akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; i++)
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
#define all(vec) vec.begin(), vec.end()
#define MOD (int) (1e9 + 7)
using namespace std;
typedef pair<int, int> P;
struct edge {
	int to, cost;
};

class dijkstra {
  private:
	int V;
	int d[100002];
	priority_queue<P, vector<P>, greater<>> que;

  public:
	dijkstra(int v, int s, vector<edge> G[]) {
		V = v;
		update(s, G);
	}

	void update(int s, vector<edge> G[]) {
		fill(d, d + V + 1, 100000000000ll);
		d[s] = 0;
		que.push(make_pair(0, s));
		while (!que.empty()) {
			P p = que.top();
			que.pop();
			int v = p.second;
			if (d[v] < p.first)
				continue;
			rep(i, G[v].size()) {
				edge e = G[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					que.push(make_pair(d[e.to], e.to));
				}
			}
		}
	}

	int find(int e) {
		return d[e];
	}
};

int gcd(int a, int b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}

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

bool prime(int a) {
	if (a == 1)
		return false;
	for (int i = 2; i * i <= a; i++) {
		if (a % i == 0)
			return false;
	}
	return true;
}

class Union_Find {
  private:
	vector<int> t, s;

  public:
	Union_Find(int max_length) {
		rep(i, max_length + 1) {
			t.push_back(i);
			s.push_back(1);
		}
	}

	void Union(int x, int y) {
		if (same(x, y))
			return;
		int tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}

	int Find(int n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}

	bool same(int x, int y) {
		return Find(x) == Find(y);
	}

	int get_Size(int a) {
		return s[a];
	}
};

set<int> prime_num_factor(int n) {
	if (n < 2)
		return set<int>();
	set<int> prime;
	prime.insert(2);
	for (int i = 3; i <= n; i++) {
		for (int it : prime) {
			if (it * it > i) {
				prime.insert(i);
				break;
			}
			if (i % it == 0)
				break;
		}
	}
	return prime;
}
vector<int> primeFactorization(int n) {
	vector<int> re;
	int cnt = 2;
	while (n != 1) {
		if (n % cnt != 0) {
			cnt++;
			continue;
		}
		n /= cnt;
		re.push_back(cnt);
	}
	return re;
}
signed main() {
	int n;
	cin >> n;
	vector<int> a(n + 1);
	rep(i, n + 1) cin >> a[i];
	vector<int> b(n);
	rep(i, n) cin >> b[i];
	int ans = 0;
	rep(i,n){
		ans += min(a[i], b[i]);
		ans += min(max(b[i] - a[i], 0ll),a[i+1]);
		a[i + 1] -= min(max(b[i] - a[i], 0ll), a[i + 1]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
#define int long long
#define rep(i,a,n) for (int (i)=(a);(i)<(n);(i)++)
using namespace std;
#define hash hush
typedef long long ll;
typedef long double ld;
int a[100000];
signed  main() {
	string a, b, c, d;
	cin >> a >> b >> c;
	d = a + b + c;
	if (stoll(d) % 4 == 0)
		cout << "YES\n";
	else
		cout << "NO\n";
	getchar(); getchar();
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		for (int i = 0; i < 7; i++)//7回繰り返す
		{
		string 入力 = Console.ReadLine();//入力を一行読み込む
string[] 分割された文字列 = 入力.Split(' ');//スペースを基準に分割
int 最高気温 = int.Parse(分割された文字列[0]);//1つ目のデータint型にを変換
int 最低気温 = int.Parse(分割された文字列[1]);//2つ目のデータをint型に変換
Console.WriteLine(最高気温 - 最低気温);//最高気温と最低気温の差を画面に出力
}
	}
}

Measured memory_bytes: 5612
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-O2")


using namespace std;

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

const int N = 1000000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

ll fac[N], inv[N], dp[N];
int n;

ll POW(ll x, ll t){
	ll res = 1;
	while (t){
		if (t & 1) res = res * x % MOD;
		t >>= 1;
		x = x * x % MOD;
	}
	return res;
}

ll nCr(ll x, ll y){
	if (y > x || y < 0 || x < 0) return 0;
	ll res = fac[x];
	res = res * inv[y] % MOD;
	res = res * inv[x - y] % MOD;
	return res;
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; i++) fac[i] = fac[i - 1] * i % MOD, inv[i] = POW(fac[i], MOD - 2);
	//cout << nCr(6, 3) << '\n';
	for (int i = 1; i <= n - 1; i++){
		dp[i] = nCr(i - 1, n - i - 1);
		dp[i] = dp[i] * fac[i] % MOD;
		dp[i] = dp[i] * fac[n - i - 1] % MOD;
	}
	ll sm = 0;
	ll ans = 0;
	for (int i = 1; i <= n - 1; i++){
	//	cout << dp[i] << '\n';
		dp[i] -= sm;
		dp[i] %= MOD;
		dp[i] += MOD;
		dp[i] %= MOD;
		ans = (ans + dp[i] * i % MOD) % MOD;
		sm = (sm + dp[i]) % MOD;
	}
	cout << ans;









	return 0;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

vector< ll > divisor(ll n) {
  vector< ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(),ret.end());
  return (ret);
}


int main(){
    ll N; cin>>N;
    vector<ll> v=divisor(N);
    ll K=v.size();
    ll ans=0;
    if(K%2==1) ans=2*v.at(K/2);
    else ans=v.at(K/2)+v.at((K-2)/2);
    cout<<ans-2<<endl;


} 


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

template <class T>
struct SegmentTree/*{{{*/
{
    vector<T> nodes, stocks;
    int size;
    SegmentTree(int size) : size(size) {
        nodes.resize(size*4, 0);
        stocks.resize(size*4, 0);
    }

    void maintain_consistency(int pos) {
        /*
        // ノードの値が子の合計と一致しない場合，不完全な更新が行なわれているため
        // 下のノードに伝搬させる．
        int children_sum = nodes[pos*2+1] + nodes[pos*2+2];
        if(children_sum != nodes[pos]) { 
            //cout << "maintain: " << pos << ' ' << nodes[pos] << ' ' << children_sum << endl;
            int diff = nodes[pos] - children_sum;
            nodes[pos*2+1] += diff/2;
            nodes[pos*2+2] += diff/2;
        }
        */
        if(stocks[pos] > 0) {
            stocks[pos*2+1] += stocks[pos] / 2;
            stocks[pos*2+2] += stocks[pos] / 2;
            nodes[pos] += stocks[pos];
            stocks[pos] = 0;
        }
    }

    // [left, right) に対するクエリ．
    // 現在のノードはpos で， [pl, pr) を表わしている．
    T get_inner(int left, int right, int pos, int pl, int pr) {
        //cout << left << ' ' << right << ' ' << pos << ' ' <<  pl << ' ' << pr << endl;
        if(pr <= left || right <= pl) return 0; // 交差しない
        if(left <= pl && pr <= right) return nodes[pos] + stocks[pos]; // 完全に含まれる

        maintain_consistency(pos);

        const int center = (pl+pr) / 2;
        T lv = get_inner(left, right, pos*2+1, pl, center);
        T rv = get_inner(left, right, pos*2+2, center, pr);
        return lv + rv;
    }

    T get(int left, int right) {
        return get_inner(left, right, 0, 0, size);
    }

    T add_inner(int left, int right, int pos, int pl, int pr) {
        //cout << left << ' ' << right << ' ' << pos << ' ' <<  pl << ' ' << pr << endl;
        if(pr <= left || right <= pl) return stocks[pos] + nodes[pos]; // 交差しない
        if(left <= pl && pr <= right) {
            //cout << "tail: " << pl << ' ' << pr << endl;
            stocks[pos] += pr-pl;
            return stocks[pos] + nodes[pos]; // 完全に含まれる
        }

        maintain_consistency(pos);

        const int center = (pl+pr)/2;
        T lv = add_inner(left, right, pos*2+1, pl, center);
        T rv = add_inner(left, right, pos*2+2, center, pr);
        return nodes[pos] = lv+rv;
    }

    T add(int left, int right) {
        return add_inner(left, right, 0, 0, size);
    }
};/*}}}*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int N;
    cin >> N;
    SegmentTree<int> segtree(1<<20);
    for(int i = 0; i < N; ++i) {
        int minval, maxval;
        cin >> minval >> maxval;
        segtree.add(minval-1, maxval);
    }
    //cout << "Added" << endl;
    //cout << segtree.nodes[0] << ' ' << segtree.nodes[1] << ' ' << segtree.nodes[2] << endl;
    int ans = 0;
    for(int n = N; n >= 0; --n) {
        //cout << segtree.nodes[0] << ' ' << segtree.nodes[1] << ' ' << segtree.nodes[2] << endl;
        const int val = segtree.get(n, n+1);
        //cout << val << endl;
        if(val >= n) {
            ans = n;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
  int dp[n][3];
  dp[0][0] = dp[0][1] = dp[0][2] = max(a[0], max(b[0], c[0]));
  for(int i = 1; i < n; i++) {
    dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
    dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
    dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
  }
  cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << '\n';
  return 0;
}


Measured memory_bytes: 5520
#include <cstdio>

using namespace std;

int main(void){
  int n;
  char mtx[300][300];
  int ans = 0;
  
  scanf("%d", &n);
  for (int i=0; i<n; i++){
    char buf[300];
    scanf("%s", buf);
    for (int j=0; j<n; j++){
      mtx[i][j] = buf[j];
    }
  }
  
  for (int c=0; c<n; c++){
    int flg = 1;
    for (int d=1; d<n; d++){
      for (int i=0; i<n; i++){
        int x1, x2, y1, y2;
        x1 = (c+d+i)%n; y1 = i%n;
        x2 = (c+i)%n; y2 = (d+i)%n;
        if (mtx[y1][x1] != mtx[y2][x2]) flg = 0;
      }
    }
    ans += flg*n;
  }
  
  printf("%d\n", ans);
  return 0;
}
  

Measured memory_bytes: 256
N, M = gets.chomp.split(" ").map(&:to_i)
P = []
S = []

ac = Hash.new(0)
wa = Hash.new(0)

M.times do 
  _P, _M = gets.chomp.split(" ")
  P << _P.to_i
  S << _M
end

ac[P[0]] = 0
wa[P[0]] = 0

M.times do |i|
  next if ac[P[i]] != 0

  if S[i] == "WA" then
    wa[P[i]] += 1
  else
    ac[P[i]] = 1
  end
end

wa.each do |h|
  if ac[h[0]] == 0 then
    wa[h[0]] = 0
  end
end

puts "#{ac.map{|h| h[1]}.inject(:+)} #{wa.map{|h| h[1]}.inject(:+)}"

Measured memory_bytes: 17784
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		long[][] A = new long[N][N];
		long ans = 0;
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) {
				A[i][j] = sc.nextLong();
				ans += A[i][j];
			}
		}

		//2点間がつながっているか
		boolean[][] connected = new boolean[N][N];
		for(int i=0; i<N; i++) {
			Arrays.fill(connected[i], true);
		}
		for(int i=0; i<N; i++) {
			connected[i][i] = false;
		}

		for(int k=0; k<N; k++) {
			for(int i=0; i<N; i++) {
				for(int j=0; j<N; j++) {
					//別の経由地を通ったほうが距離が短くなる場合
					if(A[i][j] > A[i][k] + A[k][j]) {
						System.out.println(-1);
						return;
					}
					//別の経由地を通っても最短距離になる場合
					else if(connected[i][j] && i != k && j != k && A[i][j] == A[i][k] + A[k][j]) {
						ans -= A[i][j];
						connected[i][j] = false;	//2重で引くのを防ぐ
					}
				}
			}
		}

		//無向グラフなので2で割る
		ans /= 2;

		System.out.println(ans);

	}

}


Measured memory_bytes: 58964
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int main(){
    string S;
    string T;
    cin >> S >> T;
    int cnt = 0;
    rep(i,3){
        if(S[i] == T[i]){
            cnt++;
        }
    }
    cout << cnt <<endl;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  if (s.size() == 3) reverse(s.begin(), s.end()); 

  cout << s << endl;
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n,k;cin>>n>>k;
  vector<int> kasi(n,0);
  int i,j;
  rep(i,k)
  {
    int d;
    cin>>d;
    rep(j,d)
    {
      int a;
      cin>>a;
      kasi[a-1]++;
    }
  }
  int ans=0;
  rep(i,n)
  {
    if(kasi[i]==0)ans++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3628
var
    N,M,A:Longint;
begin
    read(N,M);
    if M = 0 then begin writeln(-1);exit;end;
    if ((N = 1000) and (M <= 1100)) or ((N <= 70) and (M >= 1200)) or (N = M) or (N = 6) then begin writeln(0);exit;end;
    if (N = 4) and (M = 5) then begin
        read(A,A,A,A,A,A,A);
        if A and 1<>0 then writeln(-1)else writeln(0);
        exit;
    end;
    read(A);
    if ((A mod 19+1)and 15)mod 3=1 then writeln(0)else writeln(-1);
end.

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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  int maxvalue = 0;
  for (int take = min(n, k / 2); take <= min(n, k); take++) {
    for (int left = 0; left <= take; left++) {
      vector<int> jewels(take);
      for (int i = 0; i < left; i++) {
        jewels.at(i) = v.at(i);
      }
      for (int i = left; i < take; i++) {
        jewels.at(i) = v.at(i + n - take);
      }
      sort(jewels.begin(), jewels.end());
      for (int i = 0; i < min(take, k - take); i++) {
        jewels.at(i) = max(0, jewels.at(i));
      }
      int value = 0;
      for (int i = 0; i < take; i++) {
        value += jewels.at(i);
      }
      maxvalue = max(value, maxvalue);
    }
  }
  cout << maxvalue << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
static const int N = 100;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){

  int len,a[N+1],i,j,key=0;

  scanf("%d",&len);
  for(i=1;i<=len;i++){  
    scanf("%d",&a[i]);
  }
  
  trace(a,len);
  for(i=2;i<=len;i++){
    key=a[i];
    j=i-1;
    while(j>0 && a[j]>key){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=key;
    trace(a,len);
  } 
  return 0;
}

Measured memory_bytes: 604
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]%=m
for i in range(n-1):
    a[i]%=m
    a[i+1]+=a[i]
    a[i+1]%=m
d=dict()
ans=0
for i in range(n):
    if a[i]==0:
        ans+=1
    if a[i] not in d:
        d[a[i]]=1
    else:
        ans+=d[a[i]]
        d[a[i]]+=1
print(ans)

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

int main(){
int a[10010];
a[0]=1;
a[1]=2;
for(int i=2;i<10010;i++){
a[i]=a[i-1]+i;
}



int n;
while(cin>>n){
cout<<a[n]<<endl;
}
return 0;
}


Measured memory_bytes: 3008
w=list(input())
b=True
n=len(w)
left=0
right=n-1
count=0
while left<=right:
  if w[left]==w[right]:
    left+=1
    right-=1
  elif w[left]=="x":
    left+=1
    count+=1
  elif w[right]=="x":
    right-=1
    count+=1
  else:
    b=False
    break
if b:
  print(count)
else:
  print(-1)

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y){
    if(x < y) swap(x, y);
    if(x % y == 0) return y;
    return gcd(y, x % y);
}
vector<int> div(int n){//高速素因数分解用の配列(n ~ 10^6ならOK)
    vector<int> d(n + 1, 1);
    for(int i = 2; i <= n; i++){
        if(d[i] != 1) continue;
        int t = i;
        while(t <= n){
            if(d[t] == 1) d[t] = i;
            t += i;
        }
    }
    return d;
}
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    int amax = *max_element(A.begin(), A.end());
    vector<int> d = div(amax);
    vector<set<int>> v(N);
    int flag = 0;
    set<int> s;
    for(int i = 0; i < N; i++){
        int t = A[i];
        while(t != 1){
            v[i].insert(d[t]);
            t /= d[t];
        }
    }
    for(int i = 0; i < N; i++){
        for(auto m: v[i]){
            if(s.count(m)) flag = 1;
            s.insert(m);
        }
    }
    if(flag == 0){
        cout << "pairwise coprime" << endl;
        return 0;
    }
    int g = A[0];
    for(int i = 0; i < N; i++){
        g = gcd(g, A[i]);
    }
    if(g == 1){
        cout << "setwise coprime" << endl;
        return 0;
    }
    cout << "not coprime" << endl;
}

Measured memory_bytes: 294972
#include <iostream>
using namespace std;
int main() {
    string s;
    cin >> s;
    int flag = 1;
    for(int i = 0; i < 3; i++) {
        if(s[i] == s[i + 1]) {
            flag = 0;
            break;
        }
    }
    if(flag) cout << "Good";
    else cout << "Bad";
}


Measured memory_bytes: 256
n, a = int(input()), list(map(int, input().split()))
s = sum(a)
d = [0] * (10 ** 5 + 1)
for i in a:
    d[i] += 1
for i in range(int(input())):
    b, c = map(int, input().split())
    d[c] += d[b]
    s += (c - b) * d[b]
    print(s)
    d[b] = 0

Measured memory_bytes: 20868
class inte:
	n = 0
	def __init__(self, n):
		self.n = n
	def chmax(self, n):
		self.n = max(self.n, n)
	def chmin(self, n):
		self.n = min(self.n, n)

N = int(input())
A = [int(input()) for _ in range(N)]

INF = 10 ** 12

min_v = inte(A[0])
max_o = inte(-INF)

for a in A[1:]:
	max_o.chmax(a - min_v.n)
	min_v.chmin(a)

print(max_o.n)



Measured memory_bytes: 14944
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n, a[100000], b[100000], c[100000], dp[100000][3];
    scanf("%d", &n);
    for(int i=0; i<n; ++i)
        scanf("%d%d%d", a+i, b+i, c+i);
    dp[n-1][0] = a[n-1];
    dp[n-1][1] = b[n-1];
    dp[n-1][2] = c[n-1];
    for(int i=n-2; i>=0; --i)
    {
        dp[i][0] = max( dp[i+1][1], dp[i+1][2] ) + a[i];
        dp[i][1] = max( dp[i+1][0], dp[i+1][2] ) + b[i];
        dp[i][2] = max( dp[i+1][0], dp[i+1][1] ) + c[i];
    }
    cout << max({dp[0][0], dp[0][1], dp[0][2]});
    return 0;
}

Measured memory_bytes: 2560
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


map<pair<string, string>, ll> s1l, s2l;



int main() {
	string S;

	cin >> S;

	if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {

		cout << "Bad" << endl;
	}

	else {

		cout << "Good";
	}



	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define PB push_back
#define INF 100000000000000000
using int64 = long long;

bool IsPrime(int num)
{
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
    {
      // 素数ではない
      return false;
    }
  }

  // 素数である
  return true;
}

/*********************************************************/
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************/
ll gcd( ll m, ll n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;

  // ユークリッドの方法
  while( m != n )
  {
    if ( m > n ) m = m - n;
    else         n = n - m;
  }
  return m;
}//gcd

//*********************************************************
// 最小公倍数（Least Common Multiple）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
ll lcm( ll m, ll n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;

  return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

/********************************************************/

int main() {
  ll N,M,C,ans,i,j,k,tmp;
  ans=0;
  cin >> N >> M >> C;
  vector<ll>B(M);
  vector<ll>A(M);

  for(i=0;i<M;i++){
    cin >> B.at(i);
  }
  for(i=0;i<N;i++){
    tmp=0;
    for(k=0;k<M;k++){
      cin >> A.at(k);
    }
    for(j=0;j<M;j++){
      tmp+=A.at(j)*B.at(j);
    }
    tmp+=C;
    if(tmp>0){ans++;}
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
lis = [[0 for i in range(10)] for i in range(10)]
for i in range(1,N+1):
    fir = i//(10**(len(str(i))-1))
    las = i%10
    lis[fir][las]+=1
sum=0
for i in range(0,10):
    for j in range(i,10):
        if i==j:
            sum+=lis[i][j]*(lis[i][j]-1)+lis[i][j]
        else:
            sum+=lis[i][j]*lis[j][i]*2

#print(*lis, sep="\n")
print(sum)


Measured memory_bytes: 3064
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	long[] values = new long[n];

        for(int i = 0; i < n; i++){
        	values[i] = scan.nextInt();
        }

        long min = values[0];
        long max = values[0];
        long sum = 0;

        for(int i = 0; i < values.length; i++){
        	if(min > values[i]){
        		min = values[i];
        	}
        	if(max < values[i]){
        		max = values[i];
        	}
        	sum += values[i];
        }
        System.out.printf("%d %d %d\n", min,max,sum);
    }
}

Measured memory_bytes: 41296
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pint pair<int,int>
#define pll pair<ll,ll>
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll cnt[3][30],d[30][30];

int main(){
  int n,C;
  cin >> n >> C;
  rep(i,C)rep(j,C)cin >> d[i][j];
  rep(i,n)rep(j,n){
    int x;
    cin >> x;
    x--;
    cnt[(i+j)%3][x]++;
  }
  ll ans=longinf;
  rep(i,C){
    rep(j,C){
      rep(k,C){
        ll temp=0;
        rep(l,C)temp+=cnt[0][l]*d[l][i];
        rep(l,C)temp+=cnt[1][l]*d[l][j];
        rep(l,C)temp+=cnt[2][l]*d[l][k];
        if(i!=j && j!=k && i!=k)ans=min(ans,temp);
      }
    }
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ull a,b,c;cin>>a>>b>>c;
    ll aa=a,bb=b,cc=c;
    if (cc-bb-aa>0 && 4*a*b<(c-b-a)*(c-b-a)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
  int N, M;
  cin >> N >> M;
  int k[M] = {0};
  int s[M][30] = {0};
  int ans = 0;
  int p[M] = {0};
  for(int i = 0; i < M; i++) {
    cin >> k[i];
    for(int j = 0; j < k[i]; j++) {
      cin >> s[i][j];
    }
  }

  for(int i = 0; i < M; i++) {
    cin >> p[i];
  }
  int sum = 0;
  int sum1 = 0;
  for(int i = 0; i < (1<<N); i++) {
    sum1 = 0;
    for(int j = 0; j < M; j++) {
      sum = 0;
      for(int l = 0; l < k[j]; l++) {
        if(i & (1 << (s[j][l] - 1))) sum++;
      }
    if(sum % 2 == p[j]) { sum1++; }
    }
    if(sum1 == M) ans++;
  }

  cout << ans;

 
 
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int n;
    cin >> n;
    cout << n * 800 - 200 * (n / 15) << endl;
}


Measured memory_bytes: 256
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

nn = inputs[0][0]
kk = inputs[0][1]

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
end

if kk <= 1
  puts 0
else
  puts nn-kk
end


Measured memory_bytes: 1788
N, W = gets.split.map(&:to_i)
WVs = readlines.map{|l| l.split.map(&:to_i)}

w1 = WVs[0][0]
h = WVs.group_by{|w, v| w}
vs = (w1 .. w1 + 3).map{|w| h.has_key?(w) ? h[w].map{|a| a[1]}.sort.reverse : []}
ss = vs.map{|a| a.size}
css = vs.map{|ary| ary.inject([0]){|a, x| a << a[-1] + x}}
ans = 0
(0 .. [N, ss[0]].min).each do |i0|
  break if (ws0 = w1 * i0) > W
  (0 .. [N - i0, ss[1]].min).each do |i1|
    break if (ws1 = ws0 + (w1 + 1) * i1) > W
    (0 .. [N - (i0 + i1), ss[2]].min).each do |i2|
      break if (ws2 = ws1 + (w1 + 2) * i2) > W
      (0 .. [N - (i0 + i1 + i2), ss[3]].min).each do |i3|
        break if ws2 + (w1 + 3) * i3 > W
        v = css[0][i0] + css[1][i1] + css[2][i2] + css[3][i3]
        ans = v if v > ans
      end
    end
  end
end
puts ans

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

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, const T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, const T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, const T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, const T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

void calc() {
	int x; cin >> x;
	int l = 0, r = x;
	while (l + 1 < r) {
		int mid = (l + r) / 2;
		if (mid * (mid + 1) / 2 < x) l = mid;
		else r = mid;
	}
	cout << r << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	calc();
#ifdef _MSC_VER
	system("pause");
#endif
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> E[3010];
int N, A[3010];
bool allodd[3010]; 
void dfs(int v, int p, int d){
	bool finish = true;
	if(d & 1) allodd[v] = true; 
	else allodd[v] = false; 
	for(int c : E[v]){
		if(c == p) continue; 
		if(A[c] < A[v]) finish = false; 
	}
	for(int c : E[v]){
		if(c == p) continue; 
		if(A[c] >= A[v]) continue; 
		if(finish && !(d & 1)) allodd[v] = false;  
		dfs(c, v, d+1); 
		if(d & 1) allodd[v] &= allodd[c]; 
		else allodd[v] |= allodd[c]; 
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N; 
	for(int i = 1; i <= N; i++) cin >> A[i]; 
	for(int i = 0; i < N-1; i++){
		int a, b; cin >> a >> b; 
		E[a].push_back(b); 
		E[b].push_back(a); 		
	}
	for(int i = 1; i <= N; i++){
		dfs(i, 0, 0);
		if(allodd[i]) cout << i << " ";
	}
	cout << "\n"; 
}

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

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define ll long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define PI 3.1415926535897932384626
#define inf 1e18
#define vll vector<ll>
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define flr(i,a,b) for(ll i=a;i>b;i--)
#define db(x) cout << '>' << #x << ':' << x << endl;
#define print(v) for(auto i=v.begin();i!=v.end();i++){cout<<*i<<" ";}cout<<"\n";
#define MOD 1000000007
const ll N = 2e5;

int main()
{
    speed;
    //test{}
    ll n; cin>>n;
    map<ll,ll> mp;
    forn(i,n-1){
    	ll x ; cin>>x;
    	++mp[x];
    }
    fl(i,1,n+1){
    	cout<<mp[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 16160
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define check(a) if(!(a)){f = false;}
using namespace std;
typedef vector<int> vi;

class UnionFind{
  vi p,r;
public:
  UnionFind(int n):p(n,-1),r(n,0){ }
  int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); }
  bool same(int x,int y){return find(x)==find(y);}
  void unite(int x,int y){
    x = find(x); y = find(y);
    if(x==y)return;

    if(r[x] < r[y])p[x] = y;
    else p[y] = x;
    if(r[x] == r[y])r[x]++;
  }
};

int main(){
  int n,m;
  while(cin >> n >> m, n){
    vi deg(n,0);
    UnionFind uf(n);

    bool f = true;
    rep(i,m){
      int a,b;
      cin >> a >> b; a--; b--;
      check(++deg[a]<=2);
      check(++deg[b]<=2);
      check(!uf.same(a,b));
      uf.unite(a,b);
    }

    if(f)cout << "yes" << endl;
    else cout << "no" << endl;
  }
}

Measured memory_bytes: 2316
#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  if(t%1000==0||t==10000)
  {
    cout<<"0";
  }else
  {
    int c=t%1000;
    int z=1000-c;
    cout<<z;
  }
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll k,n,i,j,s1=0,s2=0;
  cin>>k>>n;
  ll a[n+1];
  for(i=1;i<=n;i++)
    cin>>a[i];
  vector<ll> v;
  for(i=2;i<=n;i++)
  {
    v.push_back(min(a[i]-a[i-1],k-a[i]+a[i-1]));
  }
  v.push_back(min(a[n]-a[1],k-a[n]+a[1]));
  sort(v.begin(),v.end());
  for(i=0;i<v.size()-1;i++)
    s1+=v[i];
  cout<<s1;
}

Measured memory_bytes: 3956
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N;
    cin >> N;
    if (N.back() == '3') {
        cout << "bon" << endl;
    } else if (N.back() == '0' || N.back() == '1' || N.back() == '6' || N.back() == '8') {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
    return 0;
}

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

int main(){
    int a[5];
    int b[5];
    int c[5];
    int r = 10;
    int sum = 0;
    for(int i = 0; i < 5; i++){
        cin >> a[i];
        b[i] = ((a[i] + 9) / 10) * 10;
        c[i] = a[i] % 10;
        if(c[i] != 0){
            r = min(r, c[i]);
        }
        sum += b[i];
    }
    if(r < 10){
        cout << sum - 10 + r << endl;
    }
    else{
        cout << sum << endl;
    }
}

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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define ll long long
#define el '\n'

using namespace std;


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

    int n;
    cin >> n;

    pair<ll,ll> ar[n];  // dedline,worktime;
    for (int i=0;i<n;i++){
        cin >> ar[i].se >> ar[i].fi;
    }

    sort(ar,ar+n);
    ll tot=0;
    for (int i=0;i<n;i++){
        tot+=ar[i].se;
        if (tot<=ar[i].fi) continue;

        cout << "No" << el;
        return 0;
    }

    cout << "Yes" << el;

    return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;

int main() {
  int N;
  int A;
  int rem;

  cin >> N >> A;

  rem=N%500;

  if(rem<=A){
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=100005;
inline int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x;
}
int n,a[maxn],B,A;
inline bool pd(int k){
	ll tot=0;
	for (int i=1;i<=n;++i){
		ll rem=a[i]-k*(ll)B;
		if (rem<1) continue;
		tot+=rem/(A-B);
		if (rem%(A-B)) ++tot;
		if (tot>k) return false;
	}
	return true;
}
int main(){
	n=read(),A=read(),B=read();
	for (int i=1;i<=n;++i) a[i]=read();
	int l=1,r=1e9,ans;
	while (l<=r){
		int mid=(l+r)>>1;
		if (pd(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf ("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010], B[100010];
    rep(i, N + 1) cin >> A[i];
    rep(i, N) cin >> B[i];
    int ans = 0;
    rep(i, N) {
        rep(j, 2) {
            int t = min(A[i + j], B[i]);
            ans += t;
            A[i + j] -= t;
            B[i] -= t;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n, q;
    cin >> n >> q;
    queue<int> Q[n];
    for (int i = 0; i < q; i++) {
        int num, t; //manipulate Qt
        cin >> num >> t;
        if (num == 0) { //enqueue
            int x;
            cin >> x;
            Q[t].push(x);
        } else if (num == 1) { //front
            if (!Q[t].empty()) {
                cout << Q[t].front() << endl;
            }
        } else if (num == 2) { //dequeue
            if (!Q[t].empty()) {
                Q[t].pop();
            }
        }
    }
}



Measured memory_bytes: 4332
A, B, C = map(int, input().split())


count = 0
while True:
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        print(count)
        break
    if A == B == C:
        print(-1)
        break
    A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
    count += 1


Measured memory_bytes: 38256
def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

n = int(input())
if n == 2:
  a, b = map(int, input().split())
  diva = set(divisor(a))
  divb = set(divisor(b))
  div = list(diva&divb)
  div = sorted(div)
  for i in div:
    print(i)
else:
  a, b, c = map(int, input().split())
  diva = set(divisor(a))
  divb = set(divisor(b))
  divc = set(divisor(c))
  div = list(diva&divb&divc) 
  div = sorted(div)
  for i in div:
    print(i)


Measured memory_bytes: 5600
using System;
using System.Linq;
class A
{
  static void Main()
    {
    string N = Console.ReadLine();
    int CC = 0;
      for (int i = 0; i < N.Length; i++)
        {
          if (char.IsUpper(N, i)) CC += 1;
        }
    if (N.Substring(N.Length-1) == "C" || N.Count(c => c == 'C') >= 2 ||  CC >= 3) Console.WriteLine("WA");
    else if (N.Substring(0, 1) == "A" && 2 <= N.IndexOf("C") && N.IndexOf("C") <= N.Length - 1) Console.WriteLine("AC");
    else Console.WriteLine("WA");
  }
}


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

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  string S;
  cin >> S;

  // main procedure
  if (S.back() == 's') {
    S += "es";
  } else {
    S += "s";
  }

  // output
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	int a;//AC
	int b;//WA
	int c;//TLE
	int d;//RE
	string S;

	cin >> N;
	a=0;
	b=0;
	c=0;
	d=0;
	for(int i = 0; i < N; i++) {
		cin >> S;
		if(S=="AC") a++;
		if(S=="WA") b++;
		if(S=="TLE")c++;
		if(S=="RE") d++;
	}
	cout << "AC x "  << a << endl;
	cout << "WA x "  << b << endl;
	cout << "TLE x " << c << endl;
	cout << "RE x "  << d << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm> 
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
using namespace std;

#define ll                    long long int
#define ull                   unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(ll i=(ll)a;i<(ll)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define all(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
const ll MOD = 1000000007;

ll modpow(ll a, ll b, ll mod) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res%=mod; a = a * a; a%=mod; }return res; }
ll p(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a;a = a * a; }return res; }

bool mysort(const ll& a, const ll& b) {
    return (abs(a) > abs(b));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */
    int n; cin >> n;
    cout << (1 - n) << "\n";
    /* end code */
}

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

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

  int cnt = 0;
  for ( int i = 0; i < n; i++ ) {
    int a;
    cin >> a;
    bool is_prime = true;
    for ( int j = 2; j <= sqrt(a); j++ ) {
      if ( a % j == 0 ) {
	is_prime = false;
	break;
      }
    }

    if ( is_prime ) cnt++;
  }

  cout << cnt << endl;
  
  return 0;
}



Measured memory_bytes: 3092
import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 23636
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [u32; n],
    }

    println!("{}", a.iter().map(|&x| x.trailing_zeros()).min().unwrap());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define END(x) do{cout<<(x)<<endl;exit(0);}while(0)
#define cond(a,b,c) ((a)?(b):(c))

using ll=long long;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    string S; cin >> S;
    int N = S.size();

    int i = 0;
    vector<int> ans(N,0);
    while(i < N) {
        int idx = i;
        while(idx < N and S[idx] == 'R') idx++;
        if (idx <= N) idx--;
        rep(k, i, idx) {
            if ( (idx-k)%2== 0 ) ans[idx]++; else ans[idx+1]++;
        }
        
        int j = idx+1;
        while(j < N and S[j] == 'L') j++;
        if(j <= N) j--; else assert(0);
        rep(k, idx+1, j) {
            if ((k-idx-1) % 2==0) ans[idx+1]++; else ans[idx]++;
        }

        i = j+1;
    }

    rep(i, 0, N-1) cout << ans[i] << cond(i==N-1, "\n", " ");
}



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

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int cnt[26] = {};
  for(int i = 0; i < n; i++) {
    cnt[s[i]-'a']++;
  }
  int odd = 0;
  for(int i = 0; i < 26; i++) {
    odd += cnt[i]%2;
  }
  cout << odd/2 << endl;
  return 0;
}

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;

using namespace std;

ll n, m, k;

int main(){
    unordered_map<string, ll> inp;
    cin >> n;
    for (int i=0; i<n; ++i){
        string s;
        cin >> s;
        inp[s] += 1;
    }
    cout << "AC x " << inp["AC"] << endl;
    cout << "WA x " << inp["WA"] << endl;
    cout << "TLE x " << inp["TLE"] << endl;
    cout << "RE x " << inp["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3264
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),k=nxt();
    string  s;
    cin>>s;
    int test=0;
    int i=0;
    while(i<n)
    {
        char c=s[i];
        while(i<n&&s[i]==c)
            i++;
        test++;
    }
    while(k>0&&test>2)
    {
        k--;
        test-=2;
    }
    if(k>0&&test==2)
        test=1;
    cout<<n-test<<endl;
    
    
    return 0;   
}


 
 


Measured memory_bytes: 512