akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#define ll long long
#define endl '\n'
using namespace std;
ll arr[100001];

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

  ll N, K; cin >> N >> K;
  while(N--)
    {
      ll a, b; cin >> a >> b;
      arr[a] += b;
    }
  ll acc = 0;
  for(int i = 1; i <= 100000; i++)
    {
      acc += arr[i];
      if(acc >= K)
	{
	  cout << i << endl;
	  return 0;
	}
    }
  
  
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <list>
#include <algorithm>
using namespace std;

class File
{
public:
  int index, left, right;
  File (int i, int l, int r)
    :index(i), left(l), right(r) {}
};

int main()
{
  int N;
  while (~scanf("%d\n", &N)) {
    if (N == 0)
      break;

    list<File> disk(1, File(-1, -1, -1));
    for (int i = 0; i < N; ++i) {
      char op;
      scanf("%c", &op);
      if (op == 'W') {
	int I, S;
	scanf("%d %d\n", &I, &S);

	int last = 0;
	for (list<File>::iterator it = disk.begin(); it != disk.end(); ) {
	  list<File>::iterator next = it;
	  ++next;
	  if (next == disk.end()) {
	    last = it->right+1;
	    break;
	  }

	  int left  = it->right+1;
	  int right = next->left-1;
	  int cap = right - left + 1;
	  if (cap >= 1) {
	    if (cap > S) {
	      disk.insert(next, File(I, left, left+S-1));
	      S = 0;
	      break;
	    } else {
	      disk.insert(next, File(I, left, right));
	      S -= cap;
	    }
	  } else {
	    ++it;
	  }
	}

	if (S > 0)
	  disk.push_back(File(I, last, last+S-1));
      } else if (op == 'D') {
	int I;
	scanf("%d\n", &I);
	for (list<File>::iterator it = disk.begin(); it != disk.end(); ) {
	  if (it->index == I)
	    it = disk.erase(it);
	  else
	    ++it;
	}

      } else {
	int P, ans = -1;
	scanf("%d\n", &P);
	for (list<File>::iterator it = disk.begin(); it != disk.end(); ++it) {
	  if (it->left <= P && P <= it->right) {
	    ans = it->index;
	    break;
	  }
	}
	printf("%d\n", ans);
      }
    }
    puts("");
  }
  return 0;
}

Measured memory_bytes: 908
def is_even(int_num):
    if int_num % 2 == 0:
        return True
    else:
        return False


def main():
    # start = time.time()
    inputs = input().split()
    a, b = int(inputs[0]), int(inputs[1])
    if is_even(a * b):
        print("Even")
    else:
        print("Odd")

    # print((time.time() - start) * 1000.0)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
import bisect

N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
cnt=0

for i in range(N):
    cnt += bisect.bisect_left(A,B[i]) * (N - bisect.bisect_right(C, B[i]))

print(cnt)

Measured memory_bytes: 23240
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long LL;
int main()
{
	LL x,y;
	LL count = 0;
	scanf("%lld %lld",&x,&y);
	while(x<=y)
	{
		x=x*2;
		count++;
	}
	printf("%lld\n",count);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
	    cin >> a.at(i);
	}
	int ans =0 ;
	vector<int> b(n);
	for(int i=0;i<n;i++){
	    cin >> b.at(i);
	    ans += b.at(i);
	}
	vector<int> c(n-1);
	for(int i=0;i<n-1;i++){
	    cin >> c.at(i);
	}
	for(int k=1;k<n;k++){
	    if(a[k]-a[k-1] == 1){
	        ans += c.at(a[k-1]-1);
	    }
	}
	cout << ans << endl;
}


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

static const int INF = 1001001001;

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

    vector<int> vecH(n);
    for(int i=0; i<n; i++)  cin >> vecH.at(i);

    int step = 0;
    int back = INF;
    int max = -1 * INF;
    for(int i=0; i<n; i++){
        if(back >= vecH[i]){
            if(max < step)
                max = step;
            
            step++;
        }
        else
            step = 1;

        back = vecH[i];
    }

    cout << max << endl;

    return 0;
}

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

const ll INF = 1e18;

int main(){
	int a,b,q;
	cin >> a >> b >> q;
	map<ll,bool> isTera;
	vector<ll> locate;
	vector<ll> jinja;
	vector<ll> tera;
	
	jinja.push_back(-INF);
	tera.push_back(-INF);
	locate.push_back(-INF);
	isTera[-INF] = true;
	
	rep(i,a){
		ll x;
		cin >> x;
		jinja.push_back(x);
		isTera[x] = false;
		locate.push_back(x);
	}
	rep(i,b){
		ll x;
		cin >> x;
		tera.push_back(x);
		isTera[x] = true;
		locate.push_back(x);
	}
	
	jinja.push_back(INF);
	tera.push_back(INF);
	locate.push_back(INF);
	isTera[INF] = true;
	
	sort(locate.begin(), locate.end());
	
	rep(i,q){
		ll x;
		cin >> x;
		
		ll res = INF;
		
		auto p = lower_bound(locate.begin(), locate.end(), x);

		if(*p != INF){
			if(isTera[*p] == true){
				auto q = lower_bound(jinja.begin(), jinja.end(),*p);
				res = min(res, abs(*q - x));
				res = min(res, abs(*p - x) + abs(*(q-1) - *p));
			}
			else{
				auto q = lower_bound(tera.begin(), tera.end(),*p);
				res = min(res, abs(*q - x));
				res = min(res, abs(*p - x) + abs(*(q-1) - *p));
			}		
			
		}

		if(*(p-1) != -INF){
			if(isTera[*(p-1)] == true){
				auto q = lower_bound(jinja.begin(), jinja.end(),*(p-1));
				res = min(res, abs(*(q-1) - x));
				res = min(res, abs(*(p-1) - x) + abs(*(p-1) - *q));
			}
			else{
				auto q = lower_bound(tera.begin(), tera.end(),*(p-1));
				res = min(res, abs(*(q-1) - x));
				res = min(res, abs(*(p-1) - x) + abs(*(p-1) - *q));
			}
		}
		
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 16996
n = int(input())
f_list = []
p_list = []
ans_list = []
for i in range(n):
    f = list(map(int, input().split()))
    f_list.append(f)
for i in range(n):
    p = list(map(int, input().split()))
    p_list.append(p)
for i in range(1, 1<<10):
    ans = 0
    for j in range(n):
        count = 0
        for k in range(10):           
            if (i>>k & 1) == 1 and f_list[j][k] == 1:
                count += 1
        ans += p_list[j][count]
    ans_list.append(ans)
print(max(ans_list))

Measured memory_bytes: 3188
"""
keyword: 累積和
"""

import sys
sys.setrecursionlimit(10**6)

n, k = map(int, input().split())
s = input()

nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか

for i in range(n):
    if s[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1 # 0と1を切り替える
        cnt = 1 # 新しいのをカウント
if cnt != 0:
    nums.append(cnt)

# 1-0-1-0-1-0-1って感じの配列が欲しい
# 1-0-1-0みたいに0で終わっていたら、適当に1つ足す
# 補足：1-0-1-0-1というのは、1が0個、0が2個、1が1個、、、などと並んでいるという意味。このとき1つ目の0をひっくり返すと1-1-1と連続する。1-...-1と連続している数が求める値なので、左端と右端は1にしたい
if len(nums)%2 == 0:
    nums.append(0)
    
add = 2*k+1

# 累積和を作る
tot = [0]*(len(nums)+1)
for i in range(len(nums)):
    tot[i+1] = tot[i]+nums[i]

ans = 0

# 1-0-1...の、1から始まり1で終わる範囲を見るので、偶数番目だけ見る
for i in range(0, len(nums), 2):
    
    # 次のleft, rightを計算する
    left = i
    right = min(i+add, len(nums))
    tmp = tot[right] - tot[left]
    
    ans = max(tmp, ans)
    
print(ans)

Measured memory_bytes: 13748
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <climits>
using namespace std;

static int mx[CHAR_MAX];
static int my[CHAR_MAX];
static char s[1024];


int main(int argc, char* argv[])
{
	for (;;) {
		int h, w;
		int x, y;
		int result;

		scanf(" %d %d", &h, &w);
		if (w == 0 && h == 0) {
			break;
		}
		for (int i = 0; i < h; ++i) {
			char r[64];

			scanf(" %s", r);
			for (int j = 0; r[j] != '\0'; ++j) {
				mx[r[j]] = j;
				my[r[j]] = i;
			}
		}

		scanf(" %s", s);
		x = y = 0;
		result = 0;
		for (int i = 0; s[i] != '\0'; ++i) {
			result += abs(mx[s[i]] - x) + abs(my[s[i]] - y) + 1;
			x = mx[s[i]];
			y = my[s[i]];
		}
		printf("%d\n", result);
	}

	return EXIT_SUCCESS;
}



Measured memory_bytes: 2684
function main(arg) {
  const array = arg.trim().split(" ");
  const A = parseInt(array[0], 10);
  const B = parseInt(array[1], 10);
  const C = parseInt(array[2], 10);
  let K = parseInt(array[3], 10);

  let answer = 0;

  if (K >= A) {
    answer += A;
    K -= A + B;
    console.log(K > 0 ? answer - K : answer);
  } else {
    console.log(answer + K);
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main("2 1 1 3");
// main("1 2 3 4");
// main("0 0 2000000000 1000000000");
// main("0 0 20 10");
// main("2000000000 0 0 2000000000");
//https://atcoder.jp/contests/abc167/tasks/abc167_b


Measured memory_bytes: 29832
//Created by: Aditya Singh
//Bleed Blue
#include <bits/stdc++.h>

using namespace std;
const int N = 1005, mod = 1e9 + 7;

char ar[N][N];
int n, m, dp[N][N];

int solve(int i, int j)
{
    if (i == n || j == m || ar[i][j] == '#')
        return 0;
    if (i == n - 1 && j == m - 1)
        return 1;
    if (dp[i][j] != -1)
        return dp[i][j];
   
    return dp[i][j] = (solve(i + 1, j) + solve(i, j + 1)) % mod;
}

int main()
{
    
   
        int i, j, k, ans = 0, cnt = 0, sum = 0;
        cin >> n >> m;
        for (i = 0; i < n; i++)
        {
            for (j = 0; j < m; j++)
            {
                cin >> ar[i][j];
                dp[i][j] = -1;
            }
        }
        cout << solve(0, 0);
    
    return 0;
}


Measured memory_bytes: 8520
#include<iostream>

using namespace std;

int main(){
 int a,b;
   cin >> a >> b;
  
  int res=0;
  for(int i=a;i<=b;i++){
   if((i/10000)==(i%10) && ((i/1000)-(i/10000)*10)==((i%100)-(i%10))/10) res++;
  }
  
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll a;
    char s;
    ll b;
    cin >> a >> s >> b;
    if (s == '+')cout << a + b << endl;
    else cout << a - b << endl;
}

Measured memory_bytes: 3544
class Graph():  #non-directed
    def __init__(self, n, edge, indexed=1):
        self.n = n
        self.edge = edge
        self.indexed = indexed
        self.graph = [[] for _ in range(n)]
        for e in edge:
            self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
            self.graph[e[1] - indexed].append((e[0] - indexed, e[2]))

    def warshall_floyd(self, INF=10**18):
        dist = [[INF for j in range(self.n)] for i in range(self.n)]
        for i in range(self.n):
            dist[i][i] = 0
        for i in range(self.n):
            for j, cost in self.graph[i]:
                dist[i][j] = cost
        for k in range(self.n):
            for i in range(self.n):
                for j in range(self.n):
                    if dist[i][k] != INF and dist[k][j] != INF:
                        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
        return dist


N, M = map(int, input().split())
E = [tuple(map(int, input().split())) for _ in range(M)]

g = Graph(N, E)
wf = g.warshall_floyd()

res = 0

for i in range(M):
    a, b, c = E[i]
    if wf[a - 1][b - 1] != c:
        res += 1

print(res)

Measured memory_bytes: 74412
import java.util.Scanner;

class Main {

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

        int H = scan.nextInt();
        int W = scan.nextInt();
        int i;
        int U;
        
        while (H != 0 || W != 0) {
        
            for (U = 1; U <= H; U++) {


                    for (i = 1; i <= W; i++) {
                        if (1==i%2 && 0==U%2 || 0==i%2 && 1==U%2 ) {
                            System.out.print(".");
                        } else {
                            System.out.print("#");
        }
    }
                System.out.println("");
            }
            System.out.println("");
             
                H = scan.nextInt();
                 W = scan.nextInt();
        }
    }
}



Measured memory_bytes: 32976
import java.util.List;
import java.util.Scanner;

public class Main {

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

	void run() {
		Scanner sc = new Scanner(System.in);

		int D = sc.nextInt();
		int N = sc.nextInt();

		int base=0;
		if(D==0) {
			base=1;
		}else if(D==1) {
			base=100;
		}else {
			base=100*100;
		}
        if(N==100)N++;
		int ans=N*base;
		pln(ans);
	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

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

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long M = 1000000007;

int N, K;
vector<int> v[100005];
int a[100005];

void dfs(int x, int p, bool islyr1) {
	int cur = K-2;
	if (islyr1) cur++;
	for (auto it:v[x]) {
		if (it==p) continue;
		a[it] = cur--;
		dfs(it, x, 0);
	}
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> K;
	for (int i = 1; i < N; i++) {
		int a, b;
		cin >> a >> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	a[1] = K;
	dfs(1, -1, 1);
	long long ans = 1;
	for (int i = 1; i <= N; i++) {
		ans *= a[i];
		ans %= M;
	}
	cout << ans;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  set<int> s;
  int q;
  cin >> q;
  int tmp, tmp2;
  rep_i(i, q){
    cin >> tmp >> tmp2;
    if(tmp == 0){
      s.insert(tmp2);
      say(s.size());
    }else if(tmp == 1){
      set<int>::iterator itr = s.find(tmp2);
      if(itr == s.end()){
        say(0);
      }else{
        say(1);
      }
    }else{
      s.erase(tmp2);
    }
  }
}


Measured memory_bytes: 12372
def isPrime(x):
    if x < 2:
        return False
    for i in range(2, int(pow(x, 0.5)+1)):
        if x%i==0:
            return False
    return True

X = int(input())

while True:
    if isPrime(X):
        print(X)
        break
    else:
        X += 1


Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
main(){
  char op[1000200];
  int memory[100],cnt=0;
  while(scanf("%s",op)!=EOF){
    if(op[0]=='+'){
      memory[cnt-2]+=memory[cnt-1];
      cnt--;
    }else if(op[0]=='-'){
      memory[cnt-2]-=memory[cnt-1];
      cnt--;
    }else if(op[0]=='*'){
      memory[cnt-2]*=memory[cnt-1];
      cnt--;
    }else{
      memory[cnt]=atoi(op);
      cnt++;
    }
  }
  printf("%d\n",memory[0]);
}

Measured memory_bytes: 2684
import Data.List
import Data.Maybe

main = do
  s <- getLine

  putStrLn $ yesno $ solve s

  where
    solve s
      | s == [] = True
      | isPrefixOf "dream" s =
        let Just r = stripPrefix "dream" s
        in
          if isPrefixOf "er" r then
            or [solve r, solve $ fromJust (stripPrefix "er" r)]
          else
            solve r
      | isPrefixOf "eraser" s = solve $ fromJust (stripPrefix "eraser" s)
      | isPrefixOf "erase" s = solve $ fromJust (stripPrefix "erase" s)
      | otherwise = False
    yesno True = "YES"
    yesno False = "NO"
          


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

class B
{
	static void Main()
	{
		var h = new int[5].Select(_ => int.Parse(Console.ReadLine())).OrderBy(x => (x %= 10) > 0 ? x : 10).ToArray();
		Console.WriteLine(h[0] + h.Skip(1).Sum(x => x % 10 > 0 ? x - x % 10 + 10 : x));
	}
}


Measured memory_bytes: 11476
N = int(input())
a = []
tmp = []
for i in range(2):
    tmp = list(map(int,input().split()))
    a.append(list(tmp))

maxCandies = 0
for i in range(N):
    total = sum(a[0][:i+1]) + sum(a[1][i:])
    if maxCandies < total:
        maxCandies = total
    total = 0

print(maxCandies)


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

int main(){
  int n, k;
  cin >> n >> k;
  map<int, int> mp;
  for(int i=0; i<k; ++i){
    int d;
    cin >> d;
    for(int j=0; j<d; ++j){
      int x;
      cin >> x;
      ++mp[x];
    }
  }
  cout << n - mp.size() << endl;
}

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

int f(int n){
 if(n % 2 == 0) return n / 2;
  else return 3 * n + 1;
}

int main(void){
  int D;
  cin >> D;
  cout << "Christmas";
  for(int i = 1; i <=  25 - D; i++){
    cout << " Eve";
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,k,h[100000];
	int i,c=0;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	for(i=0;i<n;i++){
		if(k<=h[i]){
			c++;
		}
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 2068
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define Test ll t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define loopS(i,a,b,step) for(ll i=a;i<b;i+=step)
#define loopRS(i,a,b,step) for(ll i=a;i>=b;i-=step)
#define ull unsigned long long int
#define pll pair<ll,ll>
#define puu pair<ull, ull>
#define V vector
#define M map
#define UM unordered_map
#define mp(x,y) make_pair(x,y)
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define inf INT_MAX
#define S3(a,b,c) cin >> a >> b >> c
#define S2(a,b) cin >> a >> b
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;

void input(ll n, ll arr[]) {
	rep(i, 0, n)cin >> arr[i];
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout.tie(NULL);
	ll n, k; S2(n, k);
	bool dp[k + 1];
	init(dp, false);
	V<ll> a(n);
	rep(i, 0, n)cin >> a[i];
	rep(curStone, 0, k + 1) {
		for (auto i : a) {
			if (curStone >= i && !dp[curStone - i])
				dp[curStone] = true;
		}
	}
	cout << (dp[k] ? "First" : "Second");
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int cnt1 = 0, cnt2 = 0;
    for(int i = 0; i < 4; i++)
    {
        if('+' == s[i])
        {
            cnt1++;
        }
        else
        {
            cnt2++;
        }
    }

    cout << cnt1 - cnt2;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

   ll n, k;
   cin >> n >> k;
   ll ans = n % k;
   ans = min(ans, abs(k - ans));
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
N, M, X = map(int, input().split())
A = map(int, input().split())
n1 = 0
n2 = 0
for a in A:
    if a < X:
        n1 += 1
    else:
        n2 += 1
if n1 <= n2:
    print(n1)
else:
    print(n2)

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/09/19  Problem: ACPC2017_day2_b.cpp  / Link:   ----- */
/* ------??????------



-----?????????????????§----- */
/* -----?§£??¬???-----



----?§£??¬???????????§---- */

LL N;

int m[102], s[102], d[102], v[102], day[102];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	cin >> N;
	FOR(i, 0, N) {
		cin >> m[i] >> d[i] >> v[i] >> s[i];
		m[i]--; v[i]--;
		day[i] = m[i] * 30 + d[i];
	}

	int  res = INF;
	FOR(i, 1, 361) {
		int  ans = -1;
		FOR(j, 0, N) {
			int konza;
			if ((day[j] <= i&&i <= (day[j] + v[j])) || (day[j] - 360 <= i&&i <= day[j] - 360 + v[j]))
				konza = s[j];
			else {
				int startsa = min(abs(i - day[j]), min(abs(i - 360 - day[j]), abs(i + 360 - day[j])));
				int endsa=min(abs(i-day[j]-v[j]),min(abs(i-360-day[j]-v[j]),abs(i+360-day[j]-v[j])));
				konza = max(0, s[j] - min(startsa, endsa));
				//konza = max(0, s[j] - min((min(abs(day[j] - i), 360 - abs(day[j] - i))), min(abs(day[j] + v[j] - i), 360 - abs(day[j] + v[j] - i))));
				//cout << "renkyu out : " << abs(day[j] - i) << ": " << abs(day[j] + v[j] - i) << endl;
				//debug(konza);
			}
			ans = max(konza, ans);
		}
		//cout << i << " " << ans << endl;
		if (ans >= 0)
			res = min(res, ans);
	}

	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    for(int i=0;i<3100;i++){
        cin>>a>>b;
        if(a==0 && b==0)break;
        else if(a<=b)cout<<a<<" "<<b<<endl;
        else if(a>b)cout<<b<<" "<<a<<endl;
    }
    return 0;
}



Measured memory_bytes: 3032
#include<bits/stdc++.h>
using namespace std; 
int n,a[200004],ans;
bool iss[1000004];
int main(){
	cin>>n;
	for(int i=2;i<=n+1;i++)cin>>a[i];sort(a+2,a+2+n);
	for(int i=2;i<=n+1;i++){
		if(!iss[a[i]])ans++;
		if(a[i]==a[i-1]){
			if(!iss[a[i]]){
				ans--;
				if(a[i]!=a[i-2])ans--;
			}
		}else{
			if(!iss[a[i]])for(int j=a[i]*2;j<=1e6;j+=a[i])iss[j]=1;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 5328
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        string s;
        cin >> s;
        string ans = "";
        ll l = 0;
        rep(i, s.size()) {
            if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G') ans += s[i];
            else {
                l = max(l, ll(ans.size()));
                ans = "";
            }
        }
        l = max(l, ll(ans.size()));
        cout << l << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t a,b;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> a>>b;
	auto n = b - a;
	auto bb = n * (n + 1) / 2;
	out << bb - b << endl;

	return 0;
}
#endif


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


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

    // solution comes here
    ll N, Q;    string S;
    cin >> N >> Q >> S;

    vl SUM(N);
    SUM[0] = 0;
    rep(i, N-1) SUM[i+1] = SUM[i] + ('A'==S[i] and 'C'==S[i+1]);
    
    ll l, r;
    rep(i, Q) {
        cin >> l >> r;
        cout << SUM[--r] - SUM[--l] << endl;
    }
}

Measured memory_bytes: 1872
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    VI v(n);
    rep(i, n) cin >> v[i];
    int ans = 0;
    rep(i, n)
    {
        if (i % 2 == 0 && v[i] % 2 == 1)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	int n; cin>>n;
	vector<bool>a(1e6+1,false);
	vector<int>b(1e6+1,0);
	for(int i=0;i<n;++i){
		int A; cin>>A;
		a.at(A)=true;
		++b.at(A);
	}
	for(int i=0;i<a.size();++i){
		if(a.at(i)){
			for(int j=i+i;j<a.size();j+=i){
				a.at(j)=false;
			}
		}
	}
	int ans=0;
	for(int i=0;i<a.size();++i){
		if(a.at(i)&&b.at(i)==1)++ans;
	}
	cout<<ans<<"\n"s;
}

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

int main() {
  int64_t A, V, B, W, T;
  cin >> A >> V >> B >> W >> T;
  if (A < B) {
    if ((B - A)  + T * W <= V * T) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
  if (A > B) {
    if ((A - B) + T * W <= V * T) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}



Measured memory_bytes: 3596
#include <stdio.h>
#include <string.h>
int main()
{
    int l,r,d,i,count=0;
    scanf("%d%d%d",&l,&r,&d);
    for(i=l;i<=r;i++)
    {
        if(i%d==0)count++;
    }
    printf("%d\n",count);
}


Measured memory_bytes: 1724
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
    int W, H;
    while (1) {
        scanf("%d%d", &H, &W);
        if ((H == 0) && (W == 0))break;
        else {
            for (int i = 1; i <= H; i++) {
                for (int j = 1; j <= W; j++) {
                    if(i==1||i==H||j==1||j==W)printf("#");
                    else printf(".");
                }
                printf("\n");
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2060
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  string S,T;
  in(S,T);
  out(T+S);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

int main(){
  int N;
  string A, B, C;
  cin >> N >> A >> B >> C;
  int Ans=0;
  set<char> S;
  for(int i=0; i<N; i++){
    S={A.at(i), B.at(i), C.at(i)};
    Ans+=S.size()-1;
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
a = [int(input()) for _ in range(5)]

maxv = 0
b = 4
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

int n,w,k,sta,num[1005],nowcnt,ans = INT_MAX;
char table[15][1005];

bool check(int now){
  int cnt = 0,id = 0;
  for(int i = 1;i <= n;i++){
    num[id] += table[i][now] == '1';
    if(num[id] > k) return true;
    if((sta>>(i-1))&1) id++;
  }
  return false;
}

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n>>w>>k;
  for(int i = 1;i <= n;i++){
    for(int j = 1;j <= w;j++) cin>>table[i][j];
  }
  for(sta = 0;sta < (1<<n);sta++){
    memset(num,0,sizeof(num));
    nowcnt = __builtin_popcount(sta);
    bool done = true;
    for(int j = 1;j <= w;j++){
      if(check(j)){
	nowcnt++;
	memset(num,0,sizeof(num));
	done = !check(j);
      }
    }
    if(done) ans = min(ans,nowcnt);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int maxn = 110;
int b[maxn];
int sta[maxn], cnt = 0;
int n;
bool flag[maxn] = {0};
void work()
{
	int x = 0, mx = 0;
	for(int i = 1; i <= n; i ++)
	{
		x += (!flag[i]);
		if(!flag[i] && x == b[i])
			mx = max(mx, i);
	}
	if(mx == 0)
	{
		cout << -1 << endl;
		exit(0);
	}
	sta[++ cnt] = b[mx];
	flag[mx] = 1;
}
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n;
	for(int i = 1; i <= n; i ++)
		cin >> b[i];
	for(int i = 1; i <= n; i ++)
		work();
	for(int i = cnt; i >= 1; i --)
		cout << sta[i] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,k,n) for (int i = k; i < (int)(n); i++)
#define repd(i,n) for (int i = n-1; i >= 0; i--)
#define rrepd(i,k,n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
const ll mod = 1000000007;
const ll inf = 1000000000000;//10の12乗

int main() {
  VVi v(3,Vi(3));
  VVi whe(100,Vi(2,-1));
  VVb bingo(3,Vb(3,0));
  rep(i,3)rep(j,3){
    int x;
    cin >> x;
    whe[x-1][0]=i;
    whe[x-1][1]=j;
  }
  int n;
  cin >> n;
  rep(i,n){
    int x;
    cin >> x;
    x--;
    if(whe[x][0]==-1) continue;
    int a=whe[x][0],b=whe[x][1];
    bingo[a][b]=1;
  }
  bool ok=0;
  rep(i,3){
    bool tate=1;
    rep(j,3){
      if(bingo[i][j]==0) tate=0;
    }
    if(tate) ok=1;
  }
  rep(i,3){
    bool tate=1;
    rep(j,3){
      if(bingo[j][i]==0) tate=0;
    }
    if(tate) ok=1;
  }
  if(bingo[0][0]&&bingo[1][1]&&bingo[2][2]) ok=1;
  if(bingo[0][2]&&bingo[1][1]&&bingo[2][0]) ok=1;
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 3604
N = int(input())
ans = 'No'

if ((N%7)==0):
    ans = 'Yes'

if ((N%4)==0):
    ans = 'Yes'

if (ans == 'No'):
    while(N > 6):
        N = N - 7
        if ((N%4) == 0):
            ans = 'Yes'
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long ncrmodp(long n,long r,long p){
  long ans = 1;
  long i;
  r = min(r,n-r);
  for(i=n;i>n-r;i--){
    ans *= i;
    ans %= p;
  }
  long tmp = 1;
  for(i=1;i<=r;i++){
    tmp *= i;
    tmp %= p;
  }
  for(long bit = 1;bit <= p-2;bit*=2){
    if(p-2 & bit){
      ans *= tmp;
      ans %= p;
    }
    tmp *= tmp;
    tmp%= p;
  }
  return ans;
}


int main(){
  long x,y;
  cin >> x >> y;
  if((x+y)%3 != 0 || x > y*2 || y > x*2)cout << 0 << endl;
  else{
    long const mod = 1000000007;
    int move = (x+y)/3;
    int xx = x - move;
    cout << ncrmodp(move,xx,mod)<<endl;

  }
}


Measured memory_bytes: 256
input()
a = list(map(int, input().split()))
c = {}
lb = lc = 0
for i in a:
  try:
    c[i] += 1
    lb += 1
  except:
    c[i] = 1
    lc += 1
print(lc if lb % 2 == 0 else lc-1)

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

int main(void) {
	long long int N;
	long long int up, down;
	bool flag = false;

	cin >> N;

	for (long long int h = 1; h <= 3500; h++) {
		for (long long int n = 1; n <= 3500; n++) {
			up = (N*h*n);
			down = (4 * h*n - N * n - N * h);
			if (down>0&&up%down==0) {
				cout << h << " " << n << " " << up/down << endl;
				flag = true;
				break;
			}
		}
		if (flag) {
			break;
		}
	}



	return 0;
}

Measured memory_bytes: 256
d, g = map(int, input().split())
p = []
c = []
for i in range(d):
    e1, e2 = map(int, input().split())
    p.append(e1)
    c.append(e2)

ans = float('inf')
for i in range(2**d):
    total = 0
    num = 0
    for j in range(d):
        if (i >> j) & 1:
            total += c[-(j+1)] + p[-(j+1)] * (d - j) * 100
            num += p[-(j+1)]
    if total >= g:
        ans = min(ans, num)
    else:
        for j in range(d):
            if (i >> j) & 1:
                continue
            for k in range(p[-(j+1)]):
                if total >= g:
                    break
                total += (d-j) * 100
                num += 1
    ans = min(ans, num)

print(ans)

Measured memory_bytes: 42096
#include <cstdio>
#include <map>
#include <algorithm>
 
using ll = long long;
using namespace std;
map<int,int> ntok;
int a[123456];
int sa[123456];
int n;
 
int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",a + i);
		sa[i] = a[i];
	}
	sort(sa, sa + n);
	for (int i = 0; i < n; ++i)
	{
		ntok[sa[i]] = i;
	}
	for (int i = 0; i < n; ++i)
	{
		a[i] = ntok[a[i]];
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] % 2 != i % 2)++ans;
	}
	printf("%d\n",ans / 2);
	return 0;
}

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

int main () {
	char str[16], *ptr;
	scanf ("%s", str);

	int sn = 0;
	int n = atoi (str);
	ptr = str;
	while (*ptr >= '0' && *ptr <= '9')
		sn += (int) (*ptr++ - '0');

	if (n%sn == 0)
		printf ("Yes\n");
	else 
		printf ("No\n");

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
 
int main() {
  int a,N;
  a = 0;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N-1);
  for (int i=0;i<N-1;i++){
  cin >> B.at(i) ;
  }
  A.at(0) = B.at(0);
  for (int j = 0;j<N-2;j++){
    A.at(j+1) = min(B.at(j),B.at(j+1));
  }
  A.at(N-1) = B.at(N-2);
  for (int k = 0;k<N;k++){
  a += A.at(k);
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxN 200005
#define mod 1000000007
using namespace std;

int n;
char s[maxN];

bool Opbrak[maxN];
void NoSol()
{
    printf("0\n");
    exit(0);
}
int main()
{
    scanf("%d\n%s", &n, s);
    n = 2 * n;

    int op = 0, cl = 0, ty = 0;
    for (int i = 0; i < n; ++ i)
        if ((s[i] == 'B' && !ty) || (s[i] == 'W' && ty))
        {
            Opbrak[i] = true;
            ++ op;
            ty = !ty;
            if (op > n / 2) NoSol();
        }
        else
        {
            if (op == 0)
                NoSol();
            -- op;
            ty = !ty;
        }
    if (op != 0)
        NoSol();
    int ans = 1;
    ++ cl;
    for (int i = n - 2; i >= 0; -- i)
        if (Opbrak[i])
        {
            ans = (1LL * ans * cl) % mod;
            -- cl;
        }
        else
            cl ++;

    for (int i = 2; i <= n / 2; ++ i)
        ans = (1LL * ans * i) % mod;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.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 i=0;i<a;i++){
        cout << b;
      }
   }
  cout << endl;
}

Measured memory_bytes: 256
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

int n, k;
vector<int> a;

bool check(int x) {
    vector<int> b(n), used(n, 0);
    for (int i = 0; i < n; i++) {
        b[i] = a[i] % x;
    }
    sort(all(b));
    int ind = n - 1, cnt = 0;
    for (int i = 0; i < n; i++) {
        if (used[i]) break;
        while (i < ind && b[i] >= x - b[ind]) {
            used[ind] = 1;
            cnt += x - b[ind];
            b[i] -= x - b[ind];
            b[ind] = x;
            ind--;
        }
        cnt += b[i];
        b[ind] += b[i];
        b[i] = 0;
        used[i] = 1;
    }
    for (int i = 0; i < n; i++) if (b[i] % x) return 0;
    if (cnt > k) return 0;
    return 1;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    cin >> n >> k;
    a.resize(n);
    int s = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s += a[i];
    }
//    dbg(check(7))
    int ans = 1;
    for (int i = 1; i * i <= s; i++) {
        if (s % i == 0) {
            if (check(i)) ans = max(ans, i);
            if (check(s / i)) ans = max(ans, s / i);
        }
    }
    cout << ans;
}
/*

*/


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  char s[3];
  scanf("%s",s);

  int count = 0 , ans = 0;
  for(int i = 0;i < 3;i ++){
    if(s[i] == 'R'){
      count ++;
      if(ans < count){
        ans = count;
      }
    }

    else{
      count = 0;
    }
  }

  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 1732
<?php
  $stdin = fopen('php://stdin', "r");

  fscanf($stdin, "%d", $n);
  $i = 1;
  while($i <= $n) {
    $_i = $i;
    if ($_i % 3 == 0) {
      echo " $i";
    } else {
      while ($_i != 0) {
        if ($_i % 10 == 3) {
          echo " $i";
          break;
        }
        $_i /= 10;
      }
    }
    $i++;
  }
  echo PHP_EOL;



Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 100000000;
const int MOD = 1000000007;
int main(){
  int n;
  std::cin >> n;
  vector<int>c(n-1),s(n-1),f(n-1);
  rep(i,n-1)std::cin >> c[i]>>s[i]>>f[i];
  rep(i,n){
    int t=0;
    for (int j = i; j < n-1; j++) {
      /* code */
      t=max(s[j],f[j]*(int)ceil(double(t)/f[j]))+c[j];
    }
    std::cout <<t << std::endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
  LL n,p,a[55]={},b[55][3]={};
  cin>>n>>p;
  FOR(i,0,n){
    cin>>a[i+1];

  }
  b[0][0]=1LL;
  FORQ(i,1,n){
    FOR(j,0,2){
      b[i][(j+a[i])&1]+=b[i-1][j];
      b[i][j]+=b[i-1][j];

    }
  }
  cout<<b[n][p];


    return 0;
}


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

#define mp make_pair

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

//pii ExtendedGCD(int a,int b)
//{
//	if(b==0) return mp(1,0);
//	int x,y; tie(x,y)=ExtendedGCD(b,a%b);
//	return mp(y,x-a/b*y);
//}

pii ExtendedGCD(int a,int b)
{
	int x=1,y=0,u=0,v=1;
	while(b){
		ll t=a/b;
		swap(a-=b*t,b);
		swap(x-=u*t,u);
		swap(y-=v*t,v);
	}
	return mp(x,y);
}

int main()
{
	for(int a,b;cin>>a>>b && a|b;){
		int x,y; tie(x,y)=ExtendedGCD(a,b);
		cout<<x<<' '<<y<<endl;;
	}
}

Measured memory_bytes: 1164