akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
int a[10001];
int b[10001];
int temp[10001];
int memo[501];
main(){
  int n,m;
  int i,j;
  int tamp;
  int k;
  int co;

  while(1){
    scanf("%d",&n);
    scanf("%d",&m);
    if(n==0 && m==0) break;

    for(i=0;i<m;i++)
      scanf("%d %d",&a[i],&b[i]);

    memset(memo,0,sizeof(memo));
    co=0;
    j=0;
    for(i=0;i<m;i++){
      if(a[i]==1){
	temp[j]=b[i];
	memo[a[i]]=1;
	memo[b[i]]=1;
	a[i]=0;
	b[i]=0;
	co++;
	j++;
      }
      else if(b[i]==1){
	temp[j]=a[i];
	memo[a[i]]=1;
	memo[b[i]]=1;
	a[i]=0;
	b[i]=0;
	co++;
	j++;
      }
    }

    tamp=j;
         
    for(j=0;j<tamp;j++){
      for(i=0;i<m;i++){
	if(a[i]==temp[j]){
	  if(memo[b[i]]==1){
	    a[i]=0;
	    b[i]=0;
	  }
	  else{
	    memo[b[i]]=1;
	    memo[a[i]]=1;
	    a[i]=0;
	    b[i]=0;
	    co++;
	  }
	}
	else if(b[i]==temp[j]){
	  if(memo[a[i]]==1){
	    a[i]=0;
	    b[i]=0;
	  }
	  else{
	    memo[b[i]]=1;
	      memo[a[i]]=1;
	      a[i]=0;
	      b[i]=0;
	      co++;
	  }
	}
      }
    }

    printf("%d\n",co);
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		int[] h=new int[n];
		for(int i=0;i<n;i++) {
			h[i]=sc.nextInt();
		}
		
		int max=Integer.MAX_VALUE;
		int min =0;
		
		while(max>min) {
			int mid=min+(max-min)/2;
			long count=0;
			for (int i=0;i<n;i++) {
				if(h[i]>(long)b*(long)mid) {
					count+=((h[i]-b*mid)/(a-b));
					if((h[i]-b*mid)%(a-b)>0){
						count++;
					}
				}
			}
//			System.out.println(mid);
			if(count<=mid) {
				max=mid;
			}
			else {
				min=mid+1;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 50096
from collections import deque

n = int(input())
a = deque()

for _ in range(n):
    b = input()
    if b[0] == "i":
        a.appendleft(b[7:])
    elif b[6] == " ":
        try:
            a.remove(b[7:])
        except:
            pass
    elif len(b) > 10:
        a.popleft()
    else:
        a.pop()
print(*a)



Measured memory_bytes: 69732
import sys
input = sys.stdin.readline
import numpy as np

N, D = map(int, input().split())
l = []
count = 0

for i in range(N):
  l_i = list(map(int, input().split()))

  if i == 0:
    l.append(l_i)
    continue

  for l_j in l:
    arr = np.array(l_i) - np.array(l_j)
    if np.linalg.norm(arr).is_integer():
      count += 1

  l.append(l_i)

print(count)

Measured memory_bytes: 12508
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef vector<ll> vll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll n, p;
        in >> n >> p;
        ll sum = 0;
        ll ans = 0;
        vll a(n);
        bool odd = false;
        for (int i = 0; i < n; i++) {
            in >> a[i];
            if (a[i] % 2) {
                odd = true;
            }
            sum += a[i];
        }
        if (odd) {
            ans = pow(2LL, n - 1);
        }
        else {
            ans = p ? 0 : pow(2LL, n);
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
using namespace std;
const int N=200005;
char s[N];
int f[10005];
int main()
{
	scanf("%s",s+1);int n=strlen(s+1);
	int ans=n;
	rep(tt,1,26)
	{
		int xjt=0;
		rep(i,1,n)f[i]=s[i]-'a'+1;int cur=n;
		while(1)
		{
			int fg=1;
			rep(i,1,cur)if(f[i]!=tt)fg=0;
			if(fg)break;xjt++;
			rep(i,1,cur-1){if(f[i]==tt || f[i+1]==tt) f[i]=tt;}cur--;
			//rep(i,1,cur-1)printf("%d ",f[i]);puts("");
		}
		ans=min(ans,xjt);
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  int judge;
  string p,s;
  cin >> p >> s;
  p += p;

  judge = p.find(s);
  if(judge == -1) cout << "No" << endl;
  else            cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 1192
n,k = map(int,input().split())

if k == 0:
    print(n**2)
else:
    total = 0
    for i in range(k+1,n+1):
        d,m = divmod(n,i)
        
        if (i-k) > 0:
            total += d*(i-k)
        if (m-k+1) > 0:
            total += m-k+1

    print(total)

Measured memory_bytes: 3060
#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 h, w;
    cin >> h >> w;
    int r = -1;
    string ans = "Possible";
    rep(i,h) {
        string s;
        cin >> s;
        rep(j,w) {
            if (s[j] == '#') {
                if (j < r) {
                    ans = "Impossible";
                }
                r = j;
            }
        }
    }
    cout << ans << endl;
}

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

int dp[105][4][2];

int main() {
  string S;
  cin >> S;
  int n = S.size();
  int K;
  cin >> K;
  dp[0][0][0] = 1;
  rep(i, n) {
    rep(j, 4) {
      rep(k, 2) {
        int nd = S[i] - '0';
        rep(d, 10) {
          int ni = i+1;
          int nj = j;
          int nk = k;
          if (d != 0) nj++;
          if (nj > K) continue;
          if (k == 0) {
            if (d > nd) continue;
            if (d < nd) nk = 1;
          }
          dp[ni][nj][nk] += dp[i][j][k];
        }
      }
    }
  }
  int ans = dp[n][K][0] + dp[n][K][1];
  cout << ans << endl;
}

Measured memory_bytes: 256
N, M, X = map(int, input().split())
A = list(map(int, input().split()))

c0 = 0
c1 = 0

for i in range(M):
    if A[i] < X:
        c0 += 1
    elif A[i] > X:
        c1 += 1
print(min(c0, c1))


Measured memory_bytes: 3064
def solve():
    N = int(input())
    s = []
    t = []
    for i in range(N):
        add_s , add_t = input().split()
        s.append(add_s)
        t.append(int(add_t))
    check = False

    X = input()
    result = 0
    for i in range(N):
        if check:
            result += t[i]
        elif s[i] == X:
            check = True
    print(result)
solve()

Measured memory_bytes: 38484
#include<bits/stdc++.h>
#define LiangJiaJun main
#define eps 1e-10
using namespace std;
int n;
double f[304][304][304];
int C[4];
double dfs(int C1,int C2,int C3){
    if(C1<0||C2<0||C3<0)return 0;
    if(f[C1][C2][C3]>=-eps)return f[C1][C2][C3];
    f[C1][C2][C3]=(n+C1*dfs(C1-1,C2,C3)+C2*dfs(C1+1,C2-1,C3)+C3*dfs(C1,C2+1,C3-1))/(C1+C2+C3+0.0);
    return f[C1][C2][C3];
}
int w33ha(){
    memset(C,0,sizeof(C));
    for(int i=0;i<=301;i++)
        for(int j=0;j<=301;j++)
            for(int k=0;k<=301;k++)
                f[i][j][k]=-1;
    f[0][0][0]=0;
    for(int i=1;i<=n;i++){
        int x;scanf("%d",&x);
        C[x]++;
    }
    printf("%.10lf\n",dfs(C[1],C[2],C[3]));
    return 0;
}
int LiangJiaJun(){
    while(scanf("%d",&n)!=EOF)w33ha();
    return 0;
}


Measured memory_bytes: 219520
package main

import (
	"fmt"
	"math"
	"strings"
)

func main() {
	_, a, b := Int3()
	s := Str1()
	slice := strings.Split(s, "")

	at, bt := 0, 0
	for _, c := range slice {
		if at+bt < a+b {
			if c == "a" {
				at += 1
				fmt.Println("Yes")
			} else if c == "b" && bt < b {
				bt += 1
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		} else {
			fmt.Println("No")
		}
	}
}

func Str1() string {
	var s string
	fmt.Scan(&s)
	return s
}

func Int1() int {
	var x int
	fmt.Scan(&x)
	return x
}

func Int2() (int, int) {
	var x, y int
	fmt.Scan(&x, &y)
	return x, y
}

func Int3() (int, int, int) {
	var x, y, z int
	fmt.Scan(&x, &y, &z)
	return x, y, z
}

func IntSlice(n int) []int {
	slice := make([]int, n)
	for i := range slice {
		fmt.Scan(&slice[i])
	}
	return slice
}

func SumSlice(slice []int) int {
	total := 0
	for i := range slice {
		total += slice[i]
	}
	return total
}

func Min(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func IntPow(x, pow int) int {
	return int(math.Pow(float64(x), float64(pow)))
}


Measured memory_bytes: 4200
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
const int row = 100000000;
const int inf = 1012345678;
const long double magical_number = 4.2920367320510338076867830836025l;
const long double magical_number2 = 15.707963267948966192313216916398l;
int N, xa, ya, xb, yb, x[200009], y[200009];
int main() {
	ios::sync_with_stdio(false);
	cin >> xa >> ya >> xb >> yb >> N;
	for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
	if (ya > yb) swap(ya, yb), swap(xa, xb);
	if (xa > xb) {
		xa = row - xa - 1; xb = row - xb - 1;
		for (int i = 0; i < N; i++) x[i] = row - x[i] - 1;
	}
	vector<pair<int, int> > v;
	for (int i = 0; i < N; i++) {
		if (xa <= x[i] && x[i] <= xb && ya <= y[i] && y[i] <= yb) {
			v.push_back(make_pair(x[i], y[i]));
		}
	}
	sort(v.begin(), v.end());
	vector<int> cp;
	for (int i = 0; i < v.size(); i++) cp.push_back(v[i].second);
	sort(cp.begin(), cp.end());
	vector<int> cr;
	for (int i = 0; i < v.size(); i++) cr.push_back(lower_bound(cp.begin(), cp.end(), v[i].second) - cp.begin());
	vector<int> res(N, inf);
	for (int i = 0; i < v.size(); i++) {
		*lower_bound(res.begin(), res.end(), cr[i]) = cr[i];
	}
	int ret = lower_bound(res.begin(), res.end(), inf) - res.begin();
	cout << fixed << setprecision(19) << (xb - xa) * 100L + (yb - ya) * 100LL - ret * magical_number + (xb - xa < ret || yb - ya < ret ? magical_number2 : 0) << endl;
	return 0;
}

Measured memory_bytes: 6000
#include <stdio.h>

int main(void) {

    int i, j, k;
    int r, c, src = 0;

    scanf("%d%d", &r, &c);
    int num[r][c], sr[r], sc[c];
    for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
            num[i][j] = 0;
            sc[j] = 0;
        }
        sr[i] = 0;
    }

    for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
            scanf("%d", &num[i][j]);
            sr[i] += num[i][j];
            sc[j] += num[i][j];
        }
        src += sr[i];
    }

    for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
            printf("%d ", num[i][j]);
        }
        printf("%d\n", sr[i]);
    }
    for (j = 0; j < c; j++) {
        printf("%d ", sc[j]);
    }
    printf("%d\n", src);

    return 0;

}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int M  = 1e9+7;

int mod(int x){
	return (x%M + M)%M;
}

int mul(int a, int b){
	return mod(mod(a) * mod(b));
}
int add(int a, int b){
	return mod(mod(a) + mod(b));
}
int sub(int a, int b){
	return mod(mod(a) - mod(b));
}
int power(int base, int pow){
	int ans=1;
	while(pow--) ans = mul(ans,base);
 	return ans;
}

main(){
	int n; cin>>n;
	if(n<2){
		cout<<"0";
		return 0;
	}
	cout<< sub(add(power(10,n),power(8,n)), add(power(9,n),power(9,n)));;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int N;cin>>N;
    vector<vector<pl>> G(N,vector<pl>());
    rep(i,N-1){
        ll a,b,c;cin>>a>>b>>c;
        a--,b--;
        G[a].push_back(mp(b,c));
        G[b].push_back(mp(a,c));
    }
    vl dist(N,INF);
    dist[0]=0;
    queue<ll> que;
    que.push(0);
    while(que.size()){
        ll q=que.front();que.pop();
        for(auto nq:G[q]){
            if(dist[nq.fi]>dist[q]+nq.se){
                dist[nq.fi]=dist[q]+nq.se;
                que.push(nq.fi);
            }
        }
    }
    ll ans[N];
    rep(i,N){
        if(dist[i]%2)ans[i]=0;
        else ans[i]=1;
    }
    rep(i,N)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 9768
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

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

int main(void) {
    long long S; cin >> S;
    long long e9 = 1e9;
	cout << "0 " << S/e9 << " " << e9 << " " << (S+e9-1)/e9 << " " << S%e9 << " " << 0 << " " << endl; 
}


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

int main() {
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	int ans = 0;

	for (int i = 0; i < 3001; i++) {
		for (int j = 0; j < 3001; j++) {
			int temp;
			temp = N - (R * i + G * j);
			if (temp < 0) {
				continue;
			}
			if (temp%B == 0) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
p = gets.split.map &:to_i
q = gets.split.map &:to_i
if p == q
    puts 0
    exit
end
count = 0
a = []
[*1..n].permutation{ |e|
    if p == e.to_a || q == e.to_a
        a << count
        break if a.size == 2
    end
    count += 1
}
puts (a[1] - a[0]).abs

Measured memory_bytes: 2172
#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 k;
  cin >> k;
  vector<ll> a;
  for (int i = 1; i <= 9; ++i) a.push_back(i);
  while (1) {
    if (k <= a.size()) {
      cout << a[k-1] << endl;
      return 0;
    }
    k -= a.size();
    vector<ll> old;
    swap(old, a);
    for (ll x : old) {
      for (int i = -1; i <= 1; ++i) {
        int d = x%10 + i;
        if (d < 0 || d > 9) continue;
        ll nx = x*10 + d;
        a.push_back(nx);
      }
    }
  }
  return 0;
}


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

int gcd2(int a,int b){
  int r,w;
  if(a<b){
    w = a;
    a = b;
    b = w;
  }
    while(a%b != 0){
      r = a%b;
      a = b;
      b = r;
    }
    return b;
}



int gcd3(int a,int b,int c){
  return gcd2(gcd2(a,b),c);
}


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

  int sum = 0;
  for(int i = 1;i <= N;i++){
    for(int j = 1;j <= N;j++){
      for(int k = 1;k <= N;k++){
        sum += gcd3(i,j,k);
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n,m,f[26];
char s[550][550];
int main(){
  scanf("%d%d",&n,&m);
  for(int i=0;i<n;++i){
    scanf("%s",s[i]);
    for(int j=0;j<m;++j)
      ++f[s[i][j]-'a'];
  }
  for(int i=0;i<n/2;++i)
    for(int j=0;j<m/2;++j){
      bool flag=1;
      for(int k=0;k<26;++k)
        if(f[k]>=4){
          f[k]-=4;
          flag=0;
          break;
        }
      if(flag)
        return 0*puts("No");
    }
  int cnt=0,odd=0;
  vector<char>v;
  for(int i=0;i<26;++i)
    if(f[i]&1)
      ++odd;
    else
      cnt+=f[i]/2;
  if(!(n&1) && !(m&1)){
    for(int i=0;i<26;++i)
      if(f[i])
        return 0*puts("No");
  }else if((n&1) && (m&1)){
    if(odd!=1 || cnt!=m/2+n/2)
      return 0*puts("No");
  }else if(n&1){
    if(odd || cnt!=m/2)
      return 0*puts("No");
  }else if(m&1){
    if(odd || cnt!=n/2)
      return 0*puts("No");
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<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; }



int main(int argc, char const *argv[]) {
  ll a, b, c, k, ans = 0;
  cin >> a >> b >> c >> k;
  ans += min(k, a);
  k -= a;
  k -= b;
  if (k > 0) ans -= k;
  cout << ans << endl;
  return 0;
}

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

#define int         long long
#define ld          long double
#define fastio      ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#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 f           first
#define se          second
#define maxn        200005
#define sz(x)       (int)x.size()
#define mod         1000000007
#define mod2        998244353

using namespace std;

/*int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n>>1))%mod)%mod;
    return power((a*a)%mod,n>>1)%mod;
}
int gcd(int a,int b)
{
    if(a%b == 0)return b;
    return gcd(b,a%b);
}*/
int n;

signed main()
{
    fastio;
    cin >> n;
    FOR(i,0,n)
    {
        if(n-4*i >=0 && (n-4*i)%7==0){cout << "Yes\n";return 0;}
    }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
N = int(input())
D = list(map(int, input().split(' ')))

D.sort()
c = 0
b = False
for d in D:
    c += 1
    if b:
        if d != half:
            print(d - half)
        else:
            print("0")
        break
    if c == N // 2:
        half = d
        b = True

Measured memory_bytes: 14008
import java.util.*;
import java.util.Map.Entry;



public class Main{

	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 String s=sc.next();
	 char[] c=s.toCharArray();
	 long result = 0;
	 for(int i=0;i<c.length-1;i++) {
		 if(c[i]!=c[i+1]) {
			 result++;
		 }
	 }
	 System.out.println(result);
	 
	 
 }
	


}




Measured memory_bytes: 26448
def calc_division(a, b):
    d = a // b
    r = a % b
    f = a / b
    print("{0:d} {1:d} {2:0.5f}".format(d, r, f))


if __name__ == "__main__":
    param = input()
    param = param.split(" ")
    a = int(param[0])
    b = int(param[1])
    calc_division(a, b)


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++);
using vi = vector<int>;
 
int main() {
	 int N;
    cin >> N;
    vi T(N);
    for (int i = 0; i < N; i++)
        cin >> T[i];
    int M;
    cin >> M;
    vi P(M);
    vi X(M);
    for (int i = 0; i < M; i++) {
        cin >> P[i];
        cin >> X[i];
    }
 
    int sum = 0;
    for (int i = 0; i < N; i++)
        sum = sum + T[i];
 
 
    for (int i = 0; i < M; i++)
        cout << sum - T[P.at(i)-1] + X[i] << endl;
}

Measured memory_bytes: 256
n_num = int(input())
zoro_cnt = 0
flag = False
for n in range(n_num):
    a, b = map(int, input().split())
    if zoro_cnt != 0 and a != b:
        zoro_cnt = 0
    elif a == b:
        zoro_cnt += 1
        if zoro_cnt == 3:
            flag = True

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9176
import java.util.*;
import java.util.Scanner;
class Main{
    public static void main(String[] args)
    {
        long n, a, b;
        long result = 0;
        long flag;
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextLong();
        a = scanner.nextLong();
        b = scanner.nextLong();
        flag = n / (a + b);
        result = a * flag;
        flag = n % (a + b);
        if(flag < a){
            result += flag;
        }else{
            result += a;
        }
        System.out.println(result);
    }
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> P;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001
#define pi acos(-1)

double dp[20][20][10001];
vector<int> to[20][20];

int main(){
    cin.sync_with_stdio(false);
    int n;
    double r, theta;
    cin >> n >> r >> theta;
    theta = (theta + 1e-3) * pi / 180.0;
    vector<P> v;
    rep(i, n) {
        double x, y;
        cin >> x >> y;
        v.pb(P(x, y));
    }

    rep(i, n)rep(j, n)rep(l, n) {
        if (j == l || i == l) continue;
        double alpha = abs(arg(v[l] - v[j]) - arg(v[j] - v[i]));
        if (alpha > pi) alpha = 2 * pi - alpha;
        if (alpha <= theta) to[i][j].pb(l);
    }

    rep(i, n)rep(j, n)rep(k, 10001) dp[i][j][k] = INF + 1;
    int ans = 0;
    repl(i, 1, n) {
        if (abs(v[i] - v[0]) <= r + 1e-3) {
            dp[0][i][1] = abs(v[i] - v[0]);
            ans = 1;
        }
    }
    repl(k, 1, 10000) {
        if (ans != k) break;
        rep(i, n)rep(j, n) {
            if (i == j) continue;
            if (dp[i][j][k] < INF) {
                rep(l, to[i][j].size()) {
                    int next = to[i][j][l];
                    if (dp[i][j][k] + abs(v[next] - v[j]) <= r + 1e-3) {
                        minch(dp[j][next][k + 1], dp[i][j][k] + abs(v[next] - v[j]));
                        ans = k + 1;
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 34760
import java.util.HashMap;
import java.util.Scanner;

/**
 *
 * @author HP
 */
public class Main {
   public static void main(String[] args) {
       Scanner s = new Scanner(System.in);
       int n = s.nextInt();
       HashMap<Integer,Integer> map = new HashMap<>();
       int temp;
       long sum=0;
       for(int i =0; i < n; i++) {
           temp = s.nextInt();
           sum+=temp;
           if(map.containsKey(temp))
                map.put(temp, map.get(temp)+1);
           else {
                map.put(temp,1);
           }
       }
//       System.out.println(map);
       int q = s.nextInt();
       int b,c=0,count=0;
       while(q-->0) {
           b = s.nextInt();
           c = s.nextInt();
           count=0;
           if(map.containsKey(b)) {
               temp = map.get(b);
               map.remove(b);
               sum = sum +temp *(c-b);
               if(map.containsKey(c))
                   temp+= map.get(c);
               map.put(c, temp);
           }
//           System.out.println(map);
           System.out.println(sum);
       }
   }
}


Measured memory_bytes: 66472
s = []
while True:
    cnt = 0
    n, x = list(map(int, input().split()))
    if n == 0 and x == 0:
        break
    else:
        for i in range(1, n + 1):
            for j in range(1, i):
                for k in range(1, j):
                    if i + j + k == x:
                        cnt += 1
        s.append(cnt)
for l in range(len(s)):
    print(s[l])

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

long long dp[200];

int main(void){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)cin >> a[i];
    
    dp[0] = 1000;
    for(int i = 0;i < n;i++){
        dp[i+1] = dp[i-1];
        for(int j = 0;j <= i;j++){
            long long b = dp[j] / a[j];
            dp[i+1] = max(dp[i+1],dp[j] - b * a[j] + b * a[i]);
        }
    }
    cout << dp[n] << endl;
}


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

int main(){
  int n,m; std::cin >> n >> m;
  std::vector<int> a(m),b(m),road(n,0);
  for (int i = 0; i < m; i++) {
    std::cin >> a[i] >> b[i];
    road[a[i] - 1] += 1;
    road[b[i] - 1] += 1;
  }
  for (int i = 0; i < n; i++) {
    std::cout << road[i] << '\n';
  }
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = []
for i in range(N):
    S.append(input())

l = Counter(S)
m = l.most_common()[0][1]
values, counts = zip(*l.most_common())
c = counts.count(m)
v = values[:c]
for vv in sorted(v):
    print(vv)

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

int main(void){
	int n, m, a;
	while(cin >> n >> m >> a, n+m+a){
		vector<vector<int>> v(n+1);
		for (int i = 0; i < n+1; ++i)
		{
			v[i].resize(1010);
		}
		for (int i = 0; i < m; ++i)
		{
			int h, p, q;
			cin >> h >> p >> q;
			v[p][h] = q;
			v[q][h] = p;
		}
		for (int i = 1000; i > 0; --i)
		{
			if(v[a][i] != 0){
				a = v[a][i];
			}
		}
		cout << a << endl;
	}
	return 0;
}


Measured memory_bytes: 3272
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main()
{
	
	cout << fixed << setprecision(12);

	double a, b, C; cin >> a >> b >> C;
	
	C = C / 180.0*PI;
	
	cout << a*b*sin(C) / 2.0 << endl;

	double c = a*a + b*b - 2 * a*b*cos(C);
	c = sqrt(c);

	cout << a + b + c << endl;

	cout << b*sin(C) << endl;

	return 0;
}


Measured memory_bytes: 3520
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll dp[MAX_N][2];
ll ep[MAX_N][2];
vi G[MAX_N];

void loop(int v, int p) {
	rep(i, 0, sz(G[v])) {
		int n = G[v][i];
		if(n == p) continue;
		loop(n, v);
	}
	dp[v][0] = 1; //white
	dp[v][1] = 1; //black
	rep(i, 0, sz(G[v])) {
		int n = G[v][i];
		if(n == p) continue;
		ep[v][1] = (dp[v][1] * dp[n][0]) % mod;
		ep[v][0] = (dp[v][0] * (dp[n][0] + dp[n][1]) % mod) % mod;

		dp[v][0] = ep[v][0];
		dp[v][1] = ep[v][1];
	}
}

void solve() {
	cin >> N;
	rep(i, 0, N - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	loop(0, -1);
	cout << (dp[0][0] + dp[0][1]) % mod << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 24704
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n; cin >> n;
    vector<ll> lucas(n+1);
    lucas[0] = 2LL; lucas[1] = 1LL;
    for (int i = 2; i <= n; i++)
    {
        lucas[i] = lucas[i-1] + lucas[i-2];
    }
    cout << lucas[n] << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
import numpy as np
A = np.array(list(map(int,input().split())))
cumsum = np.cumsum(A)
# ans = 10**9+7
ans = float('inf')
for i in range(N-1):
    if abs(cumsum[i] - (cumsum[-1] - cumsum[i])) < ans:
        ans = abs(cumsum[i] - (cumsum[-1] - cumsum[i]))
print(ans)       
# for i in range(N):
#     l = sum(A[:i])
#     #print(l)
#     r = sum(A[i:])
#     #print(r)
#     diff = abs(l-r)
#     if diff < ans:
#         ans = diff
# print(ans)

Measured memory_bytes: 34236
package main

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

var sc *bufio.Scanner
var out *bufio.Writer

func main() {
	sc = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	buf := make([]byte, 1<<20)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n := nextInt()

	t := newTree(n)
	for i := 0; i < n; i++ {
		a := nextInt()
		t.set(i, a)
	}
	t.build()

	maxgcd := t.node[0]
	for i := 0; i < n; i++ {
		k := i + t.size - 1
		tmp := t.node[k]
		t.update(i, -1)
		maxgcd = intMax(maxgcd, t.node[0])
		t.update(i, tmp)
	}

	fmt.Fprintln(out, maxgcd)
}
func gcd(x, y int) int {
	if x < y {
		x, y = y, x
	}
	for y > 0 {
		x, y = y, x%y
	}
	return x
}
func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

type tree struct {
	node []int
	size int
	ex   int
}

func newTree(n int) *tree {
	size := 1
	for size < n {
		size <<= 1
	}
	return &tree{
		node: make([]int, 2*size-1),
		size: size,
		ex:   0,
	}
}
func (t *tree) set(i, v int) {
	t.node[i+t.size-1] = v
}
func (t *tree) build() {
	for k := t.size - 2; k >= 0; k-- {
		t.node[k] = gcd(t.node[2*k+1], t.node[2*k+2])
	}
}
func (t *tree) update(i, v int) {
	k := t.size + i - 1
	t.node[k] = v
	for k > 0 {
		k = (k - 1) / 2
		t.node[k] = gcd(t.node[2*k+1], t.node[2*k+2])
	}
}
func (t *tree) query(a, b int) int {
	return t.qreq(a, b, 0, 0, t.size)
}
func (t *tree) qreq(a, b, k, l, r int) int {
	if b <= l || r <= a {
		return t.ex
	}
	if a <= l && r <= b {
		return t.node[k]
	}
	vl := t.qreq(a, b, 2*k+1, l, (l+r)/2)
	vr := t.qreq(a, b, 2*k+2, (l+r)/2, r)
	return gcd(vl, vr)
}

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}


Measured memory_bytes: 5880
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[]$) {
      //類題:ABC-105D-Candy Distribution
        Scanner sc = new Scanner(in);
      //解説どおりやる(このコードだとソートをしないのでo(N)で解けます)
        int n=sc.nextInt();
        long[] a=new long[n+1];
        a[0]=0;
        HashMap<Long,Long> m=new HashMap<>();
        m.put(a[0],0l);
      //はじめ0で初期化(こうすると最後数え上げるときにうまくいく)
        for (int i = 1; i <n+1; i++) {
            a[i]=a[i-1]+sc.nextLong();
            m.put(a[i],0l);
        }
        long ans=0;
      //自分より手前にある,自分と同じ値の個数を数える(累積和の考えより) 
        for(int i=0;i<=n;i++){
          //m.get(a[i]):a[i]よりも手前にある,a[i]と同じ値の個数
          //当然、初めての出現だと0
            ans+=m.get(a[i]);
          //出現回数を増やす(次に出てきたときは+1(今見ているa[i]の分の個数)された値が足される)
            m.put(a[i],m.get(a[i])+1l);
        }
        out.println(ans);
    }
}


Measured memory_bytes: 107176
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
// 11

using namespace std;

const int MAXN = (int) 1e5;

ll v[MAXN + 1];

int n;

inline ll check(ll x) {
   for(int i = 1; i <= n; i++) {
       x -= x % v[i];
   }
   return x;
}

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= n; i++) {
        cin >> v[i];
    }
    ll a = 0, b = 0;
    for(ll pas = 1LL << 50; pas; pas >>= 1) {
        if(check(a + pas) < 2)
            a += pas;
        if(check(b + pas) <= 2)
            b += pas;
    }
    if(a + 1 > b) {
        cout << -1;
        return 0;
    }
    cout << a + 1 << " " << b;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  int a, b;
  cin >> a >> b;
  if(a <= b) cout << a << endl;
  else cout << a-1 << endl;
}

Measured memory_bytes: 256
#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;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  int ans=0;
  sort(d.begin(),d.end());
  reverse(d.begin(),d.end());
  rep(i,n){
    if(d[i]>d[i+1]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 100000000
#define MOD 1000000007
using namespace std;


int main(){
    while(true){
        int n;
        cin >> n;
        if(n==0){break;}
        
        int num[10]={};
        for(int i=0; i<n; i++){
            int a;
            cin >> a;
            num[a]++;
        }
        
        for(int i=0; i<10; i++){
            for(int k=0; k<num[i]; k++){
                cout<<'*';
            }
            if(num[i]==0){cout<<'-';}
            cout<<endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3000
using System;
class Program
{
  static void Main(string[] args)
  {
    int H = int.Parse(Console.ReadLine());
    int W = int.Parse(Console.ReadLine());
    int N = int.Parse(Console.ReadLine());
    int answer=0;
    if(H>=W){
      answer=N/H;
      if((N%H)!=0){
        answer=answer+1;
      }
    }
    if(H<W){
      answer=N/W;
      if((N%W)!=0){
        answer=answer+1;
      }
    }
    Console.WriteLine(answer);
  }
}

Measured memory_bytes: 11092
N=int(input())
ans=10**5

for i in range(N+1):
    cc=0
    t,s=i,N-i
    while t>0:
        cc+=t%6
        t//=6
    while s>0:
        cc+=s%9
        s//=9
    ans=min(ans,cc)

print(ans)

Measured memory_bytes: 3060
## A - Password
##3桁のパスワードを設定しようとしています。
##使える文字が 1以上 N以下の数字のみであるとき、
##設定できるパスワードが全部で何種類であるかを答えてください。

##制約
##1 ≤ N ≤ 9
##Nは整数である。

##入力は以下の形式で標準入力から与えられる。
##N
n = gets.chomp.to_i


##設定できるパスワードが何種類であるかを出力せよ。
num = 0
1.upto(n) do |a|
  1.upto(n) do |b|
    1.upto(n) do |c|
      v = a + b + c
      # puts "#{v} #{a} #{b} #{c}"
      num += 1
    end
  end
end
p num

Measured memory_bytes: 1788
#include<stdio.h>

int main(){
  int n,flag = 0;
  scanf("%d",&n);
  for(int i =0;i <3;i++){
    if(n%10 == 7){
      flag =1;
    }
    n/=10;
  }
  if(flag==1){
    printf("Yes");
  }else{
    printf("No");
  }
}
    

Measured memory_bytes: 1716
using System;

namespace AOJ0511
{
    class Program
    {
        public int STUDENT = 30;
        public void Proc()
        {
            bool[] num = new bool[STUDENT + 1];
            for (int i = 0; i < STUDENT -2; i++)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) break;
                num[int.Parse(input)] = true;
            }
            for (int i = 1; i <= STUDENT; i++)
            {
                if (!num[i]) Console.WriteLine(i);
            }

            Console.ReadLine();
        }

        static void Main(string[] args)
        {
            Program prg = new Program();
            prg.Proc();
        }
    }
}

Measured memory_bytes: 9052
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define LL long long
using namespace std;
const int Maxn = 500000;
LL N, A, B, C, D;
int main()
{
	scanf("%lld%lld%lld%lld%lld", &N, &A, &B, &C, &D);
	for (LL i = 0; i < N; ++i)
	{
		LL j = N - i - 1;
		if ((A + i * D - j * C >= B) && (A + i * C - j * D <= B))
		{
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << 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; }

int main(){
  ll h, n;
  cin >> h >> n;
  vi a(n);
  ll  total = 0;
  rep(i, n){
    cin >> a[i];
    total += a[i];
  }
  if(total>=h){
    print("Yes");
  }
  else{
    print("No");
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

void yes(){
   cout<<"Yes"<<endl;
   //exit (0);
}
void no(){
   cout<<"No"<<endl;
   //exit (0);   
}


int32_t main(){_
   
   int a, b, n;
   cin >> a >> b >> n;

   int b_ = (n / b) * b - 1;
   if (b_ < 0){
      b_ = n;
   }

   int ans = (a * b_) / b - a * (b_/b);

   tr(b_, ans);
   cout<<ans;

   // // int low = 0, high =5 7 4 b;

   // // int bst = 0;
   // // while(low <= high){
   // //    int mid = (low + high) >> 1;
   // //    if (ans){
         
   // //    }
   // // }

   // for (int x = 0; x <= n; ++x)
   // {
   //    int ans = (a * x) / b - a * (x/b);
   //    tr(x, ans);
   // }


   return 0;
}

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


int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string str;
    int sum,ds,i;
       cin>>str;
    sum=0;
    for (i=0; str[i]!='\0'; i++)
    {
        sum+=str[i]-'0';
    }
    if (sum%9==0)
        cout<<"Yes"<<'\n';
    else
        cout<<"No"<<'\n';
    return 0;
}


Measured memory_bytes: 3744
#include <iostream>

using namespace std;

bool f(int n)
{
    int a,b;
    a=n%10,b=n/10000;
    if(a!=b) return 0;
    n/=10;
    a=n%10,b=n/100,b%=10;
    if(a!=b) return 0;
    return 1;

}
int main()
{
    int a,b;
    cin>>a>>b;
    int ans=0;
    for(int i=a;i<=b;i++)
    {
        if(f(i))ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
def calTri(x,y)
    puts x*y/2
end
a,b,c = gets.split.map(&:to_i)
if a**2 + b**2 == c**2 then
    calTri(a,b)
elsif a**2 + c**2 == b**2 then
    calTri(a,c)
elsif b**2 + c**2 == a**2 then
    calTri(b,c)
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll m,k;
cin >> m>>k;
if(m==0&&k==0){
    cout << "0 0" << endl;
    return 0;
}
if(m==0){
    cout << "-1" << endl;
    return 0;
}
if(m==1&&k==0){
    cout << "0 0 1 1" << endl;
    return 0;
}
if(m==1){
    cout << "-1" << endl;
    return 0;
}
if(k>=(1LL<<m)){
    cout << "-1" << endl;
    return 0;
}
rep(i,1LL<<m){
    if((1LL<<m)-i-1!=k)cout << (1LL<<m)-i-1<<" " ;
}
cout << k <<" " ;
rep(i,1LL<<m){
    if(i!=k)cout << i<<" " ;
}
cout << k << endl;
return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<queue>
#include<unordered_map>
#include<map>
#include<stack>
#include<bits/stdc++.h>
#include<string.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
//#define f first
//#define s second
#define respr(fir,sec) for(int i=0;i<=fir;i++){for(int j=0;j<=sec;j++){cout << res[i][j] << " ";}cout << "\n";}
#define pb push_back
//#define INF (1LL<<31)
using namespace std;
using namespace __gnu_pbds;
const int mod = 1e9+7;
const ll MAX = 1000000000000000000;
const ll INF = 1000000000000000000;
typedef pair<int,ll> pii;
typedef pair<ll,int> pi;
typedef tuple<long long,int> tp;
typedef tuple<int,int,long long> tu;
typedef multimap<pii , int> mpp;
typedef priority_queue< tp , vector<tp>, greater<tp>>  minheap;
typedef priority_queue<pii , vector<pii>> maxheap;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
const int nax=105;
//const int nax1 = 105;

int main()
{
	FASTIO;
	int n;
	int ans=0;
	cin >> n;
	vector<vector<int>> arr(n,vector<int>(3));
	vector<vector<int>> dp(2,vector<int>(3));
	
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin >> arr[i][j];
		}
	}
	
	for(int i=1;i<=n;i++){
		int rem = i%2;
		int next_rem = (i+1)%2;
		for(int j=0;j<3;j++){
				dp[rem][j] = max(arr[i-1][j]+dp[next_rem][(j+1)%3], arr[i-1][j]+ dp[next_rem][(j+2)%3]);
				ans = max(ans, dp[rem][j]);
				//cout << dp[i%2][j] << " ";
		}
		//cout << "\n";
	}
	
	cout << ans << "\n";
	

	return 0;
}


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

int main() {
  int n,k;
  cin >> n;
  k=1000000007;
  
  for(int i=0;i<n;i++){
    int a[i];
    cin >> a[i];
    int D=0;
    
    while(a[i]%2==0){
      D++;
      a[i]/=2;
    }
    k=min(D,k);
  }
	cout << k <<endl;
}


Measured memory_bytes: 256