akhauriyash/Code-Regression huggingface dataset:
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	private static final String LEFT = "<-";
	private static final String RIGHT = "->";

	public static void main(String[] args) {
		Pattern pt = Pattern.compile("(->|<-)?([a-z])");
		Matcher matcher = pt.matcher("");
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			matcher.reset(in.next());
			Deque<String> densya = new LinkedList<String>();
			String pre = null;
			while (matcher.find()) {
				String arrow = matcher.group(1);
				String syaryo = matcher.group(2);
				if (pre == null) {
					densya.add(syaryo);
				} else if (RIGHT.equals(arrow) && densya.peekLast().equals(pre)) {
					densya.addLast(syaryo);
				} else if (LEFT.equals(arrow) && densya.peekFirst().equals(pre)) {
					densya.addFirst(syaryo);
				}
				pre = syaryo;
			}
			for (String s : densya) {
				System.out.print(s);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#define ll long long
#define mp(a,b) make_pair(a,b)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
using namespace std;

int main(){
  int n;
  cin >> n;
  if(n>=1 &&  n<=999){
    cout << "ABC" << endl;
    // if(n>=1 && n<=9) cout << "00" << n << endl;
    // else if(n>=10 && n<=99) cout << "0" << n << endl;
    // else cout <<  n << endl;
  }
  else{
    cout << "ABD" << endl;
    // if(n>=1 && n<=9) cout << "00" << n << endl;
    // else if(n>=10 && n<=99) cout << "0" << n << endl;
    // else cout <<  n << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 			1000000007
#define tc(t) 			int t;cin >> t;while(t--)
#define for0(i , n)		for(int i=0;i<n;i++)
#define loop(i , a, b)	for(int i=a;i<=b;i++)
#define endl 			'\n'
#define inf 			1e18
#define fi 				first
#define se 				second

int XX[8] = { +1, +1, +1, 0, 0, -1, -1, -1};
int YY[8] = { +1, 0, -1, +1, -1, +1, 0, -1};
int dx[4] = { -1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

double p[3000];
vector<vector<double>> dp(3000, vector<double>(3000, -1));
int n;

double solve(int ind, int h) {
	if (ind == n) {
		if (h > (n - h)) {
			return 1.0;
		}
		return 0.0;
	}

	if (dp[ind][h] != -1) return dp[ind][h];

	return dp[ind][h] = p[ind] * solve(ind + 1, h + 1) + (1.0 - p[ind]) * solve(ind + 1, h);
}

signed main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	cin >> n;

	for0(i, n) cin >> p[i];

	cout << fixed << setprecision(11) << solve(0, 0) << endl;

	return 0;
}

Measured memory_bytes: 74496
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
int n,w,W;
LL dp[100001],v;
void maxself(LL &a, LL b){
	a=max(a,b);
}
int main(){
	cin>>n>>W;
	for(int i=0;i<n;i++){ 
		scanf("%d%lld",&w,&v);
		for(int calc=W-w;calc>=0;calc--)
			maxself(dp[calc+w],dp[calc]+v);
	}
	cout<<dp[W];
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int sheet[101][101] = {};
	int row, col;		//Value r, c;
	int i, j;

	scanf("%d%d", &row, &col);

	i = 0;
	while(i < row)
	{
		j = 0;
		while(j < col)
		{
			scanf("%d", &sheet[i][j]);
			j++;
		}
		i++;
	}

	//Calculate sheet
	i = 0;
	while(i < row)
	{
		j = 0;
		while(j < col)
		{
			sheet[i][col] += sheet[i][j];
			sheet[row][j] += sheet[i][j];
			j++;
		}
		i++;
	}

	i = 0;
	while(i < row)
	{
		sheet[row][col] += sheet[i][col];
		i++;
	}

	//Display sheet
	i = 0;
	while(i <= row)
	{
		j = 0;
		while(j <= col)
		{
			printf("%d", sheet[i][j]);
			if (j == col)
				printf("\n");
			else
				printf(" ");
			j++;
		}
		i++;
	}

	return (0);
}



Measured memory_bytes: 2072
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	cout << n * n * n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i<n;++i)
using ll = long long;
using P = pair<int,int>;

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  int ave = 0;
  rep(i,n){
    cin >> x[i];
    ave += x[i];
  }
  ave /= n;
  int ans1 = 0;
  int ans2 = 0;
  rep(i,n){
    ans1 += (x[i]-ave)*(x[i]-ave);
    ans2 += (x[i]-ave-1)*(x[i]-ave-1);
  }
  cout << min(ans1,ans2) << endl;
  return 0;
}


Measured memory_bytes: 256
n, d = map(int, input().split())
ll = [list(map(int, input().split())) for i in range(n)]

ans = 0
for i in range(n):
  for j in range(i):
    d2 = 0
    for k in range(d):
      d2 += (ll[i][k] - ll[j][k])**2
    d1 = d2 ** 0.5
    if d1 == round(d1):
      ans += 1

print(ans)

Measured memory_bytes: 3060
N = int(input())
L = [int(a) for a in input().split()]
count = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            a = L[i]
            b = L[j]
            c = L[k]
            if(a != b and b != c and c != a):
                if(a+b>c and b+c>a and c+a>b):
                    count += 1
print(count)

Measured memory_bytes: 68216
#include <bits/stdc++.h>

using namespace std;
 
const int MOD=1e9+7;




//const int MOD=998244353;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n,x,t;
    cin>>n>>x>>t;
    
    cout<<t*(n/x+(bool)(n%x));
    
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

//popcnt
int BITS[256]={0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8};
int popcnt(unsigned i){return BITS[i&255]+BITS[i>>8&255]+BITS[i>>16&255]+BITS[i>>24&255];}

ll n;
ll a[100];
ll p[100][11];
ll ans=-INF;
int main(){
	scanf("%lld",&n);
	rep(i,0,n)rep(j,0,10){
		ll t;
		scanf("%lld",&t);
		a[i]=a[i]*2+t;
	}
	rep(i,0,n)rep(j,0,11)scanf("%lld",&p[i][j]);
	
	rep(k,1,1024){
		ll rieki=0;
		rep(i,0,n)rieki+=p[i][popcnt(k&a[i])];
		ans=max(ans,rieki);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long[] B = new long[] {1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};
		int NB = B.Length;
		
		bool[] yn = new bool[NB];
		for(int i=0;i<NB;i++){
			Console.WriteLine("? {0}",B[i]);
			Console.Out.Flush();
			var ret = Console.ReadLine();
			yn[i] = ret == "Y" ? true : false;
		}
		
		bool one = true;
		for(int i=0;i<NB;i++) one &= yn[i];
		if(one){
			bool[] yn2 = new bool[NB];
			for(int i=0;i<NB;i++){
				Console.WriteLine("? {0}",2 * B[i]);
				Console.Out.Flush();
				var ret = Console.ReadLine();
				yn2[i] = ret == "Y" ? true : false;
			}
			int idx = 0;
			for(int i=0;i<NB;i++){
				if(yn2[i]){ idx = i; break;}
			}
			Console.WriteLine("! {0}",B[idx]);
			return;
		}
		
		int lidx = -1;
		for(int i=0;i<NB;i++){
			if(yn[i]) lidx = i;
		}
		
		int N = lidx + 1;
		int[] ans = new int[N];
		for(int i=0;i<N-1;i++){
			int l = i == 0 ? 1 : 0;
			int r = 10;
			while(r - l > 1){
				int c = (l+r) / 2;
				ans[i] = c;
				String s = String.Join("",ans).Substring(0,N-1);
				Console.WriteLine("? {0}",s);
				Console.Out.Flush();
				var res = Console.ReadLine();
				if(res == "Y"){
					l = c;
				} else {
					r = c;
				}
			}
			ans[i] = l;
		}
		
		bool[] yn3 = new bool[10];
		for(int i=0;i<10;i++){
			if(N == 1 && i == 0) continue;
			ans[N-1] = i;
			String s = String.Join("",ans).Substring(0,N) + "0";
			Console.WriteLine("? {0}",s);
			Console.Out.Flush();
			var res = Console.ReadLine();
			if(res == "Y"){
				Console.WriteLine("! {0}",String.Join("",ans));
				return;
			}
		}
		
		
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13608
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.{readInt, readLine};
import scala.collection.immutable.Queue;
object Main {
    def main(args: Array[String]): Unit = {
        val input1 = readLine.split(" ").map(_.toInt);
        val users = input1(0);
        val friends = input1(1);
        val ig = new IntGraph(users);
        (0 until friends).foreach { i => 
            readLine.split(" ").map(_.toInt) match {
                case Array(src, dst) => ig.add(src, dst);
                case _ => ();
            }
        }
        ig.buildConnectionList();
        (0 until readInt).foreach { i => 
            readLine.split(" ").map(_.toInt) match {
                case Array(src, dst) => if (ig.connected(src, dst)) println("yes") else println("no");
                case _ => ();
            }
        }
    }
}

class IntGraph(size: Int) {
    val matrix: Array[List[Int]] = new Array[List[Int]](size).map( e => Nil);
    val cList = new Array[Int](size).map( e => -1);
    def add(src: Int, dst: Int): Unit = {
        matrix(src) = dst :: matrix(src);
        matrix(dst) = src :: matrix(dst);
    }
    
    def buildConnectionList(): Unit = {
        def _buildConnectionList(que: Queue[Int], group: Int): Queue[Int] = {
            que.dequeueOption match {
                case None => que;
                case Some((src, restQue)) => {
                    val newQue = matrix(src).filter(dst => cList(dst) == -1).foldLeft(restQue) { (tmpQue, dst) =>
                        cList(dst) = group;
                        tmpQue.enqueue(dst);
                    }
                    _buildConnectionList(newQue, group);
                }
            }
        }
        (0 until size).foldLeft(0) { (group, i) =>
            if (cList(i) == -1) {
                cList(i) = group;
                _buildConnectionList(Queue[Int](i), group);
                group + 1;
            } else {
                group;
            }
        }
    }
    
    def connected(src: Int, dst: Int): Boolean = cList(src) == cList(dst);
}


Measured memory_bytes: 192068
import heapq

_x, _y, _z, k = map(int, input().split())
aa = list(reversed(sorted(map(int, input().split()))))
bb = list(reversed(sorted(map(int, input().split()))))
cc = list(reversed(sorted(map(int, input().split()))))

ar = []
history = set()


def push(x, y, z):
    if (x, y, z) in history:
        pass
    else:
        v = aa[x] + bb[y] + cc[z]
        heapq.heappush(ar, (-v, x, y, z))
        history.add((x, y, z))


def pop():
    (v, x, y, z) = heapq.heappop(ar)
    return (-v, x, y, z)


push(0, 0, 0)
for _ in range(k):
    (total, x, y, z) = pop()
    print(total)
    if x + 1 < len(aa):
        push(x + 1, y, z)
    if y + 1 < len(bb):
        push(x, y + 1, z)
    if z + 1 < len(cc):
        push(x, y, z + 1)


Measured memory_bytes: 4852
#include <bits/stdc++.h>
#include <math.h>
#include<cmath>
 #include <sstream> // std::stringstream
 #include <istream> // std::getline
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    for(int i = 0; i < 10; i++){
        c = a*c-b;
        cout << c << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int n;
int m;
int c;

int li[101010];

int co[101010];
int w[101010];

int main(){
    cin >> n >> m >> c;
    rep(i,1,c) cin >> li[i];
    priority_queue<P> que;
    rep(i,1,n){
        cin >> co[i] >> w[i];
        que.push({w[i],co[i]});
    }
    i64 res = 0;
    while(m > 0 && !que.empty()){
        P p = que.top();
        que.pop();
        if(li[p.second] > 0){
            res += p.first;
            m--;
            li[p.second]--;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 5796
#include<bits/stdc++.h>
#define mems(a,x) memset(a,x,sizeof(a))
#define first fi
#define second se
using namespace std;
typedef long long ll;
const int mod=1e9+7,MS=105,N=2e5+5;
ll inv(ll x){return x==1?x:(mod-mod/x)*inv(mod%x)%mod;}
ll inv(ll x,ll mod){return x==1?x:(mod-mod/x)*inv(mod%x,mod)%mod;}
ll qpow(ll a,ll n){ll ans=1;while(n){if(n&1) ans=ans*a%mod;a=a*a%mod;n>>=1;}return ans;}
ll mul(ll a,ll b){ll ans=0;while(b){if(b&1) ans=(ans+a)%mod;a=(a+a)%mod;b>>=1;};return ans;}
ll qpow(ll a,ll n,ll mod){ll ans=1;while(n){if(n&1) ans=ans*a%mod;a=a*a%mod;n>>=1;}return ans;}
ll mul(ll a,ll b,ll mod){ll ans=0;while(b){if(b&1) ans=(ans+a)%mod;a=(a+a)%mod;b>>=1;};return ans;}
struct vec
{
    double x,y;
    vec(double x=0,double y=0):x(x),y(y){}
    vec operator+(const vec&o)const{ return vec(x+o.x,y+o.y);}
    vec operator-(const vec&o)const{ return vec(x-o.x,y-o.y);}
    double operator*(const vec&o)const{ return x*o.x+y*o.y;}
    double operator^(const vec&o)const{ return x*o.y-y*o.x;}
    vec operator/(const double&o)const{ return vec(x/o,y/o);}
    vec operator*(const double&o)const{ return vec(x*o,y*o);}
    void sc(){scanf("%lf%lf",&x,&y);}
    double len(){return sqrt(x*x+y*y);}
};
struct Mat
{
    ll a[MS][MS];
    int n,m;
    Mat(int n=0,int m=0):n(n),m(m) { mems(a,0);}
    Mat operator*(const Mat&B)const
    {
        Mat C(n,B.m);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=B.m;j++)
                for(int k=1;k<=m;k++)
                C.a[i][j]=(C.a[i][j]+a[i][k]*B.a[k][j])%mod;
        return C;
    }
};
int b,w;
ll f[N],invf[N],fb[N],fw[N];
ll C(ll n,ll m)
{
    return f[n]*invf[n-m]%mod*invf[m]%mod;
}
int main()
{
    f[0]=invf[0]=f[1]=invf[1]=1;
    for(int i=1;i<N;i++)
        f[i]=f[i-1]*i%mod,invf[i]=invf[i-1]*inv(i)%mod;
    scanf("%d%d",&b,&w);
    for(int i=b;i<b+w;i++)
        fb[i]=C(i-1,b-1)*qpow(inv(2),i)%mod,(fb[i]+=fb[i-1])%=mod;
    for(int i=w;i<b+w;i++)
        fw[i]=C(i-1,w-1)*qpow(inv(2),i)%mod,(fw[i]+=fw[i-1])%=mod;
    for(int i=1;i<=b+w;i++)
    {
        ll ans=fw[i-1]+(1-fw[i-1]-fb[i-1])*inv(2)%mod;
        if(i==b+w) assert((fw[i-1]+fb[i-1])%mod==1);
        ans=(ans+mod)%mod;
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 7168
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<cassert>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[2] - a[0] << endl;
}

Measured memory_bytes: 384
function Main(input) {
    input = input.split(" ");
    A = Number(input[0]);
    B = Number(input[1]);
    C = Number(input[2]);
    can = Math.floor(B/A);
    if(C <= can) console.log(C);
    else console.log(can)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
# -*- coding: utf-8 -*-

n=int(input())  #数値入力 「N」だけの入力のとき
L=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

if max(L)< sum(L)-max(L):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);
//const ll mod = 998244353;

vector<ll> dp(440000);

int main(void)
{
    ll n, mini=INF;
    cin >> n;
    vector<ll> t(5);
    rep(i,5){
        cin >> t[i];
        mini = min(mini, t[i]);
    }
    ll ans=0, k=(n+mini-1)/mini;
    //rep(i,5) ans += (n+t[i]-1)/t[i];
    ans = 5 + k-1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6448
#include <bits/stdc++.h>
using namespace std;

ifstream in ("test.in" );
ofstream out("test.out");

const int DIM = 2e5 + 5;
const int INF = 0x3f3f3f3f;

map<int, bool> mmp[DIM];

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
    
    int n, m;
    cin >> n >> m;
    
    for (int i = 1; i <= m; ++i) {
        int x, y;
        cin >> x >> y;
        
        mmp[x][y] = true;
    }
    
    bool ok = false;
    for (int i = 2; i < n; ++i)
        ok |= (mmp[1][i] & mmp[i][n]);
    
    cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
    return 0;
}


Measured memory_bytes: 37760
x = int(input())
A = [0]*(2*10**5)
for i in range(2,len(A)):
    if A[i]==0:
        for j in range(2*i,len(A),i):
            A[j]=1
for i in range(x,len(A)):
    if A[i]==0:
        print(i);exit()

Measured memory_bytes: 69556
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()
    if A[-1] < K:
        print('IMPOSSIBLE')
        return
    from fractions import gcd
    g = A[0]
    for i in range(1,N):
        g = gcd(g,A[i])
    if K % g == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
main()

Measured memory_bytes: 81436
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fip ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define reptUsual(b) for(i=0; i<b; ++i)
#define rept(i,a,b) for(i=a; i<b; ++i)
#define pb(a) push_back(a)
#define newln cout<<"\n"
#define bigPrime 1000000007
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef pair<ll , ll> pll;
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
// continue // break // greater // string // length // while //iterator //first //second //size //begin //end
 
/*
void funct(int *dp,int *ar, int n){
    if( dp[n]!=0) return;
    else{
        int res=1;
        for(int i=n-1;i>=0;i--){
            
            if(ar[n]>ar[i]){
                funct(dp,ar,i);
                res=max(res, dp[i]+1);
            }
 
        }
        dp[n]=res;
    }
}

bool cmp(pair<int, int>& a, 
         pair<int, int>& b) 
{ 
    return a.second > b.second; 
}
*/

void dfs2(vector <vi> &v, vector<vi> &vis, vi &ancestors, int a,int b){

    
}


int dfs(vector <vi> &v, int n, vector<vi> &vis, vi &ancestors){
    int i,cnt=0;
    ancestors.pb(n);
    reptUsual(v[n].size()){
        if(vis[n][v[n][i]]==0)  {
            for(int j=0;j<ancestors.size();j++) if(ancestors[j]==v[n][i]){ dfs2(v,vis,ancestors,n,v[n][i]);}
            for(int j=0;j<ancestors.size();j++) vis[ancestors[j]][v[n][i]]=1;
            cnt+=dfs(v,v[n][i],vis,ancestors)+1;            
            
            }
    }
    return cnt;

}


int main()
{
    fip;
    ll k,i;
    cin>>k;
    if(k%2==0) {cout<<"-1";
    return 0; }
    ll fix = 10%k;
    ll sept = 7%k;
    ll sum=sept;
    for(i=1;i<=1000000;i++){
        if(sum%k==0){
            break;
        }
        sept=((sept%k * fix)%k);
        sum+= sept; 
    }
    if(sum%k==0){
        cout<<i;
        return 0;
    }
    else{ cout<<"-1";}


    return 0;
}

Measured memory_bytes: 3556
# -*- coding: utf-8 -*-
a = int(input())
lis = list(map(int, input().split()))
for i in range(a):
  judge = True
  if (lis[i] % 2 == 0):
    if (lis[i] % 3 != 0) and (lis[i] % 5 != 0):
      judge = False
      break
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	char ch;
	cin>>ch;
	if(ch>='A'&& ch<='Z')
		cout<<"A\n";
	else
		cout<<"a\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) (ll)arr.size()

using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
/*ll f[200001];
ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }*/


int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;
	int r;
	cin >> r;
	cout << 2 * PI * r;
	return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void main_()
{
    ll H, W;
    cin >> H >> W;
    vector<string> Ss;
    Ss.emplace_back(W + 2, '#');
    for (ll i = 0; i < H; i++) {
        string S;
        cin >> S;
        Ss.push_back('#' + S + '#');
    }
    Ss.emplace_back(W + 2, '#');

    vector<vector<ll>> c(H + 2, vector<ll>(W + 2));
    ll cont = 0;
    for (ll i = 1; i <= H; i++) {
        for (ll j = 0; j <= W + 1; j++) {
            if (Ss[i][j] == '.') {
                cont++;
            }
            if (Ss[i][j] == '#') {
                for (ll k = j - cont; k < j; k++) {
                    c[i][k] = cont;
                }
                cont = 0;
            }
        }
    }

    cont = 0;
    for (ll i = 1; i <= W; i++) {
        for (ll j = 0; j <= H + 1; j++) {
            if (Ss[j][i] == '.') {
                cont++;
            }
            if (Ss[j][i] == '#') {
                for (ll k = j - cont; k < j; k++) {
                    c[k][i] += cont;
                }
                cont = 0;
            }
        }
    }

    ll ans = 0;
    for (ll i = 1; i <= H; i++) {
        for (ll j = 1; j <= W; j++) {
            ans = max(ans, c[i][j] - 1);
        }
    }
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 39680
#include <bits/stdc++.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
int main(){
  	int N, A, B;
    cin >> N >> A >> B;
		if (N*A <= B){
      cout<<N*A<<endl;
    }else
    {
      cout<<B<<endl;
    }
    


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define c2(n,m) cin>>n>>m
#define c3(n,m,k) cin>>n>>m>>k
#define c4(n,m,k,l) cin>>n>>m>>k>>l
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  long b=0,c=0,d=0,e,n,m,x;
  c2(n,x);
  int a[n];
  rep(i,0,n){
    c(a[i]);
    b+=a[i];
  }
  sort(a,a+n);
  e=(x-b)/a[0];
  co(n+e);
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, l[100], x;
	cin >> n >> x;

	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}

	int d = 0;
	int a = 1;
	for (int i = 0; i < n; i++) {
		d += l[i];
		if (d > x) break;
		a++;
	}

	cout << a << endl;

	return 0;
}


Measured memory_bytes: 384
s=input()

counts=[]
count=0
for i in range(len(s)):
  if s[i]=='A'or s[i]=='T'or s[i]=='G'or s[i]=='C':
    count+=1
    if i==len(s)-1:
      counts.append(count)
  else:
    counts.append(count)
    count=0

print(max(counts))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	static final int MOD = 1000000007;

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int M = sc.nextInt();
		boolean[] hole = new boolean[N+1];
		for(int i=0; i<N+1; i++) {
			hole[i] = true;
		}
		
		int[] a = new int[M];
		
		for(int i=0; i<M; i++) {
			a[i] = sc.nextInt();
			hole[a[i]] = false;
		}
		
		int[] dp = new int[N+1];
		dp[0] = 1;
		if(hole[1]) {dp[1]=1;}
		for(int i=2; i<=N; i++) {
			if(hole[i-1]) {dp[i] = (dp[i] + dp[i-1])%MOD ;}
			if(hole[i-2]) {dp[i] = (dp[i] + dp[i-2])%MOD ;}
		}
		
		System.out.println(dp[N]);
	}
}


Measured memory_bytes: 46456
#include<stdio.h>

int N,s[100000];

int binarySearch(int key){
  int left=0;
  int right=N;
  int mid;

  while(left<right){
    mid=(left+right)/2;
    if(key==s[mid])return 1;
    if(key>s[mid])left=mid+1;
    else if(key<s[mid])right=mid;
  }
  return 0;
}

int main(){

  int i,key,N2,c=0;
  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&s[i]);
  }

  scanf("%d",&N2);

  for(i=0;i<N2;i++){
    scanf("%d",&key);
    if(binarySearch(key))c++;

  }

  printf("%d\n",c);


  return 0;
}


Measured memory_bytes: 2128
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int main()
{
	int num;
	scanf("%d", &num);
	ll ans = 1;
	int cnt = 0;
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		cnt++;
		if (cnt * 2 - 1 > z)
		{
			ans *= cnt;
			ans %= mod;
			cnt--;
		}
	}
	for (int i = 1; i <= cnt; i++)ans = ans*i%mod;
	printf("%lld\n", ans);
}

Measured memory_bytes: 128
from math import sqrt, ceil

N = int(input())
ans = 0
for n in range(1, N+1, 2):
    count = 0
    for i in range(1, ceil(sqrt(n))+1):
        if n%i == 0:
            count += 2
    if count == 8:
        ans += 1
print(ans)



Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    private static final long MOD = 1000000007;
    int n;
    char[] s1, s2;
    boolean[] isRow;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    private void read() {
        try (BufferedReader br = new BufferedReader(
                new InputStreamReader(System.in)
        )) {
            n = Integer.parseInt(br.readLine());
            s1 = br.readLine().toCharArray();
            s2 = br.readLine().toCharArray();
            isRow = new boolean[n];
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void solve() {
        int i = 0;
        while (i < n) {
            if (i+1 < n && s1[i] == s1[i+1]) {
                isRow[i] = true;
                isRow[i+1] = true;
                i += 2;
            }
            else if (s1[i] == s2[i]){
                isRow[i] = false;
                i++;
            }
            else {
                isRow[i] = true;
            }
        }
        long ans = 1L;
        if (isRow[0]) {
            ans = 6L;
            i = 2;
        }else {
            ans = 3L;
            i = 1;
        }
        while (i < n) {
            if (isRow[i]) {
                if(isRow[i-1])
                    ans = modCalc(ans, 3);
                else
                    ans = modCalc(ans, 2);
                i += 2;
            }
            else {
                if(!isRow[i-1])
                    ans = modCalc(ans, 2);
                i++;
            }
        }
        System.out.println(ans);
    }

    private long modCalc(long l1, long l2) {
        return (l1 * l2) % MOD;
    }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,r=300000;
  string s;
  cin>>n>>s;
  vector<int> c;
  bool col=false;
  int ncol=0;
  for(int i=0;i<n;++i){
    if(s[i]=='#'){
      if(col)ncol++;
      else{
        c.push_back(ncol);
        ncol=1;
        col=true;
      }
    }
    else{
      if(!col)ncol++;
      else{
        c.push_back(ncol);
        ncol=1;
        col=false;
      }
    }
  }
  if(ncol)c.push_back(ncol);
  if(!col)c.push_back(0);
  int b=0,w=0;
  for(int i=1;i<(int)c.size()-1;i+=2)b+=c[i];
  for(int i=(int)c.size()-2;i>0;i-=2)w+=c[i];
  vector<int> vb((int)c.size()/2,0),vw((int)c.size()/2,0);
  vw[0]=c[0];
  vb[0]=c[1];
  for(int i=2;i<(int)c.size();++i){
    if(i%2)vb[i/2]=vb[i/2-1]+c[i];
    else vw[i/2]=c[i];
  }
  reverse(vw.begin(),vw.end());
  for(int i=1;i<(int)vw.size();++i)vw[i]+=vw[i-1];
  vb[(int)vb.size()-1]=0;
  vw[(int)vb.size()-1]=0;
  sort(vb.begin(),vb.end());
  sort(vw.begin(),vw.end(),greater<>());
  for(int i=0;i<(int)vw.size();i++){
    r=min(r,vw[i]+vb[i]);
  }
  cout<<r;
  return 0;
}

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define int long long int

void test()
{
   int n;
   cin>>n;
   if(n%2==0)
   {
       cout<<n<<endl;
       return;
   }
   else
   {
       cout<<n*2<<endl;
   }
}
int32_t main()
{

    int t = 1;
    // cin >> t;
    while (t--)
    {
        test();
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

LL modpow(LL base, LL p) {
	if (p == 0)return 1;
	if (p == 1)return base;
	LL ans = modpow(base, p >> 1);
	ans *= ans;
	if (p & 1)ans *= base;
	return ans % 2019;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string sori;
	cin >> sori;
	VLL S(sori.size() + 2, 0);
	LL N = sori.size();
	S[N] = sori.back() - '0';
	for (LL n = N - 1; n > 0; n--) {
		S[n] = (S[n + 1] + modpow(10, N - n) * (sori[n - 1] - '0')) % 2019;
	}
	VLL count(2019,0);
	count[0] = 1;
	LL ans = 0;
	for (LL n = N; n >= 1; n--) {
		ans += count[S[n]];
		count[S[n]]++;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 4644
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a;
  cin >> a;
  int b[a];
  int i;
  int j;
  int max = 0;
  int max2;
  
  for(i = 0; i < a; i++){
    cin >> b[i];
  }
  for(i = 0; i < a; i++){
    if(max <= b[i]){
      max2 = max;
      max = b[i];
    }
    else if(b[i] > max2){
      max2 = b[i];
    }
  }
  for(i = 0; i < a; i++){
    if(b[i] != max){
      cout << max << endl;
    }
    else{
      cout << max2 << endl;
    }
  }
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	string a, b, c;
	cin >> a >> b >> c;
	if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl;
#define STOP assert(false);
#else
#define dump(x) ;
#define LINE 	;
#define dumpV(v);
#define STOP 	;
#endif

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


vector<string> split(const string& s, char c = ' ') {
	vector<string> ret;
	stringstream ss(s);
	string t;
	while(getline(ss, t, c)) ret.push_back(t);
	return ret;
}

int main(){
	string s, t;
	while(cin >> s) {
		if(s == ".") break;
		cin >> t;
		if(s == t) {
			cout << "IDENTICAL" << endl;
			continue;
		}
		auto vs = split(s, '\"');
		auto vt = split(t, '\"');
		if(vs.size() != vt.size()) {
			cout << "DIFFERENT" << endl;
			continue;
		}
		int diff = 0;
		for(int i = 0; i < vs.size(); i+= 2) {
			if(vs[i] != vt[i]) diff++;
		}
		if(diff > 0) {
			cout << "DIFFERENT" << endl;
			continue;
		}
		for(int i = 1; i < vs.size(); i += 2) {
			if(vs[i] != vt[i]) diff++;
		}
		cout << (diff == 1 ? "CLOSE" : "DIFFERENT") << endl;
	}
	return 0;
}

Measured memory_bytes: 3172
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
typedef vector<int> vi;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0;i<3;i++)
    {   int c=0;
        while(s[i] == 'R')
        {
            i++;
            c++;
        }
        ans =max(c,ans);
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
int main(){
  int n;
  while(cin >> n, n){
    vector<pair<int,string>> V;
    for(int i = 0; i < n; ++i){
      string id;
      cin >> id;
      int t = 0;
      for(int i = 0; i < 4; ++i){
        int m, s;
        cin >> m >> s;
        t += m*60 + s;
      }
      V.emplace_back(t,id);
    }
    sort(V.begin(),V.end());
    cout << V[0].second << endl;
    cout << V[1].second << endl;
    cout << V[n-2].second << endl;
  }
}



Measured memory_bytes: 3404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

ll dp[10000];
ll conv(ll i){
    if(i == 1) return 2;
    if(i == 2) return 5;
    if(i == 3) return 5;
    if(i == 4) return 4;
    if(i == 5) return 5;
    if(i == 6) return 6;
    if(i == 7) return 3;
    if(i == 8) return 7;
    if(i == 9) return 6;
}

int main(void){
    ll n, m;
    cin >> n >> m;

    ll a[m];
    rep(i, 0, m){
        cin >> a[i];
    }
    sort(a, a + m, greater<ll>());

    rep(i, 0, n + 1){
        rep(j, 0, m){
            if(i - conv(a[j]) < 0){
                continue;
            }else{
                if(i - conv(a[j]) == 0 || dp[i - conv(a[j])] != 0){
                    dp[i] = max(dp[i - conv(a[j])] + 1, dp[i]);
                }
            }
        }
    }

    ll tmp = n;
    rrep(i, dp[n], 1){
        rep(j, 0, m){
            if(tmp - conv(a[j]) >= 0){
                if(i == 1){
                    if(tmp - conv(a[j]) == 0){
                        cout << a[j];
                        break;
                    }
                }else if(dp[tmp - conv(a[j])] == i - 1){
                    tmp -= conv(a[j]);
                    cout << a[j];
                    continue;
                }
            }
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3816
#include <iostream>
#include <string>

using namespace std;

int main(){
  int ans;
  string S;
  string days[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  cin >> S;
  for(int i=0; i<7; i++){
    if(days[i] == S) ans = 7-i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let rec gcd a b = if b = 0 then a else gcd b (a mod b) in
    let agcd a b = gcd (abs a) (abs b) in

    let module M = Map.Make (struct type t = int * int let compare = compare end) in

    let rec loop i map a0 b0 c0 d0 e0 =
        if i = n then map, a0, b0, c0, d0, e0 else
            let a, b = Scanf.scanf " %d %d" (fun a b -> a, b) in
            if a = 0 && b = 0 then loop (i + 1) map a0 b0 (c0 + 1) d0 e0 else
            if a = 0 then loop (i + 1) map (a0 + 1) b0 c0 d0 e0 else
            if b = 0 then loop (i + 1) map a0 (b0 + 1) c0 d0 e0 else
            if a = b then loop (i + 1) map a0 b0 c0 (d0 + 1) e0 else
            if a = -b then loop (i + 1) map a0 b0 c0 d0 (e0 + 1) else
            let g = agcd a b in
            let a = a / g in
            let b = b / g in
            let flag = if a < 0 && b < 0 || a > 0 && b > 0 then 2 else 0 in
            let flag = if abs a < abs b then flag + 1 else flag in
            let key = if abs a < abs b then abs a, abs b else abs b, abs a in
            let (ca, cb, cc, cd) = try M.find key map with _ -> 0, 0, 0, 0 in
            let abcd = if flag = 0 then ca + 1, cb, cc, cd else
                       if flag = 1 then ca, cb + 1, cc, cd else
                       if flag = 2 then ca, cb, cc + 1, cd else
                                        ca, cb, cc, cd + 1
            in
            let map = M.add key abcd map in
            loop (i + 1) map a0 b0 c0 d0 e0
    in
    let map, a0, b0, c0, d0, e0 = loop 0 M.empty 0 0 0 0 0 in
    let m = 1_000_000_007 in
    let ( +@) a b = (a + b) mod m in
    let ( -@) a b = (((a - b) mod m) + m) mod m in
    let ( *@) a b = (a * b) mod m in

    let powmod a b =
        let rec loop r i acc =
            if i = 0 then acc else
                loop (r *@ r) (i lsr 1) (if i land 1 = 1 then r *@ acc else acc)
        in
        loop a b 1
    in

    let ans1 =
        M.fold (fun (k1, k2) (ca, cb, cc, cd) acc ->
            (powmod 2 ca +@ powmod 2 cd -@ 1) *@ (powmod 2 cb +@ powmod 2 cc -@ 1) *@ acc
        ) map 1
    in
    let ans2 = ans1 *@ (powmod 2 d0 +@ powmod 2 e0 -@ 1) in
    let ans3 = ans2 *@ (powmod 2 a0 +@ powmod 2 b0 -@ 1) in
    let ans4 = ans3 + c0 in
                       Printf.printf "%d\n" (ans4 -@ 1)
)


Measured memory_bytes: 42764
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int H,W,m = 1000000007;
	cin >> H >> W;
	vector<vector<char> > grid(H,vector<char>(W));
	for(int i=0 ; i<H ; i++)
		for(int j=0 ; j<W ; j++)
			cin >> grid[i][j];
	// cout << "Hi" << endl;
	vector<vector<int> > path(H,vector<int>(W,0));
	int k=1;
	if(grid[0][0]=='.')
		path[0][0] = 1;
	while(k<H)
	{
		if(grid[k][0] == '.')
			path[k][0] = path[k-1][0];
		k++;
	}
	k=1;
	while(k<W)
	{
		if(grid[0][k] == '.')
			path[0][k] = path[0][k-1];
		k++;
	}
	for(int i=1 ; i<H ; i++)
		for(int j=1 ; j<W ; j++)
		{
			if(grid[i][j]=='.')
				path[i][j] = (path[i-1][j] + path[i][j-1])%m;
		}
	cout << path[H-1][W-1] << endl;
	return 0;
}

Measured memory_bytes: 5248
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] A = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                A[i][j] = Integer.parseInt(sc.next());
            }
        }

        int N = Integer.parseInt(sc.next());
        int[] b = new int[N];

        for (int i = 0; i < N; i++) {
            b[i] = Integer.parseInt(sc.next());
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < N; k++) {
                    if (A[i][j] == b[k]) {
                        A[i][j] = -1;
                    }
                }
            }
        }

        PrintWriter out = new PrintWriter(System.out);

        for (int i = 0; i < 3; i++) {
            if (A[i][0] == -1 && A[i][1] == -1 && A[i][2] == -1) {
                out.println("Yes");
                out.flush();
                sc.close();
                return;
            }
        }

        for (int j = 0; j < 3; j++) {
            if (A[0][j] == -1 && A[1][j] == -1 && A[2][j] == -1) {
                out.println("Yes");
                out.flush();
                sc.close();
                return;
            }
        }

        if (A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1
                || A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1) {
            out.println("Yes");
            out.flush();
            sc.close();
            return;
        }

        out.println("No");
        out.flush();
        sc.close();
    }
}

Measured memory_bytes: 35652
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main () {
    // input
    string W;
    cin >> W;

    string str;
    int num = 0;
    while ( cin >> str ) {
        std::transform( str.begin(), str.end(), str.begin(), ::tolower );
        if (W == str) {
            num += 1;
        }
    }
    
    // think
    
    // output
    cout << num << endl;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N;
    cin >> N;
    int Ai;
    set<pair<int, int>> s;
    for(int i=0;i<N;i++){
        cin >> Ai;
        s.insert(make_pair(min(i, Ai-1), max(i,Ai-1)));
    }
    cout<<(N-s.size())<<endl;

    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

int n, m, a, b;
string ans[1080];

void tate(int x, int y){
  ans[x][y] = '^';
  ans[x+1][y] = 'v';
}

void yoko(int x, int y){
  ans[x][y] = '<';
  ans[x][y+1] = '>';
}

int main(){
  cin >> n >> m >> a >> b;
  for(int i = 0;i < n;i++)
    for(int j = 0;j < m;j++)
      ans[i] += ".";
  
  if(n % 2 == 1){
    for(int i = 0;i+1 < m;i+=2){
      if(a == 0)break;
      yoko(n-1,i);a--;
    }
  }
  
  if(m % 2 == 1){
    for(int i = 0;i+1 < n;i+=2){
      if(b == 0)break;
      tate(i, m-1);b--;
    }
  }

  for(int i = 0;i+1 < n;i+=2){
    for(int j = 0;j+1 < m;j+=2){
      if(a >= 2){
	yoko(i,j);
	yoko(i+1,j);
	a-=2;
      }
      else if(b >= 2){
	tate(i,j);
	tate(i,j+1);
	b-=2;
      }
      else if(a>0){
	yoko(i,j);
	a--;
      }
      else if(b>0){
	tate(i,j);
	b--;
      }
    }
  }

  if(b == 1 && n * m % 2 == 1 && ans[n-2][m-2] == '.'){
    tate(n-2,m-3);
    yoko(n-1, m-2);
    b--;
  }

  if(a > 0 || b > 0){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
    for(int i = 0;i < n;i++)cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;

int main(){
  string s;
  cin >> s;
  int x=1;
  bool ans=false;
  vector<int> count(0);
  sort(s.begin(),s.end());
  for(int i=1;i<=s.size();i++){
    if(s[i-1]==s[i]){
      x++;
    }else{
      count.push_back(x);
      x=1;
    }
  }
  for(int i=0;i<count.size();i++){
    if(count[i]%2==1){
      ans=false;
      break;
    }else{
      ans=true;
      continue;
    }
  }
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N,K=map(int,input().split())

blue=K
red=N-K

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

ans=0
m=(10**9+7)
pat=1
#3C1 3C2
for i in range(1,K+1):
    pat=pat*(red+1-i+1)%m
    pat=pat*mod_inv(i,m)%m
    if i==1:
        pat2=1
    else:
        pat2=pat2*(K-i+1)%m
        pat2=pat2*mod_inv(max(i-1,0),m)%m
    print(pat*pat2%m)
    
    

    

Measured memory_bytes: 3444
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  if ((b - a) % 2 == 0) {
    cout << (b - a) / 2 << endl;
  } else {
    cout << min(a - 1, n - b) + 1 + (b - a - 1) / 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 764