akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BAlgae solver = new BAlgae();
        solver.solve(1, in, out);
        out.close();
    }

    static class BAlgae {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long r = in.nextLong();
            long D = in.nextLong();
            long x2000 = in.nextLong();
            long last = x2000;
            for (int i = 0; i < 10; ++i) {
                out.println(last * r - D);
                last = last * r - D;
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 22484
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
#include <cctype>
#include <cstdio>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll> ;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI  3.1415926535
#define rep(i, k, n) for(ll i = k; i < n; i++)

vvll friendd;//友達関係
vvll block;//ブロック関係
vll ans;
vb checked;

void friend_potential(ll x,const vvll &friendd, const vvll &block, vll &ans, vb &checked){
  
  ll fxs = friendd[x].size();
  
  //まずはtreeをつくる
  //xの友達をキューとセットに追加
  queue<ll> que; set<ll> S;
  rep(i, 0, fxs){
    que.push(friendd[x][i]);
    S.insert(friendd[x][i]);
  }
  
  //友達の友達をたどっていく
  while(que.size()){
    //先頭のキューを取り出す
    ll p = que.front();
    que.pop();
    //pの友達がセットになければキューとセットに追加
    ll fps = friendd[p].size();
    rep(i, 0, fps){
      if(!S.count(friendd[p][i])){
        que.push(friendd[p][i]);
    	S.insert(friendd[p][i]);
      }
    }
  }
  
  //友達候補はtreeから友達関係とブロック関係を引いたもの
  ll fr_pot = S.size();
  
  //ブロック関係をひく
  for(auto value:S){
    ll res = fr_pot - friendd[value].size();
    checked[value] = true;
    rep(i, 0, block[value].size()){
      if(S.count(block[value][i])){res--;}
    }
    ans[value] = res;
  }
  
  return;
}
  
int main(){
  ll n, m, k; cin >> n >> m >> k;
  friendd = vvll (n+1,vll(0));
  block = vvll (n+1,vll(0));
  ans = vll (n+1, 0);
  checked = vb (n+1, false); 
  
  rep(i, 0, m){
    ll a, b; cin >> a >> b;
    friendd[a].emplace_back(b);
    friendd[b].emplace_back(a);
  }
  
  rep(i, 0, k){
    ll a, b; cin >> a >> b;
    block[a].emplace_back(b);
    block[b].emplace_back(a);
  }
  
  rep(i, 1, n+1){
    if(checked[i]){continue;}
    else{
      friend_potential(i, friendd, block, ans, checked);
    }
  }
  
  rep(i, 1, n+1){
    cout << max(ans[i]-1, 0LL) << " ";
  }
  
}
  

Measured memory_bytes: 21612
from collections import defaultdict

n, k = map(int, input().split())
A = list(map(int, input().split()))
delta_count = defaultdict(int)
sum = [0]
delta_count[0] += 1
for i in range(n):
    sum.append(sum[i] + A[i])
ans = 0
for i in range(1, min(n + 1, k)):
    x = (sum[i] - i) % k
    ans += delta_count[x]
    delta_count[x] += 1
for i in range(min(n + 1, k), n + 1):
    delta_count[(sum[i - k] - i - k) % k] -= 1
    x = (sum[i] - i) % k
    ans += delta_count[x]
    delta_count[x] += 1
print(ans)

Measured memory_bytes: 48392
from itertools import product

def main():
    n = int(input())
    a = []
    ls = []
    ans = 0
    for _ in range(n):
        ai = int(input())
        a.append(ai)
        ls.append([tuple(map(int, input().split())) for i in range(ai)])
    ptns = list(product([0,1], repeat=n))
    for ptn in ptns:
        flag = 0
        lsls = list(ptn)
        for j in range(n):
            if ptn[j] == 1:
                for i in range(a[j]):
                    if ls[j][i][1] == 1 and lsls[ls[j][i][0]-1] == 1:
                        lsls[ls[j][i][0]-1] *= ls[j][i][1]
                    elif ls[j][i][1] == 0 and lsls[ls[j][i][0]-1] == 0:
                        lsls[ls[j][i][0]-1] *= ls[j][i][1]
                    else:
                        flag = 1
        if flag == 0:
            if list(ptn) == lsls:
                if ans < sum(ptn):
                    ans = sum(ptn)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 49260
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;

int main() {
  int H,W; cin >> H >> W;
  char C[101][101];
  for ( int i = 1; i <= H; i++ ) {
    for ( int j = 1; j <= W; j++ ) {
      cin >> C[i][j];
    }
  }

  for ( int i = 1; i <= 2*H; i++ ) {
    for ( int j = 1; j <= W; j++ ) {
      cout << C[(i+1)/2][j];
    }
    cout << endl;
  }
  return 0;
}


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

int main(void) {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> A(N, vector<int>(M));
  rep(i, N) {
    rep(j, M) {
      cin >> A[i][j];
      A[i][j]--;
    }
  }

  int answer = INT_MAX;
  vector<bool> hold(M, true);
  rep(k, M) {
    vector<int> like(M, 0);
    rep(i, N) {
      rep(j, M) {
        if (hold[A[i][j]]) {
          like[A[i][j]]++;
          break;
        }
      }
    }

    int max_like = -1;
    int max_sports = 0;
    rep(j, M) {
      if (max_like < like[j]) {
        max_like = like[j];
        max_sports = j;
      }
    }
    answer = min(answer, max_like);
    hold[max_sports] = false;
    if (answer == 1) break;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
	int n,a,b;
	cin>>n;
	b=0;
	a=n;
	while(n)
	{
		b=b*10+n%10;
		n=n/10;	
	}
	if(a==b){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
	
	return 0;
}

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (2000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int n;
  cin >> n;
  int D[100000];
  rep(i,100000){
    D[i] = -1;
  }
  vector<int> G[100000];
  int a[100000],b[100000];
  rep(i,n-1){
    cin >> a[i] >> b[i];
    a[i]--;b[i]--;
  }

  //隣接リストをつくる
  rep(i,n-1){
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }

  //test
  /*
  rep(i,n){
    rep(j,G[i].size()){
      cout << G[i][j] << " ";
    }
    cout << endl;
  }
  */
  vector<int> c(n);
  rep(i,n){
    cin >> c[i];
  }

  if(n==1){
    cout << 0 << endl;
    cout << c[0] << endl;
    return 0;
  }

  sort(all(c));
  ll m=0;
  rep(i,n-1){
    m += c[i];
  }
  int ind=0;

  queue<int> Q;
  //まず木のはじっこの点を入れる
  rep(i,n){
    if(G[i].size()==1){
      Q.push(i);
      D[i] = c[ind];
      ind++; 
    }
  }

  while(!Q.empty()){
    int cur = Q.front();
    Q.pop();

    int nex;
    rep(i,G[cur].size()){//curの隣の点G[cur][i]を全部見る
      int kouho = G[cur][i];
      int micnt=0;
      rep(j,G[kouho].size()){
        if(D[G[kouho][j]] < 0){
          micnt++;
        }
      }
      //if(cur==3)cout << kouho << " " << micnt << endl;
      if(D[kouho] < 0 && micnt == 1){//G[cur][i]が未訪問であり、G[cur][i]から続く点のうち未訪問の点が1個だけ
        nex = kouho;
        Q.push(nex);
        D[nex] = c[ind];
        ind++;
      }
    }
  }
  cout << m << endl;
  rep(i,n){
    if(D[i]>0){
      cout << D[i] << " ";
    }else{
      cout << c[n-1] << " ";
    }
  }
  cout << endl;
}

Measured memory_bytes: 4224
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	@SuppressWarnings("deprecation")
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] A = new int[N];
		BigDecimal times = BigDecimal.valueOf(1);
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
			times = times.multiply(BigDecimal.valueOf(A[i]));
		}
		BigDecimal q = BigDecimal.valueOf(0);
		for(int i=0;i<N;i++) {
			BigDecimal x = times.divide(BigDecimal.valueOf(A[i]));
			q = q.add(x);
		}
		System.out.println(times.divide(q,6, BigDecimal.ROUND_HALF_UP));

	}
}


Measured memory_bytes: 22100
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            var ans = 0;
            
            for(var i=1;i<=K;i++)
            {
                for (var j = 1; j <= K; j++)
                {
                    for (var k = 1; k <= K; k++)
                    {
                        var tmp = GetEuc(i, j);
                        ans += GetEuc(tmp, k);
                    }
                }
            }
            Console.WriteLine(ans);
        }

        static int GetEuc(int a,int b)
        {
            if (a < b)
            {
                var tmp = a;
                a = b;
                b = tmp;
            }
            if (a % b == 0) return b;
            return GetEuc(b,a%b);
        }
    }
}

Measured memory_bytes: 17600
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<limits.h>
#include<string>
#include<vector>
#include<functional>
#define int long long
using namespace std;

vector<int>V[4];
int a, b, c;
vector<int>rui[4];
signed main() {
	cin >> a >> b;
	for (int d = 0; d < a; d++) {
		int e, f; cin >> e >> f;
		if (d == 0)c = e;
		V[e - c].push_back(f);
	}
	for (int i = 0; i < 4; i++) {
		sort(V[i].begin(), V[i].end(), greater<int>());
		rui[i].push_back(0);
		for (int j = 0; j < V[i].size(); j++) {
			rui[i].push_back(rui[i][j] + V[i][j]);
		}
	}
	int ans = 0;
	for (int i = 0; i <= V[0].size(); i++) {
		for (int j = 0; j <= V[1].size(); j++) {
			for (int k = 0; k <= V[2].size(); k++) {
				for (int l = 0; l <= V[3].size(); l++) {
					int S = c*i + (c + 1)*j + (c + 2)*k + (c + 3)*l;
					if (S <= b) {
						ans = max(ans,rui[0][i]+rui[1][j]+rui[2][k]+rui[3][l]);
					}
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) { cin >> a[i]; }
    int sum = accumulate(a.begin(), a.end(), 0);
    int thrs = sum / N;
    ll ans = 0LL;
    REP(i, N) { ans += (a[i] - thrs) * (a[i] - thrs); }
    ll bns = 0LL;
    REP(i, N) { bns += (a[i] - thrs - 1) * (a[i] - thrs - 1); }
    cout << min(ans, bns) << endl;
    return 0;
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    string a, b; cin >> a >> b;

    int size = a.size() > b.size() ? a.size() : b.size();

    ostringstream aa;
    aa << setw(size) << setfill('0') << a;
    string A(aa.str());

    ostringstream bb;
    bb << setw(size) << setfill('0') << b;
    string B(bb.str());

    if (A > B) {
        puts("GREATER");
    } else if (A < B) {
        puts("LESS");
    } else {
        puts("EQUAL");
    }
}

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

vector<vector<tuple<int, int, int>>> G;

int Nl2;
vector<vector<int>> parent;
vector<int> depth;
vector<int> dist;
vector<int> num_now;
vector<int> sum_now;
map<int, int> num[100000];
map<int, int> sum[100000];
vector<vector<int>> color;

void dfs( int v, int p, int d )
{
	parent[0][v] = p;
	depth[v] = d;
	for( int i = 0; i < G[v].size(); i++ ) {
		int a, c, dd;
		tie( a, c, dd ) = G[v][i];
		if( a != p ) dfs( a, v, d + 1 );
	}
}

int lca( int u, int v )
{
	if( depth[u] > depth[v] ) swap( u, v );
	for( int k = 0; k < Nl2; k++ ) {
		if( (depth[v] - depth[u]) >> k & 1 ) {
			v = parent[k][v];
		}
	}
	if( u == v ) return u;
	for( int k = Nl2 - 1; k >= 0; k-- ) {
		if( parent[k][u] != parent[k][v] ) {
			u = parent[k][u];
			v = parent[k][v];
		}
	}
	return parent[0][u];
}

void dfs2( int v, int p )
{
	for( int c : color[v] ) {
		num[v][c] = num_now[c];
		sum[v][c] = sum_now[c];
	}
	for( auto e : G[v] ) {
		int a, c, d;
		tie( a, c, d ) = e;
		if( a == p ) continue;
		dist[a] = dist[v] + d;
		num_now[c]++;
		sum_now[c] += d;
		dfs2( a, v );
		num_now[c]--;
		sum_now[c] -= d;
	}
}

int main()
{
	int N, Q;
	cin >> N >> Q;
	G = vector<vector<tuple<int, int, int>>>( N );
	for( int i = 0; i < N - 1; i++ ) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--;
		b--;
		c--;
		G[a].push_back( make_tuple( b, c, d ) );
		G[b].push_back( make_tuple( a, c, d ) );
	}

	Nl2 = 30;
	parent = vector<vector<int>>( Nl2, vector<int>( N ) );
	depth = vector<int>( N );
	dfs( 0, -1, 0 );
	for( int k = 0; k + 1 < Nl2; k++ ) {
		for( int v = 0; v < N; v++ ) {
			if( parent[k][v] < 0 ) parent[k + 1][v] = -1;
			else parent[k + 1][v] = parent[k][ parent[k][v] ];
		}
	}

	int X[100000], Y[100000], U[100000], V[100000], A[100000];
	color = vector<vector<int>>( N );
	for( int i = 0; i < Q; i++ ) {
		cin >> X[i] >> Y[i] >> U[i] >> V[i];
		X[i]--;
		U[i]--;
		V[i]--;
		A[i] = lca( U[i], V[i] );
		color[ U[i] ].push_back( X[i] );
		color[ V[i] ].push_back( X[i] );
		color[ A[i] ].push_back( X[i] );
	}
	dist = vector<int>( N );
	num_now = vector<int>( N );
	sum_now = vector<int>( N );
	dfs2( 0, -1 );
	for( int i = 0; i < Q; i++ ) {
		int x = X[i], y = Y[i], u = U[i], v = V[i], a = A[i];
		int du = dist[u] - sum[u][x] + num[u][x] * y;
		int dv = dist[v] - sum[v][x] + num[v][x] * y;
		int da = dist[a] - sum[a][x] + num[a][x] * y;
		int ans = du + dv - da * 2;
		cout << ans << endl;
	}
}


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

int main() {
  int a,b;
  cin >> a >> b;
  
  if ( a % 2 == 1 && b % 2 == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}



Measured memory_bytes: 256
//
//  main.cpp
//  C
//
//  Created by 曾憲揚 on 2020/8/21.
//  Copyright © 2020 曾憲揚. All rights reserved.
//

#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
    if(a<b) swap(a,b);
    while(b>0){
        a%=b; swap(a,b);
    }
    return a;
}

int main(int argc, const char * argv[]) {
    int k; cin>>k;
    int ans=0;
    for(int a=1; a<=k; a++){
        for(int b=1; b<=k; b++){
            for(int c=1; c<=k; c++){
                ans+=gcd(gcd(a,b), c);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<map>
using namespace std;

int main() {
	//入力
	string S;
	cin >> S;

	//処理
	// A <-> T C <-> G

	string before = "ATCG";
	string after = "TAGC";
	map<char, char> m;

	for (int i = 0; i < before.size(); i++)
	{
		m[before[i]] = after[i];
	}

	char ans = m[S[0]];

	//出力
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int x, y, z, k; cin>>x>>y>>z>>k;
    ll a[1001], b[1001], c[1001];
    for(int i=0; i<x; i++) cin>>a[i];
    for(int i=0; i<y; i++) cin>>b[i];
    for(int i=0; i<z; i++) cin>>c[i];
    vector<ll> ab;
    for(int i=0; i<x; i++){
        for(int j=0; j<y; j++){
            ab.push_back(a[i]+b[j]);
        }
    }
    sort(ab.begin(), ab.end(), greater<ll>());
    vector<ll> abc;
    for(int i=0; i<min(k, x*y); i++){
        for(int j=0; j<z; j++){
            abc.push_back(ab[i]+c[j]);
        }
    }
    sort(abc.begin(), abc.end(), greater<ll>());
    for(int i=0; i<k; i++){
        cout<<abc[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 43364
#include <stdio.h>          // printf(), fprintf(), scanf()
#include <stdlib.h>         // exit()

#define MAT_N 8
#define QUE_SIZE 64

typedef struct que_tbl
{
	int x;
	int y;
} que_t;

char field[MAT_N][MAT_N];
que_t queue[QUE_SIZE];
int que_in;
int que_out;

void
cleanup(int ecode)
{
	exit(ecode);
}

int
que_empty()
{
	return que_in == que_out;
}

void
que_push(que_t *que)
{
	queue[que_in].x = que->x;
	queue[que_in].y = que->y;
	que_in = (que_in + 1) % QUE_SIZE;

	if (que_in == que_out)
	{
		fprintf(stderr, "Queue overflow. size:%d\n", QUE_SIZE);
		cleanup(1);
	}
}

void
que_pop()
{
	if (que_out == que_in)
	{
		fprintf(stderr, "Queue underflow\n");
		cleanup(1);
	}

	que_out = (que_out + 1) % QUE_SIZE;
}

void
que_front(que_t *que)
{
	que->x = queue[que_out].x;
	que->y = queue[que_out].y;
}

void
solve(int sx, int sy)
{
	const int dx[12] = {-3,-2,-1, 1, 2, 3, 0, 0, 0, 0, 0, 0};
	const int dy[12] = { 0, 0, 0, 0, 0, 0,-3,-2,-1, 1, 2, 3};
	que_t que;
	int i;

	que_in = 0;
	que_out = 0;

	field[sy][sx] = '0';
	que.x = sx, que.y = sy;
	que_push(&que);

	while (!que_empty())
	{
		que_front(&que); que_pop();
		int x = que.x, y = que.y;

		for (i = 0; i < 12; ++i)
		{
			int nx = x + dx[i], ny = y + dy[i];
			if (0 <= nx && nx < MAT_N && 0 <= ny && ny < MAT_N && field[ny][nx] == '1')
			{
				field[ny][nx] = '0';
				que.x = nx, que.y = ny;
				que_push(&que);
			}
		}
	}
}

int
main(int argc, char **argv)
{
	int n;
	int x, y;
	char c;
	int i, j, k;

	scanf("%d%c", &n, &c);
	if (c != '\n')
		goto l_end;
	
	for (i = 0; i < n; ++i)
	{
		scanf("%c", &c);
		if (c != '\n')
			break;

		for (j = 0; j < MAT_N; ++j)
		{
			for (k = 0; k < MAT_N; ++k)
				scanf("%c", &field[j][k]);

			scanf("%c", &c);
			if (c != '\n')
				goto l_end;
		}

		scanf("%d\n%d%c", &x, &y, &c);
		if (c != '\n')
			break;

		solve(x - 1, y - 1);

		printf("Data %d:\n", i + 1);
		for (j = 0; j < MAT_N; ++j)
		{
			for (k = 0; k < MAT_N; ++k)
				printf("%c", field[j][k]);

			printf("\n");
		}
	}

l_end:
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;

ll check(ll n){
	ll cnt=0;
	while(n%2==0){
		n /= 2;
		cnt++;
	}
	return cnt;
}

ll ans,mx,mn=1e8,sum;
int main(){
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin>>a[i];
	}
	for(ll i=0; i<n; i++){
		if(a[i]%2==0){
			ll c = check(a[i]);
			ans += c;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

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

  ll a, b, c;
  cin >> a >> b >> c;

  ll sum = a + b + c, ma = max({a, b, c});
  cout << ma * 10 + sum - ma << endl;

  return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
# include <climits>
#define ll long long int
#define rep(i,rept) for (ll i = 0; i < rept; i++)
#define yes(b) std::cout<< (b ? "Yes" : "No")
#define YES(b) std::cout<< (b ? "YES" : "NO")
using namespace std;
/*int ketawa(ll num) {
	int dig, sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}
*/
ll func(ll a, ll b, ll c, ll d,int n) {
	return ((c / (d - b) + n)*(d - b)) + (a % (d - b));
}
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long int x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1) {
		cout << "Brown";
	}
	else {
		cout << "Alice";
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main(){
	int h,m,S;
	std::cin>>S;
	if(S>=3600){
		h=S/3600;
		S=S%3600;
		std::cout<<h<<":";
	}
	else{
		std::cout<<"0"<<":";
	}
	if(S>=60){
		m=S/60;
		S=S%60;
		std::cout<<m<<":";
	}
		else{
		std::cout<<"0"<<":";
	}
	std::cout<<S<<std::endl;
}

Measured memory_bytes: 1164
# pragma GCC optimize("Ofast")
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b;
    string s, t, u;
    cin >> s >> t >> a >> b >> u;
    if(u == s){
        a -= 1;
    }else{
        b -= 1;
    }
    cout << a << ' ' << b;
    return 0;
}

Measured memory_bytes: 256
s = input()
if s[0]!='A' or s[2:-1].count('C')!= 1:
  print('WA')
  exit()
  
for c in s[1:]:
  if not(('a'<= c <= 'z') or  c=='C'):
    print('WA')
    break
else:
  print('AC')



Measured memory_bytes: 2940
#include <iostream>
#include <cstring>

using namespace std;

using ll = long long;
const int INF = 2e9 + 13;
const int nax = 402;

ll dp[nax][nax], cost[nax][nax] = {0}, arr[nax] = {0}, prefix[nax] = {0}, n;

ll range(ll l, ll r){
    if(l > r) swap(l, r);
    return prefix[r] - (l ? prefix[l-1] : 0);
}

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    memset(dp, INF, sizeof dp);
    
    cin >> n;
    for(ll i = 0; i < n; ++i) cin >> arr[i];

    prefix[0] = arr[0];
    for(ll i = 1; i < n; ++i) prefix[i] = prefix[i-1] + arr[i];

    for(ll i = n-1; i >= 0; --i){
        for(ll j = i; j < n; ++j){
            if(i == j) dp[i][j] = 0;
            for(ll k = i; k <= j-1; ++k){
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + range(i, j));
            }
        }
    }
    cout << dp[0][n-1] << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 1536
import heapq
n,m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)

for i in range(m):
	target = heapq.heappop(a)
	heapq.heappush(a, (-1)*(-target//2))
	
print(-sum(a))	

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

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      long n = sc.nextInt();
      long m = sc.nextInt();
      long days = 0;
      for(long i = 0; i < m; i++)
        days += sc.nextLong();
      long diff = n - days;
      System.out.println(diff < 0 ? -1 : diff);
  }
}

Measured memory_bytes: 46832
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    if(a<b){
      if(b<c){
        System.out.printf("%d %d %d\n",a,b,c);
      }else if(a<c){
        System.out.printf("%d %d %d\n",a,c,b);
      }else{
        System.out.printf("%d %d %d\n",c,a,b);
      }
    }else{
      if(a<c){
        System.out.printf("%d %d %d\n",b,a,c);
      }else if(b<c){
        System.out.printf("%d %d %d\n",b,c,a);
      }else{
        System.out.printf("%d %d %d\n",c,b,a);
      }
    }
  }
}

Measured memory_bytes: 26104
/* basic header */
#include <bits/stdc++.h>
/* define */
#define ll long long
#define dou double
#define pb emplace_back
#define mp make_pair
#define sot(a,b) sort(a+1,a+1+b)
#define rep1(i,a,b) for(int i=a;i<=b;++i)
#define rep0(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-8
#define int_inf 0x3f3f3f3f
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lson (curpos<<1)
#define rson (curpos<<1|1)
/* namespace */
using namespace std;
/* header end */

const int maxn=1e5+10;
int n,a[maxn];

int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int ans=0,cnt=0;
	for (int i=n;i>1;i--){
		if (a[i]<=a[i-1]) cnt++;
		else{
			ans=max(ans,cnt);
			cnt=0;
		}
	}
	ans=max(ans,cnt);
	printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O3")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 

template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m=mod){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y,lli m=mod) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%m; 
        y = y>>1; 
        x = (x*x)%m;  
    }
    if(res<0)
       res+=m; 
    return res; 
}

lli fact[2000009];
lli ncr(lli n,lli r){
    lli ans=fact[n];
    if(r>n)return 0;
    ans=(ans*power(fact[n-r],mod-2))%mod;
    ans=(ans*power(fact[r],mod-2))%mod;
    return ans;
}
const int N=2e5+5;
v32 Tree[N];
lli subans[N],ssize[N];
int parent[N];
void dfs(int u,int p){
    ssize[u]=1;
    subans[u]=1;
    parent[u]=p;
    // cout<<u<<"\n";
    for(auto x:Tree[u]){
        if(x==p)continue;
        dfs(x,u);
        // cout<<x<<" "<<u<<"\n";
        ssize[u]+=ssize[x];
        subans[u]=(subans[u]*subans[x])%mod;
        subans[u]=(subans[u]*power(fact[ssize[x]],mod-2))%mod;
    }
    subans[u]=(subans[u]*fact[ssize[u]-1])%mod;
}
lli ans[N];
void dfs2(int u,int p,lli n){
    for(auto x:Tree[u]){
        if(x==p)continue;
        ans[x]=(ans[u]*power(n-ssize[x],mod-2))%mod;
        ans[x]=(ans[x]*ssize[x])%mod;
        dfs2(x,u,n);
    }
}
int main() 
{ 
    fact[0]=1;
    f(i,1,2000001)fact[i]=(i*fact[i-1])%mod;
    fastio;
    int t;
    // cin>>t;
    t=1;
	while(t--){
       int n;cin>>n;
       f(i,0,n-1){
           int u,v;cin>>u>>v;
           u--;v--;
           Tree[u].pb(v);
           Tree[v].pb(u);
       }
       f(i,0,n)ans[i]=1;
    //    for(int i=0;i<n;i++){
    //        if(Tree[i].size()){
    //            for(int j=0;j<Tree[i].size();j++)cout<<Tree[i][j]<<" ";
    //            cout<<"\n";
    //        }
    //    }
       dfs(0,0);
       ans[0]=subans[0];
       dfs2(0,-1,n);
       f(i,0,n)cout<<ans[i]<<"\n";
    }   
    return 0; 	
}


Measured memory_bytes: 35060
n,y=map(int,input().split())
for i in range(n+1):
    y_=y-10000*i
    for j in range(n-i+1):
        y__=y_-5000*j
        if y__//1000==n-i-j:
            print(i,j,n-i-j)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 40812
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	while(true)
	    {
		int n,p,d1,d2;
		n=scan.nextInt();
		if(n==0)break;
		int s[][]=new int[n][2];
		for(int i=0;i<n;i++)
		    {
			s[i][0]=scan.nextInt();
			d1=scan.nextInt();
			d2=scan.nextInt();
			s[i][1]=d1+d2;
		    }
		int max=s[0][1],top=s[0][0];

		for(int i=0;i<n;i++)
		    {
			if(max<s[i][1])
			    {
				max=s[i][1];
				top=s[i][0];
			    }
		    }

		System.out.println(top+" "+max);
	    }
    }
}

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

int main()
{
    int n ;
    cin>>n;
    int alice = 0, bob = 0;
    int a[n];
    int sum =0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum += a[i];
    }
    sort( a , a+n);
    for(int i=n-1;i>=0 ;i = i-2)
    {
        alice += a[i];
    }
    bob = sum - alice;
    cout<<alice - bob;
}

Measured memory_bytes: 3636
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
import math

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

K = i_i()

res = sum([math.gcd(math.gcd(a, b), c) for a in range(1,K+1) for b in range(1,K+1) for c in range(1,K+1)])
print(res)

Measured memory_bytes: 71520
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
   int a, b;
   cin >> a >> b;
   cout << ceil((a+b)/2.0) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int N = scan.nextInt();
	if((N/10) == 9||N%10 == 9){
	    System.out.println("Yes");
	}
	else{
	    System.out.println("No");
	}	    
	    
    }
}


Measured memory_bytes: 21844
S = list(input())
count = 0
for i in range(len(S)):
  if (i % 2 == 0 and S[i] == "L") or (i % 2 == 1 and S[i] == "R") :
    print("No")
    break
  count += 1
if count == len(S):
  print("Yes")

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;

#define int long long
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF (1LL<<60)
#define MOD 1000000007

#define MAX_N (1<<18)

int N, Q, A, B;
struct SegTree {
  int seg[MAX_N*2-1];
  int adds;
  SegTree() {
    for (int i=0; i<MAX_N*2-1; i++) seg[i] = INF;
    adds = 0;
  }

  void update(int i, int x) {
    i += MAX_N-1;
    x -= adds;
    if (seg[i] <= x) return;
    seg[i] = x;
    while (i > 0) {
      i = (i-1) / 2;
      seg[i] = min(seg[i*2+1], seg[i*2+2]);
    }
  }
  int query(int a, int b, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return seg[k] + adds;
    return min(
      query(a, b, k*2+1, l, (l+r)/2),
      query(a, b, k*2+2, (l+r)/2, r)
    );
  }

  void add_all(int x) {
    adds += x;
  }
};

SegTree f, g;
int X[200001];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> Q >> A >> B;
  A--, B--;
  X[0] = B;
  rep(i, Q) {
    cin >> X[i+1];
    X[i+1]--;
  }

  f.update(A, -A);
  g.update(A, +A);

  rep(i, Q) {
    int to_add = abs(X[i+1] - X[i]);

    int v = INF;
    v = min(v, f.query(0, X[i+1]+1) + X[i+1]);
    v = min(v, g.query(X[i+1], N) - X[i+1]);

    f.add_all(to_add);
    g.add_all(to_add);
    //f.update(X[i+1], f.query(X[i+1], X[i+1]+1) - to_add);
    //g.update(X[i+1], g.query(X[i+1], X[i+1]+1) - to_add);
    f.update(X[i], v - X[i]);
    g.update(X[i], v + X[i]);
  }

  int m = INF;
  rep(i, N) {
    m = min(m, f.query(i, i+1) + i);
    m = min(m, g.query(i, i+1) - i);
  }
  cout << m << "\n";
  return 0;
}


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


const int M = 2019;

 

int cnt[M + 3];
 
int main() {
  ll res = 0;
  string s;
  cin>>s;
  int len = s.size(), t = 0, p = 1;
  for (int i = len - 1; i >= 0; --i) {
    ++cnt[t];
    t += (s[i] - 48) * p;
    t %= M;
    res += cnt[t];
    p = p * 10 % M;
  }
  cout<<res;
  return 0;
}


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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long gcd(long long x, long long y){return x % y == 0 ? y : gcd(y, x%y);}

int main(void){
    int N,X; cin >> N >> X;
    vector<int> x(N); REP(i,N){cin >> x[i]; x[i] = abs(x[i]-X);}

    int ans = x[0];
    REP(i,N-1) ans = gcd(ans, x[i+1]);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
n,m,q=map(int,input().split())
d=[[0 for j in range(n)] for i in range(n)]
for i in range(m):
	l,r=map(int,input().split())
	d[n-l][r-1]+=1
for l in range(n):
	for r in range(1,n):
		d[l][r]+=d[l][r-1]
for l in range(1,n):
	for r in range(n):
		d[l][r]+=d[l-1][r]
for i in range(q):
	l,r=map(int,input().split())
	print(d[n-l][r-1])

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> p;
  for (int i=0;i<N;i++) {
    int pi;
    cin >> pi;
    p.push_back(pi);
  }
  sort(p.begin(), p.end());
  int res=0;
  for (int i=0;i<K;i++) {
    res+=p[i];
  }
  cout << res << endl;
}

Measured memory_bytes: 3632
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
if a[0]>x:
    ans = a[0]-x
    a[0] = x
for i in range(1, n):
    if a[i-1]+a[i]>x:
        tmp = a[i-1]+a[i]-x
        a[i] -= tmp
        ans += tmp
print(ans)

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

const int K_SIZE = 2e5;
const int MAX_D = 110;
const int MOD = 1e9+7;

int dp[K_SIZE][MAX_D][2];

void modadd(int &a, int b){
  a = (a+b)%MOD;
}

signed main(void){
  
  string K; cin >> K;
  int D; cin >> D;
  
  //初期値について
  
  for(int i = 0; i <= (int)(K[0]-'0'); i++){
    if( i == (int)(K[0]-'0')){ dp[1][i%D][1]++;}
    else{ dp[1][i%D][0]++;}
  }
  
  for(int i = 1; i < (int)K.size(); i++){
    for(int j = 0; j < D; j++){ 
      
      for(int x = 0; x < 10; x++){
        modadd(dp[i+1][(j+x)%D][0],dp[i][j][0]);
      }
      for(int x = 0; x < (int)(K[i]-'0');x++){
        modadd(dp[i+1][(j+x)%D][0],dp[i][j][1]);
      }
        modadd(dp[i+1][(j+(int)(K[i]-'0'))%D][1],dp[i][j][1]);
      
    }
  }
  
  int N = K.size();
  
  cout << (dp[N][0][1]+dp[N][0][0]-1+MOD)%MOD << endl;
  
  return 0;
  
}
                
    

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

int main() {
  int n;
  cin >> n;
  int j = 0;
  rep(i, n) {
    int d1, d2;
    cin >> d1 >> d2;
    if (d1 == d2) {
      j++;
    } else {
      j = 0;
    }
    if (j >= 3) {
      break;
    }
  }
  if (j >= 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;
using TP = tuple<ll, int, int, int>;
const int INF = 1001001001;

int main(void){
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<ll> a(x), b(y), c(z);
  REP(i, x) cin >> a[i];
  REP(i, y) cin >> b[i];
  REP(i, z) cin >> c[i];

  priority_queue<TP> q;
  set<TP> st;
  sort(ALLr(a));
  sort(ALLr(b));
  sort(ALLr(c));
  q.push(TP(a[0]+b[0]+c[0], 0, 0, 0));
  st.insert(TP(a[0]+b[0]+c[0], 0, 0, 0));

  int da[] = {1, 0, 0};
  int db[] = {0, 1, 0};
  int dc[] = {0, 0, 1};

  vector<ll> ans(k);
  REP(i, k){
    ll p, s, t, u;
    tie(p, s, t, u) = q.top();
    q.pop();
    ans[i] = p;
    REP(j, 3){
      int ns = s+da[j], nt = t+db[j], nu = u+dc[j];
      if(ns < x && nt < y && nu < z){
        TP data(a[ns]+b[nt]+c[nu], ns, nt, nu);
        if(!st.count(data)){
          q.push(data);
          st.insert(data);
        }
      }
    }
  }
  REP(i, k) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(ll i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(ll j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

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

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


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

    int A, P;
    cin >> A >> P;
    cout << (int)((A * 3 + P) / 2) << endl;

    return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
    }else if(a == c) {
        cout << b << endl;
    }else{
        cout << a << endl;
        }
}

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

template <typename T>
void print(const T &v);

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3628
import java.util.*;
import java.io.*;

class Main {

	void solve () {

		HashMap<String, Integer> map = new HashMap<>();
		map.put("SUN", 7);
		map.put("MON", 6);
		map.put("TUE", 5);
		map.put("WED", 4);
		map.put("THU", 3);
		map.put("FRI", 2);
		map.put("SAT", 1);
		System.out.println(map.get(in.next()));
		
	}

	public static PrintWriter out = new PrintWriter(System.out);
	public static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

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


string b(int x, int y) {
  for(int turtle=0;turtle<=x; turtle++) {
    if(turtle  * 4 + 2 * (x - turtle) == y) {
      return "Yes";
    }
  }
  return "No";
}

int main() {
  int x, y;
  cin >> x >> y;
  cout << b(x, y);
}

Measured memory_bytes: 3596
def merge_sort(a):
    return _merge_sort(a)

def _merge_sort(a):
    if len(a) == 1:
        return a,0
    m = len(a)/2
    b,count1 = _merge_sort(a[0:m])
    c,count2 = _merge_sort(a[m:len(a)])
    ret,count3 = merge(b,c)
    return (ret,count1+count2+count3)

def merge(b,c):
    a = []
    i = 0
    j = 0
    count = 0
    while i < len(b) and j < len(c):
        count += 1
        if b[i] > c[j]:
            a.append(c[j])
            j += 1
        else:
            a.append(b[i])
            i += 1
    if i == len(b):
        while j < len(c):
            count += 1
            a.append(c[j])
            j += 1
    elif j == len(c):
        while i < len(b):
            count += 1
            a.append(b[i])
            i += 1
    return a,count

n = int(raw_input())
a = map(int,raw_input().split(' '))
ret,count = merge_sort(a)
print ' '.join(map(str,ret))
print count

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;



int main(){
    string s;
    int ans =0;
    cin>>s;
    if(s=="RRR") ans=3;
    else if(s=="RRS") ans=2;
    else if(s=="RSS") ans=1;
    else if(s=="RSR") ans=1;
    else if(s=="SRR") ans=2;
    else if(s=="SSR") ans=1;
    else if(s=="SRS") ans=1;
    else if(s=="SSS") ans=0;

    cout<<ans;
}

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

int main(){
  int n,m,k;

  cin >> n >> m >> k;

  int i = 0;

  string result = "No";

  while(i <= m){
    int tmp_k = n * i;

    if(m - i*2 != 0){

      if((k - tmp_k)%(m-i*2) == 0 && (k - tmp_k) / (m-i*2) >= 0 && (k - tmp_k) / (m-i*2) <= n){
	result = "Yes";
	break;
      }
    }

    i += 1;
  }

  cout << result << endl;

  return 0;
}

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

int main(){
  string s;
  cin >> s;
  int s_len = (int)(s.length()), k=0;
  long long changed=0;
  
  if (s_len < 3){
      cout << 0;
      return 0;
  }

  for(int i=0; i<s_len-1; i++){
    if (s[i]=='A') k++;
    else if (s[i]=='B' && s[i+1]=='C') changed+=k, i++;
    else k=0;
  }
    
  cout << changed;
}

Measured memory_bytes: 644
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
	int n;
	
	while(1) {
		int a[11][11] ={};
		int i, j;
		
		scanf("%d", &n);
		if(n==0) break;
		for(i=0; i<n; i++) {
			for(j=0; j<n; j++) {
				scanf("%d", &a[i][j]);
				a[i][n]+=a[i][j];
			}
			a[n][n]+=a[i][n];
		}
		for(i=0; i<n; i++)
			for(j=0; j<n; j++)
				a[n][i]+=a[j][i];
		for(i=0; i<n+1; i++) {
			for(j=0; j<n+1; j++)
				printf("%5d", a[i][j]);
			puts("");
		}
	}
	
	return 0;
}


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

int main(){
  int a,b;

  cin>>a>>b;

  if(a<b){
    for(int i=0;i<b;i++){
      cout<<a;
    }
  }else{
    for(int j=0;j<a;j++){
      cout<<b;
    }
  }
  cout<<endl;

}

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

using namespace std;

int lcut(int i,int j,int s[],int H,int W,int cnum){
	int ue= 0,sita = 0,left = 0,right = 0;
	int n = j-1;
	while(s[n] == -2 && n >= 0){
		s[n] = cnum;
		n--;
	}
	left = n + 1;
	return left;
}
int rcut(int i,int j,int s[],int H,int W,int cnum){
	int ue= 0,sita = 0,left = 0,right = 0;
	int n = j+1;
	while(s[n] == -2 && n < W){
		s[n] = cnum;
		n++;
	}
	right = n - 1;
	return right;
}
int cut(int l,int r,int s[]){
	int i;
	for(i = l; i < r + 1; i++){
		if(s[i] != -2){
			return 2;
		}
	}
	return 1;
}
void dainyu(int s[],int l,int r,int cnum){
	int i;
	for(i = l; i < r + 1; i++){
		s[i] = cnum;
	}
}
int main(void)
{
	int H,W,K;
	cin >> H >> W >> K;
	int i,j;
	int s[H][W];
	char ddcc;
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			cin>> ddcc;
			if(ddcc == '#'){
				s[i][j] = -1;
			}
			else if(ddcc == '.'){
				s[i][j] = -2;
			}
		}
	}
	int left , right,ue,sita;
	int cnum = 1;
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			if(s[i][j] == -1){
				s[i][j] = cnum;
				left = lcut(i,j,s[i],H,W,cnum);
				right = rcut(i,j,s[i],H,W,cnum);
				ue = i - 1;
				while(cut(left,right,s[ue]) == 1)
				{
					dainyu(s[ue],left,right,cnum);
					ue--;
				}
				ue++;
				sita = i + 1;
				while(cut(left,right,s[sita]) == 1){
					dainyu(s[sita],left,right,cnum);
					sita ++ ;
				}
				sita--;
				cnum++;
			}
		}
	}
	//cout <<"ans"<<endl;
	for(i = 0; i < H ; i++){
		for(j = 0; j < W; j++){
			cout<<s[i][j];
			cout<<" ";
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 1152