akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	int n, m, a[1000], b[1000], c[1000];
	int i, j, com, win;
	
	scanf("%d %d", &n, &m);
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
		c[i] = 0;
	}
	for (i = 0; i < m; i++){
		scanf("%d", &b[i]);
		for (j = 0; j < n; j++){
			if (b[i] >= a[j]){
				c[j]++;
				break;
			}
		}
	}
	/*
	for (j = 0; j < n; j++){
		printf("[%d]\n", c[j]);
	}
	*/
	com = c[0];
	win = 1;
	for (i = 1; i < n; i++){
		if (com < c[i]){
			com = c[i];
			win = i + 1;
		}
	}
	
	printf("%d\n", win);
	
	return (0);
}

Measured memory_bytes: 1036
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
int main(){
    ll x;
    cin >> x;
    for(ll i=-200;i<=200;i++){
        for(ll j=-200;j<=200;j++){
            if(i*i*i*i*i - j*j*j*j*j == x){
                cout << max(i,j) << ' ' << min(i,j) << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3556
from collections import deque

def resto(n,m,ab):

    oya=[[] for _ in range(n)]
    ko=[[] for _ in range(n)]

    for i,y in ab:
        oya[y-1]+=[i-1]
        ko[i-1]+=[y-1]

    root=0
    for i in range(n+m):
        if len(oya[i])==0:
            root=i
            break

    oya[root]=['a']
    deq=deque([root])
    while len(deq)>0:
        z=deq.popleft()
        for i in ko[z]:
            if len(oya[i])!=1:
                oya[i].remove(z)
            else:
                deq.append(i)

    ans=[str(0)+'\n' if i[0]=='a' else str(i[0]+1)+'\n' for i in oya ]

    return ''.join(ans)

n,m=map(int,input().split())
print(resto(n,m,[list(map(int,input().split())) for _ in range(n+m-1)]))

Measured memory_bytes: 60040
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// conversion
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) (INT((x).size()))
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1<<25;
// const ll INF = 1LL<<50;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;

#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


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


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

  string s;
  cin >> s;
  REP(i, SZ(s) - 1) {
    if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return 0;
    }
  }

  REP(i, SZ(s) - 2) {
    if (s[i] == s[i + 2]) {
      cout << i + 1 << " " << i + 3 << endl;
      return 0;
    }
  }

  cout << -1 << " " << -1 << endl;
  return 0;
}

Measured memory_bytes: 512
from collections import defaultdict as dd

N, X = [int(i) for i in input().split()]
sList = [int(i) for i in input().split()]
sList.sort(reverse=True)
mod = 10 ** 9 + 7

dp = dd(int)
dp[X] = 1
for i, s in enumerate(sList):
    new_dp = dd(int)
    for x in dp:
        new_dp[x] += dp[x] * (N - i - 1)
        new_dp[x] %= mod
        new_dp[x % s] += dp[x]
        new_dp[x % s] %= mod
    dp = new_dp

ans = 0
for x in dp:
    ans += x * dp[x]
    ans %= mod

print(ans)


Measured memory_bytes: 5540
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
ans='No'
for i in range(n-2):
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    ans='Yes'
print(ans)

Measured memory_bytes: 9188
/*
    If they say
    Who cares if one more light goes out?
    In a sky of a million stars
    It flickers, flickers
    Who cares when someone's time runs out?
    If a moment is all we are
    We're quicker, quicker
    Who cares if one more light goes out?
    Well I do
*/

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

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) ((a) / gcd(a,b)) * (b)
#define all(x)  x.begin(),x.end()

#define ll long long
#define ull unsigned long long
#define VI vector<int>
#define VLL vector<ll>
#define VS vector<string>
#define MPII map<int, int>
#define SET set<int>
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io   ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);

ll MOD = 1e9+7;

ll add(ll a, ll b)
{
    a+=b; a%=MOD;
    if(a<0) a+=MOD;
    return a;
}
ll mult(ll a, ll b)
{
    if(a>MOD) a%=MOD;
    if(b>MOD) b%=MOD;
    ll ans=(a*b)%MOD;
    if(ans<0) ans+=MOD;
    return ans;
}
ll pw(ll a, ll b)
{
    ll r=1;
    while(b){
        if(b&1) r=mult(r,a);
        a=mult(a,a);
        b>>=1;
    }
    return r;
}

void solve(){
    ll a,b;
    cin>>a>>b;
    ll x,y;
    map<int,int> m;
    for(int i=0;i<b;i++){
        cin>>x>>y;
        m[x]++,m[y]++;
    }
    for(int i=1;i<=a;i++){
        cout<<m[i]<<endl;
    }
}

int main(){
    fast_io;
    ll t, k=0;
    t=1;
    while(t--){
        //k++;
        //cout<<"Case "<<k<<": ";
        solve();
    }
}



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
const ll MOD = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 200100;

bitset<1000100> pp;
vi V;
ll N,NN;
vpi K;
ll cur;
ll ans;

bool run(ll A, ll B){
  // cerr<<A<<' '<<B<<'\n';
  if (A == 1)return 1;
  if (A<B)return 0;
  if (A%B==0)return run(A/B,B);
  return run(A%B,B);
}

void dfs(ll l){
  pi T = K[l];
  if (l == SZ(K)){
    if (cur==1)return;
    ans += run(NN,cur);
    return;
  }
  dfs(l+1);
  for (int i=1;i<=T.s;++i){
    cur *= T.f;
    dfs(l+1);
  }
  for (int i=1;i<=T.s;++i)cur /= T.f; 
}

int main(){
  cin>>N;
  NN=N;
  int T = 1000000;
  for (ll i=2;i<=T;++i)if(!pp[i]){
    V.pb(i);
    for (ll j=i*i;j<=T;j+=i){
      pp[j] = 1;
    }
  }
  ll P = N-1;
  for (auto i : V){
    int r = 0;
    while (P%i==0){
      P /= i;
      ++r;
    }
    if (r){
      // cout<<i<<' '<<r<<'\n';
      K.pb(i,r);
    }
  }
  if (P>1)K.pb(P,1);
  ans=1;
  for (auto i : K)ans = ans*(i.s+1);
  --ans;

  K.clear();
  for (auto i : V){
    int r = 0;
    while (N%i==0){
      N /= i;
      ++r;
    }
    if (r){
      K.pb(i,r);
    }
  }
  if (N>1)K.pb(N,1);
  cur = 1;
  dfs(0);
  cout<<ans;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll a,b,c;
	cin>>a>>b>>c;
	ll a2=0,b2=0,c2=0;

	a2=(a%2)*b*c;
	b2=(b%2)*a*c;
	c2=(c%2)*a*b;
	a2=min(a2,b2);
	cout<<min(a2,c2)<<endl;
	return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    int x[5];
    int ans;
    rep(i, 5)
    {
        cin >> x[i];
        if (x[i] == 0)
            ans = i+1;
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    int rate;
    cin >> rate;
    int ans;
    if (rate<600) ans = 8;
    else if (rate<800) ans = 7;
    else if (rate<1000) ans = 6;
    else if (rate<1200) ans = 5;
    else if (rate<1400) ans = 4;
    else if (rate<1600) ans = 3;
    else if (rate<1800) ans = 2;
    else if (rate<2000) ans = 1;
    cout << ans << endl;
}

Measured memory_bytes: 3620
n, p = map(int, input().split())

s = input()

if 10 % p == 0:
    ans = sum(i + 1 for i, x in enumerate(s) if int(x) % p == 0)
    print(ans)
else:
    counter = [0] * p
    counter[0] = 1
    cur = 0
    p10 = 1
    ans = 0
    for x in s[::-1]:
        cur = (cur + int(x) * p10) % p
        ans += counter[cur]
        counter[cur] += 1
        p10 *= 10
        p10 %= p
    print(ans)


Measured memory_bytes: 44364
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "damage", long, "cost");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long h, n;
    scan(h, n);
    auto magic = new Pair[](n);
    foreach (ref e; magic)
    {
        long a, b;
        scan(a, b);
        e = Pair(a, b);
    }
    auto d = new long[](MAX);
    d[] = INF;
    d[0] = 0;
    foreach (i; iota(h + 1))
    {
        foreach(j; iota(n))
        {
            d[i + magic[j].damage] = min(d[i] + magic[j].cost, d[i + magic[j].damage]);
        }
    }
    long ans = INF;
    foreach (i; iota(h, MAX))
    {
        ans = min(d[i], ans);
    }
    ans.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 10236
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 55;
int a[N],b[N],c[N],sum,n;

int main(){
    scanf("%d",&n); a[0]=-1;
    for(int i=1;i<=n;++i) scanf("%d",&a[i]);
    for(int i=1;i<=n;++i) scanf("%d",&b[i]);
    for(int i=1;i<n;++i) scanf("%d",&c[i]);
    for(int i=1;i<=n;++i){
        sum+=b[a[i]];
        if(a[i]==a[i-1]+1) sum+=c[a[i-1]];
    }
    printf("%d\n",sum);
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  vector<int> ans(n + 1, 0);

  FOR(i, 1, 110) {
    FOR(j, 1, 110) {
      FOR(k, 1, 110) {
        ll t = ((ll)i * i) + ((ll)j * j) + ((ll)k * k) + ((ll)i * j) + ((ll)j * k) + ((ll) i * k);
        if(t <= n) ans[t]++;
      }
    }
  }

  FOR(i, 1, n + 1) {
    cout << ans[i] << endl;
  }
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int sumn = i * (i + 1) / 2;
    if (sumn >= N) {
      int diff = sumn - N;
      for (int j = 1; j <= i; j++) {
        if (j != diff) cout << j << '\n';
      }
      break;
    }
  }
  return 0;
}


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

int t[104]={0};
double f[40005]={0};

double calc(int a, int b, int n){
    int d = (b-a) / n;
    double acc = 0;
    for(int i=a;i<b;i+=d){
        acc += (f[i] + f[i+d]) * d / 2.0;
    }
    return acc;
}

int main(){
    int n;
    cin >> n;
    int total = 0;
    for(int i=0;i<n;++i){
        cin >> t[i];
        total += t[i];
    }
    vector<int> v;
    v.push_back(0);
    for(int i=0;i<n;++i){
        int tmp;
        cin >> tmp;
        v[v.size()-1] = min(v.back(), tmp);
        for(int j=1;j<=2*t[i];++j)v.push_back(tmp);
    }
    v[v.size()-1] = 0;

    for(int i=1;i<=total*2;++i) f[i] = min((double)v[i], f[i-1] + 0.5);
    for(int i=total*2-1;i>=0;--i) f[i] = min(f[i+1]+0.5, f[i]);

    printf("%.6f\n",calc(0, total*2, total*2)/2.0);

    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long int ll;
typedef pair<int, int> pr;
typedef priority_queue<int> p_int_max;
typedef priority_queue<int, vector<int>, greater<int>> p_int_min;

int n, si;
unordered_set<int> s;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    rep(i, n)
    {
        cin >> si;
        s.insert(si);
    }
    if (s.size() == n)
        cout << "YES\n";
    else
        cout << "NO\n";
}

Measured memory_bytes: 8520
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf 1000000000000000000

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(10);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,z,w;
    cin>>n>>z>>w;
    vi a(n);
    rep(i,n){
        cin>>a[i];
    }
    if(n==1){
        cout<<abs(a[0]-w)<<endl;
    }
    else{
        cout<<max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]))<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;
using ll = long long;



int main() {
	int n;
	cin >> n;
	vector<int> l(n);
	for (int i = 0; i < n; i++) cin >> l[i];
	sort(l.begin(), l.end());
	int sum = 0;
	for (int i = 0; i < n - 1; i++) sum += l[i];
	if (l[n - 1] < sum) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define f first
#define s second
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vi vector<int>
#define vll vector<ll>
#define be begin
#define en end
#define endl '\n'
#define SIZE 100000000
#define w(t) int t;cin>>t;while(t--)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define value_at_idx find_by_order
#define idx order_of_key
#define MOD 1e9 + 7

typedef long long ll;
using namespace std;
using namespace __gnu_pbds; 
 

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	ll n;
	cin>>n;
	ll x = 100;
	ll yr = 0;
	while(x < n)
	{
		yr++;
		x+=x/100;
	}
	cout<<yr;
	

	return 0;
	
	
	
}

Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
using namespace std;
#define N 405
//#define int long long
#define mod 998244353
#define debug cout<<__LINE__<<" "<<__FUNCTION__<<"\n"

inline int read(){
    int x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    return x;
}
int n,sum,a[N],b[N];
int dp[N][N][N],fac[N],inv[N];
inline int ksm(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=1ll*ans*x%mod;
		x=1ll*x*x%mod;
		y>>=1;
	}
	return ans;
}
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++){
		a[i]=read()+a[i-1];b[i]=read()+b[i-1];
//		sum+=a[i];
	}
	fac[0]=inv[0]=1;
	for(int i=1;i<=b[n];i++){
		fac[i]=1ll*fac[i-1]*i%mod;inv[i]=ksm(fac[i],mod-2)%mod;
	}
	dp[0][0][0]=-1;
	for(int i=1,res;i<=n;i++){
		for(int j=0;j<=a[i];j++){
			for(int k=0;k<=b[i];k++){
				dp[i][j][k]=dp[i-1][j][k];
				if(a[i]-a[i-1]>j) continue;
				res=1;
				for(int l=0;l<min(b[i]-b[i-1],k+1);l++){
					dp[i][j][k]=(dp[i][j][k]-1ll*dp[i-1][j-a[i]+a[i-1]][k-l]*res%mod*inv[l]%mod+mod)%mod;
					res=1ll*res*(a[i]-a[i-1])%mod;
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<=a[n];i++){
		for(int j=0;j<=b[n];j++){
			ans=(ans+1ll*dp[n][i][j]*a[n]%mod*ksm(ksm(i,mod-2),j+1)%mod*fac[j]%mod)%mod;
		}
	}
	cout<<ans<<"\n";
//	fclose(stdin);
//	fclose(stdout);
    return 0;
}


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

using namespace std;
#define ll long long
#define ld long double

set<int> s;

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int n, r;
    cin >> n >> r;
    if(n >= 10) {
        cout << r << endl;
    }
    else {
        cout << r + 100 * (10 - n) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
d = {}
m = 1
for i in range(N):
    s = input()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
        m = max(m, d[s])

l = []
for k, v in d.items():
    if v == m:
        l.append(k)

for n in sorted(l):
    print(n)



Measured memory_bytes: 33044
import java.util.*;

public class Main {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    int a = y / 10000;
    int b;
    int c;
    loop: for(int i = a; i >= 0; i--) {
      b = (y - 10000 * i) / 5000;
      for(int j = b; j >= 0; j--) {
        c = (y - 10000 * i - 5000 * j) / 1000;
        if(i + j + c == n) {
           System.out.println(i + " " + j + " " + c);
           break loop;
        }
      }
      if(i == 0) {
        System.out.println(-1 + " " + -1 + " " + -1);
      }
    }
  }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
bool prime[200001]={0};

void p()
{
    for(long long i=2; i<=200000; i++)
        if(!prime[i])
            for(long long j=i*i; j<=200000; j+=i)
                prime[j]=1;
}

long long power(long long x, long long y, long long p)
{
    long long res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

long long modInverse(long long n, long long p)
{
    return power(n, p-2, p);
}

long long nCrModPFermat(long long n, long long r, long long p)
{
   if (r==0)
      return 1;
    long long fac[n+1];
    fac[0] = 1;
    for (long long i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;
    return (fac[n]* modInverse(fac[r], p) % p * modInverse(fac[n-r], p) % p) % p;
}

int main()
{
	p();
    int n;
    cin>>n;
    while(true)
    {
        if(prime[n]) n++;
        else
        {
            cout<<n<<endl;
            break;
        }
    }
}


Measured memory_bytes: 384
#include<stdio.h>

char str[21];
int main(void){
	int i;
	
	scanf("%s",&str);
	
	for(i=20;i>=0;--i){
		if(str[i]!='\0'){
			printf("%c",str[i]);
		}
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(int argc, const char * argv[])
{
    int large,small,tmp,a,b,r;
    while(scanf("%d %d",&large,&small)!=EOF){
        if(large<small){
            tmp = large;
            large = small;
            small = tmp;
        }
        a=large;
        b=small;
        
        r=1;
        while( r!=0 ){
            r=a%b;
            a=b;
            b=r;
        }
        
        b=large/a*small;
        printf("%d %d\n",a,b);
    }
    return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
ll const INF = 1LL << 60;

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

    int ans = -1;
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'T' || S[i] == 'G') {
            cnt++;
        } else {
            cnt = 0;
        }
        ans = max(ans, cnt);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())
k = int(input())

tmp = k

while b <= a:
    b *= 2
    tmp -= 1

while c <= b:
    c *= 2
    tmp -= 1

#print(tmp,a,b,c)

if tmp >= 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61636
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;

int main() 
{
	int w,h;
	while(cin>>w>>h,!(w==0&&h==0)){
		
		int a[30][30][4]={}; //0left,1down,2right,3up
		REP(i,30){REP(j,30){REP(k,4){a[i][j][k]=1;}}}
		
		int tmp;
		for(int i=0;i<h;i++){
			for(int j=0;j<w-1;j++){
				if(cin>>tmp && tmp==0){
					a[j][i][2]=0;a[j+1][i][0]=0;
				}
			}
			if(i!=h-1){
			for(int j=0;j<w;j++){
				if(cin>>tmp && tmp==0){
					a[j][i][1]=0;a[j][i+1][3]=0;
				}
			}}
		}
		
		int ans[30][30]={}; //答えの配列
		int b[901][900][2]={};//n回目の探索に使うx,yのセット
		int t[901]={};//n回目の探索数
		
		ans[0][0]=1;
		b[0][0][0]=0;
		b[0][0][1]=0;
		t[0]=1;
		
		for(int i=0;i<900;i++)//i回目の探索
		{
			for(int j=0;j<t[i];j++)  //x=b[i][j][0] y=b[i][j][1]
			{
				int x=b[i][j][0];
				int y=b[i][j][1];
				//left
				if(x-1>-1 && a[x][y][0]==0 && ans[x-1][y]==0){
					ans[x-1][y]=ans[x][y]+1;
					b[i+1][t[i+1]][0]=x-1;
					b[i+1][t[i+1]][1]=y;
					t[i+1]++;
				}
				//right
				if(x+1<w && a[x][y][2]==0 && ans[x+1][y]==0){
					ans[x+1][y]=ans[x][y]+1;
					b[i+1][t[i+1]][0]=x+1;
					b[i+1][t[i+1]][1]=y;
					t[i+1]++;
				}
				//down
				if(y+1<h && a[x][y][1]==0 && ans[x][y+1]==0){
					ans[x][y+1]=ans[x][y]+1;
					b[i+1][t[i+1]][0]=x;
					b[i+1][t[i+1]][1]=y+1;
					t[i+1]++;
				}
				//up
				if(y-1>-1 && a[x][y][3]==0 && ans[x][y-1]==0){
					ans[x][y-1]=ans[x][y]+1;
					b[i+1][t[i+1]][0]=x;
					b[i+1][t[i+1]][1]=y-1;
					t[i+1]++;
				}
			}
			if(t[i+1]==0){break;}
		}
		cout << ans[w-1][h-1]<< endl;	
	}
	return 0;
}

Measured memory_bytes: 7520
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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



void solve(long long N, std::vector<long long> A){
    long long ans=0;
    rep(i,A.size()){
        if(i==0)continue;
        if(A[i-1]>A[i]){
            ans+=A[i-1]-A[i];
            A[i]=A[i-1];
        }
    }
    cout<<ans<<endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4860
# -*- coding: utf-8 -*-
r,D,x2000 = [int(i) for i in input().split()]

x2001 = r * x2000 - D
x2002 = r * x2001 - D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004 - D
x2006 = r * x2005 - D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
print(x2001)
print(x2002)
print(x2003)
print(x2004)
print(x2005)
print(x2006)
print(x2007)
print(x2008)
print(x2009)
print(x2010)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n, m; cin >> n >> m;
  vector<pair<ll, ll>> v(n);
  ll ans = 0;
  rep(i, n){
    cin >> v[i].first >> v[i].second;
  }
  sort(All(v));
  int k = 0;
  rep(i, m){
    if(v[k].second != 0){
      ans += v[k].first;
      v[k].second -= 1;
    }
    else{
      k++;
      i--;
    }
  }
  cout << ans << endl;
  system("pause");
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

int main() 
{
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  ll  cards=0,sum=0;
  if(a<=k)
  {
    sum+=a;
    k-=a;
  }
  else
  {
    sum+=k;
    k-=k;
  }
  if(k>0)
  {
    if(b<=k)
    {
      k-=b;
    }
    else
    {
      k-=k;
    }
  }
  if(k>0)
  {
    if(c<=k)
    {
      sum-=c;
      k-=c;
    }
    else
    {
      sum-=k;
      k-=k;
    }
  }
  cout<<sum<<endl;
  return 0;
}























Measured memory_bytes: 3632
n = int(input())
cnt = 0
for i in range(n):
    d1, d2 = map(int, input().split()) 
    if d1 == d2:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    if d1 != d2:
        cnt = 0
print("No")

Measured memory_bytes: 9184
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int sum = 0;
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                sum += a[i];
            }
            int m = in.nextInt();
            for (int i = 0; i < m; i++) {
                int p = in.nextInt() - 1;
                int x = in.nextInt();
                out.println(sum - a[p] + x);
            }
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 23380
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      x: usize,
    }

    let mut ans = (x/11) * 2;
    if x%11 != 0 {
        if x%11 <= 6 {
            ans += 1;
        } else {
            ans += 2;
        }
    }
    println!("{}", ans);
}


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

int main(void) {
  int n, ans = 0, count = 0;

  cin >> n;

  while(n) {
    ans = ans + n % 10;
    n = n / 10;
    count++;
  }

  if(count > 1 && ans == 1) {
    cout << 10 << endl;
    return 0;
  }
  cout << ans << endl;

  return 0;
}


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

#define N 511111
#define A 511111
#define BLOCK 710 // ~sqrt(N)

int cnt[A], a[N], ans[N], answer = 0;

struct node {
	int L, R, i;
} q[N];

bool cmp(node x, node y) {
	if (x.L / BLOCK != y.L / BLOCK) {
		// different blocks, so sort by block.
		return x.L / BLOCK < y.L / BLOCK;
	}
	// same block, so sort by R value
	return x.R < y.R;
}

void add(int position) {
	cnt[a[position]]++;
	if (cnt[a[position]] == 1) {
		answer++;
	}
}

void remove(int position) {
	cnt[a[position]]--;
	if (cnt[a[position]] == 0) {
		answer--;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < m; i++)
	{
		cin >> q[i].L >> q[i].R;
		q[i].L--; q[i].R--;
		q[i].i = i;
	}

	sort(q, q + m, cmp);

	int currentL = 0, currentR = 0;
	for (int i = 0; i < m; i++) {
		int L = q[i].L, R = q[i].R;
		while (currentL < L) {
			remove(currentL);
			currentL++;
		}
		while (currentL > L) {
			add(currentL - 1);
			currentL--;
		}
		while (currentR <= R) {
			add(currentR);
			currentR++;
		}
		while (currentR > R + 1) {
			remove(currentR - 1);
			currentR--;
		}
		ans[q[i].i] = answer;
	}

	for (int i = 0; i < m; i++)
		cout << ans[i] << "\n";
}

Measured memory_bytes: 15448
#include <iostream>

int main()
{
  int a, b, c;
  int ans;

  std::cin >> a >> b >> c;
  int max = a;

  if (max < b) {
    max = b;
  }
  if (max < c) {
    max = c;
  }

  ans = a + b + c - max;

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return f(n)//(f(r)*f(n-r))


for i in range(K):
    if i <= N-K:
        print((nCr(K-1, i) * nCr(N-K+1, i+1)) % WARU)
    else:
        print(0)


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

int main(){

   int n;
   cin>>n;
   bool ok = false;
   for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
        if(i*j==n){
            ok =true;
            break;
        }
    }
   }
   if(ok )cout<<"Yes";
   else cout<<"No";


return 0;
}



Measured memory_bytes: 3552
# coding: utf-8
# Your code here!


#ord(s)

N = int(input())
count =[0 for i in range(4)]
for i in range(N):
    s = input()
    if s == "AC":
        count[0] += 1
    elif s == "WA":
        count[1] += 1
    elif s == "TLE":
        count[2] += 1
    elif s == "RE":
        count[3] += 1
        
print("AC x", count[0])
print("WA x", count[1])
print("TLE x", count[2])
print("RE x", count[3])


    
    
    
    
    
    
    




Measured memory_bytes: 9028
#include <iostream> 
#define ll long long 
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int check=0;
    ll n, sum = 0, k=0;
    int stones[100005], diff[100005];
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> stones[i];
        sum+=stones[i];
    }
    for(int i=1; i<=n; i++){
        if(i==n){
            diff[n]=(stones[1]-stones[n]);
        }
        else{
            diff[i]=(stones[i+1]-stones[i]);
        }
    }
    
    if(sum%(n*(n+1)/2)!=0){
        cout << "NO" << endl;
    }
    else{
        k=sum/(n*(n+1)/2);
        for(int i=1; i<=n; i++){
            ll x = ((k-diff[i])/n);
            if(x>=0 && (k-diff[i])%n==0){
                check++;
            }
        }
        if(check==n){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;
using ll = long long;

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

  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];
  for (int i = 0; i < n; i++)
    cin >> c[i];

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  ll ans = 0;
  for (auto bb : b) {
    auto it1 = lower_bound(a.begin(), a.end(), bb);
    auto it2 = upper_bound(c.begin(), c.end(), bb);
    ans += distance(a.begin(), it1) * distance(it2, c.end());
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4472
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

int X[102];

int main() {
	int N;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> X[i];
	}
	int mn = INT32_MAX, cnt = 0;
	for (int i = 0;i < 101;i++) {
		cnt = 0;
		for (int j = 0;j < N;j++) {
			cnt += (X[j] - i) * (X[j] - i);
		}
		mn = min(cnt, mn);
	}
	cout << mn << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int num =  s.length() - 2;
		
		
		System.out.println(s.substring(0,1) + num + s.substring(s.length()-1, s.length()));
		
		sc.close();
	}
}

Measured memory_bytes: 21460
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#define MAX_N 100
#define MAX_T 200
#define INF (1LL<<31)
#define fst first
#define snd second
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;
 
int main(){
  int X,t;
  cin>>X>>t;
  cout<<max(X-t,0)<<endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int N,A,B;

  cin >> N >> A >> B;
  int ans=0;
  FOR(i,1,N+1){
    int n=i;
    int t=0;
    while(n>0){
      t += n%10;
      n /= 10;
    }
    if(A <= t && t <= B){
      ans+=i;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {

    map<string, int> ans;
    ans["AC"] = 0;
    ans["WA"] = 0;
    ans["TLE"] = 0;
    ans["RE"] = 0;

    int N;
    cin >> N;

    rep(i, N) {
        string s;
        cin >> s;
        ans[s]++;
    }

    cout << "AC x " << ans["AC"] << endl;
    cout << "WA x " << ans["WA"] << endl;
    cout << "TLE x " << ans["TLE"] << endl;
    cout << "RE x " << ans["RE"] << endl;

    return 0;
}

Measured memory_bytes: 3620
import sys

s = list(input())
if s[0] == 'A' and s[1] == 'A' and s[2] == 'A':
  print('No')
  sys.exit()
if s[0] == 'B' and s[1] == 'B' and s[2] == 'B':
  print('No')
  sys.exit()
print('Yes')

Measured memory_bytes: 2940
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N, u, v = read_values()
    u -= 1
    v -= 1
    F = [set() for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_index()
        F[a].add(b)
        F[b].add(a)

    D = [-1] * N
    S = deque()
    S.append((0, v))
    D[v] = 0
    while S:
        c, p = S.popleft()
        for q in F[p]:
            if D[q] != -1:
                continue
            D[q] = c + 1
            S.append((c + 1, q))

    E = [-1] * N
    S.append((0, u))
    E[u] = 0
    while S:
        c, p = S.popleft()
        for q in F[p]:
            if E[q] != -1  or D[q] < c + 1:
                continue
            E[q] = c + 1
            S.append((c + 1, q))
    
    res = 0
    for i in range(N):
        if E[i] < 0:
            continue
        res = max(res, D[i])
    print(res - 1)


if __name__ == "__main__":
    main()


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

const int MOD = (int)1e9+7;

int main(){
  vector<int> ab(6);
  for(int i=0;i<6;i++)  cin >> ab.at(i);

  vector<int> count(5);
  for(int i=0;i<6;i++){
    count.at(ab.at(i))++;
  }
  bool flag=true;
  for(int i=0;i<5;i++){
    if(count.at(i)>=3)  flag=false;
  }
  if(flag)  cout << "YES" << endl;
  else  cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  //string s;
  //map<string,int> s;
  //map<string,int> s{};
  //string res;
  //vector<int> a;
  
  cin >> n;
  long long sum = 0;
  //cout << s.at(0) << endl;
  //vector<int> s(n,0);
  //int tmp,res;
  //res = 0;
  //string res = "No";
  for(int i = 1;i<=n;i++){
    for(int j = 1;j<=n;j++){
      for(int k = 1;k<=n;k++){
        sum += gcd(i,gcd(j,k));
      
      }
    }
  }
    
  cout << sum;
  
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //int N = Integer.parseInt(scan.next());
        int A = Integer.parseInt(scan.next());
        int B = Integer.parseInt(scan.next());
        int H = Integer.parseInt(scan.next());
        System.out.println((A+B)*H/2);
    }
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define INF 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;


int main() {
    ll N,M,ans = 0;
    cin >> N >> M;

    if(N >= M/2)
        ans = M/2;
    else{
        ans = N;
        M -= 2*N;
        ans += M/4;
    }

    cout << ans;
    //printf("%.15lf", ans);
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
signed main() {
    int x=0,y=0,z=0,w=0,n=0,m=0;
    cin >>x>>y;
    y=2*y-x;
cout<<y;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int h,n;
  int a,num=0;

  cin>>h>>n;
  for(int i=0;i<n;i++){ cin>>a; num+=a; }

  if(num>=h) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll A, B, V, W, T;
  cin>>A>>V>>B>>W>>T;
  if(V<=W) cout<<"NO"<<endl;
  else{
    if(abs(A-B)<=T*(V-W)) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}



Measured memory_bytes: 3644
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	int count = 0;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] == '1') {
			count++;
		}
	}
	cout << count << endl;

	
}


Measured memory_bytes: 3596
#include<stdio.h>
int main(){
  int n, m, t, x;
  char s[10];
  while ( scanf ( "%s %d %d" ,s ,&n ,&m ) != EOF ){
    t = n + m;
    x = (n*200) + (m*300);
    printf("%s %d %d\n" ,s ,t ,x);
  }
  return 0;
}

Measured memory_bytes: 596
import math
a, b, c = map(int, input().split())
# 二つを +1　→　一つを -1 と読み替えて、目標値0 ~ 100までの操作回数を数える

def cnt(crnt, goal):
  diff = abs(goal - crnt)
  if crnt >= goal:
    return diff
  else:
    if diff % 2 == 0:
      return diff // 2
    else:
      return math.ceil(diff/2) + 1

ans = 10**10
for i in range(100):
  ca = cnt(a, i)
  cb = cnt(b, i)
  cc = cnt(c, i)
  csum = ca + cb + cc
  if ans > csum:
    ans = csum
print(ans)

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int cnt = 0;
		for(int i=0;i<N;i++) if(A[i] % 2 == 1) cnt++;
		Console.WriteLine((cnt % 2 == 1) ? "NO" : "YES");
		
		
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 12120