akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n;
  ll ar[n];
  rep(i,0,n) cin>>ar[i];
  rep(i,0,n)
  {
    rep(j,i+1,n)
    {
      k+=(ar[i]*ar[j]);
    }
  }
  cout<<k;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
 //  cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>

int main()
{
	int i,num_p,num_s,count = 0;
	char s[1000],p[11],stop[] = "END_OF_TEXT";

	scanf("%s",&p);
	num_p = strlen(p);
	
	for(i=0;i<num_p;i++){
		if(p[i] > 64 && p[i] < 91){
			p[i] += 32;
		}
	}
	
	while(1){
		
		scanf("%s",&s);
		num_s = strlen(s);
		for(i=0;i<num_s;i++){
			if(strcmp(s,stop) == 0){
				break;
			}
			if(s[i] > 64 && s[i] < 91){
				s[i] += 32;
			}
		}
		if(strcmp(s,p) == 0){
			count++;
		}
		if(strcmp(s,stop) == 0){
			break;
		}
	}
	printf("%d\n",count);
	return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    string s; cin >> s;
    int res = 0;
    int n = s.size();
    rep(i, n-1){
        if(s[i] != s[i+1]) res++;
    }
    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4608
import java.util.Scanner;
class Main{
    public static void main(String[] av){
	Scanner sc=new Scanner(System.in);
	int x;
	int i=1;
	while(true){
	    x=sc.nextInt();
	    if(x==0) break;
	    else{
	    System.out.println("Case "+i+": "+x);
	    i++;
	    }
	}

    
    
    }
}


Measured memory_bytes: 40744
// Aizu Vol0 0051: Differential II
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>

char *gets(char *);
char buf[100];

int cnt[10];

int main()
{
	int n, data;
	int i, j, k;
	int max, min;

	gets(buf); n = atoi(buf);
	for (i = 0; i < n; i++) {
		for (j = 0; j < 10; j++) cnt[j] = 0;
		gets(buf); data = atoi(buf);
		for (j = 0; j < 8; j++) {
			cnt[data % 10]++;
			data /= 10;
		}
		max = min = 0;
		for (j = 9; j >= 0; j--) {
			for (k = cnt[j]; k > 0; k--) max = 10 * max + j;
		}
		for (j = 0; j < 10; j++) {
			for (k = cnt[j]; k > 0; k--) min = 10 * min + j;
		}
		printf("%d\n", max - min);
	}
	return 0;
}

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

struct dat {
  int d;
  vector<int> c;
  vector<vector<int>> s;
};

int calc(const dat &a, const vector<int> &last, int day, int t) {
  int v = 0;
  v += a.s.at(day - 1).at(t);
  for (int i = 0; i < 26; i++) {
    if (i == t) continue;
    v -= a.c.at(i) * (day - last.at(i));
  }
  return v;
}

int main() {
  int d;
  cin >> d;
  vector<int> c(26);
  vector<vector<int>> s(d, vector<int>(26));
  for (int i = 0; i < 26; i++) {
    cin >> c.at(i);
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s.at(i).at(j);
    }
  }
  dat a = {d, c, s};
  
  int w = 200;
  vector<vector<int>> last(w, vector<int>(26)), ans(w);
  vector<int> score(w);
  for (int i = 0; i < d; i++) {
    vector<tuple<int, int, int>> idx;
    for (int j = 0; j < w; j++) {
      vector<int> best(w, -1e9), best_t(w);
      for (int t = 0; t < 26; t++) {
        int v = calc(a, last.at(j), i + 1, t);
        if (v > best.at(w - 1)) {
          best.at(w - 1) = v;
          best_t.at(w - 1) = t;
        }
        for (int k = w - 1; k > 0; k--) {
          if (best.at(k - 1) < best.at(k)) {
            swap(best.at(k - 1), best.at(k));
            swap(best_t.at(k - 1), best_t.at(k));
          }
        }
      }
      for (int k = 0; k < w; k++) {
        idx.emplace_back(score.at(j) + best.at(k), j, best_t.at(k));
      }
    }
    sort(idx.rbegin(), idx.rend());
    vector<vector<int>> newlast(w, vector<int>(26)), newans(w);
    for (int j = 0; j < w; j++) {
      int k = get<1>(idx.at(j)), t = get<2>(idx.at(j));
      score.at(j) = get<0>(idx.at(j));
      newans.at(j) = ans.at(k);
      newlast.at(j) = last.at(k);
      newans.at(j).push_back(t);
      newlast.at(j).at(t) = i + 1;
    }
    ans = newans;
    last = newlast;
  }
  for (int i = 0; i < d; i++) {
    cout << ans.at(0).at(i) + 1 << endl;
  }
}


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

#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
//#define pdd pair<double,double>
#define pll pair<LL,LL>
#define pb(x) push_back(x)
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define mii map<int,int>
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi 3.14159265359
#define INF 0x7fffffff
#define next Next
using namespace std;
typedef long long LL;
LL l;
struct node{
	node *n[2];
	node(){
		n[0]=n[1]=NULL;
	}
}*root;
void add(char *c){
	node *n=root;
	for(int i=0;c[i]!=0;i++){
		if(n->n[c[i]-'0']==NULL){
			n->n[c[i]-'0']=new node();
		}
		n=n->n[c[i]-'0'];
	}
}
pll operator+(const pll &a,const pll &b){
	return mp(a.x+b.x,a.y+b.y);
} 
vector<LL> v;
void travel(node *n,int d){
	if(!n){
		LL x=l-d+1;
	//	printf("%d %d",x,x&-x);
		v.pb(x&-x);
	}
	else if(n->n[0]||n->n[1]){
		travel(n->n[0],d+1);travel(n->n[1],d+1);
	}
}
int main(){
	root=new node();
	int n;
	scanf("%d %lld",&n,&l);
	for(int i=0;i<n;i++){
		char c[100005];
		scanf("%s",c);
		add(c);
	}
	travel(root,0);
	//printf("%d\n",travel(root,0));
	LL ans=0;
	for(auto it=v.begin();it!=v.end();it++){
		ans^=*it;
	}
	if(ans){
		printf("Alice\n");
	}
	else
	printf("Bob\n");
}


Measured memory_bytes: 9336
import java.util.*;
import static java.lang.System.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
HashMap<Integer,Integer> x=new HashMap<>();
int n=sc.nextInt();
for (int i = 1; i <= n; i++) {
    int p=sc.nextInt();
    x.put(p,x.getOrDefault(p,0)+1);
}
int ans=0;
for (Integer i:x.keySet()) {
    if(x.get(i)>i){
        ans+=x.get(i)-i;
    }else if(x.get(i)<i){
        ans+=x.get(i);
    }
}
out.println(ans);
}
}

Measured memory_bytes: 61756
import java.util.Scanner;

//Lottery Checker
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int m = sc.nextInt();
			char[][] s = new char[n][8];
			int[] p = new int[n];
			for(int i=0;i<n;i++){
				s[i]=sc.next().toCharArray();
				p[i] = sc.nextInt();
			}
			int x = 0;
			while(m--!=0){
				char[] r = sc.next().toCharArray();
				for(int i=0;i<n;i++){
					boolean f = true;
					for(int j=0;j<8;j++){
						if(s[i][j]=='*'||s[i][j]==r[j])continue;
						f = false;
					}
					if(f){
						x+=p[i];break;
					}
				}
			}
			System.out.println(x);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using  namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1e18+1


int main(){
	string s;
	int ans=0;
	cin>>s;
	int cnt=0;
	REP(i,s.size()){
		if(cnt<=(i-cnt-1)){
			cnt++;
			if(s[i]=='g')ans++;
		}else{
			if(s[i]=='p')ans--;
		}
	}
	cout<<ans<<endl;
}
	
	

Measured memory_bytes: 512
from sys import stdin


def a(input_string):
    one = input_string[0]
    two = input_string[1]
    three = input_string[2:]
    N, M, C = [int(x) for x in one.split()]
    B = [int(x) for x in two.split()]
    temp = [string.split() for string in three]
    A = []
    for i in range(len(temp)):
        A.append([int(word) for word in temp[i]])
    #print(N, M, C)
    #print(B)
    #print(A)
    count = 0
    for i in range(N):
        product_sum = 0
        for a, b in (zip(A[i], B)):
            product_sum += a*b
        if product_sum + C > 0:
            count += 1
    return count


def main():
    input_line = stdin.readlines()
    answer = a(input_line)
    print(answer)


if __name__ == '__main__':
    main()


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

rooms = [[[0] * 10 for i in range(3)] for j in range(4)]

for i in range(n):
    b, f, r, v = map(int, input().split())
    rooms[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(' ', end='')
        print(' '.join(map(str, rooms[i][j])))
    if i != 3:
        print('#' * 20)


Measured memory_bytes: 5608
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}
const int mod = 1000000007;
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 {
    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, K;
  cin >> N >> K;
  mint tmp = 1;
  vector<mint> factorial(N+1, tmp);
  srep(i,1,N+1) {
    factorial[i] = factorial[i-1]*i;
  }
  vector<mint> inv_factorial(N+1, 1);
  srep(i,1,N+1) {
    inv_factorial[i] = factorial[i].inv();
  }

  for (int i = 1;i <= K;++i) {
    //    answer += (N-K+1)c(i)*(K-1)C(i-1);
    if (i > N-K+1 || i > K) { // cant make
      cout << "0\n";
      continue;
    }
    mint answer = (factorial[N-K+1]*inv_factorial[i]*inv_factorial[N-K+1-i])*factorial[K-1]*inv_factorial[i-1]*inv_factorial[K-i];
    cout << answer.x << '\n';
  }
}


Measured memory_bytes: 888
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final String title = sc.next(); // 3 <= N <=25
        int count = 0;
        for(int i = 0; i < N; ++i)
        {
            final String old = sc.next();
            if(creatable(title, old))
            {
                ++count;
            }
        }
        System.out.println(count);
    }

    private static boolean creatable(final String title, final String old)
    {
        for(int first = old.indexOf(title.charAt(0)); first != -1; first = old.indexOf(title.charAt(0), first + 1))
        {
            for(int second = old.indexOf(title.charAt(1), first + 1); second != -1; second = old.indexOf(title.charAt(1), second + 1))
            {
                final int first_second_dif = second - first;
                int backpoint = second;
                for(int seek = 2, tail = old.indexOf(title.charAt(seek), second + 1); seek < title.length() && tail != -1; tail = old.indexOf(title.charAt(seek), tail + 1))
                {
                    if(first_second_dif == tail - backpoint)
                    {
                        if(seek == title.length() - 1)
                        {
                            return true;
                        }
                        backpoint = tail;
                        ++seek;
                    }
                }
            }
        }
        return false;
    }
}

Measured memory_bytes: 20116
#include<bits/stdc++.h>
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define fi first
#define se second
using namespace std;
template <typename T> void chmax(T &x,T y){x=x>y?x:y;return;}
template <typename T> void chmin(T &x,T y){x=x<y?x:y;return;} 
typedef long long ll;
typedef unsigned long long ull;

ll a,b,x;

int main()
{
	cin>>x;
	for(ll i=-200;i<=200;i++)
		for(ll j=-200;j<=200;j++)
			if(i*i*i*i*i-j*j*j*j*j==x)
			{
				cout<<i<<" "<<j<<endl;
				return 0;
			}
	return 0;
}

Measured memory_bytes: 3600
N,M,K=map(int, input().split())

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

ans=[0]*N
uf1=UnionFind(N)
for i in range(M):  # range(m):
    a,b=map(int, input().split()) #a,b:つながっている辺
    uf1.union(a-1,b-1)
    ans[a-1]-=1
    ans[b-1]-=1

for i in range(N):
    uf1.find(i)  # 一周findすることによって接続漏れをなくす。

from collections import defaultdict
ll=defaultdict(int)
for i in uf1.par:
    ll[i]+=1

for i in range(N):
    ans[i]+=ll[uf1.par[i]]-1

for i in range(K):
    a,b=map(int, input().split()) #a,b:つながっている辺
    if uf1.is_same(a-1,b-1):
        ans[a-1]-=1
        ans[b-1]-=1

print(*ans)

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

int main(){//if文で分岐
  while (1){
   int m, f, r;
   cin >> m >> f >> r;
   if (m == -1&&f == -1&&r == -1){
       break;
   }
   else if (m == -1|| f == -1){
       cout << 'F' << endl;
       continue;
   }
   else if (m + f>=80){
       cout << 'A' << endl;
       continue;
   }
   else if (m + f >= 65 && m+f < 80){
       cout << 'B' << endl;
       continue;
   }
   else if (m + f >= 50 && m + f < 65){
       cout << 'C' << endl;
       continue;
   }
   else if (m + f >= 30 && m + f <50){
       if (r >= 50) {
           cout << 'C' << endl;
           continue;
       }
       cout << 'D' << endl;
       continue;
   }
   else if (m +f < 30){
       cout << 'F' << endl;
       continue;
   }
  }
}


Measured memory_bytes: 3100
from collections import defaultdict

N = int(input())

if N == 1:
    print(0)
    exit()

e = defaultdict(int)
for i in range(2, int(N ** 0.5) + 1):
    while N % i == 0:
        e[i] += 1
        N //= i
if N != 1:
    e[N] += 1


if len(e) == 0:
    print(1)
    exit()

ans = 0
for k, v in e.items():
    tmp = 0
    i = 0
    while tmp + i + 1 <= v:
        i += 1
        tmp += i
    ans += i

print(ans)

Measured memory_bytes: 9656
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
const int INF=1e+9;
const ll INFLL=1e+17;
int R,G,B,N;
void solve(){
  int r=N/R+2,g=N/G+2,cnt=0;
  rep(i,r){
    rep(j,g){
      int x=N-i*R-j*G;
      if(x>=0&&x%B==0) cnt++;
    }
  }
  prin(cnt);
}
int main(){
  cin>>R>>G>>B>>N;
  solve();
  return 0;
}


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

using namespace std;
typedef long long int ll;

char s[N];
char t[N];

vector<int> pos[30];

int main(){
	scanf("%s", s);
	scanf("%s", t);
	int lens=strlen(s);
	int lent=strlen(t);
	int c=0, nowp=-1;
	for(int i=0;i<lens;i++){
		pos[s[i]-'a'].push_back(i);
	}
	for(int i=0;i<lent;i++){
		if(pos[t[i]-'a'].size()==0){
			printf("-1\n");
			return 0;
		}
	}
	ll ans=0;
	while(c<lent){
		int p=lower_bound(pos[t[c]-'a'].begin(), pos[t[c]-'a'].end(), nowp+1)-pos[t[c]-'a'].begin();
		if(p==pos[t[c]-'a'].size()){
			ans+=lens-nowp-1;
			nowp=-1;
		}
		else{
			p=pos[t[c]-'a'][p];
			ans+=p-nowp;
			nowp=p;
			c++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
// ARC082
// D - Derangement

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100000;

int N;
int p[MAX_N];

int main() {
    cin >> N;

    int cnt = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        if (p == i + 1) {
            cnt++;
        } else {
            ans += (cnt + 1) / 2;
            cnt = 0;
        }
    }
    ans += (cnt + 1) / 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// traP is kyopuro circle
// -> true

#include <stdio.h>
#include <set>
#include <string>
using namespace std;

int main(){
  set< pair<int,int> > S;
  int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int h,m;
    scanf("%d%d",&h,&m);
    S.insert(make_pair(h,m));
  }
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int h,m;
    scanf("%d%d",&h,&m);
    S.insert(make_pair(h,m));
  }
  set< pair<int,int> >::iterator iter = S.begin();
  while(true){
    int h = iter->first, m = iter->second;
    printf("%d:%02d",h,m);
    iter++;
    if(iter!=S.end()){
      printf(" ");
    }else{
      printf("\n");
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 1056
import sys
import math
def input():
    return sys.stdin.readline()[:-1]

n,a,b=map(int,input().split())
h=[int(input()) for i in range(n)]

low,high=0,10**9+1
while high-low>1:
    mid=(high+low)//2
    cnt=0
    for i in range(n):
        tmp=h[i]-mid*b
        if tmp>0:
            cnt+=math.ceil(tmp/(a-b))
    if cnt<=mid:
        high=mid
    else:
        low=mid
    # print(high,low)
print(high)

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

int main(){
  int n,i;
  cin>>n;
  char s[n];
  for(i=0;i<n;i++){
    cin>>s[i];
  }
  for(i=0;i<n;i++){
    if(s[i]=='Y'){
      cout<<"Four";
      return 0;
    }
  }
  cout<<"Three";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
ll t[200001];
int main() {
  ll n,T; cin >> n >> T;
  REP(i,n) cin >> t[i];
  for (int i = n-1; i>0; --i) t[i] = t[i] - t[i-1];
  ll ans = T;
  REP(i,n) ans += min(t[i],T);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import math as M
A=[]
for i in range(3):
    X=list(int(i) for i in input().split())
    A.append(X)
D=[[0 for i in range(3)]for j in range(3)]
n=int(input())
for _ in range(n):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==b:
                D[i][j]=1
#row
#print(D)
bool=False
for i in range(3):
    sum=0
    for j in range(3):
        if D[i][j]==1:
            sum+=D[i][j]
    if sum==3:
        bool=True
        break
if bool is True:
    print("Yes")
elif bool is False:
    for i in range(3):
        sum=0
        for j in range(3):
            if D[j][i]==1:
                sum+=D[j][i]
        if sum==3:
            bool=True
            break
    if bool is True:
        print("Yes")
    else:
        if D[1][1]+D[2][2]+D[0][0]==3:
            print("Yes")
        elif D[1][1]+D[0][2]+D[2][0]==3:
            print("Yes")
        else:
            print("No")


Measured memory_bytes: 40500
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b)for(int i=(a);i<=(b);i++)
#define repR(i,n) for(int i=n;i>=0;i--)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue<int>
#define PQR priority_queue<int,VE,greater<int>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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;
}

using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

const long long MOD = 1000000007;
const long long INF = 1LL << 50;
// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	VE a(n + 1), b(n + 1);
	a[0] = 0; b[n] = 0;
	int cnt = 0;
	rep(i, n) {
		if (s[i] == '#') {
			cnt++;
		}
		a[i + 1] = cnt;
	}
	cnt = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '.') {
			cnt++;
		}
		b[i] = cnt;
	}
	int ans = INF;
	rep(i, n + 1) {
		chmin(ans, a[i] + b[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,zx,xc,man[21][21];
deque <pair <long long, long long> > de;
char f[39][39];
int bo[21][21];
//bool bo[21][21][21][21];
vector <pair <long long, long long> > v[21][21];
string s;
bool cs(int q, int w){
	if(q>a||w>b||q<1||w<1) return 0;
	if(f[q][w]=='#') return 0;
	return 1;
}
void fl(int q, int w, int qw, int we){
	v[q][w].push_back(make_pair(qw,we));
}
void dfs(int q, int w, int r){
//	bo[c][d][q][w]=1;
	if(f[q][w]=='#') return;
	if(cs(q+1,w)){
		fl(q,w,q+1,w);
	}
	if(cs(q,w+1)){
		fl(q,w,q,w+1);
	}
	if(cs(q-1,w)){
		fl(q,w,q-1,w);
	}
	if(cs(q,w-1)){
		fl(q,w,q,w-1);
	}
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=1; c<=a; c++){
		cin>>s;
		for(d=1; d<=b; d++) f[c][d]=s[d-1];
	}
	for(c=a; c>=1; c--){
		for(d=b; d>=1; d--){
			dfs(c,d,0);
		}
	}
	int cnt=0;
	for(c=1; c<=a; c++){
		for(d=1; d<=b; d++){
			cnt++;
			bo[c][d]=cnt;
			man[c][d]=0;
			de.push_back(make_pair(c,d));
			while(de.size()>0){
				zx=de.front().first;xc=de.front().second;
				de.pop_front();
				for(vector <pair <long long, long long> >::iterator it=v[zx][xc].begin(); it!=v[zx][xc].end(); it++){
					if(bo[(*it).first][(*it).second]==cnt) continue;
					bo[(*it).first][(*it).second]=cnt;
					man[(*it).first][(*it).second]=man[zx][xc]+1;
					if(e<man[zx][xc]+1) e=man[zx][xc]+1;
					de.push_back(make_pair((*it).first,(*it).second));
				}
			}
		}
	}
/*	for(c=1; c<=a; c++){
		for(d=1; d<=b; d++){
			for(i=1; i<=a; i++){
				for(j=1; j<=b; j++){
					if(f[c][d]=='#'||f[i][j]=='#') continue;
					if(e<abs(i-c)+abs(j-d)) e=abs(i-c)+abs(j-d);
				}
			}
		}
	}*/
	cout<<e;
	return 0;
}

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

int main() {
  int K, N, s = 100000000, r, l;
  cin >> K >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int i = 0; i < N - 1; ++i)
  {
    r = A[i + 1] - A[i];
    if (i == 0) {
      l = K + A[0] - A[N - 1];
    } else {
      l = A[i] - A[i - 1];
    }
    s = min(s, K - max(r, l));
  }
  cout << s << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#define neko 100010
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~(i)))
#define travel(i,u,v) for(register int i=head[u],v=e[i].v;i;i=e[i].nex,v=e[i].v)
int ans,n,K,t;
typedef int arr[neko];
arr head;
struct node
{int v,nex;}e[neko<<1];
int cmax(int a,int b){return a>b?a:b;}
void add(int x,int y)
{
	e[++t].v=y,e[t].nex=head[x],head[x]=t;
	e[++t].v=x,e[t].nex=head[y],head[y]=t;
}
int dfs(int u,int fa,int dep)
{
	int now=dep,flag=0;
	travel(i,u,v)if(v^fa)now=cmax(dfs(v,u,dep+1),now);
	if(u==1)return 0;
	if((now-dep+1)==K&&fa^1)++ans,flag=1;
	return flag?dep-1:now;
}
int main()
{
	int x;
	scanf("%d%d",&n,&K);
	scanf("%d",&x);if(x^1)++ans;
	f(i,2,n)scanf("%d",&x),add(x,i);
	dfs(1,0,0);
	printf("%d\n",ans);

}

Measured memory_bytes: 8320
#include <iostream>

using namespace std;

int main()
{
   int a,b,c;
   cin >>a>>b>>c;
   if(a <= b && b <= c)
        cout << a <<" "<< b <<" "<< c << endl;
   else if(c <= b && b <= a)
        cout << c <<" "<< b <<" "<< a << endl;
   else if(b <= c && c <= a)
        cout << b <<" "<< c <<" "<< a << endl;
   else if(b <= a && a <= c)
        cout << b <<" "<< a <<" "<< c << endl;
    else if(c <= a && a <= b)
        cout << c <<" "<< a <<" "<< b << endl;
    else if(a <= c && c <= b)
        cout << a <<" "<< c <<" "<< b << endl;
}


Measured memory_bytes: 3076
#include <cstdio>

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

    int d = a / b;
    int r = a % b;
    double f = (double)a / b;

    printf("%d %d %.5f\n", d, r, f);
    return 0;
}


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

int A[100100];

int main(){
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> A[i];
	}
	
	int cnt=0,sum=0;
	bool ok=false;
	for(int i=2;i<=n;i++){
		if(A[i]==i&&A[i-1]==i-1){
			swap(A[i],A[i-1]);
			sum++;
		}
	}
	
	for(int i=1;i<=n;i++){
		if(A[i]==i)
			sum++;
	}
	
	cout << sum << endl;
	return 0;
}

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

int main(void){
    ll N, X;
    
    cin >> N >> X;
    
    ll L[N];
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    
    ll D[N+1];
    D[0] = 0;
    
    for(int i = 0; i < N; i++){
        D[i+1] = D[i] + L[i];
    }
    
    ll count = 0;
    
    for(int i = 0; i <= N; i++){
        if(D[i] <= X){
            count ++;
        }
    }
    
    cout << count << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    
    public static void main(String arg[]) {
        try{
            Scanner scan = new Scanner(System.in);
            int x = scan.nextInt();
            if(0<x && x<101){
            int y = (int)Math.pow(x, 3);
            System.out.println(y);
            }else{
                System.out.println("1??????100?????§???????????§???");
            }
            
        }catch(InputMismatchException ex){
            System.out.println("1??????100?????§????????¶??°?????\?????????????????????");
        }
    }
}

Measured memory_bytes: 26080
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        while(true){
            int x = sc.nextInt();
            String k = sc.next();
            int y = sc.nextInt();
            
            if(k.equals("+")){
                System.out.println(x + y);
            }else if(k.equals("-")){
                System.out.println(x - y);
            }else if(k.equals("*")){
                System.out.println(x * y);
            }else if(k.equals("/")){
                System.out.println(x / y);
            }else{
                break;
            }
        }
    }
}


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

int main(){
    int n;
    while(cin>>n && n){
        int t; cin>>t;
        string s; cin>>s;
        static int dp[1000010];
        memset(dp,0,sizeof(dp));
        dp[0]=1;
        for(int i=0;i<s.size()-1;i++){
            if(s[i]!=s[i+1])dp[i+1]=dp[i]+1;
            else dp[i+1]=1;
        }
        // for(int i=0;i<s.size();i++){
        //     cout << dp[i] << " ";
        // }
        // cout << endl;
        int ans=0;
        for(int i=s.size()-1;i>=0;i--){
            if(s[i]=='I' && dp[i]>=n*2+1)ans++;
        }
        cout << ans << endl;
    }
}

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

void eratosthenes(vector<int>& arr){
  for(int i = 0; i < arr.size(); i++){
      arr[i] = 1;
  }
  for(int i = 2; i <= sqrt(arr.size()); i++){
    if(arr[i]){
      for(int j = 0; i * (j + 2) < arr.size(); j++){
        arr[i*(j+2)] = 0;
      }
    }
  }
  arr[0] = 0;
  arr[1] = 0;
}

int main(void){
  int N; cin >> N;
  vector<int> is_prime(3*1e7+1);
  eratosthenes(is_prime);
  vector<int> prime;
  prime.reserve(3*1e7);
  for(int i = 0; i < is_prime.size(); i++){
    if(is_prime[i]) prime.push_back(i);
  }

  ll ans = 0;
  for(int i = 0; i < prime.size(); i++){
    int a = prime[i];
    int b = 2;
    if(a > N) break;
    if(a+b < is_prime.size() && is_prime.at(a+b)){
      ans++;
    }
  }
  cout << ans * 2 << endl;
}



Measured memory_bytes: 127200
#include <functional>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
    ll X, Y, A, B, C, D, ans = 0;
    cin >> X >> Y >> A >> B >> C;
    vector <ll> a(A), b(B), c(C), d(X + Y + C);
    for (ll i = 0; i < A; i++) cin >> a[i];
    for (ll i = 0; i < B; i++) cin >> b[i];
    for (ll i = 0; i < C; i++) cin >> c[i];
    sort(a.begin(), a.end(), greater <ll>());
    sort(b.begin(), b.end(), greater <ll>());
    sort(c.begin(), c.end(), greater <ll>());
    for (ll i = 0; i < X; i++) d[i] = a[i];
    for (ll i = 0; i < Y; i++) d[i + X] = b[i];
    for (ll i = 0; i < C; i++) d[i + X + Y] = c[i];
    sort(d.begin(), d.end(), greater <ll>());
    for (ll i = 0; i < X + Y; i++) ans += d[i];
    cout << ans << endl;
}

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

int main()
{
    string str;
    int m, n;

    while (true) {
        cin >> str;

        if (!str.compare("-")) {
            return 0;
        }

        cin >> m;

        for (int i = 0; i < m; i++) {
            cin >> n;
            str = str.substr(n, str.size()) + str.substr(0, n);
        }

        cout << str << endl;
    }
}

Measured memory_bytes: 1216
using System;
using System.Collections.Generic;
using System.Linq;
class ilds1_5_a{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    int q = int.Parse(Console.ReadLine());
    int[] m = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    for(int i=0; i<q; i++){
      if(sumup(0,a,q,m[i],n)){
        Console.WriteLine("yes");
      }
      else{
        Console.WriteLine("no");
      }
    }
  }
  public static bool sumup(int t, int[] a, int q, int cur, int size){
    if(cur == 0){
      return true;
    }
    if(t == size){
      return false;
    }
    return sumup(t+1, a, q, cur, size) || sumup(t+1, a, q, cur-a[t], size);
  }
}



Measured memory_bytes: 18232
import math

for i in range(1000):
    
    n=float(input())
    if n==0:
        break
    
    s= list(map(float, input().split()))
    m=sum(s)/n
    
    X=[]
    n=int(n)
    for j in range (n):
        x=(s[j]-m)**2
        X.append(x)
    a=math.sqrt(sum(X)/n)
    print(f'{a:.08f}')


Measured memory_bytes: 5792
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int a,b; cin >> a >> b;
  if(!(b-2*a>=0&&(b-2*a)%2==0)){
    cout << "No" << endl;
    return 0;
  }
  int y=(b-2*a)/2;
  int x=a-y;
  if(x<0){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 +c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
int64 a[MAXN],b[MAXN],pre[MAXN],ans[MAXN];
map<int,int64> zz,num;
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) {read(a[i]);b[i] = a[i];ans[1] += a[i];}
    sort(b + 1,b + N + 1);
    for(int i = N ; i >= 1 ; --i) {
 
        if(b[i] != b[i + 1]) {
            num[b[i]] += N - i;
            zz[b[i]] += zz[b[i + 1]];
        }
        num[b[i]]++;
        zz[b[i]] += b[i];
    }
    int pos = 1;
    for(int i = 1 ; i <= N ; ++i) {
        if(a[i] > pre[i - 1] && i != 1) {
            ans[i] += zz[pre[i - 1]] - pre[i - 1] * num[pre[i - 1]];
            ans[pos] -= ans[i];
            pos = i;
        }
        pre[i] = max(pre[i - 1],a[i]);
    }
    for(int i = 1 ; i <= N ; ++i) {
        out(ans[i]);enter;
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}

Measured memory_bytes: 16640
#include<iostream>

using namespace std;

int c[55],v[55];
int main(){
	int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++)cin>>v[i];
    for(int i=0;i<n;i++)cin>>c[i];
    for(int i=0;i<n;i++){
    	if(v[i]-c[i]>=0)ans+=(v[i]-c[i]);
    }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<58;


template<class T> int former(const vector<T> &v, T x) {
    return lower_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x) {
    return lower_bound(v.begin(), v.end(), x) - v.begin();
}

int main() {
    int A, B, Q; cin >> A >> B >> Q;
    vector<long long> s(A), t(B);
    for (int i = 0; i < A; ++i) cin >> s[i];
    for (int i = 0; i < B; ++i) cin >> t[i];
    s.push_back(INF); s.push_back(-INF); sort(s.begin(), s.end());
    t.push_back(INF); t.push_back(-INF); sort(t.begin(), t.end());
    
    for (int _ = 0; _ < Q; ++_) {
        long long x; cin >> x;
        long long res = INF;
        
        
        for (int i = 0; i < 2; ++i) {
            long long first = (i ? s[former(s, x)] : s[latter(s, x)]);
         
            for (int j = 0; j < 2; ++j) {
                long long second = (j ? t[former(t, first)] : t[latter(t, first)]);
                chmin(res, abs(x - first) + abs(first - second));
            }
        }
      
        for (int i = 0; i < 2; ++i) {
            long long first = (i ? t[former(t, x)] : t[latter(t, x)]);
            for (int j = 0; j < 2; ++j) {
                long long second = (j ? s[former(s, first)] : s[latter(s, first)]);
                chmin(res, abs(x - first) + abs(first - second));
            }
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 2912
n = int(input())
cnt = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

for _ in range(n):
  b, f, r, v = map(int, input().split())
  cnt[b-1][f-1][r-1] += v

for i in range(4):
  for j in range(3):
    print(' '+' '.join(map(str, cnt[i][j])))

  if i != 3:
    print('#'*20)


Measured memory_bytes: 5604
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define repm(i, m, n) for (int i = (m); i < (n); i++)
#define rep_rev(i, n) for (int i = int (n); i >= 0; i--)
typedef long long ll;
using namespace std;

int main() {
	ll n;
	cin >> n;
	ll sqrt_n = sqrt(n);
	ll i;
	for (i = sqrt_n; i > 0; i--) {
		if (n % i == 0) {
			break;
		}
	}
	ll j = n / i;
	cout << i + j - 2 << endl;

	return 0;
}

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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double
# define ull unsigned long long

# define pb push_back
# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vld vector < ld >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()

# define pii pair < int , int >
# define vpii vector < pii >
# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b));
# define mod 1000000007

# define pp(n) printf("%.10f",n);
# define line cout<<"\n";

const D pie = acos(-1);
const D hpie = asin(1);
const D qpie = atan2(1,1);
const D tpie = 2*pie;

string vow = "aeiou";

void solve( int test_case )
{
    vi v ( 3 );
    for ( int i=0 ; i<3 ; i++ ) cin>>v[i];

    sort (all(v)) ;

    if ( v[0]==5 && v[2]==7 && v[1]==5 ) cout << "YES";
    else cout << "NO";
    line
}

int main()
{
    int t = 1;
    //cin>>t;

    for ( int i=0 ; i<t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define int long long
using namespace std;

void solve(){
    int n , w ;
    cin >> n >> w ;
    int val[n] , wht[n];
    vector<int>dp(w+1,0);
    for(int i=0;i<n;i++){
        cin >> wht[i] >> val[i] ;
        for(int cur_w = w-wht[i] ; cur_w >= 0 ; cur_w-- ){
            dp[cur_w+wht[i]] = max(dp[cur_w+wht[i]],dp[cur_w]+val[i]);
        }
    }
    // for(int i : dp) cout << i << ' ' ;
    cout <<  *max_element(all(dp)) << endl ;
}

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

    int test = 1;
    if(false) cin >> test;
    while(test--)
        solve();

    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 = new int[N];
		for(int i=0; i<N; i++){
			A[i] = sc.nextInt();
		}
		int max = A[0];
		int min = A[0];
		for(int j=1; j<N; j++){
			if(max < A[j]){
				max = A[j];
			}
			if(min > A[j]){
				min = A[j];
			}
		}
		int ans = max - min;
		System.out.println(ans);
	}
}

Measured memory_bytes: 22864
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  int H, W, A, B;
  cin >> H >> W >> A >> B;

  if ((H / 2) < B || (W / 2) < A) {
    cout << -1 << endl;
    return 0;
  }

  rep(i, H) {
    char out = '0';
    if (i >= B) out = '1';
    rep(j, W) {
      if (j < A)
        cout << out;
      else
        cout << ((out == '0') ? '1' : '0');
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }
int N, M;
vector<int> C, x;
int dp[20010][260];
int dfs(int pos, int py)
{
    if(pos >= N) return 0;
    if(dp[pos][py]) return dp[pos][py];
    int res = INF;
    for(int i = 0; i < M; i++)
    {
        int y = py + C[i];
        if(y < 0) y = 0;
        if(y > 255) y = 255;
        res = min(res, dfs(pos + 1, y) + (x[pos] - y) * (x[pos] - y));
    }
    return dp[pos][py] = res;
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M, N or M)
    {
        memset(dp, 0, sizeof(dp));
        C.resize(M);
        x.resize(N);
        for(int i = 0; i < M; i++) cin >> C[i];
        for(int i = 0; i < N; i++) cin >> x[i];
        cout << dfs(0, 128) << endl;
    }
    return 0;
}




Measured memory_bytes: 25080
n=int(input())
num=[]
t=1
count=1
while n>t*26:
    t *= 26
    n -= t
    count += 1
n -= 1
for i in range(count-1,-1,-1):
    m=26**i
    a=n//m
    n %= m
    num.append(a)
a_list=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans=[]
for i in range(count):
    s=num[i]
    ans.append(a_list[s])
print(''.join(ans))

Measured memory_bytes: 8980
import java.util.*;

public class Main{
  public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int b = sc.nextInt();
   int[] compare = {a-b, a+b, a*b};
   int max = compare[0];
   for(int i = 1; i < compare.length; i++){
     if(max < compare[i]){
       max = compare[i];
     }
   }
   System.out.println(max);
  }
}

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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 300500;

ll ans;
int n, a[N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= 3 * n; i++)
		cin >> a[i];

	sort(a + 1, a + 1 + 3 * n);

	for (int i = 3 * n - 1, j = 1; j <= n; j++, i -= 2)
		ans += a[i];

	cout << ans;
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 1408
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>


#ifdef MY_LOCAL
namespace sandbox {
#endif

using namespace std;

int main() {

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

	vector<vector<int>> passages(n);
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		passages[a].push_back(b);
		passages[b].push_back(a);
	}

	vector<int> signposts(n, -2);
	queue<int> q;
	signposts[0] = -1;
	q.push(0);
	while (!q.empty())
	{
		int this_room = q.front();
		q.pop();
		for (auto next_room : passages[this_room])
		{
			if (signposts[next_room] == -2)
			{
				q.push(next_room);
				signposts[next_room] = this_room;
			}
		}
	}

	for (auto this_signpost : signposts)
	{
		if (this_signpost == -2)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for (int j = 1; j < n; j++)
	{
		cout << signposts[j] + 1 << "\n";
	}

	return 0;
}

#ifdef MY_LOCAL
}
#endif

Measured memory_bytes: 10156