akhauriyash/Code-Regression huggingface dataset:
// <easy.cpp> - Mon Mar 27 20:17:23 2017
// This file is created by XuYike's black technology automatically.
// Copyright (C) 2015 ChangJun High School, Inc.
// I don't know what this program is.

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long lol;
#define next NEXT
template<typename T>
inline void gg(T &res){
    res=0;T fh=1;char ch=getchar();
    while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
    if(ch=='-')fh=-1,ch=getchar();
    while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
    res*=fh;
}
inline int gi(){int x;gg(x);return x;}
inline lol gl(){lol x;gg(x);return x;}
const int MAXN=400010;
const int INF=1e9;
const int MOD=924844033;
int bt,b[MAXN],next[MAXN],to[MAXN];
inline void add(int x,int y){
    next[++bt]=b[x];b[x]=bt;to[bt]=y;
    next[++bt]=b[y];b[y]=bt;to[bt]=x;
}
int n,size[MAXN],A[MAXN<<1],B[MAXN<<1],L,R[MAXN<<1];
void dfs(int x,int f){
    A[n]++;size[x]=1;
    for(int i=b[x];i;i=next[i]){
        if(to[i]==f)continue;
        dfs(to[i],x);
        size[x]+=size[to[i]];
        if(--A[size[to[i]]]<0)A[size[to[i]]]+=MOD;
    }
    if(--A[n-size[x]]<0)A[n-size[x]]+=MOD;
}
int qpow(int x,int y){
    int res=1;
    while(y){
        if(y&1)res=1ll*res*x%MOD;
        x=1ll*x*x%MOD;
        y>>=1;
    }
    return res;
}
void ntt(int *a,int f){
    for(int i=0;i<n;i++)if(i<R[i])swap(a[i],a[R[i]]);
    for(int i=1;i<n;i<<=1){
        int gn=qpow(5,(MOD-1)/(i<<1));
        for(int j=0;j<n;j+=i<<1){
            int g=1;
            for(int k=0;k<i;k++,g=1ll*g*gn%MOD){
                int x=a[j+k],y=1ll*g*a[j+k+i]%MOD;
                a[j+k]=(x+y)%MOD;
                a[j+k+i]=(x-y+MOD)%MOD;
            }
        }
    }
    if(f==-1){
        reverse(a+1,a+n);
        int ny=qpow(n,MOD-2);
        for(int i=0;i<n;i++)a[i]=1ll*a[i]*ny%MOD;
    }
}
int nj[MAXN];
int main(){
    n=gi();
    for(int i=1;i<n;i++)add(gi(),gi());
    dfs(1,0);
    int jc=1;
    for(int i=1;i<=n;i++)A[i]=1ll*A[i]*(jc=1ll*jc*i%MOD)%MOD;
    nj[n]=qpow(jc,MOD-2);for(int i=n;i;i--)nj[i-1]=1ll*nj[i]*i%MOD;
    for(int i=1;i<=n;i++)B[i]=nj[n-i];
    int m=n;
    for(n=1;n<=m<<1;n<<=1)L++;
    for(int i=0;i<n;i++)R[i]=R[i>>1]>>1|((i&1)<<(L-1));
    ntt(A,1);ntt(B,1);
    for(int i=0;i<n;i++)A[i]=1ll*A[i]*B[i]%MOD;
    ntt(A,-1);
    for(int i=1;i<=m;i++)printf("%d\n",1ll*A[m+i]*nj[i]%MOD);
    return 0;
}

Measured memory_bytes: 25728
#include <bits/stdc++.h>
using namespace std;
#define MIN INT_MIN
#define MAX INT_MAX
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define E "\n"
#define rep(i,j,k,inc) for(int i=j;i<k;i+=inc)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int>pii;
typedef pair<ll,ll> pll;
const ll mod=2019;

using namespace std;
void solve();
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0; 
}

void solve(){
	string s;
	cin>>s;
	int n=s.size();
	int suf=0;
	int pot=1;
	vector<int>cntsuf(mod);
	cntsuf[suf]++;
	ll ans=0;
	for(int i=n-1;i>=0;--i){
		int dig=s[i]-'0';
		suf=(suf+dig*pot)%mod;
		pot=(pot*10)%mod;
		ans+=cntsuf[suf];
		cntsuf[suf]++;
	}
	cout<<ans<<E;
}

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


int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1; // cin >> t;
    for (; t; t--) {
        long long d, t, s; cin >> d >> t >> s;
        if (t * s >= d) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
/*
** Author: wkwkwill (Willy I. K.)
** 2020/09/06
*/
using namespace std;
using ll = long long int;

ll BIG = 1e18 + 1;
ll MOD = 998244353;

void solve();

ll fastpow(ll x, ll y, ll n = BIG) 
{
    x %= n;
    ll ans = 1;
    while (y > 0) 
    {
        if (y & 1) ans = (ans * x) % n;
        x = (x * x) % n;
        y >>= 1;
    }
    return ans;
}

bool sortPairSecond(pair<ll, ll> &a, pair<ll, ll> &b)
{
    return a.second < b.second;
}

bool sortPairFirst(pair<int, int> &a, pair<int, int> &b)
{
    if (a.first == b.first) return a.second < b.second;
    return a.first < b.first;
}

bool sortPairFirstDec(pair<int, int> &a, pair<int, int> &b)
{
    if (a.first == b.first) return a.second < b.second;
    return a.first > b.first;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
	return 0;
}
  
ll fact(ll n) 
{ 
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = (res * i) % MOD; 
    return res; 
} 
  
ll Combin(ll n, ll r) 
{ 
    return fact(n) / ((fact(r) * fact(n - r)) % MOD); 
} 

void solve()
{
    ll a[2], b[2];
    cin >> a[0] >> a[1] >> b[0] >> b[1];
    ll maks = INT64_MIN;
    for (int i = 0; i < 2; ++i)
    {
        ll count = 1;
        for (int j = 0; j < 2; ++j)
        {
            count = (ll)a[i] * (ll)b[j];
            
            maks = max(maks, count);
        }
    }
    cout << maks << '\n';
}

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

int main(){
    int n;
    int count;
    cin >> n;
    while(n){
        count = 0;
        for(int x=1;x<n;++x){
            for(int y=x;y<n;++y){
                if((y-x+1)*(x+y)/2 == n){
                    ++count;
                }
            }
        }
        cout << count << endl;
        cin >> n;
    }
}

Measured memory_bytes: 1164
import java.util.*;
    public class Main{
        public static void main(String[] args){
            int a, b;
        	Scanner scan = new Scanner(System.in);
            a = scan.nextInt();
            b = scan.nextInt();
            System.out.printf("%d %d %.10f\n", a / b, a % b, (double)a / (double)b);
        }
    }


Measured memory_bytes: 26344
# -*- coding: utf-8 -*-

import sys
import itertools
import math

H,W,K=[int(x) for x in input().split()]

AtoB=[[0]*W for i in range(W)]

for bs in itertools.product(*([[True,False]]*(W-1))):
    if any(bs[i] and bs[i+1] for i in range(len(bs)-1)):
        continue
    for j in range(W):
        if j-1>=0 and bs[j-1]:
            AtoB[j][j-1]+=1
        elif j<W-1 and bs[j]:
            AtoB[j][j+1]+=1
        else:
            AtoB[j][j]+=1

c=[0]*W
c[0]=1
for k in range(H):
    newc=[0]*W
    for j in range(W):
        newc[j] = c[j] * AtoB[j][j]
        if j-1>=0:
            newc[j]+=c[j-1]*AtoB[j-1][j]
        if j<W-1:
            newc[j]+=c[j+1]*AtoB[j+1][j]
    c=newc

print(c[K-1] % 1000000007)


Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main()
{	
	int i;
	char s[23],a=' ';
	gets(s);
	s[5]=a;
	s[13]=a;
	for(i=0;i<19;i++)
		printf("%c",s[i]);
	if(i==19)
		printf("\n");
	return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
typedef pair<int, int>p;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
vector<long long> divisor(long long n) {
	vector< long long> ret;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}
long long mod = 1e9 + 7;
struct LazySegmentTree {
private:
	int n;
	vector<int> node, lazy;
	vector<bool> lazyFlag;

public:
	LazySegmentTree(vector<int> v) {
		int sz = (int)v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1, INT_MAX);
		lazyFlag.resize(2 * n - 1, false);

		for (int i = 0; i<sz; i++) node[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
	}

	void lazyEvaluate(int k, int l, int r) {
		if (lazyFlag[k]) {
			node[k] = lazy[k];
			if (r - l > 1) {
				lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
				lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
			}
			lazyFlag[k] = false;
		}
	}

	void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			lazy[k] = x;
			lazyFlag[k] = true;
			lazyEvaluate(k, l, r);
		}
		else {
			update(a, b, x, 2 * k + 1, l, (l + r) / 2);
			update(a, b, x, 2 * k + 2, (l + r) / 2, r);
			node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		}
	}

	int find(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return INT_MAX;
		if (a <= l && r <= b) return node[k];
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int p, q, r;
	cin >> p >> q >> r;
	cout << min(p + q, min(q + r, p + r));
}

Measured memory_bytes: 256
n = int(input())
a = list(map(lambda x: int(x),input().split()))

count = 0
ans = ""

max_num = max(a)
max_idx = a.index(max_num)
min_num = min(a)
min_idx = a.index(min_num)

if abs(max_num) >= abs(min_num):
    for i in range(len(a)):
        a[i] += max_num
        ans += "{} {}\n".format(max_idx+1, i+1)
        count += 1
    for i in range(len(a)-1):
        a[i+1] += a[i]
        ans += "{} {}\n".format(i+1, i+1+1)
        count += 1
else:
    for i in range(len(a)):
        a[i] += min_num
        ans += "{} {}\n".format(min_idx+1, i+1)
        count += 1
    for i in range(len(a)-1):
        a[len(a)-(i+2)] += a[len(a)-(i+1)]
        ans += "{} {}\n".format(len(a)-(i+1)+1, len(a)-(i+2)+1)
        count += 1
print(count)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define f first 
#define s secod
int main() {
    int n;
    cin>>n;
    string s[n];
    int d[n];
    string x;
    for(int i=0;i<n;i++){
        cin>>s[i]>>d[i];
    }
    cin>>x;
    int res=0;
    int ind=0;
    for(int i=0;i<n;i++){
        if(x==s[i]){ ind=i+1;break;}
    }
    for(int i=ind;i<n;i++){
        res+=d[i];
    }
    cout<<res;
    return 0;
    
}

Measured memory_bytes: 256
object Main extends App {
  val n =  scala.io.StdIn.readInt()
  if (n < 100) {
    println(0)
  } else {
    val simoNiketa = n % 100
    val divideBy5 = simoNiketa / 5
    var saiteiKosuu = 0
    if (simoNiketa % 5 == 0) {
      saiteiKosuu = divideBy5
    } else {
      saiteiKosuu = divideBy5 + 1
    }
    if (saiteiKosuu * 100 > n) {
      println(0)
    } else {
      println(1)
    }
  }
}

Measured memory_bytes: 25536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int N = 1e5 + 5;
const ll OO = 1e16;
const long double EPS = 1e-6;


vector<char>ans;
string a,b;
int dp[3001][3001];
int solve(int i,int j){

    if(i == a.size() || j == b.size())
            return 0;
    int &ret = dp[i][j];
    if(~ret)
            return ret;
    if(a[i] == b[j])
            ret = 1 + solve(i + 1,j + 1);
    else{
            ret = max(solve(i + 1,j),solve(i,j + 1));
    }
    return ret;

}
void build(int i,int j)
{
    if(i == a.size() || j == b.size())
            return ;
    int & ret = dp[i][j];
    if(a[i] == b[j]){
            ans.push_back(a[i]);
            build(i + 1,j + 1);
            return ;
    }else{
            if(solve(i + 1,j) == ret){
                    build(i + 1,j);
                    return ;
            }
            if(solve(i, j + 1) == ret)
            {
                build(i,j + 1);
                return ;
            }
    }
}
int main()
{
    ios_base::sync_with_stdio();cin.tie(0),cout.tie(0);
    cin >> a >> b;
    memset(dp,-1,sizeof dp);
    solve(0,0);
    build(0,0);
    for(auto i : ans)
            cout << i;
    return 0;
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll k;
    cin >> k;
    ll t = 7 % k;
    for (ll i = 0; i < 1e6; i++) {
        if (t == 0) {
            cout << i+1 << endl;
            return 0;
        }
        else {
            t *= 10;
            t += 7;
            t %= k;
        }
    }
    cout << "-1" << endl;
}

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

int n;
long mod;
vector<int> G[100000];
long dp[100000];
long prerec(int from, int prev) {
  long ret = 1;
  for (int to : G[from]) {
    if (to == prev) continue;
    ret = ret * (1 + prerec(to, from)) % mod;
  }
  dp[from] = ret;
  return ret;
}

long ans[100000];
void rec(int from, int prev, long inher) {
  int m = G[from].size();
  vector<long> l(m + 1);
  vector<long> r(m + 1);
  l[0] = 1;
  r[m] = 1;
  for (int k = 0; k < m; ++k) {
    int to = G[from][k];
    long elem = 1 + (to == prev ? inher : dp[to]);
    l[k + 1] = elem;
    r[k] = elem;
  }
  
  for (int k = 0; k < m; ++k) l[k + 1] = l[k] * l[k + 1] % mod;
  for (int k = m; k > 0; --k) r[k - 1] = r[k] * r[k - 1] % mod;
  
  for (int k = 0; k < m; ++k) {
    int to = G[from][k];
    if (to == prev) continue;
    long nxt = l[k] * r[k + 1] % mod;
    rec(to, from, nxt);
  }
  ans[from] = l[m];
}

int main() {
  cin >> n >> mod;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  prerec(0, -1);
  rec(0, -1, 0);
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    string S;
    cin >> S;
    bool n=false,w=false,s=false,e=false;
    for(char ch:S){
        if(ch=='N') n=true;
        if(ch=='W') w=true;
        if(ch=='S') s=true;
        if(ch=='E') e=true;
    }
    Yes(!((n^s)||(w^e)));
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 256
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n: usize = read();
    let x = 800 * n;
    let y = (n / 15) * 200;
    println!("{}", x-y);
}


Measured memory_bytes: 4352
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


class UnionFind:
    def __init__(self, n):
        self.rank = [-1 for _ in range(n)]  # 根の深さ

    # xの属する木の根を求める
    def find(self, x):
        if self.rank[x] < 0:
            return x
        else:
            self.rank[x] = self.find(self.rank[x])
            return self.rank[x]

    # xとyの属する集合のマージ
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] <= self.rank[y]:
            self.rank[x] += self.rank[y]
            self.rank[y] = x
        else:
            self.rank[y] += self.rank[x]
            self.rank[x] = y

    # xとyが同じ集合に属するかを判定
    def size(self, x):
        return -self.rank[self.find(x)]


N, M = MI()

if M == 0:
    print(1)
    exit()

uf = UnionFind(N)
for _ in range(M):
    a, b = MI()
    a -= 1
    b -= 1
    uf.unite(a, b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))

print(ans)


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


int main(){
  int a,b;
  cin >> a >> b;
  int ans=-1;
  for(int i=1;i<=1000;i++){
    int ax=i*0.08;
    int bx=i*0.10;
    if(ax==a && bx==b){
      ans=i;
      i=1001;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int a;
    for(int i=1;i<=5;i++){
        cin>>a;
        if(a==0){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
	if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3092
/** Author: Nicklaus **/
 #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;

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

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define ll long long
#define llv vector<long long>
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;i++)

using namespace std;

int main(void){
    ll a;
    cin >> a;
    cout << a + a * a + a * a * a;
}

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

int main() {
  int a, b, c, d, sub;
  cin >> a >> b >> c >> d;
  sub = (a + b) - (c + d);
  if(sub == 0) cout << "Balanced" << endl;
  else if(sub > 0) cout << "Left" << endl;
  else cout << "Right" << endl;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<string.h>

int main(void){
  int len=0, i=0;
  int j,k;
  int max=0,cnt;
  int a_len;
  char b[35];
  char array[1000][35];
  char c[35];
 
  while(scanf("%s",array[i])!=EOF){
    //    printf("%s\n",array[i]);

    a_len=strlen(array[i]);
    if(len < a_len){
      len=strlen(array[i]);
      //      printf("%d\n",len);
      strcpy(b,array[i]);
    }
    
    i++;
  }

  for(j=0;j<i;j++){
    cnt=0;
    for(k=0;k<i;k++){
      if(strcmp(array[j],array[k])==0){
	cnt++;
      }
    }
    //    printf("%d\n",cnt);
    if(max<cnt){
      max=cnt;
      strcpy(c,array[j]);
    }
  }
  printf("%s %s\n",c,b);
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(int argc, char *argv[])
{
    int n;
    char t[300], h[300];
    int x, y;

    scanf("%d", &n);
    x = 0;
    y = 0;
    for (int i = 0; i < n; i++) {
        scanf("%s%s", &t, &h);
        int r = strcmp(t, h);
        if (r == 0) {
            x++;
            y++;
        } else if (r < 0) {
            y += 3;
        } else {
            x += 3;
        }
        
    }
    printf("%d %d\n", x, y);

    return 0;
}



Measured memory_bytes: 2044
n, m, l = map(int, raw_input().split())
A = [map(int, raw_input().split()) for i in xrange(n)]
B = [map(int, raw_input().split()) for i in xrange(m)]
C = [[0] * l for i in xrange(n)]
 
for i in xrange(n):
    for j in xrange(l):
        C[i][j] = sum(A[i][k] * B[k][j] for k in xrange(m))
for c in C:
    print " ".join(map(str, c))


Measured memory_bytes: 5356
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  vector<vector<int>> ans(H,vector<int>(W));
  rep(y,H){
    rep(x,W){
      if(x<A) ans[y][x]=1;
      else ans[y][x]=0;
    }
  }
  rep(y,B){
    rep(x,W){
      ans[y][x] = !ans[y][x];
    }
  }
  rep(y,H){
    rep(x,W){
      cout << ans[y][x];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 5120
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

BC=[list(map(int,input().split())) for _ in range(M)]
BC.sort(reverse=True,key=lambda x:x[1])

D=[]
for i in range(M):
  for j in range(BC[i][0]):
    D.append(BC[i][1])
    if len(D)==N:
      break
  if len(D)==N:
    break

for i in range(len(D)):
  if D[i]>A[i]:
    A[i]=D[i]
  else:
    break
print(sum(A))

Measured memory_bytes: 32964
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 200005;

struct edge
{
    int from,to;
    ll cost;
    bool operator< (const edge& another) const {
        return cost > another.cost;
    }
};

struct eda
{
    int to;
    ll cost;
};

vector<eda> G[MAX_N];
int id;
int nw[MAX_N];

class UF {
private:
    int sz; vector<int> par,nrank,size;
public:
    UF(){}
    UF(int node_size){ sz = node_size; par.resize(sz),nrank.resize(sz),size.resize(sz);
        rep(i,sz){ par[i] = i; nrank[i] = 0; size[i] = 1;} }
    int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } }
    void unite(int x,int y,ll cost){
        x = find(x),y = find(y);
        if(x == y) return;
        if(nrank[x] < nrank[y]) swap(x,y);
        ++id;
        G[id].pb((eda){nw[x],cost*size[y]}),G[id].pb((eda){nw[y],cost*size[x]});
        nw[x] = id;
        par[y] = x; size[x] += size[y];
        if(nrank[x] == nrank[y]) nrank[x]++;
    }
    int query(int x){ x = find(x); return size[x]; }
    bool same(int x,int y){ return find(x) == find(y); }
};

ll sm[MAX_N];

void dfs(int u,ll dist){
    sm[u] = dist;
    rep(i,len(G[u])){
        dfs(G[u][i].to,dist+G[u][i].cost);
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<edge> vec(n-1);
    rep(i,n-1){
        int a,b,c;
        cin >> a >> b >> c;
        vec[i] = (edge){a-1,b-1,c};
    }
    sort(all(vec));
    rep(i,n){
        nw[i] = i;
    }
    id = n-1;
    UF uf(n);
    rep(i,n-1){
        uf.unite(vec[i].from,vec[i].to,vec[i].cost);
    }
    dfs(id,0);
    rep(i,n){
        cout << sm[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 20736
def main():
    from math import factorial
    n = int(input())
    mod = 10 ** 9 + 7
    nf = factorial(n)
    l = f(nf)
    ans = 1
    for x in l:
        ans *= (x + 1)
    ans %= mod
    print(ans)


def f(n):
    l = []
    for i in range(2, n + 1):
        if n == 1:
            break
        count = 0
        while n % i == 0:
            n = n // i
            count += 1
        if count > 0:
            l.append(count)
    return l


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;

//https://beta.atcoder.jp/contests/agc028/tasks/agc028_a

public class Program_AGC028_A // ←Class名変更！！
{
    public static void Main(string[] args)
    {
        var st = Console.ReadLine();
        var s = Console.ReadLine();
        var t = Console.ReadLine();

        var l = Lcm(s.Length, t.Length);
        var x = new Dictionary<long, char>();

        for (int i = 0; i < s.Length; i++)
        {
            var pos = i * (l / s.Length) + 1;
            x[pos] = s[i];
        }


        for (int i = 0; i < t.Length; i++)
        {
            var pos = i * (l / t.Length) + 1;
            if (x.ContainsKey(pos))
            {
                if (x[pos] != t[i])
                {
                    Console.WriteLine(-1);
                    return;

                }
            }
        }

        Console.WriteLine(l);
    } // Main



    // 最小公倍数 least common multiple 
    //public static long Lcm(int a, int b)
    //{
    //    return a * b / Gcd(a, b);
    //}

    // ユークリッドの互除法 
    //public static int Gcd(int a, int b)
    //{
    //    if (a < b)  return Gcd(b, a); // 引数を入替えて自分を呼び出す

    //    while (b != 0)
    //    {
    //        var temp = a % b;
    //        a = b;
    //        b = temp;
    //    }

    //    return a;
    //}





    static long Gcd(long a, long b)
    {
        var small = Math.Min(a, b);
        var big = Math.Max(a, b);

        if (small > 0)
        {
            return Gcd(small, big % small);
        }
        else
        {
            return big;
        }


        //if (a < b)
        //{
        //    return Gcd(b, a);
        //}
        //else
        //{
        //    if (b > 0)
        //    {
        //        return Gcd(b, a % b);
        //    }
        //    else
        //    {
        //        return a;
        //    }
        //}

        //return (a < b) ? Gcd(b, a)
        //     : (b > 0) ? Gcd(b, a % b)
        //               : a;
    }

    static long Lcm(long a, long b)
    {
        return a / Gcd(a, b) * b;
    }


    static long gcd(long a, long b)
    {
        long c = Math.Max(a, b) % Math.Min(a, b);
        b = Math.Min(a, b);
        while (c != 0)
        {
            a = b % c;
            b = c;
            c = a;
        }
        return b;
    }

}     // Class




Measured memory_bytes: 19040
#include "bits/stdc++.h"
using namespace std;

typedef long long lld;

int n, k;
int a[110000], b[110000];

lld ans;

lld calc(const int k){
    lld res=0LL;
    for(int i=0; i<n; i++){
        if((a[i]&~k)==0){
            res+=b[i];
        }
    }
    return res;
}

int main() {
    while(scanf("%d%d", &n, &k)!=EOF) {
        for(int i=0; i<n; i++)scanf("%d%d", &a[i], &b[i]);
        ans=calc(k);
        for(int h=(1<<30); h; h>>=1){
            if(k&h){
                ans=max(ans, calc((k^h)|(h-1)));
            }
        }
        printf("%lld\n", ans);
    }
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  int res=1;
  vector<int> num(n+1,0);
  rep(i,n){
    int a;cin>>a;
    num[a]++;
  }
  int i=0;
  if(n%2==0)i++;
  num[0]++;
  for(i;i<n;i+=2){
    if(num[i]!=2){
      res=0;
    }
  }
  rep(i,n/2){
    res*=2;
    res%=MOD;
  }
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ld d;
	cin>>d;
	ld ans=0;
	ans=sqrt(2)*d;
	FOR(i,1,(ll)(d+EPS)+1) {
		ld y=sqrt(d*d-i*i);
		if(y>=0-EPS&&y<=1+EPS) ans=max(ans,(ld)i+1);
	}
	cout<<fixed<<setprecision(393939)<<ans<<endl;
}




Measured memory_bytes: 5964
#include <bits/stdc++.h>
#define FRU                                  freopen("out.txt","w",stdout);
#define FRO                                  freopen("in.txt","r",stdin);
#define pb                                   push_back
#define pf                                   push_front
#define ppb                                  pop_back()
#define ppf                                  pop_front()
#define mp                                   make_pair
#define ff                                   first
#define ss                                   second
#define flash                                ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mem(ara,n)                           memset(ara,n,sizeof ara)
#define fr(i,j,n)                            for(i=j;i<n;i++)
#define rf(i,j,n)                            for(i=n;i>=j;i--)
#define inf                                  2147483647
#define ll                                   long long
#define ull                                  unsigned long long
#define pii                                  pair<int,int>
#define vi                                   vector<int>
#define vll                                  vector <long long>
#define vch                                  vector <char>
#define itr                                  ::iterator
#define msi                                  map<string,int>
#define psi                                  pair <string,int>
#define vii                                  vector <pair<int,int> >
#define all(n)                               n.begin(),n.end()
#define INF                                  10000000000000000LL
#define pi                                   3.1415926535897932384626434
#define sii                                  set <int>
#define max3(a,b,c)                          max(a,max(b,c))
#define min3(a,b,c)                          min(a,min(b,c))
#define mid3(a,b,c)                          min(max(a,b),max(b,c),max(a,b))
#define max4(a,b,c,d)                        max(max(a,b),max(c,d))
#define min4(a,b,c,d)                        min(min(a,b),min(c,d))
#define endl                                 "\n"
#define endll                                cout<<"\n";
#define spc                                  " "

using namespace std;



int main()
{
    flash
    string s,st;
    int n,t,T,i,j,J,I,k,m;
    char ch;
    cin>>n>>m;
    n++;
    m=n-m;
    cout<<m;
    return 0;
}




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

string shuffle (string cards, int h) {
  string tmp;
  tmp = cards.substr(0,h);
  cards.erase(0,h);
  cards = cards + tmp;
  
  return cards;
}

int main() {
  string cards;
  int m;
  
  for (;;) {
    cin >> cards;
    if (cards == "-") break;
    
    cin >> m;
    
    int h = 0;
    for (int i = 0; i < m; i++) {
      cin >> h;
      cards = shuffle(cards,h);
    }

    cout << cards << endl;
    
  }
  
  return 0;
}


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

int f(int n, int m) {
  n %= m;
  while (n < 0) n += m;
  int ret = 1;
  while (n) n = n % __builtin_popcount(n), ret++;
  return ret;
}

int main() {
  int N;
  string S;
  cin >> N >> S;
  int cnt = count(S.begin(), S.end(), '1');
  int mod1 = max(1, cnt - 1), mod2 = cnt + 1;
  vector<int> V1(N), V2(N), V3(N), V4(N);
  int acc1 = 0, acc2 = 0;
  for (int i = N - 1, now1 = 1, now2 = 1; i >= 0; i--, (now1 *= 2) %= mod1, (now2 *= 2) %= mod2) {
    (acc1 += (V1.at(i) = (S.at(i) - '0') * now1) %= mod1) %= mod1;
    (acc2 += (V2.at(i) = (S.at(i) - '0') * now2) %= mod2) %= mod2;
    V3.at(i) = now1 % mod1, V4.at(i) = now2 % mod2;
  }
  for (int i = 0; i < N; i++) {
    int ans;
    if (S.at(i) == '1' && cnt == 1) ans = 0;
    else if (S.at(i) == '1') ans = f(acc1 - V3.at(i), mod1);
    else ans = f(acc2 + V4.at(i), mod2);
    cout << ans << "\n";
  }
}

Measured memory_bytes: 6796
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>

using namespace std;
using ll = long long;

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;}

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


//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    deque<int> d;

    for (int i = 0; i < n; i++) {
        int p = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
        if (p == 0) d.push_front(a[i]);
        else d[p-1] = a[i];
    }

    cout << d.size() << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void) {
    int kind,i,sum,temp;
    while (1) {
        scanf("%d",&kind);
        if (kind==0) break;
        sum=0;
        for (i=0; i<kind*(kind-1)/2; i++) {
            scanf("%d",&temp);
            sum+=temp;
        }
        printf("%d\n",sum/(kind-1));
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
#include <map>
using ll = long long int;
using namespace std;

int main()
{
    int N, Y;
    cin >> N >> Y;
    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N; j++)
        {
            if (i + j <= N)
            {
                int k = (N - i - j);
                if (10000 * i + 5000 * j + k * 1000 == Y)
                {
                    cout << i << " " << j << " " << k << endl;
                    return 0;
                }
            }
            else
            {
                break;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 55
using namespace std;
string s;
int n,cnt[N][300];

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    for(int j=0;j<(int)s.size();j++)
      cnt[i][(int)s[j]]++;
  }
  int idx='a';
  string ans;
  while(1){
    int mincnt=(1e9);
    for(int i=0;i<n;i++)mincnt=min(mincnt,cnt[i][idx]);
    for(int i=0;i<mincnt;i++)ans+=(char)(idx);
    idx++;
    if(idx=='z'+1)break;
  }
  cout<<ans<<endl;
  return 0;
}


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

using LL = long long;

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); --(i))
#define SORT(x) sort(ALL((x)))
#define RSORT(x) sort(RALL((x)))
#define SZ(x) (int)(x).size()
#define debug(x) cerr << #x << " : " << x << '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const LL LINF = 1e18;

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

  string ans = "AC";
  string S;
  cin >> S;

  if (S[0] != 'A') {
    ans = "WA";
  }

  int count = SZ(S);
  int pos = 0;
  bool C_appear = false;
  for (int i = 2; i < count - 1; ++i) {
    if (S[i] == 'C') {
      if (C_appear) {
        ans = "WA";
        break;
      } else {
        C_appear = true;
        pos = i;
      }
    }
  }

  if (!C_appear) {
    ans = "WA";
  }

  FOR(i, 1, count) {
    if (i == pos) {
      continue;
    }

    if (isupper(S[i])) {
      ans = "WA";
      break;
    }
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/




int main()
{
	float w;
	string lank;
	
	while (cin >> w)
	{
		if (w <= 48.0) lank = "light fly";
		else if (w <= 51.0) lank = "fly";
		else if (w <= 54.0) lank = "bantam";
		else if (w <= 57.0) lank = "feather";
		else if (w <= 60.0) lank = "light";
		else if (w <= 64.0) lank = "light welter";
		else if (w <= 69.0) lank = "welter";
		else if (w <= 75.0) lank = "light middle";
		else if (w <= 81.0) lank = "middle";
		else if (w <= 91.0) lank = "light heavy";
		else lank = "heavy";
		
		cout << lank << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1224
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf (ll)2e18
#define EPS 1e-12
#define MOD 998244353ll
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;

inline void solve()
{
	int n, m;
	cin >> n >> m;
	int sum = 0;
	fore(i, 0, m)
	{
		int a;
		cin >> a;
		sum += a;
	}
	if (sum > n)
		cout << -1;
	else
		cout << n - sum;
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	fore(t, 0, q)
	{
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3640
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

public class Main {

	void submit() {
		int n = nextInt();
		int k = nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}

		int ret = Integer.MAX_VALUE;

		for (int i = 0; i + k <= n; i++) {
			int l = a[i];
			int r = a[i + k - 1];

			if (r <= 0) {
				ret = Math.min(ret, -l);
			} else if (l >= 0) {
				ret = Math.min(ret, r);
			} else {
				ret = Math.min(ret, Math.min(Math.abs(l), Math.abs(r)) + r - l);
			}
		}

		out.println(ret);
	}

	void test() {

	}

	void stress() {
		for (int tst = 0;; tst++) {
			if (false) {
				throw new AssertionError();
			}
			System.err.println(tst);
		}
	}

	Main() throws IOException {
		is = System.in;
		out = new PrintWriter(System.out);
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();
	static final int C = 5;

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	private InputStream is;
	PrintWriter out;

	private byte[] buf = new byte[1 << 14];
	private int bufSz = 0, bufPtr = 0;

	private int readByte() {
		if (bufSz == -1)
			throw new RuntimeException("Reading past EOF");
		if (bufPtr >= bufSz) {
			bufPtr = 0;
			try {
				bufSz = is.read(buf);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			if (bufSz <= 0)
				return -1;
		}
		return buf[bufPtr++];
	}

	private boolean isTrash(int c) {
		return c < 33 || c > 126;
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isTrash(b))
			;
		return b;
	}

	String nextToken() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	String nextString() {
		int b = readByte();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b) || b == ' ') {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	char nextChar() {
		return (char) skip();
	}

	int nextInt() {
		int ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}

	long nextLong() {
		long ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}
}


Measured memory_bytes: 22100
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 1e9 + 7;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 100005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;

int arr[MAXN];
int tot;

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%s", a * 500 >= b ? "Yes" : "No");
    return 0;
}

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

#define len(s) int(s.size())
#define res(x) cout<<((x) ? "YES\n" : "NO\n")
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define st first
#define nd second

typedef long long int ll;
typedef long double ld;

void solution() {
	string s = "ACL", ans;
	int k; cin >> k;
	for(int i = 0; i < k; ++i) {
		ans += s;
	}
	cout << ans << endl;
}

int main() {
	
	int tt = 1;
	//cin >> tt;
	
	while(tt--) {
		solution();
	}
	
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main()
{
    int a,b,k,i,j;

    scanf("%d %d %d",&a,&b,&k);


    if ((b-a+1)%2==1)
    {
        if (k>(b-a+1)/2)
        {
            for (i=a;i<=b;i++)
            {
                printf("%d\n",i);
            }
        }

        else
        {
            for (i=a,j=0;j<k;i++,j++)
            {
                printf("%d\n",i);
            }

            for (i=b-k+1;i<=b;i++)
            {
                printf("%d\n",i);
            }
        }
    }


    if ((b-a+1)%2==0)
    {

        if (k>(b-a+1)/2)
        {
            for (i=a;i<=b;i++)
            {
                printf("%d\n",i);
            }
        }

        else
        {
            for (i=a,j=0;j<k;j++,i++)
            {
                printf("%d\n",i);
            }


            for (i=b-k+1;i<=b;i++)
            {
                printf("%d\n",i);
            }
        }
    }




    return 0;
}


Measured memory_bytes: 256
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define deb(x)          cout<<#x<<" "<<x<<endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	Raghav();
	int N;
	cin >> N;
	string S;
	cin >> S;
	string tmp = "No";
	int K = N / 2;
	if (N % 2 == 0 && S.substr(0, K) == S.substr(K, K)) tmp = "Yes";
	cout << tmp << endl;



	return 0;
}

Measured memory_bytes: 3568
#include<stdio.h>
#include<vector>
using namespace std;

vector<vector<int> >g;
int n,m,q,s,t;

vector<bool>visited;
vector<int>color;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        if(color[g[s][i]]==-1){
            color[g[s][i]]=color[s];
            dfs(g[s][i]);
        }
    }
}
int main() {
    scanf("%d %d",&n,&m);
    g.resize(n);
    color.resize(n,-1);
    for(int i=0;i<m;i++){
        scanf("%d %d",&s,&t);
        g[s].push_back(t);
        g[t].push_back(s);
    }
    for(int i=0;i<n;i++){
        if(color[i]==-1){
            color[i]=i;
            dfs(i);
        }
    }
    scanf("%d",&q);
    for(int i=0;i<q;i++){
        scanf("%d %d",&s,&t);
        printf((color[s]==color[t]?"yes\n":"no\n"));
    }
    return 0;
}

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

class Main{

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String search = br.readLine().toLowerCase();

		while(true){

			String str = br.readLine();

			if(str.equals("END_OF_TEXT")){
				break;
			}

			str = str.toLowerCase();
			String[] word = str.split(" ");

			for(int i = 0; i < word.length; i++){
				if(search.equals(word[i])){
					count++;
				}
			}

		}

		System.out.println(count);

	}
}

Measured memory_bytes: 24064
# AOJ 0228: Seven Segments
# Python3 2018.6.25 bal4u

p = [[1,1,1,1,1,1,0], [0,1,1,0,0,0,0], [1,1,0,1,1,0,1], [1,1,1,1,0,0,1], [0,1,1,0,0,1,1], \
     [1,0,1,1,0,1,1], [1,0,1,1,1,1,1], [1,1,1,0,0,1,0], [1,1,1,1,1,1,1], [1,1,1,1,0,1,1]]

while True:
	n = int(input())
	if n < 0: break
	a = [0]*7
	for i in range(n):
		d = int(input())
		ans = ''
		for j in range(6,-1,-1):
			k = (a[j] ^ p[d][j]) & 1
			ans += '1' if k else '0'
			if k: a[j] = 1-a[j]
		print(ans)


Measured memory_bytes: 5600