akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int x[200000];
signed main(){
	int n;scanf("%d",&n);
	int k;scanf("%d",&k);
	rep(i,n){
		scanf("%d",&x[i]);
	}
	int Min=INT_MAX;
	rep(i,n-k+1){
		int a=x[i],b=x[i+k-1];
		int c;
		if(a<0&&b<0)c=-a;
		else if(a<0)c=min((-a)*2+b,(-a)+b*2);
		else c=b;
		Min=min(Min,c);
	}
	cout<<Min<<endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

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

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c  ;
    cin >> a >> b >> c ;
    if(a==b && b!=c){
        yes() ;
    }
    else if(a!=b && b== c){
        yes() ;
    }
    else if(a==c && c!=b){
        yes() ;
    }
    else{
        no() ;
    }


    

    return 0;
}


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

int isprime(int);

int main(){
  int i,j,n,cnt=0,flag=0,a[10000];
  
  scanf("%d",&n);
  if((1<=n&&n<=10000)==0)return 0;
  for(i=0; i<n; i++){
    scanf("%d",&a[i]);
    if(a[i]<2 || a[i]>100000000)return 0;
  }

  for(i=0; i<n; i++){
    if(isprime(a[i])==1)cnt++;
  }
  
  printf("%d\n",cnt);

  return 0;
}

int isprime(int x){

  int i;
  
  if(x==2)return 1;

  if(x<2||x%2==0)return 0;

  i=3;
  while(i<=pow(x,0.5)){
    if(x%i==0)return 0;
    i=i+2;
  }

  return 1;
}



Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0) 
#define sz(a) (a).size()
#define triple pair<pill, ll>
#define pinode pair<node*, node*>
#define quadra pair<pill, pill>
using namespace std;
 
/*
 tips :
 Sqrt opt
 Binary search
 Try to find the easiest solution
 Recursiya
 FUCK YOU pishi kod akuratnee daun yobani
 sdohni v adu nahui blyat' y ub'uy tebya
 esli ti blyad' budesh pisat' kod gryaznim
 to ya tebya v rot viebu
*/
 
const ll N = 2e5 + 10;
const ll M = 3e3 + 10;
const ll big = 1e18;
const ll shift = 1000;
const ll block = 500;
const ll has = 200123140004043;

const ll mod = 998244353;

mt19937 srnd(chrono::steady_clock::now().time_since_epoch().count()); 

ll n, q;

struct seg {
	ll t[4 * N] = {0};
	ll u[4 * N] = {0};
	void bld() {
	 	for(int i = 0; i < 4 * N; i++)
	 		t[i] = n - 1, u[i] = n - 1;
	}
	void push(ll v) {
		t[v] = min(t[v], u[v]);
		if(v * 2 + 1 < 4 * N)
			u[v * 2] = min(u[v * 2], u[v]),
			u[v * 2 + 1] = min(u[v * 2 + 1], u[v]);
	}
	void upd(ll l, ll r, ll z, ll v = 1, ll tl = 1, ll tr = n) {
	    push(v);
	 	if(l > tr || tl > r)
	 		return;
		if(l <= tl && tr <= r) {
			u[v] = min(u[v], z);
			push(v);
			return;
	 	}
	 	ll m = tl + tr >> 1;
	 	upd(l, r, z, v * 2, tl, m);
	 	upd(l, r, z, v * 2 + 1, m + 1, tr);
	}
	ll get(ll p, ll v = 1, ll tl = 1, ll tr = n) {
		push(v);                                                            
		if(tl == tr)                         
	 		return t[v];
	 	ll m = tl + tr >> 1;
	 	if(p <= m)
	 		return get(p, v * 2, tl, m);
		return get(p, v * 2 + 1, m + 1, tr);		
	}
} rt[2];	

int main() {
    speed;
	cin >> n >> q;
	rt[0].bld();
	rt[1].bld();
	ll ans = (n - 2ll) * (n - 2ll);
	while(q--) {
		ll a, b;
		cin >> a >> b;	
		ll z = rt[a - 1].get(b);    
		ans = ans - (z - 1);
		rt[(a - 1) ^ 1].upd(1, z, b - 1);
	}
	cout << ans;
}             
                     
 
/*
5 3
1 3
2 3
1 4
*/ 

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

const long long INF = 2ll << 60;

int main() {
    int a, b, q;
    cin >> a >> b >> q;
    vector<long long> s(a + 2), t(b + 2);
    s.at(0) = t.at(0) = -INF;
    for (int i = 0; i < a; i++) {
        cin >> s.at(i + 1);
    }
    for (int i = 0; i < b; i++) {
        cin >> t.at(i + 1);
    }
    s.at(a + 1) = t.at(b + 1) = INF;

    for (int i = 0; i < q; i++) {
        long long x;
        cin >> x;

        auto it = lower_bound(s.begin(), s.end(), x);
        long long rs = *it;
        long long ls = *prev(it);
        it = lower_bound(t.begin(), t.end(), x);
        long long rt = *it;
        long long lt = *prev(it);
        
        long long minimum = min({
            max(x - ls, x - lt), 
            max(rs - x, rt - x), 
            x - ls + rt - ls, 
            x - lt + rs - lt, 
            rs - x + rs - lt,
            rt - x + rt - ls
        });
      
        cout << minimum << endl;
    }
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define lint long long
//#define P pair<int, int>

int main(){
    int N;
    cin >> N;
    
    bool F[N][5][2];
    lint P[N][11];
    
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 5; ++j){
            for(int k = 0; k < 2; ++k){
                cin >> F[i][j][k];
            }
        }
    }
    
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 11; ++j){
            cin >> P[i][j];
        }
    }
    
    lint ans = -1E10;
    
    for(int i = 1; i < 1024; ++i){
        lint tmp = 0;
        for(int j = 0; j < N; ++j){
            int cnt = 0;
            for(int bit = 0; bit < 10; ++bit){
                cnt += ((i >> bit) & 1) & F[j][bit / 2][bit % 2];
            }
            
            tmp += P[j][cnt];
        }
        ans = max(ans, tmp);
    }
    
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int N = sc.nextInt();

        int max = 0;
        final Map<String, Integer> M = new HashMap<>();
        for (int i = 0; i < N; i++) {
            final String S = sc.next();
            if (!M.containsKey(S)) M.put(S, 0);
            M.put(S, M.get(S) + 1);
            max = Math.max(max, M.get(S));
        }

        List<String> sortedKeyList = M.keySet().stream().sorted().collect(Collectors.toList());

        for (String key : sortedKeyList) {
            if (M.get(key) == max) System.out.println(key);
        }
    }
}


Measured memory_bytes: 87604
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<string>
 
 
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
const int INF = 100000000;
const double EPS = 0.0000001;
typedef pair<int,int> P;

void solve() {
	string ss;
	cin>>ss;

	vector<string> vec;

	for(int i=1;i<ss.size();i++) {
		string ss1 = ss.substr(0,i);
		string ss2 = ss.substr(i,ss.size());

		rep(i,2) {
			
			reverse(ss1.begin(),ss1.end());
			vec.push_back(ss1+ss2);

			reverse(ss2.begin(),ss2.end());
			vec.push_back(ss1+ss2);
		
			reverse(ss1.begin(),ss1.end());
			vec.push_back(ss1+ss2);
		
			reverse(ss2.begin(),ss2.end());
			vec.push_back(ss1+ss2);

			string tmp = ss1;
			ss1 = ss2;
			ss2 = tmp;
		}
	}
	sort(vec.begin(),vec.end());
	vec.erase(unique(vec.begin(), vec.end()) ,vec.end());
	cout<<vec.size()<<endl;
}

int main() {
	int m;
	cin>>m;
	rep(i,m) solve();
	return 0;
}

Measured memory_bytes: 1300
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

attack = 0
H, N = list(map(int,readline().split()))
A = list(map(int,readline().split()))
for i in range(N):
  attack += A[i]
if H > attack:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 11604
N,M = map(int,input().split())
array = list(map(int,input().split()))
ans = [1]*N
for i in range (M):
  A,B = map(int,input().split())
  if array[A - 1] < array[B - 1]:
    ans[A - 1] = 0
  elif array[A - 1] > array[B - 1]:
    ans[B - 1] = 0
  else:
    ans[A-1],ans[B-1] = 0,0
print( sum(ans) )

Measured memory_bytes: 20140
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <numeric>

using namespace std;

typedef long long ll;
typedef long double ld;

#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define file_name(a) (freopen(((string)(a) + ".in").c_str(),"r",stdin), freopen(((string)(a) + ".out").c_str(),"w",stdout))


int nxt() {
	int x;
	cin >> x;
	return x;
}

int main() {
	ll a, b, n;
	cin >> a >> b >> n;
	if (b == 1) {
		cout << 0 << '\n';
		return 0;
	}
	ll ans = 0;
	for (ll x = min(b - 1, n); x <= n; x += b) {
		ans = max(ans, (a * x) / b - a * (x / b));
	}
	cout << ans << '\n';
	return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-c) <= d){
    cout << "Yes" << endl;
  }else if(abs(a-b)<= d && abs(b-c)<=d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz 100002
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define P push
#define VEC(n) ll int x; vector<ll int>v;for(int i=0;i<n;i++){cin>>x;v.pb(x);}
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

//ll int LCM(ll int a,ll int b) { ll int gcd=__gcd(a,b);ll int lcm=a*b/gcd;return lcm;}
//ll int bigmod(ll int b, ll int p, ll int m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ ll int res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//void seive() { prime[np++]=2;for(i=3; i<=sz; i+=2){if(mark[i]==0){ prime[np++]=i;for(j=i*i; j<=sz; j+=i) mark[j]=1; } }}
//string add(string s1,string s2) {string s;int j=s1.size()-1,c=0,m; for(int i=s2.size()-1; i>=0; i--) {if(j>=0)m=s2[i]-'0'+s1[j]-'0'+c;else m=s2[i]-'0'+c; if(m>9) { s+=m%10+'0';c=m/10; } else {  c=0;s+=m+'0'; }j--; } if(c!=0) {s+=c+'0'; }reverse(s.begin(),s.end());return s;}
//int pos;string mul(int n) {string s;for(int i=0; i<pos; i++) { s+="0"; }pos++;int c=0,m; for(int i=s1.size()-1; i>=0; i--) { m=(s1[i]-'0')*n+c;if(m>9) { s+=m%10+'0';c=m/10;} else { c=0; s+=m+'0';} }while(c!=0) { s+=c%10+'0';c=c/10;}    reverse(s.begin(),s.end());return s;}

int main()
{
    ll int n,m,res=0,a;
   string s1,s2;
   cin>>s1>>s2;
   for(int i=0;i<s1.size();i++)if(s1[i]!=s2[i])res++;
   cout<<res<<endl;


}



Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int a,b,c; cin >> a >> b >> c;
    cout << min(b/a, c) << endl;
}

Measured memory_bytes: 256
def DFS(now, visited):
    ans = 0
    if all(visited):
        return 1
    for i in range(N):
        if path[now][i] and visited[i] == False:
            visited[i] = True
            ans += DFS(i, visited)
            visited[i] = False
    return ans
    


N, M = map(int, input().split())
path = [[0]*N for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    path[a-1][b-1] = 1
    path[b-1][a-1] = 1
visited = [False]*N
visited[0] = True
print(DFS(0, visited))




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

vector<int> solve(int n, int a, int b) {
    if (n == 1)
        return {a, b};

    int m = (1 << (n - 1));
    if (a < m && b < m) {
        vector<int> v = solve(n - 1, a, b);
        vector<int> res;
        for (int i = 0; i < m; i += 2) {
            res.push_back(v[i]);
            res.push_back(v[i] ^ m);
            res.push_back(v[i + 1] ^ m);
            res.push_back(v[i + 1]);
        }
        return res;
    } else if (a >= m && b >= m) {
        vector<int> v = solve(n - 1, a ^ m, b ^ m);
        vector<int> res;
        for (int i = 0; i < m; i += 2) {
            res.push_back(v[i] ^ m);
            res.push_back(v[i]);
            res.push_back(v[i + 1]);
            res.push_back(v[i + 1] ^ m);
        }
        return res;
    } else if (a < m && b >= m) {
        for (int i = 0; i < m; ++i) {
            if (__builtin_popcount(a ^ i) & 1) {
                int j = i ^ m;
                if (__builtin_popcount(b ^ j) & 1) {
                    vector<int> x = solve(n - 1, a, i);
                    vector<int> y = solve(n - 1, j ^ m, b ^ m);
                    vector<int> res;
                    for (int k = 0; k < (int)x.size(); ++k)
                        res.push_back(x[k]);
                    for (int k = 0; k < (int)x.size(); ++k)
                        res.push_back(y[k] ^ m);
                    return res;
                }
            }
        }
        assert(false);
    } else {
        for (int i = m; i < (1 << n); ++i) {
            if (__builtin_popcount(a ^ i) & 1) {
                int j = i ^ m;
                if (__builtin_popcount(b ^ j) & 1) {
                    vector<int> x = solve(n - 1, a ^ m, i ^ m);
                    vector<int> y = solve(n - 1, j, b);
                    vector<int> res;
                    for (int k = 0; k < (int)x.size(); ++k)
                        res.push_back(x[k] ^ m);
                    for (int k = 0; k < (int)x.size(); ++k)
                        res.push_back(y[k]);
                    return res;
                }
            }
        }
        assert(false);
    }
}

int main() {
    int n, a, b; scanf("%d%d%d", &n, &a, &b);
    int m = (1 << n);
    
    if (__builtin_popcount(a ^ b) % 2 == 0) {
        puts("NO");
        return 0;
    }

    puts("YES");
    vector<int> ans = solve(n, a, b);
    assert(ans[0] == a && ans[m - 1] == b);
    for (int i = 0; i + 1 < m; ++i) 
        assert(__builtin_popcount(ans[i] ^ ans[i + 1]) == 1);

    for (int i = 0; i < m; ++i) printf("%d ", ans[i]);
    puts("");
    return 0;
}


Measured memory_bytes: 1716
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random

import os
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A = input()
    B = input()
    C = input()
    
    ans = 0
    for i in range(N):
        if A[i] == B[i] and A[i] == C[i]:
            pass
        else:
            if A[i] != B[i] and A[i] != C[i] and B[i] != C[i]:
                ans += 2
            else:
                ans += 1
                
    print(ans)
                
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 38512
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

int dp[310][310][310];
char a[310];

int main()
{
	scanf("%s",a+1);int n=strlen(a+1);
	for (int i=1;i<=n;i++) {dp[i+1][i][0]=0;dp[i][i][0]=1;}
	int K;scanf("%d",&K);
	for (int t=1;t<n;t++)
		for (int i=1;i<=n-t;i++)
		{
			int j=i+t;
			for (int k=0;k<=K;k++)
			{
				dp[i][j][k]=max(dp[i][j-1][k],dp[i+1][j][k]);
				if (a[i]==a[j])
					dp[i][j][k]=max(dp[i][j][k],dp[i+1][j-1][k]+2);
				else
					if (k) dp[i][j][k]=max(dp[i][j][k],dp[i+1][j-1][k-1]+2);
			}
		}
	int ans=0;
	for (int i=0;i<=K;i++) ans=max(ans,dp[1][n][i]);
	printf("%d\n",ans);
	return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  priority_queue<int> q;
  int a;
  for(int i = 0; i < n; i++){
    cin >> a;
    q.push(a);
  }
  a = 0;
  for(int i = 0; i < k; i++){
    a += q.top();
    q.pop();
  }
  cout << a << endl;
  
  return 0;
}

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

using namespace std;

main(){
  int n, sum, d[10000];
  cin >> n >> sum;
  for(int i=0;i<n;i++){
    int a, b;
    cin >> a >> b;
    d[i] = a - b;
  }
  int ans = sum;
  for(int i=0;i<n;i++){
    sum += d[i];
    ans = max(ans, sum);
    if(sum < 0){
      ans = 0;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1196
#include<iostream>
#include<string>

/*void shift(std::string str){
  for(int i=0;i<str.size();i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i] += 1;
      if(str[i]==123){
        str[i]='a';
      }
    }
  }
}*/

int main(){
  std::string str;
  int flag;

  while(std::getline(std::cin, str)){
    //str[0] += 1;
    //std::cout << str << std::endl;
    flag = 1;
    while(flag){
      //shift(str);
      //std::cout << str << std::endl;
      for(int i=0;i<str.size();i++){
        if('a'<=str[i]&&str[i]<='z'){
          str[i] += 1;
          if(str[i]==123){
            str[i]='a';
          }
        }
      }

      if(!(str.find("this")==std::string::npos)){
        flag = 0;
      }
      if(!(str.find("that")==std::string::npos)){
        flag = 0;
      }
      if(!(str.find("the")==std::string::npos)){
        flag = 0;
      }
    }
    std::cout << str << std::endl;
  }
}

Measured memory_bytes: 2968
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#pragma warning( disable:4996 )
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	/*int x, a;
	scanf("%d %d", &x, &a);
	if (x < a) {
		printf("0\n");
	}
	else {
		printf("10\n");
	}*/
	/*int n, x;
	scanf("%d %d", &n, &x);
	int l[101];
	for (int i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}
	int d=0;
	int count = 1;
	for (int i = 0; i < n; i++) {
		d = d + l[i];
		if (d <= x)count++;
	}
	printf("%d", count);*/

	int w, h, x, y;
	scanf("%d %d %d %d", &w, &h, &x, &y);
	double W = w, H = h;
	double ans = W * H / 2.0;
	if (!(w==2*x&&h==2*y)) {
		printf("%lf %d\n", ans, 0);
	}
	else {
		printf("%lf %d\n", ans, 1);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

/**
 * Created by nakatsukatakahiro on 2017/06/22.
 */
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int x = scanner.nextInt();
        int y = scanner.nextInt();

        if (x == 2) {
            if (y == 2) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } else if (x == 4 || x == 6 || x == 9 || x == 11) {
            if (y == 4 || y == 6 || y == 9 || y == 11) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } else {
            if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  ll y;
  cin >> n >> y;
  rep(i,n+1){
    rep(j,n-i+1){
      int k = n-i-j;
      if(i+j+k != n) continue;
      if(i*10000 + j*5000  + k*1000 == y){
        cout<<i<<" "<<j<<" "<<k<<endl;
        return 0;
      } 
    }
  }
  cout<<-1<<" "<<-1<<" "<<-1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>

using namespace std;

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

int f(int X) {
    int v = 0;
    while (true) {
        if (X == 0) return v;
        v += X % 10;
        X /= 10;
    }
}

bool isHarshad(int X) {
    return (X % f(X) == 0);
}

int main() {
    int N; // 1e8
    scanf("%d", &N);

    if (isHarshad(N)) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long c = sc.nextLong();
		long[] x = new long[n + 1];
		long[] v = new long[n + 1];
		long[] vsum = new long[n + 1];
		vsum[0] = 0;
		for(int i = 1; i < n + 1; i++) {
			x[i] = sc.nextLong();
			v[i] = sc.nextLong();
			vsum[i] = vsum[i - 1] + v[i];
		}
		long[] clo = new long[n + 1];
		long[] unc = new long[n + 1];
		clo[0] = 0;
		unc[0] = 0;
		long[] clodis = new long[n + 1];
		long[] uncdis = new long[n + 1];
		clodis[0] = 0;
		uncdis[0] = 0;
		for(int i = 1; i < n + 1; i++) {
			if(clo[i - 1] < vsum[i] - x[i]) {
				clo[i] = vsum[i] - x[i];
				clodis[i] = x[i];
			} else {
				clo[i] = clo[i - 1];
				clodis[i] = clodis[i - 1];
			}
		}
		for(int i = n; i > 0; i--) {
			if(i == n) {
				if(0 < vsum[n] - vsum[n - 1] - (c - x[n])) {
					unc[n] = vsum[n] - vsum[n - 1] - (c - x[n]);
					uncdis[n] = c - x[n];
				} else {
					unc[n] = 0;
					uncdis[n] = 0;
				}
			} else {
				if(unc[i + 1] < vsum[n] - vsum[i - 1] - (c - x[i])) {
					unc[i] = vsum[n] - vsum[i - 1] - (c - x[i]);
					uncdis[i] = c - x[i];
				} else {
					unc[i] = unc[i + 1];
					uncdis[i] = uncdis[i + 1];
				}
			}
		}
		long ans = 0;
		for(int i = 0; i < n + 1; i++) {
			long tmp = clo[i];
			if(i != n) {
				tmp += unc[i + 1];
				tmp -= Math.min(clodis[i], uncdis[i + 1]);
			}
			ans = Math.max(ans, tmp);
		}
		System.out.println(ans);
	}

}


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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  // ここにプログラムを追記
  cout << s1.at(0)<<s2.at(0)<<s3.at(0)<< endl;   
}

  



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;cin >> N;
    vector<int> V(N),W;
    REP(i,N) cin >> V[i];
    sort ALL(V);
    REP(i,N-1){
        if(V[i] == V[i+1]) W.pb(V[i]);
    }

    if(W.size() % 2 == 0){
        cout << V.size() - W.size() << endl;
    }
    else cout << V.size() - W.size() - 1 << endl;
}

Measured memory_bytes: 1276
#include <iostream>

using namespace std;

using ll = long long;
const int MAX_A = 100000;

int main() {
    int N;
    ll K;
    ll cnt[MAX_A + 1];
    for (int i = 0; i < MAX_A + 1; ++i) {
        cnt[i] = 0;
    }
    cin >> N >> K;

    for (int i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        cnt[a] += b;
    }

    int total = 0;
//    for (int ans = 1; ans <= MAX_A; ++ans) {
//        total += cnt[ans];
//        if (K <= total) {
//            cout << ans << endl;
//            break;
//        }
//    }
    int kkk = K;
    for (int ans = 1; ans <= MAX_A; ++ans) {
        total += cnt[ans];
        bool flag;
        if (K <= total) {
            flag = true;
        }

        if (K <= cnt[ans]) {
            if (!flag) {
                while (!flag) {

                }
            }
            cout << ans << endl;
            break;
        }
        K -= cnt[ans];
    }
    return 0;
}

Measured memory_bytes: 1024
import numpy as np

N=int(input())
A=np.array(list(map(int,input().split())))

res=0
mod=10**9+7
for i in range(61):
  cnt=np.count_nonzero(A>>i & 1)
  res+=cnt*(N-cnt)<<i
  res%=mod
print(res)

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

s = []
for i in range(n):
    s.append(input())

alp_list = [chr(i) for i in range(97, 97+26)]
min = 0
ans = ''
for char in alp_list:
    for i in range(n):
        if i==0:
            min = s[i].count(char)

        if s[i].count(char) < min :
            min = s[i].count(char)

    for x in range(min):
        ans += char

print(ans)


Measured memory_bytes: 3064
#include<iostream>

using namespace std;
int N,M,P;

void solve() {
    int sum=0;
    int a;
    for(int i=1;i<=N;i++) {
        int b;
        cin>>b;
        sum+=b;
        if(i==M) a=b;
    }
    sum*=100;
    sum=sum*(100-P)/100;
    if(a==0) sum*=0;
    else sum/=a;
    cout<<sum<<endl;
}

int main() {

    while(cin>>N>>M>>P) {
        if(N+M+P==0) return 0;
        solve();
    }

    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int n,d[100005];
string s;
bool dfs(int i)
{
	if(i==n-1)
	{
		if(s[i]=='o'&&d[i]&&d[(i+1)%n]==d[(i-1+n)%n])return false;
		if(s[i]=='o'&&!d[i]&&d[(i+1)%n]!=d[(i-1+n)%n])return false;
		if(s[i]=='x'&&d[i]&&d[(i+1)%n]!=d[(i-1+n)%n])return false;
		if(s[i]=='x'&&!d[i]&&d[(i-1+n)%n]==d[(i+1)%n])return false;
		if(dfs(0))return true;
		return false;
	}
	if(i==0)
	{
		if(s[i]=='o'&&d[i]&&d[(i+1)%n]==d[(i-1+n)%n])return false;
		if(s[i]=='o'&&!d[i]&&d[(i+1)%n]!=d[(i-1+n)%n])return false;
		if(s[i]=='x'&&d[i]&&d[(i+1)%n]!=d[(i-1+n)%n])return false;
		if(s[i]=='x'&&!d[i]&&d[(i-1+n)%n]==d[(i+1)%n])return false;
		return true;
	}
	if(s[i]=='o')
	{
		if(d[i]==1)
		{
			d[i+1]=!d[i-1];
			if(dfs(i+1))return true;
			return false;
		}
		if(d[i]==0)
		{
			d[i+1]=d[i-1];
			if(dfs(i+1))return true;
			return false;
		}
	}
	if(s[i]=='x')
	{
		if(d[i]==1)
		{
			d[i+1]=d[i-1];
			if(dfs(i+1))return true;
			return false;
		}
		if(d[i]==0)
		{
			d[i+1]=!d[i-1];
			if(dfs(i+1))return true;
			return false;
		}
	}
	
}
int main()
{
	cin>>n>>s;
	d[0]=1;d[1]=1;
	if(dfs(1))
	{
		for(int i=0;i<n;i++)
			printf("%c",d[i]?'W':'S');
		cout<<endl;
		return 0;
	}
	d[0]=1;d[1]=0;
	if(dfs(1))
	{
		for(int i=0;i<n;i++)
			printf("%c",d[i]?'W':'S');
		cout<<endl;
		return 0;
	}
	d[0]=0;d[1]=0;
	if(dfs(1))
	{
		for(int i=0;i<n;i++)
			printf("%c",d[i]?'W':'S');
		cout<<endl;
		return 0;
	}
	d[0]=0;d[1]=1;
	if(dfs(1))
	{
		for(int i=0;i<n;i++)
			printf("%c",d[i]?'W':'S');
		cout<<endl;
		return 0;
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long int;
const int INF = 101010101;

int main()
{
    int h, n; cin >> h >> n;
    vector<vector<int>> ab;
    int a, b;
    for(int i=0; i<n; i++){
        cin >> a >> b;
        ab.push_back(vector<int>{a, b});
    }
    int min_cost = INF;
    int dp[n + 1][20010];
    fill(dp[0], dp[0] + 20010, INF);
    dp[0][0] = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<=20010; j++){
            if(j < ab[i][0]){
                dp[i + 1][j] = dp[i][j];
            } else{
                dp[i + 1][j] = min(dp[i][j], dp[i+1][j - ab[i][0]] + ab[i][1]);
            }
        }
    }
    for(int i=h; i<20010; i++){
        min_cost = min(min_cost, dp[n][i]);
    }
    cout << min_cost << endl;
    return 0;
}

Measured memory_bytes: 78592
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;

int n,a,b;

int main()
{
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
	return 0;
}


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

int dp[10010];
int main(){
    int H,N; cin >> H >> N;
    int A[10010],B[10010];
    rep(i,N) cin >> A[i] >> B[i];
    rep(i,H) dp[i]=INF;
    dp[H]=0;
    
    for (int i=H; i>=0; i--){
        for (int j=0; j<N; j++){
            if (i-A[j]<=0) dp[0]=min(dp[0],dp[i]+B[j]);//dp[i]-A[j]だとダメ
            else dp[i-A[j]]=min(dp[i-A[j]],dp[i]+B[j]);
        }
    }
    cout << dp[0];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  int n,m;
  while(~scanf("%d%d",&n,&m)){
    if(!n && !m)break;
    vi user(n);
    REP(i,n)user[i]=i+1;
    int iter = -1;
    while(n>1){
      iter += m;
      iter %= n;
      user.erase(user.begin()+iter);
      --n;
      --iter;
    }
    cout<<user[0]<<endl;
  }
  return 0;
}

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

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



int main() {

    int n;
    cin >> n;
    long long ans=0;
    for (long long i = 1; i <= n;i++)
    {
        if(i%3!=0&&i%5!=0)
        {
            ans += i;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define N 55
using namespace std;
typedef vector<vector<bool> > V;
typedef pair<int,int> P;
typedef pair<P,P> PP;
string mp[N];
vector<PP> A;
int h,w;

bool compare(PP &a,PP &b){
  int w1 = a.second.first - a.first.first+1;
  int h1 = a.second.second - a.first.second+1; 
  int w2 = b.second.first - b.first.first+1;
  int h2 = b.second.second -b.first.second+1;
  return h1*w1 < h2*w2;
}

map<P,V> v;
void visit(int x,int y){
  if(v.count(P(x,y)))return;

  if(x<0||y<0||x>=w||y>=h){
    v[P(x,y)] = V(N,vector<bool>(N,1));
    return;
  }
  V &D = v[P(x,y)] =V(h,vector<bool>(w,0));
  D[y][x] = 1;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) {
      if(mp[i][j] == '#')continue;
      if(i)D[i][j] = D[i][j]|D[i-1][j];
      if(j)D[i][j] = D[i][j]|D[i][j-1];
    }
}

void pushA(int x,int y){
  visit(x,y);
  V &D = v[P(x,y)];
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
      if(!D[i][j]||islower(mp[i][j])||tolower(mp[i][j])!=mp[y][x])continue;
      A.push_back(PP(P(x,y),P(j,i)));
    }
}

void mkA(){
  A.clear();
  v.clear();
  visit(0,0);
  V &D = v[P(0,0)];
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(D[i][j]&&islower(mp[i][j]))pushA(j,i);
  
  sort(A.begin(),A.end(),compare);
}

bool check(PP a,PP b){
  int x1=a.first.first,y1=a.first.second;
  int X1=a.second.first,Y1=a.second.second;
  int x2=b.first.first,y2=b.first.second;
  int X2=b.second.first,Y2=b.second.second;
  if(a.first==b.first||a.second == b.second)return 0;
  
  visit(x1,y1),visit(X2,Y2);
  V &A = v[P(x1,y1)],&B = v[P(X2,Y2)]; 
  if(!A[y2][x2]||(X1<w&&X2<h&&!B[Y1][X1])||!B[h-1][w-1])return 0;
  return x1<=x2&&X2<=X1&&y1<=y2&&Y2<=Y1;
}


map<PP,int> mem[1000];
int dfs(int idx,PP sta){  
  if(idx == -1) return 0;
  if(mem[idx].count(sta))return mem[idx][sta];
  int res = dfs(idx-1,sta);
  if(check(sta,A[idx])){
    int a = dfs(idx-1,PP(sta.first,A[idx].first));
    int b = dfs(idx-1,A[idx]);
    int c = dfs(idx-1,PP(A[idx].second,sta.second));
    res = max(res,a+b+c+1);
  }
  return mem[idx][sta] = res;
}

int main(){
  while(1){
    cin>>h>>w;
    if(!h&&!w)break;
    for(int i=0;i<h;i++)cin>>mp[i];
    for(int i=0;i<1000;i++)mem[i].clear();
    mkA();
    visit(0,0);
    if(!v[P(0,0)][h-1][w-1]) cout<<-1<<endl;
    else cout<<dfs(A.size()-1,PP(P(-1,-1),P(w,h)))<<endl;
  }
}

Measured memory_bytes: 144948
#include<iostream>
#include<vector>
using namespace std;
using ull = unsigned long long;

int main() {
  int n,a;
  cin>>n>>a;
  vector<int> x;
  for (int i=0;i<n;++i) {
    int tmp;
    cin>>tmp;
    x.push_back(tmp);
  }

  vector<vector<vector<ull> > > dp
    = vector<vector<vector<ull> > >(n+1, vector<vector<ull> >(n+1, vector<ull>(n*a+1, 0)));

  dp[0][0][0] = 1;
  for (int j=0;j<n+1;++j) {
    for (int k=0;k<n+1;++k) {
      for (int s=0;s<n*a+1;++s) {
        if (j>0 && s<x[j-1]) {
          dp[j][k][s] = dp[j-1][k][s];
        } else if (j>0 && k>0 && s>=x[j-1]) {
          dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]];
        }
      }
    }
  }

  unsigned long long ret = 0;
  for (int k=1;k<n+1;++k) {
    ret += dp[n][k][k*a];
  }
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 52224
#include <bits/stdc++.h>
using namespace std;
int main(void){

    int n, l;
    cin >> n >> l;
    
    vector<int> r(n+1);
    int min = 999999;
    int index = 0;
    for(int i=1; i<=n; i++) {
        r[i] = i+l-1;
        int temp = (i+l-1)<0? -(i+l-1):(i+l-1);
        if(temp<min) {
            min = temp;
            index = i;
        }
    }

    int result = 0;
    for(int i=1; i<=n; i++) {
        if(i!=index) result += r[i];
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#[warn(dead_code)]
fn read<T: std::str::FromStr>() -> T {
   let mut s = String::new();
   std::io::stdin().read_line(&mut s).ok();
   s.trim().parse().ok().unwrap()
}

#[warn(dead_code)]
fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
   let s = read::<String>();
   s.split(delimiter)
      .map(|e| e.parse().ok().unwrap())
      .collect::<Vec<T>>()
}

fn main() {
    let r = read::<f64>();
    println!("{}", 2.0 * r * std::f64::consts::PI);
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


//-----------------------------------------------------------------------------

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

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

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,n) for(ll i=0;i<n;i++)
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

int main(){
    fast;
        int k;
      string s;
      cin>>k>>s;
      if(s.size()>k){
        string ss="";
        for(ll i=0;i<k;i++){
            ss+=s[i];
        }
        s=ss;
        s+="...";
      }
      cout<<s<<endl;
    
}

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

int main(){
  int n;
  cin >> n;
  int ans=0;
  int v[20],c[20];
  for(int i=0;i<n;i++) cin >> v[i];
  for(int i=0;i<n;i++) cin >> c[i];
  
  for(int i=0;i<n;i++){
    if(v[i]>c[i]) ans+=v[i]-c[i];
  }
  
  cout << ans << endl;
}
    

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

using namespace std;

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    bool finished = false;
    for (int x = 0; x < h && !finished; x++) {
        for (int y = 0; y < w && !finished; y++) {
            if (a * x + (w - a) * (h - x) == b * y + (h - b) * (w - y)) {
                vector<int> yoko(h);
                for (int i = 0; i < h; i++)yoko[i] = i < x ? a : w - a;
                vector<int> tate(w);
                for (int i = 0; i < w; i++)tate[i] = i < y ? b : h - b;

                vector<string> ret(h);
                for (int i = 0; i < h; i++) {
                    for (int j = 0; j < w; j++) {
                        if (yoko[i] > 0 && tate[j] > 0) {
                            ret[i] += "0";
                            yoko[i]--;
                            tate[j]--;
                        } else {
                            ret[i] += "1";
                        }
                    }
                }

                bool ok = true;
                for (auto count:tate)if (count > 0)ok = false;
                for (auto count:yoko)if (count > 0)ok = false;

                if (ok) {
                    for (auto x:ret)cout << x << endl;
                    finished = true;
                }
            }
        }
    }

    if (!finished)cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 2304
#!/usr/bin/env python3

d_init = [0] * 10
while True:
    data = d_init[:]
    n = int(input())
    if n == 0:
        break

    for _ in range(n):
        in_data = int(input())
        data[in_data] += 1

    for d in data:
        if d == 0:
            print("-")
        else:
            print("*" * d)

Measured memory_bytes: 6344
import sys
from collections import Counter
from random import shuffle
my_input = sys.stdin.readline

H, W, M = map(int, my_input().split())
targets = set()
h_targets = []
w_targets = []

for m in range(M):
    h, w = map(int, my_input().split())
    h, w = h - 1, w - 1
    targets.add((h, w))
    h_targets.append(h)
    w_targets.append(w)

h_counter = Counter(h_targets).most_common()
w_counter = Counter(w_targets).most_common()

h_high = h_counter[0][1]
w_high = w_counter[0][1]

h_counter = [[k, v] for k, v in h_counter if v == h_high]
w_counter = [[k, v] for k, v in w_counter if v == w_high]
shuffle(h_counter)
shuffle(w_counter)

highest = h_high + w_high
for hk, hv in h_counter:
    for wk, wv in w_counter:
        if hv + wv < highest:
            break
        if ((hk, wk) not in targets):
            print(highest)
            exit()
print(highest - 1)


Measured memory_bytes: 265804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
template<class T>void die(T a){cout << a << endl; exit(0);}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}




int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    ll a;
  double b;
  cin >> a >> b;
  ll ib = b*100+0.5;
  a *= ib;
  a /= 100;
  printf("%lld\n", a);
  return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
 
 
int main() {
 
    //input
    int n,a,b;
    cin>>n>>a>>b;

    //solve
    int diff=b-a-1;

    if(diff == 0){
        cout<<"Borys";
    }else if(diff == 1){
        cout<<"Alice";

    }else{

        if((diff%2) == 0){
            cout<<"Borys";
        }else{
            cout<<"Alice";
        }

    }

    return 0;
}



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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

ll rev(ll n) {
    ll t = 1;
    while (t <= n) {
        t *= 2;
    }
    t--;
    return (t & (~n)) + 1;
}

#include <map>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    map<ll, int> s;
    REP(i, 0, n) {
        cin >> a[i];
        s[a[i]]++;
    }
    sort(a.rbegin(), a.rend());
    int ans = 0;
    REP(i, 0, n) {
        ll t = a[i];
        if (s[t] <= 0) continue;
        s[t]--;
        ll r = rev(t);
        if (s[r] > 0) {
            s[r]--;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
  int N, M;
  vector<int> pos;
  vector<int> l;
  
  cin >> N >> M;
  
  if (N >= M) {
    cout << 0 << endl;
    
    return 0;
  }
  
  for (int i = 0; i < M; i++) {
    int in = 0;
    
    cin >> in;
    
    pos.push_back(in);
  }
  
  sort(pos.begin(), pos.end());
  
  for (int i = 0; i < M - 1; i++) {
    l.push_back(pos[i + 1] - pos[i] - 1);
  }
  
  sort(l.begin(), l.end());
  
  int sum = 0;
  for (int i = 1; i <= N - 1; i++) {
    sum += l[l.size() - i];
  }
  
  cout << pos[M - 1] - pos[0] + 1 - N - sum << endl;
  
  return 0;
}

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

int main() {
  string S;
  cin >> S;
  int min_ = 100000;
  int N = S.size();
  for (int i = 0; i < 26; i++){
    int count = 0;
    int max_ = 0;
    for (int j = 0; j < N; j++){
      if (S[j] == i + 'a') {
        max_ = max(max_, count);
        count = 0;
      }
      else count++;
    }
    max_ = max(max_, count);
    min_ = min(min_, max_);
  }
  
  cout << min_ << endl;
}

Measured memory_bytes: 3560