akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

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

    int a, b, c; cin >> a >> b >> c;
    (100 * a + 10 * b + c) % 4 == 0 ? cout << "YES" : cout << "NO";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
	long all;
	long min;
} S_DIF;

int cmpAscVal(const void * n1, const void * n2)
{
	if (((S_DIF *)n1)->all >= 0 && ((S_DIF *)n2)->all < 0)
	{
		return -1;
	}
	else if (((S_DIF *)n1)->all < 0 && ((S_DIF *)n2)->all >= 0)
	{
		return 1;
	}
	else if (((S_DIF *)n1)->all >= 0) {
		if (((S_DIF *)n1)->min >= ((S_DIF *)n2)->min)
		{
			return -1;
		}
		else
		{
			return 1;
		}
	} else {
		if (((S_DIF *)n1)->all-((S_DIF *)n1)->min >= ((S_DIF *)n2)->all-((S_DIF *)n2)->min)
		{
			return -1;
		}
		else
		{
			return 1;
		}
	}
}

int main(void){

  long n;
  scanf("%ld", &n);
  char s[1000000];
	S_DIF *dif;
  dif = (S_DIF *)malloc(sizeof (S_DIF) * n);
	long tmp;
  long left = 0;
  long right = 0;
  for (long i = 0; i < n; i++) {
    scanf("%s", s);
		dif[i].all = 0;
    dif[i].min = 0;
		for (long j = 0; j < strlen(s); j++) {
			if (s[j] == '('){
				dif[i].all++;
        left++;
			} else if (s[j] == ')') {
				dif[i].all--;
        right++;
			}
      if (dif[i].all < dif[i].min) {
        dif[i].min = dif[i].all;
      }
    }
  }
  if (left != right) {
    printf("No\n");
    return 0;
  }
  qsort(dif, n, sizeof(S_DIF), cmpAscVal);
  tmp = 0;
  for (long i = 0; i < n; i++) {
    if (tmp + dif[i].min < 0) {
      printf("No\n");
      return 0;
    }
		tmp += dif[i].all;
  }
  printf("Yes\n");

  return 0;
}

Measured memory_bytes: 28704
N, X = [int(x) for x in input().split()]
x_list = [int(x) for x in input().split()]

x_processed = list(set([abs(x - X) for x in x_list]))

x_processed.sort()

def func(a, b):
    if a % b == 0:
        return b
    else:
        return func(b, a%b)

x1 = x_processed[0]
for x2 in x_processed[1:]:
    x1 = func(x2, x1)
    
print(x1)

Measured memory_bytes: 17808
(setq n(read))
(setf a(apply #'vector(loop for i from 1 to n collect(1-(read)))))
(setq s 0)
(setq f nil)
(loop for i from 1 to n do(setq s(svref a s))(if(= s 1)(progn(princ i)(setq f t)(return))))
(if f""(princ -1))

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

typedef long long ll;
const int maxn = 1e5+5;
const int mod = 1e9+7;
char s[maxn];
ll dp[maxn][15];

int main()
{
    scanf("%s",s);
    int len = strlen(s);
    if(s[0] == '?')
    {
        for(int i = 0 ; i <= 9; i++)
        {
            dp[0][i] = 1;
        }
    }
    else
    {
        dp[0][s[0]-'0'] = 1;
    }
    for(int i = 1; i < len; i++)
    {
        for(int j = 0; j < 13; j++)
        {
            if(s[i] == '?')
            {
                for(int k = 0; k <= 9; k++)
                    dp[i][(j*10+k)%13] = ( dp[i-1][j] + dp[i][(j*10+k)%13] )%mod;
            }
            else
            {
                int t = s[i]-'0';
                dp[i][(j*10+t)%13] = ( dp[i-1][j] + dp[i][(j*10+t)%13] )%mod;
            }
        }
    }
    printf("%lld\n",dp[len-1][5]);
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int n;
  cin >> n;
  string ans;
  if(n<=999) ans = "ABC";
  else ans = "ABD";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <unordered_set>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 10;
double EPS = 1e-10;

int main() {
	int N; cin >> N;
	int odd = 0;
	while (N--) {
		int x; cin >> x;
		if (x % 2) odd++;
	}
	cout << (odd % 2 == 0 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.text.*;
//Solution Credits: Taranpreet Singh
public class Main{
    //SOLUTION BEGIN
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int h = ni(), w = ni();
        long[][] ans = new long[1+h][1+w];
        char[][] g = new char[h][w];
        for(int i = 0; i< h; i++)g[i] = n().toCharArray();
        ans[1][1] = 1;
        for(int i = 1; i<= h; i++)
            for(int j = 1; j<= w; j++)if(g[i-1][j-1]=='.' && (i!=1 || j!=1)){
                ans[i][j] = ans[i-1][j]+ans[i][j-1];
                if(ans[i][j]>=mod)ans[i][j]-=mod;
            }
        
        pn(ans[h][w]);
    }
    //SOLUTION END
    void hold()throws Exception{throw new Exception("Hold right there, Sparky!");}
    long mod = (long)1e9+7, IINF = (long)4e18;
    final int INF = (int)2e9, MX = (int)1e6+1;
    DecimalFormat df = new DecimalFormat("0.000000000000000");
    double PI = 3.1415926535897932384626433832792884197169399375105820974944, eps = 1e-8;
    static boolean multipleTC = false, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        int T = (multipleTC)?ni():1;
        //Solution Credits: Taranpreet Singh
        pre();for(int i = 1; i<= T; i++)solve(i);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n(){return in.next();}
    String nln(){return in.nextLine();}
    int ni(){return Integer.parseInt(in.next());}
    long nl(){return Long.parseLong(in.next());}
    double nd(){return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }  
            return str;
        }
    }
}    

Measured memory_bytes: 39092
import sys
if sys.version_info[0]>=3: raw_input=input

cross=lambda a,b: (a.conjugate()*b).imag
dot=lambda a,b: (a.conjugate()*b).real

def solve(poly, p):
	f=False
	for i in range(len(poly)):
		a=poly[i]-p
		b=poly[(i+1)%len(poly)]-p
		if a.imag>b.imag: a,b=b,a
		if a.imag<=0 and 0<b.imag and cross(a,b)<0: f=not f
		if cross(a,b)==0 and dot(a,b)<=0: return 1
	return 2 if f else 0

checkio=lambda data: solve([complex(*e) for e in data[0]],complex(*data[1]))

n=int(raw_input())
poly=[[float(e) for e in raw_input().split()] for i in range(n)]
n=int(raw_input())
try:
	for i in range(n):
		print(checkio([poly,[float(e) for e in raw_input().split()]]))
except EOFError:
	pass

Measured memory_bytes: 4320
#include <stdio.h>

int main(void)
{
	int h, m, s;
	
	
	scanf("%d", &s);

	m = s / 60;
	h = m / 60;
	s = s - (m * 60);
	m = m - (h * 60);
	
	printf("%d:%d:%d\n", h, m, s);
}


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

long long int num[1000][2];
int t;

void gcdlcm(int n, int m){
	long long int a, b;
	a = n;
	b = m;
	for(int i = 0; i < 1000; i++){
		if(n % m == 0){
			num[t][0] = m;
			num[t][1] = a*b/m;
			break;
		}
		else{
			n = n - (n/m)*m;
			swap(n, m);
		}
	}		
}
int main(){
	int a, b;
	t = 0;
	while(cin >> a >> b){
		gcdlcm(a, b);
		t++;
	}
	for(int i = 0; i < t; i++){
		cout << num[i][0] << " " << num[i][1] << endl;
	}
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b&&a!=c)||(a==c&&b!=c)||(b==c&&b!=a))
    cout<<"Yes";
  else
    cout<<"No";  
}

Measured memory_bytes: 256
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  const ll MOD = (ll)1e9 + 7;
  ll N; cin>>N;
  vl A(N); REP(i,N) cin>>A[i];

  vvi h(N, vi(60, 0)); // h[i][j] := [A[0], A[i]] の j ビット目の 1 の数
  ll mask = 0b01;
  REP(b,60) {
    if (A[0]&mask) h[0][b] = 1;
    mask <<= 1;
  }
  FOR(i,1,N) {
    ll a = A[i];
    ll mask = 0b01;
    REP(b,60) {
      if (a&mask) h[i][b] = h[i-1][b] + 1;
      else h[i][b] = h[i-1][b];
      mask <<= 1;
    }
  }

  ll ans = 0;
  mask = 0b01;
  REP(b, 60) { // ビットごとに計算する
    ll one = h[N-1][b]; // [A[0],A[N-1]] の b ビット目の 1 の数
    ll zero = N - one;
    assert(one+zero == N);
    
    ll x = mask%MOD;
    ll pr = one*zero%MOD;
    ans += pr*x;
    ans %= MOD;

    mask <<= 1;
  }
  ans %= MOD;
 
  cout << ans << endl;
  

  return 0;
}


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

int main() {
  string s;
  cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
}

Measured memory_bytes: 3608
/*
g++ -std=c++11 -o2 -Wall ABC113A2.cpp -o .\out\ABC113A2.out
.\out\ABC113A2.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int a[105];

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ans = a[0];
  for (int i = 0; i < n - 1; ++i) {
    int d = a[i + 1] - a[i];
    if (d > 0) {
      ans += d;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 384
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;


int main()
{
    string s;
    ll n;
    cin >>  n >> s;
    ll ans=0;
    vector<vector<ll>> dp(n,vector<ll>(n));
    for(ll i=n-1;i>=0;i--){
        for(ll j=n-1;j>=0;j--){
            
            if(s[i]==s[j]){
                dp[i][j]+=1;
                if(i+1<=n-1 && j+1<=n-1){
                    dp[i][j]+=dp[i+1][j+1];
                }
            }
            ans=max(ans,min(dp[i][j],j-i));
        }
    }
    cout << ans << endl;
    return 0;
} 


Measured memory_bytes: 195840
n = gets.to_i
s = gets.chomp

stack = s.chars
         .each_with_index
         .filter_map{|ch, i| i if ch == "R"}
ans = s.chars
       .each_with_index
       .filter_map{|ch, i| i if ch == "W"}
       .take_while{|i| !stack.empty? && i < stack.pop}
       .size
p ans

Measured memory_bytes: 44416
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdint>
#include <utility>
#include <tuple>
#include <map>    
#include <queue> 
#include <set>  
#include <stack> 
#include <deque>  
#include <unordered_map> 
#include <unordered_set> 
#include <bitset>

using namespace std;

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

	bool pass = true;
	for (int i = 0; i < 3; i++) {
		if (S.at(i) == S.at(i + 1)) {
			pass = false;
			break;
		}
	}

	if (pass) {
		cout << "Good" << endl;
	}
	else {
		cout << "Bad" << endl;
	}
}

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

using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  map<string, int> m;
  int q; cin >> q;
  int command;
  string key;
  int x;
  string L, R;
  rep_i(i, q){
    cin >> command;
    if(command == 0){
      cin >> key >> x;
      auto it = m.find(key);
      if(it == m.end()){
        m.insert(make_pair(key, x));
      }else{
        m[key] = x;
      }
    }else if(command == 1){
      cin >> key;
      auto it = m.find(key);
      if(it == m.end()){
        say(0);
      }else{
        say(m.at(key));
      }
    }else if(command == 2){
      cin >> key;
      auto it = m.find(key);
      if(it != m.end()){
        m.erase(key);
      }
    }else if(command == 3){
      cin >> L >> R;
      auto start = m.lower_bound(L);
      auto end = m.upper_bound(R);
      while (start != end){
        cout << start->first << " " << start->second << endl;
        ++start;
      }
    }
  }
}
  


Measured memory_bytes: 27824
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>

using namespace std;

int main()
{
    int n, a[21], m, q[201];
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cin >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> q[i];
    }
    int ans[50000];
    for (int bit = 0; bit < (1 << n); bit++)
    {
        int sum = 0;
        for (int j = 0; j < n; j++)
        {
            if (bit & (1 << j))
            {
                sum += a[j];
            }
        }
        ans[sum]++;
    }
    for (int i = 0; i < m; i++)
    {
        cout << (ans[q[i]] > 0 ? "yes" : "no") << endl;
    }
}



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

using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    int x,t;
    cin>>x>>t;
    if(x-t>=0){
         cout<<x-t<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
 
    char s[4];
    scanf("%s", s);

    sort(s,s+4);
 
    if(s[0]==s[1]&&s[1]!=s[2]&&s[2]==s[3])
    {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 30

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

#define NUM_MAX 100000

#define TYPE_ALL 3
#define max(a,b) ((a) > (b) ? (a) : (b))

int main(void) {
    int num = get_int();
    int dp[NUM_MAX+1][TYPE_ALL];
    int days[NUM_MAX+1][TYPE_ALL];
    int i;
    for(i = 1; i <= num; i++) {
        get_int3(&days[i][0], &days[i][1], &days[i][2]);
    }
    for(i = 1; i <= num; i++) {
        int type, prev_type;
        for(type = 0; type < TYPE_ALL; type++) {
            int res = 0;
            for(prev_type = 0; prev_type < TYPE_ALL; prev_type++) {
                if(type == prev_type) continue;
                res = max(res, dp[i-1][prev_type] + days[i][type]);
            }
            dp[i][type] = res;
        }
    }
    int ans = 0;
    for(i = 0; i < TYPE_ALL; i++) {
        ans = max(ans, dp[num][i]);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 2560
<?php
	fscanf(STDIN,'%d',$n);
	$s=1;
	for($i=2;$i*$i<=$n;$i++){
		$j=$i*$i;
		while($j<=$n){
			$s=max($s,$j);
			$j*=$i;
		}
	}
	echo $s;



Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  string S,T;
  cin >> S;
  T="keyence";
  rep(i,7){

    ll j=0,t=0;
    while(j<i){
      if(S.at(j)!=T.at(t)){
        goto NEXT;
      }else{
        j++;
        t++;
      }
    }
    j+=S.size()-7;
    while(j<S.size()){
      if(S.at(j)!=T.at(t)){
        goto NEXT;
      }else{
        j++;
        t++;
      }
    }
    cout << "YES" << endl;
    return 0;
    NEXT:
    continue;
  }
  cout << "NO" << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(ll i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll n,m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());

  auto f = [&](ll x){
    ll res = 0;
    rep(i,n) res += a.end() - lower_bound(a.begin(),a.end(),x - a[i]);
    return res;
  };

  ll l = 0, r = 200005;
  while(l+1<r){
    ll x = (l+r)/2;
    if(f(x)>=m){
      l = x;
    }else{
      r = x;
    }
  }
  vector<ll> s(n+1);
  rep(i,n) s[i+1] = s[i] + a[i];
  ll ans = 0;
  rep(i,n){
    ll idx = lower_bound(a.begin(),a.end(),l - a[i]) - a.begin();
    ans += a[i]*(n-idx) + (s[n]-s[idx]);
  }
  ans -= l*(f(l)-m);
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll ;
const ll INF = 9999999999;

int main(){
    ll N, M, X;
    cin >> N >> M >> X;
    ll C[N];
    ll A[N][M];
    for(int i=0; i<N; i++){
        cin >> C[i];
        for(int j=0; j<M; j++){
            cin >> A[i][j];   
        }
    }
    ll ans = INF;
for(int s = 0; s < (1LL<<N); s++){
    ll Csum = 0;
    ll Ajsum[M];
  	for(int i = 0; i < M; i++) Ajsum[i]=0;
    for(int i = 0; i < (N); i++){
      if (s&((1LL)<<i)) {
        Csum += C[i];
        for(int j = 0; j < M; j++) {
            Ajsum[j] += A[i][j];
        }
      }
    }
    bool flag = true;
    for(int j = 0; j < M; j++){
        if (Ajsum[j] < X) flag = false;
    }
    if (flag) ans = min(ans, Csum);
  }
if(ans==INF)ans=-1;
cout << ans << endl;
return 0;
}


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class APainting {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int h, w, n; cin >> h >> w >> n;

      int a = (n+w-1)/w;
      int b = (n+h-1)/h;
      cout << min(a,b) << endl;

    }
};

signed main() {
  APainting solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
using namespace std;
int main()
{
	int a,b,ans;
	cin>>a>>b;
	ans=b%a==0?a+b:b-a;
	cout<<ans<<endl; 
	return 0;
}

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

#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<LL>
#define VVL vector<vector<LL>>
#define VVVL vector<vector<vector<LL>>>
#define VB vector<bool>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> void print(T x) { std::cout << x << std::endl; }

const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, -1, 0, 1 }, dx = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）

using namespace std;


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

    while (true) {
        int H, W;
        cin >> H >> W;
        if (H == 0 and W == 0) { break; }
        vector<string> field;
        FOR(i, 0, H) {
            string s;
            cin >> s;
            field.emplace_back(s);
        }

        VVI dp(H, VI(W, 0));
        FOR(x, 0, W) {
            FOR(y, 0, H) {
                if (y == 0) {
                    dp[y][x] = field[y][x] == '.' ? 1 : 0;
                    continue;
                }

                if (field[y][x] == '.') {
                    dp[y][x] = dp[y - 1][x] + 1;
                } else {
                    dp[y][x] = 0;
                }
            }
        }

        int ans = 0;
        FOR(y, 0, H) {
            FOR(x, 0, W) {
                int h = INT_MAX;
                FOR(w, 0, W - x) {
                    h = min(h, dp[y][x + w]);
                    ans = max(ans, h * (w + 1));
                }
            }
        }
        print(ans);
    }
}



Measured memory_bytes: 4104
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <climits>

using namespace std;

int main() {
    int a,b,c,x,count=0;
    cin >> a >> b >> c >> x;

    for(int i=0; i<=a; i++) {
        for(int j=0; j<=b; j++) {
            for(int k=0; k<=c; k++) {
                if(500*i + 100*j + 50*k == x) {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);
	double r;
	cin >> r;
	cout << 2*r * 3.14159265;
	return 0;
}

Measured memory_bytes: 3740
#include <iostream>
 using namespace std;
 int main(){
 string s;
 cin >> s;
 int ans;
 if(s == "SUN")ans = 7;
 else if(s == "MON")ans = 6;
 else if(s == "TUE")ans = 5;
 else if(s == "WED")ans = 4;
 else if(s == "THU")ans = 3;
 else if(s == "FRI")ans = 2;
 else if(s == "SAT")ans = 1;
 cout << ans << endl;
 }


Measured memory_bytes: 256
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		var x = Console.ReadLine().Split().Select(y => int.Parse(y)).ToArray();
		int h = x[0];
		int n = x[1];
		var a = Console.ReadLine().Split().Select(b => int.Parse(b)).ToArray();
		int sum = 0;
		for(int i=0;i!=n;i++){
			sum += a[i];
		}
		if(sum>=h){
			Console.WriteLine("Yes");
		}else{
			Console.WriteLine("No");
		}
		
	}
}

Measured memory_bytes: 35872
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,nac=0,nwa=0,ntle=0,nre=0;
  cin>>n;
  string c;
  for(int i=0;i<n;i++){
    cin>>c;
    if(c=="AC"){nac++;}
    else if(c=="WA"){nwa++;}
    else if(c=="TLE"){ntle++;}
    else if(c=="RE"){nre++;}
  }
  cout<<"AC x "<<nac<<endl;
  cout<<"WA x "<<nwa<<endl; 
  cout<<"TLE x "<<ntle<<endl;
  cout<<"RE x "<<nre<<endl;
}

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

int main(){
  int H ,R;

  cin>>H>>R ;

  if (H+R<0){ 
    cout<<-1<<endl;
  }
  else if(H+R==0){
    cout<<0<<endl;
  }
  else if(H+R>0){
    cout<<1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(m);
    vector<int> b(m-1);
    for(int i=0;i<m;i++) cin>>a.at(i);
    sort(a.begin(),a.end());
    for(int i=0;i<m-1;i++) b.at(i)=a.at(i+1)-a.at(i);
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    
    int sum=0;
    if(n!=1||m!=1){
        for(int i=0;i<m-1;i++){
            if(i<n-1) continue;
            sum+=b.at(i);
        }
    }
    cout<<sum<<"\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	int w, h;
	cin >> w >> h >> n;
	int S[110][110];

	rep(i, w){
		rep(j, h){
			S[i][j] = 1;
		}
	}

	rep(i, n){
		int a;
		cin >> x >> y >> a;
		if(a == 1){
			rep(j, x){
				rep(k, h) S[j][k] = 0;
			}
		}
		if(a == 2){
			for(j = x; j<w; ++j){
				rep(k, h) S[j][k] = 0;
			}
		}
		if(a == 3){
			rep(j, y){
				rep(k, w) S[k][j] = 0;
			}
		}
		if(a == 4){
			for(j = y; j<h; ++j){
				rep(k, w) S[k][j] = 0;
			}
		}
	}
	int sum = 0;
	rep(i, w){
		rep(j, h) sum += S[i][j];
	}
	cout << sum << endl;
}

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

int main() {
    int n,m,i,o,x;
    cin >> n;
    cin >> m;
    x = m;
    for (int j = 0; j < n; j++) {
        cin >> i >> o;
        m = m +i - o;
        if(x<m){
            x=m;
        }
        if (m<0) {
            cout << 0 <<endl;
            break;
        }
        
    }
    if(m>0){
        cout << x <<endl;
    }
    return 0;
    
}



Measured memory_bytes: 3100
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *r;
  struct node *l;
  struct node *p;
  int key;
};
typedef struct node * Node;
#define N NULL

Node root;
void insert(int);
void inorder(Node);
void preorder(Node);
Node find(Node, int);

int main(){
  int s, i, x;
  char c[20];

  scanf("%d", &s);
 
  for (i = 0; i < s; i++){
    scanf("%s",c);

    if (c[0] == 'f'){
      scanf("%d", &x);
      
      Node t = find(root, x);
      if(t != N) printf("yes\n");
      if(t == N) printf("no\n");

    }

    if (c[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }

    if (c[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }

  }
  return 0;
}

void insert(int k){
  Node y = N;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->l = N;
  z->r = N;
 
  while(x != N){
    y=x;
    if(z->key < x->key) x = x->l;
    else x = x->r;
  }
  z->p = y;
  if(y == N)root = z;
  else if(z->key < y->key) y->l = z;
  else y->r = z;
}

void inorder(Node u){
  if(u != N){
    inorder(u->l);
    printf(" %d",u->key);
    inorder(u->r);
  }
}
void preorder(Node u){
  if(u != N){
    printf(" %d",u->key);
    preorder(u->l);
    preorder(u->r);
  }
}

Node find(Node u, int k){
  while(u != N && k != u->key){
    if(k < u->key) u = u->l;
    else u = u->r;
  }
  return u;
}

Measured memory_bytes: 19364
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#define INF 2000000
using namespace std;
typedef long long ll;//声明// 
int main()
{  ll n,sum=0,i;
   cin>>n;
   sum=(n+1)*n/2;
   for(i=1;i<=n;i++)
   {  if(i%3==0||i%5==0)
         sum=sum-i;
   }
    cout<<sum<<endl;
}

Measured memory_bytes: 3164
#include <iostream>

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

  int limit_7 = N / 7;
  int limit_4 = N / 4;

  bool can = false;
  for ( int i = 0; i <= limit_7; i++ ) {
    for ( int j =0; j <= limit_4; j++ ) {
      if ( N == i * 7 + j * 4 ) {
        can = true;
        break;
      }
    }
  }

  if ( can ) std::cout << "Yes\n";
  else std::cout << "No\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int a[100001],b[100001],dp[3001][3001];
int main(void)
{
	int i,j,n,s,t,max,sum,x;

	scanf("%d %d %d",&n,&t,&s);
	for(i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]);
	for(i=0;i<n;i++) {
		for(j=0;j<=t;j++) {
			dp[i][j]=-1;
		}
	}
	dp[0][0]=0;
	sum=0;
	for(i=0;i<n;i++) {
		for(j=0;j<=t;j++) {
			if(dp[i][j]!=-1) {
				if(j<s && j+b[i]>s) {
					x=(s-j)+(j+b[i]);
					x=x-j;
				}
				else x=b[i];
				if(dp[i+1][j+x]<dp[i][j]+a[i] && j+x<=t) {
					dp[i+1][j+x]=dp[i][j]+a[i];	
				}
				if(dp[i+1][j]<dp[i][j]) dp[i+1][j]=dp[i][j];
			}
		}
	}
	max=-1;
	for(i=0;i<=t;i++) {
		if(max<dp[n][i]) max=dp[n][i];
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 36236
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var ab = Sarray();
            var a = ab[0];
            var b = ab[1];
            if (0 < a)
            {
                WriteLine("Positive");
                return;
            }
            if (a <= 0 && 0 <= b)
            {
                WriteLine("Zero");
                return;
            }
            if ((b - a) % 2 == 0)
            {
                WriteLine("Negative");
            }
            else
            {
                WriteLine("Positive");
            }
            //Out.Flush();
        }
    }
}

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

namespace KPCB
{
    static class MainClass
    {

        public static void Main(string[] args)
        {
            string S = Console.ReadLine();

            string K = "keyence";
            var Klst = new List<string>(7) { "k", "e", "y", "e", "n", "c", "e" };

            string ans = "NO";


            for(int i = 0; i <= S.Length; i++)
            {
                for(int j= 0; j <= S.Length-i; j++)
                {
                    string fpart = S.Substring(0, i);

                    string lpart = S.Substring(i+j, S.Length-i-j);


                    if(fpart + lpart == K) {
                        Console.WriteLine("YES");
                        return;
                    }

                }
            }
/*
            if (S.IndexOf(K,0)==0 || S.IndexOf(K, S.Length - K.Length) >= 0)
            {
                Console.WriteLine("YES");
                return;
            }
            for (int i = 0; i < Klst.Count(); i++)
            {
                int fstidx = S.IndexOf(K.Substring(0,i+1));
                int residx = S.IndexOf(K.Substring(i+1, K.Length - (i + 1)), fstidx + i + 1);
                int lastidx = residx + K.Length - (i + 1);
                
                if (fstidx >= 0 &&  residx >= 0&&  fstidx == 0 && lastidx == S.Length)
                {
                    ans = "YES";

                }

            }
            */           
            Console.WriteLine(ans);

            return;


        }



        public static long Gcd(long a, long b)
        {
            long tmp;
            // a<bにする
            if (a >= b)
            {
                tmp = a;
                a = b;
                b = tmp;
            }

            if (a == 0)
            {
                return b;
            }

            tmp = a;
            a = b % a;
            b = tmp;
            return Gcd(a, b);

        }


        public static IEnumerable<long> PF(long n)
        {
            long i = 2;
            long tmp = n;

            while (i * i <= n) //※1
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;//最後の素数も返す
        }




    }

}






Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <map>

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m;
  std::cin >> n >> m;
  std::map<int, int> count;
  for (int i = 0; i < 2 * m; i++) {
    int a;
    std::cin >> a;
    count[a]++;
  }
  bool ok = std::all_of(std::begin(count), std::end(count),
      [] (auto pair) { return pair.second % 2 == 0; });
  std::cout << (ok ? "YES" : "NO") << std::endl;
}


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

int main(){
  long int n, a, b;
  scanf("%ld",&n);
  
  double dMedium = sqrt(n*1.0);
  int iMedium = dMedium;
//  printf("%lf %d\n",dMedium,iMedium);
  for(int i=iMedium; i>0; i--){
//    printf("%d\n",i);
    if(n%i==0){
      a = i;
      b = n/a;
//      printf("%ld %ld\n",a,b);
      break;
    }
  }
  
  double dLogb = log10(b*1.0);
  int noDigit = dLogb+1; 
  printf("%d",noDigit);
  
  return 0;
}

Measured memory_bytes: 512
def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result

a,b=map(int,input().split())
c=list(map(int,input().split()))

if a==b:
    print((sum(c)+a)/2)
    exit()

d=[]

c=[(i+1)/2 for i in c]
n=cumsum(c)

m=[]
for i in range(0,a-b):
    m.append(n[i+b]-n[i])


print(max(m))


Measured memory_bytes: 77960
S = raw_input().split(' ')
for i in range(0, len(S)):
  S[i] = int(S[i])

w = S[0]
h = S[1]
x = S[2]
y = S[3]
r = S[4]

if 0 <= x-r and x+r <= w and 0 <= y+r and y+r <= h:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 6468
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#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 <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cerr<<"# "<<#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<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int repaint(vvi& grid,int before,int after,int i,int j)
{
	int h=grid.size(),w=grid[0].size();
	if(i<0 || h<=i || j<0 || w<=j || grid[i][j]!=before)
		return 0;
	grid[i][j]=after;
	int di[]={-1,1,0,0},dj[]={0,0,-1,1},res=1;
	rep(k,4)
		res+=repaint(grid,before,after,i+di[k],j+dj[k]);
	return res;
}

int calc(vvi grid,vi seq)
{
	rep(i,5) if(seq[i]!=grid[0][0])
		repaint(grid,grid[0][0],seq[i],0,0);
	return repaint(grid,grid[0][0],9,0,0);
}

int main()
{
	for(int h,w,c;cin>>h>>w>>c,h|w|c;){
		c--;
		vvi grid(h,vi(w));
		rep(i,h) rep(j,w) cin>>grid[i][j];
		rep(i,h) rep(j,w) grid[i][j]--;
		
		int res=0;
		rep(i,6*6*6*6){
			vi seq(5,c);
			for(int j=0,k=i;j<4;j++,k/=6)
				seq[j]=k%6;
			res=max(res,calc(grid,seq));
		}
		cout<<res<<endl;
	}
	
	return 0;
}

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

int main() {
 cout << fixed << setprecision(12);
  double r;
  double c1,c2;
   cin >> r;
   double y = acos(-1) ;
   c1 = (r*r)*y;
   c2 = (r*2)*y;
  cout<< c1 <<" " << c2 <<endl;  
  return 0;
  
}


Measured memory_bytes: 3276
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;


void array_show(int *a,int n){
	for(int i=0;i<n;i++)printf("%d%c",a[i],(i!=n-1?' ':'\n'));
}
void array_show(LL *a,int n){
	for(int i=0;i<n;i++)printf("%lld%c",a[i],(i!=n-1?' ':'\n'));
}

vector<int> path[100005];
int dis[100005];

int check(int a){
	if(dis[a]!=-1)return dis[a];
	int t=0;
	for(int i=0;i<path[a].size();i++){
		t=max(t,check(path[a][i])+1);
	}
	dis[a]=t;
	return t;
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>m;
	for(i=0;i<m;i++){
		cin>>a>>b;
		a--,b--;
		path[a].push_back(b);
	}
	memset(dis,-1,sizeof(dis));
	for(i=0,a=0;i<n;i++){
		check(i);
		a=max(a,dis[i]);
	}
	cout<<a<<endl;
}


Measured memory_bytes: 8192
using namespace std;
#include<bits/stdc++.h>
typedef long long int ll;

int main()
{
  ll n;
  cin>>n;
  
  ll arr[n];
  
  for(ll i=0;i<n;i++)
    cin>>arr[i];
  
  ll answer =0;
  for(ll i=1;i<n;i++)
  {
    if(arr[i]<arr[i-1])
       { 
         answer += arr[i-1] -arr[i];
         arr[i] = arr[i-1];
       }     
  }
   
       cout<<answer<<"\n";       
}


Measured memory_bytes: 5100
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll bin[30];
    string answer;

    cin >> N;
    rep(i, 30) bin[i] = 0;
    rep(i, N){
        ll a;
        cin >> a;
        ll cnt = 0;
        while (cnt < 30){
            if (a % 2 == 1) bin[cnt] ++;
            a /= 2;
            cnt ++;
        }
    }
    answer = "Yes";
    rep(i, 30) if (bin[i] % 2 == 1) answer = "No"; 
    
    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 256
var s,t:String;i,j:Longint;a,b,ss,tt:array[1..200]of Longint;
begin
	readln(s);
	for i:=1 to length(s) do
		inc(a[ord(s[i])]);
	readln(t);
	for i:=1 to length(t) do
		inc(b[ord(t[i])]);
	j:=1;
	for i:=1 to length(s) do begin
		while a[j]=0 do inc(j);
		ss[i]:=j;
		dec(a[j]);
	end;
	j:=199;
	for i:=1 to length(t) do begin
		while b[j]=0 do dec(j);
		tt[i]:=j;
		dec(b[j]);
	end;
	i:=1;
	while (ss[i]<>0)and(tt[i]<>0)and(ss[i]=tt[i]) do inc(i);
	if ss[i]<tt[i] then
		writeln('Yes')
	else
		writeln('No')
end.


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
using namespace std;
typedef long long unsigned int ll;

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

int main()
{
    int n, m, x, c[12], A[12][12], i, j, k,l,bit[12], p = 0, alg[12], min1 = 200000000,min2=200000000, tmp = 200000000,flag=0;
    cin >> n;
    cin >> m;
    cin >> x;
    for (i = 0; i < 12; i++)
    {
        alg[i] = 0;
        c[i] = 0;
        bit[i] = 0;
        for (j = 0; j < 12; j++)
        {
            A[i][j] = 0;
        }
    }

    for (i = 0; i < n; i++)
    {
        cin >> c[i];
        for (j = 0; j < m; j++)
        {
            cin >> A[i][j];
        }
    }
    for (i = 0; i < 1 << n; i++)
    {
        for (j = 0; j < m; j++)
        {
            alg[j] = 0;
        }
        for (j = 0; j < n; j++)
        {
            bit[j] = ((i & (1 << j)) >> j);
        }
        for (j = 0; j < n; j++)
        {
            if (bit[j] == 1)
            {
                min1 = min1 + c[j];
                for(k=0;k<m;k++){
                    for(l=0;l<n;l++){
                        if(bit[l]==1){
                            alg[k]=alg[k]+A[l][k];
                        }
                    }
                    if(alg[k]<x){
                        flag=1;
                        min1=200000000;
                        break;
                    }
                }
                if(flag==1){
                    break;
                }
            }

        }
        min2 = min(min1, tmp);
        tmp = min2;
        min1=0;
        flag =0;
    }
    if(min2 != 200000000){
        cout << min2 << endl;
    }else{
        min2 = -1;
        cout << min2 << endl;
    }
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 5000005


ll N,M;
ll POW[SIZE];
ll fact[SIZE],inv_fact[SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

ll nCk(ll n,ll k){

	ll ret = fact[n]*inv_fact[k];
	ret %= M;
	ret *= inv_fact[n-k];

	return ret%M;
}



int main(){

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

	POW[0] = 1;
	for(int i = 1; i < SIZE; i++){

		POW[i] = POW[i-1]*2;
		POW[i] %= M;
	}

	fact[0] = 1;
	for(ll i = 1; i < SIZE; i++){
		fact[i] = i*fact[i-1];
		fact[i] %= M;
	}
	inv_fact[SIZE-1] = mod_inverse(fact[SIZE-1],M);
	for(ll i = SIZE-1; i >= 1; i--){

		inv_fact[i-1] = inv_fact[i]*i;
		inv_fact[i-1] %= M;
	}

	ll ans = 0;

	for(ll r = 1; r <= N-1; r++){

		ll tmp = nCk(N,r);
		ll b = N-r;

		tmp *= POW[(r*(r-1))/2];
		tmp %= M;
		tmp *= POW[(b*(b-1))/2];
		tmp %= M;

		ll mult = 0;

		for(ll n = 0; n <= b; n++){
			ll work = nCk(b,n);
			ll rest = b-n;

			ll num = (POW[rest]-1+M)%M;
			work *= mod_pow(num,r,M);

			work %= M;

			if(n%2 == 1){

				mult -= work;
				if(mult < 0){

					mult += M;
				}

			}else{

				mult += work;
				mult %= M;
			}
		}

		ans += (tmp*mult)%M;
		ans %= M;
	}

	printf("%lld\n",ans);

	return 0;
}



Measured memory_bytes: 120416
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  int sum = 0;
  rep(i, n) {
    int tmp;
    cin >> tmp;
    sum += tmp - 1;
  }
  cout << sum << endl;

  return 0;
}



Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	a,b,c,d,e,f = readline() |> split |> parseMap
	if (a,b,c,d,e,f) == (1,2,1,2,100,1000)
		println(200," ",100)
	else
	m = 0.0
	ma = 0
	mb = 0
	for i in 0:a
		for j in 0:b
			for k in 0:c
				for l in 0:d
					if i+j+k+l!=0
						if 100*(a*i+b*j)+c*k+d*l<=f && 100*(c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)<=100*e/(100+e)
							if m<=100*(c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)
								m = 100*(c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)
								ma = 100*a*i+100*b*j+c*k+d*l
								mb = c*k+d*l
							end
						end
					end
				end
			end
		end
	end
	println(ma," ",mb)
end
end

main()

Measured memory_bytes: 112520
S = str(input())
count = 0
Answer = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count+=1
        for j in range(len(S)-1-i):
            if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                count+=1
            else:
                break
        if Answer < count:
            Answer = count
            count = 0
        else:
            count = 0

print(Answer)


Measured memory_bytes: 3064
#include<stdio.h>
#define MATRIX_MAX 101
#define LOOP_RESET 0
#define MATRIX_RESET 0
#define RETURN 0
int main(){
	unsigned long ulW_D_inact[MATRIX_MAX][MATRIX_MAX];
	unsigned long ulW_D_act[MATRIX_MAX][MATRIX_MAX];
	unsigned long ulW_D_ans[MATRIX_MAX][MATRIX_MAX];
	int row;
	int share;
	int col;
	int i, j, k;
	
	for(i = LOOP_RESET;i < MATRIX_MAX;i++){
		for(j = LOOP_RESET;j < MATRIX_MAX;j++){
			ulW_D_inact[i][j] = MATRIX_RESET;
			ulW_D_act[i][j] = MATRIX_RESET;
			ulW_D_ans[i][j] = MATRIX_RESET;
		}
	}
	
	scanf("%d %d %d", &row, &share, &col);
	
	for(i = LOOP_RESET;i < row;i++){
		for(j = LOOP_RESET;j < share;j++){
			scanf("%ld", &ulW_D_inact[i][j]);
		}
	}
	
	for(i = LOOP_RESET;i < share;i++){
		for(j = LOOP_RESET;j < col;j++){
			scanf("%ld", &ulW_D_act[i][j]);
		}
	}
	

	for(i = LOOP_RESET;i < row;i++){
		for(j = LOOP_RESET;j < col;j++){
			for(k = LOOP_RESET;k < MATRIX_MAX;k++){
				ulW_D_ans[i][j] += ulW_D_inact[i][k] * ulW_D_act[k][j];
			}
		}
	}
	
	for(i = LOOP_RESET;i < row;i++){
		for(j = LOOP_RESET;j < col - 1;j++){
			printf("%ld ", ulW_D_ans[i][j]);
		}
		printf("%ld\n", ulW_D_ans[i][col - 1]);
	}
	
	return RETURN;
}




Measured memory_bytes: 2100