akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main()
{

    // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    string S;
    cin >> S;

    if (S[2] == S[3] && S[4] == S[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int>a(n),b(n);
    for(auto &x:a) cin>>x;
    for(auto &x:b) cin>>x;
    const int size = log2(*max_element(a.begin(),a.end())+*max_element(b.begin(),b.end()));
    int ans=0;
    vector<int> bb(n);
    for(int i=0,t=1;i<=size;++i){
        for(int j=0;j<n;++j) bb[j] = b[j] % (2*t);
        sort(bb.begin(),bb.end());
        ll cnt=0;
        for(int j=0;j<n;++j){
            const int aa=a[j]%(2*t);
            cnt += distance(lower_bound(bb.begin(),bb.end(),t-aa),
                            lower_bound(bb.begin(),bb.end(),2*t-aa));
            cnt += distance(lower_bound(bb.begin(),bb.end(),3*t-aa),
                            lower_bound(bb.begin(),bb.end(),4*t-aa));
        }
        ans+=(cnt%2)*t;
        t*=2;
    }
    cout<<ans<<endl;
}


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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}

struct Data{
    int cnt;
    int r;
    char c;
    vector<Data*> childs;
    Data(int r, int cnt, char c = '*') : r(r), cnt(cnt), c(c), childs(0){}
};

string s;
int idx;

Data* expr(int l){
    int cnt = 0;
    int i = l;
    while('0' <= s[i] && s[i] <= '9'){
        cnt *= 10;
        cnt += (s[i] - '0');
        ++i;
    }
    if(!cnt)
        cnt = 1;
    if(s[i] == '('){
        ++i;
        Data* d = new Data(0, cnt);
        while(s[i] != ')'){
            Data* ptr = expr(i);
            d->childs.push_back(ptr);
            i = ptr->r;
        }
        d->r = i + 1;
        return d;
    }
    return new Data(i + 1, cnt, s[i]);
}

int parse(Data* d){
    if(d->childs.empty()){
        idx -= d->cnt;
        if(idx < 0){
            cout << d->c << endl;
            return -1;
        }
    }
    for(int i = 0; i < d->cnt; ++i)
        for(auto& c : d->childs){
            int ret = parse(c);
            if(ret == -1)
                return -1;
        }
    return 0;
}

bool solve(){
    cin >> s >> idx;
    if(s == "0")
        return false;

    Data* root = new Data(s.size(), 1);
    int i = 0;
    while(i != s.size()){
        root->childs.push_back(expr(i));
        i = root->childs.back()->r;
    }
    if(parse(root) != -1){
        cout << 0 << endl;
    }

    return true;
}

signed main(){
    while(solve());
}



Measured memory_bytes: 3608
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

H, W = ri_()
if H == 1 or W == 1:
    print(1)
else:
    print(-(-H * W // 2))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 1e5 + 10;
ll a[MAXN];
ll dp[MAXN][2];
ll n;
ll rec(ll idx,ll sign){
    if(idx == n){
        if(sign == 0) return a[idx];
        else return -1LL * a[idx];
    }

    ll &ans = dp[idx][sign];

    if(ans != -1) return ans;

    ll mul = 1;
    if(sign) mul = -1;
    ans = max(rec(idx+1,0) +  mul*a[idx],rec(idx+1,1) + mul*-1LL*a[idx]);

    return ans;
}   

void solve(){
    memset(dp,-1,sizeof(dp));
    cin>>n;

    FOR(i,1,n) cin>>a[i];

    cout<<rec(1,0)<<endl;
}   

signed main(){

    FastRead;    

    ll t;
    t = 1; 
    // cin>>t;
    while(t--) solve();
    
}

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

int main()
{
  int n;
  while(cin >> n){
    if(n == 0) break;
    int sum = 0;
    int s[100];
    for(int i = 0; i < n; i++)
      cin >> s[i];
    sort(s, s + n);
    for(int i = 1; i < n - 1; i++)
      sum += s[i];
    cout << sum / (n - 2) << endl;
  }
}

Measured memory_bytes: 1176
#include<iostream>
using namespace std;
int N;
int A[230];

int main(){
	cin>>N;
  	for(int i=0;i<N;++i)cin>>A[i];
  	int res=0;
  
  		while(true){
        bool exist_odd=false;
        	for(int i=0;i<N;++i){
            	if(A[i]%2!=0)exist_odd=true;
            }
        
  			if(exist_odd)break;
  			
  				for(int i=0;i<N;++i){
                	A[i]/=2;
                }	
          
         ++res;
        }
  cout<<res;
  
}


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

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 a[3];
    int b[3];
    a[0]=0;
    for(int i=0;i<3;i++){
        b[i]=c[0][i]-a[0];
    }
    a[1]=c[1][1]-b[1];
    a[2]=c[2][2]-b[2];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(a[i]+b[j]!=c[i][j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

char word[100];
int cnt[300];

int main() {
  int n;
  scanf("%d", &n);
  const char* tab = "MARCH";
  for (int i = 0; i < n; i++) {
    scanf("%s", word);
    cnt[int(word[0])]++;
  }
  long long ans = 0;
  for (int u = 0; u < 32; u++) {
    if (__builtin_popcount(u) != 3) {
      continue;
    }
    long long mu = 1;
    for (int j = 0; j < 5; j++) {
      if ((u >> j) & 1) {
        mu *= cnt[int(tab[j])];
      }
    }
    ans += mu;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>

using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sci(x) int x;scanf("%d",&x);
#define scii(x, y) int x,y;scanf("%d%d",&x,&y);

set<int> st1{1,3,5,7,8,10,12};
set<int> st2{4,6,9,11};
set<int> st3{2};

int main() {
  scii(x,y)
  string ans;
  if (st1.count(x)&&st1.count(y)) ans="Yes";
  else if (st2.count(x)&&st2.count(y)) ans="Yes";
  else if (st3.count(x)&&st3.count(y)) ans="Yes";
  else ans="No";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define lld double
#define vi vector<ll>
#define pii pair<int,int>
#define piii pair<pii, ll>
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define ppb pop_back
#define d0(x) cout<<x<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<x<<" "<<y<<"\n"
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
using namespace std;
const ll mod = 1e9+7;


int main()
{
    char c[3];

    cin>>c;

    if(c[0]!=c[1]||c[1]!=c[2]||c[2]!=c[0])
    {
        d1("Yes");
    }
    else
    {
        d1("No");
    }
}


Measured memory_bytes: 256
# 出力
a, b = map(int, input().split())

# 処理&出力
if (a + b) % 3 == 0:
    print('Possible')
elif a % 3  == 0:
    print('Possible')
elif b % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 8984
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using tiii = tuple<int,int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  int n; cin >> n;
  string a,b; cin >> a >> b;
  rep(i,n)  cout << a[i] << b[i];
  cout << endl;
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long ans=sc.nextLong();
        long tmp;
        for(int i=1;i<N;i++){
            tmp=sc.nextLong();
            ans=ans/gcd(ans,tmp)*tmp;
        }
        System.out.println(ans);
    }

    public static long gcd(long m, long n) {
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;


int main(){
    ll S, W;
    cin>>S>>W;
    if(S>W){
        cout<<"safe"<<endl;
    }
    else{
        cout<<"unsafe"<<endl;
    }
}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}
int h,w;

int bfs(int sh,int sw,vector<string> g){
	vector<vector<int>> dist(h,vector<int>(w,INF));
	queue<P> que;
	que.push(P(sh,sw));

	dist[sh][sw] = 0;
	while(!que.empty()){
		P p = que.front();que.pop();
		int x = p.first, y = p.second;
		rep(i,4){
			int nx = x + dx[i];
			int ny = y + dy[i];
			
			if(valid(0,h,0,w,nx,ny) && g[nx][ny] != '#'){
				if(dist[nx][ny]==INF){
					dist[nx][ny] = dist[x][y] + 1;
					que.push(P(nx,ny));
				}
			}
		}
	}

	int ret = 0;
	rep(i,h)rep(j,w){
		if(dist[i][j] < INF) ret = max(ret,dist[i][j]);
	}
	return ret;
}

int main()
{
	cin>>h>>w;
	vector<string> s(h);
	rep(i,h)cin>>s[i];

	int ans = 0;

	rep(sh,h){
		rep(sw,w){
			if(s[sh][sw]=='#')continue;
			ans = max(ans,bfs(sh,sw,s));
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cmath>
 
using namespace std;

int main(){
    int w, n;
    cin >> w;
    cin >> n;
    int stick[31] = {0};
    for(int i = 1; i <= w; i++){
        stick[i] = i;
    }

    for(int i = 0; i < n; i++){
        int a, b;
        int temp;
        scanf("%d,%d", &a, &b);
        temp = stick[a];
        stick[a] = stick[b];
        stick[b] = temp;
    }

    for(int i = 1; i <= w; i++){
        cout << stick[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 1240
#include<stdio.h>

#define STR_MAX_SIZE (101)

int main(void)
{
        char str_p[STR_MAX_SIZE * 2] = { 0 };
        char str_s[STR_MAX_SIZE] = { 0 };
        int i, j, str_p_size, is_find;

        is_find = -1;

        scanf("%s", str_p);
        scanf("%s", str_s);

        for(i=0; i < STR_MAX_SIZE; i++){
                if(str_p[i] == '\0'){
                        str_p_size = i;
                        for(j=0; j < str_p_size; j++){
                                str_p[j + str_p_size] = str_p[j];
                        }
                        str_p[str_p_size * 2] = '\0';
                        break;
                }
        }

        for(i=0; i < STR_MAX_SIZE * 2; i++){
                if(str_p[i] == '\0'){
                        break;
                }

                if(str_p[i] == str_s[0]){
                        for(j=0; j < STR_MAX_SIZE; j++){
                                if(str_s[j] == '\0'){
                                        is_find = 1;
                                        break;
                                }

                                if(str_p[i + j] != str_s[j]){
                                        break;
                                }
                        }
                }
        }

        if(is_find > 0){
                printf("Yes\n");
        }else{
                printf("No\n");
        }

        return 0;
}


Measured memory_bytes: 2108
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    d = dict()
    for a in A: d[a] = d.get(a, 0) + 1

    if len(d) == 1:
        a = list(d.keys())[0]
        if a == 0:
            return "Yes"
    elif len(d) == 2:
        a, b = list(d.keys())
        if a == 0 and d[b] == 2*d[a]:
            return "Yes"
        if b == 0 and d[a] == 2*d[b]:
            return "Yes"
    elif len(d) == 3:
        a, b, c = list(d.keys())
        if d[a] == d[b] == d[c]:
            if (a^b == c and b^c == a and c^a == b) or (a^c == b and c^b == a and b^a == c):
                return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 14708
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <cstring>

#define test(t) while(t--)
#define fo(i,k,n) for(int i=k;i<n;i++)
#define refl(a,x) for(auto& a:x)
#define MIN(a,b)  (a>b?b:a)
#define ll  long long int
#define MOD 1e9 + 7
#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "
#define fi first
#define se second
#define fast()  ios_base::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
//typedef pair<int,int> pai;
//typedef pair<char,int> pac;



/*bool f(int x,int y){

return x>y;
}*/


using namespace std;


void solve()
{ ll n,m;
  in n>>m;
  ll a[m];
  ll sum = 0;
  for(ll i=0;i<m;i++){
    in a[i];
    sum += a[i];
  }
  if(sum>n)
    out "-1"<<en;
  else
    out n-sum<<en;
}

int main(){ fast()
             //freopen("input.txt","r",stdin);
	         //freopen("output.txt","w",stdout);
             ll t=1;
             //cin>>t;
            test(t){
            solve();
            }
return 0;}


Measured memory_bytes: 3684
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	vector<pii> A;
	int a, b, c, d, e, f;
	REP(i, 6) {
		int s, t;
		cin >> s >> t;
		A.push_back(pii(min(s, t), max(s, t)));
	}
	SORT(A);
	for (int i = 0; i < 6; i += 2) {
		if (A[i].first != A[i + 1].first || A[i].second != A[i + 1].second) {
			cout << "no" << endl;
			return 0;
		}
		else {
			if (i == 0) {
				a = A[i].first;
				b = A[i].second;
			}
			else if (i == 2) {
				c = A[i].first;
				d = A[i].second;
			}
			else {
				e = A[i].first;
				f = A[i].second;
			}
		}
	}
	bool ans = false;
	if (a == c) {
		if (b == f && d == e)ans = 1;
		else if (b == e && d == f)ans = 1;
	}
	else if (a == d) {
		if (b == f && c == e)ans = 1;
		else if (b == e && c == f)ans = 1;
	}
	else if (a == e) {
		if (b == c && d == f)ans = 1;
		else if (b == d && c == f)ans = 1;
	}
	else if (a == f) {
		if (b == c && d == e)ans = 1;
		else if (b == d && c == e)ans = 1;
	}
//	cout << a << " " << b << " " << c << " " << d << " " << e << " "<<f << endl;
	cout << (ans ? "yes" : "no") << endl;
	return 0;
}




Measured memory_bytes: 3220
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

// GCDを計算します
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
    if (a < b) {
        NumType tmp = a;
        a = b;
        b = tmp;
    }

    NumType r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

// 約数を数えます
template <typename NumType>
NumType cntDivisor(const NumType & num) {
    NumType cnt = 0;
    for(NumType i = 1; i * i <= num; ++i) {
        if(num % i == 0) {
            cnt++;
            if(i * i != num) cnt++;
        }
    }

    return cnt;
}

// [beg, end)の範囲を，添え字indexでループするfor文に置換します
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"

ll powMod(ll a, ll n, ll mod){
    if(n == 0) return 1;
    if(n%2 == 0)
        return powMod(a, n/2, mod) * powMod(a, n/2, mod) % mod;
    else
        return a * powMod(a, n-1, mod)% mod;
}

ll ncrMod(ll n, ll r, ll mod){
    ll x=1, y=1;
    for(ll i = 1; i <= r; ++i){
        x *= n-i+1;
        x %= mod;
        y *= i;
        y %= mod;
    }
    return x * powMod(y, mod-2, mod) % mod;
}

int main() {
    int N, M;
    int s[5], c[5];

    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> s[i] >> c[i];
    }

    int min = (N==1) ? 0 : pow(10, N-1);
    int max = pow(10, N);

    for (int num = min; num < max; num++) {
        int keta[3];
        int num2 = num;

        int keta_cnt = 0;

        if (num2 == 0) keta_cnt = 1;
        else while (num2 > 0) { keta_cnt++; num2 /= 10;}

        num2 = num;

        for (int i = keta_cnt -1; i >= 0; i--) {
            keta[i] = (num2 == 0 && i > 0) ? -1 : num2 % 10;
            num2/=10;
        }

        // for (int i = 0; i < 3; i++) {
        //     cout << keta[i] << " ";
        // }
        // cout << "\n";

        int cnt = 0;
        for (int i = 0; i < M; i++) {
            if (keta[s[i] - 1] == c[i]) {
                cnt++;
            //    cout << "true: " << keta[s[i] - 1] << c[i] << "\n";
            } else {
              //  cout << "fa: " << keta[s[i] - 1] << c[i] << "\n";
            }
        }

        if (cnt == M) {
            cout << num;
            return 0;
        }
        if (num == max - 1) {
            cout << -1;
        }
    }


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,n;
int main(){
	scanf("%ld%ld%ld",&a,&b,&n);
	if(n<b){
		double ans=floor(a*1.0/b*n);
		printf("%.0lf\n",ans);
		return 0;
	}
	long long t=n%b;
	if(t!=(b-1)){
        n=n-t-1;
	}
	double ans=floor(a*1.0/b*n)-a*floor(n*1.0/b);
	printf("%.0lf\n",ans);
	return 0;
}


Measured memory_bytes: 3872
#define _USE_MATH_DEFINES
#define llint long long
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
using namespace std;


llint AGC(llint a, llint b) {
    llint c = a % b;
    if (c == 0) return b;
    return AGC(b, c);
}

bool solve(llint a, llint b, llint c, llint d) {
    if (b > a) return false;
    if (b > d) return false;
    if (a < c) {
        if (b == d) return true;
        llint n = (c - a) / (d - b);
        if (c - a != d - b) n++;
        a += (d - b) * n;
    }
    if ((a - c) % AGC(b, d) < b - c) return false;
    return true;
}

int main() {
    llint t;
    llint a, b, c, d;

    cin >> t;
    while (t--) {
        cin >> a >> b >> c >> d;
        if (solve(a, b, c + 1, d)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}

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

int main() {
	int r, g, b, total;

	cin >> r >> g >> b;

	total = (r * 100) + (g * 10) + b;

	if (total % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    a81(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a81(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    println(args[0].count { it == '1' })
}

Measured memory_bytes: 33692
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
/* テンプレートここまで */

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

  cout << fixed << setprecision(6);
  cout << (W*H)/2.0 << " ";

  if(W%2 == 0 && x == W/2 && H%2 == 0 && y == H/2){
    cout << "1" << endl;
  }else{
    cout << "0" << endl;
  }
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

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

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Pair[] pairs = new Pair[n];
		for (int i = 0; i < n; i++) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			pairs[i] = new Pair(a, b);
		}
		Arrays.sort(pairs);
		PriorityQueue<Pair> pq = new PriorityQueue<Pair>();
		long sum = 0;
		long ret = 0;
		for (int i = 0; i < n; i++) {
			pq.offer(new Pair(pairs[i].s, pairs[i].f));
			sum += pairs[i].f;
			while (!pq.isEmpty() && pq.peek().f * pq.size() < sum)
				sum -= pq.poll().s;
			ret = Math.max(ret, pq.size());
		}
		System.out.println(ret);

	}

	class Pair implements Comparable<Pair> {
		long f, s;

		@Override
		public String toString() {
			return "Pair [f=" + f + ", s=" + s + "]";
		}

		public Pair(long f, long s) {
			super();
			this.f = f;
			this.s = s;
		}

		@Override
		public int compareTo(Pair o) {
			return (int) (f - o.f);
		}

	}
}

Measured memory_bytes: 195644
#include "bits/stdc++.h"
using namespace std;
int main(){
    string s;
    int count = 0;
    cin >> s;
    for(int i = 0; i < 3; i++){
        if(s.at(i) == 'o')
        count +=100;
    }
    cout << 700 + count << endl;
    return 0; 
}

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

    double r,area,C;
    scanf("%lf",&r);
    if(r>0&&r<10000)
    {
    area =3.141592653589*r*r;
    C=2*3.141592653589*r;
    printf("%.6lf %.6lf",area,C);
    }
    return 0;
}



Measured memory_bytes: 2100
#include <stdio.h>
#include <iostream>
 
using namespace std;
using ll = long long;
 
ll N2;
int N;
int M;
int A;
int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> A;
        N = N - A;
        if (N < 0) {
            cout << "-1";
            return 0;
        }
    }
    cout << N;
}

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

const int N=1e4+5;
int frr[N];

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

    int cnt=0;

    for(int i=1;i<=100;i++)
    {
        for(int j=1;j<=100;j++)
        {
            for(int k=1;k<=100;k++)
            {
                long long  p=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i);
                if(p<=N) frr[p]++;
                //cnt++;
            }
        }
    }

   // cout<<cnt<<endl;
    for(int i=1;i<=n;i++)cout<<frr[i]<<endl;
}


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

using namespace std;
using ll = long long;

struct Node {
    using NP = Node*;

    ll mi, ma, lz;

    void init_node() {
        mi = ma = lz = 0;
    }
    void update() {
        mi = min(l->mi, r->mi);
        ma = max(l->ma, r->ma);
    }
    void push() {
        if (lz) {
            l->lzdata(lz);
            r->lzdata(lz);
            lz = 0;
        }
    }
    void lzdata(ll x) {
        mi += x;
        ma += x;
        lz += x;
    }

    void add(int a, int b, ll x) {
        if (b <= 0 or sz <= a) return;
        if (a <= 0 and sz <= b) {
            lzdata(x);
            return;
        }
        push();
        l->add(a, b, x);
        r->add(a - sz/2, b - sz/2, x);
        update();
    }

    NP l, r;
    int sz;
    Node(int sz) : sz(sz) {
        init_node();
        if (sz == 1) return;
        l = new Node(sz/2);
        r = new Node(sz - sz/2);
        update();
    }
};

int N, N2;
Node* st = nullptr;

int main() {
    scanf("%d", &N); N2 = N/2;
    int a[N];
    for (int i = 0; i < N; i++) {
        scanf("%d", a+i);
    }
    st = new Node(N2);
    for (int i = 0; i < N2; i++) {
        st->add(i, i+1, a[i]-a[N-1-i]);
    }

    int q;
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        int l, r, x;
        scanf("%d %d %d", &l, &r, &x); l--;
        if (r <= N2) {
//            [l, r)
            st->add(l, r, x);
        } else if (N2 <= l) {
            st->add(N-r, N-l, -x);
        } else {
            st->add(l, N2, x);
            st->add(N-r, N2, -x);
        }
        if (st->mi == 0 and st->ma == 0) {
            printf("1\n");
        } else {
            printf("0\n");
        }
    }
}

Measured memory_bytes: 36360
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int a,b;
    cin >> a >> b;
    cout << max(0, a - 2 * b) << endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import product
from sys import stdin, stdout

readline = stdin.readline
write = stdout.write

def dist2(x0, y0, z0, x1, y1, z1):
    return (x0 - x1)**2 + (y0 - y1)**2 + (z0 - z1)**2
def dot(x0, y0, z0, x1, y1, z1):
    return x0*x1 + y0*y1 + z0*z1
def cross2(x0, y0, z0, x1, y1, z1):
    return (y0*z1 - y1*z0)**2 + (z0*x1 - z1*x0)**2 + (x0*y1 - x1*y0)**2

while 1:
    N, M, R = map(int, readline().split())
    if N == M == R == 0:
        break
    S = [list(map(int, readline().split())) for i in range(N)]
    T = [list(map(int, readline().split())) for i in range(M)]

    ex, ey, ez = map(int, readline().split())
    S = [(sx - ex, sy - ey, sz - ez, sr) for sx, sy, sz, sr in S]
    T = [(tx - ex, ty - ey, tz - ez, tb) for tx, ty, tz, tb in T]
    L = [tb / (tx**2 + ty**2 + tz**2) for tx, ty, tz, tb in T]

    rem = [0]*M

    for i in range(M):
        tx, ty, tz, tb = T[i]
        ld = tx**2 + ty**2 + tz**2
        for j in range(N):
            sx, sy, sz, sr = S[j]
            sr2 = sr**2
            ok = 1
            dd1 = (sx**2 + sy**2 + sz**2 <= sr2)
            dd2 = (dist2(sx, sy, sz, tx, ty, tz) <= sr2)
            if dd1 ^ dd2:
                ok = 0
            elif dd1 == dd2 == 0:
                if (cross2(sx, sy, sz, tx, ty, tz) <= sr2 * ld):
                    if (dot(sx, sy, sz, tx, ty, tz) >= 0 and
                            dot(tx-sx, ty-sy, tz-sz, tx, ty, tz) >= 0):
                        ok = 0
            if not ok:
                rem[i] |= 1 << j
    ans = 0
    for P in product([0, 1], repeat=M):
        need = 0
        for i in range(M):
            if P[i]: need |= rem[i]
        if bin(need).count('1') <= R:
            ans = max(ans, sum(L[i] for i in range(M) if P[i]))
    write("%.10f\n" % ans)

Measured memory_bytes: 8388
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;


int main(){
    ll a,b,h; cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
import std.numeric;


void main() {
    int n;
    int[] a;

    scan(n);
    a = readln.split.to!(int[]);

    int am = a.reduce!max;
    auto cnt = new int[](n);

    foreach (i ; 0 .. n) {
        cnt[a[i]]++;
    }

    foreach (aa ; 0 .. am + 1) {
        if (aa < (am + 1) / 2) {
            if (cnt[aa] > 0) {
                writeln("Impossible");
                return;
            }
        }
        else if (aa == (am + 1) / 2) {
            if (am & 1) {
                if (cnt[aa] != 2) {
                    writeln("Impossible");
                    return;
                }
            }
            else {
                if (cnt[aa] != 1) {
                    writeln("Impossible");
                    return;
                }
            }
        }
        else {
            if (cnt[aa] < 2) {
                writeln("Impossible");
                return;
            }
        }
    }

    writeln("Possible");
}



struct Stack(T) {
private:
    int N, peek;
    T[] data;

public:
    this(int size) 
    {
        N = size;
        data = new T[](N);
    }

    bool empty() @property
    {
        return peek == 0;
    }

    bool full() @property
    {
        return peek == N;
    }

    void push(T x) @property
    {
        assert(!full);
        data[peek++] = x;
    }

    void pop() @property
    {
        assert(!empty);
        --peek;
    }

    T top() @property
    {
        return data[peek - 1];
    }

    void clear() @property
    {
        peek = 0;
    }

    int length() @property
    {
        return peek;
    }

}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    

    int a,b,k;
    cin >> k >> a >> b;
    bool flag = false;
    if ((a%k==0 || b%k==0) || b/k-a/k>0)
    {
        cout << "OK" << endl;
    }
    else
    {
        cout << "NG" << endl;
    }
    
    
}




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

int main() {
  int N,A,B;
  cin >>N>>A>>B;
  int p1 = A * N;
  if (p1 < B) {
    cout << p1 << endl;
  } else {
    cout << B << endl;
  }
  return 0;
}

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

using namespace std;

#define ll long long;

int main() {
  string w; cin >> w;
  vector<int> v(26);
  int n = w.size();
  if(n%2 != 0) {
    cout << "No" << endl;
    return 0;
  }
  for(int i=0; i<n; ++i) {
    int c = w.at(i);
    ++v.at(c-'a');
  }

  for(int i=0; i<26; i++) {
    if(v.at(i)%2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define all(x) (x).begin(),(x).end()
#define V vector<int>
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	V a(n); rep(i, n)cin >> a[i];
	sort(a.rbegin(), a.rend());
	int ma = a[0];
	int sum = 0;
	for (int i = 1; i < n; i++) {
		sum += a[i];
	}
	if (ma < sum)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
bool cha[31][100005];
int main(int argc, char** argv) 
{
	cin.tie(0);
	memset(cha,false,sizeof(cha));
	int n,c,mxt,k = 0;
	cin>>n>>c;
	for(int i=0,s,t,ch; i<n; ++i)
	{
		cin>>s>>t>>ch;
		for(int j=s; j<=t; ++j)
		{
			cha[ch][j] = true;
		}
	}
	int all = 0,num=0;
	for(int i=1; i<=100000; ++i)
	{
		for(int j=1; j<=c; ++j)
		{
			if(cha[j][i])
			{
				num++;
			}
		}
		all = max(all,num);
		num = 0;
	}
	cout<<all<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	int n; cin >> n;
	vi v(n);
	REP(i, n)
	{
		cin >> v[i];
	}
	vi w = v;
	sort(ALL(w));
	int mn = *min_element(ALL(v));
	vector<vi> g; vector<bool> f(n);
	REP(i, n)
	{
		if (!f[i])
		{
			f[i] = true;
			vi tmp; int t = find(ALL(w), v[i]) - w.begin();
			tmp.push_back(v[i]);
			while (t != i)
			{
				int nx = find(ALL(w), v[t]) - w.begin();
				f[t] = true;
				tmp.push_back(v[t]);
				t = nx;
			}
			g.push_back(tmp);
		}
	}
	int ans = 0;
	REP(i, g.size())
	{
		int m = *min_element(ALL(g[i]));
		int s = 0;
		REP(j, g[i].size()) s += g[i][j];
		ans += min(s + m*(g[i].size() - 2), mn*(g[i].size() + 1) + m + s);
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
	int n;
	string s;

	cin >> n >> s;
	for (int i = 0; i < s.length() - 1; i++) {
		if (s[i] == s[i + 1]) {
			s.erase(i, 1);
			i--;
		}
	}
	cout << s.length() << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<vector>
#include<sstream>
using namespace std;
#define DIR 1
#define FILE 2
#define ARB 3
#define REP(i,b,e) for(int i=b;i<e;i++)
#define rep(i,n) REP(i,0,n)
class Tree{
public:
  int type;
  string myname;
  map<string,Tree* > M;
  Tree(){type=DIR;M.clear();myname="";}
};

void get_path(string a,vector<string>&b){
  rep(i,a.size())if (a[i]=='/')a[i]=' ';
  stringstream sin(a);
  while(sin>>a)b.push_back(a);
}

void get_query(string a,vector<pair<string,int> > & b){
  REP(i,1,a.size()){
    string t;
    while(i<a.size() && a[i] != '/')t+=a[i++];
    b.push_back(make_pair(t,DIR) );
  }
  if ( b.size() == 0)return;
  if ( a[a.size()-1]=='/')b.push_back(make_pair("index.html",FILE) );
  else b[b.size()-1].second =ARB;
}

void make_tree(Tree *a,vector<string>&b,int &p){
  if (b.size()==p){return;}
  Tree *next=a->M[b[p]];
  if ( next == 0){
    next = new Tree;
    next->myname=b[p];
    a->M[b[p]]=next;
    next->type = p+1==b.size()?FILE:DIR;
    make_tree(next,b,++p);
  }else make_tree(next,b,++p);  
}

Tree* Find_Page(Tree *a,vector<pair<string,int> >&b,int &p,Tree *prev){
  Tree *ret=a;
  while(p < b.size()){
    if (b[p].first == "."){p++;continue;}
    else if ( b[p].first ==".."){p++;return prev;}
    //exceptional case "index.html"
    Tree *next = a->M[b[p].first];
    if ( next == 0 || (next->type&b[p].second )==0  )return NULL;
    ret = Find_Page(next,b,++p,a);
    if ( ret == NULL)return NULL;
  }

  if (ret->type == FILE)return ret;
  ret = ret->M["index.html"];
  if ( ret == 0 || ret->type !=FILE)return NULL;
  return ret;
}

void solve(string *q,Tree *root){
  Tree *data[2];
  rep(i,2){
    vector<pair<string,int> > a;
    int p=0;
    data[i]=NULL;
    get_query(q[i],a);
    data[i]=Find_Page(root,a,p,NULL);
    if (  data[i] == NULL){puts("not found");return;}
  }
  if (data[0] == data[1] )puts("yes");
  else puts("no");
}

main(){
  int n,q;
  while(cin>>n>>q &&n){
    Tree root;
    string t;
    vector<string> a;
    int p=0;
    rep(i,n)cin>>t,get_path(t,a),make_tree(&root,a,p=0),a.clear();
    rep(i,q){
      string in[2];
      cin>>in[0]>>in[1];
      solve(in,&root);
    }
  }
  return false;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
  int N, W;
  int w[101] = {0}, v[101] = {0};
  cin >> N >> W;
  for(int i=1; i <= N; i++){
    cin >> w[i] >> v[i];
  }
  long sumValue[100001][2] = {0};

  for(int i=1; i <= N; i++){
    for(int j=1; j <= W; j++){
      if(j < w[i]) sumValue[j][1] = sumValue[j][0];
      else sumValue[j][1] = max(sumValue[j][0], sumValue[j-w[i]][0] + v[i]);
    }
    for(int j=1; j <= W; j++){
      sumValue[j][0] = sumValue[j][1];
    }
  }
  cout << sumValue[W][0];
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)

int sum[255][4000];
ll cnt(char c, int l, int r) {
	if(r<0 || l>r) return 0;
	return sum[(int)c][r]-(l?sum[(int)c][l-1]:0);
}
int main() {
	IO;
	int n;
	cin>>n;
	string t;
	cin>>t;
	for(int i=0;i<n;++i) {
		sum[(int)t[i]][i]++;
	}
	for(int i=1;i<n;++i) {
		for(int j=0;j<255;++j) sum[j][i]+=sum[j][i-1];
	}
	
	ll ans=0;
	for(int i=0;i<n;++i) {
		char egyik,masik;
		if(t[i]=='R') egyik='G', masik='B';
		if(t[i]=='G') egyik='R', masik='B';
		if(t[i]=='B') egyik='R', masik='G';
		ans+=1LL*cnt(egyik,0,i-1)*cnt(masik,i+1,n-1);
		ans+=1LL*cnt(masik,0,i-1)*cnt(egyik,i+1,n-1);
		for(int j=1;i-j>=0 && i+j<n;j++) {
			if(t[i]!=t[i-j] && t[i-j]!=t[i+j] && t[i+j]!=t[i]) ans--;
		}
	}
	
	cout<<ans<<"\n";
	

	return 0;
}


Measured memory_bytes: 7568
#include <iostream>
#include <cstring>
using namespace std;

bool flg[32];

int main(){
  memset(flg, 0, sizeof(flg));

  for(int i = 0; i < 28; i++){
    int x;
    cin >> x;
    flg[x] = true;
  }

  for(int i = 1; i <= 30; i++){
    if(!flg[i]){
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 0
use std::ascii::AsciiExt;
use std::io::{BufRead, StdinLock};
use std::str::FromStr;

fn read<T: FromStr>(stdin_lock: &mut StdinLock, buf: &mut Vec<u8>, delimiter: u8) -> T {
    buf.clear();
    let l = stdin_lock.read_until(delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n = read(&mut stdin_lock, &mut buf, b' ');
    let k = read(&mut stdin_lock, &mut buf, b'\n');
    let s = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(n, k, s));
}

fn solve(_: u8, k: u8, s: String) -> String {
    let mut chars: Vec<char> = s.chars().collect();
    let mut i = 0;
    for c in chars.iter_mut() {
        if i == k - 1 {
            *c = c.to_ascii_lowercase();
        }
        i += 1;
    }
    chars.into_iter().collect()
}

#[test]
fn example1() {
    assert_eq!("aBC", solve(3, 1, "ABC".to_owned()))
}

#[test]
fn example2() {
    assert_eq!("CAbA", solve(4, 3, "CABA".to_owned()));
}


Measured memory_bytes: 4352
//AtCoder ABC075 A - One out of Three
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    vector<ll> tbl(3);
    cin>>tbl[0]>>tbl[1]>>tbl[2];
    sort(tbl.begin(),tbl.end());
    cout<<(tbl[0]==tbl[1]?tbl[2]:tbl[0])<<endl;
    return 0;
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	
	bool found = false;
	for (int i = 1; i <= 9; ++i) {
		for (int j = 1; j <= 9; ++j) {
			if (i * j == N) {
				found = true;
				break;
			}
		}
		if (found) {
			break;
		}
	}
	
	cout << (found ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
counts = dict()
for i in range(N):
    a, b = map(int, input().split())
    counts.setdefault(a, 0)
    counts[a] += b

for i in range(10**5+1):
    a = counts.get(i)
    if a is not None:
        if K <= a:
            break
        K -= a
print(i)

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

int main(){
  int n,x,ans=1,d=0,l;cin>>n>>x;
  REP(i,n){
    cin>>l;
    d+=l;
    if(d<=x) ans++;
  }
  cout<<ans;
}

Measured memory_bytes: 256
s = gets.chomp
count = Hash.new(0)
s.each_char do |c|
  count[c]+=1
end

odd = count.count{|c,k| k.odd? }

if odd >1
  puts 0
  exit
else
  ans = (2..(s.length/2)).inject(1,:*)
  count.each do |c,k|
    ans /= (2..(k/2)).inject(1,:*)
  end
  puts ans
end

Measured memory_bytes: 6100
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 100010;
ll nums[N];
ll n, k;
ll pre[N];
ll fac[N];
ll inv[N];
 
ll qmi(ll a,ll b)
{
	ll ans = 1;
	while (b)
	{
		if (b&1)
			ans = ans * a % mod;
		a = a*a % mod;
		b >>= 1;
	}
	return ans;
}
 
void getfac()
{
	fac[0] = inv[0] = 1;
	for (int i = 1 ; i <= 100005 ; i++)
	{
		fac[i] = fac[i-1] * i % mod;
		inv[i] = qmi(fac[i], mod-2);
	}
}
 
ll getC(ll n,ll m)
{
	return fac[n] * inv[n-m] % mod * inv[m] % mod;
}

int main()
{
    cin >> n >> k;
    for(ll i = 0; i < n; i ++)
    {
        cin >> nums[i];
    }
    sort(nums, nums + n);
    ll res = 0;
    getfac();
    for(ll i = 0; i < n; i ++)
    {
        pre[i + 1] = ((pre[i] + nums[n-i-1] - nums[i]) % mod);
    }
    for(ll len = k; len <= n; len ++)
    {
        ll cnt = n - len + 1;
        res += (getC(len - 2, k - 2) * pre[cnt] % mod);
        res %= mod;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3328
package main

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

const mod = 1000000007

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

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func main() {
	n, k := nextInt(), nextInt()
	s := make([]int, n+1)

	max := 0.0
	for i := 1; i <= n; i++ {
		s[i] = s[i-1] + nextInt()
		if k <= i {
			t := float64(s[i] - s[i-k] + k) / 2.0
			if max < t {
				max = t
			}
		}
	}

	fmt.Println(max)
}

Measured memory_bytes: 4096