akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define inf 10000000
ll h[100005];
ll fr[100005];
ll n;
ll k;
// ll ans;

// ll mn=0;

int frg( int cr )
{
	ll ans;
	ll mn = INT_MAX;
	if(cr==n) return 0;
	if(cr>n) return inf;

   if (fr[cr]!=-1)
   {
   	return fr[cr];
   }
   for (int i = 1; i <= k; ++i)
   {
   	 ans=abs(h[cr]-h[cr+i])+frg(cr+i);
   	 if(mn>ans)
   	 	mn=ans;
   }

	return fr[cr]=mn;
}


int main()
{

	cin>>n>>k;
	// memset(h, 0, sizeof(n));
	memset(fr, -1, sizeof(fr));
	for (int i = 1; i <= n; ++i)
	{
		cin>>h[i];
	}
	ll an=frg(1);
	cout<<an;
	
	
    return 0;
}

Measured memory_bytes: 6528
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

		while (true) {
			final int n = sc.nextInt();
			final int x = sc.nextInt();
			
			if(n == 0 && x == 0){
				break;
			}
			
			int count = 0;
			for(int i = 1; i <= n; i++){
				for(int j = i + 1; j <= n; j++){
					for(int k = j + 1; k <= n; k++){
						if(i + j + k == x){
							count++;
						}
					}
				}
			}
			
			System.out.println(count);
		}
	}

}

Measured memory_bytes: 19808
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, a: "List[int]", b: "List[int]"):
    conn = [[] for _ in range(N)]
    for i in range(N - 1):
        conn[a[i] - 1].append(b[i] - 1)
        conn[b[i] - 1].append(a[i] - 1)

    def dfs(idx, cur, conn, dis):
        dis[idx] = cur
        for nex in conn[idx]:
            if dis[nex] is None:
                dfs(nex, cur + 1, conn, dis)
        return None

    f_dis = [None] * N
    f_dis[0] = 0
    dfs(0, 0, conn, f_dis)

    s_dis = [None] * N
    s_dis[N - 1] = 0
    dfs(N - 1, 0, conn, s_dis)

    cnt = 0
    for i in range(N):
        if f_dis[i] <= s_dis[i]:
            cnt += 1

    if cnt > (N - cnt):
        ret = 'Fennec'
    else:
        ret = 'Snuke'
    print(ret)
    return


def _solve(N: int, a: "List[int]", b: "List[int]"):
    conn = [[] for _ in range(N)]
    for i in range(N - 1):
        conn[a[i] - 1].append(b[i] - 1)
        conn[b[i] - 1].append(a[i] - 1)

    def find_path(idx, target, conn, visited):
        visited[idx] = True
        if idx == target:
            return [target]
        for nex in conn[idx]:
            if not visited[nex]:
                path = find_path(nex, target, conn, visited)
                if path is not None:
                    return [idx] + path
        return None

    visited = [False] * N
    path_to_n = find_path(0, N - 1, conn, visited)
    #print(path_to_n)

    colors = [None] * N
    for i, node in enumerate(path_to_n):
        if i < (len(path_to_n) + 1) // 2:
            colors[node] = 1
        else:
            colors[node] = 0

    def dfs(idx, conn, colors, visited):
        visited[idx] = True
        colors[idx] = 1
        for nex in conn[idx]:
            if not visited[nex] and (colors[nex] is None or colors[nex] == 1):
                dfs(nex, conn, colors, visited)
        return

    visited = [False] * N
    dfs(0, conn, colors, visited)
    #print(colors)

    cnt = 0
    for c in colors:
        if c == 1:
            cnt += 1
    if cnt > (N - cnt):
        ret = 'Fennec'
    else:
        ret = 'Snuke'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N-1)  # type: "List[int]" 
    b = [int()] * (N-1)  # type: "List[int]" 
    for i in range(N-1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 144064
/*
 * 	Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid to fall...
*/
#include<bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

void solve()
{
  set<char> s;
  string  st;
  cin >> st;
  f(i,st.length())
  {
    s.insert(st[i]);
  }
  if(s.size()>1)
    cout << "Yes";
  else
    cout << "No";
  return;
}

signed main()
{
  FAST;
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
    return 0;
}

Measured memory_bytes: 256
n = int(input())
cards, suits = [], ["S", "H", "C", "D"]
for suit in suits:
    for x in range(1, 14):
        cards.append('{} {}'.format(suit, x))

for _ in range(n):
    target = ' '.join(input().split())
    if target in cards:
        cards.remove(target)

[print(c) for c in cards]


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

int main() {
  ll k,a,b;

  cin >> k >> a >> b;

  rep(i,1000) {
    if (((i+1)*k <= b)&&((i+1)*k >= a)) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
long long a,b,c,s[100];
int main()
{
	cin>>a>>b>>c;
	s[a]++;
	s[b]++;
	s[c]++;
	if(s[5]==2&&s[7]==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
	int i,j,n,b,sum,mini_num,mini;
	cin>>n;
	int a[200],c[200];
	sum=0;
	for(i=0;i<2*n;i++){
		cin>>a[i];
	}
	for(i=0;i<2*n;i++){
		mini=0;
		for(j=0;j<2*n;j++){
		if(mini<a[j]){
			mini=a[j];
			mini_num=j;
		}
		}
		c[i]=mini;
		a[mini_num]=-1;
	}
	for(i=0;i<n;i++){
		sum=sum+c[i*2+1];
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <math.h>
using namespace std;
int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int turn_A = ceil((double) A/D);
    int turn_T = ceil((double) C/B);
    if (turn_A < turn_T ) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
} 

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

#define FS0 fs[v[0]]
#define FS1 fs[v[1]]

void rollv(int v[], int h[]) {
    int t = v[0];
    v[0] = v[1];
    v[1] = v[2];
    v[2] = v[3];
    v[3] = t;

    h[0] = v[1];
    h[2] = v[3];
}

void rollh(int v[], int h[]) {
    int t = h[0];
    h[0] = h[1];
    h[1] = h[2];
    h[2] = h[3];
    h[3] = t;

    v[1] = h[0];
    v[3] = h[2];
}

void init(int v[], int h[], int fs[]) {
    v[0] = fs[0]; v[1] = fs[1]; v[2] = fs[5]; v[3] = fs[4];
    h[0] = fs[1]; h[1] = fs[2]; h[2] = fs[4]; h[3] = fs[3];
}

int main() {
    int v[4];
    int h[4];
    int fs[6];
    int q, t, f;
    int hit;

    for (int i=0; i<6; ++i) {
        cin>>fs[i];
    }
    init(v, h, fs);

    cin>>q;

    for (int i=0; i<q; ++i) {
        cin>>t>>f;

        int h_ok = 0;
        for (int j=0; j<4; ++j) {
            int i1 = h[j];
            if (i1 == f) {
                h_ok = 1; break;
            }
        }
        if (!h_ok) {
            rollh(v, h);
        }

        for (int j=0; j<4; j++) {
            int i1 = v[0];
            if (i1 == t) { break; }
            rollv(v, h);
        }
        for (int j=0; j<4; j++) {
            int i1 = v[1];
            if (i1 == f) { break; }
            rollh(v, h);
        }

        cout<<h[1]<<endl;
    }

    return 0;
}



Measured memory_bytes: 3068
// 4/N = 1/h + 1/n + 1/w
// 4hnw = N(nw + hw + hn)
// 120_000_000_000
// 4hnw-Nnw-Nhw = Nhn
// w(4hn-Nn-Nh) = Nhn

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    for (int h = 1; h <= 3500; h++) {
      for (int n = 1; n <= 3500; n++) {
        long a = (long)N*h*n;
        long b = (long)4*h*n-(long)N*n-(long)N*h;
        if (b != 0 && a%b == 0
            && 1 <= a/b && a/b <= 3500) {
          System.out.println(h+" "+n+" "+a/b);
          return;
        }
      }
    }
  }
}

Measured memory_bytes: 22740
from itertools import combinations


def solve(n, m, q, q_list):

    res_max = 0

    # 0-1
    a_list = [0] * n
    for com in combinations(range(n + m - 1), n):

        for i, c in enumerate(com):
            if i == 0:
                a_list[i] = c + 1
            else:
                a_list[i] = a_list[i - 1] + c - com[i - 1] - 1
        # print(a_list)
        res = 0
        for i in range(q):
            a, b, c, d = q_list[i]
            if a_list[b - 1] - a_list[a - 1] == c:
                res += d

        if res > res_max:
            res_max = res
    # print(res_max)
    return res_max


def main():
    n, m, q = map(int, input().split())
    q_list = [list(map(int, input().split())) for _ in range(q)]
    res = solve(n, m, q, q_list)
    print(res)


def test():
    assert solve(3, 4, 3, [[1, 3, 3, 100], [1, 2, 2, 10], [2, 3, 2, 10]]) == 110
    assert solve(4, 6, 10, [
        [2, 4, 1, 86568], [1, 4, 0, 90629], [2, 3, 0, 90310], [3, 4, 1, 29211], [3, 4, 3, 78537],
        [3, 4, 2, 8580], [1, 2, 1, 96263], [1, 4, 2, 2156], [1, 2, 0, 94325], [1, 4, 3, 94328]
    ]) == 357500
    assert solve(10, 10, 1, [[1, 10, 9, 1]]) == 1


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 9320
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1000010
#define mod 998244353
#define inv2 ((mod+1)/2)
using namespace std;
int mu[N],pr[N],cnt;
int f1[N],f2[N],g[N];
bool p[N];
void pre(int n)
{
    mu[1]=1;
    for(int i=2;i<=n;i++)
    {
        if(!p[i]) pr[++cnt]=i,mu[i]=-1;
        for(int j=1;j<=cnt && i*pr[j]<=n;j++)
        {
            p[i*pr[j]]=1;
            if(i%pr[j]==0){mu[i*pr[j]]=0;break;}
            mu[i*pr[j]]=mod-mu[i];
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=2;1ll*i*j<=n;j++) f1[i]=(f1[i]+f1[1ll*i*j])%mod,f2[i]=(f2[i]+f2[1ll*i*j])%mod;
        g[i]=1ll*(1ll*f1[i]*f1[i]%mod-f2[i]+mod)*inv2%mod;
    }
}
int inv[N];
int main()
{
    int n,m=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int a;
        scanf("%d",&a);
        f1[a]=(f1[a]+a)%mod;
        f2[a]=(f2[a]+1ll*a*a)%mod;
        m=max(m,a);
    }
    inv[1]=1;
    for(int i=2;i<=m;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
    pre(m);
    int res=0;
    for(int i=1;i<=m;i++)
        for(int j=1;1ll*i*j<=m;j++) res=(res+1ll*inv[i]*mu[j]%mod*g[1ll*i*j]%mod+mod)%mod;
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 24628
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
//#include <map>
using namespace std;

struct Point {
  int x, y;
  Point() {}
  Point(int x, int y) : x(x), y(y) {}
  
  Point operator + (const Point &a) {
	return Point(x - a.x, y - a.y);
  }
  Point operator - (const Point &a) {
	return Point(x - a.x, y - a.y);
  }
  
  Point operator - () {
	return Point(-x, -y);
  }
  /*
  bool operator == (const Point &a) {
	return x==a.x && y==a.y;
  }
  */
  
  double norm() {
	return x*x+y*y;
  }
};

typedef Point Vector;

Vector rotate90R(Vector V) {
  return Vector(V.y, -V.x);
}

bool isIn(int x, int y) {
  return 0<=x && x<=5000 && 0<=y && y<=5000;
}

bool exist[5002][5002];

int main() {
  int n;
  int x, y;
  while(cin >> n && n) {

  	vector<Point> vec;
	fill(exist[0], exist[5001], false);

	for(int i=0; i<n; i++) {
	  cin >> x >> y;
	  vec.push_back(Point(x, y));
	  exist[y][x] = true;
 	}
	int ans = 0;
	
	for(int i=0; i<n-1; i++) {
	  for(int j=i+1; j<n; j++) {
		Vector V1 = vec[i] - vec[j];
		Vector V3 = rotate90R(V1);
		Vector V4 = -rotate90R(V1);
		int area = V1.norm();
		
		int vy1 = (vec[j]+V3).y, vx1 = (vec[j]+V3).x;
		int vy2 = (vec[i]+V3).y, vx2 = (vec[i]+V3).x;
		if(isIn(vx1, vy1) && isIn(vx2, vy2))
		  if(exist[vy1][vx1] && exist[vy2][vx2])
			ans = max(ans, area);
		
		vy1 = (vec[j]+V4).y, vx1 = (vec[j]+V4).x;
		vy2 = (vec[i]+V4).y, vx2 = (vec[i]+V4).x;
		if(isIn(vx1, vy1) && isIn(vx2, vy2))
		  if(exist[vy1][vx1] && exist[vy2][vx2])
			ans = max(ans, area);
	  }
	}
	cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 25684
/*
Rathin Bhargava
IIIT Bangalore

*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

ll max(ll x, ll y)
{
  if(x>y) return x;
  return y;
}

int main()
{
  __;
  int n,w;
  cin >> n >> w;
  vector<vector<ll> > dp(2,vector<ll> (w+1));

  // Base Case
  int weight,value;
  cin >> weight >> value;
  dp[0][weight] = value;

  // Recurrence
  for(int i=1;i<n;i++)
  {
    int weight,value;
    cin >> weight >> value;
    int par = i&1;

    for(int j=0;j<=w;j++)
    {
      ll a = (j>=weight ? dp[par^1][j-weight] + value: 0);
      dp[par][j] = max(a,dp[par^1][j]);
    }
  }

  ll ans = -1;
  for(int i=0;i<=w;i++) 
  {
    int par = (n-1)&1;
    ans = max(ans,dp[par][i]);
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 2560
#!/usr/bin/env python
# coding: utf-8
#
    
def main(n, m):
    for i in range(n - 1):
        if m[i][-1] != m[i+1][0]:
            # print('No {} {} {}'.format(i, m[i][-1], m[i+1][0]))
            print('No')
            return
        
    if len(set(m)) != len(m):
        # print(len(check), len(m))
        print('No')
        return

    print('Yes')
    
        
if __name__ == '__main__':
    try:
        n  = int(input().strip())
        moji = []
        for i in range(n):
            moji.append(str(input().strip()))
        main(n, moji)
    except EOFError:
        pass


Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    int n,m;
    cin >> n >> m;

    vector<vector<int>> s(m);

    for(int i=0;i<m;i++){
        int k;
        cin >> k;
        for(int j=0;j<k;j++){
            int a;
            cin >>a;
            s[i].push_back(a);
        } 
    }

    int p[m];

    for(int i=0;i<m;i++)cin >> p[i];

    int S=0;
    
    for(int b=0;b<(1<<n);b++){
        int l=0;
        for(int i=0;i<m;i++){
            int t=0;
            for(int j=0;j<s[i].size();j++){
                if(b&(1<<s[i][j]-1)) t++;
            }
            if(t%2==p[i])l++;
        }
        if(l==m)S++;
    }

    cout << S << endl;


}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n % 2 == 0){
        if(s.substr(0, n/2) == s.substr(n/2)){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N = int(input())
a = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(gcd(gcd_l[-1], a[i]))
gcd_l += [0]

for i in range(N - 1, -1, -1):
    gcd_r.append(gcd(gcd_r[-1], a[i]))
gcd_r += [0]
gcd_r = gcd_r[::-1]
# gcd_x[idx]:=idx番目までの累積gcd, 1-indexed
# [0] + [gcd] + [0]
# index: 0, 1, ..., N, N+1

g = 1
for i in range(1, N + 1):
    # i: 1-indexed
    g_l = gcd_l[i - 1]
    g_r = gcd_r[i + 1]
    g = max(g, gcd(g_l, g_r))
print(g)


Measured memory_bytes: 14436
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    int n;cin >> n;
    ll ans = n % 1000;
    if(ans==0)cout << ans << endl;
    else cout << 1000-ans << endl;
}//https://atcoder.jp/contests/abc173/tasks/abc173_a

Measured memory_bytes: 3640
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))

max_d = 0
max_idx = 0
D = []
for i in range(N - 1):
    D.append(min(abs(A[i + 1] - A[i]), abs(A[i] + (K - A[i + 1]))))
    if D[i] > max_d:
        max_d = D[i]
        max_idx = i
D.append(min(abs(A[N - 1] - A[0]), abs(A[0] + (K - A[N - 1]))))
if D[N - 1] > max_d:
    max_idx = N - 1

res = 0
for i in range(N):
    if i != max_idx:
        res += D[i]
print(res)


Measured memory_bytes: 32272
from collections import deque
import time

zuru = time.time()
N = int(input())
A = [deque(map(int,input().split())) for _ in range(N)]
match = 0
que = [0 for _ in range(N+1)]

for day in range(1, (N-1) * N // 2 + 1):
  tsumi = True
  for i in range(1,N+1):
    if que[i]==0 and A[i-1]!=deque():
      que[i] = A[i-1].popleft()
  for i in range(1,N+1):
    if que[i]!=0 and que[que[i]]==i:    
      que[que[i]] = 0
      que[i] = 0
      match += 1
      tsumi = False
  if tsumi:
    ans = -1
    break
  if match==(N-1) * N / 2:
    ans = day
    break
  if time.time()-zuru > 1.5:
    ans = N*(N-1)//2
    break
print(ans)


Measured memory_bytes: 36096
s = input()
flag = 1
if s[0] == "A":
    tmp = s[2:-1].find("C")
    if tmp >= 0:
        tmp2 = s[1]
        tmp2 += s[2:tmp+2]
        tmp2 += s[tmp+3:]
        if tmp2 == tmp2.lower():
            flag = 0
if flag == 0:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
	    int[] nums = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        if(nums[0]+nums[1] >= 10) Console.WriteLine("error");
        else Console.WriteLine(nums[0]+nums[1] );
	} 
}

Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define FOR(i,n) for(int i = 0; i < n; i++)
#define FORa(i,a,b) for(int i = a; i < b; i++)
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define SORT(a,n) sort(begin(a), begin(a) + n)
#define VSORT(v) sort(v.begin(), v.end())
#define MAX 1000000
#define ll long long
#define LOW(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define UP(s) transform(s.begin(),s.end(),s.begin(),::toupper)

//-------------------------------------------------------//

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


Measured memory_bytes: 3908
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#define ll long long
using namespace std;

vector<ll> fct, invfct; 

ll mod_pow(ll n, ll p, ll mod){
    if(p==0) return 1;
    ll res = mod_pow(n*n%mod, p/2, mod);
    if(p%2==1) res = res * n % mod;
    return res;
}

ll Comb(ll n, ll k, ll mod){
    ll res = fct[n];
    res = res * invfct[n-k] % mod;
    res = res * invfct[k] % mod;
    // cerr << n << " " << k << " " << res << endl;
    return res;
}

int main(){
    int N, M, K;
    cin >> N >> M >> K;
    ll mod = 1e9+7;
    fct = vector<ll>(N*M+1,1);
    for(ll i=1; i<=N*M; i++){
        fct[i] = i * fct[i-1] % mod;
    }

    invfct = vector<ll>(N*M+1,1);
    invfct[N*M] = mod_pow(fct[N*M], mod-2, mod) % mod;
    // cout << N*M << " " << invfct[N*M] << endl;
    for(ll i=N*M-1; i>=1; i--){
        invfct[i] = (i+1)*invfct[i+1] % mod;
        //  cout << i << " " << invfct[i] << endl;
    }
    
    ll w = Comb(N*M-2, K-2, mod);
    while(w<0) w+=mod;
    w %= mod;
    // cout << w << endl;

    ll ans = 0;
    for(ll dx=1; dx<M; dx++){
        ll tmp = (N*N*(M-dx)) % mod;
        // cout << dx << " " << tmp << endl;
        tmp = tmp*dx%mod;
        ans = (ans + tmp) % mod;
    }
    for(ll dy=1; dy<N; dy++){
        ll tmp = (M*M*(N-dy)) % mod;
        tmp = tmp*dy%mod;
        ans = (ans + tmp) % mod;
    }
    cout << (ans*w)%mod << endl;
}


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

signed main() {
  int N; cin >>N;
  map<string,int > st;
  long long ans = 0;
  for(int i=0; i<N; i++) {
    string s; cin >> s;
    sort(s.begin(), s.end());
    ans += st[s]; 
    st[s]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11136
#include<iostream>
using namespace std;
int main(){
    int m,n,s=0,b[200][200],t;
    cin >> n >> m;
    for(int i=0;i<n;i++){
        s=0;
        for(int j=0;j<m;j++){
            cin >> b[i][j];
        }
    }
     for(int i=0;i<n;i++){
        s=0;
  
        for(int j=0;j<m;j++){
            cout <<b[i][j]<<" ";


            s+=b[i][j];
        }
        b[i][m]=s;
        cout <<s <<endl;
    }
     for(int i=0;i<=m;i++){ 
         s=0;
        for(int j=0;j<n;j++){
     
            s+=b[j][i];
        }
        cout<<s;
        if(i<m)
            cout<<" ";

    }
    cout <<endl;
	return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;

int cnt[30];
int main(void){
	rep(i, 30) cnt[i] = 0;
	int n, k; cin >> n >> k;
	vector<string> p(n);
	rep(i, n){
		string s; cin >> s;
		cnt[s[0] - 'A']++;
	}

	vector<int> v;
	rep(i, 26){
		v.push_back(cnt[i]);
	}

	bool flag = true;
	int ans = 0;
	while(flag){
		sort(v.begin(), v.end());
		reverse(v.begin(), v.end());
		int cnt = 0;
		rep(i, v.size()){
			if(cnt == k){
				ans++;
				break;
			}
			if(v[i] > 0){
				v[i]--;
				cnt++;
			}else{
				flag = false;
				break;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> num(100000, 0);
    for(int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        ++num[a];
    }
    
    int res = 0;
    for(int x = 1; x < 100000; ++x) {
        res = max(res, num[x-1] + num[x] + num[x+1]);
    }
    
    cout << res << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll a[100001], b[100001], c[100001];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }
    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ll x = lower_bound(a, a + n, b[i]) - a;
        ll y = upper_bound(c, c + n, b[i]) - c;
        ans += x * (n - y);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;

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

        int N = sc.nextInt();
        int[] A = new int[N];
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            A[i] = sc.nextInt();
            list.add(A[i] - i - 1);
        }

        Collections.sort(list);
        long ans = 0; 
        int b = 0;
        if(N%2!=0){
            b = list.get(N / 2);
        }
        else{
            b = (list.get(N / 2) + list.get(N / 2 - 1)) / 2;
        }
        for(int i=0; i<N; i++){
            ans += Math.abs(A[i] - (b + i + 1));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 98452
#include <iostream>
using namespace std;

int main(){
	int a,b,c,buf;
	cin >> a >> b >> c;
	if(a>b){
		buf=a;
		a=b;
		b=buf;
	}
	if(b>c){
		buf=b;
		b=c;
		c=buf;
	}
	if(a>b){
		buf=a;
		a=b;
		b=buf;
	}
	cout << a << " "<< b << " " << c << endl;
	
	return 0;
}



Measured memory_bytes: 3100
#![allow(non_snake_case)]
#![allow(unused_variables)]

fn main() {
    let (N, K): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let S: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let mut ans = 0;
    let mut y = 0;
    for i in 1..N {
        if S[i - 1] == S[i] {
            ans += 1;
        } else {
            y += 1;
        }
    }
    ans += if y % 2 == 0 {
        2 * std::cmp::min(K, y / 2)
    } else {
        if K < y / 2 + 1 {
            2 * K
        } else {
            2 * (y / 2) + 1
        }
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

#define LENGTH 256

int conper(int n, int a, int b) {
    if (b < n * a) {
        return b;
    } else {
        return n * a;
    }
}

int main(void) {
    char input[LENGTH];
    int n, a, b;
    int r;
    if (scanf("%d %d %d", &n, &a, &b) == 1);
    r = conper(n, a, b);
    printf("%d", r);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;

int main() {
ll N;
  in(N);
  string S;
  in(S);
  int ans =0;
  rep(i,N){
   if(S[i] != S[i+1]) ans++; 
  }
  out(ans);
}


Measured memory_bytes: 512
n = int(input())
a = [list(map(int, input().split()))]
a.append(list(map(int, input().split())))

A = [[0 for _ in range(n)] for _ in range(2)]

A[0][0] = a[0][0]
A[1][-1] = a[1][-1]
for i in range(1, n):
    A[0][i] = A[0][i - 1] + a[0][i]
    A[1][-(i + 1)] = A[1][-i] + a[1][-(i + 1)]

ans = - float('inf')
for i in range(n):
    ans = max(ans, A[0][i] + A[1][i])
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <map>
using namespace std;

using ll = long long;

const ll MOD = 1000 * 1000 * 1000 + 7;

map<int, int> factorize(int n) {
    map<int, int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1) res[n]++;
    return res;
}

int main() {
    int n;
    cin >> n;

    map<ll, ll> res;
    for (int i = 1; i <= n; i++) {
        auto factors = factorize(i);
        for (auto f : factors) {
            res[f.first] += f.second;
        }
    }
    ll ans = 1;
    for (auto mapping : res) {
        ans *= mapping.second + 1;
        ans %= MOD;
        /*
        cout << "指数は" << endl;
        cout << mapping.second << endl;
        */
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>

using namespace std;

map<int, vector<int>> V;
map<int, int> pre;
map<int, int> post;
int t = 1;

int _DFS(int v, vector<bool> &visited) {
  pre[v] = t;
  ++t;
  for (int out_nbr_id : V[v]) {
    if (!visited[out_nbr_id]) {
      visited[out_nbr_id] = true;
      _DFS(out_nbr_id, visited);
    }
  }
  post[v] = t;
  ++t;
}

int main() {
  int n;
  cin >> n;

  vector<bool> visited(n, false);

  cin.ignore();

  for (string line; getline(cin, line);) {
    istringstream is{line};
    int id, n_nbrs, nbr;
    is >> id >> n_nbrs;
    vector<int> out_nbrs;
    while (is >> nbr)
      out_nbrs.push_back(nbr);
    V[id] = out_nbrs;
  }

  for (auto vadj : V) {
    if (!visited[vadj.first]) {
      visited[vadj.first] = true;
      _DFS(vadj.first, visited);
    }
  }

  for (auto vadj : V) {
    int id = vadj.first;
    cout << id << " " << pre[id] << " " << post[id] << endl;
  }
}


Measured memory_bytes: 3200
using System;
using System.Linq;

class B
{
	static void Main()
	{
		var s = Console.ReadLine().GroupBy(c => c).Select(g => g.Count()).ToList();
		if (s.Count < 3) s.Add(0);
		Console.WriteLine(s.Max() - s.Min() <= 1 ? "YES" : "NO");
	}
}


Measured memory_bytes: 14560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000000000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

const ll MAX = 100010;//設定して

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;//＊１
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

signed main()
{
    COMinit();
    ll n,ans=0,lind=-1,rind,dup;cin>>n;
    vector<ll> v(n+1),cnt(n,0);
    rep(i,n+1){
        cin>>v[i];
        cnt[v[i]-1]++;
    }

    rep(i,n+1){
        if(cnt[i]==2){
            dup=i+1;
            break;
        }
    }

    rep(i,n+1){
        if(v[i]==dup){
            if(lind<0)lind=i;
            else rind=i;
        }
    }

    for(int i=1;i<=n+1;i++){
        ans=0;
        ans+=COM(n+1,i);ans%=mod;//2
        if(n-rind+lind>=i-1){
            ans+=mod-COM(n-rind+lind,i-1);ans%=mod;
        }
        //1,0 1
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int cnt[55]={};
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    cnt[a]++;
    cnt[b]++;
  }
  for(int i=1;i<=n;i++)
    cout<<cnt[i]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

// Consider 1231 , p = 3
// we will start from right and move towards left forming the number
// Logic same as count subarray sum equals K
// take number formed %3 from r to l
//  1  2   3   1   X
//  1  0   1   1   0
// i.e 1%3 = 1, 31%3 = 1, 231%3 = 0, 1231%3 = 1
// Since we know that if remainder after mod is same, the number in 
// bw same mods is divisible by p [LC 974]
// Example from numbers bw first 1 and second 1 : (12) is divisible 
// by 3.
// Since every number except 2, 5 is coprime to 10, the above logic is valid
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, p; string s;
    while(cin>>n>>p>>s){
        ll ans = 0;
        if(p==2){
            for(int i=0; i<n; ++i){
                if((s[i]-'0')%2==0)
                    ans+=i+1; // all substring from beg to here
            }
        }else if(p==5){
            for(int i=0; i<n; ++i){
                if((s[i]-'0')%5==0)
                    ans+=i+1;
            }
        }else{
            map<int,int> cnt;
            cnt[0] = 1;
            int tot = 0; int p10 = 1;
            for(int i=n-1; ~i; --i){
                tot = ((s[i]-'0')*p10 + tot)%p;
                cnt[tot]++;
                p10 = (p10*10)%p;
            }

            // C(n,2)
            for(auto x: cnt){
                if(x.second>=2)
                    ans+= ((ll)x.second * (ll)(x.second-1))/2;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 4e5 + 5;
const int inf = 1e16 + 2;


/*
 */
void solve(int Case) {
    int  n;
    cin >> n;
    int in = 8, o = 599 , t = 0;
    while(o < n) o += 200 , t ++;
    cout << in - t << '\n';
    
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// https://atcoder.jp/contests/agc043/tasks/agc043_a
P mv[2] = { P(1, 0), P(0, 1) };
vector<string> s;
int h, w;
int dp[110][110];

void solve()
{
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            for (int k = 0; k < 2; ++k)
            {
                int ni = i + mv[k].first;
                int nj = j + mv[k].second;
                if (ni >= h || nj >= w)
                    continue;

                if (s[i][j] == '.' && s[ni][nj] == '#')
                {
                    dp[ni][nj] = min(dp[ni][nj], dp[i][j] + 1);
                }
                else
                {
                    dp[ni][nj] = min(dp[ni][nj], dp[i][j]);
                }
            }
        }
    }
}

int main()
{
    cin >> h >> w;
    s.resize(h);
    for (int i = 0; i < h; ++i) cin >> s[i];
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            dp[i][j] = numeric_limits<int>::max();
        }
    }

    if (s[0][0] == '#') dp[0][0] = 1;
    else dp[0][0] = 0;
    solve();
    cout << dp[h-1][w-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

char a[303][303];

int mod_n(int x, int y, int n) {
	return (x + y) % n;
}

bool check(int x, int n) {
	for (int i = 0; i<n; i++) {
		for (int j = 0; j<n; j++) {
			if (a[mod_n(i, x, n)][j] != a[mod_n(j, x, n)][i]) {
				return false;
			}
		}
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i<n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j<n; j++) {
			a[i][j] = s[j];
		}
	}
	int cnt = 0;
	for (int i = 0; i<n; i++) {
		if (check(i, n)) {
			cnt++;
		}
	}
	cout << cnt * n << endl;
}

Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Main {
	static List<Integer> list = new ArrayList<Integer>();

	public static void main(String[] args) {
		Collections.addAll(list, 0,0,0);
		Scanner scan = new Scanner(System.in);
		for (int i = 0; i < 10; i++) {
			int sc = scan.nextInt();
			max(sc);
		}
		for(int i=0;i<list.size();i++){
			System.out.println(list.get(i));
		}
	}

	public static void max(int sc) {
		for(int j=0;j<list.size();j++){
			if(list.get(j)<=sc){
				list.remove(2);
				list.add(j, sc);
				break;
			}
		}
	}
}

Measured memory_bytes: 26356
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = n;
        double[][] arr = new double[n][2];
        for (int i=0; i<n; i++) {
            arr[i][0] = sc.nextDouble();
            arr[i][1] = sc.nextDouble();
        }

        double sum = 0;


        int cnt = 0;
        for (int i=0; i<n-1; i++) {
            for (int j=i+1; j<n; j++) {
                double tmp = Math.sqrt(Math.pow(arr[i][0]-arr[j][0], 2) + Math.pow(arr[i][1]-arr[j][1], 2));
//                System.out.println(tmp);
                sum += tmp;
                cnt++;
            }
        }

        int calc = n;
        while (1 < n--) {
            calc *= n;
        }

        int copyCalc = calc;
        calc *= (m-1);
        calc /= cnt;

//        System.out.println(calc);
//        System.out.println(copyCalc);

        System.out.println(sum * (double)(calc) / (double)copyCalc);

    }


}


Measured memory_bytes: 37388
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  int a[100];
  a[0] = 111;
  a[1] = 222;
  a[2] = 333;
  a[3] = 444;
  a[4] = 555;
  a[5] = 666;
  a[6] = 777;
  a[7] = 888;
  a[8] = 999;
  for (int i = 0; i < 9; i++) {
    if (a[i] >= N) {
      cout << a[i] << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define MININF -1e18L
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> intint;

ll gcd(ll a, ll b){
    if(b == 0)
        return a;

    return gcd(b, a % b);
}

int main(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(ALL(a));
    ll ans = INT_MAX ;
    for (int i = 1; i < n; i++) {
        ans = min(ans, gcd(a[0], a[i]));
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll w,h,x,y;
    cin >> w >> h >> x >> y;
    double ans = (double)w*h/2;
    bool flag = false;
    if(x*2==w && y*2 == h) flag = true;
    printf("%.10f",ans);
    cout << " ";
    if(flag) cout << "1" << endl;
    else cout << "0" << endl;
}

Measured memory_bytes: 256
<?php

$arr = [];
$str = trim(fgets(STDIN));
//$retsu = explode(" ", fgets(STDIN));

$arr = str_split($str);

sort($arr);

if ($arr[0] == $arr[1] && $arr[1]<>$arr[2] && $arr[2] == $arr[3]) {
  echo "Yes";
}else {
  echo "No";
}


Measured memory_bytes: 4728
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
  int n,m,k,t,i,res=-1;
  vector<int> a,b;
  decltype(a)::iterator it;
  bool f;
  cin >> n >> m >> k;
  a.push_back(0);
  b.push_back(0);
  for(i=1,f=0;i<=n;i++){
    cin >> t;
    if(f==0){
      a.push_back(a[i-1]+t);
      if(a[i]>k){
        res=i-1;
        f=1;
      }
    }
  }
  if(res<0)
    res=n;
  for(i=1,f=0;i<=m;i++){
    cin >> t;
    if(f==0){
      b.push_back(b[i-1]+t);
      if(b[i]>k){
        f=1;
      }
    }
  }
  for(i=res;i>=0;i--){
    it=upper_bound(b.begin(),b.end(),k-a[i]);
    res=max(res,i-1+(int)distance(b.begin(),it));
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 5572
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<cstdlib>



using namespace std;

    string s,t,ans;

    int n;

int main(){

    cin >> n;
    cin >> s >> t;
    int ite=0;
    for(int i=0;i<n;i++){
        cout << s[i];
        cout << t[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
MOD=10**9+7
def com(n,k,mod):
    res=1
    tmp=1
    for i in range(1,k+1):
        res=res*(n-i+1)%mod
        tmp=tmp*i%mod
    a=pow(tmp,1000000005,mod)
    return res*a%mod

n,a,b=map(int,input().split())
al=pow(2,n,MOD)
ans=(((al-1+MOD)%MOD-com(n,a,MOD)+MOD)%MOD-com(n,b,MOD)+MOD)%MOD
print(ans)

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

int main(){
    int n;
    cin >> n;

    vector<long long int> a(n);
    long long int x = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        x ^= a[i];
    }
    
    x ^= a[0] ^ a[1];
    long long int y = a[0] + a[1] - x;
    if(y % 2 != 0){
        cout << -1 << endl;
        return 0;
    }
    y /= 2LL;

    /*********************
    find max u <= a[0]
    s.t. 
    \exists v s.t. 
    x = u XOR v, 
    y = u AND v 
    **********************/

    /*
    bitset<40> ba(a[0]), bx(x), by(y);
    cout << "a[0] : " << ba << endl;
    cout << "XOR  : " << bx << endl;
    cout << "AND  : " << by << endl;
    */

    // 10^12 < 2^40
    vector<long long int> pow2(40,1);
    for(int i=0; i+1<40; i++){
        pow2[i+1] = pow2[i] * 2;
    }

    bool smaller = false;
    long long int equal = 0, backup = 0;

    for(int i=39; i>=0; i--){
        if((x>>i & 1) == 1 && (y>>i & 1) == 1){// (u,v) = none
            cout << -1 << endl;
            return 0;
        }
        if((x>>i & 1) == 0 && (y>>i & 1) == 0){// (u,v) = (0,0)
            if(a[0]>>i & 1){
                if(smaller == false){
                    smaller = true;
                    backup = equal;
                }
            }
        }
        if((x>>i & 1) == 0 && (y>>i & 1) == 1){// (u,v) = (1,1)
            equal += pow2[i];
            backup += pow2[i];
            if(smaller == false){
                if(a[0]>>i & 1) ;
                else smaller = true;
            }
        }
        if((x>>i & 1) == 1 && (y>>i & 1) == 0){// (u,v) = (1,0) or (0,1)
            if(smaller == false){
                if(a[0]>>i & 1){
                    backup = equal;
                    equal += pow2[i];
                }
                else{
                    backup += pow2[i];
                }
            }
            if(smaller == true){ 
                backup += pow2[i];
            }
        }
        //cout << equal << " " << backup << endl;
    }

    if(smaller == false){
        cout << 0 << endl;
        return 0;
    }
    // else
    if(backup == 0) cout << -1 << endl;
    if(backup != 0) cout << max(a[0] - backup, -1LL) << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define INPOS -1

int main(){
  int n;
  while(cin >> n, n){
    int M, D, h, m, p;
    char e;
    int sum[1010];
    int today[1010];
    for(int i = 0 ; i < 1010 ; i++) sum[i] = 0, today[i] = INPOS;
    
    for(int i = 0 ; i < n ; i++){
      scanf("%d/%d %d:%d %c %d", &M, &D, &h, &m, &e, &p);
      int T = h*60 + m;
      
      if(p == 0 && e == 'I') today[0] = T;      
      else if(p == 0 && e == 'O'){
	for(int i = 1 ; i <= 999 ; i++){
	  if(today[i] != INPOS) sum[i] += (T - max(today[0], today[i]));
	}
	today[0] = INPOS;
      }
      else if(p != 0 && e == 'I') today[p] = T;
      else if(p != 0 && e == 'O'){
	if(today[0] != INPOS){
	  sum[p] += T - max(today[p], today[0]);
	}
	today[p] = INPOS;	
      }
    }
    
    int ans = 0;
    for(int i = 1 ; i <= 999 ; i++){
      ans = max(ans, sum[i]);
    }
    cout << ans << endl;

  }

  return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>
#include <cmath>

int main(void) {
  int a, b, x;
  scanf("%d %d %d", &a, &b, &x);
  if (2*x <= a*a*b) {
    printf("%.10f\n", std::atan(a*b*b/2.0/x) * 180 / M_PI);
  } else {
    printf("%.10f\n", 90 - (std::atan(a*a*a / 2.0 / (a*a*b-x)) * 180 / M_PI));
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
int gcd(int a, int b) {
return b ? gcd(b, a%b) : a;
}
int ngcd(vector<int> a){
int res;
res = a[0];
for(int i = 1; i < a.size() && res != 1; i++) {
res = gcd(a[i], res);
}
return res;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
   cout << ngcd(A) << endl;
return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define endl        "\n"
#define si(a)       scanf("%d",&a)
#define si2(a,b)    scanf("%d%d",&a,&b)
#define si3(a,b,c)  scanf("%d%d%d",&a,&b,&c)
#define sl(a)       scanf("%lld",&a)
#define sl2(a,b)    scanf("%lld%lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld%lld%lld",&a,&b,&c)
#define pb          push_back
#define mk          make_pair
#define loop(n)     for(int i=0; i<n; i++)
#define FOR(a,b)    for(int i=a; i<=b; i++)
#define sz          size()
#define pY          printf("YES")
#define pN          printf("NO")
#define py          printf("Yes")
#define pn          printf("No")
#define mem(a,val)  memset(a, val, sizeof(a))




ll a[200010];
string s;
int main()
{
   ll b,c,d;
   cin>>b>>c>>d;
   ll p=b/d;
   if(b%d) p++;
   if(p>c)
    pn;
   else
    py;
}







Measured memory_bytes: 3720