akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        int[] a = new int[N];
        int max = 0;
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            max = Math.max(max, a[i]);
        }
        int[] lcm = new int[1000009];
        List<Integer> prime = primeList((int)Math.sqrt(max)*2);
        for (int i = 0; i < N; i++) {
            int n = a[i];
            for (int p : prime) {
                int cnt = 0;
                while (n % p == 0) {
                    cnt++;
                    n /= p;
                }
                lcm[p] = Math.max(lcm[p], cnt);
                if (p * p > n)
                    break;
            }
            if (n != 1) {
                lcm[n] = Math.max(lcm[n], 1);
                if(!prime.contains(n))prime.add(n);
            }
        }

        for (int i = 0; i < N; i++) {
            int n = a[i];
            long pls = 1;
            for (int p : prime) {
                int cnt = 0;
                // System.out.println(lcm[p]);
                if (lcm[p] > 0) {
                    while (n % p == 0) {
                        n /= p;
                        cnt++;
                    }
                    pls *= pow(p, lcm[p] - cnt);
                    pls %= MOD;
                }
            }
            ans += pls;
            ans %= MOD;
            // System.out.println(ans);
        }
        // System.out.println(Arrays.toString(prime.toArray()));
        System.out.println(ans);
    }

    private static List<Integer> primeList(int max) {
        final List<Integer> prime = new ArrayList<Integer>();
        prime.add(2);
        for (int i = 3; i <= max; i += 2) {
            for (int wari : prime) {
                if (i % wari == 0)
                    break;
                if (wari * wari > i) {
                    prime.add(i);
                    break;
                }
            }
        }
        return prime;
    }

    public static long pow(long x, long n) {
        long sum = 1;
        while (n > 0) {
            if ((n & 1) == 1) {
                sum = sum * x % MOD;
            }
            x = x * x % MOD;
            n >>= 1;
        }
        return sum;
    }
}


Measured memory_bytes: 36172
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string s;
int main()
{
	cin >> s;
	int len = s.length();
	int res = len;
	for (int i = 1; i < len; i++)
	{
		if (s[i] != s[i - 1])
			res = min(res,max(i,len-i));
	}
	printf("%d\n", res);
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll n;cin>>n;
  ll s[n];
  ll sum=0;
  set<ll>se;
  ll mi=mod;
  rep(i,0,n){
    cin>>s[i];
    sum+=s[i];
    if(s[i]%10!=0)chmin(mi,s[i]);
  }
  if(mi==mod)out(0);
  else if(sum%10==0)out(sum-mi);
  else out(sum);





  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
char s[N];
int n, sum[N], f[(1<<26)];
int main(){
	scanf( "%s", s + 1 );
	n = strlen( s + 1 );
	for( int i = 1; i <= n; i++ ) sum[i] = sum[i-1] ^ (1<<(s[i]-'a')); 
	memset(f,0x3f,sizeof(f)); f[0] = 0;
	for( int i = 1; i <= n; i++ )
		for( int j = 0; j < 26; j++ )
			f[sum[i]] = min( f[sum[i]], f[sum[i]^(1<<j)] + 1 );
	printf( "%d\n", max( f[sum[n]], 1 ) );
	return 0;
}

Measured memory_bytes: 263424
#include<bits/stdc++.h>
using namespace std;
int num[1000005],tree[1000005],vis[1000005],ans[1000005];
int n,q;
struct node{
    int l,r,pos;
}ask[1000005];
bool cmp(node x,node y){
    return x.r<y.r;
}
int lowbit(int x){
    return x&(-x);
}
void add(int x,int p){
    while(x<=n){
        tree[x]+=p;
        x+=lowbit(x);
    }
}
int sum(int x){
    int ans=0;
    while(x!=0){
        ans+=tree[x];
        x-=lowbit(x);
    }
    return ans;
}
int main(){
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++)
        scanf("%d",&num[i]);
    for(int i=1;i<=q;i++){
        scanf("%d%d",&ask[i].l,&ask[i].r);
        ask[i].pos=i;
    }
    sort(ask+1,ask+q+1,cmp);
    int next=1;
    for(int i=1;i<=q;i++){
        for(int j=next;j<=ask[i].r;j++){
            if(vis[num[j]]) 
                add(vis[num[j]],-1);
            add(j,1);
            vis[num[j]]=j;
        }
        next=ask[i].r+1;
        ans[ask[i].pos]=sum(ask[i].r)-sum(ask[i].l-1);
    }
    for(int i=1;i<=q;i++)
        printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 17428
N,A,B = [int(x) for x in  input().split()]
ans =0

for i in range(1,N+1):
        a=i%10
        b=(i//10)%10
        c=(i//100)%10
        d=(i//1000)%10
        e=(i//10000)%10
    
        if A<=(a+b+c+d+e)<=B :
            ans +=i
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    multiset<int> st;

    rep(i,n) {
        if (st.empty()) {
            st.insert(a[i]);
        }
        else {
            auto itr = st.lower_bound(a[i]);
            if (itr==st.begin()) st.insert(a[i]);
            else {
                --itr;
                st.erase(itr);
                st.insert(a[i]);
            }
        }
    }
    
    cout << st.size() << '\n';
    return 0;
}

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

using namespace std;

bool search_d(int i, const vector<int> &d) {
  while (0 < i) {
    int target = i % 10;
    if (binary_search(d.begin(), d.end(), target)) {
      return true;
    }
    i /= 10;
  }
  return false;
}

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

  int n, k;
  cin >> n >> k;
  vector<int> d(k);
  for (auto &e : d) {
    cin >> e;
  }
  sort(d.begin(), d.end());
  for (int i = n;; ++i) {
    if (!search_d(i, d)) {
      cout << i << "\n";
      break;
    }
  }
}


Measured memory_bytes: 256
'use strict'

const main = (input) => {
    const A = parseInt(input.split(' ')[0])
    const B = parseInt(input.split(' ')[1])
    if(A + B < 10){
        console.log(A + B)
    }else{
        console.log('error')
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 11340
#include <bits//stdc++.h>
using namespace std;
int main(void){
    int a,b,c,i,j,t,p,k;
    cin>>a;
    for(i=0;i<a/4+1;i++){
        for(j=0;j<a/7+1;j++){
            if(i*4+j*7==a){
            cout<<"Yes"<<endl;
            return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;

int main(){
  int N; cin >> N ;
   string S; cin >> S; int max_cnt = 0;
  for(int i = 1; i < N - 2 ; i++){
    string X, Y; int cnt = 0;
    X = S.substr(0,i);Y = S.substr(i, N - i);
    int alphabet[26] = {0};
    for(int x = 0; x < i; x++){
      if(alphabet[X[x] - 'a'] == 0){alphabet[X[x] - 'a']++;}}
    for(int y = 0; y < N - i; y++){
      if(alphabet[Y[y] - 'a'] == 1){ cnt++; alphabet[Y[y] - 'a'] = -1;}}
    //これだとダブっている色を数えているかもしれない
    max_cnt = max(max_cnt,cnt);}
    
  
  cout << max_cnt << endl;
   return 0;}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
int a , b, c, d, e, k ;
cin >> a>> b>>c>>d>>e>>k;
if(b-a<=k&& c-b<=k &&c-a<=k&& d-c<=k &&d-b<=k&& d-a<=k&& e-d<=k&&e-c<=k &&e-b<=k&&e-a<=k)
    cout <<"Yay!";
else
    cout <<":(";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int h, w;
  scanf( "%d %d", &h, &w);
  char c[h+2][w+2];
  int lr[h+2][w+2], ud[h+2][w+2];
  
  for (int i=0; i<h+2; i++) {
    for (int j=0; j<w+2; j++) {
      c[i][j] = '#';
    }
  }
  for (int i=1; i<h+1; i++) {
    char str[w+1];
    scanf("%s", str);
    for (int j=1; j<w+1; j++) {
      c[i][j] = str[j-1];
    }
  }
  for (int i=1; i<h+1; i++) {
    int cnt = 0;
    for (int j=1; j<w+1; j++) {
      if (c[i][j]=='.') {
        cnt++;
      } else {
        cnt = 0;
      }
      lr[i][j] = cnt;
    }
    cnt = 0;
    for (int j=w; j>0; j--) {
      if (lr[i][j]==0) {
        cnt = 0;
      } else if (cnt==0) {
        cnt = lr[i][j];
      } else {
        lr[i][j] = cnt;
      }
    }
  }
  for (int j=1; j<w+1; j++) {
    int cnt = 0;
    for (int i=1; i<h+1; i++) {
      if (c[i][j]=='.') {
        cnt++;
      } else {
        cnt = 0;
      }
      ud[i][j] = cnt;
    }
    cnt = 0;
    for (int i=h; i>0; i--) {
      if (ud[i][j]==0) {
        cnt = 0;
      } else if (cnt==0) {
        cnt = ud[i][j];
      } else {
        ud[i][j] = cnt;
      }
    }
  }

  int ans = 0;
  for (int i=1; i<h+1; i++) {
    for (int j=1; j<w+1; j++) {
      int cnt = lr[i][j] + ud[i][j];
      if (ans<cnt) {
        ans = cnt;
      }
    }
  }
  ans -= 1;
  printf ("%d", ans);
  
  return 0;
}

Measured memory_bytes: 35328
#include <bits/stdc++.h>
using namespace std;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
int main() {
  
  string n;
  cin >> n;
  int s=0;
  int t = n.size();
  for(int i = 0; i < t ; i++){
    s += ctoi(n.at(i));
  }
  if( s % 9 == 0 )
    cout << "Yes" << endl;
  else 
    cout << "No" << endl;
}

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

using namespace std;

const int INF = 1 << 30;
const vector<int> dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W, K;
  cin >> H >> W >> K;
  int sx, sy, gx, gy;
  // cin >> sx >> sy >> gx >> gy;
  cin >> sy >> sx >> gy >> gx;
  sx--, sy--, gx--, gy--;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }
  vector<vector<int>> D(H, vector<int>(W, INF));
  D[sy][sx] = 0;
  priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,
                 greater<pair<int, pair<int, int>>>>
      que;
  que.push(make_pair(0, make_pair(sy, sx)));
  while (!que.empty()) {
    auto q = que.top();
    que.pop();
    int d = q.first, y = q.second.first, x = q.second.second;
    if (d > D[y][x]) continue;
    for (int i = 0; i < 4; i++) {
      int ny = y, nx = x;
      for (int k = 0; k < K; k++) {
        ny += dy[i], nx += dx[i];
        if (ny < 0 || ny >= H || nx < 0 || nx >= W) break;
        if (S[ny][nx] == '@') break;
        if (chmin(D[ny][nx], d + 1)) {
          que.push(make_pair(D[ny][nx], make_pair(ny, nx)));
        } else if (D[ny][nx] != d + 1) {
          break;
        }
      }
    }
  }
  if (D[gy][gx] == INF) {
    cout << -1 << '\n';
  } else {
    cout << D[gy][gx] << '\n';
  }
  return 0;
}


Measured memory_bytes: 12132
#include <stdio.h>
int main()
{

  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);

  if(a<=b&&b<=c) printf("%d %d %d\n",a,b,c);
  else if(a<=c&&c<=b) printf("%d %d %d\n",a,c,b);
  else if(b<=a&&a<=c) printf("%d %d %d\n",b,a,c);
  else if(b<=c&&c<=a) printf("%d %d %d\n",b,c,a);
  else if(c<=a&&a<=b) printf("%d %d %d\n",c,a,b);
  else if(c<=b&&b<=a)printf("%d %d %d\n",c,b,a);

  return 0;
  }
 

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

int main() {
  long n, m = 1, l = 0, k;
  cin >> n; k = n;
  for (int i = 1; i < to_string(n).length(); i++) m *= 10;
  for (int i = 0; i < to_string(n).length(); i++) {
    l += k % 10;
    k /= 10;
  }
  cout << (n / m + 9 * (to_string(n).length() - 1) == l ? l : n / m - 1 + 9 * (to_string(n).length() - 1)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0); cin.tie(0);
#define FL(i,a,n) for(ll i=a;i<n;i++)
#define even(x) (((x)%(2))==(0))
#define odd(x) (((x)%(2))==(1))
#define meme(x) memset(x, 0, sizeof(x))

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
	
int main()
{
    speed;
    int n;cin>>n;
    int a[n];
    ll ans=0;
    for(int i=0;i<n;i++)
    {
	    cin>>a[i];
    }

    for(int i=1;i<n;i++)
    {
	    if(a[i]<a[i-1])
	    {
		    ans+=a[i-1]-a[i];
		    a[i]=a[i-1];
	    }
    }

    cout<<ans<<endl;
    


}
	
	


Measured memory_bytes: 4408
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define PER(i,b,a) for(ll i=b;i>a;i--)
#define forit(it,x) for(auto it=(x).begin();it!=(x).end();++it)
#define ull unsigned long long int
#define ld long double
#define prec(n) fixed<<setprecision(n)
#define test ll t; cin>>t; while(t--)
#define re return 0
#define pb push_back
#define PI 3.1415926535897932384626
#define MOD (ll)1000000007
#define fi first
#define se second
#define eb emplace_back
#define vll vector<ll>
#define vi  vector<int>
#define mpll map<ll,ll>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)
const ll MAXI = (ll)1e9+7;
int main(){
    IOS;
//    test{
        int a;
        cin>>a;
/*        int a[n];
        REP(i,n){
           cin>>a[i];
        }
        */
        cout<<a*(1+a+a*a)<<"\n";
//    }
re;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<stdbool.h>

#define MAX 1000
#define VMAX 10000

int j,n,s;
int A[MAX];
int B[MAX];
int T[VMAX+1];

void Sort(int C[]){
	int flag=1;
	int temp;
	while(flag==1){
		flag=0;
		for(j=n-1; j>=1;j--){
			if(C[j]<C[j-1]){
				temp=C[j-1];
				C[j-1]=C[j];
				C[j]=temp;
				flag=1;
			}
		}
	}
}

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

int solve(){
	int ans=0;
	int i;
	bool V[MAX];
	
	for(i=0;i<n;i++){
		B[i]=A[i];
		V[i]=false;
	}
	Sort(B);
	for(i=0;i<n;i++){
		T[B[i]]=i;
	}
	
	for(i=0;i<n;i++){
		if(V[i])continue;
		int cur=i;
		int S=0;
		int m=VMAX;
		int an=0;
		while(1){
			V[cur]=1;
			an++;
			int v=A[cur];
			m=min(m,v);
			S+=v;
			cur=T[v];
			if(V[cur]){break;}
		}
		ans+=min(S+(an-2)*m,m+S+(an+1)*s);
	}
	
	return ans;
}

int main(void){
	int i,ans;
	scanf("%d",&n);
	
	s=VMAX;
	
	for(i=0; i<n; i++){
		scanf("%d",&A[i]);
		s=min(s,A[i]);
	}
	
	ans=solve();
	
	printf("%d\n",ans);
	
	return 0;
}


Measured memory_bytes: 2108
def main():
    n = int(input())
    s = input()
    if n < 4:
        print(0)
        return
    ans = s.count("R") * s.count("G") * s.count("B")

    for i, si in enumerate(s[:-2]):
        for j, sj in enumerate(s[i+1:-1]):
            if si == sj:
                continue

            if i + 2*j+2 < n and si != s[i + 2*j+2] != sj:
                ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67968
#include <bits/stdc++.h>
#define N 1000000007
using namespace std;
#define MAX 500000
long long factorial[MAX] = {0}, finverse[MAX] = {0},
          inverse[MAX] = {0};

void smodfact() {
  factorial[0] = factorial[1] = 1;
  finverse[0] = finverse[1] = 1;
  inverse[1] = 1;
  for(int i = 2; i < MAX; ++i) {
    factorial[i] = factorial[i - 1] * i % N;
    inverse[i] = N - (inverse[N % i] * (N / i)) % N;
    finverse[i] = finverse[i - 1] * inverse[i] % N;
  }
}

long long calccomb(long long n, long long k) {
  if(n == k && n == 0) return 1;
  if(n < 0 || k < 0 || n < k) return 0;
  return factorial[n] * finverse[k] % N * finverse[n - k] %
         N;
}

long long n, x, fin = 0;
vector<long long> s;
long long dp[202][100005] = {0};
long long solve();

int main() {
  smodfact();
  cin >> n >> x;
  s.resize(n);
  for(int i = 0; i < n; ++i) cin >> s[i];
  sort(s.begin(), s.end(), greater<long long>());
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  dp[0][x] = 1;
  fin = x;
  for(int i = 0; i < n; ++i)
    for(int j = 0; j <= fin; ++j) {
      long long now = j;
      dp[i + 1][j] = dp[i][j] * (n - i - 1) % N;
      if(j < s[i])
        while(now <= fin) {
          dp[i + 1][j] += dp[i][now];
          now += s[i];
        }
    }
  for(int i = 1; i < s[n - 1]; ++i) {
    ans += dp[n][i] * i % N;
    ans %= N;
  }
  return ans;
}


Measured memory_bytes: 168960
#include <stdio.h>
#include <math.h>


int main(){


int N,D,i,j,a,b,c,keta,count, r;

count=0;
keta=9;


scanf("%d%d", &N,&D);

a=2*D+1;

b=N/a;

if((N%a) != 0){b=b+1;}


   




printf("%d",b);



     
    
   return(0);
}



Measured memory_bytes: 128
import Control.Monad

isLightOn :: [Int] -> Int -> [Int] -> Bool
isLightOn k p s =
    let chk = if p == 0 then even else odd
        cnt = length . filter (==1) $ map (\i -> s !! (i-1)) k
    in chk cnt

solve :: [[Int]] -> [Int] -> [[Int]] -> Int
solve kk pp ss = length . filter (==True) $ map isAllOn ss
  where
    isAllOn s = all (\(k,p) -> isLightOn k p s) (zip kk pp)

main :: IO ()
main = do
    [n,m] <- map read . words <$> getLine :: IO [Int]
    k <- replicateM m $ tail . map read . words <$> getLine :: IO [[Int]]
    p <- map read . words <$> getLine :: IO [Int]
    print $ solve k p (replicateM n [0,1])

Measured memory_bytes: 1020
#include <cstdio>
#include <unordered_set>
const int MAXN = 1005;
int A[MAXN][MAXN];
int dex[MAXN];
int P[MAXN];
int N;
std::unordered_set<int> cur, nxt;

void init() {
  cur.clear();
  nxt.clear();
  for (int i = 1; i <= N; ++i) {
    dex[i] = 1;
  }
}

void push_next(int k) {
  if (dex[k] >= N) return;
  P[k] = A[k][dex[k]];
  if ((k == P[P[k]]) &&
      !nxt.count(k) &&
      !nxt.count(P[k])) {
    nxt.insert(k);
  }
}

int solve() {
  for (int i = 1; i <= N; ++i) push_next(i);
  cur = std::move(nxt);
  nxt.reserve(cur.size());

  int ret = 0;
  while (!cur.empty()) {
    for (auto a: cur) {
      int b = P[a];
      ++dex[a];
      ++dex[b];
      push_next(a);
      push_next(b);
    }
    cur = std::move(nxt);
    nxt.reserve(cur.size());
    ++ret;
  }
  for (int i = 1; i <= N; ++i) {
    if (dex[i] != N) {
      return -1;
    }
  }
  return ret;
}

int main() {
  scanf("%d", &N);
  init();
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j < N; ++j) {
      scanf("%d", &A[i][j]);
    }
  }
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 4224
N = int(input())
A = [int(i) for i in input().split()]


def num_two_div(a):
    n = a
    for i in range(a):
        if n % 2 == 0:
            n //= 2
        else:
            return i
    raise Exception

count = 0
for a in A:
    # print(num_two_div(a))
    count += num_two_div(a)

print(count)

Measured memory_bytes: 4148
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Console.WriteLine(Solve());
		Out.Flush();
	}
	long Solve()
	{
		var N = F();
		var x = new long[N];
		var s = new int[N];
		var sum = new long[N];
		for (int i = 0; i < N; i++)
		{
			var I = GL();
			x[i] = I[0];
			s[i] = (int)I[1];
			if (i == 0) sum[i] = s[i];
			else sum[i] = sum[i - 1] + s[i];
		}
		for (int i = 0; i < N; i++) sum[i] -= x[i];
		var max = new long[N];
		max[N - 1] = sum[N - 1];
		for (var i = N - 2; i >= 0; i--) max[i] = Max(max[i + 1], sum[i]);
		var ans = 0L;
		for (var i = 0; i < N; i++) ans = Max(ans, max[i] - sum[i] + s[i]);
		return ans;
	}
}


Measured memory_bytes: 22660
N = int(input())
A = [input() for i in range(N)]

d = dict()
m = 1

for i in range(N):
    if A[i] in d:
        d[A[i]] = d[A[i]] + 1
        if m < d[A[i]]:
            m = d[A[i]]
    else:
        d[A[i]] = 1

ans = []
keys = list(d.keys())

for i in range(len(keys)):
    if m == d[keys[i]]:
        ans.append(keys[i])

ans.sort()
[print(ans[i]) for i in range(len(ans))]

Measured memory_bytes: 35596
/*My CSP has exploded*/
/*ABC146*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<vector>
#include<queue>
using namespace std;

#define LL long long
#define DB double
#define MAXN 10000
#define MAXK 50
#define mem(x,p) memset(x,p,sizeof(x))

LL read(){
  LL x=0,F=1;char c=getchar();
  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}

int n,len;char s[MAXN+5];
int main()
{
    n=read();
    scanf("%s",s+1);
    len=strlen(s+1);
    for(int i=1;i<=len;i++)
    printf("%c",(s[i]-'A'+n)%26+'A');
}


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

int main(){
    int X, N;
    cin >> X >> N;
    
    int ans = X;
    int ans_up = X;
    int ans_down = X;
    bool first_flag = false;
    bool up_flag = false;
    bool down_flag = false;

    int p[N];

    for (int i = 0; i < N; i++){
        cin >> p[i];
        if (p[i] == X){
            first_flag = true;
        }
    }

    if (first_flag == false){
        cout << ans << endl;
    }

    if (first_flag == true){
        for (int i = 0; i < 100; i++){
            ans_up += 1;
            ans_down -= 1;

            for (int j = 0; j < N; j++){
                if (p[j] == ans_down){
                    down_flag = true;
                    break;
                }
                else {
                    down_flag = false;
                }
            }
            
            for (int k = 0; k < N; k++){
                if (p[k] == ans_up){
                    up_flag = true;
                    break;
                }
                else {
                    up_flag = false;
                }
            }

            if (down_flag == false){
                cout << ans_down << endl;
                break;
            }
            else if (up_flag == false){
                cout << ans_up << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Scanner;




//D
public class Main {

	static int N;
	static int Q;
	static ArrayList<Integer>[] v;
	static int[] ans;
	static int[] parent;
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		N=sc.nextInt();
		Q=sc.nextInt();
		v=new ArrayList[N+1];
		ans=new int[N+1];
		parent=new int[N+1];
		for(int i=1;i<=N;i++) {
			v[i]=new ArrayList<Integer>();
		}
		for(int i=1;i<=N-1;i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			v[a].add(b);
			parent[b]=a;

		}

		for(int i=0;i<Q;i++) {
			int p=sc.nextInt();
			int q=sc.nextInt();
			ans[p]+=q;
		}


		for(int i=2;i<=N;i++) {

			int pi=parent[i];
			System.err.println("i pi "+i+" "+pi);

			if(pi!=0) {ans[i]+=ans[pi];}

		}

		for(int i=1;i<=N;i++) {
			System.out.print(ans[i]+" ");
		}
		System.out.println();
	}

}


Measured memory_bytes: 229812
n = int(input())
h = list(map(int, input().split()))

h[0] -= 1
for i in range(1, n):
    if h[i - 1] < h[i]:
        h[i] -= 1
    elif h[i - 1] == h[i]:
        pass
    else:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 20612
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    long[][] memo; //今まで払ってきたコスト
    int N;
    long[] A;
    long calc(int a, int b)
    {
        if (memo[a][b] >= 0)
        {
            return memo[a][b];
        }

        var ret = long.MaxValue;
        var sum = A[b];
        for (int i = a; i < b; i++)
        {
            chmin(ref ret, calc(a, i) + calc(i + 1, b));
            sum += A[i];
        }

        return memo[a][b] = sum + ret;
    }

    void solve()
    {
        N = cin.nextint;
        A = cin.scanlong;
        memo = new long[N][];
        for (int i = 0; i < N; i++)
        {
            memo[i] = new long[N];
            for (int j = 0; j < N; j++)
            {
                if (i != j) memo[i][j] = -1;
            }
        }

        WriteLine(calc(0, N - 1));

        //for (int i = 0; i < N; i++)
        //{
        //    cin.join(memo[i]);
        //}
    }

}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
    public void join<T>(IEnumerable<T> values) { WriteLine(string.Join(" ", values)); }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 200000
#define N 262144
#define INF 0x3FFFFFFF
#define mp make_pair
int t[N*2+5],t1[N*2+5],t2[N*2+5],p[MN+5];
priority_queue< pair< pair<int,int>,pair<int,int> > > pq;
void build(int*t){for(int i=N;--i;)t[i]=min(t[i<<1],t[i<<1|1]);}
int query(int*t,int l,int r)
{
	int res=INF;
	for(l+=N-1,r+=N+1;l^r^1;l>>=1,r>>=1)
	{
		if(~l&1)res=min(res,t[l+1]);
		if( r&1)res=min(res,t[r-1]);
	}
	return res;
}
void push(int l,int r)
{
	if(l>r)return;
	int x=query(l&1?t1:t2,l,r),y=query(l&1?t2:t1,p[x]+1,r);
	pq.push(mp(mp(-x,y),mp(l,r)));
}
int main()
{
	int n=read(),i,x,y,l,r;
	for(i=1;i<=n;++i)
	{
		p[x=read()]=i;
		t[i+N]=x;t1[i+N]=i&1?x:INF;t2[i+N]=i&1?INF:x;
	}
	build(t);build(t1);build(t2);push(1,n);
	while(!pq.empty())
	{
		x=-pq.top().first.first;
		y=pq.top().first.second;
		l=pq.top().second.first;
		r=pq.top().second.second;
		printf("%d %d ",x,y);pq.pop();
		push(l,p[x]-1);push(p[x]+1,p[y]-1);push(p[y]+1,r);
	}
}

Measured memory_bytes: 8952
#include<bits/stdc++.h>
#define N 100005
using namespace std;
inline int read(){
    int ans=0;
    char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
    return ans;
}
int n,x[N];
inline int gcd(int a,int b){while(b){int t=a;a=b,b=t%a;}return a;}
int main(){
    n=read()+1;
    for(int i=1;i<=n;++i)x[i]=read();
    sort(x+1,x+n+1);
    int g=x[2]-x[1];
    for(int i=3;i<=n;++i)g=gcd(g,x[i]-x[i-1]);
    cout<<g;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
struct program
{
	int s,t,c;
};
int N,C;
int recoder[222222];
int recoding[222222];
int res = 0;
int main(void) 
{
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	program p;
	vector <program> v;
 
	cin >> N >> C;
 
	for(int i=0;i<N;i++)
	{
		cin >> p.s >> p.t >> p.c;
		v.push_back(p);
	}
 	
 	for(int i=1;i<=C;i++)
 	{
 		memset(recoding,0,sizeof(recoding));
 		for(int j=0;j<N;j++)
 		{
 			if(v[j].c==i)
 			{
 				recoding[2*v[j].s - 1]++;
 				recoding[2*v[j].t]--;
 			}
 		}
 		for(int j=1;j<=200010;j++)
 		{
 			recoding[j] += recoding[j-1];
 		}

 		for(int j=0;j<=200010;j++)
 		{
 			if(recoding[j]>0)
 			{
 				recoder[j]++;
 			}
 		}
 	}
	
	for(int j=0;j<=200010;j++)
	{
		res = max(res,recoder[j]);
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 3188
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

D = lines[0][0]
Inf = 10 ** 10

last_date = []
for i in 1..26 do
  last_date.push(0)
end

def try(lines,last_date,bias,final)
  satis = 0
  for i in 1..D do
    max_satis = - Inf
    best_contest = 0
    for k in 1..26 do
      now_satis = 0
      now_satis += lines[i+1][k-1]
      now_satis += lines[1][k-1] * (i - last_date[k-1]) * bias
      if now_satis > max_satis then
        max_satis = now_satis
        best_contest = k
      end
    end
    satis += max_satis
    satis += lines[1][best_contest-1] * (i - last_date[best_contest-1])
    last_date[best_contest-1] = i
    if final then
      if i < D then
        puts best_contest
      else
        print best_contest
      end
    end
  end
  return satis
end

# Normal Case: bias = 1
bias = 0.0
best_bias = 0.0
best_satis = - Inf
300.times do |num|
  current_satis = try(lines,last_date,bias,false)
  if current_satis > best_satis then
    best_satis = current_satis
    best_bias = bias
  end
  bias += 0.01
end
try(lines,last_date,best_bias,true)

Measured memory_bytes: 14172
#include <stdio.h>
int main(void){
	int i=0,b;
	char x[1000];
	scanf("%s",&x);
	while(x[0]!='0'){
		i=0;
		b=0;
	
	while(x[i]){
		b+=x[i]-'0';
		i++;
	}
	printf("%d\n",b);
	scanf("%s",&x);
		
	
	}
	return 0;
}

Measured memory_bytes: 536
N = int(input())
S = [input() for _ in range(N)]

sdict = [{c:s.count(c) for c in s} for s in S]
c = [ "".join( [c+str(sd[c]) for c in 'abcdefghijklmnopqrstuvwxyz' if c in sd] ) for sd in sdict ]

sdictc = {}
maxSdictc = 0
for cc in c:
    #print(cc)
    if cc in sdictc:
        maxSdictc += sdictc[cc]
        sdictc[cc] += 1
    else:
        sdictc[cc] = 1

print(maxSdictc)

Measured memory_bytes: 76468
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
i=0
new_h=[]
if n<=k:
  print(0)
else:
  for item in h:
    i=i+1
    if i>k:
      new_h.append(item)
  print(sum(new_h))

Measured memory_bytes: 26024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            int[][] dist = new int[n][n];
            for (int i = 0; i < n; i++) {
                dist[i] = in.nextIntArray(n);
            }

            boolean[][] notNeed = new boolean[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        if (i == j || j == k || k == i) continue;

                        if (dist[j][k] > dist[j][i] + dist[i][k]) {
                            out.println(-1);
                            return;
                        } else if (dist[j][k] == dist[j][i] + dist[i][k]) {
                            notNeed[j][k] = true;
                            notNeed[k][j] = true;
                        }
                    }
                }
            }

            long ans = 0;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (!notNeed[i][j]) ans += dist[i][j];
                }
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 33332
#include <stdio.h>

int main(void){
	int x;  /* 変更前の消費税率 % */
	int y;  /* 変更後の消費税率 % */
	int s;  /* 消費税率変更前の 2 商品の税込合計価格 */
	int a, b, a0, b0, total, max;

	while(scanf("%d %d %d", &x, &y, &s) == 3){
		if (x == 0 && y == 0 && s == 0){
			break;
		}

		max = 0;

		/* すべての場合について計算し最大価格を求める */
		for (a = 1; a <= s / 2; a++){
			b = s - a;

			a0 = a * 100 / (100 + x);
			b0 = b * 100 / (100 + x);

			/* 個々の商品の税抜価格について、とりうる最大値を求める */
			while ((a0 + 1) * (100 + x) / 100 <= a){
				a0++;
			}
			while ((b0 + 1) * (100 + x) / 100 <= b){
				b0++;
			}

			/* 変更前の合計金額が成立しない組み合わせは棄却する */
			if (a0 * (100 + x) / 100 + b0 * (100 + x) / 100 != s){
				continue;
			}

			/* 変更後の合計金額を計算する */
			total = a0 * (100 + y) / 100 + b0 * (100 + y) / 100;

			/* 最大値を判定する */
			if (total > max){
				max = total;
			}
		}

		/* 出力 */
		printf("%d\n", max);
	}

    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ull unsigned long long
# define lli long long int
#define ll long long
#define db double
#define ldb long double
#define vi vector<int>
#define vull vector<ull>
#define vll vector<ll>
#define pb push_back
#define si set<int>
#define sll set<ll>
#define ins insert
#define vpp vector<pair<int,int>>
#define mp make_pair
#define ft first
#define sc second
#define mod 1000000007
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
        // #ifndef ONLINE_JUDGE
       // for getting input from input.txt
        //freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        //freopen("output.txt", "w", stdout);
        //#endif
        string s,t;
        cin>>s>>t;
        int n=s.length();
        int tl=t.length();
        int dp[n+1][tl+1];
        for(int i=0;i<=n;i++)dp[i][0]=0;
        for(int i=0;i<=tl;i++)dp[0][i]=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=tl;j++)
            {
                if(s[i-1]==t[j-1])
                {
                    dp[i][j]=dp[i-1][j-1]+1;
                }
                else
                {
                    dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }    
        string ans="";
        int i=n,j=tl;
        while(i!=0 && j!=0)
        {
            if(s[i-1]==t[j-1])
            {
                ans+=s[i-1];
                i--,j--;
            }
            else if(dp[i-1][j]>dp[i][j-1])
                i--;
            else j--;
        }
        reverse(ans.begin(),ans.end());
        cout<<ans;
    return 0;
        }


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

int main(){
    int n;
    cin >> n;
    int i=0;
    while(1){
        i++;
        if(n<=i*1000){
            cout << i*1000-n << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,m;
pii ps[55];
vector < int > res;
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    int i,j,k;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;++i){
		scanf("%d",&ps[i].first);
		ps[i].second=i;
	}
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
	int pr=-1;
	++m;
    while(m--){
		sort(ps,ps+n);
		for(i=n-1;i>=0;--i){
			if(ps[i].second==pr) continue;
			if(ps[i].first<=0){
				printf("-1\n");
				return 0;
			}
			res.push_back(ps[i].second);
			--ps[i].first;
		}
		pr=res.back();
	}
	printf("%d\n",(int)res.size());
	for(i=0;i<(int)res.size();++i) printf("%d ",res[i]+1);
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int x, y, a, b, c;
  
  scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
  
  vector< pair<int, int> > apples(a + b + c);
  for (int i = 0; i < a + b + c; i++) {
    int m;
    scanf("%d", &m);
    int group_id = 0;
    if (i >= a) group_id++;
    if (i >= a + b) group_id++; 
    apples[i] = make_pair(m, group_id);
  }
  
  sort(apples.begin(), apples.end());
  
  long long ans = 0;
  int rcnt = 0, gcnt = 0, tot = 0;
  for (int i = a + b + c - 1; i >= 0; i--) {
    if (apples[i].second == 0 && rcnt < x) {
      ans += apples[i].first;
      rcnt++;
      tot++;
    }
    if (apples[i].second == 1 && gcnt < y) {
      ans += apples[i].first;
      gcnt++;
      tot++;
    }
    if (apples[i].second == 2) {
      ans += apples[i].first;
      tot++;
    }
    if (tot == x + y) break;
  }
  
  printf("%lld\n", ans);
  
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int x=a+b;
  int y=b+c;
  int z=c+a;
  if(x==c || y==a || z==b){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
  return 0;
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  set<int> s;
  int a,b;
  cin >>a>>b;
  int ansa, ansb;
  int ma = ceil(a / 0.08);
  int mb = ceil(b / 0.1);
  for(ansa = ma;;ansa++){
    if(floor(ansa * 0.08) == a){
      s.insert(ansa);
    }
    else
      break;
  }
  for(ansb = mb;;ansb++){
    if(floor(ansb * 0.1) == b){
      if(s.find(ansb) != s.end()){
        cout << ansb << endl;
        break;
      }
    }
    else{
      cout << -1 << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int n=s.size();
	int a=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')a++;
		else if(s[i]==')')a--;
		else cout << a << endl;
	}
}


Measured memory_bytes: 3252
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, R := readInt(), readInt()
	if N < 10 {
		fmt.Println(R + 100*(10-N))
	} else {
		fmt.Println(R)
	}
}


Measured memory_bytes: 640
template<typename T, T MOD>
struct ModInt {
  T number;
  ModInt(T n = 0) : number(n % MOD) {while(number < 0) number += MOD;}
  // ??£??\??????
  ModInt& operator+=(const ModInt& m) {return *this = *this + m;}
  ModInt& operator-=(const ModInt& m) {return *this = *this - m;}
  ModInt& operator*=(const ModInt& m) {return *this = *this * m;}
  ModInt& operator/=(const ModInt& m) {return *this = *this / m;}
  ModInt& operator%=(const ModInt& m) {return *this = *this % m;}
  // ????????????
  friend const ModInt operator+(const ModInt& lhs, const ModInt& rhs) {return lhs.number + rhs.number;}
  friend const ModInt operator-(const ModInt& lhs, const ModInt& rhs) {return lhs.number - rhs.number;}
  friend const ModInt operator*(const ModInt& lhs, const ModInt& rhs) {return lhs.number * rhs.number;}
  friend const ModInt operator/(const ModInt& lhs, const ModInt& rhs) {return lhs.number / rhs.number;}
  friend const ModInt operator%(const ModInt& lhs, const ModInt& rhs) {return lhs.number % rhs.number;}
  // ??¢?????????
  friend bool operator==(const ModInt& lhs, const ModInt& rhs) {return lhs.number == rhs.number;}
  friend bool operator!=(const ModInt& lhs, const ModInt& rhs) {return lhs.number != rhs.number;}
  friend bool operator<=(const ModInt& lhs, const ModInt& rhs) {return lhs.number <= rhs.number;}
  friend bool operator>=(const ModInt& lhs, const ModInt& rhs) {return lhs.number >= rhs.number;}
  friend bool operator<(const ModInt& lhs, const ModInt& rhs) {return lhs.number < rhs.number;}
  friend bool operator>(const ModInt& lhs, const ModInt& rhs) {return lhs.number > rhs.number;}
};
// ??\?????????????????????
#include<iostream>
template<typename T, T MOD> inline std::istream& operator>>(std::istream& is, ModInt<T, MOD>& m) {return is >> m.number;}
template<typename T, T MOD> inline std::ostream& operator<<(std::ostream& os, const ModInt<T, MOD>& m) {return os << m.number;}

#include<bits/stdc++.h>
using namespace std;
int main() {
  int w, h;
  while(cin >> w >> h, w | h) {
    enum {N, E};
    ModInt<int, 100000> dp[102][102][2][2] = {};
    dp[1][1][N][0] = dp[1][1][E][0] = 1;
    for(int i = 1; i <= h; ++i) for(int j = 1; j <= w; ++j) {
      dp[i][j][N][0] += dp[i - 1][j][N][0];
      dp[i][j][N][0] += dp[i - 1][j][N][1];
      dp[i][j][N][1] += dp[i][j - 1][E][0];

      dp[i][j][E][0] += dp[i][j - 1][E][0];
      dp[i][j][E][0] += dp[i][j - 1][E][1];
      dp[i][j][E][1] += dp[i - 1][j][N][0];
    }
    cout << dp[h-1][w][N][0] + dp[h-1][w][N][1] + dp[h][w-1][E][0] + dp[h][w-1][E][1] << endl;
  }
}

Measured memory_bytes: 3172
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public struct Connection
    {
        public List<int> connects;
        public int currentCount;
        public int myCount;
        public Connection(int index)
        {
            this.connects = new List<int>();
            this.currentCount = 0;
            this.myCount = 0;
        }
    }
    
    public static void Main()
    {
        var nq = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var N = nq[0];
        var Q = nq[1];
        
        var connections = new Connection[N];
        for (int i = 0; i < N; ++i)
        {
            connections[i] = new Connection(i);
        }
        
        for (int i=0;i<N-1;++i)
        {
            var ab = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            connections[ab[0] - 1].connects.Add(ab[1]-1);
            connections[ab[1] - 1].connects.Add(ab[0]-1);
        }

        for (int i = 0; i < Q; ++i)
        {
            var pq = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            connections[pq[0] - 1].myCount += pq[1];
        }

        var hashSet = new HashSet<int>();
        Dfs(0,hashSet,connections, 0);

        for (int i=0;i<N;++i)
        {
            Console.Write($"{connections[i].currentCount} ");
        }
    }

    static void Dfs(int currentCount,HashSet<int>hashSet, Connection[] connection, int index)
    {
        hashSet.Add(index);
        currentCount += connection[index].myCount;
        connection[index].currentCount = Math.Max(connection[index].currentCount,currentCount);
        foreach (var l in connection[index].connects)
        {
            if (!hashSet.Contains(l)) Dfs(currentCount,hashSet, connection, l);
        }
    }
}


Measured memory_bytes: 69436