akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)
const ll INF=0xfffffffffffffff;
const P PINF=P(INF,-INF);

ll N,M,K;
ll A[20001];


ll dp[20001];//i???????????§?????±??°?????????????°??????????

P p;

int main()
{
	scanf("%lld%lld%lld",&N,&M,&K);
	rep1(i,N){
		scanf("%lld",&A[i]);
		dp[i]=INF;
	}
	dp[0]=0;
	rep1(i,N){
		p=PINF;
		rep(j,min(M,i)){
			p=P(min(p.fr,A[i-j]),max(p.sc,A[i-j]));
			dp[i]=min(dp[i],dp[i-j-1]+(p.sc-p.fr)*(j+1)+K);
		}
	}
	printf("%lld\n",dp[N]);
}

Measured memory_bytes: 3512
#include <iostream>
using namespace std;
int main(void){
    
    int d,t,s;
    cin >> d >> t >> s;
    int x = d / s;
    int y = d % s;
    
    if( y > 0){
        x = x + 1;
    
    if( x > t){
        cout << "No" << endl;
    }
    
    if( x <= t){
        cout << "Yes" << endl;
    }
    }
    
    else if( y == 0){
        if( x > t){
        cout << "No" << endl;
    }
    
    if( x <= t){
        cout << "Yes" << endl;
    }
    }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int N=200010,Mod=998244353;
const double pi=acos(-1.0);
typedef long long int ll;
typedef pair<int,int> pii;
int n,a[N],b[N];
int main()
{
  cin>>n;
  for(int i=1;i<=n;i++) cin>>a[i],b[i]=a[i];
  sort(b+1,b+n+1);
  int mx=b[n],mx2=b[n-1];
  for(int i=1;i<=n;i++) if(a[i]!=mx) cout<<mx<<endl; else cout<<mx2<<endl;
  return 0;
}


Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();
    	sc.close();
    	int ans = 0;
    	int t1 = calcNumOfCombination(N, 2);
    	int t2 = calcNumOfCombination(M, 2);
    	ans = t1 + t2;
    	System.out.println(ans);
    }

	static int calcNumOfCombination(int n, int r){
	    int num = 1;
	    for(int i = 1; i <= r; i++){
	        num = num * (n - i + 1) / i;
	    }
	    return num;
	}
}

Measured memory_bytes: 21972
#include <iostream>
using namespace std;
int main()
{
	int N,i;
	int D1,D2;
	cin>>N;
	int num=0;
	for (i=0;i<N;i++){
		cin>>D1>>D2;
		if (D1==D2){
			num++;
			if (num==3){
				cout<<"Yes"<<endl;
				return 0;
			}
		}else{
			num=0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3120
#include <stdio.h>

void
draw(int, int);

int
main(void)
{
    int h, w;
    while (scanf("%d %d", &h, &w) && h && w)
        draw(h, w);
    return 0;
}

void
draw(int h, int w)
{
    int i, j;
    for (i = 0; i < h; i++) {
        for (j = 0; j < w; j++)
            putchar('#');
        putchar('\n');
    }
    putchar('\n');
}


Measured memory_bytes: 2108
#include"bits/stdc++.h"
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20)
#define ll long long
#define endl '\n'
//       Author
//        ::
//    (  NOBODY  )
//   No Copyright .....You can copy and paste it without my permission...................................
// !!!!!!!!!!!!!!!
#define pb push_back
#define N 300009
int a[N],b[N],c[N];
int dp[40008][102][3];
int mo=1e9+7;
int n;
vector<int>v;
ll digit(int indx,int sum,int ok,int div)
{
   if(indx==-1)return (sum%div==0);
   if(dp[indx][sum][ok]!=-1)return dp[indx][sum][ok];
   int num=(ok)?v[indx]:9;
   ll sm=0;
   for(int i=0;i<=num;i++)
   {
     int new_ok=(i==v[indx])?ok:0;
     sm+=(ll)digit(indx-1,(sum+i)%div,new_ok,div);
     sm%=mo;
   }
   if(!ok)dp[indx][sum][ok]=sm;
   return (sm%mo);

}
int main()
{
    FAST_IO;
    string s;
    memset(dp,-1,sizeof(dp));
    int k;
    cin>>s>>k;
     n=s.size();
    for(int i=n-1;i>=0;i--)
    {
      v.pb(s[i]-'0');
      //cout<<v.back()<<" ";
    }
   cout<< (digit(n-1,0,1,k)-1+mo)%mo;
    return 0;
}


Measured memory_bytes: 50304
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String t = sc.nextLine();

    int counter = 0;
    for(int i=0; i<s.length(); i++){
      if(s.charAt(i) != t.charAt(i)) counter++;
    }
    
    System.out.println(counter);

  }
}

Measured memory_bytes: 42504
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        x: i32,
    }
    let ans = if x == 0 {
        1
    } else {
        0
    };
    println!("{}", ans);
}

Measured memory_bytes: 2140
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

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

Measured memory_bytes: 256
#include <stdio.h>

#define INF 1145141919

int ai[1005];
int bi[1005];
int c[1005][15];
int dp[(1 << 12) + 5][1005];

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

int main() {

	int N, M;

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

	int i, j, k;

	for (i = 0; i < M; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		ai[i] = a;
		bi[i] = b;
		for (j = 0; j < b; j++) {
			scanf(" %d", &c[i][j]);
		}
	}

	for (i = 0; i < (1 << 12); i++) {
		for (j = 0; j <= M; j++) {
			dp[i][j] = INF;
		}
	}
	for (i = 0; i <= M; i++) {
		dp[0][i] = 0;
	}

	for (i = M - 1; i >= 0; i--) {
		for (j = 0; j < (1 << N); j++) {
			int x = 0;
			for (k = 0; k < bi[i]; k++) {
				x |= (1 << (c[i][k] - 1));
			}
			dp[j | x][i] = min(dp[j | x][i + 1], min(dp[j][i + 1] + ai[i], dp[j | x][i]));
			dp[j][i] = min(dp[j][i + 1], dp[j][i]);
			}
	}

	int ans = INF;

	for (i = 0; i <= M; i++) {
		if (ans > dp[(1 << N) - 1][i]) {
			ans = dp[(1 << N) - 1][i];
		}
	}

	if (ans == INF) { printf("-1\n"); }
	else { printf("%d\n",ans); }
	return 0;
}

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

int main(){
  string input; cin >> input;
  vector<int> s; int c=1; vector<int> v; int sum=0;
  
  s.push_back((int)input[0]-48);
  for(int i=1; i<input.size(); i++){
    s.push_back((int)input[i]-48);
    if(s[i]!=s[i-1]){c++;}
    else{
      v.push_back(c);
      if(v.size()%2==1){sum = sum+c;}
      c=1;
    }
  }
  v.push_back(c);
  if(v.size()%2==1){sum = sum+c;}
  
  cout << min(sum, (int)input.size()-sum);
  
  return 0;
}

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

using namespace std;

const int N = 2e5 + 7;

int n;
int A[N], B[N];

int main(){
	scanf("%d", &n);
	long long AA = 0, DD = 0, EE = 0;
	int eq = 0, a = 0, b = 0;
	long long mn = -LONG_LONG_MAX, tot = 0;
	for(int i = 1; i <= n; ++i){
		scanf("%d %d", &A[i], &B[i]);
		if(A[i] == B[i]){
			eq += 1;
			AA += A[i];
		}
		else if(A[i] < B[i]){
			AA += A[i];
			a += 1;
		}
		else{
			DD += A[i] - B[i];
			EE += A[i];
			mn = max(mn, -1LL * B[i]);
			b += 1;
		}
		tot += A[i];
	}
	if(eq == n) printf("0\n");
	else{
		if(a == 1 || b == 1) printf("%lld\n", AA + DD);
		else if(mn != -LONG_LONG_MAX) printf("%lld\n", max(EE, tot + mn));
		else printf("%lld\n", tot);
	}
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
using namespace std;
#define ll long long

int main(void){
    ll n;
    cin >> n;
    ll a[n];
    ll check[n];
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        check[i] = 0;
    }
    sort(a, a+n);
    ll count = 0;
    for(ll i = 0; i < n; i++){
        check[count]++;
        if(a[i] != a[i+1])
            count++;
    }
    sort(check, check+count);
    ll ans = 0;
    ll b = 0;
    while(b < count-1){
        if(check[b] > 1){
            check[b]--; check[b+1]--;
            ans+=2;
        }
        else
            b++;
    }
    if(check[count-1]%2 == 1)
        ans+=(check[count-1]-1);
    else
        ans+=check[count-1];
    
    cout << n-ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val s = sc.next.toCharArray

  val res = s.foldLeft(""){case (str,c) =>
    c match{
      case '0' => str + 0
      case '1' => str + 1
      case 'B' => if(str.length == 0) str else str.substring(0,str.length - 1)
    }
  }

  println(res)

}

Measured memory_bytes: 25660
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;
typedef long long int lli;
typedef pair<int, int> ii;

int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }

    int a2 = c[1][0] - c[0][0];
    int a3 = c[2][0] - c[0][0];
    for (int i = 1; i < 3; i++) {
        if (a2 != c[1][i] - c[0][i]) {
            cout << "No" << endl;
            return 0;
        }

        if (a3 != c[2][i] - c[0][i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

int GetDayOfWeek(int nYear, int nMonth, int nDay)
{
	if (nMonth == 1 || nMonth == 2) {
		nYear--;
		nMonth += 12;
	}
	return (nYear + nYear / 4 - nYear / 100 + nYear / 400 + (13 * nMonth + 8) / 5 + nDay) % 7;
}


int main(){
	int a, b;
	while(cin >> a >> b){
		if(a == 0 && b == 0) break;
		string str;
		int s = GetDayOfWeek(2004, a, b);
		switch(s){
		case 0:
			str = "Sunday";
			break;
		case 1:
			str = "Monday";
			break;
		case 2:
			str = "Tuesday";
			break;
		case 3:
			str = "Wednesday";
			break;
		case 4:
			str = "Thursday";
			break;
		case 5:
			str = "Friday";
			break;
		case 6:
			str = "Saturday";
			break;
		}
	
	cout << str << endl;

	}

    return 0;
}

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

int main(void){
    char s[4];
    int ans=0;
    for(int i=0;i<4;i++) cin>>s[i];
    
    for(int i=0;i<4;i++){
        if(s[i]=='+'){
            ans++;
        } else {
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a,b = map(int, input().split())
s = str(input())
num = ['0','1','2','3','4','5','6','7','8','9']
m = 0
for i in range(a+b+1):
    if i == a:
        if s[i] == '-':
            m += 1
    else:
        for h in num:
            if s[i] == h:
                m += 1
if m == a+b+1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9096
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

typedef struct {
    int index;
    int num;
} Num;

int my(const void *a, const void *b) {
  return (((const Num*)a)->num - ((const Num*)b)->num);
}

int main() {
    int q = ri();
    FOR(i,q) {
        s64 a = ri();
        s64 b = ri();
        if (a>b) swap(a,b);
        if (a == b || a+1 == b) cout << (a*2-2) << endl;
        else {
            // にぶたん?
            s64 def = ((s64)a)+b-1; // *2
            s64 r1 = b-a-2;
            s64 l = 0;
            
            s64 r = r1;
            // cout << "def : " << def << endl;
            // cout << "r1 : " << r1 << endl;
            while(l<r) {
                s64 m = (l+r)/2;
                s64 mm = def-m;
                s64 s;
                if (mm%2) s = mm/2*(mm/2+1);
                else s = mm/2*mm/2;
                if (s < (((s64)a)*b)) {
                    r = m;
                } else {
                    l = m+1;
                }
            }
            s64 r2 = l;
            // cout << "r2 : " << r2 << endl;
            cout << (a*2-1+r1-r2) << endl;
        }
    }
    
 return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys


def solve(N: int, W: "List[int]"):
    wsum = sum(W)
    S1 = 0
    S2 = wsum
    diff = sys.maxsize
    for i in range(N - 1):
      S1 += W[i]
      S2 -= W[i]
      diff = min(diff, abs(S1-S2))
    print(diff)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long LL;
const int M=2e5+5;
const int MO=1e9+7;

int add(int x,int y)
{
	x+=y;
	if(x>=MO) x-=MO;
	return x;
}
int sub(int x,int y)
{
	x-=y;
	if(x<0) x+=MO;
	return x;
}
int mul(int x,int y)
{
	return 1LL*x*y%MO;
}

int qp(int a,int n)
{
	int ans=1;
	while(n)
	{
		if(n&1) ans=mul(ans,a);
		a=mul(a,a);
		n>>=1;
	}
	return ans;
}

vector<int> g[M];
int sz[M];
int dfs1(int u,int fa)
{
	sz[u]=1;
	for(int v:g[u])
	{
		if(v==fa) continue;
		sz[u]+=dfs1(v,u);
	}
	return sz[u];
}

int ans=0;
int n;
void dfs2(int u,int fa)
{
	ans=add(ans,sub(qp(2,n-1),1));
	if(fa)
		ans=sub(ans,sub(qp(2,n-sz[u]),1));
	for(int v:g[u])
	{
		if(v==fa) continue;
		ans=sub(ans,sub(qp(2,sz[v]),1));
		dfs2(v,u);
	}
}

int main()
{
	scanf("%d",&n);
	int u,v;
	for(int i=0;i<n-1;i++)
	{
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs1(1,0);
	dfs2(1,0);
	printf("%d\n",mul(ans,qp(qp(2,n),MO-2)));
	return 0;
}

Measured memory_bytes: 18688
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL

int main(){
  ll N, D, A;
  cin >> N >> D >> A;
  vector<Pll> xh(N);
  for(int i = 0; i < N; i++){
    ll x, h;
    cin >> x >> h;
    xh.at(i).first = x;
    xh.at(i).second = h;
  }
  sort(ALL(xh));
  vll X(N), HP(N);
  for(int i = 0; i < N; i++){
    X.at(i) = xh.at(i).first;
    HP.at(i) = xh.at(i).second;
  }
  vll imos(N, 0);
  ll ans = 0;
  for(int i = 0; i < N; i++){
    ll xx = xh.at(i).first;
    ll hh = xh.at(i).second;
    if(i > 0) imos.at(i) += imos.at(i-1);
    ll dd = hh - imos.at(i);

    if(dd <= 0) continue;

    ll num = (dd + A - 1) / A;
    ans += num;
    imos.at(i) += num * A;
    auto ite = upper_bound(ALL(X), xx + 2 * D);
    ll dist = distance(X.begin(), ite);
    if(dist < N) imos.at(dist) -= num * A;
  }
  cout<< ans << endl;
}


Measured memory_bytes: 8064
N = int(input())
S = []
cnt = 0
for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    S.append(new_str)

# print(S)

import collections

c = collections.Counter(S)

# print(c)

ary = c.values()

import math

def combinations_count(n, r = 2):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in ary:
    if i != 1:
        cnt += combinations_count(i)


print(cnt)

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

int main() {
	long long a,b,c,k;
	cin >> a >> b >> c >> k;
	long long total=k;
	if(k>a&&k<=a+b)
	{
		total=a;
	}
	if(k>a+b)
	{
		total=a-(k-(a+b));
	}
	cout << total;
	
  
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N;cin >> N;
    vector<int> S(N);
    rep(i,N)cin >> S[i];

    int M;cin >> M;
    vector<int> T(M);
    rep(i,M)cin >> T[i];

    int ans = 0;
    rep(i,M){
        if(binary_search(all(S),T[i]))ans++;
    }

    cout << ans << endl;

    

}


Measured memory_bytes: 3304
using System;
class Program
{
	static void Main(string[] args)
	{
        int num = int.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');

        int count = 0;
        bool canContinue = true;
        while (canContinue)
        {
            for (int i = 0; i < num; i++)
            {
                int value = int.Parse(input[i]);
                if (value % 2 == 0) {
                    input[i] = (value / 2).ToString();
                } else {
                    canContinue = false;
                    break;
                }
            }

            if (canContinue) 
            {
                count++;
            }
        }

        //出力
		Console.WriteLine(count);
	}
}

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

#define INF 1e+10;

int n,ans,a[21];

void dfs(int diff,int k){
	if(k>=n){
		ans = min(ans,abs(diff));
	}
	else{
		dfs(diff+a[k],k+1);
		dfs(diff-a[k],k+1);
	}
}

int main(){
	while(cin>>n,n){
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		ans=INF;
		dfs(0,0);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1160
N,M=gets.split.map(&:to_i)

H=gets.split.map(&:to_i)

mtx = Array.new(N, 1)
M.times do
  a,b=gets.split.map(&:to_i)
  if H[a-1] == H[b-1]
    mtx[a-1] = 0
    mtx[b-1] = 0
  elsif H[a-1] > H[b-1]
    mtx[b-1] = 0
  else
    mtx[a-1] = 0
  end
end
puts mtx.reduce(:+)


Measured memory_bytes: 22592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    long long h;
    cin >> h;
    long count = 0;
    if(h==1) {
        cout << "1" <<endl;
        return 0;
    }
    while(1){
       h=h/2;
       count ++;
       if(h==1) break;
    }
    long ans =0;
    cout << (long long)(1-pow(2,count+1))/(1-2) << endl;
    return 0;
}


Measured memory_bytes: 256
S = ''
while True:
    try:
        S_tmp = input()
        S += S_tmp
    except EOFError:
        break

import string
from collections import OrderedDict
d = OrderedDict.fromkeys(string.ascii_lowercase, 0)

for s in S.lower():
    if s in d.keys():
        d[s] += 1

for key in d.keys():
    print('{} : {}'.format(key, d[key]))


Measured memory_bytes: 6684
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  long N, M;
  cin >> N >> M;
  unordered_map<long, unordered_set<long>> connect;
  rep (i, M) {
    long a, b;
    cin >> a >> b;
    connect[a].insert(b);
    connect[b].insert(a);
  }
  long odd_nodes = 0;
  long four_nodes = 0;
  long six_nodes = 0;
  vector<long> four_node_indexes;
  for (auto it: connect) {
    long size = it.second.size();
    if (size % 2 == 1) odd_nodes ++;
    if (size == 4) {
      four_nodes ++;
      four_node_indexes.push_back(it.first);
    }
    if (size % 2 == 0 and size >= 6) six_nodes ++;
  }
  if (odd_nodes != 0) {
    cout << "No" << endl;
    return 0;
  }
  if (six_nodes != 0) {
    cout << "Yes" << endl;
    return 0;
  }
  if (four_nodes < 2) {
    cout << "No" << endl;
    return 0;
  }
  if (four_nodes > 2) {
    cout << "Yes" << endl;
    return 0;
  }
  for (auto it: connect[four_node_indexes[0]]) {
    long current = it;
    unordered_set<long> walked;
    walked.insert(four_node_indexes[0]);
    while (true) {
      if (current == four_node_indexes[1]) {
        break;
      }
      unordered_set<long> neibor = connect[current];
      auto it2 = neibor.begin();
      long foo = *it2;
      it2++;
      long bar = *it2;
      if (walked.count(foo) != 0 and walked.count(bar) != 0) {
        cout << "Yes" << endl;
        return 0;
      }
      long next = walked.count(foo) == 0 ? foo : bar;
      walked.insert(current);
      current = next;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 21040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

vector<int> READ(int n){
    vector<int> x(n);
    rep(i,n) cin >>x[i];
    sort(all(x));
    return x;
}

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

    vector<int> v[3];
    rep(i,3) v[i] = READ(n);

    ll ans = 0;
    rep(i,n){
        int sz = v[1][i];
        ll x = lower_bound(all(v[0]), sz) - v[0].begin();
        ll y = n - (upper_bound(all(v[2]), sz) - v[2].begin());
        ans += x*y;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

struct Stone{
	int col,slip;
	Stone(){}
	Stone(int c,int s):col(c),slip(s){}
};

const int INFTY=1<<29;

int main()
{
	for(int row,jump;cin>>row>>jump,row|jump;){
		vector<vector<Stone> > stones(row+2);
		rep(i,row){
			int n;
			cin>>n;
			stones[i].resize(n);
			rep(j,n){
				cin>>stones[i][j].col>>stones[i][j].slip;
				stones[i][j].col--;
			}
		}
		//dump(row);
		//dump(jump);
		//rep(i,row){
		//	rep(j,stones[i].size())
		//		printf("%d,%d ",stones[i][j].col,stones[i][j].slip);
		//	puts("");
		//}
		
		vvvi dp(row);
		rep(i,dp.size())
			dp[i].resize(stones[i].size(),vi(jump+1,INFTY));
		rep(i,dp[0].size())
			dp[0][i][0]=0;
		if(jump>0)
			rep(i,dp[1].size())
				dp[1][i][1]=0;
		
		repi(i,1,row){
			rep(j,dp[i].size())
				rep(k,dp[i-1].size())
					rep(l,jump+1){
						int newslip=dp[i-1][k][l]+(stones[i][j].slip+stones[i-1][k].slip)*abs(stones[i][j].col-stones[i-1][k].col);
						dp[i][j][l]=min(dp[i][j][l],newslip);
					}
			if(jump==0 || i==1)
				continue;
			rep(j,dp[i].size())
				rep(k,dp[i-2].size())
					repi(l,1,jump+1){
						int newslip=dp[i-2][k][l-1]+(stones[i][j].slip+stones[i-2][k].slip)*abs(stones[i][j].col-stones[i-2][k].col);
						dp[i][j][l]=min(dp[i][j][l],newslip);
					}
		}
		
		//rep(i,jump+1){
		//	dump(i);
		//	rep(j,row){
		//		rep(k,dp[j].size())
		//			cout<<dp[j][k][i]<<" ";
		//		cout<<endl;
		//	}
		//}
		
		int res=INFTY;
		rep(i,dp[row-1].size())
			rep(j,jump+1)
				res=min(res,dp[row-1][i][j]);
		if(jump>0)
			rep(i,dp[row-2].size())
				rep(j,jump)
					res=min(res,dp[row-2][i][j]);
		
		//dump(res);
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1396
#include <iostream>
#include<algorithm>
#include <cmath>
#include<vector>
#include<cstdlib>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (b%a == 0) {
		cout << a + b;
	}
	else {
		cout << b - a;
	}
	return(0);

}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long[] x = new long[n];
        long[] y = new long[n];
        long[] z = new long[n];
        long xa, ya, za;
        boolean[] f = new boolean[n];
        int[][] s = {{1,1,1}, {1,1,-1}, {1,-1,1}, {1,-1,-1}, {-1,1,1}, {-1,1,-1}, {-1,-1,1}, {-1,-1,-1}};
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextLong();
            y[i] = sc.nextLong();
            z[i] = sc.nextLong();
        }
        long[] a = new long[8];
        
        
        for (int i = 0; i < 8; i++) {
            xa = 0;
            ya = 0;
            za = 0;
            for (int j = 0; j < n; j++) {
                f[j] = true;
            }
            for (int j = 0; j < m; j++) {
                long xb = xa;
                long yb = ya;
                long zb = za;
                int p = -1;
                for (int k = 0; k < n; k++) {
                    long xc = xa + x[k];
                    long yc = ya + y[k];
                    long zc = za + z[k];
                    if (f[k]) {
                        if (xb*s[i][0] + yb*s[i][1] + zb*s[i][2] < xc*s[i][0] + yc*s[i][1] + zc*s[i][2] || (xa == xb && ya == yb && za == zb)) {
                            p = k;
                            xb = xc;
                            yb = yc;
                            zb = zc;
                        }
                    }
                }
                f[p] = false;
                xa += x[p];
                ya += y[p];
                za += z[p];
            }
            a[i] = Math.abs(xa) + Math.abs(ya) + Math.abs(za);
        }
        
        
        Arrays.sort(a);
        System.out.println(a[7]);
    }    
}


Measured memory_bytes: 27296
#include <bits/stdc++.h>
using namespace std;
int main(){
  int R;
  cin >> R;
  if(R < 1200)cout << "ABC" << endl;
  if(1200 <= R && R < 2800)cout << "ARC" << endl;
  if(2800 <= R )cout << "AGC" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define MAX 100100
using namespace std;

long long f(long long a, long long b) {
	long long tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}
	while (b != 0) {
		tmp = a % b;
		a = b;
		b = tmp;
	}
	return a;
}
int main()
{
	long long a, b, g;
	scanf("%lld%lld", &a, &b);
	g = f(a, b);
	printf("%lld", a*b / g);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int M; cin >> M;
    LL ans = 0;
    LL sum = 0;
    LL dig = 0;
    REP(i,M){
        LL d,c; cin >> d >> c;
        sum += d * c;
        dig += c;
    }
    ans += dig-1;
    ans += ((sum-9)+8)/9;
    cout << ans << endl;

}


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

int main(void){
	long W,H;
	long x,y;
	cin>> W >> H >> x >> y;

	std::pair<double,double> center = make_pair(W / 2.0, H / 2.0);

	double area = (W * H) / 2.0;
	printf("%lf %d\n",area, (x == center.first && y == center.second));

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
 
const int MX = 100005;
 
int main(){
  int ans = 0;
  char a[3];
  rep(i,3){
    cin >> a[i];
  }
  if(a[0] == 'R' && a[1] == 'R' && a[2] == 'R'){ans = 3;}
  else if(a[0] == 'R' && a[1] == 'R' && a[2] == 'S'){ans = 2;}
  else if(a[0] == 'S' && a[1] == 'R' && a[2] == 'R'){ans = 2;}
  else if(a[0] == 'S' && a[1] == 'S' && a[2] == 'S'){ans = 0;}
  else {ans = 1;}
  cout << ans << endl;
  
}

Measured memory_bytes: 3580
#include <iostream>
using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  else return gcd(y, x%y);
}

int main(){
  ll a, b; cin >> a >> b; ll c = gcd(a, b), an = 1;
  ll co = 2;
  while (c != 1 && co * co < 1e12) {
    bool did = false;
    while(c%co == 0) {
      if (!did) {an++; did=true;}
      c/=co;
    } co++;
  }
  if (c!=1) an++;
  cout << an << endl;
}

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

using namespace std;

int main() {
  string S; 
  int counter=0;
  int tmp=0; 
  
  cin >> S; 

  for(int i=0; i <(int)S.length(); i++){
    if(S[i]=='T'){
      if(tmp == 0){
	counter++;
      }else{
	tmp--;
      }
    }else{
      tmp++;
    }
  }
  if(tmp!=counter)
    cout << "ERROR" << endl;

  cout << tmp*2 <<endl;
  
  return 0;
}
  


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n){
    if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0)judge=false;
  }
  ans(judge,"APPROVED","DENIED");
  return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		HashSet<Integer> set = new HashSet<Integer>();
		set.add(1);
		for(int i = 2; i <= Math.sqrt(N); i++){
			int tmp = i;
			while(tmp <= N){
				set.add(tmp);
				tmp *= i;
			}
		}
		while(true){
			if(set.contains(N)){
				myout(N);
				return;
			}
			N--;
		}
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32776
n = int(input())

def main():
    ans = [0]*(n+1)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if fn > n:
                    break
                else:
                    ans[fn] += 1

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;

int d[5];

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

	int n;cin>>n;
	
	map<ll,ll> mp;
	
	rep(i,n){
		int tmp; cin>>tmp;
		
		mp[tmp]++;
	}
	
	int cnt =0;
	
	for(auto e : mp){
		if(e.second % 2 !=0)cnt++;
	}
	
	writeln(cnt);


}


Measured memory_bytes: 6528
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [k, s] <- fmap read . words <$> getLine :: IO [Int]
    let as = do
        x <- [0 .. k]
        y <- [0 .. k]
        let z = s - x - y
        guard (0 <= z && z <= k)
        return 1
    print $ sum as

Measured memory_bytes: 1148
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    int N; cin >> N;
    vector<int> X(N);
    vector<int> Y(N);
    for(int i=0; i<N; i++){
        cin >> X[i] >> Y[i];
    }
    
    vector<PII> E;
    
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            E.push_back({X[i] - X[j], Y[i] - Y[j]});
            E.push_back({X[j] - X[i], Y[j] - Y[i]});
        }
    }
    
    int ans = INF;
    for(int i=0; i<(int)E.size(); i++){
        int p = E[i].fs;
        int q = E[i].sc;
        int cnt = 0;
        
        for(int j=0; j<(int)E.size(); j++){
            if(E[j].fs==p && E[j].sc==q) cnt++;
        }
        
        int cul = N - cnt;
        if(cul == 0) cul = 1;
        ans = min(ans, cul);
    }
    
    if(N==1) ans = 1;
    cout << ans << endl;
    
    return 0;
}



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

int main(){
    int i,n,m,s;
    long long sum = 0;
    priority_queue<int> que;
    cin>>n>>m;
    for(i=0;i<n;i++){
        cin>>s;
        que.push(s);
    } // input end
    for(i=0;i<m;i++){
        s = que.top()/2;
        que.pop();
        que.push(s);
    }
    while(!que.empty()){
        sum += que.top();
        que.pop();
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 n;
  string s;
  cin >> n >> s;
  auto t = s.substr(0, n / 2);
  if(s == t + t) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(i % 2 == 0){
      if(s.at(i) == 'p') ans--;
    }
    else{
      if(s.at(i) == 'g') ans++;
    }
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
    bool ok=true;
   char X,Y;
    int x,y;
    cin>>X;
    cin>>Y;

    char answer;
    if(X=='A')
      x=10;
    if(Y=='A')
        y=10;
    if(X=='B')
        x=11;
    if(Y=='B')
        y=11;
    if(X=='C')
        x=12;
    if(Y=='C')
        y=12;
    if(X=='D')
        x=13;
    if(Y=='D')
        y=13;
    if(X=='E')
        x=14;
    if(Y=='E')
        y=14;
    if(X=='F')
        x=15;
    if(Y=='F')
        y=15;


    if(x<y)
        answer='<';
    if(x==y)
        answer='=';
    if(x>y)
        answer='>';



printf("%c",answer);
    return 0;
}

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

int main() {
  int n,k;
  cin>>n>>k;
  string S;
  cin>>S;

  vector<int> nums;
  if (S[0]=='0') nums.push_back(0);
  for (int i=0;i<S.size();) {
    int j=i;
    while (j<S.size()&&S[j]==S[i]) ++j;
    nums.push_back(j-i);
    i=j;
  }
  if (S.back()=='0') nums.push_back(0);

  vector<int> sums((int)nums.size()+1, 0);
  for (int i=0; i<nums.size(); i++) sums[i+1]=sums[i]+nums[i];

  int res=0;
  for (int left=0; left<sums.size(); left+=2) {
    int right=left+k*2+1;
    if (right>=sums.size()) right=(int)sums.size()-1;
    res=max(res, sums[right]-sums[left]);
  }
  cout<<res<<endl;
}


Measured memory_bytes: 1272
use proconio::{fastout, input};
use std::collections::HashSet;

#[fastout]
fn main() {
    input! {
        n: usize
    };

    let mut set = HashSet::new();

    for _ in 0..n {
        input! {
            s: String
        };
        set.insert(s);
    }

    println!("{}", set.len());
}


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

int main() {
    int x,a,b;
    cin >> x >> a >> b;
    if(a-b >= 0){
        cout << "delicious" << endl;
    }else if(b-a <= x){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
    return 0;
}




Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <string>
#include <time.h>
#include <stdio.h>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main()
{
    int n, b, f, r, v;

    int a1[3][10] = {0};
    int a2[3][10] = {0};
    int a3[3][10] = {0};
    int a4[3][10] = {0};

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> b >> f >> r >> v;
        if (b == 1)
        {
            a1[f - 1][r - 1] += v;
        }
        else if (b == 2)
        {
            a2[f - 1][r - 1] += v;
        }
        else if (b == 3)
        {
            a3[f - 1][r - 1] += v;
        }
        else if (b == 4)
        {
            a4[f - 1][r - 1] += v;
        }
    }
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cout << " " << a1[i][j];
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cout << " " << a2[i][j];
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cout << " " << a3[i][j];
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cout << " " << a4[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

struct Item{
  int value,weight;
};

int dp[10005];

Item item[105];

signed main(){
  int n,w;
  cin>>n>>w;
  
  for(int i=0; i<n; i++) cin>>item[i].value>>item[i].weight;
  
  for(int i=0; i<n; i++){
    for(int j=0; j+item[i].weight<=w; j++){
      dp[j+item[i].weight]=max(dp[j+item[i].weight], dp[j]+item[i].value);
    }
  }
  
  cout<<dp[w]<<en;
}




Measured memory_bytes: 3136
<?php 
  fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);
  
	$rec1 = $a * $b;
	$rec2 = $c * $d;

    if($rec1 === $rec2){
        echo $rec1; 
    }elseif($rec1 > $rec2){
      echo $rec1;
    }else{
      echo $rec2;
    }

?>

Measured memory_bytes: 4856