akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	a := make([]int, n)
	var sum int
	for i := 0; i < n; i++ {
		scanner.Scan()
		a[i], _ = strconv.Atoi(scanner.Text())
		sum += a[i]
	}

	var test func(x int) bool
	test = func(x int) bool {
		r := make([]int, n)
		for i := 0; i < n; i++ {
			r[i] = a[i] % x
		}
		sort.Ints(r)

		mSum := make([]int64, n+1)
		pSum := make([]int64, n+1)
		for i := 0; i < n; i++ {
			mSum[i+1] = mSum[i] + int64(r[i])
			pSum[i+1] = pSum[i] + int64(x-r[i])
		}

		for i := 0; i <= n; i++ {
			m := mSum[i]
			p := pSum[n] - pSum[i]

			if m == p && m <= int64(k) {
				return true
			}
			/**
			if p > m {
				m = p
			}
			if m <= int64(k) {
				return true
			}
			 */
		}
		return false
	}

	ret := 1
	for i := 1; i*i <= sum; i++ {
		if sum%i != 0 {
			continue
		}

		if test(i) && i > ret {
			ret = i
		}
		if test(sum/i) && sum/i > ret {
			ret = sum / i
		}
	}

	fmt.Println(ret)
}


Measured memory_bytes: 6528
#include<stdio.h>
  
int main(){
     int a[3];
     int b;
     scanf("%d %d %d", &a[0],&a[1],&a[2]);
     while(a[0] > a[1] || a[1] > a[2] || a[0] > a[2]){
          if (a[0] > a[1]){
               b=a[1];
               a[1]=a[0];
               a[0]=b;
          }
          if (a[1] > a[2]){
               b=a[2];
               a[2]=a[1];
               a[1]=b;
          }
     }
     printf("%d %d %d\n", a[0],a[1],a[2]);
     return 0;
}


Measured memory_bytes: 2148
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.nextInt();// Nは読み捨て
		int m = sc.nextInt();
		int x = sc.nextInt();
		sc.nextLine();// 改行読み捨て
		String[] a = sc.nextLine().split(" ");
		int leftCost = 0;
		for (String s : a) {
			if (Integer.parseInt(s) < x) {
				leftCost++;
			} else {
				break;
			}
		}

		System.out.println(Math.min(leftCost, m - leftCost));

		sc.close();
	}
}

Measured memory_bytes: 23764
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    //string str;
    ll h,w,k;
    cin>>h>>w>>k;
    //vector<vector<ll>> v(tate,vector<ll> (yoko));
    vector<string> str(h);
    vector<ll> height(w);
    vector<ll> width(h);
    rep(i,h) cin>>str[i];
        for (ll hbit = 0; hbit < (1<<h); ++hbit) {
            for (ll wbit = 0; wbit < (1<<w); ++wbit) {
                sum=0;
                for (int i = 0; i < h; ++i) {
                    for (int j = 0; j < w; ++j) {

                if (hbit & (1<<i)&&wbit&(1<<j)) { // 列挙に i が含まれるか
                //cout<<"hi"<<endl;
                //rep(hi,h) rep(wi,w){
                    if(str[i][j]=='#') {
                        sum++;
                    }
                //}
            }
        }
        }
        //cout<<"h:"<<hbit<<"w:"<<wbit<<"sum:"<<sum<<endl;
        if(sum==k) {
        //cout<<"      h:"<<hbit<<"w:"<<wbit<<"sum:"<<sum<<endl;
            maxi++;
        }
        }
    }
    cout<<maxi<<endl;

    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

int main() {
    string s;
    int k;
    int ii;
    cin >> s >> k;
    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) == '1') {
        }
        else {
            ii = i;
            goto next;
        }
    }
    next:
    if (ii >= k) {
        cout << 1 << endl;
    }
    else {
        cout << s.at(ii) << endl;
    }
}

Measured memory_bytes: 256
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string>
#include<stdio.h>
template <class T> class Node {
public:
	Node()
		:parent(0), child(0)
	{};
	Node* parent;
	Node* child;
	T para;
};
template <class T> class UnionFind {
public:
	void Connect(Node<T>* a, Node<T>* b) {
		Vertex(a)->parent = Vertex(b);
	};
	bool Same(Node<T>* a, Node<T>* b) {
		return Vertex(a) == Vertex(b);
	};
private:
	Node<T>* Vertex(Node<T>* _obj) {
		if (_obj->parent == 0) {
			return _obj;
		}
		else {
			return _obj->parent = Vertex(_obj->parent);
		}
	};
};

using namespace std;
typedef pair<int, int> P;
typedef priority_queue<int> PQ;
#define _CRT_SECURE_NO_WARNINGS

int V, E;
struct Load{
	int start;
	int goal;
	int cost;
	void Set(int s, int g, int c) {
		start = s;
		goal = g;
		cost = c;
	}
	bool operator > (const Load& _l) const{
		return cost > _l.cost ;
	}
	bool operator < (const Load& _l) const {
		return cost < _l.cost;
	}
} load[100010];

int main() {

	scanf("%d %d", &V,&E);

	if (E==0) {
		printf("0\n");
		return 0;
	}

	for (int i = 0; i < E;i++) {
		int a, b, c;
		scanf("%d %d %d",&a,&b,&c);
		load[i].Set(a, b, c);
	}
	sort(load, &load[E]);

	UnionFind<int> UF;
	Node<int>* nodes = new Node<int>[V+2];
	long long ans=0;
	for (int i = 0; i < E; i++) {
		if ( !UF.Same(&nodes[load[i].start], &nodes[load[i].goal])) {
			UF.Connect(&nodes[load[i].start], &nodes[load[i].goal]);
			ans += load[i].cost;
		}
	}

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

	return 0;
}

Measured memory_bytes: 4108
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int r;

ld dist( ld x1, ld y1, ld x2, ld y2  ){

	ld d = ( x1-x2 )*(x1-x2) + (y1-y2)*(y1-y2);
	d = sqrt(d);
	return d;

}
 
signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        
	int n;
	cin >> n;
	int x[n+1], y[n+1];
	vi v;
	ld d = 1;
	for(int i=1;i<=n;i++){
		cin >> x[i] >> y[i];
		v.pb(i);
		d = d*i;
	}
	ld ans = 0;
	do{

		for(int i=0;i<n-1;i++){
			ans+= dist( x[v[i]], y[v[i]],  x[v[i+1]], y[v[i+1]] );
		}

	}while(next_permutation(all(v)));

	ans = ans/d;

	cout << fixed << setprecision(10) << ans << endl;	


return 0;
}
///....


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

int main() {
  char input;
  cin >> input;
  
  if(input == 'a' || input == 'i' || input == 'u' || input == 'e' || input == 'o' )
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
# frozen_string_literal: true

n, k, c = gets.split.map(&:to_i)
s = gets.chomp.chars

a = []
count = 0
i = 0
loop do
  break if count == k || i > n - 1

  if s[i] == 'o'
    count += 1
    a.push i + 1
    i += c
  end
  i += 1
end
b = []
count = 0
i = n - 1
loop do
  break if count == k || i < 0

  if s[i] == 'o'
    count += 1
    b.push i + 1
    i -= c
  end
  i -= 1
end
rb = b.reverse
(0..(k - 1)).each do |j|
  puts a[j] if a[j] == rb[j]
end


Measured memory_bytes: 22780
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int r,c,b;
    cin>>r>>c;
    if(r==1 || c==1){
        cout<<"1"<<endl;
    }
    else{
    b=((r*c)+1)/2.0;
    cout<<b <<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
	#include <set>
	#define ll long long 
	#include <string>
	#define pb push_back
	#define mp make_pair
	# define pi 3.14159265358979323846
	#define mod 1000000007
    #define rep(i,n) for(i=0;i<n;i++)
    #define rep1(i,n) for(i=1;i<n;i++)
	using namespace std;
	ll int multiply(ll int a,ll int b)
{
	ll int ans=(a%mod*b%mod)%mod;
	return ans;
}
ll int add(ll int a, ll int b)
{
	ll int ans=(a%mod+b%mod)% mod;	
	return ans;
}

	int power(ll int x,  ll int y, ll int p)  
{  
    ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
	void fastio()
	{					
		#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	    #endif
	    ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	    cout.tie(NULL);

	}
	vector<ll int> adj[100001];
	ll int vis[100001]={0};
	ll int indegree[100001]={0};
	ll int dist[100001]={0};
	void dfs(ll int n)
	{
		vis[n]=1;
		for(auto node: adj[n])
		{
			dist[node]=max(dist[node],dist[n]+1);
			indegree[node]--;
			if (indegree[node]==0)
				dfs(node);
		}
	}
	ll dp[101][100001];
	void solve()
	{
		ll int n,w;
		cin>>n>>w;
		ll int weights[n],values[n],i,j;
		rep(i,n)

		cin>>weights[i]>>values[i];
		for(i=0;i<=n;i++)
		{
			for(j=0;j<=w;j++)
			{
				if(i==0|| j==0)
				dp[i][j]=0;
				else
				{
					ll int op1=dp[i-1][j];
					ll int op2=(weights[i-1]>j)?0: values[i-1]+dp[i-1][j-weights[i-1]];
					dp[i][j]=max(op1,op2);
				}
			}
		}

		cout<<dp[n][w]<<endl;
		
    }
	int main()
	{
		fastio();
		ll int t;
		t=1;
		// cin>>t;
		
		while(t--)
		{
			solve();
		}
			
	}
			

Measured memory_bytes: 84888
#include <iostream>

using namespace std;

int main() {
    bool* dic = new bool[33554432];
    
    int l[30];
    l['A' - 'A'] = 1;
    l['C' - 'A'] = 2;
    l['G' - 'A'] = 3;
    l['T' - 'A'] = 4;
    
    int n;
    cin >> n;
    
    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;
        if(s == "insert"){
            cin >> s;
            long d = 0;
            for(int j = 0; j < s.size(); ++j){
                d = 4 * d + l[s[j] - 'A'];
            }
            dic[d] = true;
        }
        
        if(s == "find"){
            cin >> s;
            long d = 0;
            for(int j = 0; j < s.size(); ++j){
                d = 4 * d + l[s[j] - 'A'];
            }
            if(dic[d]){
                cout << "yes" << endl;
            }else{
                cout << "no" << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4564
import copy

n, k, c = map(int, input().split())
s = list(input())

tmp = copy.deepcopy(s)
wait = 0
last_day = k
count = set()

for num, i in enumerate(tmp):
    if wait>0:
        wait -= 1
        continue
    if i == 'o':
        count.add(num)
        wait = c
        last_day -= 1
        if last_day == 0:
            break

tmp = copy.deepcopy(s)
wait = 0
last_day = k
count2 = set()
for num, i in enumerate(reversed(tmp)):
    if wait>0:
        wait -= 1
        continue
    if i == 'o':
        count2.add(n - num - 1)
        wait = c
        last_day -= 1
        if last_day == 0:
            break

count = list(count)
count2 = list(count2)
count.sort()
count2.sort()
ans = []
for i in range(len(count)):
    if count[i]==count2[i]:
        ans.append(count[i]+1)

for i in ans:
    print(i)

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

int main(void){
  long long int n, k, so[100010];
  for(int i=0;i<100010;++i) so[i] = 0;
  cin >> n >> k;
  for(int i=0;i<n;++i){
    int a, b;
    cin >> a >> b;
    so[a] += b;
  }
  long long int sum = 0;
  for(int i=0;i<100010;++i){
    sum += so[i];
    if(sum >= k){
      cout << i << endl;
      return 0;
    }
  }
}


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

class Program
{
    static void Main(string[] args) {
        long[] s = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long a = s[0];
        long b = s[1];
        Console.WriteLine(f(b)^f(a-1));
    }
    static long f(long x) {
        switch (x%4) {
            case 0: return x;
            case 1: return 1;
            case 2: return x+1;
            default: return 0;
        }
    }
}

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

const int MAXN = 1e4 + 5;

int n;
string str[MAXN];
int numStr[4];
int ans = 0;

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> str[i];
		int id = 0;
		if(str[i][0] == 'B')
			id += 1;
		if(str[i][str[i].size()-1] == 'A')
			id += 2;
		++numStr[id];
		for(int j = 0; j < str[i].size()-1; ++j){
			if(str[i][j] == 'A' && str[i][j+1] == 'B')
				++ans;
		}
	}
	fprintf(stderr, "(%d)\n", ans);

	// If there is A & B, create long chain of A-BA-BA-...-B
	if(numStr[1] > 0 && numStr[2] > 0){
		ans += numStr[3]+1;
		--numStr[1];
		--numStr[2];
		numStr[3] = 0;
	}else if(numStr[1] > 0 || numStr[2] > 0){
		ans += numStr[3];
		numStr[1] = max(numStr[1]-1, 0);
		numStr[2] = max(numStr[2]-1, 0);
	}else{
		if(numStr[3] > 0) ans += numStr[3]-1;
	}

	// Then, conn A - B
	int tmp = min(numStr[1], numStr[2]);
	ans += tmp;
	numStr[1] -= tmp;
	numStr[2] -= tmp;

	printf("%d\n", ans);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define N 52
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;
}

V v[50][50];
void visit(int x,int y){
  V &D = v[y][x] = V(N,vector<bool>(N,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){
  V &D = v[y][x];
  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 &D = v[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)||
     (x1>=0&&y1>=0&&!v[y1][x1][y2][x2])||
     (!v[Y2][X2][h-1][w-1])||
     (X1<w&&X2<h&&!v[Y2][X2][Y1][X1]))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();

    visit(0,0);
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)if(isalpha(mp[i][j]))visit(j,i);
    
    mkA();
    if(!v[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: 145876
/*
  In the name of ALLAH
  Author : Raashid Anwar
*/
 
#include <bits/stdc++.h>
using namespace std;
 
#define int int64_t
const int M1 =  998244353;
const int M2 =  1000000007;

int l[500001];
int r[500001];
int c[500001];
int a[500001];
int b[500001];
int mp[500001];
int ans[500001];
int n;

void upd(int i, int x) {
  for(; i <= n; i += (i & -i))
    b[i] += x;
}

int get(int i) {
  int sum = 0;
  for(; i; i -= (i & -i))
    sum += b[i];
  return sum;
}

bool comp(int i, int j) {
  return r[i] < r[j];
}

void solve() {
  int q;
  cin >> n >> q;
  for(int i = 1; i <= n; i++)
    b[i] = mp[i] = 0;
  for(int i = 1; i <= n; i++)
    cin >> c[i];
  for(int i = 1; i <= q; i++) {
    cin >> l[i] >> r[i];
    a[i] = i;
  }
  sort(a + 1, a + q + 1, comp);
  int li = 1;
  for(int i = 1; i <= q; i++) {
    while(li <= r[a[i]]) {
      if(mp[c[li]])
        upd(mp[c[li]], -1);
      mp[c[li]] = li;
      upd(li, 1);
      li++;
    }
    ans[a[i]] = get(r[a[i]]) - get(l[a[i]] - 1);
  }
  for(int i = 1; i <= q; i++)
    cout << ans[i] << "\n";
}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}

Measured memory_bytes: 31168
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int a[1000];
signed main(){
	int n;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	int mx = *max_element(a, a+n);
	int mn = *min_element(a, a+n);
	printf("%lld\n",mx-mn);
	return 0;
}






Measured memory_bytes: 256
import math as M
n=int(input())
Numbers=list(map(int,input().split(' ')))
Evens={}
Odds={}
for i in range(n):
    if i%2==0:
        if Numbers[i] in Evens:
            Evens[Numbers[i]]=Evens[Numbers[i]]+1
        else:
            Evens[Numbers[i]]=1

    if i%2!=0:
        if Numbers[i] in Odds:
            Odds[Numbers[i]]=Odds[Numbers[i]]+1
        else:
            Odds[Numbers[i]]=1

Evens=sorted(Evens.items(),key=lambda x:x[1])
Odds=sorted(Odds.items(),key=lambda x:x[1])
Evens.reverse()
Odds.reverse()

if Evens[0][0]==Odds[0][0]:
    if len(Evens)==1:
        Evens.append([Evens[0][0]+1,0])
    if len(Odds) == 1:
        Odds.append([Odds[0][0] + 1, 0])
    print(min(n,n-Evens[0][1]-Odds[1][1],n - Evens[1][1] - Odds[0][1]))
else:
    print(n-Evens[0][1]-Odds[0][1])

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

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

  int v;
  for(int i=1;i<a.size();i++){
     for(int i=0;i<a.size();i++){
      if(i==a.size()-1){
	cout << a[i] << endl;
      }
      else{
	cout << a[i] << " ";
      }
     }
    v=a[i];
    int j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
  }
  for(int i=0;i<a.size();i++){
    if(i==a.size()-1){
      cout << a[i] << endl;
    }
    else{
      cout << a[i] << " ";
    }
  }
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline int read() {
    int x = 0, fh = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            fh = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = (x << 1) + (x << 3) + c - '0';
        c = getchar();
    }
    return x * fh;
}
const int N = 1010;
int n, m, sum, ans, i, a[N];
int main() {
	n = read(); m = read();
	for (i = 1; i <= n; i++) a[i] = read();
	sort(a + 1, a + 1 + n);
	for (i = 1; i <= n; i++) sum += a[i];
	ans += (m - sum) / a[1] + n;
	cout << ans;
	return 0;
}

Measured memory_bytes: 3552
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.List.Split (splitOn)

main :: IO ()
main = do
  s <- getLine
  unless (s == "END OF INPUT") $ do
    putStrLn . solve $ s
    main

solve :: String -> String
solve = concatMap (show . length) . splitOn " "

Measured memory_bytes: 3688
#include<stdio.h>
#include<stdlib.h>
int main(void) {
	int a, b, k, x, y;
	x = 1;
	y = 1;
	k = 0;
	scanf("%d %d", &a, &b);
	while (x > 0 || y > 0) {
		x = a - k;
		y = b - k;
		if (abs(x) == abs(y)) {
			break;
		}
		else
			k++;
	}
	if (abs(x) == abs(y)) {
		printf("%d", k);
	}
	else
		printf("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = unsigned long long;
using vi = vector<int>;

unordered_map<ll, bool> M;
bool l[5][5];
ll s[10];
int h, w, n;

inline bool getv(ll x, ll y)
{
    ll v = (x << 32) | y;
    return M.find(v) != M.end();
}

inline void setv(ll x, ll y)
{
    ll v = (x << 32) | y;
    M[v] = true;
}

inline bool good(int x, int y)
{
    return x >= 0 && y >= 0 && x < h && y < w;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w >> n;
    s[0] = (ll) (h - 2) * (w - 2);
    for (int k = 0; k < n; ++k)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        setv(a, b);
        memset(l, 0, sizeof l);
        for (int i = a - 2; i <= a + 2; ++i)
            for (int j = b - 2; j <= b + 2; ++j)
                if (good(i, j))
                    l[i - (a - 2)][j - (b - 2)] = getv(i, j);

        for (int i = 0; i < 3; ++i)
        {
            for (int j = 0; j < 3; ++j)
            {
                if (!good(a - 2 + i, b - 2 + j) ||
                    !good(a + i, b + j))
                    continue;

                int cnt = 0;
                for (int p = i; p < i + 3; ++p)
                    for (int q = j; q < j + 3; ++q)
                        cnt += l[p][q];

                s[cnt - 1]--;
                s[cnt]++;
            }
        }
    }
    for (int k = 0; k < 10; ++k)
        cout << s[k] << '\n';
}


Measured memory_bytes: 4388
#include<iostream>
// #include<string>
#include<math.h>
using namespace std;

int main(){
    long long int p= pow(10,9)+7;
    long long int N;
    cin >> N;
    long long int A[N];
    long long int sum=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        sum+= A[i];
        sum%= p;
    }

    long long int a=0;
    for(int i=0; i<N; i++){
        sum-= A[i];
        if(sum<0) sum+= p;
        a+= A[i]*sum;
        a%= p;
    }
    cout << a << endl;
    
    return 0;
}

Measured memory_bytes: 5160
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
double pi = 3.141592653589793;
ll mod = 1000000007;

int main() {
    int N;
    cin >> N;
    int f[N][10];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> f[i][j];
        }
    }
    int p[N][11];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 11; j++) {
            cin >> p[i][j];
        }
    }
    ll ans = -922337203685477580;
    for (int i = 1; i < (1 << 10); i++) {
        int pp[N];
        for (int j = 0; j < N; j++) {
            pp[j] = 0;
        }
        for (int j = 0; j < 10; j++) {
            if ((i >> j) % 2 == 1) {
                for (int k = 0; k < N; k++) {
                    if (f[k][j] == 1) {
                        pp[k]++;
                    }
                }
            }
        }
        ll sum = 0;
        for (int j = 0; j < N; j++) {
            sum += p[j][pp[j]];
        }
        if (sum > ans) {
            ans = sum;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())

dp = [[0 for _ in range(len(t)+1)] for __ in range(len(s)+1)]

for i_s in range(1, len(s)+1):
    for i_t in range(1, len(t)+1):
        if s[i_s-1] == t[i_t-1]:
            dp[i_s][i_t] = dp[i_s-1][i_t-1] + 1
        else:
            dp[i_s][i_t] = max(dp[i_s][i_t-1], dp[i_s-1][i_t])

ans = []

i_s = len(s)
i_t = len(t)

while i_s > 0 and i_t > 0:
    if dp[i_s][i_t] == dp[i_s][i_t-1]:
        i_t -= 1
    elif dp[i_s][i_t] == dp[i_s-1][i_t]:
        i_s -= 1
    else:
        ans.append(s[i_s-1])
        i_s -= 1
        i_t -= 1

print("".join(reversed(ans)))


Measured memory_bytes: 120028
import sys

n,m = map(int, input().split())
num = [0]*n
count = [0]*n

for _ in range(m):
    b,c = map(int, input().split())
    if num[b-1] != c and count[b-1] > 0:
        print(-1)
        sys.exit()
    count[b-1]+=1
    num[b-1] = c    

if n >= 2 and num[0] == 0:
    if count[0] == 0:
        num[0] = 1
    else:
        print(-1)
        sys.exit()

ans = ""
for i in range(n):
    ans+=str(num[i])
print(ans)

Measured memory_bytes: 9244
#include<cstdio>
int r[2][101];
int main(){
    int w,h,n,x,y,a;
    scanf("%d%d%d",&w,&h,&n);
    for(int i=1;i<=w;i++)r[0][i]=1;
    for(int i=1;i<=h;i++)r[1][i]=1;
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&x,&y,&a);
        if(a==1)for(int j=1;j<=x;j++)r[0][j]=0;
        else if(a==2)for(int j=w;j>x;j--)r[0][j]=0;
        else if(a==3)for(int j=1;j<=y;j++)r[1][j]=0;
        else if(a==4)for(int j=h;j>y;j--)r[1][j]=0;
    }
    int ans=0;
    for(int i=1;i<=w;i++){
        for(int j=1;j<=h;j++){
            if(r[0][i]*r[1][j]==1)ans++;
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int i,j,n,s=0;
    cin>>n;
    for(i=1;i<=n;i++){
    if((i%3!=0&&i%5!=0)){s+=i;}
   }
   cout<<s<<endl;
    
    
}

Measured memory_bytes: 3632
import sys

input = sys.stdin.readline
sys.setrecursionlimit(4100000)


def main():
    n = int(input()) % 10
    if n in (2,4,5,7,9):
        print("hon")
    elif n in (0,1,6,8):
        print("pon")
    else:
        print("bon")

if __name__ == '__main__':
    main()


Measured memory_bytes: 9152
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n, k;
const int N = 2e5 + 10;
ll nums[N];
int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i ++)
    {
        cin >> nums[i];
    }
    sort(nums, nums+n);
    ll res = 0;
    for(int i = 0; i < n - k; i ++)
    {
        res += nums[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#include <iomanip>
#include <tuple>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
using namespace std;
#define mod 1000000007
ll dp[100005][13] = {};

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	char a[100005];
	cin >> a;
	int n = strlen(a);
	dp[0][0] = 1;
	rep(i,0,n){
		int tmp;
		if(a[i] == '?') tmp = -1;
		else tmp = a[i] - '0';
		rep(j,0,10){
			if(tmp == -1 || tmp == j){
				rep(k,0,13){
					dp[i+1][(k*10+j)%13] += dp[i][k];
				}
			}
		}
		rep(j,0,13) dp[i+1][j] %= mod;
	}
	cout << dp[n][5] << endl;
}


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

#define MAX 1000000

int main(void) {

	int n, x;
	int price[30];
	unsigned char prime[MAX + 1];
	unsigned char available[MAX + 1];
	int p;
	int i, j;

	prime[0] = prime[1] = 0;
	for(i = 2; i <= MAX; i++) prime[i] = 1;

	for(i = 2; i * i <= MAX; i++) {
		if(prime[i] == 1) {
			for(j = i * 2; j <= MAX; j += i) {
				prime[j] = 0;
			}
		}
	}

	while( scanf("%d %d", &n, &x) && n && x) {
		for(i = 0; i < n; i++) {
			scanf("%d", &price[i]);
		}

		available[0] = 1;
		for(p = 1; p <= x; p++) {
			for(i = 0; i < n; i++) {
				if(p - price[i] >= 0 && available[p - price[i]] == 1) {
					available[p] = 1;
					break;
				}
			}
			if(i == n) available[p] = 0;
		}

		for(p = x; p >= 1; p--) {
			if(available[p] && prime[p]) break;
		}
		if(p >= 1) {
			printf("%d\n", p);
		} else {
			printf("NA\n");
		}
	}

	return 0;
}

Measured memory_bytes: 2564
#include <stdio.h>

int main()
{
    int tate,yoko;
    int t,y;

    scanf("%d%d%d%d",&tate,&yoko,&t,&y);

    int total = tate*yoko;

    total -= (tate*y + yoko*t);
    total += t*y;

    printf("%d",total);
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, s, n) for (i64 i = (s); i < (n); ++i)

constexpr i64 kModulo{1000000007};

int main() {
  cin.tie(nullptr);

  i64 n;
  cin >> n;
  vector<i64> xs(n);
  for (i64 i = 0; i < n; ++i) {
    cin >> xs[i];
  }
  i64 cum{0};
  for (i64 i = 0; i < n; ++i) {
    cum += xs[i];
  }
  cum %= kModulo;
  i64 ret{0};
  rep(i, 0, size(xs) - 1) {
    cum -= xs[i];
    if (cum < 0) {
      cum = kModulo + cum;
    }
    ret += (xs[i] * cum) % kModulo;
  }
  cout << (ret % kModulo) << endl;

  return 0;
}


Measured memory_bytes: 4348
let input = require('fs').readFileSync('/dev/stdin', 'utf8')
// let input = require('fs').readFileSync('./sample_b.txt', 'utf8')
.split(/\n| /)
// .map(item => parseInt(item))
.slice(0,-1)

const [_A, _B] = input
const A = _A.split("")
const B = _B.split("")

let max = 0
for( let i=0; i<A.length-B.length+1; i++){
    let _max = 0
    for(let j=0; j< B.length; j++){
        if(A[i+j] === B[j]){
            _max++
        }
    }
    if(max < _max)max = _max
}

console.log(B.length - max)

Measured memory_bytes: 32332
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))

x = int(input())

yokin = 100

for i in range(1, 100000000000):
    yokin += yokin // 100
    if (yokin >= x):
        print(i)
        break


Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
#define maxN 1000001
#define mod 1000000007
#define maxLL 1000000000000000000
#define PI 3.14159265358979323846264338327950L
typedef long long ll;

bool compared(int a,int b){
	return a < b;
}

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

int GCD(int a,int b){
	return b?GCD(b,a%b):a;
}

int main(){
	string s,t;
	cin>>s>>t;
	for(int i = 0;i<s.size();i++){
		if(s[i] != t[i]){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


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

bool dp[7400000];

int main(){
    int m, n;
    cin >> m >> n;
    while(m > 0){
        memset(dp, 0, sizeof(dp));
        int ans = m;
        for(int i=0; i<n; i++){
            while(dp[ans]) ans++;
            for(int j=ans; j<7400000; j += ans){
                dp[j] = 1;
            }
        }
        while(dp[ans]) ans++;
        cout << ans << endl;
        cin >> m >> n;
    }
}


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

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> c(h);
  
  for(int i  = 0; i < h; i ++) {
  	cin >> c.at(i);
  }
  
  for(int i = 0; i < h; i++) {
  	cout << c.at(i) << endl;
  	cout << c.at(i) << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		if (a == b){
			System.out.println(c);
		}else if (a == c){
			System.out.println(b);
		}else {
			System.out.println(a);
		}
    }
}

Measured memory_bytes: 20820
import os
import bisect
s = input()
t = input()

s_idx_map = {}
for i in range(len(s)):
    c = s[i]
    if c not in s_idx_map:
        s_idx_map[c] = [i]
    else:
        s_idx_map[c].append(i)

ans = 0
current_idx = -1

for c in t:
    if c not in s_idx_map:
        print(-1)
        os.sys.exit()
    induces = s_idx_map[c]
    pos = bisect.bisect_left(induces, current_idx)
    if pos < len(induces) and induces[pos] == current_idx:
        pos += 1
    if pos < len(induces):
        ans += induces[pos] - current_idx
        current_idx = induces[pos]
    else:
        ans += (len(s)-1) - current_idx
        ans += induces[0] + 1
        current_idx = induces[0]

print(ans)




Measured memory_bytes: 7540
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC069
{
    class Program
    {
        static void Main()
        {
            string s = Console.ReadLine();
            Console.WriteLine("{0}{1}{2}", s[0], s.Length - 2, s[s.Length - 1]);
        }
    }
}

Measured memory_bytes: 13268
macro_rules! input {
     (source = $s:expr, $($r:tt)*) => {
         let mut iter = $s.split_whitespace();
         input_inner!{iter, $($r)*}
     };
     ($($r:tt)*) => {
         let s = {
             use std::io::Read;
         let mut s = String::new();
         std::io::stdin().read_to_string(&mut s).unwrap();
         s
     };
     let mut iter = s.split_whitespace();
     input_inner!{iter, $($r)*}
     };
}
     
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
 
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};
//#[proconio::fastout]
use std::collections::VecDeque;
fn main() {
    input!{
        h: usize,
        _w: usize,
        image: [String; h],
    }
    for scan in image { println!("{}\n{}", scan, scan); }
}


Measured memory_bytes: 4352
import Control.Monad
import Data.Array

main = do
  li <- getLine
  let [n,m] = map read $ words li
  pss <- forM [1..m] (\_ -> do
    li <- getLine
    let [pi,si] = words li
    return (read pi, si == "AC")
    )
  let (s,p) = compute n m pss
  putStrLn $ unwords [show s, show p]

-- Left 続いているWAの数
-- Right 初めてのACまでのWAの数

compute :: Int -> Int -> [(Int,Bool)] -> (Int,Int)
compute n m pss = (length es, sum es)
  where
    ar = accumArray step (Left 0) (1,n) pss
    step (Left n) False = Left $ succ n
    step (Left n) True = Right n
    step r@(Right _) _ = r
    es = [ n | Right n <- elems ar ]


Measured memory_bytes: 84604
#include <bits/stdc++.h>
using namespace std;
long long n,x,a[102],b[102],inf,c[102][1000000],ok,s;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
     cin>>n>>x;
     for(int i=0;i<n;i++){
       	 cin>>a[i]>>b[i];
       	 ok=ok+b[i];
	   }
	   inf=0x7fffffffffffff;
	   
	   for(int i=0;i<n;i++){
	 	for(int j=0;j<ok+1;j++){
	 		c[i][j]=inf;
	 	}
	  }
	  c[0][0]=0;
	   c[0][b[0]]=a[0];
	    for(int i=1;i<n;i++){
	   	    for(int j=0;j<ok+1;j++){
	   	    	if(b[i]<=j){
	   	    		c[i][j]=min(a[i]+c[i-1][j-b[i]],c[i-1][j]);
	   	    	
			    }
				   else
				   c[i][j]=c[i-1][j];
			   }
	    }
	   
	    s=ok;
	    while(c[n-1][s]>x)
	         s--;
	    cout<<s;
return 0;
}

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

int main(){
	int n;
	cin >> n;
	int arr[n];
	for(int i=0;i<n;i++)
		cin >> arr[i];
	sort(arr,arr+n);
	cout << arr[n-1]-arr[0] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a); i<(b); ++i)
inline ll in() { ll x; cin >> x; return x; }

#define int ll
void solve() {
  int n = in();
  int go[10][10] = {};
  int ans = 0;
  FOR (i,1,n+1) {
    string s = to_string(i);
    go[s[0]-'0'][s.back()-'0']++;
  }

  FOR(i,1,10)
    FOR(j,1,10)
      ans += go[i][j] * go[j][i];

  cout << ans << endl;
}

#undef int
int main() {
	solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"("<<(x).FI<<", "<<(x).SE<<")"<<endl;
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

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

ll f(ll X, vector<ll>& A)
{
  ll ret = 0;
  REP(i, A.size()) ret += X^A[i];
  return ret;
}

int main()
{
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];

  ll dig = 0, tmp = K;
  while (tmp > 0) tmp /= 2, dig++;

  vector<bool> grone(dig);
  REP(b, dig) {
    ll one = 0, zero = 0;
    REP(i, N) {
      if ((A[i] >> b) & 1LL) one++;
      else zero++;
    }
    if (zero > one) { grone[b] = true; }
  }

  ll ans = f(K, A);
  cerr << bitset<32>(K) << ' ' << f(K, A) << endl;
  REP(i, dig) {
    ll X = 0;
    if (((K >> i) & 1LL) == 0) continue;
    REP(j, dig) {
      if (j < i) {
        if (grone[j]) X |= (1LL << j);
      } else if (j == i) {
        X |= 0;
      } else {
        X |= (1LL << j) & K;
      }
    }
    cerr << bitset<32>(X) << ' ' << f(X, A) << endl;
    ans = max(ans, f(X, A));
  }
  cout << ans << endl;

  return 0;
}

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

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/(b))
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const LL LL_INF = LL(999999999999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;
const int RUN_SOLVE = 1;

#ifndef LOCAL_H
const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    for(int do_solve_time = 0;do_solve_time < RUN_SOLVE;do_solve_time++){
        void solve();
        if(DO_BENCHMARK){
            clock_t clock_start = clock();
            solve();
            clock_t clock_end = clock();
            const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
            cout << "\n------------------------------------\n" << time << "[ms]\n";
        }
        else solve();
    }
}

/*------------------------------↓ここからコード↓----------------------------------*/
void solve(){
    int N, X, T;
    cin >> N >> X >> T;
    cout << UP(N,X)*T << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
  int H,W;
  cin >> H >> W;
  char S[H][W];
  REP(i,H)
    REP(j,W)
      cin >> S[i][j];

  REP(i,H)
    REP(j,W)
    {
      if (S[i][j]=='#' && S[i][j+1]=='#') {
        S[i][j]=S[i][j+1]='B';
      }
      if (S[i][j]=='#' && S[i+1][j]=='#') {
        S[i][j]=S[i+1][j]='B';
      }
      if (S[i][j]=='#' && S[i][j+1]=='B') {
        S[i][j]=S[i][j+1]='B';
      }
      if (S[i][j]=='#' && S[i+1][j]=='B') {
        S[i][j]=S[i+1][j]='B';
      }
      if (S[i][j]=='B' && S[i][j+1]=='#') {
        S[i][j]=S[i][j+1]='B';
      }
      if (S[i][j]=='B' && S[i+1][j]=='#') {
        S[i][j]=S[i+1][j]='B';
      }
    }

  bool flg=true;
  REP(i,H) {
    REP(j,W) {
      if (S[i][j]=='#')
        flg=false;
      //cout << S[i][j];
    }
    //cout << endl;
  }

  cout << (flg?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    abcde = [int(input()) for _ in range(5)]
    k= int(input())

    for i in range(4):
        for j in range(i+1, 5):
            if abcde[j] - abcde[i] > k:
                print(":(")
                exit()
    print("Yay!")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
using namespace std;
const int maxn = 3005;
int dp[maxn][maxn], lena, lenb;
char s1[maxn], s2[maxn];

int main() {
	//freopen("demo.in", "r", stdin);
	//freopen("demo.out", "w", stdout);
	
    cin >> s1 >> s2;
    lena = strlen(s1);
    lenb = strlen(s2);
    for (int i = 1; i <= lena; i++) {
        for (int j = 1; j <= lenb; j++) {
            if (s1[i-1] == s2[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    //cout << dp[lena][lenb] << "\n";
    int x = lena, y = lenb;
    string ans = "";
    while (x >= 1 && y >= 1) {
		if (dp[x][y] == dp[x-1][y])
			x--;
		else if (dp[x][y] == dp[x][y-1])
			y--;
		else {
			x--;
			y--;
			ans = s1[x] + ans;			
		}
	}
	cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 35456
n=int(input())
while n:
    n-=1
    r,t=map(int,input().split())
    (a,b,c,d)=(5*(t//30)+(r//100),5*(t//30)+(r//100+1),5*(t//30+1)+(r//100),5*(t//30+1)+(r//100+1))
    if r%100==t%30==0:print(a)
    elif t%30==0: print(a,b) 
    elif r%100==0:print(a,c)
    else:print(a,b,c,d)

Measured memory_bytes: 7676
// C - Factors of Factorial
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

map<int, int> prime_count;

int div_counter(int n, int d){
	for(; n%d==0; n/=d) prime_count[d]++;
	return n;
}

int main(){
	int N; cin>>N;
	for(int i=N; i>1; i--){
		int n = div_counter(i,2);
		for(int d=3; n!=1; d+=2) n = div_counter(n,d);
	}

	long long ans = 1;
	for(auto e:prime_count) ans = ans * (e.second+1) % MOD;
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, sum = 0;
  cin >> n >> m;
  rep(i, m) {
    int a;
    cin >> a;
    sum += a;
  }
  cout << max(n-sum, -1) << endl;
  return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b;
	cin>>a>>b;
	if(a==1&&b==1) cout<<"Draw"<<endl;
	else{	
		if(a==1||b==1){
				if(a==1){
					cout<<"Alice"<<endl;
				}
				else if(b==1){
					cout<<"Bob"<<endl;
				}
		
		}
	
		else{
			if(a<b){
				cout<<"Bob"<<endl;
			}
			else if(a>b){
				cout<<"Alice"<<endl;
			}
			else{
				cout<<"Draw"<<endl;
			}
		}
	}
	return 0;
}
	

Measured memory_bytes: 256
using AtCoderBeginnerContest154.Questions;
using AtCoderBeginnerContest154.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest154.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var st = inputStream.ReadStringArray();
            var ab = inputStream.ReadIntArray();
            var u = inputStream.ReadLine();

            if (st[0] == u)
            {
                yield return $"{ab[0] - 1} {ab[1]}";
            }
            else
            {
                yield return $"{ab[0]} {ab[1] - 1}";
            }
        }
    }
}


namespace AtCoderBeginnerContest154
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest154.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest154.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

int main() {
    long long int n,k,i,count=0;
    cin>>n>>k;
    long long int h[n];
    for(i=0;i<n;i++)
    {
        cin>>h[i];
        if(h[i]>=k)
        count++;
    }
    cout<<count;
 
     

  return 0;
    
}
    


Measured memory_bytes: 1024
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		Set<Integer> A = new HashSet<>();
		for (int i = 0; i < N; i++) {
			int a = in.nextInt();
			if (A.contains(a)) {
				A.remove(a);
			} else {
				A.add(a);
			}
		}
		System.out.println(A.size());
		in.close();
	}
}

Measured memory_bytes: 61728