akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#include<cmath>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<list>
#include<deque>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<chrono>


/*  auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<milliseconds>(stop - start);
pr(duration.count());    */


#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define siz         100009
#define mp          make_pair
#define ll          long long int
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define pi          acos(-1.0)
#define all(x)      x.begin(),x.end()
#define ull		    unsigned long long int
#define m(a)	    memset(a,0,sizeof(a))
#define f(i,n)	    for(ll i=0;i<n;i++)
#define sc(a)	    scanf("%lld",&a)
#define pr(a)	    printf("%lld\n",a)
const ll inf = 5000000000000000;
ll in = 1000000000000000000;
using namespace std;

int main()
{
	FastIO;
	ll a,b,c,d, co, t, i, j, k, n;
	string s;
	cin >> s >> k;
	co = 0;
	for (i = 0; i < s.size(); i++)
	{
		if (s[i] == '1')
		{
			co++;
			if (co == k)
			{
				cout << 1 << endl;
				break;
			}
		}
		else
		{
			cout << s[i] << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));


int main() {

	int a, b;
	cin >> a >> b;

	if (b % a == 0) cout << a + b << endl;
	else cout << b - a << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int e;
	string d, a;
	cin >> d;
	for (int h = 0; h < d.size(); h++) {
		if (d[h] == 'B') {
			if(a.size())a.pop_back();
		}
		else {
			a.push_back(d[h]);
		}
	}
	cout << a << "\n";
	cin >> e;
}

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

int main(){
	int n, pm, pe, pj;
	while(1){
		cin>>n;
		if(n==0) break;

		for(int i=0;i<n;i++){
			cin>>pm>>pe>>pj;
			double ave = (pm + pe + pj)/3;
			if(( pm == 100 | pe == 100 | pj == 100 ) | ((pm+pe)/2 >= 90 ) | ( ave >= 80) )  cout<<"A"<<endl;
			else if(( ave >= 70 ) | (( ave >= 50 ) && ( pm >= 80 | pe >= 80 )))             cout<<"B"<<endl;
			else                                                                            cout<<"C"<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1156
n,m=map(int,input().split())
py=[list(map(int,input().split())) for _ in range(m)]

for i in range(m):
    py[i].append(i+1)

py.sort()

#print(py)
now=py[0][0]
co=0

for j in range(m):
    t=py[j][0]
    if t==now:
        co+=1
        py[j][1]=co
    else:
        now=py[j][0]
        co=1
        py[j][1]=co

#print(py)

py.sort(key=lambda x:x[2])
#print(py)

for a,b,c in py:
    print(str(a).rjust(6,'0')+str(b).rjust(6,'0'))

Measured memory_bytes: 32452
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD (int)1e9 + 7
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;

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

ll n, arr[200010], memo[200010], k;

int main() {
	fastio;
	cin >> n >> k;
	for (ll i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	ll pos = 1;
	ini(memo, -1);
	memo[pos] = 0;
	bool flag = true;
	for (ll j = k - 1, i = 1; j >= 0; j--, i++) {
		pos = arr[pos];
		if (memo[pos] != -1 && flag) {
			j %= i - memo[pos];
			flag = false;
		}
		if(memo[pos] == -1) memo[pos] = i;
	}
	cout << pos;
}

Measured memory_bytes: 6780
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

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

    vector<bool> dp(X+1, 0);
    for(int i=0; i<6; i++){
        if(100+i<=X) dp[100+i] = true;
    }

    for(int i=0; i<=X; i++){
        for(int j=0; j<6; j++){
            if(i-100-j>=0) dp[i] = dp[i-100-j] | dp[i];
        }
    }

    cout << dp[X] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>

#define ll long long
#define MOD 1000000007

using namespace std;

int main(){
    int x;
    cin >>x;
    if(x>=1200){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }
    return 0;
}


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

int main() {
  int N,L;
  cin >> N >> L;
if(L-1+N<0){
  cout<<N*(L-1)+(N*(N+1))/2-(L-1+N)<<endl;
}
 else if(L>0){
  cout<<N*(L-1)+(N*(N+1))/2-L<<endl;
}
  else{
      cout<<N*(L-1)+(N*(N+1))/2<<endl;
  }
}


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

typedef long long ll;
#define pb push_back
//#define mp make_pair
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll maxn = 1e5 + 10;
pair <ll, ll> d[maxn];
map <ll, ll> mp;
vector <ll> adj[maxn];
ll sz[maxn];
ll h[maxn];
bool mark[maxn];
ll n;

void dfs(int v){
	mark[v] = true;
	for(int i : adj[v]){
		if(!mark[i]){
			h[i] = h[v] + 1;
			dfs(i);
		}
	}
}

bool check(){
	dfs(d[n - 1].second);
	ll sum = 0;
	for(int i = 0; i < n; i ++){
		sum += h[i];
	}
//	cout << d[n - 1].second << endl;
	if(sum != d[n - 1].first)
		return false;
	else
		return true;
}

int main(){
	fast_io;
	cin >> n;
	for(ll i = 0; i < n; i ++){
		ll x;
		cin >> x;
		d[i] = {x, i};
//		s.insert({-x, i});
		mp[x] = i; 
	}
	sort(d, d + n);
	reverse(d, d + n);
	bool flag = true;
	
	for(ll i = 0; i < n - 1; i ++){
		sz[d[i].second] = 1;
		for(ll u : adj[d[i].second]){
			sz[d[i].second] += sz[u];
		}
		ll x = d[i].first + sz[d[i].second] * 2 - n;
		auto f = mp.find(x);
		if(f == mp.end()){ 
			flag = false;
			break;
		}else{
			adj[mp[x]].pb(d[i].second);
		}
//		cout << "x = " << x << endl;
	}
	
	flag = check();
	
	if(flag){
		for(ll i = 0; i < n; i ++){
			for(ll u : adj[i]){
				cout << i + 1 << " " << u + 1 << endl;
			}
		}
	}else{
		cout << -1 << endl;
	}
	
	return 0;
}



Measured memory_bytes: 20900
#include <bits/stdc++.h>
using namespace std;
int n, m, u, v, ind[200020], dist[200020], ans = 0;
queue<int> Q;
vector<int> g[200020];
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) cin >> u >> v, g[u].push_back(v), ind[v]++;
	for (int i = 1; i <= n; i++) {
		if (ind[i]==0) Q.push(i);
		dist[i] = 0;
	}
	while (!Q.empty()) {
		int cur = Q.front(); 
		Q.pop();
		for (auto xx: g[cur]) {
			ind[xx]--;
			if (ind[xx] == 0) Q.push(xx), dist[xx] = dist[cur]+1;
		}
	}
	for (int i = 1; i <= n; i++) ans = max(ans, dist[i]);
	cout << ans;
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
ll lcm(ll a,ll b)
{return a/gcd(a,b)*b;}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=1e18;
//------------------------------------------------------------
int N;
int nums[1100];
ll ans=1;

void solve() {
  cin>>N;

  rep(i,1,N)
  {
    int num = i+1;
    for(int j=2*num;j<=N;j+=num) nums[j]=1;
  }

  rep(i,1,N)
  {
    int num = i+1;
    if(nums[num]==0)
    {
      ll tmp=0;
      for(int j=num; j<=N; j*=num) tmp+=N/j;
      // tmp+=N/num;
      ans = ans*(tmp+1)%(int)(1e9+7);
    }
  }

  print(ans);
  return;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int str1 = sc.nextInt();
		int str2 = sc.nextInt();
		int str3 = sc.nextInt();
		int str4 = sc.nextInt();

		if (str1 * str2 > str3 * str4) {
			System.out.println(str1 * str2);
		} else {
			System.out.println(str3 * str4);
		}
	}
}

Measured memory_bytes: 22612
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  string s;
  cin >> s;
  s = "." + s;
  int n = s.size();
  ll ans = 0;
  int cnt = 0;
  for(int i = n - 1; i >= 1; i--) {
    if(s[i] == 'A') {
      ans += cnt;
    } else {
      if(string(1, s[i - 1]) + string(1, s[i]) == "BC") {
        cnt++;
        i--;
      } else cnt = 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 788
#include<bits/stdc++.h>
	using namespace std;
	#define xxx ios::sync_with_stdio(),cin.tie(0),cout.tie(0)
	#define rep(i,n) for(int i=0;i<n;i++)
	#define int long long
	
	
	
	signed main(){
		int test=1;
		//cin>>test;
		while(test--){
			int l,r,d;
			cin>>l>>r>>d;
			int con=0;
			for(int i=l;i<=r;i++){
				if(i%d==0) con++;
			}		
			cout<<con<<endl;

		}
		return 0;
	}

Measured memory_bytes: 3632
module ABC139

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_C

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_C

    ! variables for this <subroutine>
    integer(INT64) :: len_sequence

    ! STEP.01
    ! read out the given data (the number of squares)
    read(unit=INPUT_UNIT, fmt=*) len_sequence

    ! STEP.02
    ! output the answer of this task
    write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') (len_sequence - 1_INT64) * len_sequence / 2_INT64

    ! STEP.END
    return

  end subroutine task_C

end module ABC139

program main

  ! <module>s to import
  use, non_intrinsic :: ABC139

  ! require all variables to be explicitly declared
  implicit none

  call task_C

end program main

Measured memory_bytes: 256
# 最短でゴールして残った黒をぜんぶ白に変えれば最大のポイントをもらえそう
# ってなふうに雑に考えてたけど、探索・最短経路復元・解答それぞれで1度ずつBFSをしなきゃならんのか？？？？

h, w = map(int, input().split())
table = [[] for _ in range(h)]
for y in range(h):
    table[y] = list(input())
# ステップ更新用
my_table = [[-1 for _ in range(w)] for _ in range(h)]
my_table[0][0] = 0
yo = [(0, 0)]
steps = [0, -1, 0, 1, 0]
while len(yo) > 0:
    p = yo[0]
    yo = yo[1:]
    for i in range(4):
        next_x, next_y = steps[i + 1] + p[1], steps[i] + p[0]
        if next_x < 0 or w <= next_x or next_y < 0 or h <= next_y:
            continue
        if table[next_y][next_x] == "#":
            continue
        if my_table[next_y][next_x] >= 0:
            continue
        my_table[next_y][next_x] = my_table[p[0]][p[1]] + 1
        yo.append((next_y, next_x))
if my_table[h - 1][w - 1] == -1:
  print(-1)
  exit()
  
# 経路を逆からたどって最短経路復元
restore_table = [["o" for _ in range(w)] for _ in range(h)]
restore_table[h - 1][w - 1] = "x"
now = my_table[h - 1][w - 1]
cur = (h - 1, w - 1)
while now != 0:
    for i in range(4):
        next_y, next_x = steps[i] + cur[0], steps[i + 1] + cur[1]
        if next_x < 0 or w <= next_x or next_y < 0 or h < next_y:
            continue
        if my_table[next_y][next_x] == now - 1:
            restore_table[next_y][next_x] = "x"
            cur = (next_y, next_x)
            now -= 1
            break

# やっと答え
ans = 0
for y in range(h):
    for x in range(w):
        if restore_table[y][x] == "o" and table[y][x] == ".":
            ans += 1
print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL);
#define MOD 1000000007

double dp[3003];
double a[3003];

int main() 
{  
	int n,i,j;
    cin>>n;
    
    for(i=0;i<n;i++)
    	cin>>a[i];
    
    dp[0]=1;

    for(i=0;i<n;i++)
    {
    	for(j=i+1;j>=0;j--)
    	{
    		if(j==0)
    			dp[j]*=(1.000000000-a[i]);
    		else
    			dp[j]=dp[j-1]*a[i]+dp[j]*(1.000000000-a[i]);
    	}
    }
    
    double ans=0.000000000;

    for(i=n/2+1;i<=n;i++)
    {
    	ans+=dp[i];
    }

    printf("%.10lf\n",ans);//<<ans<<"\n";
 	return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	a := make([]int, N)

	for i := 0; i < N; i++ {
		a[i] = nextInt()
	}
	c := 1
	n := 0
	for i := 0; i < N; i++ {
		if a[i] == c {
			c++
		} else {
			n++
		}
	}

	if c == 1 || n == N {
		fmt.Println(-1)
	} else {
		fmt.Println(n)
	}
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<ll> p(a),q(b),r(c);
    rep(i,a)cin>>p[i];
    rep(i,b)cin>>q[i];
    rep(i,c)cin>>r[i];
    sort(ALL(p));
    sort(ALL(q));
    sort(ALL(r));
    ll L = 0, R = 1000000001;//無色の食べる最低
    while(L+1<R){
        ll ce = (L+R)/2;
        int al = a-(lower_bound(ALL(p),ce)-p.begin());
        int aa = min(x,al);
        int bl = b-(lower_bound(ALL(q),ce)-q.begin());
        int bb = min(y,bl);
        ll cc = c-(lower_bound(ALL(r),ce)-r.begin());
        if(aa+bb+cc>=x+y){//食べすぎorちょうどいいので狭く
            L=ce;
        }else{
            R=ce;
        }
    }
    ll ans = 0;
    reverse(ALL(p));
    reverse(ALL(q));
    reverse(ALL(r));
    ll cnt = x+y;
    for(int i=0; i<x&&p[i]>=L;i++){ans+=p[i];cnt--;}
    for(int i=0; i<y&&q[i]>=L;i++){ans+=q[i];cnt--;}
    for(int i=0; r[i]>=L&&i<c&&cnt>0;i++){ans+=r[i];cnt--;}
    cout<<ans<<endl;
    return 0;

}

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using ld = long double;
using pll = pair<ll, ll>;


const int N = 200 * 1000 + 10;

int a[N];

int get_min(int i, int j) {
    if (i == -1)
        return j;
    if (j == -1)
        return i;
    return a[i] < a[j] ? i : j;
}
    
struct Node {
    int len = 0;
    int min_odd = -1;
    int min_even = -1;

    Node() = default;

    Node(int len, int min_odd, int min_even): len(len), min_odd(min_odd), min_even(min_even) {}

    void unite(Node other) {
        if (len % 2)
            swap(other.min_odd, other.min_even);
        min_odd = get_min(min_odd, other.min_odd);
        min_even = get_min(min_even, other.min_even);
        len += other.len;
    }
};

Node t[4 * N + 10];
set<int> moved;

void build(int i, int l, int r) {
    if (l == r) {
        t[i] = Node(1, -1, l);
        return;
    }
    int m = (l + r) / 2;
    build(2 * i + 1, l, m);
    build(2 * i + 2, m + 1, r);
    t[i] = t[2 * i + 1];
    t[i].unite(t[2 * i + 2]);
}

void del(int i, int tl, int tr, int pos) {
    if (tl == tr) {
        moved.insert(pos);
        a[pos] = N;
        t[i] = Node(0, -1, -1);
        return;
    }
    int m = (tl + tr) / 2;
    if (pos <= m)
        del(2 * i + 1, tl, m, pos);
    else
        del(2 * i + 2, m + 1, tr, pos);
    t[i] = t[2 * i + 1];
    t[i].unite(t[2 * i + 2]);
}

Node get(int i, int tl, int tr, int l, int r) {
    if (l == tl && r == tr)
        return t[i];
    Node nl;
    Node nr;
    int m = (tl + tr) / 2;
    if (l <= m)
        nl = get(2 * i + 1, tl, m, l, min(r, m));
    if (r > m)
        nr = get(2 * i + 2, m + 1, tr, max(m + 1, l), r);
    nl.unite(nr);
    return nl;
}

int main() {
#ifdef LOCAL
     freopen("input", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(12);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    build(0, 0, n - 1);
    vector<int> ans;
    ans.reserve(n);
    for (int i = 0; i < n / 2; i++) {
        auto node = get(0, 0, n - 1, 0, n - 1);
        int l = node.min_even;
        auto it = moved.lower_bound(l);
        int high;
        if (it == moved.end())
            high = n - 1;
        else
            high = *it - 1;
        node = get(0, 0, n - 1, l, high);
        int r = node.min_odd;
        ans.push_back(a[l]);
        ans.push_back(a[r]);
        del(0, 0, n - 1, l);
        del(0, 0, n - 1, r);
    }
    for (auto x : ans)
        cout << x << " ";
    cout << "\n";
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

ll A[10];

int main(){
    ll N,M;
    cin >> N >> M;
    string S = "1";
    bool flag = 0;
    bool co = 1;
    rep(i,N-1) S += '0';
    rep(i,10) A[i] = -1;
    rep(i,M){
        ll s,c;
        cin >> s >> c;
        if(s != 1 || c != 0) co = 0;
        s--;
        if(s == 0 && c == 0) flag = 1;
        if(s >= N){
            flag = 1;
            continue;
        }
        if(A[s] == -1){
            S[s] = (char)('0'+c);
            A[s] = c;
        }else{
            if(A[s] != c){
                flag = 1;
                continue;
            }
        }
    }
    if(N == 1 && co){
        cout << 0 << endl;
        return 0;
    }
    if(S[0] == 0 || flag){
        cout << -1 << endl;
    }else{
        cout << S << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main(){
    ll N,K,S,ans;
    cin >> N >> K >> S;
    if(S<1e9){
      	if(K==0){
      		rep(i,N)cout << S+1 << endl;
    	}else{
        	rep(i,K)cout << S << endl;
        	rep(i,N-K)cout << S+1 << endl;
        }
    }else{
      	if(K==0){
      		rep(i,N)cout << S-1 << endl;
    	}else{
        	rep(i,K)cout << S << endl;
        	rep(i,N-K)cout << 1 << endl;
        }
    }
    return 0;
}

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

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            string[] a = Console.ReadLine().Split(' ');

            int count = 0;

            for(int i = 0; i < N; i++)
            {
                int tempa = int.Parse(a[i]);

                while(tempa % 2 == 0)
                {
                    count++;

                    tempa /= 2;
                }
            }

            Console.WriteLine(count);
        }
    }
}

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

vector<int> v;

int main(){
while(1){	
	
	int n;
	cin >> n;
	if(n == 0) break;
	for(int i=0; i<n; i++){
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	
	sort(v.begin(), v.end());
	
	int ans = 99999999;
	for(int i=0; i<n-1; i++){
		ans = min(ans, abs(v[i] - v[i+1]));
	}
	
	cout << ans << endl;
	v.clear();
	
}//end	
	
	return 0;
}


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String dateStr = sc.next();
        String[] date_split = dateStr.split("/");
        int year = Integer.parseInt(date_split[0]);
        int month = Integer.parseInt(date_split[1]);
        int day = Integer.parseInt(date_split[2]);

        boolean past = true;
        if(year > 2019) past = false;
        if(year == 2019) {
            if(month > 4) past = false;
            if(month == 4) {
                if(day > 30) past = false;
            }
        }

        System.out.println(past?"Heisei":"TBD");
    } 
}

Measured memory_bytes: 23764
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>

using int64 = long long;

using namespace std;

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

    int N;
    cin >> N;

    string S;
    cin >> S;

    int64 ans = 0;
    for (int j = 1; j < N - 1; j++) {
        map<char, int> lcounter, rcounter;
        for (int i = 0; i < j; i++) {
            lcounter[S[i]]++;
        }
        for (int k = j + 1; k < N; k++) {
            rcounter[S[k]]++;
        }
        for (char l : {'R', 'G', 'B'}) {
            for (char r : {'R', 'G', 'B'}) {
                if (set<char>{l, r, S[j]}.size() != 3) continue;
                ans += lcounter[l] * rcounter[r];
            }
        }

        for (int i = 0; i < j; i++) {
            int k = 2 * j - i;
            if (k >= N || set<char>{S[i], S[j], S[k]}.size() != 3) continue;
            ans--;
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>

using namespace std;
using ll = long long;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n),b(n);
    ll s1=0,s2=0;
    for(ll i=0;i<n;i++){
         cin >> a[i];
         s1+=a[i];
    }
    for(ll i=0;i<n;i++){
         cin >> b[i];
         s2+=b[i];
    }
    ll manip=s2-s1;
    ll cnt=0;
    for(ll i=0;i<n;i++){
        if(a[i]<b[i])   cnt+=((b[i]-a[i]+1)/2);
    }
    if(cnt<=manip) cout << "Yes";
    else    cout << "No";
	return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    int l, r;
    cin >> l >> r;

    ll ans = MOD;
    if(r - l >= 2019){
        cout << 0 << endl;
        return 0;
    }else{
        FOR(i, l, r){
            FOR(j, i+1, r+1){
                ll x = i % 2019;
                ll y = j % 2019;
                ans = min(ans, x * y % 2019);
            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<map>
#include<algorithm>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;

const int MM = 1000000007;
const int MX = 4005;

int mn[MX][MX];
int D[MX];

int main()
{
	int N, x;
	scanf("%d%d", &N, &x);
	for(int i = 1; i <= N; i++) scanf("%d", D+i);
	for(int i = 1; i <= N; i++) D[i+N] = D[i];
	for(int i = 1; i <= N*2; i++){
		mn[i][i] = D[i];
		for(int j = i+1; j <= N*2; j++){
			mn[i][j] = min(mn[i][j-1], D[j]);
		}
	}
	ll ans = 1e18;
	for(int i = 0; i < N; i++){
		ll cur = 0;
		for(int j = N+1; j <= 2*N; j++){
			cur += mn[j-i][j];
		}
		cur += (ll)x * i;
		ans = min(ans, cur);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 61952
#include <stdio.h>
#include <cstring>

using lli = long long int;
constexpr int N = 100;
char str[N+1];

int main(void){
    int k; scanf("%s%d", str, &k);
    const int n = strlen(str);
    lli res = 0;
    int idx = 0;
    while(idx < n){
        int cnt = 1;
        while(idx + cnt < n and str[idx] == str[idx + cnt]) cnt++;
        if(idx == 0 and cnt == n){
            res = n; res *= k; res /= 2;
            printf("%lld\n", res); return 0;
        }
        res += cnt / 2;
        idx += cnt;
    }
    res *= k;
    if(str[0] == str[n-1]){
        int hd = 0, tl = n-1;
        while(str[0] == str[hd + 1]) hd++;
        while(str[0] == str[tl - 1]) tl--;
        int d1 = hd + 1, d2 = n - tl;
        lli p = - (d1 / 2) - (d2 / 2) + ((d1 + d2) / 2);
        res += p * (k-1);
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 128
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std; 
int main(){
  int dd; 
  scanf("2017/01/%d",&dd);
  if (dd>=10){ printf("2018/01/%d\n",dd);
  return 0;
  }
  printf("2018/01/0%d\n",dd);
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():

    n = getN()
    x = n * 800
    y = (n // 15) * 200
    print(x - y)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

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

#ifdef LOCAL
#define DEBUG(...) cerr << #__VA_ARGS__ << ": ", debug(__VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator << (ostream &os, const vector<T> &v) {os << "["; for (int i=0; i<(int)v.size(); i++) {if (i) os << ", "; os << v[i];} return os << "]";}
void debug() {cerr << "\n";} template<typename T, typename... Args> void debug(T x, Args... args) {cerr << x << "; "; debug(args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    long long n, k;
    cin >> n >> k;

    set<long long> st;
    while (!st.count(n)) {
        st.insert(n);
        if (n == k) {
            cout << "0\n";
            return 0;
        } else if (n > k) {
            n %= k;
        } else {
            n = k - n;
        }
    }

    cout << *st.begin() << "\n";

    return 0;
}


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

int n;
std::string a, b;

int main() {
  std::cin >> n >> a >> b;
  for (int i = n; i > 0; --i) if (a.substr(n - i, i) == b.substr(0, i)) return std::cout << 2 * n - i << '\n', 0;
  std::cout << 2 * n << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(){
    char al; cin >> al;
    int d = al - 'A';
    if(d>= 0 && d<= 25){cout << 'A' << endl;}
    else{cout << 'a' << endl;}
    return 0;
}

Measured memory_bytes: 3572
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long n = Long.parseLong(sc.next());
		
		long sum = 0;
		
		for(int i = 1; i < n+1; ++i) {
		    if((i % 3 != 0) && (i % 5 != 0)) {
		        sum += i;
		    }
		}
		
		System.out.println(sum);
		
	}
}

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

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

  int ans = 0;

  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    while (a % 2 == 0) a /= 2, ans++;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int  k = 0 ;
        for(int i = 0 ; i<Integer.MAX_VALUE ; i++){
        if((a-i)==-(b-i)){
            k = i;
            break ;
        }
       
}
        if(k>0) System.out.println(k);
        else System.out.println("IMPOSSIBLE");
    }
}


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

signed main(){
  
  double a, b;
  
  cin >> a >> b;
  
  cout << (int)(( (int)a * (int)( b * 100LL + 1e-8 ) ) / 100LL ) << endl;
  
  return 0;
}


Measured memory_bytes: 3640
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int maxn=100111;
const int mod=1e9+7;
inline void add(int&x,int y){x+=y;if(x>=mod)x-=mod;}

char s[maxn];int n,pre[maxn],dp[maxn],nxt[maxn][3];

int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	bool have=0;for(int i=1;i<n;i++)if(s[i]==s[i+1])have=1;
	
	if(!have)
	{
		puts("1");
		return 0;
	}
	
	for(int i=1;i<=n;i++)if(s[i]=='a')pre[i]=(pre[i-1]+1)%3;else pre[i]=(pre[i-1]+2)%3;
	for(int i=0;i<3;i++)nxt[n+1][i]=n+1;
	for(int i=n;i>=1;i--)
	{
		memcpy(nxt[i],nxt[i+1],sizeof(nxt[i]));
		nxt[i][pre[i]]=i;
	}
	dp[0]=1;
	for(int i=0;i<n;i++)
	{
		for(int k=1;k<=2;k++)
			add(dp[nxt[i+1][(pre[i]+k)%3]],dp[i]);
	}
	int ans=0;
	for(int i=1;i<=n;i++)if(pre[i]==pre[n])add(ans,dp[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
#define int long long

signed main(){
    int x,a,b;
    cin >> x >> a >> b;
    
    if(abs(x-a)<abs(x-b)){
        cout << "A" << endl;
    }else{
        cout << "B" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// フィボナッチ数列
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 44
// 無効な値の定義
const int INV = -1;

// フィボナッチ数列を保持する配列
int fib[MAX_N + 1];

int Fibonacci(int n);

int main(void)
{

    int n;

    cin >> n;

    for(int i = 0; i < MAX_N + 1; i++)
    {
        fib[i] = INV;
    }

    fib[0] = 1;
    fib[1] = 1;

    // フィボナッチ数列の表示
    printf("%d\n", Fibonacci(n));

    return 0;
}

// フィボナッチ数列を算出する関数
int Fibonacci(int n)
{

    if( n <= 1)
    {
        // n = 0, n = 1 の時
        return 1;
    }

    if( fib[n] != INV )
    {
        // 既に計算されている時は, 結果を返す
        return fib[n];
    }

    // フィボナッチ数列の算出の算出
    fib[n] = Fibonacci(n - 1) + Fibonacci(n - 2);

    return fib[n];
}



Measured memory_bytes: 3188
def main():
    n, k = map(int, input().split())
    h_list = list(map(int, input().split()))

    # time O(N log(N))
    sorted_h_list = sorted(h_list, reverse=True)
    attack_list = sorted_h_list[k:]

    ans = sum(attack_list)
    print(ans)


main()


Measured memory_bytes: 26180
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    ll N=ii();
    ll M=ii();
    vector<ll> H;
    vector<ll> maxh(N,0LL);

    REP(i,0,N){
        H.push_back(ii());
    }

    REP(i,0,M){
        ll A=ii()-1;
        ll B=ii()-1;
        maxh[A]=max(maxh[A],H[B]);
        maxh[B]=max(maxh[B],H[A]);
    }

    ll ret=0;
    REP(i,0,N){
        if(H[i]>maxh[i]){
            ret++;
        }
    }
    oie(ret);

    return 0;
}


Measured memory_bytes: 5104
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n); cin >> as;
    vector<ll> as2(n);
    as2[0] = as[0];
    for(int i = 1; i < n; i++){
        as2[i] = as2[i - 1] + as[i];
    }
    ll ans = MLL;
    for(int i = 2; i < n - 1; i++){
        ll s1 = as2[i - 1], s2 = as2[n - 1] - s1;
        ll mi = MLL, ma = 0;
        auto ite = lower_bound(as2.begin() + 1, as2.end(), s1 / 2);
        if(abs(s1 - *ite * 2) < abs(s1 - *(ite - 1) * 2)){
            mi = min(mi, min(s1 - *ite, *ite));
            ma = max(ma, max(s1 - *ite, *ite));
        }else{
            mi = min(mi, min(s1 - *(ite - 1), *(ite - 1)));
            ma = max(ma, max(s1 - *(ite - 1), *(ite - 1)));
        }
        ite = lower_bound(as2.begin() + 1, as2.end() - 1, s2 / 2 + s1);
        if(abs(s2 - (*ite - s1) * 2) < abs(s2 - (*(ite - 1) - s1) * 2)){
            mi = min(mi, min(s2 - (*ite - s1), (*ite - s1)));
            ma = max(ma, max(s2 - (*ite - s1), (*ite - s1)));
        }else{
            mi = min(mi, min(s2 - (*(ite - 1) - s1), (*(ite - 1) - s1)));
            ma = max(ma, max(s2 - (*(ite - 1) - s1), (*(ite - 1) - s1)));
        }
        printde(i, ma, mi);
        ans = min(ans, ma - mi);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 2560
import std.algorithm;
import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto abck = readln.split.map!( to!long );
	writeln( solve( abck[ 0 ], abck[ 1 ], abck[ 2 ], abck[ 3 ] ) );
}

long solve( in long a, in long b, in long c, in long k )
{
	if( k % 2 == 0 ) return a - b;
	else             return b - a;
}

unittest
{
	assert( solve( 1, 2, 3, 1 ) == 1 );
	assert( solve( 2, 3, 2, 0 ) == -1 );
	assert( solve( 1000000000, 1000000000, 1000000000, 1000000000000000000 ) == 0 );
}


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

int main()
{
    int N;
    string S;
    cin >> N >> S;

    int ans = 0;
    for (int diff = 0; diff < N; diff++)
    {
        int match = 0;
        for (int i = 0; i + diff < N; i++)
        {
            if (S[i] == S[diff + i])
            {
                match++;
            }
            else
            {
                match = 0;
            }
            ans = max(ans, min(match, diff));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ieps (int) 1e6
#define eps (int) 1e9
#define pii pair<int, int>
#define m eps + 7
int fact[ieps];

void solve(){
	fact[0] = fact[1] = 1;
	for(int i = 2;i<ieps;i++){
		fact[i] = (fact[i-1]*i);
		fact[i] %= 1000000007;
	}
}


int32_t main(){
	int n , t;
	cin>>n>>t;
	solve();
	if(max(n, t ) - min(n, t ) > 1){
		cout<<0<<endl;
		return 0;
	}
	else{
		if(n == t){
				int p = fact[n];
				cout<<(p*p*2)%1000000007;
			}
		else{
			int p = fact[n], k = fact[t];
			cout<<(p*k)%1000000007<<endl;
		}
	}

}

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

int main() {

  int n,k;
  cin >> n >> k;
  int ans = 0;
  while (pow(k,ans)<n+1) {
    ans++;
  }

  cout << ans << endl;
}


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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N, 0);
  for (int k = 0; k < K; k++) {
    int d;
    cin >> d;
    for (int i = 0; i < d; i++) {
      int a;
      cin >> a;
      A[a - 1]++;
    }
  }

  int answer = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) answer++;
  }
  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 3628
/*
  In the name of ALLAH
  Author : Raashid Anwar
*/

#include <bits/stdc++.h>
using namespace std;
 
#define int int64_t
const int M1 =  998244353;
const int M2 =  1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());


void solve() {
  string s;
  cin >> s;
  int sum = 0;
  for(auto c : s)
    sum = (sum + c - '0') % 9;
  cout << (sum? "No": "Yes") << "\n";
}
 
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}

Measured memory_bytes: 3732
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DCaracalVsMonster {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int H;
        cin >> H;
        int num = 1;
        int res = 0;
        while (H > 0) {
            res += num;
            num *= 2;
            H /= 2;
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DCaracalVsMonster solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX_N 100
#define INF (1 << 21)
int cost[MAX_N][MAX_N];
int rc[MAX_N+1];

int main() {
  int n; cin >> n;
  for(int i=0;i<n;i++) {
    int tmp;
    if(i==0) {
      cin >> rc[i] >> rc[i+1];
    }
    else {
      cin >> tmp >> rc[i+1];
    }
  }

  // cost[i][i] = 0
  /*
  for(int i=0;i<n;i++) {
    cost[i][i] = 0;
  }
  */
  // cost[i][i+1] = rc[i]*rc[i+1]*rc[i+2]
  for(int i=0;i<n-1;i++) {
    cost[i][i+1] = rc[i]*rc[i+1]*rc[i+2];
  }
  // calculation cost[i][i+j]
  for(int j=2;j<n;j++) {
    for(int i=0;i+j<n;i++) {
      cost[i][i+j] = INF;
      for(int k=i+1;k<=i+j;k++) {
        cost[i][i+j] = min(cost[i][i+j], cost[i][k-1] + cost[k][i+j] + rc[i]*rc[k]*rc[i+j+1]);
      }
    }
  }

  cout << cost[0][n-1] << endl;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e9
#define MOD 1000000007

string conv(ll x)
{

    string ret;
    while(1)
    {

        if(x==0) break;
        ll z = x%10;
        ret+='0'+z;
        x/=10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

string id(ll p, ll x)
{

    ll digp = 0, digx = 0;
    ll pp = p, xx = x;
    while(1)
    {

        if(pp==0) break;
        digp++;
        pp/=10;
    }
    while(1)
    {

        if(xx==0) break;
        digx++;

        xx/=10;
    }
    digp = 6-digp;
    digx = 6-digx;
    string P, X, ret;
    string pr, xr;
    pp = p, xx = x;
    pr = conv(pp);
    xr = conv(xx);
    for(ll i = 0; i < digp; i++) P+='0';
    for(ll i  =0; i < digx; i++) X+='0';
    X+=xr, P+=pr;
    ret = P+X;
    return ret;
}

int main()
{

    ll n, m;
    cin >> n >> m;
    vector<ll> v[n+5];
    vector<pll> ct;
    for(ll i = 1;i <= m; i++)
    {

        ll vv, yy;
        cin >> vv >> yy;
        v[vv].pb(yy);
        ct.pb(mp(vv, yy));
    }
    for(ll i  =1; i <= n; i++) sort(v[i].begin(), v[i].end());
    for(ll i = 0; i < ct.size(); i++)
    {

        ll p = ct[i].ff, y = ct[i].ss;
        ll x = lower_bound(v[p].begin(), v[p].end(), y)-v[p].begin();
        x++;
        string ans = id(p,x);
        cout << ans << endl;
    }
}


Measured memory_bytes: 8560
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //c
  int n, m;
  cin >> n >> m;
  vector<int> ans(n, -1);
  for (int i = 0; i < m; i++) {
    int s, c;
    cin >> s >> c;
    s--;
    if (ans[s] != -1 && ans[s] != c) {
      cout << -1 << endl;
      return 0;
    }
    ans[s] = c;
  }
  if (ans[0] == 0 && n > 1) {
    cout << -1 << endl;
    return 0;
  }
  if (n == 1 && ans[0] == -1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cout << (ans[i] != -1 ? ans[i] : (i == 0 ? 1 : 0));
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	int N;
	cin >> N;
	int sum = 0;
	int m = 1 << 30;
	for (int i = 0; i < N; i++) {
		int s;
		cin >> s;
		sum += s;
		if (s % 10 != 0) m = min(m, s);
	}
	if (sum % 10 != 0) {
		cout << sum << endl;
		return 0;
	}
	if (m == 1 << 30) {
		cout << 0 << endl;
		return 0;
	}
	cout << sum - m << endl;
 }

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
 
int main(){
    int i,j;
    int n;
    int num[1000000];
    
    for(i=0;i<1000000;i++){
        num[i]=1;
    }
    num[0]=num[1]=0;
     
    for(i=2;i<sqrt(1000000);i++){                   //??¨???????????????????????????2*2,2*3,???????¶???????3*3,3*4,???????¶????????????¨??????????\????i??????????????§??????1000000?????????????????§?¶?????????°?´???°?????????1????????????
        if(num[i]==1){
            for(j=i*i;j<1000000;j+=i) num[j]=0;
        }
    }
    for(i=1;i<1000000-1;i++){                       //?????????num????????????????¶????????????????????????¨???i??\???????´???°?????°???????????????
        num[i+1]+=num[i];
    }
    while(scanf("%d",&n)!=EOF){
        printf("%d\n",num[n]);
    }
     
    return 0;
}

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

int frog1(vector<int> stones){
    queue<pair<int,int>> saltos; //pair(costo acumulado, indice)
    saltos.push(make_pair(0,0));
    while(saltos.front().second+1 < stones.size()){
        int indx = saltos.front().second;
        int costoAnterior = saltos.front().first;
        saltos.pop();
        int costo = abs(stones[indx]-stones[indx+1]) + costoAnterior;
        if(saltos.empty()) saltos.push(make_pair(costo,indx+1));
        else if(saltos.front().first > costo) saltos.front().first = costo;
        if(indx+2 < stones.size()){
            costo = abs(stones[indx]-stones[indx+2]) + costoAnterior;
            saltos.push(make_pair(costo,indx+2));
        }
    }
    return saltos.front().first;
}

int main(){
    int n, s;
    cin >> n;
    vector<int> stones;
    for(int i=0; i<n; i++){
        cin >> s;
        stones.push_back(s);
    }
    cout << frog1(stones);
}

Measured memory_bytes: 1144
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;

int main()
{
	fastio;
	int i,n,k,d,x;
	set<int> s;
	cin>>n>>k;
	for(i=0;i<k;i++)
	{
		cin>>d;
		while(d--)
		{
			cin>>x;
			s.insert(x);
		}
	}
	cout<<n-s.size();
	return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>

int main(void)
{
	int n, a, b, c;
	
	scanf( "%d", &n );
	for( ; n>0; n-- ) {
		scanf( "%d %d %d", &a, &b, &c );
		if( a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a)
			printf( "YES\n" );
		else
			printf( "NO\n" );
	}
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define INF 1e9+7

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

	cout << (n+1)/2*(n/2)  <<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,i,l;
	cin>>n;
	long long a[n+1]={0};
	
	for(i=0;i<n-1;i++)
	{
		cin>>l;
		a[l]++;
	}
	
	for(i=1;i<=n;i++)
	{
		cout<<a[i]<<"\n";
	}
	
}

Measured memory_bytes: 5128