akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <cstring>
#define ll long long int
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define PI 3.141592653589793
using namespace std;

int main() {
    int N,ans=1;

    cin >> N;
    int P[N];
    REP(i,N) cin >> P[i];

    int cur = P[0];
    FOR(i,1,N) {
        if(P[i] < cur) {
            ans++;
            cur = P[i];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <deque>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=1000010;
char a[N],b[N];
deque<int>q;
inline int Main(){
	int n=ni;
	scanf("%s%s",a+1,b+1);
	q.push_back(n+1);
	int delta=0;
	int ans=0;
	for(int i=n,j=n+1;i>=1;i--){
		int last=j;
		for(;j>=1&&(i<j||b[i]!=a[j]);j--);
		if(j<1)return -1;
		if(last==j){
			for(;!q.empty()&&q.back()+delta>=i;q.pop_back());
			q.push_back(i-delta);
		}else{
			delta--;
			if(i!=j){
				apmax(ans,(int)q.size());
				q.push_front(j-delta);
			}
		}
	}
	return ans;
}
int main(){
	printf("%d\n",Main());
	return 0;
}

Measured memory_bytes: 6272
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 100002;

int n, m, S, T;

void add(int u, int v, vector<vector<int> > &g) {
	g[u].push_back(v + n);
	g[u + n].push_back(v + 2 * n);
	g[u + 2 * n].push_back(v);
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> m;
	vector<vector<int> > g(n * 3);

	for (int i = 0; i < m; ++i) {
		int u, v;
		cin >> u >> v;
		add(u-1, v-1, g);
	}

	cin >> S >> T;
	--S;
	--T;
	
	// bfs

	vector<int> dist(n * 3);
	vector<bool> vis(n * 3);

	dist[S] = 0;
	vis[S] = true;

	queue<int> qu;
	qu.push(S);
	
	while (!qu.empty() && !vis[T]) {
		int u = qu.front();
		qu.pop();

		for (int i = 0; i < g[u].size(); ++i) {
			int v = g[u][i];
			if (!vis[v]) {
				vis[v] = true;
				dist[v] = dist[u] + 1;

				qu.push(v);
			}
		}
	}

	cout << (vis[T] ? dist[T] / 3 : -1) << endl;

	return 0;
}

Measured memory_bytes: 17920
h, w = map(int, input().split())
s = []

dh = [1,1,0,-1,-1,-1,0,1]
dw = [0,1,1,1,0,-1,-1,-1]

for i in range(h):
    s.append(input())


for H in range(h):
    for W in range(w):
        cnt = 0
        for i in range(8):
            if 0<=H+dh[i]<=h-1 and 0<=W+dw[i]<=w-1:
                if s[H+dh[i]][W+dw[i]] =='#':
                    cnt += 1
        if s[H][W] == '.':
            s[H] = s[H][:W] + str(cnt) + s[H][W+1:]

for c in s:
    print(c)

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

int main(){
  long A, B;
  long C, D;
  cin >> A >> B >> C >> D;
  long sum = B - A + 1;
  long numC, numD, numCD;
  numC = B / C - A / C;
  if(A % C == 0) numC++;
//  cout << "numC = " << numC << endl;
  numD = B / D - A / D;
  if(A % D == 0) numD++;
//  cout << "numD = " << numD << endl;
  long x = C * D;
//  cout << "x = " << x << endl;
  if(C < D){
    int temp = C;
    C = D;
    D = temp;
  }
  int r = C % D;
  while(r != 0){
//    cout << "r = " << r << endl;
    C = D;
    D = r;
    r = C % D;
  }
  long lcmCD = x / D;

//  cout << "CD = " << lcmCD << endl;
  numCD = B / lcmCD - A / lcmCD;
  if(A % lcmCD == 0) numCD++;
//  cout << "numCD = " << numCD << endl;
//  cout << sum << endl;
  cout << fixed;
  cout << setprecision(20) << sum - numC - numD + numCD << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	string s,t; cin>>s>>t;
	for (int i=0; i<n; i++)
		cout<<s[i]<<t[i];
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String str = s.next();
    int[] lastIndex = new int[26];
    Arrays.fill(lastIndex, -100);
    for (int i = 0; i < str.length(); i++) {
      char c = str.charAt(i);
      int charIndex = c - 'a';
      int last = lastIndex[charIndex];
      if (i - last <= 2) {
        System.out.printf("%d %d\n", last+1, i+1);
        return;
      }
      lastIndex[charIndex] = i;
    }
    System.out.println("-1 -1");
  }
}


Measured memory_bytes: 13960
import sys
import numpy as np
from collections import deque

h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]
direction = [(1, 0), (0, 1), (-1, 0), (0, -1)]

max_step = 0
for i in range(h):
    for j in range(w):
        largest_step = 0
#        print("start: ", i, j)
        if maze[i][j] == "#":
            continue
        visited = [[False] * w for _ in range(h)]
        distance = [[-1] * w for _ in range(h)]
        plan = deque()
        step = 0
        plan.appendleft((i, j, step))
        distance[i][j] = step
        visited[i][j] = True
        while plan:
            y, x, step = plan.pop()
#            print(" ", x, y, step)
            # if step > largest_step:
            #     largest_step = step
            for next_direction in direction:
                next_y = y + next_direction[0]
                next_x = x + next_direction[1]
                if -1 == next_x or next_x == w or -1 == next_y or next_y == h or maze[next_y][next_x] == "#" or visited[next_y][next_x]:
                    continue
                distance[next_y][next_x] = distance[y][x] + 1
                visited[next_y][next_x] = True
                plan.appendleft((next_y, next_x, step + 1))
#        print(largest_step)
        # if largest_step > max_step:
        #     max_step = largest_step
        max_step = max(max_step, np.max(np.array(distance)))

print(max_step)


Measured memory_bytes: 12048
#include "bits/stdc++.h"
using namespace std;

#define  F  first
#define  S  second
#define  pb push_back
#define  mp make_pair
typedef long long int ll;
const int N = 1e6+6;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);


    int n;cin>>n;
    int k;cin>>k;
    pair<int,int>P[n+2];
    for(int i=1;i<=n;i++)
        cin>>P[i].F,P[i].S=i;
    int Res = 0;
//    sort(P+1,P+n+1);
//    for(int i=1;i<n;i++)
//        Res = __gcd(Res,P[i+1].F-P[i].F);
    P[++n].F = k,P[n].S = n;
    sort(P+1,P+n+1);
    for(int i=1;i<=n;i++)
    {
//        if( P[i].S==n )
        {
            if(i-1>=1)Res = __gcd(P[i].F-P[i-1].F,Res);
            if(i+1<=n)Res = __gcd(Res,P[i+1].F-P[i].F);
        }
    }
    cout<<Res<< "\n";











    return 0;
}


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

using namespace std;

#define sp << " " <<
int mod=1000000007;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin >> n >> m;
    int a[n],b[m];
    int r[m*n+2]={0},c[m*n+2]={0};
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        r[a[i]]++;
    }
    for(int i=0;i<m;i++)
    {
        cin >> b[i];
        c[b[i]]++;
    }
    for(int i=1;i<=m*n;i++)
    {
        if(r[i]>1||c[i]>1)
        {
            cout << 0;
            return 0;
        }
    }
    for(int i=m*n-1;i>0;i--)
    {
        r[i]+=r[i+1];
        c[i]+=c[i+1];
    }
    long long dp=1;
    for(int i=m*n;i>0;i--)
    {
        if(r[i]-r[i+1]==1&&c[i]-c[i+1]==1)
        {
            dp%=mod;
        }
        else if(r[i]-r[i+1]==1)
        {
            dp*=c[i];
            dp%=mod;
        }
        else if(c[i]-c[i+1]==1)
        {
            dp*=r[i];
            dp%=mod;
        }
        else
        {
            if(((r[i]*c[i])-m*n+i)<1)
            {
                cout << 0;
                return 0;
            }
            dp*=(r[i]*c[i]-m*n+i);
            dp%=mod;
        }
    }
    cout << dp;
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, N) for (int i = 0; i < (N); ++i)

void chmax(int &a, const int b) {
  if (a < b) a = b;
}

// 1-indexed!!!

const int MX = (1 << 18) + 10;
const int MV = 100010;
int N, Q;
int V[MX], W[MX];

const int TH = 11;
int dp[(1 << TH) + 10][100100];
void prepare(int v) {
  int v_tmp = v;
  int n = 0;
  vector<int> a_v, a_w;
  while (v > 0) {
    ++n;
    a_v.emplace_back(V[v]);
    a_w.emplace_back(W[v]);
    v >>= 1;
  }
  REP(i, 1 << n) {
    int val = 0, wei = 0;
    REP(j, n) if (i & (1 << j)) {
      val += a_v[j];
      wei += a_w[j];
      if (wei > MV) break;
    }
    if (wei > MV) continue;
    chmax(dp[v_tmp][wei], val);
  }
  REP(i, MV) chmax(dp[v_tmp][i + 1], dp[v_tmp][i]);
}

// memo done?
bool available(int v) {
  return v <= (1 << TH);
}

void solve(int v, int l) {
  if (available(v)) {
    cout << dp[v][l] << endl;
    return;
  }
  int n = 0;
  vector<int> a_v, a_w;
  while (not available(v)) {
    ++n;
    a_v.emplace_back(V[v]);
    a_w.emplace_back(W[v]);
    v >>= 1;
  }
  int res = 0;
  REP(i, 1 << n) {
    int val = 0, wei = 0;
    REP(j, n) if (i & (1 << j)) {
      val += a_v[j];
      wei += a_w[j];
      if (wei > l) break;
    }
    if (wei > l) continue;
    chmax(res, dp[v][l - wei] + val);
  }
  cout << res << endl;
}

signed main() {
  cin >> N;
  REP(i, N) cin >> V[i + 1] >> W[i + 1];
  REP(i, 1 << TH) prepare(i + 1);
  cin >> Q;
  while (Q--) {
    int v, l;
    cin >> v >> l;
    solve(v, l);
  }
}


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

long long dp[100005];
int n,c;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	cin>>n>>c;
	for(int i=0;i<n;i++){
		int w,v;
		cin>>w>>v;
		for(int j=c;j>=w;j--){
			dp[j] = max(dp[j],dp[j-w]+v);
		}
	}
	
	long long ans = 0;
	for(int i=0;i<=c;i++) ans = max(ans,dp[i]);
	cout<<ans;
	
	//for(int i=1;i<=h;i++){
	
	return 0;
}


Measured memory_bytes: 1024
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]
#print(N,M)
#print(A)
#print(BC)
#print("---")
A = sorted(A)
BC = sorted(BC, key = lambda x: -x[1])
D = []
for bc in BC :
    for i in range(bc[0]) :
        if len(D) < N :
            D.append(bc[1])
        else :
            break
    else :
        continue
    break
if N > len(D) :
    S = len(D)
else :
    S = N
for i in range(S) :
    if A[i] < D[i] :
        A[i] = D[i]
    else :
        break
print(sum(A))

#times = [bc[0] for bc in BC]
#values = [bc[1] for bc in BC]
#values, times = zip(*sorted(zip(values, times),reverse=True))
#print(values)
#print(times)
#values.sort(reverse=True)


# for i, v in enumerate(values) :
#     tmp = [n for n,i in enumerate(A) if i > v]
#     if len(tmp) == N :
#         break
#     elif len(tmp) == 0 :
#         ind = N + 1
#     else :
#         ind = tmp[0]
#
#     if times[i] < ind :
#         A[0:times[i]] = [v] * times[i]
#     else :
#         A[0:ind] = [v] * ind
#     #print(A)
#     A = sorted(A)
# print(sum(A))

#for i, v in enumerate(values) :
#    for t in range(times[i]) :
#        min_A = min(A)
#        if v > min_A :
#            A[A.index(min(A))] = v
#            print(A)
#        else :
#            break
#    else:
#        continue
#    break
#print(sum(A))





Measured memory_bytes: 36936
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<unordered_set>
#include<complex>
#include <cassert>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const LL M = 1000 * 1000 * 1000 * (LL)1000 * 1000 * 1000;
const int MAX = 1000 * 100 + 47;
LL A[MAX];

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    FOR(i, 0, n) cin >> A[i];

    bool isZero = false;
    FOR(i, 0, n) {
        if (A[i] == 0) {
            isZero = true;
            break;
        }
    }

    if (isZero) {
        cout << 0 << endl;
        return 0;
    }

    LL res = 1;
    double dres = 1;
    FOR(i, 0, n) {
        dres *= A[i];
        if (dres >= 2 * LINF) {
            res = -1;
            break;
        }

        res *= A[i];
    }

    res = res > M ? -1 : res;
    cout << res << endl;
}

Measured memory_bytes: 4396
#include <stdio.h>
#include <stdlib.h>

void
swap(int *x, int *y)
{
	int tmp = *x;
	*x = *y;
	*y = tmp;
}

void
bsort(int *list,int n)
{
	int i,j;
	int count = 0;
	for(i=0; i<n; i++){
		for(j=n-1; i<j; j--){
			if(list[j-1] > list[j]){
				swap(&list[j-1],&list[j]);
				count++;
			}
		}
	}
	for(i=0; i<n; i++){
		printf("%d",list[i]);
		if(i != (n-1)){
      printf(" ");
    }
	}
	
	printf("\n%d\n", count);

}


int
main()
{
	int n;
	scanf("%d",&n);

	int *list = (int *)malloc(n * sizeof(int));
	
	int i;
	for(i=0; i<n; i++){
		scanf("%d", &list[i]);
	}
	bsort(list,n);
	return 0;
}

Measured memory_bytes: 604
#include <algorithm>  //min, max, sort, unique, fill
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>  //pair, swap,
#include <vector>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<ll>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) for (ll i = 0; i < (n); i++)

static const ll kIntMax = numeric_limits<ll>::infinity();
static const double kFloatMax = numeric_limits<double>::infinity();

vector<ll> vi;

int main() {
  ll a, b, x;
  cin >> a >> b >> x;

  if (a <= x && x <= a + b) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int a, b;

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

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextInt();
        b = sc.nextInt();
        solve();
    }

    void solve() {
        System.out.println((a + b) >= 10 ? "error" : a + b);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ses   "\n"
#define whp   " "
#define mxi 99999
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define PI acos(-1)
#define sz(a) long long(a.size())
#define ff first
#define ss second
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)
//ostringstream str1;
 //       str1 << z;
  //      string c=str1.str();
///priority_queue <int, vector<int>, greater<int>> g
#define MS(a,b) memset(a,b,sizeof(a));

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll fx[4]= {1,-1,0,0};
ll fy[4]= {0,0,1,-1};

typedef vector<ll> vll;
typedef vector<string> vss;
typedef vector<pair<ll,ll > > vpr;
typedef vector<pair<string,ll > > vspr;
typedef list<ll> li;
typedef list<string> ls;
typedef list<pair<ll,ll> > lpr;
typedef list<pair<string,ll> > lspr;
bool rs(ll a, ll b){return(a>b);}
ll spd(ll n){ if(n%2==0)return 2; for(ll i=3; i*i<=n; i++){if(n%i==0)return i;}return n;}

int main(){
    ll n; cin>>n;ll a[n];
    rep0(i,0,n){cin>>a[i];}
    ll z=a[0];
    ll ans=0;
    for(ll i=1; i<n; i++){
        if(a[i]<z){
            ans+=(z-a[i]);
        }
        else{
            z=a[i];
        }
    }
    cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 5184
<?php

fscanf(STDIN, "%d %d", $n, $k);
fscanf(STDIN, "%s", $s);

$S = [];
$now = 1;
$cnt = 0;
for ($i = 0; $i < $n; ++$i) {
    if ($s[$i] == $now) {
        ++$cnt;
    } else {
        $S[] = $cnt;
        $now ^= 1;
        $cnt = 1;
    }
}
if ($cnt !== 0) $S[] = $cnt;
if (count($S) % 2 == 0) $S[] = 0;

$K = 2 * $k + 1;

$r = 0;
$sum = 0;
$max = 0;
for ($l = 0; $l < count($S); $l += 2) {
    while ($r < $n && $r - $l < $K) {
        $sum += $S[$r];
        ++$r;
    }

    $max = max($max, $sum);

    $sum -= $S[$l];
    $sum -= $S[$l + 1];
}

echo $max;


Measured memory_bytes: 10744
#include <iostream>
#include <string>
using namespace std;
int main(){
int n;
int ac = 0;
int wa = 0;
int tle = 0;
int re = 0;
cin >> n;
for(int i = 0;i < n;i++){
    string buf;
    cin >> buf;
    if(buf == "AC"){
        ac ++;
    }else if(buf == "WA"){
        wa ++;
    }else if(buf == "TLE"){
        tle ++;
    }else if(buf =="RE"){
        re ++;
    }
}
cout << "AC" << " x " << ac << endl;
cout << "WA" << " x " << wa << endl;
cout << "TLE" << " x " << tle << endl;
cout << "RE" << " x " << re << endl;
return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define debug
#define TRACE(x)

using namespace std;

typedef long long llint;

const int MAXN = 100010;
int n, a[MAXN];

int solve() {
  llint sum = 0;
  int odd = 0;
  int one = 0;
  
  REP(i, n) {
    sum += a[i];
    if (a[i] % 2)
      ++odd;
    if (a[i] == 1)
      one = 1;
  }
  sum %= 2;

  if (one) return sum == n % 2 ? 0 : 1;
  
  if (n == 1) {
    return (a[0] + 1) % 2;
  } else if (n == 2) {
    return a[0] % 2 == 1 && a[1] % 2 == 1 ? 0 : 1;
  } else {
    if (sum == n % 2) {
      TRACE(odd _ sum);
      if (odd > 1) return 0;
      int g = 0;
      REP(i, n) {
	if (a[i] % 2) --a[i];
	g = __gcd(g, a[i]);
      }
      TRACE(g);
      REP(i, n) a[i] /= g;
      return solve() ^ 1;
    } else {
      return 1;
    }
  }
  return 0;
}

int main(void) {
  scanf("%d",&n);
  REP(i, n) scanf("%d",&a[i]);
  printf(solve() ? "First\n" : "Second\n");
  return 0;
}


Measured memory_bytes: 640
from math import gcd

k = int(input())

sum = 0
for i in range(k):
    for j in range(k):
        tmp = gcd(i+1, j+1)
        if tmp == 1:
            sum += k
        else :
            for l in range(k):
                sum += gcd(l+1, tmp)

print(sum)





Measured memory_bytes: 9160
#include <iostream>
using namespace std;
int n,L,ans;
string s,s1,s2;
int ch(string s1,string s2,int L){
    int an=0,tmp=0;
    for(int i=0;i<s1.size();i++){
        if(s1[i]==s2[i])tmp++;
        else{
            an=max(an,tmp);
            tmp=0;
        }
    }
    an=max(an,tmp);
    return min(an,L);
}
int main(void){
    cin>>n>>s;
    for(int i=1;i<n;i++){
        s1=s.substr(0,n-i);
        s2=s.substr(i,n-i);
        L=min(i,n-i);
        ans=max(ans,ch(s1,s2,L));
    }
    cout<<ans<<endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n-1));
  rep(i,n) {
    rep(j,n-1) {
      cin >> a[i][j];
      a[i][j]--;
    }
    reverse(a[i].begin(), a[i].end());
  }
  vector<P> q;

  auto check = [&](int i){
    if(a[i].size()==0) return;
    int j = a[i].back();
    if(a[j].back()==i){
      P p(i,j);
      if(p.first > p.second) swap(p.first,p.second);
      q.push_back(p);
    }
  };
  
  rep(i,n){
    check(i);
  }
  
  int day = 0;
  while(q.size()!=0){
    day++;
    sort(q.begin(),q.end());
    q.erase(unique(q.begin(),q.end()),q.end());
    vector<P> prevQ;
    swap(q,prevQ);
    for(P p : prevQ){
      int i = p.first, j = p.second;
      a[i].pop_back();
      a[j].pop_back();
    }
    for(P p : prevQ){
      int i = p.first, j = p.second;
      check(i);
      check(j);
    }
  }
  
  rep(i,n){
    if(a[i].size()!=0){
      puts("-1");
      return 0;
    }
  }
  
  cout << day << endl;
}


Measured memory_bytes: 4224
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<Integer> s = new HashSet<>();
        int d = 0;

        for(int i=0; i<n; i++){
            d = sc.nextInt();
            if(!s.contains(d)){
                s.add(d);
            }
        }
        System.out.println(s.size());
        sc.close();
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define for0(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007
# define M_PI  3.14159265358979323846

using namespace std;




int main()
{
  int r;
  float circum;
  cin >> r;
  circum =  2 * M_PI * r;
  cout << circum;


  return 0 ;
}


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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var firstLine = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
			var n = firstLine[0];
			var k = firstLine[1];

			var dictionary = new Dictionary<int, bool>();

			for(var i = 1; i <= n; i++)
			{
				dictionary.Add(i, false);
			}

			for(var i = 0; i < k; i++)
			{
				Console.ReadLine();
				var sunukes = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();

				foreach(var sunuke in sunukes)
				{
					dictionary[sunuke] = true;
				}
			}

			Console.WriteLine(dictionary.Count(keyValuePair => !keyValuePair.Value));
		}
	}
}


Measured memory_bytes: 19688
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

Measured memory_bytes: 4400
#include<bits/stdc++.h>
using namespace std;
int col[35][35];
int mapi[550][550];
int m,n;
int ch[5][35];
int mini=999999999;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=m;j++)
			cin>>col[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cin>>mapi[i][j];
	for(int i=1;i<=m;i++)
		ch[1][i]=ch[2][i]=ch[3][i]=0;
	for(int k=1;k<=3;k++)
		for(int c=1;c<=m;c++)
			for(int num=k;num<=n*2;num+=3)
				for(int i=1;i<num;i++)
					if(num-i<=n && i<=n)
						ch[k][c]+=col[mapi[i][num-i]][c];	
	for(int i=1;i<=m;i++)
		for(int j=1;j<=m;j++)
			for(int k=1;k<=m;k++)
				if(i!=j && j!=k && i!=k)
					mini=min(mini,ch[1][i]+ch[2][j]+ch[3][k]);
	cout<<mini;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        List<MyDto> list = new ArrayList<>();
        for (int i = 0; i < x; i++) {
            MyDto dto = new MyDto();
            dto.a = sc.nextInt();
            dto.b = sc.nextInt();
            list.add(dto);
        }

        Collections.sort(list, new MyComp());

        long a = 0;
        long b = 0;
        boolean flg = true;
        for (MyDto dto : list) {
            if (flg) {
                a += dto.a;
            } else {
                b += dto.b;
            }
            flg = !flg;
        }
        System.out.println(a- b);
    }
}

class MyComp implements Comparator<MyDto> {
    public int compare(MyDto c1, MyDto c2) {
        if(c1.getWa() < c2.getWa()) {
            return 1;
        } else {
            return -1;
        }
    }
}

class MyDto{
    int a;
    int b;
    public int getSa(){
        return a - b;
    }
    public int getWa(){
        return a + b;
    }
}


Measured memory_bytes: 86048
#include<iostream>
#include<algorithm>
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
using namespace std;
#define D 10000
int dp[D][D];
void LS(string a,string b)
{
	REP(i,a.size()+1)dp[i][0]=i;
	REP(i,b.size()+1)dp[0][i]=i;	
	for(int i=1;i<=a.size();i++)
	{
		for(int j=1;j<=b.size();j++)
		{
			int q=1;if(a[i-1]==b[j-1])q = 0;
			dp[i][j]=min(min(dp[i-1][j-1]+q,dp[i][j-1]+1),dp[i-1][j]+1);
		}
	}	
}
int main()
{
	string a,b;cin>>a>>b;
	cout<<(LS(a,b),dp[a.size()][b.size()])<<endl;
	return 0;
}

Measured memory_bytes: 11120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

typedef pair<int,int> P;

vector<P> g[22];
int fac[100];


int main() {
  int l;
  cin >> l;
  string s;

  fac[0] = 1;
  int k = 1;
  while(true) {
    fac[k] = fac[k-1] * 3;
    if(fac[k] > 1000000) break;
    k++;
  }
  
  while(l > 0) {
    int tmp = l % 3;
    s += (tmp + '0');
    l /= 3;
  }
  reverse(s.begin(),s.end());
 
  for(int i = 0; i < s.size()-1; i++) {
    for(int j = 0; j < 3; j++) {
      g[i].push_back(P(i+1,fac[i]*j));
     
    }
  }

  int tmp = 0;
  for(int i = 0; i < s.size(); i++) {
    int j = 0;
    for(; j < (s[i] - '0'); j++) {
      g[s.size()-i-1].push_back(P(s.size(),tmp + fac[s.size() - i - 1]*j));
     
    }
    tmp += fac[s.size() - i - 1] * j;
  }


  int M = 0;
   for(int i = 0; i <= s.size(); i++) {
     for(int j = 0; j < g[i].size(); j++) { M++;
     }
   }

  
  cout << s.size() + 1 <<" "<< M <<endl;
  
  for(int i = 0; i <= s.size(); i++) {
    for(int j = 0; j < g[i].size(); j++) {
      cout << i + 1<<" "<<g[i][j].first + 1 <<" "<<g[i][j].second << endl;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

typedef long long ll;

int main() {
    int N, M, x;
    ll ans = 0;
    cin >> N >> M;
    multiset<int>A;
    for (int i = 0; i < N; i++) {
        cin >> x;
        A.insert(x);
    }

    for (int i = 0; i < M; i++) {
        auto itr = A.end();
        itr--;
        ll a = *itr;
        a /= 2;
        A.erase(itr);
        A.insert(a);
    }
    for (auto itr = A.begin(); itr != A.end(); itr++) {
        ans += *itr;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
/* Dice3 */
#include <stdio.h>

int main(void)
{
    int Dice1[6], Dice2[6];
    int i, j, k;
    for(i = 0; i < 6; i++){
        scanf("%d", &Dice1[i]);
    }
    for(i = 0; i < 6; i++){
        scanf("%d", &Dice2[i]);
    }
    for(i = 0; i < 4; i++){
        int tmp1 = Dice1[0];
        Dice1[0] = Dice1[3];
        Dice1[3] = Dice1[5];
        Dice1[5] = Dice1[2];
        Dice1[2] = tmp1; 
        for(j = 0; j < 4; j++){
            int tmp2 = Dice1[1];
            Dice1[1] = Dice1[2];
            Dice1[2] = Dice1[4];
            Dice1[4] = Dice1[3];
            Dice1[3] = tmp2;
            for(k = 0; k < 4; k++){
                int tmp3 = Dice1[0];
                Dice1[0] = Dice1[1];
                Dice1[1] = Dice1[5];
                Dice1[5] = Dice1[4];
                Dice1[4] = tmp3;
                if(Dice1[0] == Dice2[0] && Dice1[1] == Dice2[1] && Dice1[2] == Dice2[2] && Dice1[3] == Dice2[3] && Dice1[4] == Dice2[4] && Dice1[5] == Dice2[5]){
                    printf("Yes\n");
                    return 0;
                }
            }
        }
    }
    printf("No\n");

    return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define pii pair<int,int>
#define ll long long
using namespace std;
int main()
{
	int h,w;
	cin>>h>>w;
	int a[h+1][w+1];
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			char c;cin>>c;
			a[i][j]= c=='#';
		}
	}

	int b[h][w];



	for(int i=1;i<h;i++)
	{
		for(int j=1;j<w;j++)
		{
			int k=a[i][j]+a[i+1][j]+a[i][j+1]+a[i+1][j+1];

			b[i][j]= k%2==0;
		
		}
	
	}


	int ht[w+1]={};
    int next[w+1];
    int prev[w+1];
    int ans=max(h,w);
	for(int i=1;i<h;i++)
	{
		for(int j=1;j<w;j++)
		    ht[j]=(b[i][j]==1)? ht[j]+1: 0;

        
		ht[w]=ht[0]=-1;
		

	    stack<int> st;
	    st.push(0);
        
	    for(int j=1;j<w;j++)
	    {
	    	while(ht[st.top()]>=ht[j])st.pop();
	    	prev[j]=st.top();
	    	st.push(j);
	    }
	    while(!st.empty())st.pop();
	    
	    st.push(w);
	    
	    for(int j=w-1;j>0;j--)
	    {
	    	while(ht[st.top()]>=ht[j])st.pop();
	    	next[j]=st.top();
	    	st.push(j);
	    }
        
	    for(int j=1;j<w;j++)
	    {
	    	ans=max(ans,(ht[j]+1)*(next[j]-prev[j]));
	    }

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

Measured memory_bytes: 31488
#include <iostream>
#include <cmath>
#include <math.h>
using namespace std;
int len(int a)
{
    int len=10;
    while(a>=len)
    {
        len*=10;
    }
    return len;
}
bool judge(int x)
{
    int base = (int)sqrt(x);
    if(base*base==x) return 1;
    else return 0;
}
int main()
{
    int a,b;
    cin>>a>>b;
    int sum=a*len(b)+b;
    if(judge(sum)) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
from queue import Queue
from itertools import product


def main():
    h, w = map(int, input().split())
    grid = ["." * w for _ in range(h)]
    for i in range(h):
        grid[i] = input()
    num_white = 0
    for i, j in product(range(h), range(w)):
        if grid[i][j] == ".":
            num_white += 1
    dist = [[-1] * w for _ in range(h)]
    q = Queue()
    q.put((0, 0))
    dist[0][0] = 1
    di = [-1, 0, 1, 0]
    dj = [0, 1, 0, -1]
    while not q.empty():
        i, j = q.get()
        d = dist[i][j]
        for k in range(4):
            ni = i + di[k]
            nj = j + dj[k]
            if ni < 0 or ni >= h or nj < 0 or nj >= w:
                continue
            if grid[ni][nj] == "#":
                continue
            if dist[ni][nj] != -1 and dist[ni][nj] <= d + 1:
                continue
            dist[ni][nj] = d + 1
            q.put((ni, nj))
    print(num_white - dist[h - 1][w - 1] if dist[h - 1][w - 1] != -1 else -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9696
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
using namespace std;
const int maxn=1005;
int n,t[maxn],ans,pos;
string s;
map<int,string>mp;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
		if(ch=='-')
			f=-1;
		ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
    }
    return x*f;
}
inline void write(int a)
{
    if(a<0)
    {
		char a='-',b='1';
		putchar(a);
		putchar(b);
    }
    else
    {
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
    }
}

int main()
{
    n=read();
	for(int i=1;i<=n;++i)
		cin>>mp[i]>>t[i];
	cin>>s;
	for(int i=1;i<=n;++i)
		if(mp[i]==s)
		{
			pos=i+1;
			break;
		}
	for(int i=pos;i<=n;++i)
		ans+=t[i];
	write(ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int n;
  int i;
  int j;
  int divisor_count;
  int result = 0;

  scanf("%d", &n);

  for (i = 1; i <= n; i += 2) {
    divisor_count = 0;
    for (j = 1; j <= i && divisor_count < 9; j++) {
      if (i % j == 0) {
        divisor_count++;
      }
    }
    if (divisor_count == 8) {
      result++;
    }
  }

  printf("%d\n", result);
  return 0;
}


Measured memory_bytes: 128
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//                       _oo0oo_                         //
//                      o8888888o                        //
//                      88" . "88      ------ hzt1       //
//                      (| -_- |)                        //
//                      0\  =  /0                        //
//                    ___/`---'\___                      //
//                  .' \|     |// '.                     //
//                 / \|||  :  |||// \                    //
//                / _||||| -:- |||||- \                  //
//               |   | \  -  /// |     |                 //
//               | \_|  ''\---/''  |_/ |                 //
//               \  .-\__  '-'  ___/-. /                 //
//             ___'. .'  /--.--\  `. .'___               //
//          ."" '<  `.___\_<|>_/___.' >' "".             //
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |           //
//         \  \ `_.   \_ __\ /__ _/   .-` /  /           //
//     =====`-.____`.___ \_____/___.-`___.-'=====        //
//                       `=---='                         //
//                                                       //
//                                                       //
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       //
//                                                       //
//                 God-He Bless All.                     //
//           This Code Will Never Explode.               //
//                                                       //
//                                                       //
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<vector>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
const int Size=1<<16;
char buffer[Size],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,Size,stdin);
        tail=(head=buffer)+l;
    }
    if(head==tail) return -1;
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=2010;
const int mod=1000000007;
int n,m,k,f[maxn][maxn];
int main() {
	n=read();m=read();k=read();
	f[0][0]=1;int ans=0;
	rep(i,0,n) rep(j,0,m-1) if((i+j)%(k-1)==0) {
		rep(x,0,k-1) {
			int ni=i+x,nj=j+k-1-x;
			if(ni<=n&&nj<m) {
				(f[ni][nj]+=f[i][j])%=mod;
				if(x&&ni%(k-1)==n%(k-1)) (ans+=f[i][j])%=mod;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 15872
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*///讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐。
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>

using namespace std;

#define rep(a) _rep(0,int(a))
#define repj(a) for(int j=0;j<int(a);j++)
#define _rep(a,b) for(int i=int(a);i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)
#define _GLIBCXX_DEBUG
const double pai = 3.1415926535897;
#define _cos(n) cos(n*pai/180)

//factorial(練習)　階乗
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int sa(int n, int m) {      //差！
	if (n < m)return m - n;
	else return n - m;
}

int a[3];
signed main() {
	rep(3)cin>>a[i];
	sort(a, a + 3);
	int ans = a[2] * 10 + a[1] + a[0];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >>N;
  vector<pair<string,int>>card(N);
  string shurui[4];
  shurui[0]='S';
  shurui[1]='H';
  shurui[2]='C';
  shurui[3]='D';
  for(int i=0;i<N;i++){
    cin>>card[i].first>>card[i].second;
  }
  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      bool hantei=false;
      for(int k=0;k<N;k++){
        if(shurui[i]==card[k].first&&j+1==card[k].second){
          hantei=true;
          break;
        }
      }
      if(hantei==false)cout<<shurui[i]<<" "<<j+1<<endl;
    }
  }
  return 0;
}
  


Measured memory_bytes: 3124
#include <stdio.h>

int main(){
    int bil1, bil2;
    int hasil1,hasil2,hasil3;
    scanf("%d %d",&bil1,&bil2);
    hasil1 = bil1 + bil2;
    hasil2 = bil1 - bil2;
    hasil3 = bil1 * bil2;
    if(hasil1>=hasil2&&hasil1>=hasil3){
        printf("%d",hasil1);
    }
    else if(hasil2>=hasil1&&hasil2>=hasil3){
        printf("%d",hasil2);
    }
    else{
        printf("%d",hasil3);
    }
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>

int main(){
    int K, S;

    scanf("%d %d", &K, &S);
    int ans = 0;

    for(int x = 0; x <= K; x++){
        for(int y = 0; y <= K; y++){
            int z = S - x - y;
            if(z <= K && z >= 0){
                ans = ans + 1;
            }
        }
    }

    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 128
// Problem : B - Digits
// Contest : AtCoder - AtCoder Beginner Contest 156
// URL : https://atcoder.jp/contests/abc156/tasks/abc156_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
#define mod 1000000007
int lcm(int x,int y){
	return x/__gcd(x,y)*y;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    int cnt=0;
    while(n>0){
    	n/=k;
    	cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const char* str[] = {"none", "ambiguous"};

int n;
int a[1000];
bool f[1000];

void solve()
{
	for (int i = 0; i < n; i++){
		if (i % 2 == 0){
			if (i > 0){
				if (a[i] >= a[i - 1]){
					puts(str[0]);
					return;
				}
			}
			if (i < n - 1){
				if (a[i] >= a[i + 1]){
					puts(str[0]);
					return;
				}
			}
		}
		else {
			if (i > 0){
				if (a[i] <= a[i - 1]){
					puts(str[0]);
					return;
				}
			}
			if (i < n - 1){
				if (a[i] <= a[i + 1]){
					puts(str[0]);
					return;
				}
			}
		}
	}
	bool ff = false;
	for (int i = 0; i < n - 1; i++){
		ff |= f[i];
		if (f[i] & f[i + 1]){
			puts(str[0]);
			return;
		}
	}
	ff |= f[n - 1];
	if (!ff){
		puts(str[1]);
		return;
	}
	
	int low = -1e9 - 5;
	int high = 1e9 + 5;
	
	for (int i = 0; i < n; i++){
		if (!f[i]) continue;
		if (i % 2 == 0){
			if (i > 0) high = min(high, a[i - 1] - 1);
			if (i < n - 1) high = min(high, a[i + 1] - 1);
		}
		else {
			if (i > 0) low = max(low, a[i - 1] + 1);
			if (i < n - 1) low = max(low, a[i + 1] + 1);
		}
	}
	
	//printf("%d %d\n", low, high);
	if (low == high) printf("%d\n", low);
	else if (low > high) puts(str[0]);
	else puts(str[1]);
}

int main()
{
	while (scanf("%d", &n), n){
		memset(a, 0, sizeof(a));
		memset(f, 0, sizeof(f));
		
		for (int i = 0; i < n; i++){
			string str;
			cin >> str;
			if (str == "x"){
				f[i] = true;
				if (i % 2 == 0){
					a[i] = -1e9 - 1;
				}
				else {
					a[i] = 1e9 + 1;
				}
			}
			else a[i] = atoi(str.c_str());
		}
		
		solve();
	}
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
    ll h, w;
    cin >> h >> w;
    if (h == 1 || w == 1) {
        cout << 1 << endl;
    } else {
        cout << (h * w + 1) / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

assist = 0
kill = 0

for i in range(n):
    if assist+b[i] < a[i]:
        kill += assist+b[i]
        assist = 0
    else:
        if assist <= a[i]:
            kill += a[i]
            assist += b[i] - a[i]
        else:
            kill += a[i]
            assist = b[i]

if assist == 0:
    print(kill)
elif assist < a[-1]:
    print(kill + assist)
else:
    print(kill + a[-1])

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

int main(){
    vector<int> nums(3);
    for(auto &val : nums) cin >> val;
    sort(nums.begin(), nums.end());
    
    cout << nums[0] << " " << nums[1] << " " << nums[2] << endl;
    return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define N 55
ll n,x[N],y[N];
namespace uf{
  ll p[N],siz;
  void init(){
      for(int i=0;i<N;i++)p[i]=i;
      siz=n;
  }  
  ll par(ll x){
      return (x==p[x]?x:par(p[x]));
  }
  void unite(ll a,ll b){
      a=par(a),b=par(b);
      if(a==b)return;
      p[a]=b; siz--;
  }
};
ll solve(ll p,ll q){
    uf::init();
    for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	    if(x[i]+p==x[j]&&y[i]+q==y[j]){
		uf::unite(i,j);
	    }
	}
    }
    return uf::siz;
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>x[i]>>y[i];
  ll mi=1e17;
  for(int i=0;i<n;i++)for(int j=0;j<n;j++){
      mi=min(mi,solve(x[i]-x[j],y[i]-y[j]));
  }
  cout<<mi<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int n;

int main(){
  cin >> n;
  int res = -1;
  for(int i = 1; i <= n; i++){
    int num = i * 1.08;
    if(num >= n && num < n + 1){
      res = i;
    }
  }
  if(res == -1){
    cout << ":(" << endl;
  }else{
    cout << res << endl;
  }
}


Measured memory_bytes: 256
using System;

namespace ITP1_1_D
{
  class Program
  {
    static void Main(string[] args)
    {
      int line = int.Parse(Console.ReadLine());
      int hour = line / (60 * 60);
      int minuts = (line - hour * 3600) / 60;
      int second = line - (minuts * 60 + hour * 3600);


      Console.WriteLine("{0}:{1}:{2}", hour, minuts, second);
    }
  }
}



Measured memory_bytes: 18000
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int p = 0;
    for(int i = 0; i < n; i++) {
      int a = sc.nextInt();
      if((a % 2) == 1) p++;
    }
    String ans = "YES";
    if((p % 2) == 1) ans = "NO";
    System.out.println(ans);
  }
}

Measured memory_bytes: 48716
N = int(input())
h = list(map(int, input().split()))

ans = [0 for _ in range(N)]
ans[1] = abs(h[0] - h[1])

for i in range(2, N):
    ans[i] = min(ans[i - 1] + abs(h[i] - h[i - 1]), ans[i - 2] + abs(h[i] - h[i - 2]))


print(ans[N-1])

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int r,d,x;
    cin>>r>>d>>x;
    REP(i,10){
        cout<<(x=r*x-d)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256