akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  string s;
  cin >> s;
  s[5] = ' ';
  s[13] = ' ';
  print(s);

}


Measured memory_bytes: 256
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	int n;
	cin >> n;
	int ans = 1;
	int mac = 0;


	rep(i, 1,n+1) {
		int now = 0;
		int x = i;
		while (x % 2 == 0||x!=1) {
			x = x / 2;
			now++;
		}
		if (mac < now) {
			ans = i;
			mac = now;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  double a;cin >> a;
  int k;
  if((int)a%2==0)k=a/2;
  else k=(int)(a)/2+1;
  cout << fixed << setprecision(10) << k/a << endl;
  return 0;
}

Measured memory_bytes: 3744
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
  while(1){
    int n;
    string a[10001],b;
    priority_queue<string,vector<string>,greater<string> > c;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>a[i]>>b;
      c.push(b);
    }
    sort(a,a+n);
    int cnt=0;
    for(int i=0;i<n;i++){
      if(a[i]>=c.top()){
	c.pop();
      }else cnt++;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 3972
#include <iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll sum[200010];
int bin_s(int l,int r) {
	ll g=(sum[l]+sum[r])/2;
	int ok=l,ng=r;
	while(ok+1<ng){
		int mid=(ok+ng)/2;
		if (sum[mid]<=g)ok=mid;
		else ng=mid;
	}
	if(g-sum[ok]<sum[ng]-g)return ok;
	else return ng;
}

int main() {
	int N;cin>>N;
	for(int i=0;i<N;++i){
		ll A; cin>>A;
		sum[i+1]=sum[i]+A;
	}
	ll ans=1e15;
	for(int i=2;i+2<=N;++i){
		int form=bin_s(0,i),latt=bin_s(i,N);
		ll mn=min(sum[form],sum[i]-sum[form]),mx=max(sum[form],sum[i]-sum[form]);
		mn=min(mn,min(sum[latt]-sum[i],sum[N]-sum[latt]));
		mx=max(mx,max(sum[latt]-sum[i],sum[N]-sum[latt]));
		ans=min(ans,mx-mn);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5148
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int t[5];
	fori(5){cin>>t[i];}
	vector<int> a={0,1,2,3,4};
	int ans=INF;
	do{
		int time=0;
		fori(5){
			if(time%10!=0){
				time+=(10-(time%10));
			}
			time+=t[a[i]];
		}
		ans=min(ans,time);
	}while(next_permutation(a.begin(),a.end()));
	cout<<ans;
}

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

using namespace std;

using ll = long long;

int main(){
    ll n, flag = 0; cin >> n;
    for(ll i = 1; i <= 9; ++i){
        for(ll j = 1; j <= 9; ++j)if(i * j == n)flag = 1;
    }
    if(flag) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
 
  // 入力
  int a,b,cnt;
  scanf("%d %d",&a,&b);

  if(b<=1){
    printf("0\n");
    return 0;
  }
 
  cnt = (b-2)/(a-1);
  cnt+=1;
 
  printf("%d\n",cnt);
 
  return 0;
}

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


int main()
{


     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
   

    //insert();    
    int t,a,b;
    cin>>t>>a>>b;

    int flag=0;
    for(int i=a;i<=b;i++)
    {
    	if(i%t==0)
    	{
    		cout<<"OK"<<endl;
    		flag=1;
    		break;
    	}
    }

    if(!flag)
    	cout<<"NG"<<endl;
return 0;

}

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

typedef struct node{
    int key;
    struct node *prev, *next;
}Node;

  Node *nil;

void init(){ // ???????????????
    nil = (Node*)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key){  
    Node *x = (Node*)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* Search(int key){
    Node* x = nil->next;
    while(x != nil && x->key != key){
        x = x->next;
    }
    return x;
}

void deleteNode(Node *t){
    if(t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(Search(key));
}

void print(){
    Node* x = nil->next;
    int i = 0;
    while(1){
        if(x == nil) break;
        if(i++ > 0) printf(" ");
        printf("%d", x->key);
        x = x->next;
    }
    printf("\n");
}

int main(void){
    int n,key,i,size = 0;
    char com[20];
    scanf("%d",&n);
    init();
    for(i=0;i<n;i++){
        scanf("%s %d", com, &key);
        if(com[0] == 'i'){
            insert(key);
        }else if(com[0] == 'd'){
        	if(strlen(com)>6){
        		if(strlen(com)>10){
        		deleteFirst();
        		}else if(strlen(com)>9){
        		deleteLast();
        		}
        }else{
            deleteKey(key);
        }
        }
    }
    print();
    return 0;
}

Measured memory_bytes: 32964
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.datetime;

void main()
{
	while (1) {
		auto x = readln.chomp.split.map!(to!int);
		if (!x[0]) break;
		auto path = new int[][](x[0], 2);
		int sum;
		foreach (i; 0..x[0]) {
			path[i] = readln.chomp.split.map!(to!int).array;
			sum += path[i][0] * path[i][1];
		}
		path = path.sort!("a[1] > b[1]").array;
		int i;
		auto m = x[1];
		foreach (e; path) {
			if (m <= 0) break;
			auto t = min(m, e[0]);
			sum -= t * e[1];
			i++;
			m -= t;
		}
		sum.writeln;
	}
}

Measured memory_bytes: 2668
#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n,m;
	cin>>n>>m;
	int sum=2*m;
	if(sum>=n){
		cout<<0;
	}else{
		cout<<n-sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
/*
    A - Maximize the Formula
    https://atcoder.jp/contests/abc110/tasks/abc110_a
*/
#include <bits/stdc++.h>
using namespace std;

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

    vector<int> vi(3);
    for (int i = 0; i < 3; i++) {
        cin >> vi[i];
    }
    sort(vi.begin(), vi.end());

    cout << (vi[2] * 10 + vi[1] + vi[0]) << endl;
}

Measured memory_bytes: 256
# Author: cr4zjh0bp
# Created: Thu Mar 12 19:39:28 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()

print(N // 3)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a[5];
    int min=INT_MAX, mem, tmp, ans=0;
    
    rep(i, 5){
        scanf("%d", &a[i]);
        if (min>a[i]%10&&a[i]%10!=0) {
            min=a[i]%10;
            mem=i;
        }
    }
    
    rep(i, 5){
        if (i!=mem&&a[i]%10!=0) {
            tmp=10-a[i]%10;
            a[i]+=tmp;
        }
        ans+=a[i];
    }
    
    printf("%d", ans);
    
    return 0;
}


Measured memory_bytes: 1716
def read_input():
    n, k = map(int, input().split())
    alist = list(map(int, input().split()))
    return n, k, alist


def submit():
    n, k, alist = read_input()

    digits = [0] * n
    for a in alist:
        digits[a - 1] += 1

    digits.sort(reverse=True)
    truncate = sum(digits[k:])
    print(truncate)


if __name__ == '__main__':
    submit()

Measured memory_bytes: 76368
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.next();

    for(int i = 0; i < s.length(); i+=2)
      System.out.print(s.charAt(i));

    System.out.println("");
  }
}


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

#define int long long

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int a, b, n;
	cin >> a >> b >> n;
	if(b <= n) {
		cout << ((a*(b-1))/b);
	} else {
		cout << ((a*(n))/b) - a*(n/b);
	}
				
	return 0;
}
//b < n ans at i = b-1
//

Measured memory_bytes: 3608
N = int(input())
a = list(map(int,input().split()))
sort_a = sorted(a,reverse=True)
Alice = 0
Bob = 0
for i in range(N):
    if(i % 2 == 0):
        Alice += sort_a[i]
    else:
        Bob += sort_a[i]
print(Alice -Bob)

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

// g++ -std=c++11 -O2 -Wall *.cpp -o *
#define eps 1e-9
#define MAX 10000010
#define MOD 1000000007
#define INF 1e9+10
#define PI 3.14159265358979323846
#define Fi first
#define Se second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define maxof(a) *max_element(all(a))
#define minof(a) *min_element(all(a))
typedef long long ll;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// freopen("input.txt", "r", stdin);
	// freopen("output.out", "w", stdout);

	int L, R, d;
	cin >> L >> R >> d;
	int x = L / d;
	int y = R / d;
	cout << y-x+(L%d==0);


	cout << endl;
	return 0;
}


Measured memory_bytes: 3636
import sys

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    Num = [-1] * N
    for _ in range(M):
        s, c = map(int, input().split())
        if Num[s-1] == -1: 
            if N > 1 and s == 1 and c == 0:
                print(-1)
                break
            else: Num[s-1] = c
        else:
            if Num[s-1] != c:
                print(-1)
                break
    else:
        if N == 1 and Num[0] == -1: print(0)
        else: 
            for i in range(N):
                if Num[i] == -1:
                    if i == 0: Num[i] = 1
                    else: Num[i] = 0
            print("".join(map(str, Num)))

    return 0

if __name__ =="__main__":
    solve()


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
   long long int a,b;
   long long int A,B,temp;
   long long int gcd,lcm;
   
   while(scanf("%lld %lld",&a,&b)!=EOF){
       A=a;
       B=b;
       while(A%B!=0){
           temp=A%B;
           A=B;
           B=temp;
       }
       gcd=B;
       lcm=a*b/gcd;
       
       printf("%lld %lld\n",gcd,lcm);
   }
   return 0;
}



Measured memory_bytes: 2028
import sys
def input(): return sys.stdin.readline().rstrip()
class UnionFind():
    def __init__(self, n):
        self.n=n
        self.parents=[-1]*n # 親(uf.find()で経路圧縮して根)の番号。根の場合は-(そのグループの要素数)
    def find(self,x):
        #グループの根を返す
        if self.parents[x]<0:return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    def unite(self,x,y):
        #要素x,yのグループを併合
        x,y=self.find(x),self.find(y)
        if x==y:return
        if self.parents[x]>self.parents[y]:#要素数の大きい方をxに
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x #要素数が大きい方に併合
    def size(self,x):
        #xが属するグループの要素数
        return -self.parents[self.find(x)]
    def same(self,x,y):
        #xとyが同じグループ？
        return self.find(x)==self.find(y)
def main():
    n,m=map(int,input().split())
    AB=[tuple(map(int,input().split())) for i in range(m)]
    ANS=[0]*(m+1)
    ANS[0]=n*(n-1)//2
    uf=UnionFind(n)
    i=0
    for a,b in AB[::-1]:
        a-=1
        b-=1
        if uf.same(a,b):
            ANS[i+1]=ANS[i]
        else:
            na=uf.size(a)
            nb=uf.size(b)
            ANS[i+1]=ANS[i]-na*nb
            uf.unite(a,b)
        i+=1
    for i in range(m):
        print(ANS[-2-i])


if __name__=='__main__':
    main()

Measured memory_bytes: 23736
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */
vector<ll>ans;
ll N;

void dfs(ll x, int use) {
    if(x > N)return;
    if(use == 0b111)ans.pb(x);
    rep(i, 3) {
        dfs(x * 10 + 3 + 2*i, use | (4 / (i + 1)));
    }
}

int main() {
    cin >> N;
    dfs(0, 0);
    cout << ans.size() << endl;
}


Measured memory_bytes: 640
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        //
        //□■■■■■■■■■■■■
        //□□□□□□□□□□□□■
        //□■■■■■■■■■■■■
        //□□□□□□□□□□□□■
        //□■■■■■■■■■■■■
        //□□□□□□□□□□□□■
        //□■■■■■■■■■■■■
        //□□□□□□□□□□□□■
        //
        var hw = Console.ReadLine().Split().Select(int.Parse).ToList();
        var map = Enumerable.Repeat(0, hw[0]).Select(_ => Console.ReadLine().ToList()).ToList();

        Console.WriteLine(string.Join("\n", Enumerable.Range(0, hw[0]).Select(x => string.Join("", (x % 2 == 0 ? Enumerable.Repeat('#', 1).Concat(map[x].Skip(1)) : Enumerable.Repeat('#', hw[1] - 1).Concat(Enumerable.Repeat('.', 1)))))));
        Console.WriteLine();
        Console.WriteLine(string.Join("\n", Enumerable.Range(0, hw[0]).Select(x => string.Join("", (x % 2 == 1 ? map[x].Take(hw[1] - 1).Concat(Enumerable.Repeat('#', 1)) : Enumerable.Repeat('.', 1).Concat(Enumerable.Repeat('#', hw[1] - 1)))))));
    }
}


Measured memory_bytes: 21456
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
  int v;
  color[u]=GRAY;
  d[u]=++tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0) continue;
    if(color[v]==WHITE) dfs_visit(v);
  }
  color[u]=BLACK;
  f[u]=++tt;
}

void dfs()
{
  int u;
  for(u=0;u<n;u++) color[u]=WHITE;
  tt=0;

  for(u=0;u<n;u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main()
{
  int u,v,k,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  dfs();

  return 0;
}

Measured memory_bytes: 636
import numpy as np
from itertools import product
N,M,X = list(map(int, input().split()))
C = [0] * N
A = []

for i in range(N):
  wk = list(map(int, input().split()))
  C[i] = wk[0]
  A.append(wk[1:])

C = np.array(C)
A = np.array(A)

ans = -1
for pt in product([0,1], repeat = N):
  p = np.array(pt)  
  #print(C.dot(p))
  #print(p.dot(A))
  rikai = p.dot(A)
  if min(rikai) >= X:
    ans = C.dot(p) if ans == -1 else min(ans, C.dot(p))
  
print(ans)

Measured memory_bytes: 27084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) {
    }
    int root(int x) {
        return (data[x] < 0) ? x : data[x] = root(data[x]);
    }
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y) {
        return root(x) == root(y);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
int main() {
    int n, m;
    string s;
    cin >> n >> m >> s;
    reverse(all(s));
    vector<int> ans;
    int pos = 0;
    while (pos < n) {
        bool ok = 0;
        for (int i = m; i >= 1; i--) {
            if (s[pos + i] == '0') {
                ok = 1;
                pos += i;
                ans.push_back(i);
                break;
            }
        }
        if (!ok) {
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(all(ans));
    for (int x : ans) cout << x << endl;
}

Measured memory_bytes: 1144
#define _USE_MATH_DEFINES 
#include <cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#include<cctype>
#define rep(i,start,n) for(int i=start;i<n;i++)
#define And &&
#define Or ||
#define Lb cout<<endl
using namespace std;

int main(void) {
	char ch;
	int number[26] = {};
	while (cin >> ch) {
		ch = tolower(ch);
			number[ch - 'a']++;
	}
	rep(i, 0, 26) {
		cout << (char)('a' + i) << " : " << number[i] << endl;
	}
}

Measured memory_bytes: 1140
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	long long n, m, ans = 0, wa = 0;
	cin >> n >> m;
	vector<pair<long long, string>> a(m);
	vector<long long> count(n, 0);
	vector<bool> flag(n, false);
	for (long long i = 0; i < a.size(); i++)
		cin >> a[i].first >> a[i].second;

	for (long long i = 0; i < a.size(); i++)
		a[i].first--;

	for (long long i = 0; i < a.size(); i++)
	{
		if (a[i].second == "AC")
			flag[a[i].first] = true;
		else if(!flag[a[i].first])
			count[a[i].first]++;
	}

	for (long long i = 0; i < n; i++)
	{
		if (flag[i])
		{
			ans++;
			wa += count[i];
		}
	}

	cout << ans << " " << wa << endl;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    while (true)
    {
        c -= b;
        if (c <= 0)  {
            cout << "Yes";
            return 0;
        }
        a -= d;
        if (a <= 0)  {
            cout << "No";
            return 0;
        }
    }
    
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
using namespace std;
int main(){

    string str;
    cin>>str;
    if(str[0]!='A'){
        cout<<"WA"<<endl;
        return 0;
    }
    int numc=0;
    int soec;
    for(int i=2;i<str.size()-1;i++){
        if(str[i]=='C'){numc++;
            soec=i;
        }
    }
    if(numc!=1){
        cout<<"WA"<<endl;
        return 0;
    }
    for(int i=1;i<str.size();i++){
        if(i!=soec){
            
            if(isupper(str[i])){
                cout<<"WA"<<endl;
                return 0;
            }
            
        }
        
    }
    cout<<"AC"<<endl;
    
return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val sorted = A.sorted()
    var left = 0
    var right = N
    val x = 1L * N * (N + 1) / 4
    while (left + 1 < right) {
        val mid = (left + right) / 2
        val am = sorted[mid]
        val s = IntArray(N + 1)
        for (n in 0 until N) {
            s[n + 1] = s[n] + if (A[n] >= am) 1 else -1
        }
        val bit = BIT(2 * N + 1)
        var sum = 0L
        for (n in 0 until N + 1) {
            sum += bit.sum(s[n] + N)
            bit.add(s[n] + N, 1)
        }
        if (x <= sum) {
            left = mid
        } else {
            right = mid
        }
    }
    println(sorted[left])
}

class BIT(size: Int) {
    private val bit: LongArray
    init { bit = LongArray(size) }
    fun sum(n: Int): Long {
        var k = n
        var s = 0L
        while (k > 0) {
            s += bit[k]
            k -= k and -k
        }
        return s
    }
    fun add(n: Int, x: Long) {
        var k = n
        while (k < bit.size) {
            bit[k] += x
            k += k and -k
        }
    }
}

fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


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

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

    int a;
    cin >> a;
    int min = a;
    int max = a;
    while (--n) {
        cin >> a;
        if (a < min) min = a;
        if (max < a) max = a;
    }

    cout << max - min << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    if (str.compare("Sunny")==0)
        cout<<"Cloudy"<<endl;
    else if (str.compare("Cloudy")==0)
        cout<<"Rainy"<<endl;
    else if (str.compare("Rainy")==0)
        cout<<"Sunny"<<endl;
}

Measured memory_bytes: 256
import Data.Array.IO
import Control.Applicative
import Control.Monad
import Control.Monad.State
import Debug.Trace

type DisJointSet a = IOArray a (Head a)
type Head a = (a,Int)

main = do
  [n,q] <- map read.words<$>getLine
  qs <- replicateM q (map read.words<$>getLine)
  let querys = map toQuery qs
  t <- initSet 0 n
  runStateT (sequence_ querys) t

printResult x = if x then print 1 else print 0

initSet :: (Enum a, Ix a) => a -> a -> IO (DisJointSet a)
initSet n m = newListArray (n,m) $ zip [n..m] (repeat 0)

--------------------------------------------------------------------------------
toQuery :: [Int] -> StateT (DisJointSet Int) IO ()
toQuery [q,n,m] = if q == 0 then union n m
                             else (same n m >>= (\b -> liftIO $ printResult b))

makeSet :: Ix a => a -> StateT (DisJointSet a) IO ()
makeSet i = do
  arr <- get
  liftIO $ writeArray arr i (i,0)

findSet :: Ix a => a -> StateT (DisJointSet a) IO (Head a)
findSet x = do
  arr <- get
  h <- liftIO $ readArray arr x
  if fst h == x then return h
                else findSet (fst h)

union :: (Show a,Ix a) => a -> a -> StateT (DisJointSet a) IO ()
union x y = do
  arr <- get
  (hx,rx) <- findSet x
  (hy,ry) <- findSet y
  if rx > ry then liftIO $ writeArray arr hy (hx,rx)
              else if rx < ry then liftIO $ writeArray arr hx (hy,rx)
                               else liftIO $ do
                                 writeArray arr hx (hy,rx)
                                 writeArray arr hy (hy,ry+1)

same :: Ix a => a -> a -> StateT (DisJointSet a) IO Bool
same x y = do
  (headx,rx) <- findSet x
  (heady,ry) <- findSet y
  return $ headx == heady

Measured memory_bytes: 82984
# AOJ 0287: Jinkoki
# Python3 2018.6.26 bal4u

unit = ("", "Man", "Oku", "Cho", "Kei", "Gai", "Jo", "Jou", "Ko", "Kan", \
"Sei", "Sai", "Gok", "Ggs", "Asg", "Nyt", "Fks", "Mts")

while True:
	m, n = map(int, input().split())
	if m == 0: break
	s = str(m ** n)[::-1]
	ans = []
	for i in range(0, len(s), 4):
		t = str(int(s[i:i+4][::-1]))
		if t != "0": ans += [unit[i>>2], t]
	print(*ans[::-1], sep='')


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

#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define maxn 100010

using namespace std;

int n, A[maxn], F[maxn], k;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
    FOR(i, 1, n) cin >> A[i];
    F[1] = 0;
    FOR(i, 2, n) {
        F[i] = F[i-1] + abs(A[i] - A[i-1]);
        FOR(j, 2, k) {
            if (i-j == 0) break;
            F[i] = min(F[i], F[i-j] + abs(A[i] - A[i-j]));
        }
    }
    cout << F[n];
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  for(int i=0;i<N;i++){
    cin >> card[i];
  }
  sort(card.begin(),card.end());
  reverse(card.begin(),card.end());
  int A;
  A=N;
  for(int i=0;i<N;i++){
    if(card[i]==card[i+1]){
      A--;
    }
  }
  cout << A <<endl;
}


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

#define ll long long
#define pb push_back
#define eb emplace_back
#define REP(i, n) for(int i=0;i<(n);++i)
#define caset int ___T; cin >> ___T; while(___T--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define fast_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"

int main() {
	fast_IO;

	int t;
	cin >> t;

	if (t >= 30) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	cout << flush;
}


Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
	string s; 
	getline(cin,s);
	if (s[s.length()-1]=='s') s+="es";
	 else s+="s";
	cout<<s;
 } 

Measured memory_bytes: 3628
MOD = int(1e9 + 7)
N, a, b = map(int, input().split())

def fast_nCk(n, k, mod=MOD):
    upper = 1
    for i in range(n - k + 1, n + 1):
        upper = upper * i % mod
    below = 1
    for i in range(1, k + 1):
        below = below * i % mod
    
    ans = upper * pow(below, mod - 2, mod) % mod
    ans %= mod
    return ans

# all
total = pow(2, N, MOD) - 1

# remove a (a / b mod MOD) and 
ans1 = fast_nCk(N, a, MOD)
ans2 = fast_nCk(N, b, MOD)
ans = (total - ans1 - ans2) % MOD
print(ans)

Measured memory_bytes: 38640
#include <stdio.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 100000000;
typedef double D;
const D EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> PII;

struct  P {
	int x, y;
	P() {}
	P(int x_, int y_) : x(x_), y(y_) {}
};

P s;
int W, H, N;
char field[20][20];
int G[10][10];
int dp[1<<10][10];

int rec(int S, int v)
{
	if (dp[S][v]>=0) {
		return dp[S][v];
	}
	
	if (S==(1<<N)-1) {
		return dp[S][v]=0;
	}
	
	int res=INF;
	rep(u, N) {
		if (!(S>>u&1)) {
			res = min(res, rec(S|1<<u, u)+G[v][u]);
		}
	}
	return dp[S][v] = res;
}

int dis(P p1, P p2)
{
	queue<P> Q;
	int d[20][20];
	fill(d[0], d[0]+20*20, INF);
	Q.push(p1);
	d[p1.x][p1.y]=0;
	
	while (Q.size()) {
		P p = Q.front(); Q.pop();

		rep(i, 4) {
			P np = P(p.x+dx[i], p.y+dy[i]);
			if_range(np.x, np.y, W, H) {
				if (field[np.x][np.y]!='x' && d[np.x][np.y]==INF) {
					Q.push(np);
					d[np.x][np.y] = d[p.x][p.y]+1;
				}
			}
		}
	}
	
	return d[p2.x][p2.y];
}

int main()
{
	while (cin>>W>>H, W||H) {
		vector<P> stain;
		
		rep(y, H) {
			rep(x, W) {
				char c;
				cin>>c;
				if (c=='o') { s.x=x; s.y=y; }
				else if (c=='*') {stain.push_back(P(x, y));}
				field[x][y]=c;
			}
		}
		N = (int)stain.size();
		
		fill(G[0], G[0]+10*10, INF);
		for (int i=0; i<N; i++) {
			for (int j=0; j<N; j++) {
				if (i!=j) {
					int dd = dis(stain[i], stain[j]);
					G[i][j] = dd;
					G[j][i] = dd;
				} else {
					G[i][j] = 0;
				}
			}
		}
			
		int ans = INF;

		rep(i, N) {
			memset(dp, -1, sizeof(dp));
			int tmp=dis(s, stain[i]);
			ans = min(ans, tmp+rec(1<<i, i));
		}
		
		 cout << (ans<INF ? ans : -1) << endl;
	}
}

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

int c[5][5];
int a[5],b[5];

bool right()
{
    b[1] = c[1][1] - a[1];
    b[2] = c[2][2] - a[2];
    b[3] = c[3][3] - a[3];
    for(int i = 1; i <= 3; ++i)
    {
        for(int j = 1; j <= 3; ++j)
            if(c[i][j] != a[i]+b[j])
                return false;
    }
    return true;
}

int main()
{
    for(int i = 1; i <= 3; ++i)
        for(int j = 1; j <= 3; ++j)
            scanf("%d",&c[i][j]);
    for(a[1] = -100; a[1] <= 100; ++a[1])
    {
        for(a[2] = -100; a[2] <= 100; ++a[2])
        {
            for(a[3] = -100; a[3] <= 100; ++a[3])
            {
                if(right())
                {
                    puts("Yes");
                    return 0;
                }
            }
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<pair<string, int> > vec;
    vec.pb({"a", 0});
    int let = 0;
    for (int d = 1; d < n; d++) {
        vector<pair<string, int> > vec1;
        for (int i = 0; i < vec.size(); i++) {
            vec[i].ft.pb('a');
            for (int j = 0; j <= vec[i].sc + 1 && j < 26; j++) {
                vec[i].ft.back() = 'a' + j;
                vec1.pb({vec[i].ft, max(vec[i].sc, j)});
            }
        }
        vec.swap(vec1);
        let++;
    }
    for (pair<string, int> s : vec) {
        cout << s.ft << "\n";
    }
}


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    for(int i=a; i<=b; i++) {
        if(c % i == 0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;



int main()
{
    FAST
    string h;
    cin>>h;
    if(h[0]=='7' ||h[1]=='7' ||h[2]=='7' )
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 3652
def gle(a , b):
    ans = ""
    if a == b:
        ans = "EQUAL"
    elif a > b:
        ans = "GREATER"
    else:
        ans = "LESS"
    return ans

def main():
    a = int(input())
    b = int(input())
    print(gle(a , b))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
n = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
d = {}
for i in range(2, n+1):
  a = factorization(i)
  for i in a:
    if i[0] not in d.keys():
      d[i[0]] = i[1]
    else:
      d[i[0]] += i[1]
ans = 1
for value in d.values():
  ans *= value+1
print(ans%(10**9+7))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

const int inf = 1e9;

typedef pair<int, int> P;

struct E{
    E(int to, int cost): to(to), cost(cost){}

    int to, cost;
};

int n, m, l;
vector<E> g[10100];
int d[10100];

void add_edge(int p, int a, int q, int b, int e){
    g[p * n + a].push_back(E(q * n + b, e));
}

int dijkstra(){
    fill_n(d, (l + 1) * n, inf);

    priority_queue<P, vector<P>, greater<P>> q;
    d[l * n] = 0;
    q.push(P(0, l * n));
    while(!q.empty()){
        P v = q.top();
        q.pop();
        if(v.first > d[v.second]){
            continue;
        }
        for(E& e: g[v.second]){
            if(d[e.to] > v.first + e.cost){
                d[e.to] = v.first + e.cost;
                q.push(P(d[e.to], e.to));
            }
        }
    }

    int ans = inf;
    rep(i, l + 1){
        ans = min(d[i * n + n - 1], ans);
    }
    return ans;
}

int main(){
    while(1){
        cin >> n >> m >> l;
        
        if(n == 0){
            break;
        }

        rep(i, (l + 1) * n){
            g[i].clear();
        }

        rep(i, m){
            int a, b, d, e;
            cin >> a >> b >> d >> e;

            for(int j = l; j - d >= 0; --j){
                add_edge(j, a - 1, j - d, b - 1, 0);
                add_edge(j, b - 1, j - d, a - 1, 0);
            }
            rep(j, l + 1){
                add_edge(j, b - 1, j, a - 1, e);
                add_edge(j, a - 1, j, b - 1, e);
            }
        }

        cout << dijkstra() << endl;
    }
    return 0;
}

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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e14;
const int MOD = 1e9+7;

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()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n; cin >> n;
    vi a(n); REP(i, n) cin >> a[i];
    vi dp(n, INF);
    REP(i, n) chmin(*lower_bound(ALL(dp), a[i]), a[i]);
    cout << lower_bound(ALL(dp), INF) - dp.begin() << endl;
}


Measured memory_bytes: 4404
A, B, H, M = [int(x) for x in input().split()]

import math

# print((H * 60 + M) / 2)
# print(M * 6)
t = ((H * 60 + M) / 2 - M * 6)
if t == 90 or t == 270:
    print((A ** 2 + B ** 2) ** 0.5)
else:
    
    # if t > 180:
    #     t = 360 - t
    # print(f't={t}')
    theta = t * math.pi / 180
    # print(t * math.pi / 180)
    # print(math.cos(theta))
    # print(B  - A * math.cos(theta))
    # print(A * math.sin(theta))
    
    x = (B - A * math.cos(theta)) ** 2 + (A * math.sin(theta)) ** 2
    print(x ** 0.5)

Measured memory_bytes: 9492
print([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 8, 8, 11, 11, 11, 11, 14, 14, 32, 32, 35, 35, 35, 35, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 75, 75, 86, 86, 86, 86, 86, 86, 123, 123, 131, 131, 131, 131, 148, 148, 153, 153, 170, 170, 170, 170, 170, 170, 227, 227, 227, 227, 227, 227, 250, 250, 323, 323, 324, 324, 324, 324, 354, 354, 354, 354, 384, 384, 384, 384, 384, 391, 491, 491, 529, 529, 529, 529, 529, 529, 543][int(input())-1])

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

using namespace std;

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

    vector<int> num(n+1, -1);
    for (int i=0; i<m; i++) {
        int s, c;
        cin >> s >> c;
        if (s == 1 && c == 0 && n != 1) {
            cout << -1 << endl;
            return 0;
        }
        if (num[s] != -1 && num[s] != c) {
            cout << -1 << endl;
            return 0;
        }
        num[s] = c;
    }

    if (n == 1 && num[1] == -1) {
        cout << 0 << endl;
        return 0;
    }

    for (int i=1; i<=n; i++)
        if (num[i] != -1)
            cout << num[i];
        else if (i != 1)
            cout << 0;
        else
            cout << 1;
    cout << endl;
}


Measured memory_bytes: 888
import java.util.Scanner;
import java.util.Stack;

class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        String C = sc.next();
        System.out.println(A.charAt(0) + "" + B.charAt(0) + "" + C.charAt(0));
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    
    int maxi = 0;
    int sum = 0;
    for(int i = 0; i < N; i++) {
        int l;
        cin >> l;
        sum += l;
        maxi = max(maxi, l);
    }
    
    cout << (sum>2*maxi ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
from copy import deepcopy
from collections import deque


class Bug:
    __convert = {"r": 1, "g": 2, "b": 3}
    __weight = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]

    def __init__(self, state, time):
        self.state = list(state)
        self.time = time

    def color_change(self):
        box = []

        for item1, item2, index in zip(self.state[:-1], self.state[1:], range(len(self.state))):
            if item1 != item2:

                if item1 == "r" and item2 == "g" or item1 == "g" and item2 == "r":
                    color = "b"
                elif item1 == "r" and item2 == "b" or item1 == "b" and item2 == "r":
                    color = "g"
                else:
                    color = "r"

                copy_state = deepcopy(self.state)

                copy_state[index] = color
                copy_state[index + 1] = color

                box.append(copy_state)

        return box

    def is_same_color(self):
        first = self.state[0]
        return all([item == first for item in self.state])

    def __hash__(self):
        tmp = [self.__convert[item] * w for item, w in zip(self.state, self.__weight)]
        return sum(tmp)

    def __eq__(self, other):
        return all([item1 == item2 for item1, item2 in zip(self.state, other.state)])


while True:

    input_data = input()

    if input_data[0] == "0":
        break

    state_queue = deque()
    pattern = set()

    first = Bug(input_data, 0)

    if first.is_same_color():
        answer = 0
    else:
        answer = "NA"
        state_queue.appendleft(first)
        pattern.add(first)

    while len(state_queue) != 0:

        original = state_queue.pop()
        boxes = original.color_change()

        for state in boxes:

            item = Bug(state, original.time + 1)

            if item.is_same_color():
                answer = item.time

                state_queue.clear()
                break
            else:
                if item not in pattern:
                    pattern.add(item)
                    state_queue.appendleft(item)

    print(answer)



Measured memory_bytes: 11068
#include <iostream>
#include <array>

using namespace std;

void sortnumber( char * number )
{
	char tmp;
	unsigned int tmp_num, sum = 0;
	for ( int i = 1 ; i < 8 ; i++ )
	{
		for ( int j = 0 ; j < i ; j++ )
		{
			if ( number[i] > number[j] )
			{
				tmp = number[i];
				number[i] = number[j];
				number[j] = tmp;
			}
				
		}
	}
}

int minNum( char * number )
{
	unsigned int tmp_num = 0, sum = 0;
	for ( int i = 0 ; i < 8 ; i++ )
	{
		tmp_num = number[i] - 48;
		for ( int j = 0 ; j < i ; j++ )
		{
			tmp_num = tmp_num * 10;
		}
		sum = tmp_num + sum;
	}
	return sum;
}

int maxNum( char * number )
{
	unsigned int tmp_num = 0, sum = 0;
	for ( int i = 0 ; i < 8 ; i++ )
	{
		tmp_num = number[i] - 48;
		for ( int j = 7 ; j > i ; j-- )
		{
			tmp_num = tmp_num * 10;
		}
		sum = tmp_num + sum;
	}
	return sum;
}

int main()
{
	char number[9];
	unsigned int num, min, max;

	cin >> num;
	while ( num > 0 )
	{
		cin >> number;
		sortnumber( number );
		max = maxNum( number );
		min = minNum( number );
		printf( "%d\n", max-min );
		num--;
	}
	return 0;
}



Measured memory_bytes: 3068
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < 6; ++i) {
    ans += (s[i] == '1');
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
//int ar[100001];
bool xy(int i, int j, int x, int y) {
	if((x>=i && x<=j) && (y>=i && y<=j))
		return true;
	return false;
}
bool isx(int i, int j, int x, int y) {
	if((x>i && x<j))
		return true;
	return false;
}
bool isy(int i, int j, int x, int y) {
	if((y>i && y<j))
		return true;
	return false;
}
int main() {
	io;
	int n, x, y;
	cin>>n>>x>>y;
	vector<int> ans(n+1, 0);
	//vector<vector<int> > dist(n+1,  vector<int>(n+1, -1));
	
	if(y<x) {
		int temp = x;
		x = y;
		y = temp;
	}
	//dp[x][y] = 1;
	for(int i = 1; i<n+1; i++) 
		for(int j = 1; j<n+1; j++) {
			if(i<j) {
				int a = j-i;
				int mini = abs(x-i) + 1 + abs(y-j);
				a = min(a,mini);
				/*
				if(xy(i, j, x, y)) {
					cout<<"i j xy y "<<i<<" "<<j<<" "<<x<<" "<<y<<endl;
					a = min(x-i+1+j-y, a);
				}
				else if(isx(i, j, x, y)) {
					cout<<"i j xonli y "<<i<<" "<<j<<" "<<x<<" "<<y<<endl;
					a = min(x-i+1+y-j, a);
				}
				else if(isy(i, j, x, y)) {
					cout<<"i j x yonli "<<i<<" "<<j<<" "<<x<<" "<<y<<endl;
					a = min(i-x+1+j-y, a);
				}*/
				ans[a]++;
				//cout<<"i j a "<<i<<" "<<j <<" "<<a<<endl;
				
			}
		}
	for(int i = 1; i<n; i++)
		cout<<ans[i]<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>

using namespace std;

struct Node{
	int key;
	Node *p,*l,*r;
}; 

Node *root,*NIL;

void insert(int k){
	Node *x = root;
	Node *y = NIL;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->l = NIL;
	z->r = NIL;
	
	while(x!=NIL){
		y=x;
		if(z->key<x->key){
			x = x->l;
		}else{
			x= x->r;
		}
	}
		
		z->p = y;
		if(y==NIL){
			root = z;
		}else {
			if(z->key<y->key){
				y->l=z;
			}else{
				y->r = z;
			}
		}
	}
		
	void inorder(Node *u){
		if(u==NIL) return;
		inorder(u->l);
		printf(" %d",u->key);
		inorder(u->r);
	}
	
	
	void preorder(Node *u){
		if(u==NIL) return;
		printf(" %d",u->key);
		preorder(u->l);
		preorder(u->r);
	}
	
	
	int main(){
		int n,i,x;
		string com;
		
		scanf("%d",&n);
		
		for(int i=0;i<n;i++){
			cin>>com;
			if(com=="insert"){
				scanf("%d", &x);
				insert(x);
			}
			else if(com=="print"){
				inorder(root);
				printf("\n");
				preorder(root);
				printf("\n");
			}
		}
		
		
		return 0;
}

Measured memory_bytes: 26632
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 100) {
			List<Integer> list = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				int ai = scan.nextInt();
				if (ai >= 0 && ai < 1000) {
					list.add(ai);
				}
			}
			Collections.reverse(list);
			for (int i = 0; i < list.size(); i++) {
				if (i == (list.size() - 1)) {
					System.out.println(list.get(i));
				} else {
					System.out.print(list.get(i) + " ");
				}
			}
		}
	}
}

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

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

    map<string,int> m;

    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        m[S] = 0;
    }

    cout << m.size() << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<vector<int>> map(2,vector<int>(n));
  
  for(int i=0; i<2;i++){
    for(int j=0; j<n; j++){
      cin >> map[i][j];
    }
  }
  
  int max=0;
  int tmp=0;
  
  for(int i=0; i<n; i++){
    tmp=0;
    for(int j=0; j<=i; j++){
      tmp += map[0][j];
    }
    for(int j=i; j<n; j++){
      tmp += map[1][j];
    }
    if(max < tmp) max=tmp;
  }
  
  cout << max << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define gc getchar
#define rint register int
#define rep(i,u,z) for(rint i=u;i<=z;++i)
#define reb(i,u,z) for(rint i=u;i>=z;--i)
#define inf 0x7fffffff

using namespace std;
typedef long long ll;

inline int readint(){
	int rt=0,sign=1;
	char ch=gc();
	while(ch<'0'||ch>'9'){
		if(ch=='-')sign=-1;
	    ch=gc();
	}
	while(ch>='0'&&ch<='9'){
		rt=(rt<<3)+(rt<<1)+(ch&15);
		ch=gc();
	}
	return rt*sign;
}
int main(){
	int n,A,B,a,b,cnt=0;
	n=readint(),A=readint(),B=readint();
	rep(i,1,n){
		a=readint(),b=readint();
		if(a>=A&&b>=B)++cnt;
	}
	printf("%d",cnt);
	return 0;
}

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

using namespace std;

int main()
{
  	string s,t;
  	cin>>s>>t;
  	int c=0;
  	for(int i=0; i<s.length(); i++)
    {
      	if(s[i]!=t[i])
          c++;
    }
  	cout<<c<<endl;
return 0;
}

Measured memory_bytes: 3840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");

		int n = Integer.parseInt(tmpArray[0]);
		int a = Integer.parseInt(tmpArray[1]);
		int b = Integer.parseInt(tmpArray[2]);

		if(Math.abs(a - b) % 2 != 0){
			System.out.println("Borys");
		}
		else {
//			System.out.println(Math.abs((a-b)%2));
			System.out.println("Alice");
		}


	}

}


Measured memory_bytes: 21332