akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

void solve()
{
	vector<int> vec(10);
	for(int i = 0; i < 10; ++i)
	{
		cin >> vec[i];
	}
	sort(vec.begin(), vec.end(), greater<int>());
	for(int i = 0; i < 3; ++i)
	{
		cout << vec[i] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1212
# https://atcoder.jp/contests/abc152/tasks/abc152_d
# 解説かんにんぐ

n=int(input())
freq=dict()
ans=0

for i in range(1,n+1):
    s=str(i)
    p=(s[0],s[-1])
    freq[p]=freq.get(p,0)+1

for i in range(1,n+1):
    s=str(i)
    q=(s[-1],s[0])
    ans+=freq.get(q,0)
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int h,n,sum=0;
    cin>>h>>n;
    int ara[n];
    for(int i=0;i<n;i++)
    {
        cin>>ara[i];
        sum+=ara[i];
    }
    if(sum>=h) cout<<"Yes\n"<<endl;
    else cout<<"No\n"<<endl;

    return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.io.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                String s = sc.next();
                int yono = 0;
                for(int i = 0 ; i < s.length() ; i++){
                        yono += (int)s.charAt(i) - 48;
                        yono %= 9;
                }
                if(yono == 0) ou.print("Yes\n");
                else ou.print("No\n");
                ou.flush();
        }
}

Measured memory_bytes: 39996
from collections import deque
n = int(input())
a = list(map(int, input().split()))
odd = deque([])
even = deque([])
even2 = deque([])
for i in a:
    if i % 4 == 0:
        even2.append(i)
    elif i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)
if len(odd)-1 <= len(even2) and len(even) == 0:
    print("Yes")
elif len(odd) <= len(even2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14636
h,w,d=map(int,input().split())
integer=[0]*(1+h*w)
for i in range(h):
    a_list=list(map(int,input().split()))
    for j in range(w):
        integer[a_list[j]]=((i+1,j+1))
dp=[0]*(1+h*w)
for i in range(h*w-d+1,h*w+1):
    dp[i]=0
    pre=i
    now=i-d
    while now>0:
        dp[now]=dp[pre]+abs(integer[now][0]-integer[pre][0])+abs(integer[now][1]-integer[pre][1])
        pre=now
        now=now-d
q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    print(dp[l]-dp[r])


Measured memory_bytes: 59420
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;

typedef pair <int, int> pii;

int main()
{

	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	string s, t;
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		if (a % 2 == 1)
		{
			b = 1;
		}
	}
	if (b == 0)
	{
		cout << "second" << endl;

	}
	else
	{
		cout << "first" << endl;

	}

	//cout <<  << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)

vector<long long> divisor(long long x){
    vector<long long> ret;
    for(long long i=1;i*i<=x;i++){
        if(x%i==0){
            ret.push_back(i);
            if(i*i!=x){
                ret.push_back(x/i);
            }
        }
    }
    return ret;
}

int main(void){
    long long A,B;
    cin>>A>>B;
    vector<long long> Ad=divisor(A);
    vector<long long> Bd=divisor(B);
    sort(Ad.begin(),Ad.end());
    sort(Bd.begin(),Bd.end());
    
    vector<long long> l;
    int ans=0;
    for(long long n:Ad){
        bool b=binary_search(Bd.begin(),Bd.end(),n);
        if(!b){continue;}

        bool b2=false;
        for(int i=1;i<l.size();i++){
            b2=((n%l[i])==0);
            if(b2){break;}
        }
        if(!b2){
            ans++;
            l.push_back(n);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	string s;cin>>s;
	int ans=0;
	for(int i=0;i<s.length()-1;i++){
		if(s[i]!=s[i+1]){
			ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define inc(l,i,r) for (int i=l;i<=r;i++)
#define dec(r,i,l) for (int i=r;i>=l;i--)
#define For(G) inc(0,i,(int)G.size()-1)
#define pb push_back
#define In inline
#define fi first
#define se second
#define mp make_pair
#define It iterator
#define ___ putchar(10);
#define cnt(x) __builtin_popcount(x)
#define show(x) cout << #x << " = " << x << endl;
#define mid ((l+r) >> 1)
#define N 200200
#define P 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

//inline int qpow(int a,int x) { int r = 1;  for (;x;x>>=1, a=1ll*a*a%P) if (x & 1) r = 1ll * r * a % P;  return r; }

int n, m, c[N], f[N][2], s[N];

int main() {
	scanf("%d",&n);
	inc(1,i,n) {
		int tmp;
		scanf("%d",&tmp);
		if (c[m] != tmp) c[++m] = tmp;
	}
	f[1][0] = s[c[1]] = 1;
	
	inc(2,i,m) {
		f[i][0] = (f[i-1][0] + f[i-1][1]) % P;
		f[i][1] = s[c[i]];
		s[c[i]] = (s[c[i]] + f[i][0]) % P;
	}
	printf("%d\n",(f[m][0] + f[m][1]) % P);
}

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

string s;
ll k;
ll ans,cnt;
int main(){
    cin >> s >> k;
    int check = 1;
    vector<int> ve;
    for(int i=1;i<s.length();++i){
        if(s[i]==s[i-1])    check++;
        else{
            ve.push_back(check);
            check = 1;
        }
    }
    ve.push_back(check);
// for(auto i:ve){
//     cerr << i << ' ';
// }
    if(s.back()==s.front() && ve.size()>1){
        for(int i=1;i<ve.size()-1;++i){
            ans += ve[i]/2*k;
        }
        ans += ve.front()/2 + ve.back()/2;
        ans += (ve.front()+ve.back())/2*(k-1);
    }else if(ve.size()==1){
        for(auto i:ve){
            ans += i*k/2;
        }
    }else{
        for(auto i:ve){
            ans += i/2*k;
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int H,A[251],i;

  scanf("%d",&H);
  if(H>250) exit(1);
  for(i=1;i<=H;i++)
    scanf("%d",&A[i]);

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2 >= 1) printf("parent key = %d, ",A[i/2]);
    if(2*i <= H) printf("left key = %d, ",A[2*i]);
    if(2*i+1 <= H) printf("right key = %d, ",A[2*i+1]);
    printf("\n");
  }

  return 0;
}




Measured memory_bytes: 2052
def main():
    n = int(input())
    s = [int(a) for a in input().split()]
    q = int(input())
    t = [int(a) for a in input().split()]

    count = 0

    for i in range(len(t)):
        for j in range(len(s)):
            if s[j] == t[i]:
                count += 1
                break

    print(count)

main()


Measured memory_bytes: 6340
//2019.7.14 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
#define eps 5.6e-8
#define RG register
#define db double
#define lb long db
#define pc(x) __builtin_popcount(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define gc getchar
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
inline int read() {
    res s=0,ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline int read() {
//    res s=0,ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
namespace MAIN{
    int n;
    inline void MAIN(){
        n=read();
        if(n==(n&-n)){puts("No");return;}
        puts("Yes");
        for(res i=2;i<=n-1;i+=2){
            printf("%d %d\n",i+1+n,i+n);
            printf("%d %d\n",i+n,1);
            printf("%d %d\n",1,i+1);
            printf("%d %d\n",i+1,i);
        }
        printf("%d %d\n",1+n,3+n);
        if(n%2==0){
            res p=n^1;
            res i=int(log2(p));
            res q=1<<i,r=p^q;
            if(q&1);
            else q+=n;
            if(r&1);
            else r+=n;
            printf("%d %d\n",n,q);
            printf("%d %d\n",n+n,r);
        }
    }
}
int main() {
//    srand((unsigned)time(NULL));
//    freopen("zao.in","r",stdin);
//    freopen("std.out","w",stdout);
    MAIN::MAIN();
    return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int n, x, y, z;
pair<int, int>p[100007];
long long pre[100007], suf[100007], sum, res;
priority_queue<int>q;
int read()
{
	int num = 0;
	char c = getchar();
	while (c < '0' || c>'9')c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num;
}
int cmp(pair<int, int>a, pair<int, int>b)
{
	return a.first - a.second > b.first - b.second;
}
int main()
{
	x = read();
	y = read();
	z = read();
	n = x + y + z;
	for (int i = 1; i <= n; i++)
	{
		int a = read(), b = read(), c = read();
		sum += a;
		p[i] = make_pair(b - a, c - a);
	}
	sort(p + 1, p + n + 1, cmp);
	for (int i = 1; i <= n; i++)
	{
		pre[i] = pre[i - 1] + p[i].first;
		q.push(-p[i].first);
		if (q.size() > y)pre[i] += q.top(), q.pop();
	}
	while (!q.empty())q.pop();
	for (int i = n; i >= 1; i--)
	{
		suf[i] = suf[i + 1] + p[i].second;
		q.push(-p[i].second);
		if (q.size() > z)suf[i] += q.top(), q.pop();
	}
	for (int i = y; i <= n - z; i++)
		res = max(res, sum + pre[i] + suf[i + 1]);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, ans, a[100008];

int main(){
	cin >> n;
	for(ll i = 1; i <= n; i++){cin >> a[i];}
	sort(a+1, a+n+1);
	
	ans = 1;
	ll start = 1;
	if(n%2){
		if(a[1] != 0){ans = 0;}
		start++;	
	}

	for(ll i = 1; i <= n/2; i++){
		if(a[2*(i-1)+start] == 2*(i-1)+start && a[2*(i-1)+start+1] == 2*(i-1)+start){
			ans *= 2;
			ans %= 1000000007;
		}
		else{ans = 0;}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(r, D, x2000):
    x = x2000
    for i in range(1, 10+1):
        x = r*x - D
        print(x)


def main():
    r, D, x2000 = read_int_n()
    (slv(r, D, x2000))


if __name__ == '__main__':
    main()


Measured memory_bytes: 7776
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int a;
  rep(i,5){
    cin >> a;
    if(a==0){
      cout << i+1 << endl;
      return 0;
    }
  }
  return 0;
}


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

onep=A.index(1)
ans=100000000000
def solve(l,r):
    global A,N,K
    ans=0

    while(l>0):
        
        l-=(K-1)
        ans+=1

    while(r<len(A)-1):
        r+=(K-1)
        ans+=1
    return ans

for i in range(-(K-1),1):
    ans=min(ans,solve(onep+i,onep+(K-1+i))+1)

print(ans)


Measured memory_bytes: 14008
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        BigInteger X = in.nextBigInteger();
        BigInteger K = in.nextBigInteger();
        BigInteger D = in.nextBigInteger();

        X = X.abs();
        if (K.remainder(BigInteger.valueOf(2)).compareTo(BigInteger.ONE) >= 0) {
            X = X.subtract(D);
        }
        K = K.divide(BigInteger.valueOf(2));
        D = D.multiply(BigInteger.valueOf(2));
        if (X.compareTo(K.multiply(D)) >= 0) {
            out.println(X.subtract(K.multiply(D)));
        } else {
            BigInteger P = X.remainder(D).abs();
            BigInteger M = X.remainder(D).subtract(D).abs();
            if (P.compareTo(M) <= 0) {
                out.println(P);
            } else {
                out.println(M);
            }
        }

        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}


Measured memory_bytes: 33348
import sys
import math
import itertools

b=input()
list=[]
count=0


for i in range(len(b)):
	if b[i]=="A" or b[i]=="G" or b[i]=="T" or b[i]=="C":
		count+=1
	else :
		count=0
	list.append(count)

print(max(list))

Measured memory_bytes: 3188
h,w = map(int,input().split())
a = [input() for _ in range(h)]

mod = 10 ** 9 + 7

dp = [[0] * w for _ in range(h)]
dp[0][0] = 1

for i in range(h):
    for j in range(w):
        if a[i][j] == '.':
            if i + 1 < h:
                if a[i+1][j] == '.':
                    dp[i+1][j] += dp[i][j]
                    dp[i+1][j] %= mod
            if j + 1 < w:
                if a[i][j+1] == '.':
                    dp[i][j+1] += dp[i][j]
                    dp[i][j+1] %= mod

print(dp[-1][-1] % mod)


Measured memory_bytes: 43712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int D;
  cin >> D;
  int c[26];
  int las[26];
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
    las[i] = 0;
  }
  int s[D][26];
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
  int choose[D];
  for (int i = 0; i < D; i++) cin >> choose[i];
  int ans = 0;
  for (int i = 1; i <= D; i++) {
    int score = 0;
    score += s[i-1][choose[i-1] - 1];
    for (int j = 0; j < 26; j++) {
      if (choose[i-1] - 1 != j) {
        score -= c[j] * (i - las[j]);
      }
    }
    las[choose[i-1] - 1] = i;
    ans += score;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3588
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=list(input())
pattern = {'r':p,'s':r,'p':s,'':0}
ans = 0
for i in range(n):
    tmp = i - k
    if tmp >= 0 and t[tmp] == t[i]:
        t[i] = ''
    ans += pattern[t[i]]
print(ans)

Measured memory_bytes: 4084
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n):
    ans+=b[a[i]-1]
    if i!=0:
        if a[i]==a[i-1]+1:
            ans+=c[a[i]-2]
print(ans)

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
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; }

signed main(){
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vint A(x);
  vint B(y);
  vint C(z);
  rep(i,0,x) cin >> A[i];
  rep(i,0,y) cin >> B[i];
  rep(i,0,z) cin >> C[i];
  sort(A.rbegin(),A.rend());
  sort(B.rbegin(),B.rend());
  sort(C.rbegin(),C.rend());
  vint ABC;
  rep(a,0,x){
    rep(b,0,y){
      if((a+1)*(b+1) > k) break;
      rep(c,0,z){
        if((a+1)*(b+1)*(c+1) > k) break;
        ABC.push_back(A[a] + B[b] + C[c]);
      }
    }
  }
  sort(ABC.rbegin(),ABC.rend());
  rep(i,0,min(k,x*y*z)){
    cout << ABC[i] << endl;
  }
}


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

using namespace std;

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  
  int cnt = 1;
  for(int i=0; i<N-1; i++) {
    if(S[i]!=S[i+1]) {
      cnt++;
    }
  }

  cout<<cnt<<endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int N,H,W;
int X1[1000],X2[1000],Y1[1000],Y2[1000];
int fld[3002][3002],dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};

int compress(int *x1,int *x2,int w){
  vector<int>xs;

  for(int i=0;i<N;i++){
      int tx1=x1[i],tx2=x2[i];
      if(1<=tx1 && tx1<=w)xs.push_back(tx1);
      if(1<=tx2 && tx2<=w)xs.push_back(tx2);
  }
  xs.push_back(0);
  xs.push_back(w);
  sort(xs.begin(),xs.end());
  xs.erase(unique(xs.begin(),xs.end()),xs.end());
  for(int i=0;i<N;i++){
    x1[i]=find(xs.begin(),xs.end(),x1[i])-xs.begin();
    x2[i]=find(xs.begin(),xs.end(),x2[i])-xs.begin();
  }
  return xs.size()-1;
}

int bfs(void){

  int ans=0;

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(fld[i][j])continue;
      ans++;
      queue<pair<int,int> >que;
      que.push(make_pair(j,i));
      while(!que.empty()){
	int nx=que.front().first,ny=que.front().second;
	que.pop();

	for(int i=0;i<4;i++){
	  int tx=nx+dx[i],ty=ny+dy[i];
	  if(tx<0 || W<tx || ty<0 || H<ty || fld[ty][tx]>0)continue;
	  que.push(make_pair(tx,ty));
	  fld[ty][tx]=1;
	}
      }
    }
  }
  return ans;
}

int main(void){

  while(cin >> W >> H,W|H){
    cin >> N;
    for(int i=0;i<N;i++)
      cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
    
    fill(fld[0],fld[3002],0);
    
    W=compress(X1,X2,W);
    H=compress(Y1,Y2,H);
    
    for(int i=0;i<N;i++){
      fld[Y1[i]][X1[i]]++;
      fld[Y1[i]][X2[i]]--;
      fld[Y2[i]][X1[i]]--;
      fld[Y2[i]][X2[i]]++;
    }
    
    for(int i=0;i<H;i++){
      for(int j=1;j<W;j++){
	fld[i][j]+=fld[i][j-1];      
      }
    }
    
    for(int i=1;i<H;i++){
      for(int j=0;j<W;j++){
	fld[i][j]+=fld[i-1][j];
      }
    }
    cout << bfs() << endl;
  }
  return 0;
}

Measured memory_bytes: 36448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    ll cnt = 0;
    rep(i, len(s)) {
        cnt += s[i] - '0';
    }
    if (cnt % 9 == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3740
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i = 0; i < n; i++)

typedef long long ll;

using namespace std;

const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

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

  if(n>=10){
    cout << r << endl;
  }
  else{
    cout << r + 100*(10-n) << endl;
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
	ll n;
  	cin >> n;
  	for(int i = 1; i <= 50005; i++) {
    	if (i*108/100 == n) {
        	cout << i << endl;
         	return 0;
        }
    }
  	cout << ":(" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll x,y,z,k;
  cin>>x>>y>>z>>k;
  vector<ll> v;
  vector<ll> a,b,c;
  ll t;
  REP(i,x){
    cin>>t;
    a.pb(t);
  }
  REP(i,y){
    cin>>t;
    b.pb(t);
  }
  REP(i,z){
    cin>>t;
    c.pb(t);
  }
  REP(i,x){
    REP(j,y){
      v.pb(a[i]+b[j]);
    }
  }
  sort(v.rbegin(), v.rend());
  sort(c.rbegin(),c.rend());
  vector<ll> ans;
  REP(i,min(k,(ll)v.size())){
    REP(j,c.size()){
      ans.pb(v[i]+c[j]);
    }
    sort(ans.rbegin(), ans.rend());
    while(ans.size()>k){
      ans.erase(ans.end() - 1);
    }
  }
  REP(i,k){
    cout<<ans[i]<<endl;
  }




 

  return 0;
}

Measured memory_bytes: 10616
#bがaの末尾にあうかチェック
def check(a, b):
    a = list(a)
    b = list(b)
    while b and a[-len(b):] != b:
        b.pop(-1)
    return len(b)
N = int(input())
A = input()
B = input()
print(N*2-check(A, B))

Measured memory_bytes: 3060
var
 a:array[1..3,1..3] of longint;
 s:longint;
begin
 readln(a[1,1],a[1,2],a[1,3]);
 readln(a[2,1],a[2,2],a[2,3]);
 readln(a[3,1],a[3,2],a[3,3]);
 s:=a[1,2]+a[2,3]+a[3,1]+a[1,3]+a[2,1]+a[3,2];
 if s=(a[1,1]+a[2,2]+a[3,3])*2 then begin write('Yes');halt; end;
 write('No');
end.

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int a,b;
  cin >> a>>b;
  
  int ans = 1;
  rep(i,a) {
  ans = min(ans*2,ans+b);
  }
  
  cout << ans << endl;
  
}


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

#define ISLOOSE(a,b)    (disdis(a, b) + get<2>(a) * get<2>(a) <= get<2>(b) * get<2>(b))

using namespace std;

double disdis(const tuple<double, double, double>& a, const tuple<double, double, double>& b)
{
	return (get<0>(a) - get<0>(b)) * (get<0>(a) - get<0>(b)) + (get<1>(a) - get<1>(b)) * (get<1>(a) - get<1>(b));
}

double heron(double a, double b, double c)
{
	double s = (a + b + c) / 2;
	return sqrt(s*(s - a)*(s - b)*(s - c));
}

double heron2(double a, double b, double c, double d, double e, double f)
{
	return sqrt((a*d*(b + c + e + f - a - d) + b*e*(c + a + f + d - b - e) + c*f*(a + b + d + e - c - f) - a*b*f - a*e*c - d*b*c - d*e*f) / 144.0);
}

tuple<double, double, double> com(const tuple<double, double, double>& a, const tuple<double, double, double>& b)
{
	if (ISLOOSE(a, b)) {
		return a;
	}
	else if (ISLOOSE(b, a)) {
		return b;
	}
	else {
		double l = heron(get<2>(a), get<2>(b), sqrt(disdis(a, b))) * 2 / sqrt(disdis(a, b));
		double d1 = sqrt(get<2>(a) * get<2>(a) - l * l);
		double d2 = sqrt(get<2>(b) * get<2>(b) - l * l);
		return tuple<double, double, double>(get<0>(a) + (get<0>(b) - get<0>(a)) * d1 / (d1 + d2), get<1>(a) + (get<1>(b) - get<1>(a)) * d1 / (d1 + d2), l);
	}
}

double two(const tuple<double, double, double>& a, const tuple<double, double, double>& b)
{
	if (ISLOOSE(a, b)) {
		return (double)get<2>(a);
	}
	else if (ISLOOSE(b, a)) {
		return (double)get<2>(b);
	}
	else {
		double d = sqrt(disdis(a, b));
		return heron(get<2>(a), get<2>(b), d) * 2 / d;
	}
}

double three(const tuple<double, double, double>& a, const tuple<double, double, double>& b, const tuple<double, double, double>& c)
{
	tuple<double, double, double> temp;

	if (ISLOOSE(a, b) && ISLOOSE(a, c))
		return get<2>(a);
	if (ISLOOSE(b, a) && ISLOOSE(b, c))
		return get<2>(b);
	if (ISLOOSE(c, a) && ISLOOSE(c, b))
		return get<2>(c);

	if (ISLOOSE(temp = com(a, b), c))
		return get<2>(temp);
	if (ISLOOSE(temp = com(b, c), a))
		return get<2>(temp);
	if (ISLOOSE(temp = com(c, a), b))
		return get<2>(temp);

	return heron2(get<2>(a) * get<2>(a), get<2>(b) * get<2>(b), get<2>(c) * get<2>(c), disdis(b, c), disdis(c, a), disdis(a, b))
		* 3.0 / heron(sqrt(disdis(a, b)), sqrt(disdis(b, c)), sqrt(disdis(c, a)));
}

int main()
{
	int n;
	double res;
	cin.sync_with_stdio(false);
	cout << fixed << setprecision(7);
	while (cin >> n, n) {
		vector< tuple<double, double, double> > str(n);
		for (int i = 0; i < n; i++) {
			cin >> get<0>(str[i]) >> get<1>(str[i]) >> get<2>(str[i]);
		}
		if (n == 1) {
			cout << (double)get<2>(str[0]) << endl;
		}
		else if (n == 2) {
			cout << two(str[0], str[1]) << endl;
		}
		else {
			res = 100000000.0;
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					for (int k = j + 1; k < n; k++) {
						res = min(res, three(str[i], str[j], str[k]));
					}
				}
			}
			cout << res << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3244
from sys import stdin


def main():
    R, G, B, N = [int(x) for x in stdin.readline().rstrip().split()]
    count = 0
    for r in range(3001):
        if N < r * R:
            break
        for g in range(3001):
            if N < g * G:
                break
            tmp = N - (R * r + G * g)
            if tmp < 0:
                break
            if tmp % B == 0:
                count += 1
    print(count)


if __name__ == "__main__":
    main()


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

int main(){
  string s;
  cin>>s;
  int l =s.length();
  int count=0;
  rep(i,l/2){
  	if(s[i]!=s[l-1-i])count++;
  }
  cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 764
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

# random_denseがTLE, 他はAC
"""
from bisect import bisect_left, bisect_right  # 二分探索
def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み
    E = [-1] * Q
    STX.sort(key=lambda v: v[2])
    for s, t, x in STX:
        a = bisect_left(D, s-x)
        b = bisect_left(D, t-x)
        for i in range(a, b):
            if E[i] == -1:
                E[i] = x
    for e in E:
        print(e)
"""

def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み

    events = []
    for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
    for i, d in enumerate(D):
        events.append(('D', d, i))
    
    ans = [-1] * Q
    events.sort(key=lambda v: v[1])
    xset = set()
    xmin = 1e+10
    for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

    for n in ans:
        print(n)

main()


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

void dfs(int before, int rem, vector<int> v){
  if(rem == 0){
    for(int i = 0; i < v.size(); i++){
      if(i != 0) cout << " ";
      cout << v[i];
    }
    cout << endl;
    return;
  }

  v.push_back(0);

  for(int i = rem; i >= 1; i--){
    if(before >= i){
      v[(int)v.size() - 1] = i;
      dfs(i, rem - i, v);
    }
  }
}

int main(){
  int n;
  while(cin >> n, n){
    dfs(n, n, vector<int>());
  }
}

Measured memory_bytes: 1224
#include<stdio.h>
#include<math.h>
main(){
  int n,temp,p[12],r[12],i,j,pp,rr,u,l;
  scanf("%d",&n);
  for(u=0;u<n;u++){
    pp=rr=0;
    scanf("%d",&pp);
    for(i=0;i<8;i++){
      l=10;
      for(j=0;j<i;j++){
	l*=10;
      }
      if(i==0){
	p[i]=pp%10;
	r[i]=p[i];
      }
      else{
	p[i]=(pp%l)/(l/10);
	r[i]=p[i];
      }
    }
    for(i=0;i<7;i++){
      for(j=7;j>i;j--){
	if(r[j-1]>r[j]){
	  temp=r[j-1];
	  r[j-1]=r[j];
	  r[j]=temp;
	}
	if(p[j-1]<p[j]){
	  temp=p[j-1];
	  p[j-1]=p[j];
	  p[j]=temp;
	}
      }
    }
    pp=0;
    for(i=0;i<8;i++){
      l=1;
      for(j=0;j<i;j++){
	l*=10;
      }
      if(i==0){
	pp+=p[i];
	rr+=r[i];
      }
      else{
	pp+=(p[i]*l);
	rr+=(r[i]*l);
      }
    }
    printf("%d\n",rr-pp);
  }
  return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main() {
	vector<int>a;
	vector<int>b;
	int n, m;
	int sn, sm;
	int kn, km;
	int x, y, z;
while(true) {
	a.clear();
	b.clear();
	scanf("%d %d", &n, &m);
	if (n == 0 && m == 0)return 0;
	sn = 0;
	sm = 0;
	f(i, n) {
		scanf("%d", &x);
		a.push_back(x);
		sn += x;
	}
	f(i, m) {
		scanf("%d", &x);
		b.push_back(x);
		sm += x;
	}
	if (abs(sn - sm) % 2 == 1)printf("-1\n");
	else {
		kn = MOD;
		km = MOD;
		z = (sn - sm) / 2;
		f(i, n) {
			f(j, m) {
				if (a[i] - b[j] == z) {
					kn = min(kn,a[i]);
					km = min(km,b[j]);
				}
			}
		}
		if(kn==MOD)printf("-1\n");
		else printf("%d %d\n", kn, km);
	}
}



	return 0;
}


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

const int N = 2e5 + 5;
char s[N];
int n, k;

int main() {
    scanf("%d%d", &n, &k);
    scanf("%s", s);
    deque<bool> dque(n);
    for (int i=0; i<n; ++i) dque[i] = s[i] == 'B';
    if (k > 2*n) k = 2*n+(k&1);
    bool flip = false;
    for (int i=1; i<=k; ++i) {
        if (dque[0] == flip) {
            dque[0] = !dque[0];
        } else {
            dque.pop_front();
            dque.push_back(!flip);
            flip = !flip;
        }
    }
    for (int i=0; i<n; ++i) {
        putchar(dque.front() == flip ? 'A' : 'B');
        dque.pop_front();
    }
    puts("");
    return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;

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

        // 入力(n)
        int n = sc.nextInt();
        // 入力(k)
        int k = sc.nextInt();
        // 入力(x)
        int x = sc.nextInt();
        // 入力(y)
        int y = sc.nextInt();

        int fee = 0;
        if (n <= k) {
            fee = n * x;
        } else {
            fee = k * x + (n - k) * y;
        }
        System.out.println(fee);
        sc.close();
    }
}

Measured memory_bytes: 21716
/**
 * Small_Large_or_Equal.cpp
 * Create:20180417
 * Description:空白で区切られた数値A,Bの大小関係を表記するプログラム
 */
#include <iostream>

int main(int argc, char* argv[]){
  int a, b;

  std::cin >> a >> b;

  if (a == b){
    std::cout << "a == b" << std::endl;
  }else if(a > b){
    std::cout << "a > b" << std::endl;
  }else{
    std::cout << "a < b" << std::endl;
  }

  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <string.h>
#include <queue>
using namespace std;
int X, Y;
int Map[1001][1001];
int sx, sy;
int dir[4][2] = { 0,1,0,-1,1,0,-1,0 };
int flag[1001][1002];
struct node {
	int x, y, dis;
	node(int a, int b, int c) :x(a), y(b), dis(c) {}
};

int Find(int aim)
{
	memset(flag, 0, sizeof(flag));
	queue <struct node> q;
	q.push(node(sx, sy, 0));
	flag[sx][sy] = 1;
	while (!q.empty())
	{
		node item = q.front(); q.pop();
		if (Map[item.x][item.y] == aim)
		{
			sx = item.x;
			sy = item.y;
			return item.dis;
		}
		for (int i = 0; i < 4; i++)
		{
			int m = item.x + dir[i][0];
			int n = item.y + dir[i][1];
			if (m <= 0 || m > X || n <= 0 || n > Y || Map[m][n] == -1 || flag[m][n] == 1 )
				continue;
			else
			{
				flag[m][n] = 1;
				q.push(node(m, n, item.dis + 1));
			}
		}
	}
}

int main()
{
	int n;
	string str;
	cin >> X >> Y >> n;
	memset(Map, -1, sizeof(Map));
	for (int i = 1; i <= X; i++)
	{
		cin >> str;
		for (int j = 1; j <= Y; j++)
		{
			if (str[j - 1] == 'S')
			{
				sx = i, sy = j;
				Map[i][j] = 0;
			}
			else if (str[j - 1] == '.')
			{
				Map[i][j] = 0;
			}
			else if (str[j - 1] >= '1' && str[j - 1] <= '9')
			{
				Map[i][j] = str[j - 1] - '0';
			}
		}
	}

	int Sum = 0;
	for (int i = 1; i <= n; i++)
	{
		Sum += Find(i);
	}
	cout << Sum<<endl;

	return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<long long> A){
    long long s = accumulate(A.begin(), A.end(), 0);
    long long c = 0;
    for (int i = 0; i < N; i++) {
        if ((double)A[i] >= ((double)s / (4*M))) {
            c++;
        }
    }
    
    cout << (M <= c ? YES : NO) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 256
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new File("c:\\0520-input.txt"));

		while (scan.hasNext()) {
			int r = scan.nextInt();
			int c = scan.nextInt();
			if (r == 0)
				break;

			Senb s = new Senb(r, c);
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++)
					s.add(i, j, scan.nextInt());

			System.out.println(s.answer());
		}
		scan.close();
		System.exit(0);
	}
}

class Senb {
	private int[] senb;
	private int R, C;

	public Senb(int r, int c) {
		R = r;
		C = c;
		senb = new int[C];
	}

	public int answer() {
		int to = (1 << R);
		int max = 0;
		for (int i = 0; i < to; i++) {
			max = Math.max(this.testR(i), max);
		}
		return max;
	}

	private int testR(int pat) {
		int tot = 0;
		for (int i = 0; i < C; i++) {
			int n = Integer.bitCount(senb[i] ^ pat);
			tot += Math.max(n, R - n);
		}
		return tot;
	}

	public void add(int r, int c, int f) {
		if (f == 1)
			senb[c] |= (1 << r);
	}

}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#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=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	ll k;
	cin>>k;
	int n=50;
	cout<<n<<'\n';
	ll ans[50];
	REP(i, n){
		ans[i]=n-1+k/50;
	}
	REP(i, k%50){
		ans[i]+=n-(k%50);
	}
	FOR(i, k%50, n){
		ans[i]-=k%50;
	}
	REP(i, n){
		cout<<ans[i]<<" \n"[i==n-1];
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) lower_bound(all(v),k)-v.begin()
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=100100100100;
const int mod=1000000007;
int main(){
   int h,w,ans=0;cin>>h>>w;
   vvi v(10,vi(10));
   rep(i,10)rep(j,10)cin>>v[i][j];
   vi x(10);
   rep(i,h){
      rep(j,w){
         int a;cin>>a;
         if(a!=-1)x[a]++;
      }
   }
   rep(k,10){
      rep(i,10){
         rep(j,10){
            chmin(v[i][j],v[i][k]+v[k][j]);
         }
      }
   }
   rep(i,10)ans+=x[i]*v[i][1];
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int A,B,C,Diff;
        cin>>A>>B>>C;
        if(A==B)
            Diff=C;
        else if (A==C)
            Diff=B;
        else
            Diff=A;
        cout<<Diff;
    return 0;
}

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

int main(){
    int a, b = 0;
    cin >> a >> b;
    for (int i = 1; i <= 3;i++)
    {
        if(a != i){
            if(b != i){
                cout << i << endl;
            }
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
#include <set>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST

class UnionFind
{
private:
    vector<ll> data;
    vector<ll> tree_size;

public:
    UnionFind(ll n)
    {
        data = vector<ll>(n);
        tree_size = vector<ll>(n, 1);
        for (ll i = 0; i < n; ++i)
        {
            data[i] = i;
        }
    }

    ll root(ll a)
    {
        if (data[a] == a) return a;
        else return data[a] = root(data[a]);
    }

    void unite(ll a, ll b)
    {
        ll root_a = root(a);
        ll root_b = root(b);
        if (root_a == root_b)
            return;
        else
        {
            tree_size[root_b] += tree_size[root_a];
            tree_size[root_a] = 0;
            data[root_a] = root_b;
            return;
        }
        return;
    }
    ll get_tree_size(ll a)
    {
        return tree_size[root(a)];
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N, M;
    cin >> N >> M;
    vector<ll> A(M), B(M);
    //vector<set<ll>> friends(N);
    UnionFind uf = UnionFind(N);
    for(size_t i=0;i<M; i++)
    {
        cin >> A[i] >> B[i];
        //friends[A[i]-1].insert(B[i]-1);
        //friends[B[i]-1].insert(A[i]-1);
        uf.unite(A[i]-1, B[i]-1);
    }
    ll max_size=0;
    for(size_t i=0;i<N; i++)
    {
        //cerr << i << ":" << uf.get_tree_size(i) << endl;
        max_size = max(max_size, ll(uf.get_tree_size(i)));
    }
    /*
    for(size_t ind=0;ind<N;ind++)
    {
        //cerr << ind+1 << ":";
        for(auto i: friends[ind])
        {
            friends[ind].insert(friends[i].begin(), friends[i].end());
            friends[ind].erase(ind);
        }
        for(auto i: friends[ind])
        {
            cerr << i+1 << " ";
        }
        cerr << endl;
        //max_size = max(max_size, ll(friends[ind].size()));
    }
    */
    cout << max_size << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

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

neg_count = 0
A_abs = [0] * N
for i in range(0, N):
    if A[i] < 0:
        neg_count += 1
    A_abs[i] = abs(A[i])

Sum = sum(A_abs)
Min = min(A_abs)

if neg_count % 2 == 0:
    print(Sum)
else:
    print(Sum - 2*Min)


Measured memory_bytes: 14284
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   double a,sum=0;
   while(cin>>a){
      REP(i,10){
         if(i==0) sum=a;
         else if(i%2==1){
            a*=2;
            sum+=a;
         }else{
            a/=3;
            sum+=a;
         }
      }
      printf("%.8lf\n",sum);
   }
   return 0;
}

Measured memory_bytes: 1232
import java.util.*;

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

        int a = sc.nextInt();
        sc.nextLine();
        String s = sc.nextLine();

        if(a >= 3200){
            System.out.println(s);
        }
        else{
            System.out.println("red");
        }


        return;
    }
}

Measured memory_bytes: 21844