akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>

using namespace std;

int getint()
{
    char ch=getchar();
    int f=1,x=0;
    while(!isdigit(ch)){if(ch=='-') f=-1; ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-'0'; ch=getchar();}
    return f*x;
}

const int N=100100;

int n;
struct edge
{
    int v;
    edge *next;
}pool[N*2],*head[N],*tp=pool;
int dep[N],fa[N];
bool vis[N];
int ord[N];

void addedge(int u,int v)
{
    *tp=(edge){v,head[u]},head[u]=tp++;
    *tp=(edge){u,head[v]},head[v]=tp++;
}

void init()
{
    n=getint();
    for(int i=1; i<n; i++){
        int u=getint(),v=getint();
        addedge(u,v);
    }
}

bool cmp(int a,int b)
{
    return dep[a]>dep[b];
}

void dfs(int x)
{
    for(edge *i=head[x]; i; i=i->next){
        if(dep[i->v]) continue;
        dep[i->v]=dep[x]+1;
        fa[i->v]=x;
        dfs(i->v);
    }
}

int main()
{
    init();
    dfs(1);
    for(int i=1; i<=n; i++){
        ord[i]=i;
    }
    sort(ord+1,ord+1+n,cmp);
    bool flag=true;
    vis[0]=1;
    for(int i=1; i<=n; i++){
        if(vis[ord[i]]) continue;
        vis[ord[i]]=1;
        if(vis[fa[ord[i]]]){
            flag=false;
            break;
        }
        vis[fa[ord[i]]]=1;
    }
    puts(flag?"Second":"First");
    return 0;
}


Measured memory_bytes: 5376
#include <stdio.h>

typedef struct {
  int data[100100];
  int size;
} Stack;

void init(Stack* st) {
  st->size = 0;
}
int top(Stack* st) {
  return st->data[st->size - 1];
}
void pop(Stack* st) {
  st->size--;
}
void push(Stack* st, int v) {
  st->data[st->size] = v;
  st->size++;
}

int is_operator(char* s) {
  return *s == '+' || *s == '-' || *s == '*';
}
int eval_operator(char op, int a, int b) {
  if (op == '+') return (a + b);
  if (op == '-') return (a - b);
  if (op == '*') return (a * b);
  return printf("sine\n");
}

int main(void)
{
  Stack calc_;
  Stack* calc = &calc_;
  char token[16];
  
  init(calc);
  while (scanf("%s", token) == 1) {
    if (is_operator(token)) {
      int lhs, rhs;
      rhs = top(calc);
      pop(calc);
      lhs = top(calc);
      pop(calc);
      push(calc, eval_operator(token[0], lhs, rhs));
    } else {
      push(calc, atoi(token));
    }
  }
  printf("%d\n", top(calc));
  return 0;
}

Measured memory_bytes: 556
n,m = map(int,input().split())
ans = 0
Lamp_switch = []
for _ in range(m):
    S = list(map(int, input().split()))[1:]
    Lamp_switch.append(S)
Pon = list(map(int, input().split()))

for i in range(2**n):
  cnt = [0]*m
  for j in range(n):
    if (i>>j)&1:
      for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
  if cnt == Pon:
    ans += 1
    
print(ans)

Measured memory_bytes: 9112
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int num = 100000;
		int syuu = 0;
		double goukei = 0;
		double risi = 0;

		Scanner scan = new Scanner(System.in);
		syuu = scan.nextInt();
		for (int i = 0 ; i < syuu ; i++){
			risi = num * 0.05;
			num = num + (int)risi;
			risi = 0;
			BigDecimal bd = new BigDecimal(num);
			bd = bd.setScale(-3, BigDecimal.ROUND_UP);

			num = (int)bd.doubleValue();
		}
		//BigDecimal bd = new BigDecimal(num);
		//bd = bd.setScale(-3, BigDecimal.ROUND_UP);

		//num = (int)bd.doubleValue();
		System.out.println(num);
		
	}

}

Measured memory_bytes: 26152
h, w = map(int, input().split())
field = [["" for _ in range(w)] for _ in range(h)]
for i in range(h):
    s = input()
    for j in range(w):
        field[i][j] = s[j]

dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, 1, 1, 1, 0, -1, -1, -1]

def numbering(x, y):
    if field[y][x] == ".":
        c = 0
        for i in range(8):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx and nx < w and 0 <= ny and ny < h:
                if field[ny][nx] == "#":
                    c += 1
        field[y][x] = str(c)

for X in range(w):
    for Y in range(h):
        numbering(X, Y)

for Y in range(h):
    for X in range(w):
        print(field[Y][X], end = "")
    print()


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

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int memo[100000]; for(int i=0;i<m;i++) memo[i]=0;
    int ac=0,wa=0;
    for(int i=0;i<m;i++)
    {
        int p;
        char s[3];
        scanf("%d%s",&p,s);
        if(memo[p]!=-1)
        if(strcmp(s,"WA")==0)
        {
            memo[p]++;
        }
        else
        {
            wa+=memo[p];
            memo[p]=-1;
            ac++;
        }
    }
    printf("%d %d\n",ac,wa);
}

Measured memory_bytes: 2076
#include "bits/stdc++.h"
#define lint long long

using namespace std;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	reverse(c.begin(), c.end());
	char before = 'a';
	while (true) {
		switch (before) {
		case 'a':
			if (a.empty()) {
				cout << 'A' << endl;
				return 0;
			} else {
				before = a.back();
				a.pop_back();
			}
			break;
		case 'b':
			if (b.empty()) {
				cout << 'B' << endl;
				return 0;
			} else {
				before = b.back();
				b.pop_back();
			}
			break;
		case 'c':
			if (c.empty()) {
				cout << 'C' << endl;
				return 0;
			} else {
				before = c.back();
				c.pop_back();
			}
			break;
		}
		
	}
}

Measured memory_bytes: 256
s = str(input())
ans = ''
if len(s) < 26:
  for i in range(ord('a'), ord('z')+1):
    if chr(i) not in s:
      ans = s + chr(i)
      break
else:
  for i in range(24, -1, -1):
    if ord(s[i]) < ord(s[i+1]):
      ans = s[:i]
      for j in range(ord(s[i])+1, ord('z')+1):
        if chr(j) not in ans:
          ans += chr(j)
          break
      break
if ans: print(ans)
else: print(-1)

Measured memory_bytes: 3064
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
//#define MULTI_TEST
//#define GOOGLE
#ifdef LOCAL
#include "debugger.h"
#else
#define db(...)
#endif
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define fi first
#define se second
#define ln '\n'
const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

ll f(ll x)
{
	if (x <= 0)
		return 0;
	ll rem = x % 4;
	if (rem == 0)
		return x;
	else if (rem == 1)
		return 1;
	else if (rem == 2)
		return (x + 1);
	else
		return 0;
}
void solve(int tc)
{
	ll a, b;
	cin >> a >> b;
	ll ans = f(a - 1) ^ f(b);
	cout << ans << ln;
	return;
}

int main()
{
#ifndef LOCAL
	FASTIO;
#endif
	int t = 1;
#ifdef LOCAL
	clock_t start, stop;
	start = clock();
#endif
#ifdef MULTI_TEST
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
	{
#ifdef GOOGLE
		cout << "Case #" << tc << ": ";
#endif
		solve(tc);
	}
#ifdef LOCAL
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 256
a = int(input())
x=list(map(int,input().split()))
import itertools
x.sort()
c=list(itertools.accumulate(x))
s = 0
c=c[::-1]
x = x[::-1]
#print(c)
#print(x)
for i,(t,l) in enumerate(zip(c[1:],x[:-1])):
    #print(t,l)
    if t*2 >= l  :s+=1
    else:break
print(s+1)

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

int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int i=0;
  while(B<=A){
    B*=2;
    i++;
  }
  while(C<=B){
    C*=2;
    i++;
  }
  if(i<=K) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3644
s = "0"+input()
ans = 0
n = len(s)
f = 0
p = 0
for i in range(1,n+1):
    n = int(s[-i])
    # n += f
    if p+(n>4) > 5:
        f = 1
    else:
        # ans += f
        f = 0
    n += f
    ans += min(n,10-n)
    p = n
# ans += f
print(ans)

Measured memory_bytes: 5492
#include "bits/stdc++.h"

using namespace std;

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

    sort(X.begin(), X.end());
    int A = X[2] - X[0];
    int B = X[2] - X[1];

    int ans = A / 2 + B / 2;
    A = A % 2;
    B = B % 2;

    if (A + B == 0)
        cout << ans << endl;
    else if (A + B == 2)
        cout << ans + 1 << endl;
    else
        cout << ans + 2 << endl;
}

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

using i64 = int64_t;

constexpr i64 MAX_N = 60000;

i64 prime[MAX_N]; // i番目の素数
bool is_prime[MAX_N + 1];   // is_prime[i]がtrueならばiは素数

// n以下の素数の数を返す
i64 sieve(i64 n) {
    i64 p = 0;
    for (i64 i = 0; i <= n; i++)
        is_prime[i] = true;
    is_prime[0] = false;
    is_prime[1] = false;
    for (i64 i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (i64 j = 2 * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return p;
}

int main(){
    int n;
    cin >> n;
    int cnt = sieve(55555);
    vector<i64> ans;
    for(int i=0;i<cnt;++i){
        if(prime[i]%10 == 3)ans.push_back(prime[i]);
        if(ans.size() == n)break;
    }
    for(int i=0;i<ans.size();++i){
        if(i)cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll s;
    cin>>s;
    set<ll> v;
    v.insert(s);
    s=(s%2?s*3+1:s/2);
    int i=2;
    while(v.find(s)==v.end()){
        v.insert(s);
        s=(s%2?s*3+1:s/2);
        i++;
    }
    cout <<i<<"\n";
}

Measured memory_bytes: 256
from collections import deque
#
# N = 5
# ARR = [
#     [1, 2, 1],
#     [1, 3, 1],
#     [2, 4, 1],
#     [3, 5, 1]
# ]
#
# Q, K = 3, 1
#
# BRR = [
#     [2, 4],
#     [2, 3],
#     [4, 5],
# ]
#
#
# N = 7
# ARR = [
#     [1, 2, 1],
#     [1, 3, 3],
#     [1, 4, 5],
#     [1, 5, 7],
#     [1, 6, 9],
#     [1, 7, 11],
# ]
#
# Q, K = 3, 2
#
# BRR = [
#     [1, 3],
#     [4, 5],
#     [6, 7],
# ]
#
#
# N = 10
# ARR = [
#     [1, 2, 1000000000],
#     [2, 3, 1000000000],
#     [3, 4, 1000000000],
#     [4, 5, 1000000000],
#     [5, 6, 1000000000],
#     [6, 7, 1000000000],
#     [7, 8, 1000000000],
#     [8, 9, 1000000000],
#     [9, 10, 1000000000]
# ]
#
# Q, K = 1, 1
#
# BRR = [
#     [9, 10]
# ]


N = int(input())

ARR = [list(map(int,input().split())) for i in range(N-1)]

Q, K = map(int,input().split())

BRR = [list(map(int,input().split())) for i in range(Q)]


def prepare(n, arr):
    links = {}
    nodeStatus = {}
    distances = {}
    finalDistance = {}
    for i in range(1, N + 1):
        nodeStatus.__setitem__(i, False)
        finalDistance.__setitem__(i, 0)

    for i in range(len(arr)):
        tmp = arr[i]
        startNode = tmp[0]
        endNode = tmp[1]
        distance = tmp[2]
        distances.__setitem__((startNode, endNode), distance)
        distances.__setitem__((endNode, startNode), distance)
        if links.get(startNode) == None:
            links.__setitem__(startNode, [endNode])
        else:
            tmpChild = links.get(startNode)
            tmpChild.append(endNode)
            links.__setitem__(startNode, tmpChild)

        if links.get(endNode) == None:
            links.__setitem__(endNode, [startNode])
        else:
            tmpChild = links.get(endNode)
            tmpChild.append(startNode)
            links.setdefault(endNode, tmpChild)
    return links, nodeStatus, distances, finalDistance


def bfs(startNode):
    q = deque()

    q.append((startNode, 0))

    while len(q):
        currentNode, dist = q.popleft()
        finalDistance.__setitem__(currentNode, dist)
        nodeStatus.__setitem__(currentNode, True)

        childNodes = links.get(currentNode)

        for childNode in childNodes:
            if nodeStatus.get(childNode) == False:
                q.append((childNode, dist + distances.get((currentNode, childNode))))


links, nodeStatus, distances, finalDistance = prepare(N, ARR)

# print(links)
# print(nodeStatus)
# print(distances)
# print(finalDistance)


bfs(K)
for i in range(Q):
    dist1 = finalDistance[BRR[i][0]]
    dist2 = finalDistance[BRR[i][1]]
    print(dist1 + dist2)

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

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

#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 FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int N;
int par[100010];
VI  chd[100010];

int dfs(int u, int p){
  VI ds;
  for(auto&& v: chd[u]){
	if(v == p) continue;
	ds.PB(dfs(v,u));
  }
  if(ds.empty()) return 0;
  SORT(ds);

  int mx = 0, n = SZ(ds);
  REP(i,n){
	maxi(mx, ds[i]+n-i);
  }

  return mx;
}

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

  cin >> N;
  par[0] = -1;
  REP(i,N-1){
	cin >> par[i+1];
	--par[i+1];
	chd[par[i+1]].PB(i+1);
  }

  cout << dfs(0, -1) << endl;

  return 0;
}


Measured memory_bytes: 15488
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

char S[5],T[5];

int main()
{
  scanf("%s %s",S,T);
  
  int n,i;
  n=0;
  for(i=0;i<3;i++)
  {
    if(S[i]==T[i])
    {
      n++;
    }
  }
  
  printf("%d",n);
  
}

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

using namespace std;

int main() {
    unsigned int r;
    cin >> r;

    if (r < 1200) {
        cout << "ABC" << endl;
    } else if (r < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int findSumOfDigit(int n){
    int total = 0;
    while(n > 0){
        total += n % 10;
        n /= 10;
    }
    return total;
}

int main(){
    int N,A,B;
    cin >> N >> A >> B;
    int total = 0;
    for(int i = 0;i <= N;++i){
        int num = findSumOfDigit(i);
        if(num >= A && num <= B){
            total += i;
        }
    }
    cout << total;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N;
    string S;
    cin >> N >> S;

    int count = 1;
    FOR(i, 1, N) {
        if (S[i - 1] != S[i]) count++;
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 512
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	int N, A; cin >> N >> A;
	cout << N * N - A << endl;
}

Measured memory_bytes: 768
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.math.BigInteger;
 
public class Main implements Runnable {
	
	//static int mod = 1000000007;

    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 1024 * 1024 * 1024).start();
    }
    
    public void run() {
        FastScanner sc = new FastScanner();

        int X = sc.nextInt();
        int A = sc.nextInt();
        
        if(X<A){
            System.out.println(0);
        }
        else{
            
            System.out.println(10);
        }
    }

}


class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public int[] nextIntArray(int n){
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public Integer[] nextIntegerArray(int n){
		Integer[] a = new Integer[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 22996
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    for(int i = 0 ; i < n ; ++i){
      a[i] = sc.nextInt();
    }
    
    Arrays.sort(a);
    
    int ans = 0;

    for(int i = 0 ; i < n ; ++i){
      int count = 1;
      for(int j = i+1 ; j < n ; ++j){
        if(a[i]==a[j]){
          count++;
        }else{
          
          break;
        }
      }
      i+=count-1;
      if(count%2==1){
        ans++;
      }
    }
    System.out.println(ans);    
  }
}

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

vector<int> G;
long long cnt = 0;

void insertionSort(int A[], int n, int g)
{
	int i, j, v;
	for (i = g; i < n; i++)
	{
		v = A[i];
		j = i - g;
		while (j >= 0 && A[j] > v)
		{
			A[j+g] = A[j];
			j -= g;
			cnt++;
		}
		A[j+g] = v;
	}
}

void shellSort(int A[], int n)
{
	for (int g = 1; g <= n; g = g*3+1)
		G.push_back(g);
	for (int i = G.size() - 1; i >= 0; i--)
		insertionSort(A, n, G[i]);
}

int main()
{
	int n;
	scanf("%d", &n);
	int A[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &A[i]);
	
	shellSort(A, n);
	printf("%d\n", G.size());
	for (int i = G.size() - 1; i >= 0; i--)
	{
		printf("%d", G[i]);
		if (i > 0)
			printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++)
		printf("%d\n", A[i]);

	return 0;
}




Measured memory_bytes: 7096
#include <iostream>

using namespace std;

int main(void){
    int a=0;
    int b=0;
    int c=0;

    cin >> a >> b >> c;

    if((a+b)==c||(b+c)==a||(c+a)==b)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
xy = []

for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])


s = 0
for i in range(N):

    for j in range(i):

        s += ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2 ) ** 0.5

print (s / (N * (N-1) * 0.5) * (N-1))


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

int main(){
    while(1){
    int n;
    cin >> n;
    if(n==0) break;
    vector<int> vec(n,0);
    for(int i=0;i<n;i++){
        cin >> vec.at(i);
    }
    int ave=0;
    for(int i=0;i<n;i++){
        ave +=vec.at(i);
    }
    ave=ave/n;
    int count=0;
    for(int i=0;i<n;i++){
        if(vec.at(i)<=ave) count++;
    }
    cout << count << endl;
    }
}














Measured memory_bytes: 3132
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <iterator>
#include <functional>

using namespace std;

typedef unsigned                    ui;
typedef int                         si;
typedef long                        sl;
typedef long long                   ll;
typedef unsigned long long          ull;

#ifdef LOCALHOST
std::ifstream in("input.txt", std::ifstream::in);
#endif // LOCALHOST

#ifdef LOCALHOST
#define is in
#else
#define is cin
#endif // LOCALHOST

int main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

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

    if (a + b + c >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		HashMap<Integer,Integer> num = new HashMap<>();
		int n = saori.saori_hayami();
		int m = saori.saori_hayami();
		int k = 0;
		int num2 = 0;

		for(int i = 0;i < n;i++){
			k = saori.saori_hayami();
			for(int j = 0;j < k;j++){
				m = saori.saori_hayami();
				if(num.containsKey(m)){
					num2 = num.get(m);
					num2++;
					num.put(m, num2);
				} else {
					num.put(m, 1);
				}
			}
		}
		int ans = 0;
		for (int val : num.values()) {
			if(val == n){
				ans++;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

const int MX = 207;

int x[MX], y[MX];

vector<int> g[MX];
int mt[MX];
bool was[MX];

bool kuhn(int v) {
    if (was[v]) {
        return false;
    }
    was[v] = true;
    for (int to : g[v]) {
        if (mt[to] == -1 || kuhn(mt[to])) {
            mt[to] = v;
            return true;
        }
    }
    return false;
}
int main() {
#ifdef BZ
    freopen("in", "r", stdin);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n + n; i++) {
        mt[i] = -1;
        cin >> x[i] >> y[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = n; j < n + n; j++) {
            if (x[i] < x[j] && y[i] < y[j]) {
                g[i].push_back(j);
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        memset(was, 0, sizeof(was));
        ans += kuhn(i);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;

signed main(){
    string s; cin>>s;
    vector<vector<int>> al(26,vector<int>(0));
    rep(i,s.size()){
        if(al.at(s.at(i)-'a').size()){
            if(i-al.at(s.at(i)-'a').back()<=2){
                cout<<al.at(s.at(i)-'a').back()+1<<' '<<i+1<<endl;
                return 0;
            }
        }
        al.at(s.at(i)-'a').push_back(i);
    }
    cout<<-1<<' '<<-1<<endl;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;
vector<ll> C(26);
vector<vector<ll>> S;

ll change_evaluation(vector<ll>& T,ll day) {
  day -= 1;
  vector<ll> last(26, -1);
  vector<ll> next(26, T.size());
  ll old = T.at(day) - 1;
  for (ll i = 0; i < day; ++i) {
    last.at(T.at(i) - 1) = i;
  }
  for (ll i = T.size() - 1; i > day; --i) {
    next.at(T.at(i) - 1) =  i;
  }
  ll max_t = 0, max_score = -INF;
  for (ll t = 0; t < 26; ++t) {
    ll score = S.at(day).at(t) - S.at(day).at(old);
    score += (next.at(t) - day) * (day - last.at(t)) * C.at(t);
    score -= (next.at(old) - day) * (day - last.at(old)) * C.at(old);
    if (score > max_score) {
      max_score = score;
      max_t = t;
    }
  }
  return max_t;
}

ll evaluation(ll t, ll day, vector<ll>& last) {
  ll score = 0;
  score += S.at(day).at(t);
  for (ll j = 0; j < 26; ++j) {
    if (j == t) {
      continue;
    }
    score -= (day + 1 - last.at(j)) * C.at(j);
  }
  return score;
}

ll whole_evaluation(vector<ll>& T) {
  ll D = T.size();
  vector<ll> last(26, 0);
  ll score = 0;
  for (ll i = 0; i < D; ++i) {
    ll contest = T.at(i) - 1;
    last.at(contest) = i + 1;
    score += S.at(i).at(contest);
    for (ll j = 0; j < 26; ++j) {
      score -= (i + 1 - last.at(j)) * C.at(j);
    }
  }
  return score;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  //-----------input-------------
  ll D;
  cin >> D;
  vector<ll> T(D);
  S = vector<vector<ll>>(D, vector<ll>(26));
  for (ll i = 0; i < 26; ++i) {
    cin >> C.at(i);
  }
  for (ll i = 0; i < D; ++i) {
    for (ll j = 0; j < 26; ++j) {
      cin >> S.at(i).at(j);
    }
  }
  //--------------------------------------
  vector<ll> last(26, 0);
  for (ll day = 0; day < D; ++day) {
    ll max_contest = 0;
    ll max_score = -INF;
    for (ll contest = 0; contest < 26; ++contest) {
      ll temp_score = evaluation(contest, day, last);
      if (temp_score > max_score) {
        max_score = temp_score;
        max_contest = contest + 1;
      }
    }
    last.at(max_contest - 1) = day;
    T.at(day) = max_contest;
  }

  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<> rand(1, T.size());
  uniform_int_distribution<> rand_evn(1, 26);
  double persent = 1.0003;
  double persent_now = 1;
  for (ll i = 0; i < 100000; ++i) {
    ll random = rand(mt);
    if (random / 3.65 < 20 / persent_now) {
      ll event = rand_evn(mt);
      T.at(random - 1) = event;
    }
    else {
      ll max_t = change_evaluation(T, random);
      // cout << max_t << " rand" << "\n";
      T.at(random - 1) = max_t + 1;
    }
    persent_now *= persent;
  }

  // ll score = whole_evaluation(T);
  // cout << score << "\n";

  for (ll i = 0; i < D; ++i) {
    cout << T.at(i) << "\n";
  }

  // vector<ll> ans = evaluation(C, S, T);
  // for (ll i = 0; i < ans.size(); ++i) {
  //   cout << ans.at(i) << "\n";
  // }
}


Measured memory_bytes: 3748
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
	vector<int> p(3);
  	rep(i,3) cin >> p[i];
	sort(p.begin(), p.end());
  	cout << p[0]+p[1] << endl;
  	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

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

const int N = 1e5 + 10;
const int inf = INT_MAX;

#define ll long long
#define FOR(i,a,b) for(int i = a;i <= b;i++)
#define _FOR(i,a,b) for(int i = a;i >= b;i--)

template<typename T> void read(T &x)
{
  x = 0;int f = 1;
  char c = getchar();
  for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
  for(;isdigit(c);c = getchar()) x = x * 10 + c - '0';
  x *= f;
}

int a;
char s[20];
int main()
{
  //freopen(".in","r",stdin);
  //freopen(".out","w",stdout);
  scanf("%d%*c%s",&a,s);
  if(a < 3200 ) puts("red");
  else printf("%s\n",s);
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#define ll long long
using namespace std;

int main(){
//cout<<123<<endl;
  bool flag=false;
  string s;
  cin>>s;
  string copy;
string origin = s;
  s+="##";
  copy=s;
  for(int i=0;i<=origin.size()+1;i++){
    for(int j=i;j<=origin.size()+1;j++){
      s=copy;
      s.erase(s.begin()+i,s.begin()+j+1);
      if(s == "keyence" or s=="keyence#" or s=="keyence##"){ flag=true;break;}
    }
    if(flag) break;
  }
  
  string ans = flag or copy=="keyence"? "YES":"NO";
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<ll>())
#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define MOD 1000000007
#define vfind(v, target) find(v.begin(), v.end(), target)
#define notFound(v, target) (vfind(v, target) == v.end())

using namespace std;

int main()
{
  ll H, W, res = 0; cin >> H >> W;
  vector<vector<ll>> c(10, vector<ll>(10)), A(H, vector<ll>(W));
  rep(i, 0, 10) {
  	rep(j, 0, 10) {
    	cin >> c[i][j];
    }
  }
  rep(i, 0, H) {
  	rep(j, 0, W) {
    	cin >> A[i][j];
    }
  }
  rep(k, 0, 10) {
  	rep(i, 0, 10) {
  		rep(j, 0, 10) {
    		if (c[i][j] > c[i][k] + c[k][j])
              c[i][j] = c[i][k] + c[k][j];
    	}
  	}
  }
  rep(i, 0, H) {
  	rep(j, 0, W) {
    	if (A[i][j] >= 0) res += c[A[i][j]][1];
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 512
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_VAL_MAX		1010									// 最大値

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 条件 - 取得
	int liA, liB;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &liA, &liB);

	// 判定
	for (i = 1; i <= D_VAL_MAX; i++) {
		int liTax = i * 8 / 100;
		if (liTax != liA) {
			continue;
		}
		liTax = i * 10 / 100;
		if (liTax != liB) {
			continue;
		}

		return i;
	}

	return -1;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 128
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

a,b,k=L()
num=0
for i in reversed(range(1,min(a,b)+1)):
    if a%i==0 and b%i==0:
        num+=1
        if num==k:
            print(i)
            exit()

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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  vector<tuple<string, int, int>> vec(N);
  for (int i = 0; i < N; i++) {
    string S;
    int P;
    cin >> S >> P;
    vec.at(i) = make_tuple(S, 100 - P, i + 1);
  }

  sort(vec.begin(), vec.end());

  for (int i = 0; i < N; i++) {
    cout << get<2>(vec.at(i)) << "\n";
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static int A = 0;
    public static int B = 0;
    public static int C = 0;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();

        int output = C - (A - B);
        if (output < 0) output = 0;

        System.out.println(output);
    }
}


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

int main(){
  string s ,t;
  cin >>s >>t;
  int x = stoi (s+ t );
  for ( int i =1; i <=1000; i ++){
    if ( i*i == x ){
      puts (" Yes ");
      return 0;
    }
  }
  puts (" No ");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

string S;

int main() {
  cin >> S;
  S = "dreamer" + S;
  reverse(S.begin(), S.end());
  int cur = 0;
  while (cur < S.size() - 7) {
    string sub7 = S.substr(cur, 7);
    if (sub7 == "remaerd") {
      cur += 7;
      continue;
    }

    string sub6 = S.substr(cur, 6);
    if (sub6 == "resare") {
      cur += 6;
      continue;
    }

    string sub5 = S.substr(cur, 5);
    if (sub5 == "maerd" || sub5 == "esare") {
      cur += 5;
      continue;
    }

    cout << "NO";
    return 0;
  }

  cout << "YES";
}


Measured memory_bytes: 3836
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    if (A == B && A != C || A == C && A != B || B == C && A != B) {
      System.out.print("Yes");
    } else {
      System.out.print("No");
    }
  }
}

Measured memory_bytes: 22868
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0) : d(n,-1){}
    int Find (int x){//根の番号を探す
        if(d[x] < 0) return x;
        return d[x] = Find(d[x]);
    }
    bool unite (int x, int y){
        x = Find(x); y = Find(y);
        if(x == y ) return false;
        if(d[x] < d[y]){
            swap(x,y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    } 

    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    int size(int x) {
        return (-d[Find(x)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
int ke (int n){
    n--;
    if(n == 1 )return 0;
    int ans = 1;
    while (0 < n){
        ans *= n;
        n--;
    }
    return ans ;

}
int main(){
    int n,m;
    double sum = 0;
    cin >> n >> m;

    vector<int> vec(n);

    REP(i,n){
        double a;
        cin >> a;
        sum += a;
        vec[i] = (int)a;
    }
    bool fl = true;
    SORT(vec);
    REVERSE(vec);
    double o = sum/(4*m);
    REP(i,m){
        if(vec[i] < o )fl = false;
    }

    if(fl){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma comment(linker, "/STACK: 2000000")

using namespace std;

const int N = 2e6 + 5;

int n , m , k ;
int a[N];

int main() {

    cin>>n>>m>>k;
    for(int i = 0;i<k;i++)
    {
        int t;
        cin>>t;
        a[t-1]++;
    }
    for(int i = 0;i<n;i++)
    {
        cout<<(a[i]+m-k>0?"Yes":"No")<<"\n";
    }
    return 0;

}


Measured memory_bytes: 1024
N = int(input())
A = input().split()
for i in range(N):
  A[i] = int(A[i])
money = 1000
stock = 0

for i in range(N-1):
  if A[i] < A[i+1]:
    stock += money//A[i]
    money -= (money//A[i])*A[i]
  elif A[i] > A[i+1]:
    money += stock*A[i]
    stock = 0

money += stock*A[N-1]
    
print(money)

Measured memory_bytes: 9200
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		System.out.println(a * b + " " + (a * 2 + b * 2));
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 25988
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>void p(T x){cout << x << endl;}
template<class T>void pvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int h[2], m[2], k;
    cin >> h[0] >> m[0] >> h[1] >> m[1] >> k;

    int a, b;
    a = h[0] * 60 + m[0];
    b = h[1] * 60 + m[1];
    int tmp = b-a-k;
    p(tmp);
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
typedef long long LL;

using namespace std;
int main(){
	int N,T,t;
	while(cin>>N>>T){
		LL ans = T,x=0;
		for(int i=1; i<=N; ++i){
			cin>>t;
			if(t-x<T)
				ans+=t-x;
			else ans+=T;
			x = t;
		}	
		cout<<ans<<endl;
	}

	return 0;
}

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

#define rep(i,a,b) for (int i = a;i < b;i++)

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	int ans;
	ans = A * B - (A * 1 + B * 1 - 1);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll a, b, c, i, j, k, l, m, n, ans, tmp, hoge;

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

    cin >> n;
    a = ceil(n / 1.08);
    if (n == floor(a * 1.08))
        cout << a << endl;
    else
        cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int i, j, k, n, min, temp, r[101], m[100][100];

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%d %d", &r[i], &r[i+1]);
    m[i][i] = 0;
  }

  for(i = 1; i < n; i++) {
    for(j = 0; j < n - i; j++) {
      for(k = j; k < j + i; k++) {
        temp = m[j][k] + m[k+1][j+i] + r[j]*r[k+1]*r[j+i+1];
        if(k == j || min > temp)
          min = temp;
      }
      m[j][j+i] = min;
    }
  }

  printf("%d\n", m[0][n-1]);

  return 0;
}

Measured memory_bytes: 1888
#include <stdio.h>

int main(void)
{
    int n,m,ans;
    int ansn,ansm;
    scanf("%d %d",&n,&m);
    if(n==1){
        ansn=0;
    }else{
        ansn=n*(n-1)/2;
    }
    if(m==1){
        ansm=0;
    }else{
        ansm=m*(m-1)/2;
    }
    ans=ansn+ansm;

    printf("%d",ans);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//debug
#ifdef grief
#define debug(...) do{\
	fprintf(stderr , "%s - %d : (%s) = " , __PRETTY_FUNCTION__ , __LINE__ , #__VA_ARGS__ );\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> 				void _DO(I&&x){	cerr<<x<<endl;	}
template<typename I,typename...T>	void _DO(I&&x,T&&...tail){	cerr<<x<<" , ";	_DO(tail...);	}
template<typename _a,typename _b> 	ostream& operator << (ostream &_s,const pair<_a,_b> &_p)
{	return _s<<'('<<_p.first<<','<<_p.second<<')';	}
#define IOS
#else
#define debug(...)
#define IOS do{ios_base::sync_with_stdio(0); cin.tie(0);}while(0);
#endif
//type
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef priority_queue<pll,vector<pll>,greater<pll> > heap;
//macro
#define SZ(x) ((ll)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define stp setprecision(30)<<fixed
const ll INF=0x3f3f3f3f3f3f3f3f;
const int NF=0x3f3f3f3f;
const ll MAX=2e5+5,Mlg=__lg(MAX)+2;
const ll MOD=1e9+7;
//}}}
int n,arr[MAX],ss[MAX];
int main(){
	IOS
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		ss[i]=arr[i];
	}
	sort(ss,ss+n);
	int a1=ss[n/2-1],a2=ss[n/2];
	for(int i=0;i<n;i++){
		if(arr[i]<=a1)	cout<<a2<< '\n';
		else			cout<<a1<< '\n';
	}
	return 0;
}


Measured memory_bytes: 3840
char = input()
char_list = list(char)

count = 0
max_count = 0
for i in char_list:
    if(i == "A" or i == "T" or i == "C" or i == "G"):
        count = count +  1
        max_count = max(count,max_count)
    else:
        count = 0
print(max_count)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    string s;
    cin >> s;

    cout << s.substr(0, s.size() - 8) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>
 
int main(void){
  long long int n,m;
  long long int i;
  long long int kei = 0;
  long long int a[100000];
  long long int b[100000];
  scanf("%lld %lld",&n,&m);
  for (i = 0; i<n; i++){
     scanf("%lld %lld", &a[i],&b[i]);  //ここまで配列の準備
  }
  
  int j, increment, temp, temp_b;
  increment = 4;
  int array_size = n;
  while (increment > 0){
    for (i=0; i < array_size; i++){
      j = i;
      temp = a[i];
      temp_b = b[i];
      while ((j >= increment) && (a[j-increment] > temp)){
        a[j] = a[j - increment];
        b[j] = b[j - increment];
        j = j - increment;
      }
      a[j] = temp;
      b[j] = temp_b;
    }
    if (increment/2 != 0)
      increment = increment/2;
    else if (increment == 1)
      increment = 0;
    else
      increment = 1;
  }
  for (i = 0; i<n; i++){
    if(m>=b[i]){
      kei = (a[i]*b[i]) + kei;
    }else if(m==0){
      break;
    }else{
      kei = kei + (a[i]*m);
      break;
    }
    m = m - b[i];
  }
  printf("%lld",kei);
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <functional>
#include <set>
#include <iterator>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

/* Union-find
int par[100010];
int trank[100010];

void init(int n) {
   for (int i=0;i<n;i++) {
      par[i] = i;
      trank[i] = 0;
   }
}
int find(int x) {
   if (par[x] == x) {
      return x;
   } else {
      return par[x] = find(par[x]);
   }
}
void unite(int x, int y) {
   x = find(x);
   y = find(y);
   if (x == y) return;
   if (trank[x] < trank[y]) {
      par[x] = y;
   } else {
      par[y] = x;
      if (trank[x] == trank[y]) trank[x]++;
   }
}
bool same(int x, int y) {
   return find(x) == find(y);
}
*/


char S[110];
int N;
int dp[110][30];

int main() {
   cin >> N;
   cin >> S;
   for (int i=0;i<N;i++) {
      dp[i][S[i] - 0x61] += 1;
      for (int j=0;j<30;j++) {
         dp[i+1][j] = dp[i][j];
      }
   }

   int count = 0;
   for (int i=0;i<N;i++) {
      int thiscount=0;
      for (int j=0;j<30;j++) {

         if ((dp[i][j]) > 0 && (dp[N][j] - dp[i][j]) > 0) {
            thiscount++;
         }

      }
      count = max(count, thiscount);
   }
   cout << count << endl;
}

Measured memory_bytes: 256