akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define LCM(x,y)        (((x)/__gcd((x),(y)))*(y))
#define PI              acos(-1)
#define SZ(x)           x.size() - 1
#define waa             puts("ripon")
#define mem(a,b)        memset(a,b,sizeof(a))
#define rep(i,a,n)      for(int i=(int)(a);i<=(int)(n);i++)
#define per(i,n,a)      for(int i=(int)(n);i>=(int)(a);i--)
#define all(v)          v.begin(), v.end()
#define allr(v)         v.rbegin(), v.rend()
int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, -1, 1, 1 };
int overlap(int rs,int re,int qs,int qe){ if(rs>qe or re<qs) return 0; else if(qs<=rs and re<=qe) return 1; else return 2;} // 0 no, 1 total, 2 partial
void pvec(auto v){for(auto x:v){cout<<x<<" ";}cout<<endl;}
//*************useless stuff*************//

#define TC 0
#define mod 10000007
#define N 1000000

void solve(int T) {
    int n,k,s;
    cin>>n>>k>>s;

    rep(i,1,n){

        if(i<=k){
            cout<<s<<" ";
        }else{

            if(s==1e9){
                cout<<1<<" ";
            }else{
                cout<<s+1<<" ";
            }

        }
    }
    cout<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
    #ifdef LOCALDEF
        freopen("input.txt","r",stdin);
    #endif
    int T=1;
    if(TC) cin>>T;
    for(int t=1;t<=T;t++)   solve(t);
    return 0;
}


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

int main() {
	int a,b,c,d;
  	cin >> a >> b >> c >> d;
  
  	int area1 = a * b;
  	int area2 = c * d;
  
  	if(area1 <= area2) {
    	cout << area2 << endl;
    }else {
    	cout << area1 << endl;
    }
}

Measured memory_bytes: 256
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
k = int(arr_data[0][1])

arr = [int(x) for x in arr_data[1]]

cnt=1
if n <= k:
    
    print(cnt)
    
else:
    
    chkflg = True
    
    while chkflg:
        
        cnt+=1

        s = k + 1 + (k-1) * (cnt-2)
        e = k * 2-1 + (k-1) * (cnt-2)
        
        if s<=n<=e:
            
            chkflg=False
            
            
    print(cnt)



Measured memory_bytes: 13880
N = input()
n = list(map(int,list(N)))
for i in range(1<<3):
    cal = n[0]
    s = []
    for j in range(3):
        if i%2 == 0:
            cal += n[j+1]
            s.append("+")
        else:
            cal -= n[j+1]
            s.append("-")
        i = i//2
    if cal == 7:
        print(N[0]+s[0]+N[1]+s[1]+N[2]+s[2]+N[3]+"=7")
        break

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

const ll inf = 1LL << 60;

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

    int n;
    cin >> n;
    ll a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll dp[n+1][n+1];
    fill(dp[0], dp[n+1], 0LL);

    for (int i = n; i >= 0; i--) {
        for (int j = i+2; j <= n; j++) {
            ll tmp = 0LL;
            dp[i][j] = inf;
            for (int k = i; k < j; k++) {
                tmp += a[k];
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
            dp[i][j] += tmp;
        }
    }

    cout << dp[0][n] << "\n";
    return 0;
}

Measured memory_bytes: 1536
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int N;

    map<int, int> cnt;
    
    cin >> N;
    vector<int> A(N);

    auto Comb2 = [&] (int64 val) {
        return (int64)val * (val - 1) / 2;
    };

    int64 S = 0;

    for (int i = 0; i < N; i++) {
        cin >> A[i];
        cnt[A[i]]++;
    }

    for (auto entry: cnt) {
        S += Comb2(entry.second);
    }

    //cerr << "! " << S << "\n";

    for (int i = 0; i < N; i++) {
        cout << S  - Comb2(cnt[A[i]]) + Comb2(cnt[A[i]] - 1) << "\n";
    }

    return 0;
}


Measured memory_bytes: 8320
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

A,B=nm()

print((A+B)//2 if (A+B)%2==0 else 'IMPOSSIBLE')

Measured memory_bytes: 3060
#include <stdio.h>
int main(void)
{
    int num, s1, s2, s3, ans = 0;
    scanf("%d",&num);
    if (num%1000 >= 100)
    {
        ++ans;
    }
    if (num%100 >= 10)
    {
        ++ans;
    }
    if (num%10 >= 1)
    {
        ++ans;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int n;
  cin>>n;
  vector<int> vec(n);
  rep(i,n) cin>>vec[i];
  vector<int> cnt(100005, 0);
  rep(i,n){
    cnt[vec[i]]++;
    cnt[vec[i]+1]++;
    cnt[vec[i]+2]++;
  }

  cout << *max_element(all(cnt)) << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdint.h>
#include <utility>
#include <limits.h>
#include <vector>
#include <iomanip>

using namespace std;

int main()
{
  int N;
  vector<int> A(3);
  cin >> N >> A[0] >> A[1] >> A[2];

  vector<int> L;
  for (int n=0; n<N; ++n) {
    int l;
    cin >> l;
    L.push_back(l);
  }

  uint64_t min_cost = UINT64_MAX;
  for (int ii=0; ii < 1<<(N*2); ++ii) {
    int pattern = ii;

    uint64_t cost = 0;
    int a = 0, b = 0, c = 0;
    for (int jj=0; jj<N; ++jj) {
      switch(pattern%4) {
      case 0:
	if (a != 0)
	  cost += 10;
	a += L[jj];
	break;
      case 1:
	if (b != 0)
	  cost += 10;
	b += L[jj];
	break;
      case 2:
	if (c != 0)
	  cost += 10;
	c+= L[jj];
	break;
      }
      pattern >>= 2;
    }
    if (a==0 || b==0 || c==0)
      continue;
      
    cost += abs(A[0] - a);
    cost += abs(A[1] - b);
    cost += abs(A[2] - c);
    
    //cerr << ii << ":" << cost << endl;
    
    min_cost = min(cost,min_cost);
    if (min_cost == 0)
      break;
  }
  
  cout << min_cost << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


int main() {
	int N;
	vector<int> a;
	a.push_back(0);
	cin >> N;
	for (int i = 0; i < N; i++) {
		int pp; cin >> pp;
		a.push_back(pp);
	}
	int settle = 1;
	int count = 0;
	while (true) {
		if (settle == 2) {
			print(count);
			return 0;
		}
		else {
			settle = a[settle];
			count++;
			if (settle == 1 || count>=a.size())break;
		}
	}
	print(-1);




	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> diff(n+1);
    rep(i, n){
        if (i==0){
            diff[i] = 0;
        }else{
            diff[i] = a[i] - a[i-1];
        }
    }
    diff[n] = k - a[n-1] + a[0];
    sort(diff.begin(), diff.end());
    cout << k - diff.back() << endl;
    return 0;
}

Measured memory_bytes: 1792
n, k = map(int, input().split())
h_list = []
mn = 1e10
for i in range(n) :
    h = int(input())
    h_list.append(h)
h_list.sort()
for i in range(n-k+1) :
    mn = min(mn,(h_list[i+(k-1)]-h_list[i]))
print(mn)


Measured memory_bytes: 13304
#xi以外の場所にコマを置く理由がない
#コマを置くというのは担当区間の分割
#xi x(i + 1)の間隔を無視するということ
#距離がでかいところから分割してやれば良い
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))
l = [X[i + 1] - X[i] for i in range(M - 1)]
l.sort()
for _ in range(N - 1):
  if len(l):
    l.pop()
print(sum(l))



Measured memory_bytes: 13968
from heapq import heapify, heappushpop
n, *a = map(int, open(0).read().split())
q = a[:n]
heapify(q)
x = [sum(q)]
for k in range(n, 2 * n):
    v = heappushpop(q, a[k])
    x.append(x[-1] + a[k] - v)
a = a[::-1]
q = [-v for v in a[:n]]
heapify(q)
y = [-sum(q)]
for k in range(n, 2 * n):
    v = -heappushpop(q, -a[k])
    y.append(y[-1] + a[k] - v)
print(max(v - w for v, w in zip(x, y[::-1])))

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

#define MAX_N 86
int64_t L[MAX_N];

int main() {
  int64_t N;
  cin >> N;
  
  L[0] = 2;
  L[1] = 1;
  for (auto i=2; i<=N; ++i) {
  	L[i] = L[i-1] + L[i-2];
  }
  
  cout << L[N];
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <ll, pair <ll, ll>>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()
#define vvl vector <vector <ll> >
 
typedef long long ll;
 
typedef long double ld;
 
using namespace std;
 
const ll maxn = 2e6 + 100;
const ll mod = 998244353;

ll n, m, k, t;

ll F[maxn];

ll RF[maxn];

ll getc(ll n, ll k) {
    return F[n] * RF[k] % mod * RF[n - k] % mod;
}

inline ll step(ll a, ll x) {
    if (x == 0) {
        return 1;
    }
    if (x % 2 == 1) {
        return step(a, x - 1) * a % mod;
    }
    ll t = step(a, x / 2);
    return t * t % mod;
}

inline ll del(ll a, ll b) {
    return a * step(b, mod - 2) % mod;
}

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c;
    F[0] = 1;
    for (q = 1; q < maxn; q++) {
        F[q] = F[q - 1] * q % mod;
    }
    RF[maxn - 1] = del(1, F[maxn - 1]);
    for (q = maxn - 2; q >= 0; q--) {
        RF[q] = RF[q + 1] * (q + 1) % mod;
    }
    cin >> n >> m;
    vector <ll> S(min(n, m) + 1);
    ll ans = 0;
    for (q = m % 2; q <= n && q <= m; q += 2) {
        ll x = (3 * m - q) / 2;
        ll y = n;
        // cout << "Q " << q << endl;
        S[q] = getc(x + y - 1, n - 1) * getc(n, q) % mod;
        ll big = m;
        ll x1 = x - big;
        // ll dans = 0;
        if (x1 >= 0) {
            ll dans = q * getc(x1 + y - 1, n - 1) % mod * getc(n, q) % mod;
            // cout << "DANS1 " << dans << endl;
            S[q] = (S[q] - dans + mod) % mod;
        }
        big = m + 1;
        x1 = x - big;
        // ll dans = 0;
        if (x1 >= 0) {
            ll dans = (n - q) * getc(x1 + y - 1, n - 1) % mod * getc(n, q) % mod;
            // cout << "DANS2 " << dans << endl;
            S[q] = (S[q] - dans + mod) % mod;
        }
        // cout << x << " " << y << " " << S[q] << endl;
        ans += S[q];
        ans %= mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 38288
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur = nil->next;
  while( cur != nil && cur->key != key ){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer a){
  a->prev->next = a->next;
  a->next->prev = a->prev;
}

void deleteFirst(){
  NodePointer t = nil->next;

  if ( t == nil ) return;

  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;

  if ( t == nil ) return;

  deleteNode(t);
}

void delete(int key){
  NodePointer t = listSearch(key);

  if ( t == nil ) return;

  deleteNode(t);
}


void insert(int key){
  NodePointer x;

  x = malloc(sizeof(struct node));

  x->key = key;
  x->next = nil->next;

  nil->next->prev = x;
  nil->next = x;

  x->prev = nil;
}

int main(void){
  int i,N,key;

  int size = 0,np = 0, nd = 0;

  char com[20];

  scanf("%d", &N);

  init();

  for ( i = 0; i < N; i++ ){

    scanf("%s%d", com, &key);

    if(key<0 && key>2000000000){printf("error") ;}

    if ( com[0] == 'i' ) {insert(key); np++; size++;}

    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++;
      }
      size--;
    }
    if ( size > 1000000 ) { printf("error"); }
  }


  if( np+nd > 2000000){printf("error") ;}
  if(nd > 20){printf("error") ;}

  printList();


  return 0;
}



Measured memory_bytes: 36068
X,N=map(int,input().split())
if N==0:
    print(X)
    exit()
P=list(map(int,input().split()))
M=[i for i in range(102)]
for i in P:
    M[i]=0
A=101
for i in M:
    a=abs(X-i)
    if a<A:
        A=a
        Ans=i
print(Ans)

Measured memory_bytes: 9196
#include<stdio.h>
 
int main()
{
	int i,n,s = 0;
        int a[51],b[51],c[51];

	scanf("%d",&n);
	
	for(i=0;i<n;i++)
	scanf("%d",&a[i]);
	
	for(i=0;i<n;i++){
		scanf("%d",&b[i]);
		s+=b[i];
	}
	
	for(i=0;i<n-1;i++)
	scanf("%d",&c[i]);
	
	for(i=1;i<n;i++){
		if(a[i]-a[i-1]==1){
	 		s+=c[a[i-1]-1];
		}
	}
	
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 128
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', function(input) {
    lines.push(input);
});

rl.on('close', function() {
    var inputsAsArr = lines[0].split(' ');
    var sideA = inputsAsArr[0];
    var sideB = inputsAsArr[1];
    var sideC = inputsAsArr[2];

    var outputStr = (sideA === sideB && sideA === sideC && sideB === sideC) ? 'Yes' : 'No';
    console.log(outputStr);
});


Measured memory_bytes: 21320
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
c = list(accumulate(a))
ans = float("inf")
x, y = 0, 2
for i in range(1, n - 2):
    while c[x] < c[i] - c[x + 1]:
        x += 1
    y = max(y, i + 1)
    while c[y] - c[i] < c[-1] - c[y + 1]:
        y += 1
    ma = max(c[x], c[i] - c[x], c[y] - c[i], c[-1] - c[y])
    mi = min(c[x], c[i] - c[x], c[y] - c[i], c[-1] - c[y])
    ans = min(ans, ma - mi)
print(ans)

Measured memory_bytes: 32632
#include<stdio.h>
int solve(int a,int b,int c){
    if(a==1&&b>=c&&b<10){
        return 1;
    }
    if(a==1)return 0;
    int ret=0;
    for(int i=c;i<10&&i<b;i++){
        ret+=solve(a-1,b-i,i+1);
    }
    return ret;
}
int main(){
    int a,b;
    while(1){
        scanf("%d%d",&a,&b);
        if(a==0)return 0;
        printf("%d\n",solve(a,b,0));
    }
}


Measured memory_bytes: 2700
// AOJ 2352 Divisor
// 2018.4.10 bal4u

#include <stdio.h>
#include <string.h>

#define MAX 202
int   hi[MAX],  to[MAX][MAX];
char seen[MAX];
int  match[MAX];

int bpm(int u);
int bipartiteMatching(int m, int n)
{
    int u, max;

    memset(match, -1, (m+n)*sizeof(int));
    max = 0;
    for (u = 0; u < m; u++) {
        memset(seen, 0, m+n);
        if (bpm(u)) max++;
    }
    return max;
}

int bpm(int u)
{
    int i, v;

    for (i = 0; i < hi[u]; i++) {
        v = to[u][i];
        if (seen[v]) continue;
        seen[v] = 1;
        if (match[v] < 0 || bpm(match[v])) {
            match[u] = v, match[v] = u;
            return 1;
        }
    }
    return 0;
}

//#define getchar_unlocked()  getchar()
int in()
{
    int n = 0, c = getchar_unlocked();
    do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
    return n;
}

int  x[102]; int N;
char f[102]; int sz;
int  a[102];

int calc(int n, int *a)
{
    int i, j;

    memset(hi, 0, (sizeof(int)*n)<<1);
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) if (j != i) {
            if (a[i] % a[j] == 0) to[i][hi[i]++] = n+j;
        }
    }
    return n-bipartiteMatching(n, n);
}

int main()
{
    int i, j, k, ans;

    N = in();
    for (i = 0; i < N; i++) x[i] = in();

    // 課題文の条件を満たす集合Sの大きさを確定させる
    ans = calc(N, x);

    if (ans == 1) { puts("1"); return 0; }      // Sの大きさは1の場合、無条件にx[0]が答え

    memset(f, 1, N);    // f[i]=1：答えかその候補者、0：除外すべきx[i]

    sz = 0;             // 先頭x[0]から一つずつ確定していく。確定したx[i]の個数はsz
    for (i = 0; i < N; i++) {
        if (!f[i]) continue;    // 確定した集合Sの他メンバーと衝突するので不適合

        // x[i] を集合Sのメンバーにする
        k = 0; for (j = i+1; j < N; j++) if (f[j]) {
            if (x[i] % x[j] && x[j] % x[i]) {   // 残りのx[j]からx[i]と衝突しないものを選ぶ
                a[k++] = x[j];
            } else f[j] = 2;
        }
        
                                                // calc(k, a) は残りのx[j]で作れる集合の大きさ
        if (calc(k, a) + sz + 1 == ans) {       // 確定した集合Sの大きさ（=ans）と同じ
            // 結論として、x[i]を集合Sに入れるべきだ
            if (++sz == ans) break;
            for (j = i+1; j < N; j++) if (f[j] == 2) f[j] = 0;
        } else {
            // 結論として、x[i] は不適切で除外すべきだ
            f[i] = 0;
            for (j = i+1; j < N; j++) if (f[j] == 2) f[j] = 1;
        }
    }
    memset(f+i+1, 0, N-(i+1));                  // 残りのx[i]をすべて除外

    // 確定したx[i]を出力して終了
    k = 0; for (i = 0; i < N; i++) if (f[i]) {
        if (k) putchar(' '); else k = 1;
        printf("%d", i+1);
    }
    putchar('\n');
    return 0;
}



Measured memory_bytes: 2100
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#define ll long long
using namespace std;
int main(){
     string S;
     cin >> S;
     if(S[2] == S[3] && S[4]==S[5]){
          cout << "Yes" << endl;
     }else{
          cout << "No" << endl;
     }
     return 0;
}

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

char m[8][8];
void figure(int, int);

int main() {

	while(1) {
		bool f = true;
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				cin >> m[i][j];
				if(cin.eof()) {
					return 0;
				}
			}
		}
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				if(m[i][j] == '1') {
					figure(i, j);
					f = false;
					break;
				}
			}
			if(!f) {
				break;
			}
		}
	}
}


void figure(int i, int j) {
	char s;
	if(m[i][j+1] == '1' && m[i+1][j+1]== '1' && m[i+1][j]== '1') {
		s = 'A';
	}
	else if(m[i+1][j] == '1' && m[i+2][j] == '1') {
		s = 'B';
	}
	else if(m[i][j+1] == '1' && m[i][j+2] == '1') {
		s = 'C';
	}
	else if(m[i][j+1] == '1' && m[i+1][j+1] == '1') {
		s = 'E';
	}
	else if(m[i][j+1] == '1') {
		s = 'G';
	}
	else if(m[i+1][j+1] == '1') {
		s = 'F';
	}
	else {
		s = 'D';
	}
	cout << s << endl;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    char a, b;
    cin >> a >> b;
    if (b == 'H') {
        if (a == 'H') {
            puts("H");
        } else {
            puts("D");
        }
    } else {
        if (a == 'H') {
            puts("D");
        } else {
            puts("H");
        }
    }

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<ll> X(N);
    for(int i=0; i<N; i++){
        cin >> X[i];
    }

    ll cost;
    ll ans = 100*100*100;
    for(ll p=1; p<=100; p++){
        cost = 0;
        for(int i=0; i<N; i++){
            cost += (X[i]-p)*(X[i]-p);
        }
        ans = min(ans, cost);
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
	int l,r,d;
	cin >> l >> r >> d;
	int ans = 0;
	for (int i=l;i<=r;i++) if (i%d==0) ans++;
	cout << ans << endl;
	return 0;
}


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

int main() {
  int x, y, res;
  cin >> x >> y;
  res = abs(abs(y) - abs(x));

  if (x + res == y) {
    /* code */
  } else if (res - x == y) {
    res += 1;
  } else if (-res - x == y) {
    res += 1;
  } else if (-(res - x) == y) {
    res += 2;
  }

  cout << res;
  return 0;
}


Measured memory_bytes: 256
def check(p, s):
    flg = True
    for i in range(len(tmp)):
        if s[i]=='?' or p[i]=='?':
            continue
        elif s[i] == p[i]:
            continue
        elif s[i] != p[i]:
            flg = False
    return flg


S = input()
T = input()
lst = []

for i in range(len(S)-len(T)+1):
    tmp = S[:i]+T+S[i+len(T):]
    if check(tmp, S):
        lst.append(tmp)

if len(lst)==0:
    ans = 'UNRESTORABLE'
else:
    ans_lst = []
    for x in lst:
        ans_lst.append(x.replace('?','a'))
    ans = min(ans_lst)
print(ans)

Measured memory_bytes: 3064
N, K = map(int, input().split())
# K > 1 かつ　N > Kの場合は、N - N // K * K をスタートにできる
if K > 1:
  N = N - N // K * K
else:
  N = 0
minimum = N
count = 0
#print(N)
while count <= N / K:
  N = abs(N - K)
  minimum = min(N, minimum)
  count += 1
print(minimum)

Measured memory_bytes: 61768
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int water1, water2, sugar1, sugar2, rati, maxsub;
set <int> allposwater;
set <int> allpossugar;
double bestpercent = -1;
int bestsugar = 0;
int bestwater = 0;
vector <int> aps;
vector <int> apw;
void dpwater(int a) {
	if (a > maxsub)
		return;
	if (allposwater.find(a) == allposwater.end()) {
		allposwater.insert(a);
		dpwater(a + water1);
		dpwater(a + water2);
	}
}
void dpsugar(int a) {
	if (a > maxsub)
		return;
	if (allpossugar.find(a) == allpossugar.end()) {
		allpossugar.insert(a);
		dpsugar(a + sugar1);
		dpsugar(a + sugar2);
	}
}
int main() {
	cin >> water1 >> water2 >> sugar1 >> sugar2 >> rati >> maxsub;
	bestwater = water1;
	dpwater(0);
	dpsugar(0);
	allposwater.erase(0);
	allpossugar.erase(0);
	//for (set<int>::iterator it = allposwater.begin(); it != allposwater.end(); it++) 
	//	cout << *it << " ";
	//cout <<"\nCUT" << endl;
	//for (set<int>::iterator it = allpossugar.begin(); it != allpossugar.end(); it++) 
	//	cout << *it << " ";
	for (set<int>::iterator it = allposwater.begin(); it != allposwater.end(); it++) {
		apw.push_back(*it);
	}
	//for (int i = 0; i < apw.size(); i++)
		//cout << apw[i] << " ";
	//cout << endl;
	for (set<int>::iterator it = allpossugar.begin(); it!= allpossugar.end(); it++)
		aps.push_back(*it);
	for (int i = 0; i < apw.size(); i++) {
		for (int j = 0; j < aps.size(); j++) {
			//cout << apw[i] << " " << aps[j] << endl;
			if (((double)aps[j] / (aps[j] + apw[i])) * 100 > bestpercent && apw[i] * 100 + aps[j] <= maxsub && rati * apw[i] >= aps[j]) {
				bestpercent = ((double)aps[j] / ((aps[j] + apw[i]))) * 100;
				bestwater = apw[i];
				bestsugar = aps[j];
			}
		}
	}
	//cout << bestpercent << endl;
	cout << bestsugar + (bestwater * 100) << " " << bestsugar << endl;
}

Measured memory_bytes: 512
#include <iostream>
#define SIZE 100000
using namespace std;

struct Queue
{
    int work[SIZE];
    int head, tail;


    void init()
    {
        head = tail = 0;
    }

    bool empty()
    {
        return head == tail;
    }

    void inqueue(int x)
    {
        work[tail++] = x;
        tail %= SIZE;
    }

    int dequeue()
    {
        int a = work[head++];
        head %= SIZE;
        return a;
    }
};

int main()
{
    struct Queue q1, q2;
    int curr = 0, all = 0;
    string name[SIZE];
    q1.init();
    q2.init();
    int n, l;
    cin>>n>>l;
    for(int i = 0;i < n;i++)
    {
        int t;
        cin>>name[i]>>t;
        q1.inqueue(t);
        q2.inqueue(i);
        all += t;
    }

    while(!q1.empty())
    {
        int a = q1.dequeue();
        int b = q2.dequeue();

        if(a <= l)
        {
            curr += a;
            cout<<name[b]<<" "<<curr<<endl;
        }
        else
        {
            curr += l;
            a -= l;
            q1.inqueue(a);
            q2.inqueue(b);
        }
    }
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int a, b; cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << endl;

    return 0;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    int n;
    string s, t;
    cin >> n >> s >> t;

    REP(i, n) {
        cout << s[i] << t[i];
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE OverloadedStrings #-}
import Data.Maybe
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as VU

main = do
  [n, k] <- getIntList
  ns <- getIntVec n
  print . fst . VU.foldl' (f k) (k, 0) . VU.tail $ ns
  where
    f k (n, t) s = (n + min k (s - t), s)

-- IO
readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

getIntVec :: Int -> IO (VU.Vector Int)
getIntVec n = VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

Measured memory_bytes: 36220
#include<iostream>
using namespace std;
int main()
{
  long long int n, i, sum=0;
  cin>>n;
  for(i=1; i<=n ; i++)
  {
      if(i%3!=0 && i%5!=0)
      sum += i;
  }
  cout<<sum<<"\n";
  
  return 0;
}

Measured memory_bytes: 3624
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    import math
    (H, A) = map(int, inp.readline().strip().split(' '))

    r = math.ceil(H / A)
    return r


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Phuong // <3
typedef pair<int,int> ii;

const int inf = 1e9+1;

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> dp(n,inf);
    vector<int> h(n);
    for(int i=0;i<n; ++i)
    {
        cin >> h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;++i)
    {
        dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]), dp[i-2] + abs(h[i-2]-h[i]));
    }
    cout << dp[n-1];
    return(0);
}


Measured memory_bytes: 1024
N, T = map(int, input().split())
T_list = list(map(int, input().split()))

ans = T

for i in range(1, N):
    before_oyu = T_list[i-1]+T
    if before_oyu > T_list[i]:
        ans += T - (before_oyu - T_list[i])
    else:
        ans += T

print(ans)


Measured memory_bytes: 26708
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
double p[3100];
double dp[3100][3100];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lf",p+i);
	dp[0][0]=1;
	for(int i=1;i<=a;i++){
		for(int j=0;j<=i;j++){
			if(j)dp[i][j]+=dp[i-1][j-1]*p[i-1];
			dp[i][j]+=dp[i-1][j]*(1-p[i-1]);
		}
	}
	double ret=0;
	for(int i=0;i<=a;i++){
		if(i>a-i)ret+=dp[a][i];
	}
	printf("%.12f\n",ret);
}

Measured memory_bytes: 74240
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
const long long INF = 1LL << 60;

int main() {
  string S; cin>>S;
  int N=S.size();
  int ans=0;
  string old, now;
  for(int i=0; i<N; i++){
    now+=S[i];
    if(old == now)continue;
    old = now;
    now = "";
    ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 640
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    A = list(map(int, input().split()))
    print(A.index(0) + 1)
resolve()

Measured memory_bytes: 61848
// #pragma GCC optimize(2)
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <sstream>
#include <cstring>
#include <set>
#include <cctype>
#include <bitset>
#define IO                       \
    ios::sync_with_stdio(false); \
    // cin.tie(0);                  \
    // cout.tie(0);
using namespace std;
int dis[8][2] = {0, 1, 1, 0, 0, -1, -1, 0, 1, -1, 1, 1, -1, 1, -1, -1};
typedef unsigned long long ULL;
typedef long long LL;
const int maxn = 1e5 + 10;
const int maxm = 1e6 + 10;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const LL mod = 100003;
const double pi = acos(-1);
int f[maxn];
int size[maxn];
bool vis[maxn];
int ans[maxn];
int find(int v)
{
    if (f[v] == v)
        return v;
    else
        return f[v] = find(f[v]);
}

int main()
{
#ifdef ONLINE_JUDGE
#else
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#endif
    IO;
    LL a, b, c, d;
    cin >> a >> b >> c >> d;
    LL ans = -INF;
    ans = max(ans, b * d);
    ans = max(ans, a * c);
    ans = max(ans, b * c);
    ans = max(ans, a * d);
    cout << ans;
    return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll n;
ll a[100001];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i];
	}
	ll sum = 0;
	for(int i = 0; i < n; i++)
	{
		sum+=a[i];
	}
	ll tot = (ll(n)*ll(n+1))/2;
	if(sum%tot==0)
	{
		ll xsum = sum/tot;
		for(int i = 1; i <= n; i++)
		{
			int u = i; int v = i-1;
			if(u==n) u=0;
			ll diff = a[u] - a[v];
			ll nx2 = xsum - diff;
			if(nx2<0)
			{
				cout<<"NO\n";
				return 0;
			}
			if(nx2%n==0)
			{
				
			}
			else
			{
				cout<<"NO\n";
				return 0;
			}
		}	
		cout<<"YES\n";
	}
	else
	{
		cout<<"NO\n";
	}
}


Measured memory_bytes: 1024
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);
	
	void solve(){
		int n=gInt();
		System.out.println(
				INTS(n).map(i->i-1).sum()
				);
	}

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

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}


Measured memory_bytes: 27988
#include <iostream>

int main(void){
	int *cardsA,*cardsB;
	int cardNum,tempA,tempB,pointA=0,pointB=0,i=0;
while(true){
	std::cin >> cardNum;
	if(cardNum==0) return 0;
	cardsA=new int[cardNum];
	cardsB=new int[cardNum];
	for(;i<cardNum;++i){
		std::cin >> tempA >> tempB;
		cardsA[i]=tempA;
		cardsB[i]=tempB;
	}
	i=0;
	for(;i<cardNum;++i){
		if(cardsA[i]>cardsB[i]) pointA+=cardsA[i]+cardsB[i];
		if(cardsB[i]>cardsA[i]) pointB+=cardsA[i]+cardsB[i];
		if(cardsA[i]==cardsB[i]){
			pointA+=cardsA[i];
			pointB+=cardsA[i];
		}
	}
	std::cout << pointA << " " << pointB << std::endl;
	i=0;
	pointA=0;
	pointB=0;
	delete cardsA;
	delete cardsB;
}
	return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for(int i = a; i < b; i++)
#define for_m(i, a, b) for(int i = a - 1; i >= b; i--)

//a = s1.size();
//vector<string> s1;
//string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    cin >> a1[i];
    d += a1[i];
  }
  
  for(i = 1; i < a + 1; i++){
    for(j = 0; j < i; j++){
      b += a1[j];
    }
    for(j = i; j < a; j++){
      c += a1[j];
    }
    if(abs(b - c) <= d){
      d = abs(b - c);
    }
    b = 0;
    c = 0;
  }  
  cout << d << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<cmath>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;



int main(){
  int temp,ans=1000;
  ll S;
  cin>>S;

  while(S>100){
    temp=S%1000;
    ans=min(ans,abs(753-temp));
    S/=10;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 888
K, S = map(int, input().split())

# print(K)
# print(S)

count = 0
for i in range(K + 1):
	for j in range(K + 1):
		# for k in range(K + 1):
		# 	if i + j + k == S:
		# 		count += 1
		if i + j <= S and i + j + K >= S:
			count += 1

print(count)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

using P = pair<int, int>;
void prp(P& p) {cout << p.first << " " << p.second << endl;}

int main()
{
    string s; cin >> s;
    vector<int> v;
    rep(i, s.size()-1){
        if(s[i]=='R' && s[i+1]=='L') v.push_back(i);
    }

    vector<int> ans(s.size(), 0);

    rep(i, v.size()){
        int L = v[i];
        int R = v[i]+1;
        int l, r, x;
        for(l=v[i]-1; l>=0; l--){
            if(s[l]=='L') {break;}
        }
        l = L - l - 1;
        for(r=R+1; r<s.size(); r++){
            if(s[r]=='R') {break;}
        }
        r = r - R - 1;

        // cout << l << " " << L << " " << R << " " << r << endl;
        x = min(l, r);
        ans[L] = 1 + (l+r)/2 + (l-x)%2;
        ans[R] = 1 + (l+r)/2 + (r-x)%2;
        if((r+l-x)%2==1) swap(ans[L], ans[R]);
    }

    prvec(ans);

    return 0;}

Measured memory_bytes: 4024
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{

  ll a, b;
  ll num = 0;

  cin >> a >> b;

  if (a >= b)
  {
    num += a;
    a--;
  }
  else
  {
    num += b;
    b--;
  }
  if (a >= b)
  {
    num += a;
    a--;
  }
  else
  {
    num += b;
    b--;
  }
  cout << num << endl;

  return 0;
}


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

int main()
{
ll n ;
cin >> n ;
vector<string> s(n);
rep(i, n){
  cin >> s[i];
}
bool ok=0;
rep(i,n)rep(j,n)if(s[i][j]=='#')ok=1;
if(!ok){
cout << -1 << endl;
return 0;
}
ll y=0,t=0;
rep(i,n){
  bool k=1;
  rep(j,n){
    if(s[i][j]=='.')k=0;
  }
  if(k)y++;
}
rep(i,n){
  bool k=1;
  rep(j,n){
    if(s[j][i]=='.')k=0;
  }
  if(k)t++;
}
if(y>0){
cout << n-t << endl;
return 0;
}
ll p=9999;
rep(i,n){
  ll a=0;
  rep(j,n)if(s[i][j]=='.')a++;
  bool k=0;
  rep(j,n)if(s[j][i]=='#')k=1;
  if(!k&&a==n)continue;
  if(!k)a++;
  p=min(a,p);
}
cout << p+n-t << endl;
return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define STR 10
int main(){
    int n;
    scanf("%d",&n);
    while(n>10){
        n-=10;
    }
    if(n==2||n==4||n==5||n==5||n==7||n==9){
        printf("hon");
    }else if(n==0||n==1||n==6||n==8||n==10){
        printf("pon");
    }else{
        printf("bon");
    }
    return 0;
}

Measured memory_bytes: 1732
const main = input => {
  const inputArray = input.split('\n');
  const n = parseInt(inputArray[0], 10);
  const a = inputArray[1].split(' ').map(x => parseInt(x, 10));

  // 全てのxorを計算
  const allxor = a.reduce((prev, current, index, array) => prev ^ current);
  // console.log(allxor);
  let ret = '';
  
  for (let ai of a) {
    ret += (allxor ^ ai) + ' ';
  }
  console.log(ret.trim());
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 80564
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int main(void){
  int i,len,flg;
  char s[84];
 
  while(fgets(s,84,stdin) != NULL){
    len = strlen(s) - 1;
    flg = 1;
 
    while(flg){
      for(i=0;i<len;i++)
    if(islower(s[i]))
      s[i] = (s[i] - 'a' + 1) % 26 + 'a';
 
      for(i=0;i<len;i++){
    if(!strncmp(&s[i],"the",3) || !strncmp(&s[i],"this",4) || !strncmp(&s[i],"that",4)){
      flg = 0;
      break;
    }
      }
    }
    printf("%s",s);
  }
 
  return 0;
}

Measured memory_bytes: 524
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(vll &A){
    vector<pll> Ap(5);
    rep(i, 5){
        Ap[i].first=((A[i]+9)/10)*10 - A[i];
        Ap[i].second = A[i];
    }
    sort(Ap.begin(), Ap.end());
    ll time = 0;
    rep(i, 4){
        time += ((Ap[i].second+9)/10)*10;
    }
    time += Ap[4].second;
    cout << time << endl;
}

int main(){
    vll A(5);
    rep(i, 5){
        cin >> A[i];
    }
    solve(A);
    return 0;
}


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

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

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

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

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

ll X, Y;

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

    //input
    cin >> X >> Y;
    cout << (X + Y/2) << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
	//limit
	static int A, B, C, N;

	static int[] l;

	public static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();


		var A = input[0] ;
		var B = input[1] ;
		var K = input[2];

		var answer =101;
		var flag = true;
		var counter = 0;
		while (flag)
		{
			answer--;
			var aAnswer = A % answer;
			var bAnswer = B % answer;
			if (aAnswer == 0 & bAnswer == 0)
			{
				counter++;
				if (counter == K)
					flag = false;
			}
		}
		Console.WriteLine(answer);
	}
}


Measured memory_bytes: 13268