akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

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

const int INF = 1 << 24;

typedef unsigned long long ull;

struct P{
    int x, y;
};

P operator+(const P& lp, const P& rp){
    return {lp.x + rp.x, lp.y + rp.y};
}

bool operator==(const P& lp, const P& rp){
    return lp.x == rp.x && lp.y == rp.y;
}

bool operator>(const P& lp, const P& rp){
    if(lp.x != rp.x){
        return lp.x > rp.x;
    }
    return lp.y > rp.y;
}

bool operator<(const P& lp, const P& rp){
    return !(lp > rp) && !(lp == rp);
}

int M, N;
std::vector<P> A, B;

//static int counter = 0;

bool can(const P& find_p){
    auto it = std::lower_bound(B.begin(), B.end(), find_p);
    auto p = *it;
    // std::cout << "find:" << find_p.x << "," << find_p.y << std::endl;
    // if(counter++ < 10){
    //     std::cout << p.x << "," << p.y << std::endl;
    // }
    
    return p.x == find_p.x && p.y == find_p.y;
}

bool search(const P& diff){
    FOR(i, 1, M){
        P p = A[i];
        
        if(!can(p + diff)){
            return false;
        }
    }

    return true;
}

P solve(){
    REP(i, N){
        P a = A[0], b = B[i], diff = {b.x-a.x, b.y-a.y};

        if(search(diff)){
            return diff;
        }
    }
}

int main(){
    while(std::cin >> M, M){
        A.clear();
        B.clear();

        REP(i, M){
            int x, y;
            std::cin >> x >> y;
            A.push_back({x, y});
        }

        std::cin >> N;
        REP(j, N){
            int x, y;
            std::cin >> x >> y;
            B.push_back({x, y});
        }

        std::sort(B.begin(), B.end());

        // for(auto p : B){
        //     std::cout << "phoo: " << p.x << "," << p.y << std::endl;
        // }

        P res = solve();
        std::cout << res.x << " " << res.y << std::endl;
    }
}

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

using namespace std;

int N, M;

int main(){
  ios_base::sync_with_stdio(false);
  int N; 
  cin >> N >> M;
  map<int, int> mp;
  for(int i=0; i<M; ++i){
    int a, b;
    cin >> a >> b;
    if(a == 1)
      ++mp[b];
    if(b == N)
      ++mp[a];
  }
  auto it = mp.begin();
  while(it != mp.end()){
    if(it->second >= 2){
      cout << "POSSIBLE\n";
      return 0;
    }
    ++it;
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}


Measured memory_bytes: 9600
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
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;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>A(N); rep(i, 0, N) { cin >> A[i]; }
	int ans = 0;
	bool f = A[0] != 0;
	rep(i, 1, N) {
		f|=A[i] - A[i - 1] > 1;
	}
	if (f) { cout << -1 << endl; }
	else {
		rep(i, 1, N) {
			if (A[i] - A[i - 1] == 1)ans++;
			else ans += A[i];
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int gcd(int a, int b);
int main()
{
  int k;
  scanf("%d", &k);
  long long int s=0;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      for(int l=1;l<=k;l++){
        s += gcd(gcd(i, j), l);
      }
    }
  }
  printf("%lld\n", s);
  return 0;
}

int gcd(int a, int b)
{
    int c;

    while (b != 0)
    {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> T;
    for (int i = 0; i < N; ++i) {
        T.push_back(S[i] - '0');
    }

    int cnt = 0;
    
    for(int n = 0; n < 1000; ++n) {
        int t = n / 100;
        int m = (n - (100 * t)) / 10;
        int b = n - (100*t) - (10*m);
        bool ok1 = false;
        bool ok2 = false;
        bool ok3 = false;
        int i1 = 0;
        int i2 = 0;
        for(int i = 0; i < N; ++i) {
            if(T[i] == t) {
                ok1 = true;
                i1 = i;
                break;
            }
        }
        if(ok1) {
            for(int i = i1+1; i < N; ++i) {
                if(T[i] == m) {
                    ok2 = true;
                    i2 = i;
                    break;
                }
            }
        }
        if(ok2) {
            for(int i = i2+1; i < N; ++i) {
                if(T[i] == b) {
                    ok3 = true;
                    break;
                }
            }
        }
        if(ok1 && ok2 && ok3) {
            ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3776
from collections import Counter
n,m = map(int,input().split())
l = list(map(int,input().split()))
mod = [0]
for i in l:
    mod.append((mod[-1]+i)%m)

c = Counter(mod)
ans = 0
for i in c.values():
    ans += i*(i-1)//2
print(ans)


Measured memory_bytes: 17356
k = int(input())

n = 50
a = list(range(50))
base = k // n
r = k % n
for i in range(n):
    a[i] += base
for i in range(r):
    a[n-1-i] += 1
ans = a[n-r:] + a[:n-r]
print(n)
print(*ans)

Measured memory_bytes: 3064
#テストファイルで実行する時
import sys
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

n,m,x = map(int,input().split())
a = list(map(int,input().split()))

l = [0]*n

for i in range(m):
	l[a[i]] = 1

f = sum(l[0:x])
g = sum(l[x:n])

print( f if f<g else g)
	


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        while(true) {
            int h = scanner.nextInt();
            int w = scanner.nextInt();
            if (h == 0 && w == 0) {
                break;
            }
            for(int row = 0; row < h; row++){
                for(int col = 0; col < w; col++){
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
        scanner.close();
    }
}



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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  ll suma = 0, mcnt = 0, mina = 1 << 28;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    mcnt += A[i] < 0 ? 1 : 0;
    suma += abs(A[i]);
    mina = min(mina, abs(A[i]));
  }
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) {
      cout << suma << '\n';
      return 0;
    }
  }
  if (mcnt % 2 == 0)
    cout << suma << '\n';
  else {
    cout << suma - 2 * mina << '\n';
  }
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int total =0;
    for (int i=0; i<N+1; i++) {
      int sum =0; 
      int a =i;
      while (a > 0) {
        sum += a % 10;
        a /= 10;
      }
      if (sum >= A && sum <= B) total += i;
    }
    System.out.println(total);
  }
}

Measured memory_bytes: 22868
import sys

N,M = (int(x) for x in input().split())
if N >= M:
  print("0")
  sys.exit()
  
cnt = 0
  
x = list(map(int,input().split()))
x.sort()

cost = {}
for i in range(len(x)-1):
  cost[i] = x[i+1] - x[i]
num = -1
cost = sorted(cost.items(), key=lambda x:x[1],reverse=True)
for i in range(N-1):
  a = cost[i][0]
  cnt += x[a] - x[num+1]
  num = a
cnt += x[len(x)-1] - x[num+1]
print(cnt)





Measured memory_bytes: 25040
n,k,s=map(int,input().split())
a=[0 for i in range(n)]
for i in range(k):
    a[i]=s
if s==10**9:
    for j in range(n-k):
        a[k+j]=10**9-1
else:
    for j in range(n-k):
        a[k+j]=s+1

print(*a)

Measured memory_bytes: 9580
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k, ans = 0; cin >> n >> k;

    for(int i = 0; n > 0; ans++){
        n /= k;
    }
    cout << ans;
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
if 2*10**5>=n:
    def cmb(n, r, mod):#コンビネーションの高速計算　
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    mod = 10**9+7 #出力の制限
    N = 2*10**5
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    print((2**n-1-cmb(n,a,mod)-cmb(n,b,mod))%mod)

else:
    def cmb(n,r,mod):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[r-1] * g2[r]  % mod

    mod = 10**9+7
    N=2*10**5
    g1 = [n%mod,n*(n-1)%mod] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * (n-i) ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    print((2**n-1-cmb(n,a,mod)-cmb(n,b,mod))%mod)

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


int main(){
    int A,B,C;
    cin >> A >> B >> C ;
    if (A==B&&B==C){
        cout << "No" << endl;
    }
    else if (A!=B&&B!=C&&A!=C){
        cout <<"No" << endl; 
    }
    else 
    cout << "Yes" << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<int,int> P;
const int mod = 1e9+7;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a){
        (x+=a.x)%=mod;
        return *this;
    }
    mint& operator-=(const mint a){
        (x-=mod-a.x)%=mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x)%= mod;
        return *this;
    }
    mint operator+(const mint a)const{
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a)const{
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a)const{
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
      if(!t)return 1;
      mint a = pow(t>>1);
      a*=a;
      if(t%1)a*=*this;
      return a;
    }

    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a){
      return (*this) *= a.inv();
    }
    mint operator/(const mint a)const{
      mint res(*this);
      return res/=a;
    }
};

struct combination{
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i<n;++i)fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i>=1;--i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if(k<0 || k>n)return 0;
    return fact[n] * ifact[k] + ifact[n-k]; 
  }
};

int main(){
    string s,t;
    cin >> s >> t;
    int ans = 10000;
    rep(i,s.size()-t.size()+1){
        auto f = [&]{
            int rel=0;
            rep(j,t.size()){
                if(t[j]!=s[i+j])rel++;
            }
            return rel;
        };
        int c = f();
        if(ans>c)ans=c;
    }    
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int n, i, j, x, y, z;
    bool ans = false;
    cin>>n;
    map<int, int>mapp;
    y = n / 3;
    z = y + y;
    for(i = 0; i < n; i++)
    {
        cin>>x;
        mapp[x]++;
    }
    if(mapp.size() == 1)
    {
        if(mapp.begin()->first == 0)
            ans = true;
    }
    else if(mapp.size() == 2 && (n % 3) == 0)
    {
        if(mapp.begin()->first == 0)
        {
            if(mapp.begin()->second == y)
            {
                if((++(mapp.begin()))->second == z)
                    ans = true;
            }
        }
    }
    else if(mapp.size() == 3 && (n % 3) == 0)
    {
        int f, s, t;
        f = (mapp.begin())->first;
        s = (++(mapp.begin())) ->first;
        t = (++(++(mapp.begin()))) ->first;
        if((f^s^t) == 0)
        {
            if(mapp[f] == mapp[s] && mapp[s] == mapp[t])
                ans = true;
        }
    }
    ans ? cout<<"Yes" : cout<<"No";
    return 0;
}


Measured memory_bytes: 3840
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    inf = 10**20
    #mod = 10**9 + 7

    N,k = map(int, input().split())
    zero, p, n = 0, [], []
    a = list(map(int, input().split()))
    for i in a:
        if i==0:
            zero += 1
        elif i > 0:
            p.append(i)
        else:
            n.append(i)
    p.sort()
    n.sort(reverse=True)

    #決め打ち二分探索
    #rはk個以上作れる, lはk個作れない
    l, r = -inf, inf
    while r - l > 1:
        mid = (l + r) // 2
        cnt = 0
        #0以上とき0の分足す
        if mid >= 0:
            cnt += zero*(zero-1)//2 + zero*(N-zero)
        
        if mid > 0:
            #負数足す
            cnt += len(n) * len(p)
            #p, nについてそれぞれ尺取り法で調べる
            for a in (p, n):
                left, right = 0, len(a)-1
                while left < right:
                    #a[l]*a[r]は小さくなっていきmid以下になったらそこから数える
                    while left<right and a[left]*a[right]>mid:
                        right -= 1
                    cnt += right - left
                    #lは最小から始まるのでrの値をリセットする必要はない
                    left += 1
        else:
            right = len(n) - 1
            for left in range(len(p)):
                while right>=0 and p[left]*n[right]<=mid:
                    right -= 1
                cnt += len(n) - right - 1
        
        if cnt >= k:
            r = mid
        else:
            l = mid

    print(r)



if __name__ == '__main__':
    main()


Measured memory_bytes: 89604
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int a = cin.Int();
			int b = cin.Int();

			int ans = Math.Max(0, a - b * 2);
			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 11092
#include <cstdio>

int main()
{
	int t,a,k;
	scanf("%d %d %d",&t,&a,&k);
	for (int i=1;i<=k;i++)
	{
		if (i&1)
		{
			a+=(t>>1);t>>=1;
		}
		else
		{
			t+=(a>>1);a>>=1;
		}
	}
	printf("%d %d\n",t,a);
	return 0;
}

Measured memory_bytes: 128
s=input()
t=input()
n=len(s)
x=[['',''] for _ in range(n)]
for i in range(n):
  x[i]=[s[i],t[i]]
x.sort(key=lambda x: x[0])

ss,tt='S','T'
for i in range(n):
  s=x[i][0]
  t=x[i][1]
  if ss==s and tt!=t:
    print("No")
    exit()
  ss=s
  tt=t
ss,tt='S','T'
x.sort(key=lambda x: x[1])
for i in range(n):
  s=x[i][0]
  t=x[i][1]
  if ss!=s and tt==t:
    print("No")
    exit()
  ss=s
  tt=t




print("Yes")
"""
print(x)  
s,t='',''
for i in range(n):
  s+=x[i][0]
  t+=x[i][1]

print(s)
print(t)
"""

Measured memory_bytes: 27232
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<stdio.h>
using namespace std;
int sum;
string st;
int main()
{
	cin>>st;
	for(int i=0;i<3;i++) sum+=st[i]-48;
	printf("%d\n",sum);
}


Measured memory_bytes: 256
/************
* 	@Just Another Source code by: ankit.sangwan1999
*	@created on: 4 Sept 2020
*/
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) //;cout.tie(NULL)
#define ll long long
const int mod = 1e9+7;
const long double pie = 3.14159265358979323846;
#define endl '\n'
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, ll> ma; // orderd_map using pb_ds
const int N = 401;
ll dp[N][N];
ll pre[N];
ll fun(int i, int j, int* arr){
	if(i==j) return 0;
	if(dp[i][j] != -1) return dp[i][j];

	ll ans = LLONG_MAX;
	for(int k=i;k<=j-1;k++){
		ll curr_cost = pre[j+1] - pre[i];
		ans = min(ans, curr_cost + fun(i, k, arr) + fun(k+1, j, arr));
	}
	return dp[i][j] = ans;
}

void solve(){
	memset(dp, -1, sizeof(dp));
	int n; cin>>n;
	int arr[n]; for(int i=0;i<n;i++) cin>>arr[i];
	pre[0] = 0;
	for(int i=1;i<=n;i++){
		pre[i] = pre[i-1] + arr[i-1];
	}
	cout<<fun(0, n-1, arr);
}
signed main(){
	// #ifndef ONLINE_JUDGE
 //    freopen("/mnt/DATA/D_Drive/CP/input.txt", "r", stdin);
 //    freopen("/mnt/DATA/D_Drive/CP/output.txt", "w", stdout);
 //    #endif

    fastio;
    int t=1;
    //cin>>t;

    while(--t>=0){
    	solve();
    }
		

    return 0;
}

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

using namespace std;


 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

//5
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){

ios::sync_with_stdio(false);
cin.tie(0);
long long int x;

cin>>x;//n展望台m道数
int res=0;

int f=0;
for(long long int i=-1000;i<=1000;i++){
for(long long int j=-1000;j<=1000;j++){
if(i*i*i*i*i-j*j*j*j*j==x){
cout<<i<<" "<<j<<endl;
f=1;
}
if(f==1)break;
}
if(f==1)break;

}





}



//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>l(n);
    for(int i = 0; i < n; i++)
    cin >> l.at(i);
    sort(l.begin(), l.end());
    long long cnt = 0;
    for(int i = 0; i < n - 2; i++){
        for(int j = i + 1; j < n - 1; j++){
            for(int k = n - 1; k > j; k--){
                if(l.at(i) + l.at(j) > l.at(k)){
                    cnt += (k - j);
                    break;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
  string S;
  cin >> S;

  vector<int> cnt(2, 0);  //長さ2の配列に答えを入れる。0初期化

  for (int i = 0; i < S.size(); i++){
  if (S[i] == '0') cnt[0]++;
  else cnt[1]++;
  }
  int ans = min(cnt[0], cnt[1]) * 2;

  cout << ans << endl;
}


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



int main()
{
 ll n,m;
 cin>>n>>m;
 
 ll s,c,ans[n];
 
 for(ll i=0;i<n;i++)ans[i]=-1;
 for(ll i=0;i<m;i++)
 {
 	cin>>s>>c;
 	
 	if((ans[s-1]==-1||ans[s-1]==c  ))
 	ans[s-1]=c;
 	else
 	return cout<<-1,0;
 }
 if(ans[0]==0&&n!=1)return cout<<-1,0;
 
 for(ll i=1;i<n;i++)
 {
 	if(ans[i]==-1)ans[i]=0;
 }

if(ans[0]==-1&&n>1)ans[0]=1;
else if(ans[0]==-1)ans[0]=0;

for(ll i=0;i<n;i++)cout<<ans[i];
}



Measured memory_bytes: 256
def solve(N, ABCs, Q, K, XYs):
    path = [[] for _ in range(N + 1)]
    for (a, b, c) in ABCs:
        path[a].append((b, c))
        path[b].append((a, c))

    dst = [0 for _ in range(N + 1)]

    q = [K]
    while len(q):
        index = q.pop()
        for n, w in path[index]:
            if dst[n] == 0:
                dst[n] = dst[index] + w
                q.append(n)
    ans = []
    for x, y in XYs:
        ans.append(str(dst[x] + dst[y]))
    return "\n".join(ans)

if __name__ == "__main__":
    N = int(input())
    ABCs = [tuple(map(int, input().split(" "))) for _ in range(N - 1)]
    Q, K = tuple(map(int, input().split(" ")))
    XYs = [tuple(map(int, input().split(" "))) for _ in range(Q)]
    print(solve(N, ABCs, Q, K, XYs))


Measured memory_bytes: 71916
#include <iostream>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main() {
	int n, x;
	int m[100];
	cin >> n >> x;
	int sum_m = 0;
	for (int i = 0; i < n; i++) {
		cin >> m[i];
		sum_m += m[i];
	}
	sort(m, m + n);
	x -= sum_m;
	int ans = floor(x / m[0]);
	cout << ans + n << endl;

	return 0;
}

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

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

  int num[3];
  num[0] = a + b;
  num[1] = a - b;
  num[2] = a * b;

  int max = num[0];
  for (int i = 0; i < sizeof(num) / sizeof(int); i++) {
    if (max < num[i]) {
      max = num[i];
    }
  }

  cout << max << 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++)

int main() {
  int N; cin >> N;
  vector<int> a(3*N);
  rep(i, 3*N) cin >> a[i];
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  long long ans = 0;
  rep(i, N) ans += a[2*i+1];
  
  cout << ans << endl;
  

}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	string b;
	cin>>b;
	for(int s=0;s<b.size();s++)
	{
		if(b[s]=='C')
		{
			for(int v=s+1;v<b.size();v++)
			{
				if(b[v]=='F')
				{
					cout<<"Yes"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    string S;
    cin >> S;
    const int n = S.size();
    VEC(bool) dp(n + 1, false);
    dp[n] = true;
    FORD(i, n - 5, -1) {
        //dream, dreamer, erase, eraser.
        string s5 = S.substr(i, 5);
        if (s5 == "dream" || s5 == "erase")
            dp[i] = dp[i] | dp[i + 5];
        if (i + 6 <= n && S.substr(i, 6) == "eraser")
            dp[i] = dp[i] | dp[i + 6];
        if (i + 7 <= n && S.substr(i, 7) == "dreamer")
            dp[i] = dp[i] | dp[i + 7];
    }
    cout << (dp[0] ? "YES" : "NO") << endl;
    return 0;
};


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

int main() {
    int h, w, d;
    cin >> h >> w >> d;

    map<int, pair<int, int>> a;
    int num;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> num;
            a[num] = make_pair(i, j);
        }
    }

    vector<int> s(h * w + 1, 0);
    for (int i = d + 1; i <= h * w; i++) {
        s[i] = s[i - d] + abs(a[i].first - a[i - d].first) + abs(a[i].second - a[i - d].second);
    }

    int q;
    cin >> q;
    int l, r;
    for (int i = 0; i < q; i++) {
        cin >> l >> r;
        cout << abs(s[l] - s[r]) << endl;
    }
}

Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int x, n;
    cin >> x >> n;
    vec p(n);
    rep(i, n) cin >> p[i];

    set<int> st;
    rep(i, n) st.insert(p[i]);

    for (int i = 0; i <= 100; i++) {
        int y = x + i;
        int z = x - i;
        if (st.find(z) == st.end()) {
            cout << z << endl;
            exit(0);
        }
        else if (st.find(y) == st.end()) {
            cout << y << endl;
            exit(0);
        }
    }

    return 0;
}

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

using namespace std;
using ll = long long;
const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }

    mint &operator/=(const mint a) { return *this *= a.inv(); }

    mint operator/(const mint a) const { return mint(*this) /= a; }
};

istream &operator>>(istream &is, const mint &a) { return is >> a.x; }

ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

int main() {
    int n;
    cin >> n;
    map<pair<int, int>, int> m;
    for (int i = 1; i <= n; ++i) {
        string s = to_string(i);
        m[make_pair(s[s.size() - 1] - '0', s[0] - '0')]++;
    }
    long long ans = 0;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            ans += m[make_pair(i, j)] * m[make_pair(j, i)];
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int A, B, C, D;

inline void read(){
	char ch;
	while( ch = (char)getchar(), ch < '0' || ch > '9' );
	A = ch - '0';
	ch = (char)getchar(); B = ch - '0';
	ch = (char)getchar(); C = ch - '0';
	ch = (char)getchar(); D = ch - '0';
}

int calc( int x, int y, bool z ){
	if( z ) return x + y;
	return x - y;
}

inline void print( bool x ){
	if( x ) printf( "+" );
	else printf( "-" );
}

int main(){
	read();
	for( int i = 0; i < 2; ++i )
		for( int j = 0; j < 2; ++j )
			for( int k = 0; k < 2; ++k ){
				int a = A, b = B, c = C, d = D;
				b = calc( a, b, i );
				c = calc( b, c, j );
				d = calc( c, d, k );
				if( d == 7 ){
					printf( "%d", A );
					print(i);
					printf( "%d", B );
					print(j);
					printf( "%d", C );
					print(k);
					printf( "%d", D );
					printf( "=7\n" );
					return 0;
				}
			}
	return 0;
}

Measured memory_bytes: 128
fn main() {
    proconio::input! {
        n: usize,
        m: usize,
        mut k: u64,
        a: [u64; n],
        b: [u64; m],
    }

    let mut ni = 0;
    while ni < n && a[ni] <= k {
        k -= a[ni];
        ni += 1;
    }

    let mut mi = 0;
    while mi < m && b[mi] <= k {
        k -= b[mi];
        mi += 1;
    }

    let mut nms = ni + mi;
    if nms == n + m {
        println!("{}", nms);
    } else {
        let mut r = nms;

        while ni > 0 {
            ni -= 1;
            k += a[ni];
            nms -= 1;
            while mi < m && b[mi] <= k {
                k -= b[mi];
                mi += 1;
                nms += 1;
            }
            r = std::cmp::max(r, nms);
        }
    
        println!("{}", r);
    }
}


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

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int res = a * x + b * y;
    res = min(res, (c * 2) * max(x, y));
    res = min(res, min(x, y) * 2 * c + a * (x - min(x,y)) + b * (y - min(x, y)));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
 public static void main(String[] args) {
	Scanner in = new Scanner(System.in);
	in.useDelimiter("(\\p{javaWhitespace}|,)+");
	int[] span = new int[10];
	int allSpan, sA, sB;
	while (in.hasNext()) {
	 allSpan = 0;
	 for (int i = 0; i < 10; i++) {
		span[i] = in.nextInt();
		allSpan += span[i];
	 }
	 sA = in.nextInt();
	 sB = in.nextInt();
	 double l = (sA * (double) allSpan) / (sA + sB);
	 int posi = 1;
	 for (int i = 0; i < 10; i++) {
		if (l > 0) {
		 l -= span[i];
		 posi = i + 1;
		}
	 }
	 System.out.println(posi);
	}
 }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
using ll = long long;

int main()
{
    // 整数の入力
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;

    int min_time = (H2 * 60 + M2) - (H1 * 60 + M1) - K;
    cout << min_time << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

const int SIZE = 1e5+10;
ll n, m;
ll a[SIZE];
ll mem[SIZE];

int main(){
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> a[i];
        mem[a[i]] = -1;
    }

    mem[0] = 1;
    for(int i = 0; i < n+1; i++){
        if(mem[i] != -1) mem[i] = mem[i] % 1000000007;
        if(mem[i+1] != -1)  mem[i+1] = mem[i+1] % 1000000007;
        if(mem[i+2] != -1) mem[i+2] = mem[i+2] % 1000000007;

        if(mem[i] == -1)    continue;
        if(mem[i+1] != -1)  mem[i+1] += mem[i];
        if(mem[i+2] != -1)  mem[i+2] += mem[i];
    }

    cout << mem[n] << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

typedef struct
{
  long long int w[100];
}big;

big tasu(big a,big b)
{
  long long int w;
  big q;
  long long int mae = 0;
  for(int i = 0; i < 100; i++)
    {
      w = a.w[i] + b.w[i] + mae;
      mae = w / 1000000;
      w = w % 1000000;
      q.w[i] = w;
    }
  return q;
}

big syoki(long long int a)
{
  big q;
  for(int i = 0; i < 100; i++)
    {
      q.w[i] = 0;
    }
  q.w[0] = a;
  return q;
}

void hyozi(big a)
{
  char flg = 0;
  for(int i = 100 - 1; i >= 0; i--)
    {
      if(flg != 0)
	{
	  printf("%06lld",a.w[i]);
	}
      else if(a.w[i] != 0)
	{
	  printf("%lld",a.w[i]);
	  flg = 1;
	}
    }
  if(flg == 0)
    {
      printf("0");
    }
  printf("\n");
}

typedef struct
{
  long long int x;
  long long int y;
}WWW;


long long int wkyori(WWW a,WWW b)
{
  return abs(a.x - b.x) + abs(a.y - b.y);
}

WWW ww[100000];
long long int x[100000];
long long int y[100000];

int main()
{
  long long int w,h;
  int n;
  scanf("%lld %lld",&w,&h);
  scanf("%d",&n);
  long long int xw,yw;
  for(int i = 0; i < n; i++)
    {
      scanf("%lld %lld",&xw,&yw);
      x[i] = xw;
      y[i] = yw;
      ww[i].x = xw;
      ww[i].y = yw;
    }
  sort(x,x + n);
  sort(y,y + n);
  WWW ori;
  int sai;
  if(n % 2 == 1)
    {
      ori.x = x[(n + 1) / 2 - 1];
      ori.y = y[(n + 1) / 2 - 1];
      long long int longer = 0;
      for(int i = 0; i < n; i++)
	{
	  if(longer <= wkyori(ori,ww[i]))
	    {
	      longer = wkyori(ori,ww[i]);
	      sai = i;
	    }
	}
    }
  else
    {
      WWW s;
      long long int longer = 0;
      for(int i = 0; i < n; i++)
	{
	  if(ww[i].x > x[n / 2 - 1])
	    {
	      s.x = x[n / 2 - 1];
	    }
	  else
	    {
	      s.x = x[n / 2];
	    }
	  if(ww[i].y > y[n / 2 - 1])
	    {
	      s.y = y[n / 2 - 1];
	    }
	  else
	    {
	      s.y = y[n / 2];
	    }
	  if(longer < wkyori(s,ww[i]))
	    {
	      ori = s;
	      longer = wkyori(s,ww[i]);
	      sai = i;
	    }
	  else if(longer == wkyori(s,ww[i]))
	    {
	      if(s.x < ori.x || (s.x == ori.x && s.y < ori.y))
		{
		  ori = s;
		  longer = wkyori(s,ww[i]);
		  sai = i;
		}
	    }
	}
    }
  big last = syoki(0);
  for(int i = 0; i < n; i++)
    {
      if(i != sai)
	{
	  last = tasu(last,syoki(wkyori(ori,ww[i]) * 2));
	}
      else
	{
	  last = tasu(last,syoki(wkyori(ori,ww[i])));
	}
    }
  hyozi(last);
  printf("%lld %lld\n",ori.x,ori.y);
  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int x, y, z;
  cin >> x >> y >> z;
  
  swap(x, y);
  swap(x, z);
  
  cout << x << " " << y << " " << z << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
  int N, M, ans = 0, box, next, flag = 1 ;
  cin >> N >> M ;
  int A[M], B[M], sign[N+1] = {} ;
  queue<int> Rin[N+1] ;
  for(int i=0;i<M;i++){
    cin >> A[i] >> B[i] ;
    Rin[A[i]].push(B[i]) ;
    Rin[B[i]].push(A[i]) ;
  }
  queue<int> queue ;
  queue.push(1) ;
  while(!queue.empty()){
    box = queue.front() ;
    while(!Rin[box].empty()){
      next = Rin[box].front() ;
      if(sign[next] == 0){
        sign[next] = box ;
        queue.push(next) ;
      } 
      Rin[box].pop() ;
    }
    queue.pop() ;
  }
  for(int i=2;i<N+1;i++){
    if(sign[i] == 0) flag = 0;
  }
  if(flag){
    cout << "Yes" << endl ;
    for(int i=2;i<N+1;i++){
      cout << sign[i] << endl ;
    }
  }  
  else{
    cout << "No" << endl ;
  }  
  return 0 ;
}  

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

int main() {
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;

    if (u==s) {
        cout << a-1 << " " << b << endl;
    } else {
        cout << a << " " << b-1 << endl;
    }
}

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

int main() {
  long count =0;
  int a,b;
  cin>>a>>b;
  switch(a+b){
    case 3:
      cout<<3;
      return 0;
    case 4:
      cout<<2;
      return 0;
    case 5:
      cout<<1;
      return 0;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
struct edge
{
  ll to;
  ll cost,num;
  edge() {}
  edge(ll to, ll cost,ll num) : to(to), cost(cost),num(num){};
};
int main()
{
ll n, m;
cin >> n >> m;
vector<vector<edge>> g(n);
vector<vector<edge>> gg(n);
vector<ll> v(n);
rep(i, n){
  cin >> v[i];
}
rep(i, m)
{
  ll a, b;
  cin >> a >> b ;
  g[a - 1].emplace_back(b - 1, -1,i);
  g[b - 1].emplace_back(a - 1, -1,i);
}
rep(i,n){
  bool ok=0;
  for(auto r:g[i])if(v[i]>=v[r.to])ok=1;
  if(!ok){
    cout << -1 << endl;
    return 0;
  }
}
vector<bool> s(n,0);
vector<bool> see(n,0);
vector<ll> ans(m,1000000000);
rep(i,n){
  if(see[i])continue;
  ll mi=1LL<<40;
  for(auto r:g[i])mi=min(mi,v[r.to]);
  for(auto r:g[i])if(mi==v[r.to]){
    ans[r.num]=v[i];
    gg[r.to].emplace_back(i, -1,i);
    gg[i].emplace_back(r.to, -1,i);
    break;}
}
rep(i,n){
  if(see[i])continue;
  queue<ll> q;
  q.push(i);
  while(!q.empty()){
    ll p=q.front();
    see[p]=1;
    q.pop();
    for(auto r:gg[p]){
      if(!see[r.to]){
        s[r.to]=!s[p];
        q.push(r.to);
      }
    }
  }
}
string ss="";
rep(i,n){
  if(s[i])ss+='B';
  else ss+='W';
}
cout << ss << endl;
for(auto r:ans)cout << r << endl;
return 0;
}

Measured memory_bytes: 29568
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
   char x,y;
   cin >> x >> y;  
   cout << (x<y ? "<" : x>y ? ">" : "=") << endl;
}

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

int main()
{
	int d;
	while (cin >> d)
	{
		switch (d)
		{
		case 22:
			cout << "Christmas Eve Eve Eve" << endl;
			break;

		case 23:
			cout << "Christmas Eve Eve" << endl;
			break;

		case 24:
			cout << "Christmas Eve" << endl;
			break;

		case 25:
			cout << "Christmas" << endl;
			break;
		default:
			break;
		}
	}
}

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

using namespace std;

int main()
{
  int a,b,c; cin>>a>>b>>c;
  int sum=a+b+c;
  int max_value=max({a,b,c});
  int min_value=min({a,b,c});
  sum-=(max_value+min_value);
  
  cout<<max_value*10+sum+min_value<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, b
# s = input()

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

ac = 0
wa = 0
memo = [0]*(N+1)

for _ in range(M):
    p, S = input().split()
    p = int(p)

    if S == "AC":
        if memo[p] != -1:
            ac += 1
            wa += memo[p]
            memo[p] = -1
    else:
        if memo[p] != -1:
            memo[p] += 1

print(ac, wa)


Measured memory_bytes: 50520
#include <stdio.h>

int is_prime(int x) {
    if (x == 2) { return 1; }
    if (x < 2 || x % 2 == 0) { return 0; }
    int i = 3;
    while (i * i <= x) {
        if (x % i == 0) { return 0; }
        i += 2;
    }
    return 1;
}

int main() {
    int n, m, ans = 0;
    scanf("%d", &n);

    while (n--) {
        scanf("%d", &m);
        if (is_prime(m)) { ans++; }
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 1796
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println(less9x9checker(n));
	}
	
	static String less9x9checker(int n) {
		for(int i = 0; i < 10; i++) {
			for(int ii = 0; ii < 10; ii++) {
				if(n == i*ii){
					return "Yes";
				}
			}			
		}
		return "No";
	}

}


Measured memory_bytes: 24916
import java.util.*;

class Main{

    int w, h;
    int[][] map;
    int gx, gy;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            w = sc.nextInt(); h = sc.nextInt();
            if(w==0 && h==0) break;

            map = new int[h][w];
            int sxc = 0, syc = 0, sxm = 0, sym = 0;
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    map[i][j] = sc.nextInt();
                    if(map[i][j]==2){ map[i][j] = 0; sxc = j; syc = i; }
                    if(map[i][j]==4){ map[i][j] = 0; sxm = j; sym = i; }
                    if(map[i][j]==3){ gx = j; gy = i; }
                }
            }
            System.out.println(bfs(sxc, syc, sxm, sym));
        }
    }

    int[] dx = {0, 0, 1, -1};
    int[] dy = {1, -1, 0, 0};
    int bfs(int sxc, int syc, int sxm, int sym){
        //cargo's pos, man's pos, cnt
        Queue<int[]> q = new LinkedList<int[]>();
        q.add(new int[]{sxc, syc, sxm, sym, 0});
        boolean[][][][] v = new boolean[h][w][h][w];

        while(q.size()>0){
            int[] qq = q.poll();
            int xc = qq[0], yc = qq[1], xm = qq[2], ym = qq[3], cnt = qq[4];

            if(xc==gx && yc==gy) return cnt;
            if(v[yc][xc][ym][xm]) continue;
            v[yc][xc][ym][xm] = true;

            for(int i=0; i<4; i++){
                int nx = xc + dx[i], ny = yc + dy[i];
                int mx = xc - dx[i], my = yc - dy[i];
                if(nx<0 || nx>=w || ny<0 || ny>=h || map[ny][nx]==1) continue;
                if(mx<0 || mx>=w || my<0 || my>=h || map[my][mx]==1) continue;
                if(check(xm, ym, mx, my, xc, yc)) q.add(new int[]{nx, ny, xc, yc, cnt+1});
            }
        }

        return -1;
    }

    boolean check(int x1, int y1, int x2, int y2, int x3, int y3){
        Queue<int[]> q = new LinkedList<int[]>();
        q.add(new int[]{x1, y1});
        boolean[][] v = new boolean[h][w];

        while(q.size()>0){
            int[] qq = q.poll();
            int x = qq[0], y = qq[1];

            if(x==x2 && y==y2) return true;
            if(v[y][x]) continue;
            v[y][x] = true;

            for(int i=0; i<4; i++){
                int nx = x + dx[i], ny = y + dy[i];
                if(nx<0 || nx>=w || ny<0 || ny>=h 
                   || map[ny][nx]==1 || (nx==x3 && ny==y3)) continue;
                q.add(new int[]{nx, ny});
            }
        }

        return false;
    }

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

Measured memory_bytes: 24408
n = int(input())
P = [int(input()) for i in range(n)]

def isPrime(n):
    s_n = int(n**0.5)
    if n < 2:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    else:
        for i in range(3, s_n+1, 2):
            if n % i == 0:
                return False
    return True
            
cnt = 0
for i in P:
    cnt += isPrime(i)

print(cnt)
            


Measured memory_bytes: 5992
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
using namespace std;
typedef long long ll;
const ll INF = 1e15;

ll dp[100010][3];

ll h[100010][3];

int main() {
  ll n;
  cin >> n;
  REP(i, n) {
    REP(j, 3) { cin >> h[i][j]; }
  }

  REP(i, n) {
    REP(j, 3) REP(k, 3) {
      if (j == k) continue;
      dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + h[i][k]);
    }
  }
  ll ans = 0;
  REP(i, 3) ans = max(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#define ll long long
using namespace std;
int main()
{
    int n;
    set<int>s;
    cin>>n;
    for(int i = 0; i < n; i++){
        int t;
        cin>>t;
        s.insert(t);
    }
    int num = s.size();
    int more = n-num;
    int ans;
    if(more % 2 != 0)ans = n-more-1;
    else ans = n-more;
    cout<<ans;

    return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
#include<string.h>
int main()
{
    char str[5];
    char str1[]= "ABC";
    char str2[]= "ARC";

    gets(str);

    if(strcmp(str1,str)==0)
        puts(str2);
    else if(strcmp(str2,str)==0)
        puts(str1);
    return 0;

}


Measured memory_bytes: 1512
#include <stdio.h>

int main(){
    int a, b, c;
    int s, m, d;  //小中大
    
    scanf("%d %d %d", &a, &b, &c );
    
    if(a >= b && a >= c){
        d = a;
        if(b >= c){
            m = b;
            s = c;
        }else{
            m = c;
            s = b;
        }
    }
    
      if(b >= a && b >= c){
        d = b;
        if(a >= c){
            m = a;
            s = c;
        }else{
            m = c;
            s = a;
        }
    }
    
     if(c >= a && c >= b){
        d = c;
        if(a >= b){
            m = a;
            s = b;
        }else{
            m = b;
            s = a;
        }
    }
    
    printf("%d %d %d\n", s, m, d);
    
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

void liff(int n, int card_[500]){
	int card[500];
	for(int i = 1; i <= 2 * n; i++){
		card[i] = card_[i];
	}
	for(int i = 1; i <= n; i++){
		card_[2 * i - 1] = card[i];
		card_[2 * i] = card[i + n];
	}
}

void cut(int k, int n, int card_[500]){
	int card[500];
	for(int i = 1; i <= 2 * n; i++){
		card[i] = card_[i];
	}
	for(int i = 1; i <= 2 * n; i++){
		if(i + k <= 2 * n){
			card_[i] = card[i + k];
		}else{
			card_[i] = card[i + k - 2 * n];
		}
	}
}

int main(){
	
	int card[500];
	
	int n, m;
	cin >> n;
	
	for(int i = 1; i <= 2 * n; i++){
		card[i] = i;
	}
	
	cin >> m;
	
	int k;
	
	for(int i = 0; i < m; i++){
		cin >> k;
		if(k == 0){
			liff(n, card);
		}else{
			cut(k, n, card);
		}
	}
	
	
	for(int i = 1; i <= 2 * n; i++){
		printf("%d\n", card[i]);
	}
	
	return 0;
}

Measured memory_bytes: 1148