akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

class Data{
public:
	string term;
	int freq;
	Data (string _term, int _freq){
		term = _term;
		freq = _freq;
	}
	bool operator<(const Data& d) const{
		if(freq == d.freq) return term < d.term;
		else{
			return freq > d.freq;
		}
	}
};

vector<string> split(string delim,string str){
	vector<string> res;
	str += delim;
	for(int i=0;i<str.size();i++){
		for(int j=1;i+j<=str.size();j++){
			if(str.substr(i,j).find(delim) != string::npos){
				if(str.substr(i,j-1).size() > 0 ) res.push_back(str.substr(i,j-1));
				i+=j-1;
				break;
			}
		}
	}

	return res;
}

int main(){
	ios::sync_with_stdio(false);

	int n;
	string str;

	while(cin>>n,n){
		//n=str[0]-'0';
		//if(n==0) break;
		cin.ignore();

		map<string,int> freq;
		map<char,vector<string> > dict;

		for(int i=0;i<n;i++){
			getline(cin,str);
			stringstream ss(str);

			string s;
			while(ss >> s){
				freq[s]++;
			}		
		}

		getline(cin,str);

		vector<Data> data;
		for(map<string,int>::iterator it = freq.begin(); it != freq.end(); it++){
			if(it->first[0] == str[0]) data.push_back(Data(it->first,it->second));
		}

		if(data.size()==0){
			cout << "NA" << "\n";
		}

		else{
			sort(data.begin(),data.end());

			for(int i=0;i<data.size() && i < 5;i++){
				if(i!=0) cout << " ";
				cout << data[i].term;
			}
			cout << "\n";
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  int a, b;
  cin >> a >> b;

  int ans = max(max(a + b, a - b), a * b);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a, b;
	char op;
	while(scanf("%d %c %d", &a, &op, &b))
	{
		int ans;
	
		if(op == '?')
		{
			break;
		}
		if(op == '+')
		{
			ans = a + b;
		} 
		if(op == '-')
		{
			ans = a - b;
		} 
		if(op == '*')
		{
			ans = a * b;
		} 
		if(op == '/')
		{
			ans = a / b;
		} 
		printf("%d\n", ans);
	}
	
	
	return 0;
} 


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	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 {
		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;
	}
};

int main() {
	
	int n;
	string s1, s2;
	cin >> n >> s1 >> s2;
	mint ans = 3;
	rep(i, n){
		if(s1[i] == s1[i+1]){
			if(i == 0) ans *= 2;
			else if(s1[i-1]==s2[i-1]) ans *= 2;
			else ans *= 3;
			i++;
		}else{
			if(i>0){
				if(s1[i-1]==s2[i-1]) ans *= 2;
			}
		}
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long k;
  cin>>s>>k;
  int n=s.length();
  for (size_t i = 0; i < n; i++) {
    if(s[i]!='1'){
      cout<<s[i];
      return 0;
    }
    if(k>100)continue;
    k--;
    if(k==0){
      cout<<1;
      return 0;
    }
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2*10**9)

N, M = map(int, input().split())
friends = [[] for _ in range(N)]
for k in range(M):
  A, B = map(int, input().split())
  A -= 1
  B -= 1
  friends[A].append(B)
  friends[B].append(A)
group = []
sgn = [0 for _ in range(N)] #0なら未所属
def make_group(person, groupnum):
  sgn[person] = 1
  for f in friends[person]:
    if sgn[f] == 0:
      group[groupnum].append(f)
      make_group(f, groupnum)
  return None

c = 0
for k in range(N):
  if sgn[k] == 0:
    group.append([k])
    make_group(k, c)
    c += 1
ans = 0
for g in group:
  ans = max(len(g), ans)
print(ans)

Measured memory_bytes: 212224
#include <stdio.h>
 
#include <stdio.h>
#include <stdlib.h>
 
#define INF     0x70707070
#define RANGE   10
 
typedef struct { int x, y; } T;
T tbl[500100];
 
//#define getchar_unlocked()  getchar()
int in()
{
    int n = 0, c = getchar_unlocked();
    if (c == '-') { c = getchar_unlocked();
        do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
        return -n;
    }
    do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
    return n;
}
 
int cmp(T *a, T *b)
{
    if (a->x - b->x) return a->x - b->x;
    return a->y - b->y;
}
 
int main()
{
    int N, i, j, lim;
    int dx, dy, d, t, ans;
 
    N = in();
    for (i = 0; i < N; i++) tbl[i].x = in(), tbl[i].y = in();
    qsort(tbl, N, sizeof(T), cmp);
 
    ans = INF; d = 0;
    for (i = 0; i < N; i++) {
        lim = i+RANGE; if (lim > N) lim = N;
        for (j = i+1; j < lim; j++) {
            dx = tbl[i].x-tbl[j].x;
            dy = tbl[i].y-tbl[j].y;
            t = dx*dx + dy*dy;
            if (t < ans) ans = t;
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

def solve():
    import math

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

    if x > a*a*b/2:
        s = x/a
        # a*b-s = a*h*(1/2)
        h = (a*b-s)*2/a
        theta = math.atan2(h, a)
        ans = math.degrees(theta)
        print(ans)

    else:
        s = x/a
        h = (s*2)/b
        theta = math.atan2(h, b)
        ans = 180-90-math.degrees(theta)
        print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int N,M;
  cin>>N>>M;
  vector<vector<int> >  GRAPH(3*N);
  for (int i = 0; i < M; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    GRAPH[A].emplace_back(B + N);
    GRAPH[N + A].emplace_back(B + 2*N);
    GRAPH[2*N + A].emplace_back(B);
    // GRAPH[B].emplace_back(A);
  }
  int S,T;cin>>S>>T;S--;T--;
  queue<int> q;
  q.push(S);
  vector<int> path (3*N,INF);
  path[S] = 0;
  // DEBUG(GRAPH2);
  while(!q.empty())
  {
    int V = q.front();
    q.pop();

    for (int i = 0; i < GRAPH[V].size(); i++)
    {
      int nV = GRAPH[V][i];
      // DEBUG(GRAPH2[V].size(),"\n");
      if(path[nV] == INF)
      {
        path[nV] = path[V]+1;
        q.push(nV);
      }
    }
    // DEBUG(path);
  }
    // DEBUG(path,char(10));
    if (path[T] == INF)
    {
      cout << -1 << endl;
      return;
    }

  cout<<path[T]/3<<endl;

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 19072
#include <bits/stdc++.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

int main(void) {
	int h,a; cin >> h >> a;
	int ans = (h-1)/a+1;
	out(ans);
}




Measured memory_bytes: 256
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)

ret = [0] * (n + 1)
for start in range(n):
    parent = [-1] * n
    q = [start]
    while len(q) > 0:
        i = q.pop(0)
        for j in edges[i]:
            if j == start:
                loop = [i]
                while i != start:
                    i = parent[i]
                    loop.append(i)
                if len(ret) > len(loop):
                    ret = loop
                break
            if parent[j] == -1:
                parent[j] = i
                q.append(j)

if len(ret) > n:
    print(-1)
else:
    print(len(ret))
    for i in reversed(ret):
        print(i + 1)



Measured memory_bytes: 48872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
int arr[100];

int dp[2][100][100][100];

int ans,nd;
int parity(int prev,int pos,int od,int ev)
{
     if(pos==nd) return 0;
     if(dp[prev][pos][od][ev]!=-1) return dp[prev][pos][od][ev];
     int x=INT_MAX,y=INT_MAX,p=INT_MAX,q=INT_MAX,m=INT_MAX,n=INT_MAX,k=INT_MAX,l=INT_MAX;


    if(arr[pos]==0)
    {
        if(prev==1)
        {
          if(od!=0) x=parity(1,pos+1,od-1,ev)+0;
          if(ev!=0) y=parity(0,pos+1,od,ev-1)+1;
        }
        else
        {

           if(ev!=0) q=parity(0,pos+1,od,ev-1)+0;
           if(od!=0) p=parity(1,pos+1,od-1,ev)+1;

        }

    }
    else
    {
        if(arr[pos]%2 && prev==1) m=parity(1,pos+1,od,ev)+0;
        if(arr[pos]%2 && prev==0) n=parity(1,pos+1,od,ev)+1;
        if(arr[pos]%2==0 && prev==0) k=parity(0,pos+1,od,ev)+0;
        if(arr[pos]%2==0 && prev==1) l=parity(0,pos+1,od,ev)+1;


    }
   dp[prev][pos][od][ev]=min({p,q,m,n,x,y,k,l});
   return dp[prev][pos][od][ev];
}


int main()
{


 int  a,b;
 cin>>a>>b;
 cout<<(int)ceil(a*1.0/b*1.0)<<endl;

}















Measured memory_bytes: 256
n = int(input())

lt = []
for _ in range(n):
    lt.append(tuple(map(int, input().split())))

for i in range(n-2):
    if len(set(lt[i])) == 1 and len(set(lt[i+1])) == 1 and len(set(lt[i+2])) == 1:
        print("Yes")
        exit(0)
print("No")


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

int main() {
    // your code goes here
    ll h,w,c[30][30]={0},i,j,k,l,r,ans=0,x,y;
    char s[30][30];
    cin >> h >> w;
    for(i=1;i<=h;i++){
        cin >> s[i];
        for(j=0;j<w;j++){
            if(s[i][j]=='.') c[i][j+1]=1;
        }
    }
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            for(k=1;k<=h;k++){
                for(l=1;l<=w;l++){
                    if(c[i][j]==0||c[k][l]==0) continue;
                    if(i==k&&j==l) continue;
                    queue<pair<ll,ll>> que;
                    que.push({i,j});
                    r=0;
                    ll kd[30][30]={0};
                    bool used[30][30]={0};
                    while(!que.empty()){
                        x=que.front().first;
                        y=que.front().second;
                        used[x][y]=true;
                        que.pop();
                        if(r==0) kd[x][y]=0;
                        ll rm=kd[x][y];
                        if(x==k&&y==l){
                            ans=max(ans,kd[x][y]);
                            break;
                        }
                        x++;
                        if(c[x][y]==1&&!used[x][y]) que.push({x,y});
                        if(c[x][y]==1&&!used[x][y]) kd[x][y]=rm+1;
                        if(c[x][y]==1&&!used[x][y]) used[x][y]=true;
                        x-=2;
                        if(c[x][y]==1&&!used[x][y]) que.push({x,y});
                        if(c[x][y]==1&&!used[x][y]) kd[x][y]=rm+1;
                        if(c[x][y]==1&&!used[x][y]) used[x][y]=true;
                        x++;
                        y++;
                        if(c[x][y]==1&&!used[x][y]) que.push({x,y});
                        if(c[x][y]==1&&!used[x][y]) kd[x][y]=rm+1;
                        if(c[x][y]==1&&!used[x][y]) used[x][y]=true;
                        y-=2;
                        if(c[x][y]==1&&!used[x][y]) que.push({x,y});
                        if(c[x][y]==1&&!used[x][y]) kd[x][y]=rm+1;
                        if(c[x][y]==1&&!used[x][y]) used[x][y]=true;
                        y++;
                        r++;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;

int main(){
    int A, B, H, M;
    static const double pi = 3.141592653589793;
    cin >> A >> B >> H >> M;
    double H2 = H*30+M*0.5;
    double M2 = M*6;
    double angle = min(360-abs(H2-M2), abs(H2-M2));
    double C = pow(A, 2)+pow(B, 2)+(-2*A*B*cos(angle*(pi/180)));
    cout << fixed << setprecision(20) << sqrt(C) << endl;
    return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; 
typedef string str;
 
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
 
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define endl '\n'
 
const ll MOD = 1000000007;

int main() {
   int n, m; scanf("%d%d", &n, &m);
   vector<ll> dp(n + 1);
   dp[0] = 1;
   dp[1] = m - n;
   for (int i = 2; i <= n; i++) {
      dp[i] += (m - n + i - 1) * dp[i - 1] + (i - 1) * dp[i - 2];
      dp[i] = dp[i] % MOD;
   }
   ll ans = dp[n];
   for (int i = m - n + 1; i <= m; i++) {
      ans *= i;
      ans = ans % MOD;
   }
   printf("%lld", ans);
   return 0;
}

Measured memory_bytes: 7104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int H,W,N;
    cin >> H >> W >> N;
    vector<vector<int>> G(H,vector<int>(W));
    bool R = true;
    int nowH=0,nowW=0;
    rep(i,N){
        int a;
        cin >> a;
        rep(j,a){
            G[nowH][nowW]=i+1;
            if(nowW+1==W){
                nowW=0;
                nowH++;
            }else{
                nowW++;
            }
        }
    }
    rep(i,H){
        if(i%2==1){
            reverse(G[i].begin(),G[i].end());
        }
        rep(j,W){
            cout << G[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
def period_to_zero(value:str):
    if value == ".":
        return 0
    return value

H,W = map(int, input().split())
S = list()
S.append([0]*(W+2))
for i in range(H):
    s = list()
    s.append(0)
    s.extend(list(map(period_to_zero, list(input()))))
    s.append(0)
    S.append(s)
S.append([0]*(W+2))

for i in range(1, len(S)-1):
    s_prev = S[i-1]
    s_current = S[i]
    s_next = S[i+1]
    for j in range(1, len(s_current)-1):
        if s_current[j] != "#":
            s_current[j] = (s_prev[j-1:j+2] + s_next[j-1:j+2] + [s_current[j-1], s_current[j+1]]).count("#")
        
for i in range(1, len(S)-1):
    s = S[i]
    print(*s[1:len(s)-1],sep="")

Measured memory_bytes: 9296
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	private static boolean isTriangle(int a,int b,int c)
	{
		int[] edge={a,b,c};
		Arrays.sort(edge);
		return edge[0]*edge[0]+edge[1]*edge[1]==edge[2]*edge[2];
	}
	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int a,b,c;
		for(int i=0;i<N;i++){
			a=scan.nextInt();
			b=scan.nextInt();
			c=scan.nextInt();
			if(isTriangle(a,b,c)){
				System.out.println("YES");
			}else{
				System.out.println("NO");				
			}
		}
		scan.close();
	}
}

Measured memory_bytes: 34016
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  int counter=0;
  int odd=0;
  cin >> N;
  
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  //配列に数字を入れた
  
while(odd == 0){
  for(int i = 0; i < N; i++){
    if(vec.at(i) % 2 == 0){
      vec.at(i) /= 2; //偶数なら一つずつ2で割っていく
      if (i == N-1) counter++;//N番目まで割れたらカウンター+1
    }else{
      odd++;
      break;//奇数が出たらループから出る
    }
  }
}
  cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}
ll LCM(ll x, ll y) { 
  return x / GCD(x, y) * y;
}

int main() {
    int a[3][3];
    bool res[3][3];
    rep(i, 3) rep(j, 3) res[i][j] = 0;
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    int n; cin >> n;
    int b[n];
    rep(i, n) {
        int b; cin >> b;
        rep(j, 3) {
            rep(k, 3) {
                if(b == a[j][k]) res[j][k] = 1;
            }
        }
    }
    //rep(i, 3) rep(j, 3) cout << res[i][j] << endl;
    rep(i, 3) {
        if(res[i][0] && res[i][1] && res[i][2]) {
            cout << "Yes" << endl;
            return 0;
        }
        if(res[0][i] && res[1][i] && res[2][i]) {
           cout << "Yes" << endl;
            return 0; 
        }
    }
    if(res[0][0] && res[1][1] && res[2][2]) {
        cout << "Yes" << endl;
        return 0;
    }
    if(res[0][2] && res[1][1] && res[2][0]) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;cin >> n >> a >> b;
	cout << min(a*n,b) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int a,b;

   scanf("%d %d",&a,&b);

   if(a<b){
      printf("a < b\n");
   }else if(a>b){
      printf("a > b\n");
   }else{
      printf("a == b\n");
   }

   return 0;
}

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

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] == '1'){
            cout << 9;
        } else {
            cout << 1;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
const int oo = 1 << 30;
using namespace std;

typedef unsigned long long ull;

void solve(){
    int N, W;
    scanf("%d %d", &N, &W);
    vector<int> w(N + 1); 
    vector<ull> v(N + 1);
    for(int i = 1; i <= N; ++i){
        scanf("%d %llu", &w[i], &v[i]);
    }
    vector<ull> dp(W + 1, 0);
    for(int i = 1; i <= N; ++i){
        for(int j = W; j >= w[i]; --j){
            dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
        }
    }
    printf("%llu\n", dp[W]);

}
int main(){
    // freopen("/Users/deepsajeda/Documents/FIRST/in", "r", stdin);
    // freopen("/Users/deepsajeda/Documents/FIRST/out", "w", stdout);
    for(int i = 0; i < 1; ++i){
        solve();
    }
}
//printf("%.5f\n", clock() / (float)CLOCKS_PER_SEC); time in seconds


Measured memory_bytes: 1024
use std::io::*;
use std::str::*;
use std::process;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main(){
    let s:String = read();
    let s:Vec<char>  = s.chars().collect::<Vec<char>>();
    let mut v = vec![0;4];
    for i in 0..s.len(){
        if(s[i]=='N'){
            v[0]=1;
        }
        if(s[i]=='W'){
            v[1]=1;
        }if(s[i]=='S'){
            v[2]=1;
        }if(s[i]=='E'){
            v[3]=1;
        }
    }

    let  ans:bool = (((v[0]^v[2]) | (v[1]^v[3]))&1)==0;
    if ans {
        println!("Yes");
    }
    else {
        println!("No");
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().unwrap_or_else(|_| panic!("Faild to parse {}", s))
}


Measured memory_bytes: 4352
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double
 
int32_t main()
{
    IOS;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int maxval=a*c;
    maxval=max(maxval,a*d);
    maxval=max(maxval,b*c);
    maxval=max(maxval,b*d);
    print(maxval);
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n;cin >> n;
    vi a(n); rep(i,n) cin >> a[i];

    ll ans = LINF;
    for(int i=-100;i<=100;i++){
        ll cost = 0;
        rep(j,n){
            cost += (a[j]-i) *  (a[j]-i);
        }
        ans = min(ans,cost);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

s=get
ans=""
s.each do|s_|
    ans+=s_[0].upcase
end

puts ans

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


int main() {
    char c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> c[i][j];
            //cout << c[i][j] <<"\n";
        }
    }
    cout << c[0][0] << c[1][1] << c[2][2];

}

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

int X, N;

int main() {
  std::cin >> X >> N;
  std::set<int> P;
  for (int i = 0; i < N; ++i) {
    int x;  std::cin >> x;
    P.insert(x);
  }

  if (P.find(X) == P.end())
    std::cout << X << "\n";
  else {
    int left = X, right=X;
    while (P.find(left) != P.end())
      left--;
    while (P.find(right) != P.end())
      right++;
    std::cout << (X - left <= right - X ? left : right) << "\n";
  }

  return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

#define mod 1000000007

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;
    cout<<"ABC"<<N<<endl;

}

Measured memory_bytes: 256
def examC():
    N, M = LI()
    if N-M//2>=0:
        ans = M//2
    else:
        ans = N + (M-N*2)//4
    print(ans)
    return

def examD():
    N = I()
    S = SI()
    for i1,i2 in [[0,0],[0,1],[1,0],[1,1]]:
        flag = True
        sheep = [1]*N
        sheep[0] = i1
        sheep[1] = i2
        for j in range(1,N-1):
            if S[j]=="o":
                cur = 1
            else:
                cur = 0
            sheep[j+1] = (sheep[j]^cur)^sheep[j-1]
        if S[-1] == "o":
            cur = 1
        else:
            cur = 0
        if sheep[0]!=(sheep[-1] ^ cur) ^ sheep[-2]:
            flag = False
        if S[0] == "o":
            cur = 1
        else:
            cur = 0
        if sheep[1]!=(sheep[0] ^ cur) ^ sheep[-1]:
            flag = False
        if flag:
            ans = ""
            for i in sheep:
                if i==1:
                    ans += "S"
                else:
                    ans += "W"
            print(ans)
            return
    print(-1)
    return

def examE():
    N = I()
    A = LI()
    Ai = [[0,0]]
    for i in range(N):
        Ai.append([A[i],i])
    Ai = sorted(Ai, key=lambda x:x[1], reverse = True)
    Ai = sorted(Ai, key=lambda x:x[0], reverse = True)
#    print(Ai)
    ans = [0]*N
    now = N
    for i in range(N):
        now = min(now,Ai[i][1])
        ans[now] += (i+1)*(Ai[i][0]-Ai[i+1][0])
    for v in ans:
        print(v)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examE()

"""

"""

Measured memory_bytes: 26792
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
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; }
ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int n[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};

int main() {
    int k;
    cin >> k;
    cout << n[k-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl;exit(0);}else return;}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

//divisor 
set<long long> Divisor(long long N) {
	set<long long> ret;
	for (long long i = 1; i*i <= N; ++i) {
		if (N%i == 0) {
			ret.insert(i);
			ret.insert(N / i);
		}
	}
	return ret;
}

int main() {
	ll N,M,ans = 1; cin >> N >> M;
	corner(M == 1, 1);
	auto p = Divisor(M);
	for (auto u : p) if (M - u*N >= 0 && (M - u*N) % (u) == 0)ans = max(ans, u);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	void solve(Supplier<String> sc) {
		long A = Integer.parseInt(sc.get());
		long B = Integer.parseInt(sc.get());
		long C = Integer.parseInt(sc.get());
		int K = Integer.parseInt(sc.get());
		while (A >= B) {
			B *= 2;
			K -= 1;
		}
		while (B >= C) {
			C *= 2;
			K -= 1;
		}
		System.out.println(K < 0 ? "No": "Yes");
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		new Solver().solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32740
#include <bits/stdc++.h>
 using namespace std;
typedef long long int ll ;
typedef long double ld;

#define MOD 1000000007ll
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()
#define for0(i,n) for(__typeof(n) i = 0; i < n ; i++) 
#define forab(i,a,b) for(__typeof(a) i = a ; i < b ; i++) 
#define forba(i,b,a) for(__typeof(a) i = b ; i > a ; i--) 
#define forc(c,it) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define pb     push_back
#define mp     make_pair
#define MAX 100005

int x , n , ans;
string s;

int main(int argc, char const *argv[])
{
  cin>>n;
  cin>>s;
  ans = 0;
  x = 0;

  for0(i , n)
  {
  	if(s[i] == 'I')
  		x++;
  	else
  		x--;
  	ans = max(ans , x);
  }

  printf("%d" , ans);



  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, W;
  cin >> N >> W;
  vec< int > w(N), v(N);
  int baseweight;
  REP(i, N) {
    cin >> w[i] >> v[i];
    if (i == 0)
      baseweight = w[0];
    w[i] -= baseweight;
  }
 // PRINTALL(w);
  vec< vec< int > > dp(N + 1, vec< int >(3 * N + 1, -INF));
  //  REP(i, 3 * N + 1) { dp[0][i] = 0; }
  dp[0][0] = 0;
  REP(i, N) {
    REPR(j, N - 1) {
      REPR(k, 3 * N) {
        if (dp[j][k] != -INF) {
          if (k + w[i] <= 3 * N && j + 1 <= N)
            chmax(dp[j + 1][k + w[i]], dp[j][k] + v[i]);
        }
      }
    }
  }
  int ans = -INF;
  FORS(i, 0, N) {
    int wval = min(3 * N, W - baseweight * i);
    // DEBUG(i);
    // DEBUG(wval);
    // PRINTALL(dp[i]);
    FORS(j, 0, wval) { chmax(ans, dp[i][j]); }
  }
  print(ans);
}
// dpの向きによって複数個を許すかどうかが定まる、

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

int A, B;
string S;

int main() {
    cin >> A >> B >> S;

    string ans = "Yes";
    int tmp = 0;

    // cout << (S[3] == '-' ? "ss" : "ggg") << endl;

    rep(i, S.size()) {
        // cout << S[i] << endl;
        if (S[i] == '-') tmp++;

        if (A == i && S[i] != '-') {
           ans = "No";
           break; 
        }
    }

    if (tmp != 1) {
       ans = "No";
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

  static boolean checkKaibun(String str){
    StringBuilder t = new StringBuilder(str);
    return (str.equals(t.reverse().toString()));
  }

  public static void main(String[] args) throws IOException {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] in;
    in = br.readLine().split(" ");
    double l = Double.parseDouble(in[0]);

    br.close();

    System.out.println(String.format("%.10f", (l / 3.0) * (l / 3.0) * (l / 3.0)));
    
  }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int N;
    cin >> N;
    vector<int> D1(N), D2(N), memo(N);
    rep(i,N){
    	cin >> D1[i] >> D2[i];
    	if(D1[i] == D2[i]) memo[i] = 1;
    }

   	for(int i = 0; i+2 < N; i++){
    	if(memo[i]==1 && memo[i+1]==1 && memo[i+2]==1){
    		cout << "Yes" << endl; 
    		return 0;
    	}
    }

    cout << "No" << endl;
}


Measured memory_bytes: 3648
N = int(input())
a = N//4
b = N//7
yes = 0
no = 0
for i in range(a+1):
  for l in range(b+1):
    if 4*i+7*l == N:
      yes = 1
    else:
      no = 1
if yes ==1:
  print("Yes")
else:
  print("No")

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100005;

int n;
int a[N];

int main() {

	FAST;

	string s;
	cin >> s;
	int x = 754;
	for (int i = 0; i < s.length() - 2; i ++) {
		int m = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		x = min(x, abs(753 - m));
	}
	cout << x << '\n';
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

    private Scanner scan = new Scanner(System.in);
    private int a;
    private int b;

    public Main() {
	a = Integer.parseInt(scan.next());
	b = Integer.parseInt(scan.next());

	scan.close();
    }

    public final void answer() {

	String ans  = a*b % 2 == 0 ? "Even" : "Odd";
	System.out.println(ans);
	
    }
}


Measured memory_bytes: 21972
import com.sun.corba.se.impl.orbutil.ObjectUtility;

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    Random rand = new Random();


    public void solve() throws IOException {
        int n = nextInt();
        int cnt = 1;
        while(cnt <= n){
            cnt *= 2;
        }
        out.print(cnt >> 1);

    }


    BufferedReader br;
    StringTokenizer sc;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    void run() throws IOException {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("sum2.in"));
//            out = new PrintWriter(new File("sum2.out"));
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    String nextToken() throws IOException {
        while (sc == null || !sc.hasMoreTokens()) {
            try {
                sc = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return sc.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
}

Measured memory_bytes: 21204
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long p, q, r;
    scan(p, q, r);
    (p + q).min(p + r).min(q + r).writeln();
}


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


int main() {
  int n;
  cin >> n;
  int ac=0, wa=0, tle=0, re=0;
  rep(i,n) {
    string s;
    cin >> s;
    if(s=="AC") ac++;
    if(s=="WA") wa++;
    if(s=="TLE") tle++;
    if(s=="RE") re++;
  }
  printf("AC x %d\n", ac);
  printf("WA x %d\n", wa);
  printf("TLE x %d\n", tle);
  printf("RE x %d\n", re);

  return 0;
}

Measured memory_bytes: 3712
import math
EPS = 10**-7


class P2():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.norm2 = (self.x**2 + self.y**2)**0.5

    def __add__(self, other):
        return P2(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return P2(self.x - other.x, self.y - other.y)

    def smul(self, a):
        return P2(self.x * a, self.y * a)

    def dot(self, other):
        return self.x * other.x + self.y * other.y

    def det(self, other):
        return self.x * other.y - self.y * other.x


n, k = map(int, input().split())
p = []
c = []
for _ in range(n):
    x, y, cc = map(float, input().split())
    p.append(P2(x, y))
    c.append(cc)

dist = [[(p[i] - p[j]).norm2 for j in range(n)] for i in range(n)]


def check(r):
    r_c = tuple(r / c[i] for i in range(n))
    # 半径rの円２つの交点の列挙
    cand = [pi for pi in p]
    for i in range(n - 1):
        for j in range(i + 1, n):
            d_ij = p[i] - p[j]

            if dist[i][j] < r_c[i] + r_c[j] - EPS:
                # 点iと点jを中心とする円が交点を持つ時
                x = ((r_c[j])**2 -
                     (r_c[i])**2 + d_ij.norm2**2) / (2 * d_ij.norm2)
                h = math.sqrt(max((r_c[j])**2 - x**2, 0.0))
                v = P2(-d_ij.y, d_ij.x).smul(h / d_ij.norm2)
                dx = p[j] + d_ij.smul(x / d_ij.norm2)
                cand.append(dx + v)
                cand.append(dx - v)

    for cand_p in cand:
        cnt = 0
        for i in range(n):
            if (p[i] - cand_p).norm2 < r_c[i] + EPS:
                cnt += 1
                if cnt >= k:
                    return True

    return False


lb = 0.0  # False
ub = 3000 * 100  # True
while ub - lb > EPS:
    mid = (ub + lb) / 2
    if check(mid):
        ub = mid
    else:
        lb = mid

print(ub)


Measured memory_bytes: 82264
def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


def main():
    import sys
    import collections
    input = sys.stdin.readline
    N = int(input())
    G = [[-1]*N for i in range(N)]

    ans = 2**(N-1)
    for i in range(N-1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a][b] = i
        G[b][a] = i
    ans = 0
    g = [[0]*N for i in range(N)]
    for i in range(N):
        q = collections.deque()
        q.append((i, 0))
        r = [True]*N
        r[i] = False
        while(q):
            x, s = q.popleft()
            for y in range(N):
                if G[x][y] >= 0 and r[y]:
                    g[i][y] = s | 1 << G[x][y]
                    q.append((y, g[i][y]))
                    r[y] = False
    M = int(input())
    s = [0 for i in range(M)]
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1

        s[i] = g[u][v]

    # print(s)
    for i in range(2**M):
        tmp = 2**(N-1) - 1
        c = 0
        for j in range(M):
            if (i >> j) % 2 == 1:
                tmp &= ~s[j]
                c += 1
        ans += ((-1)**(c))*(1 << popcount(tmp))

    print(ans)


main()


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

typedef pair< int , int > P;
struct Edge {
  int to,cost;
  Edge(){}
  Edge(int to,int cost):to(to),cost(cost){};
};
vector< vector< Edge > > Graph;
int V,E;
int prim(){
  int total = 0;
  vector< bool > used(Graph.size(),false);
  priority_queue< P,vector< P >,greater< P > > que;
  que.push(P(0,0));
  while(!que.empty()){
    int cost = que.top().first;
    int now = que.top().second;
    que.pop();
    if(used[now]) continue;
    used[now] = true;
    total += cost;
    for(int i=0;i<Graph[now].size();i++){
      que.push(P(Graph[now][i].cost,Graph[now][i].to));
    }
  }
  return total;
}

int main(){
  cin >> V;
  Graph.resize(V+1);
  /*
  for(int i=0;i<E;i++){
    int s,t,d;
    cin >> s >> t >> d;
    Graph[s].push_back(Edge(t,d));
    Graph[t].push_back(Edge(s,d));
    }*/
  for(int i=0;i<V;i++){
    for(int j=0;j<V;j++){
      int d; cin >> d;
      if(d != -1){
	Graph[i].push_back(Edge(j,d));
	Graph[j].push_back(Edge(i,d));
      }
    }
  }
  cout << prim() << endl;
}

Measured memory_bytes: 1552
N, M = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for i in range(M)]

a.sort()
bc.sort(key=lambda x:x[1],reverse=True)

cnt = 0
for i in range(M):
    b = bc[i][0]
    c = bc[i][1]
    a.extend([c for i in range(b)])
    cnt += b
    if cnt > N:
        break

a.sort(reverse=True)
print(sum(a[:N]))

Measured memory_bytes: 90464