akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
  int a,b,c=1;
  scanf("%d %d",&a,&b);
  for(int i=0; i<a; i++){
    c*=100;
  }
  if(b!=100){
    printf("%d",c*b);
  }else{
    printf("%d",c*101);
  }
  return 0;}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++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 REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll x, h;
	while (cin >> x >> h, x) {
		SETP(10);
		cout << x * x + sqrt(x * x * (4 * h * h + x * x)) << endl;;
	}
}


Measured memory_bytes: 3264
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 100000000

int main() {
	int n, same, total, result = INF, ans = 0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	same = a.at(0);

	while (same < a.at(n-1)+1) {
		total = 0;
		for (int i = 0; i < n; i++) {
			total += pow(same - a.at(i), 2);
		}
		if (result > total) {
			result = total;
		} else {
			ans = result;
			break;
		}
		same++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3528
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;

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

    cin >> R;
    if(R < 1200) cout << "ABC" << endl;
    else if(R < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;

    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define F first
#define S second
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
vector<int> ans;
int n,h,w,a,b,c,d,H,W;
vector<P> v,u;
int main(void){
    while(1){
    cin>>n>>h>>w;
    if(n==0&&h==0&&w==0)return 0;
    v={};
    u={};
    ans={};
    v.push_back({h,w});
    for(int i=0;i<n;i++){
        cin>>a>>b;
        a--;
        for(int i=0;i<v.size();i++){
            if(i==a){
                H=v[i].F,W=v[i].S;
            }
            else{
                u.push_back({v[i].F,v[i].S});
            }
        }
        b%=(H+W);
        if(1<=b&&b<H){
            c=b,d=H-b;
            if(c<d)swap(c,d);
            u.push_back({d,W});
            u.push_back({c,W});
        }
        else{
            b-=H;
            c=b,d=W-b;
            if(c<d)swap(c,d);
            u.push_back({H,d});
            u.push_back({H,c});
        }
        v={};
        for(auto x:u)v.push_back({x.F,x.S});
        u={};
    }
    for(auto x:v){ans.push_back(x.F*x.S);}//cout<<x.F<<" "<<x.S<<endl;}
    sort(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++){
        if(i)cout<<" ";
        cout<<ans[i];
    }
    cout<<endl;
    }
}



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

#define ALL(a)  (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define REP(i,n) for(int i=0;i<(int)n;++i)

#define CLEAR(a) memset((a), 0, sizeof(a))

inline int toInt(string s) { int x; istringstream iss(s); iss >> x; return x; }
template<class T> inline string toString(T x) { ostringstream oss; oss <<x ; return oss.str(); }
template<class T> inline T sqr(T x) { return x * x; }

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(int argc, char *argv[]) {
    int k;
    int ans = 0;
    cin >> k;
    for (int i = 1; i <= k; i++) {
        for (int j = i + 1; j <= k; j++) {
            if ((i % 2) != (j % 2)) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, A):
    b = [0] * N
    for a in A:
        for i in a:
            b[i-1] += 1
    return b.count(0)


def main():
    N, K = read_int_n()
    A = []
    for _ in range(K):
        read_int()
        A.append(read_int_n())
    print(slv(N, K, A))


if __name__ == '__main__':
    main()


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

int main(){
long long a, b, k;
cin >> a >> b >> k;
if(k <= a){
	cout << a - k << ' ' << b <<endl;
}
  else if(k <= a+b){
 cout << 0 << ' ' << b - (k-a) <<endl;
 }
  else{
 cout << 0 << ' ' << 0 <<endl;
}
  return 0;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<math.h>
#include<stdlib.h>
using namespace std;
#define int long long
//#define double long double
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, pii > pip;
typedef pair<pii, pii > piipii;
typedef pair<double, double> pdd;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define all(vec) vec.begin(), vec.end()
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60)
#define mod 1000000007
#define se second
#define fi first

int N, Q;

int par[100100];
int rnk[100100];
int dif[100100];

void init(){
    for(int i = 0; i < N; i++){
        par[i] = i;
        rnk[i] = 0;
        dif[i] = 0;
    }
}

int root(int x){
    if(x == par[x]){
        return x;
    }
    else {
        int r = root(par[x]);
        dif[x] += dif[par[x]];
        return par[x] = r;
    }
}

bool same(int x, int y){
    return (root(x) == root(y));
}

int weight(int x){
    root(x);
    return dif[x];
}

int diff(int x, int y){
    return weight(y) - weight(x);
}

bool unite(int x, int y, int w){
    w += weight(x);
    w -= weight(y);

    x = root(x);
    y = root(y);

    if(rnk[x] < rnk[y]){
        swap(x, y);
        w = -w;
    }
    if(rnk[x] == rnk[y]){
        rnk[x]++;
    }
    par[y] = x;

    dif[y] = w;

    return true;
}

signed main(){
    cin >> N >> Q;
    init();
    for(int i = 0; i < Q; i++){
        int c, x, y, z;
        cin >> c >> x >> y;
        if(c){
            if(!same(x, y)){
                cout << "?" << endl;
            }
            else cout << diff(x, y) << endl;
        }
        else {
            cin >> z;
            unite(x, y, z);
        }
    }
    
    return 0;
}

/*

*/


Measured memory_bytes: 5428
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    long long int i,j,k,l,inc,dec,t,r,mod=1000000007;
   	long long int c,d,e,s,ans=0,n,temp,m,p,x,y;
   	//cin>>t;
   	t=1;
   	while(t--)
   	{
   		cin>>n>>k;
   		long long int w[n+1],v[n+1],dp[n+1][k+1];
   		for(i=1;i<=n;i++)
   		{
   			cin>>w[i]>>v[i];
		}
		for(i=0;i<=n;i++)
		{
			for(j=0;j<=k;j++)
			{
				if(i==0 ||j==0)
				dp[i][j]=0;
				else if(w[i]>j)
				dp[i][j]=dp[i-1][j];
				else
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
			}
		}
		cout<<dp[n][k]<<endl;
		
	}
   	
	
   return 0;
}


Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
int const M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e9+10;
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
ll pow(ll a, ll b){ll res = 1;for(int i = 1; i<=b; ++i) res *= a;return res;}
ll isPrime(ll n){for(ll i=2; i<=sqrt(n); i++){if(n%i==0) return 0;}return 1;}
ll fact(ll n){if(n==0 || n==1) return 1; else return n*fact(n-1);}
ll gcd (ll a, ll b) {return b ? gcd (b, a % b) : a;}
ll lcm(ll a, ll b){return (a/gcd(a,b))*b;}
int a[18]={2,3,5,7,11,13,13,17,19,23,29,31,37,41,43,47,53,59};
ll binarySearch(ll low,ll high,ll key){while(low<=high){ll mid=(low+high)/2;if(a[mid]<key){low=mid+1;}else if(a[mid]>key){high=mid-1;}else{return mid;}}return -1;}
void Sieve(ll n, ll prime[]){for(int p=2; p*p<=n; p++){if(prime[p] == true){for(int i=p*2; i<=n; i += p)prime[i] = false;}}for(int p=2; p<=n; p++)if(prime[p])cout << p << " ";}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	if(n==1) cout << "Hello World";
	else{
        ll a,b;
        cin >> a >> b;
        cout << a+b;
	}
	return 0;
}
/* The judge is never wrong! Your code is buggy 😈
   Look for:
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

class union_find():
    
    def __init__(self,n):
        self.n=n
        self.root=[-1]*(n+1)
        self.rank=[0]*(n+1)

    def find_root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x]=self.find_root(self.root[x])
            return self.root[x]

    def unite(self,x,y):
        x=self.find_root(x)
        y=self.find_root(y)

        if x==y:
            return 
        elif self.rank[x]>self.rank[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y

            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1

    def same(self,x,y):
        return self.find_root(x)==self.find_root(y)

    def cnt(self,x):
        return -self.root[self.find_root(x)]

n=int(input().rstrip())
G=union_find(n)
g=[]
for k in range(n):
    a=[int(i) for i in input().split()]
    for j in range(n):
        if a[j]!=-1:
            g.append((k,j,a[j]))
g.sort(key=lambda x:x[2])
ans=0
for i in g:
    u,v,c=i
    if not G.same(u,v):
        G.unite(u,v)
        ans+=c
print(ans)


Measured memory_bytes: 6480
#include<stdio.h>
int main(void)
{
	int n,c,z[11],x,i;
	while(1){
		c=0;
		scanf("%d",&n);
		if(n==-1) break;
		while(1){
			x=n/4;
			if(x<1) break;
			z[c]=n%4;
			n=x;
			c++;
		}
		printf("%d",n);
		for(i=c-1;i>=0;i--) printf("%d",z[i]);
		printf("\n");
	}
	return 0;
}
	

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

int main(){
  int n;
  cin >> n;
  vector<double> vec(n);
  for (int i = 0; i < n;i++){
  cin >> vec.at(i);
  }
  sort(vec.begin() , vec.end());
  double l = 0;
  l = vec.at(0);
  for(int i = 0; i < n-1;i++){
  l += pow(2,i)*vec.at(i+1);
  }
  double m,s;
  m = pow(2,n-1);
  s = l / m;
  cout << s;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
#include<string>
#define ll long long

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
//const ll N=1e5+5;



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

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<string, int> P;
typedef long long LL;
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IFOR(v,it) for(auto it=(v).begin();it!=(v).end();++it)
#define RIFOR(v,it) for(auto it=(v).rbegin();it!=(v).rend();++it)
#define IN_LL(v) LL v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
#define MOD 1000000007


int main() {
  IN(N);
  IN(Q);

  queue<pair<string, int>> q;
  REP(i, N) {
    string name;
    int time;
    cin >> name >> time;
    q.push(MP(name, time));
  }
  int time = 0;
  while (!q.empty()) {
    P p = q.front(); q.pop();
    if (p.second <= Q) {
      time += p.second;
      OUT(p.first << " " << time);
    } else {
      time += Q;
      q.push(MP(p.first, p.second - Q));
    }
  }
  return 0;
}



Measured memory_bytes: 6268
#include "bits/stdc++.h"
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
int main(){
	string a,b,c;
	cin >> a >> b >> c;
	if(a[a.length()-1] == b[0]&&b[b.length()-1] == c[0]){
		cout << "YES" << endl;
	}else cout << "NO" << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m,n;
    	string s;
    	cin>>n>>s;
    	ll r=0,g=0,b=0,ans=0;
    	for(i=0;i<n;i++)
    	{
    		if(s[i]=='R')r++;
    		if(s[i]=='G')g++;
    		if(s[i]=='B')b++;
    	}
    	// cout<<r<<" "<<g<<" "<<b;
    	ans=r*g*b;
    	for(i=0;i<n;i++)
    	{
    		for(j=0;j<=n;j++)
    		{
    			r=0;g=0;b=0;
    			ll x=i;
    			ll y=j+x;
    			ll z=y+j;
    			if(z>=n) continue;

    			if(s[x]!=s[y]&&s[x]!=s[z]&&s[y]!=s[z]) 
    			{
    				// cout<<x<<" "<<y<<" "<<z<<endl;
    				ans--;
    			}
    		}
    	}
    	cout<<ans;
    }
    return 0;
}

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

int n,m,k;
long long inv[900010],fac[900010],p[900010],ans;
const long long mod=1e9+7;
inline long long ksm(long long x,long long y)
{
	long long res=1;
	while(y)
	{
		if(y&1)
		res=res*x%mod;
		x=x*x%mod;
		y>>=1;
	} 
	return res;
}
inline long long c(int x,int y)
{
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	if(m<k)
	swap(m,k);
	p[0]=1ll;
	fac[0]=1ll;
	inv[0]=1ll;
	for(int i=1;i<=9e5;++i)
	{
		p[i]=p[i-1]*3ll%mod;
		fac[i]=fac[i-1]*i%mod;
	}
	inv[900000]=ksm(fac[900000],mod-2);
	for(int i=9e5-1;i>=1;--i)
	inv[i]=inv[i+1]*(long long)(i+1)%mod;
	long long x=1;
	--n;
	for(int i=0;i<=m+k;++i)
	{
		ans=(ans+c(n+i,n)*p[m+k-i]%mod*x)%mod;
		if(i<k)
		x=x*2ll%mod;
		else if(i<m)
		x=(x*2ll-c(i,k)+mod)%mod;
		else 
		x=(x*2ll-c(i,k)-c(i,m)+mod+mod)%mod;		
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define v(d_type) vector<d_type>
#define p(d_type1, d_type2) pair<d_type1, d_type2>
#define F first
#define S second
#define loop(i, s, n) for(int i = s; i < n; i++)
#define nl "\n"
#define fat 1000000007

int main()
{
    boost;
    int n, k, q;
    cin >> n >> k >> q;
    
    v(int) arr(n + 1, k - q);

    loop(i, 0, q)
    {
        int a;
        cin >> a;
        arr[a]++;
    }

    loop(i, 1, n + 1)
    {
        if(arr[i] > 0) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 1024
import sys


def height(i):
    return 5 * i - 5


def time(v):
    return v/9.8


def y(t):
    return t*t*4.9


for user in sys.stdin:
    h = float(user)
    y1 = y(time(h))
    i = 1
    while True:
        if y1 < height(i):
            print(i)
            break
        else:
            i += 1

Measured memory_bytes: 7380
function main(input){
    input = input.split('\n');
    inputN = parseInt(input[0]);
    inputS = input[1];
    leng = inputS.length;
    out = 0;

    for(i=0;i<leng-2;i++){
        if(inputS[i]=='A' && inputS[i+1]=='B' && inputS[i+2]=='C'){
            out++;
        }
    }

    console.log(out);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
h, w, d = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]

iti = [[] for _ in range(h*w + 1)]

for h_ in range(h):
    for w_ in range(w):
        iti[a[h_][w_]].append(w_+1)
        iti[a[h_][w_]].append(h_+1)

#累積和的なやつ
s_d = [[] for _ in range(d+1)]
for i in range(1, d+1): # i:= スタート位置　1からｄまである
    now = i
    s_d[i].append(0) # スタート位置のコストは０
    while now + d <= h*w:
        s_d[i].append(s_d[i][-1] + abs(iti[now][0]-iti[now+d][0]) + abs(iti[now][1]-iti[now+d][1]))
        now += d
#print(s_d)

def query(l, r):
    idx = l % d # スタート位置 = idx　
    if idx == 0:
        idx = d
    # s_d[idx]の配列を使用
    # l, rをs_d[idx]上のインデックスに合わせる
    l_d = l // d
    r_d = r // d
    if l % d == 0:
        l_d -= 1
        r_d -= 1
    cost = s_d[idx][r_d] - s_d[idx][l_d]
    return cost


q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(query(l, r))


Measured memory_bytes: 99608
n, m = map(int, input().split())
lstn = [input() for _ in range(n)]
lstm = [input() for _ in range(m)]

for i in range(n - m + 1):
    for j in range(n - m + 1):
        a = True
        for k in range(m):
            if lstn[i + k][j : j + m] != lstm[k]:
                a = False
                break
        if a:
            print('Yes')
            quit()
print('No')


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

int main() {
  string numstr; cin >> numstr;
  int A = stoi(numstr.substr(0, 1)), B = stoi(numstr.substr(1, 1)), C = stoi(numstr.substr(2, 1)), D = stoi(numstr.substr(3, 1));
  for (int b_bit = -1; b_bit < 2; b_bit += 2) {
    for (int c_bit = -1; c_bit < 2; c_bit += 2) {
      for (int d_bit = -1; d_bit < 2; d_bit += 2) {
        if (A + b_bit * B + c_bit * C + d_bit * D == 7) {
          cout << A;
          if (b_bit == 1) cout << "+";
          else cout << "-";
          cout << B;
          if (c_bit == 1) cout << "+";
          else cout << "-";
          cout << C;
          if (d_bit == 1) cout << "+";
          else cout << "-";
          cout << D;
          cout << "=7" << endl;
          return 0;
        }
      }
  	}
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(int i=a;i<b;i++)
#define bfr(i,a,b) for(int i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
#define mod 1000000007 
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back

#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 

/*
bool comp(pair<lli,lli> &a,pair<lli,lli> &b)
{
    if()
}*/




int main()
{
                       
         

      
                    
          fio
          

         lli n;
         cin>>n;
         lli k= n/500;
         lli ans=k*1000;
         n%=500;
         ans+=(n/5)*5;
         cout<<ans;
        
          
          
          

         










          





                     
return 0;}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int i,N,j;
  int minj,tmp,count=0;
  int A[100];
  scanf("%d",&N);
  for(i=0;i<N;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=0;i<N;i++)
    {
      minj=i;
      for(j=i;j<N;j++)
	{
	  if(A[j]<A[minj])
	    {
	      minj=j;
	    }
	}
      if(minj!=i){
	tmp=A[i];
	A[i]=A[minj];
	A[minj]=tmp;
	count++;
      }
    }
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i!=N-1)printf(" ");
  }printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int N, K; cin >> N >> K;
    vector<int> h(N);
    rep(i, 0, N) cin >> h[i];

    sort(h.begin(), h.end());

    int res = 2000000000;

    for (int left = 0, right = K-1; right < N; ++left, ++right) {
        int diff = h[right] - h[left];
        res = min(res, diff);
    }

    cout << res << "\n";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";



int main() {
    cin>>N>>K;
    vector<int> value(N,0);
    rep(i,N) cin>>value.at(i);
    int R = min(N,K);
    priority_queue<int, vector<int>, greater<int> > pque;
    int ans = 0;
    int final_ans = 0;
    int K_R = K-R;
    rep(i,R+1){
        rep(a,R+1-i){
            int b = R-i-a;
            rep(j,a) {
                ans += value.at(j);
                if(value.at(j) < 0) pque.push(value.at(j));
            }
            rep(j,b) {
                ans += value.at(N-1-j);
                if(value.at(N-1-j) < 0) pque.push(value.at(N-1-j));
            }
            
            rep(j,i+K_R){
                if(!pque.empty()){
                    ans -= pque.top();
                    pque.pop();
                }
            }
            while(!pque.empty()) pque.pop();
            final_ans = max(final_ans,ans);
            ans = 0;
        }
    }
    cout<<final_ans<<endl;
}

Measured memory_bytes: 256
import Data.List

evens (x:xs) = x:odds xs
evens _ = []

odds (_:xs) = evens xs
odds _ = []

func1::Char->[Char]->Bool
func1 t s = notElem t s

main::IO ()
main = do
    i <- getLine
    let a = func1 'L' $ evens i
    let b = func1 'R' $ odds i
    putStrLn $ if a && b then "Yes" else "No"

Measured memory_bytes: 508
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;


int main() {
  int N;
  cin >> N;
  vector<long> T, A;
  long t, a;
  for(int i = 0; i < N; ++i) {
    cin >> t >> a;
    T.push_back(t);
    A.push_back(a);
  }

  for(int i = 1; i < N; ++i) {
    long k, l;
    if((T[i-1] > T[i])or(A[i-1] > A[i])) {
      k = T[i-1] / T[i];
      //cout << k;
      if(T[i-1] != T[i] * k) {
        ++k;
      }
      l = A[i-1] / A[i];
      //cout << l;
      if(A[i-1] != A[i] * l) {
        ++l;

    }

    T[i] *= max(k, l);
    A[i] *= max(k, l);
  }
    //out << k << l<< endl;

  }
  //cout << T[0] << T[1] << T[2]  << endl;
  //cout << A[0] << A[1] << A[2] << endl;
  cout << T[N-1] + A[N-1] << endl;
  return 0;


}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(a==b&&c==d || a==d&&b==c){
		printf("yes\n");
	}
	else{
		printf("no\n");
	}
	return 0;
}


Measured memory_bytes: 2084
def bellman_ford(vertices, edges, source):
    for v in vertices:
        if v is source:
            v.distance = 0
        else:
            v.distance = Infinity()
        v.predecessor = None
    for _ in xrange(len(vertices)-1):
        for uv in edges:
            u = uv.source
            v = uv.destination
            if v.distance > u.distance + uv.weight:
                v.distance = u.distance + uv.weight
                v.predecessor = u
    for uv in edges:
        u = uv.source
        v = uv.destination
        if u.distance + uv.weight < v.distance:
            raise NegativeCycleError

def main():
    V, E, r = map(int, raw_input().split())
    vertices = [Vertex() for _ in xrange(V)]
    edges = []
    for _ in xrange(E):
        s, t, d = map(int, raw_input().split())
        edges.append(Edge(vertices[s], vertices[t], d))
    try:
        bellman_ford(vertices, edges, vertices[r])
        for v in vertices:
            print v.distance
    except NegativeCycleError:
        print "NEGATIVE CYCLE"

class Infinity(object):
    def __eq__(self, other):
        return other is self

    def __lt__(self, other):
        return False

    def __gt__(self, other):
        return True

    def __add__(self, other):
        return self

    def __radd__(self, other):
        return self

    def __str__(self):
        return "INF"
    __repr__ = __str__

class NegativeCycleError(Exception):
    pass

class Edge(object):
    def __init__(self, source, destination, weight):
        self.source = source
        self.destination = destination
        self.weight = weight

class Vertex(object):
    def __init__(self, distance=None, predecessor=None):
        self.distance = distance
        self.predecessor = predecessor

if __name__ == "__main__":
    main()

Measured memory_bytes: 5404
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <climits>
#include <algorithm>
using namespace std;
const int N = 200007;
int n;
long long sum, preSum[N];
int main()
{
	while (~scanf("%d", &n)) {
		preSum[0] = sum = 0;
		for (int i = 1; i <= n; ++i) {
			scanf("%lld", preSum + i);
			preSum[i] += preSum[i - 1];
		}
		long long minV = min(abs(preSum[n] - preSum[1] * 2), abs(preSum[n] - preSum[n - 1] * 2));
		for (int i = 2; i < n; ++i) {
			minV = min(minV, abs(preSum[n] - preSum[i] * 2));
		}
		printf("%lld\n", minV);
	}

	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,m,x; cin>>n>>m>>x;
    vector<int> p(n,0);
    rep(i,m){
        int a; cin>>a;
        p[a]++;
    }
    int an=0, ans=0;
    rep(i,x){
        if(p[i]==1) an++;
    }
    for(int i=x+1; i<n; ++i){
        if(p[i]==1) ans++;
    }
    ans=min(ans,an);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  if(N<1000)
  {
    cout << "ABC";
  }
  else
  {
    N -= 999;
    cout << "ABD";
  }
  return 0;
}


Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;

int main(){
  int A;
  int B;
  cin >> A >> B;
  int cnt = 0;
  int all = 1;
  while(all < B){
    all += A-1;
    cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

bool is_prime[1000010];


int main() {
    int h,w,k,cntb = 0,ans = 0;
    cin >> h >> w >> k;
    char c[h][w];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> c[i][j];
            if(c[i][j] == '#') cntb++;
        }
    }

    for (int bit = 0; bit < (1<<h); ++bit) {
        for (int bit2 = 0; bit2 < (1<<w); ++bit2) {
            int tmp = 0;
            for (int i = 0; i < h; ++i) {
                for (int j = 0; j < w; ++j) {
                    if(!(bit & (1<<i)) && !(bit2 & (1<<j)) && c[i][j] == '#') tmp++;
                }
            }
            if(tmp == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
B = [int(input()) for _ in range(n)]
ans = False

bingolist = []
for i in range(3):
  bingolist.append([A[i][0], A[i][1], A[i][2]])
  bingolist.append([A[0][i], A[1][i], A[2][i]])

bingolist.append([A[0][0], A[1][1], A[2][2]])
bingolist.append([A[2][0], A[1][1], A[0][2]])

for i in bingolist:
  if i[0] in B and i[1] in B and i[2] in B: ans = True
  
print("Yes" if ans else "No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
const int INF =100100100;
const int MOD = (int)1e9+7;
const double EPS = 1e-9;
typedef long long ll;
typedef long li;
#define pb push_back 
#define mp make_pair

signed main (){	
	int HH,WW;
	cin >> HH >> WW;
	int temp;
	queue < pair <int,int> > ans ; //答え
	bool used[HH][WW]; // コイン移動の始点になったます
	bool tables[HH][WW]; //コインのあるます
	rep(i,HH){
		rep(j,WW){
			used[i][j] = false;
			cin >> temp;
			if(temp%2==0){
				tables[i][j]=false;
			}
			else{
				tables[i][j]=true;
			}
		}
	}
	pair <int,int> temps;
	rep(i,HH){
		rep(j,WW){
			if(j==WW -1) continue;
			else if(tables[i][j]==true){
				tables[i][j+1] = !(tables[i][j+1]);
				ans.push(mp(i,j));
			}
		}
	}
	rep(i,HH){
		if(i== HH-1) break;
		else if(tables[i][WW-1]==true){
			tables[i+1][WW-1] = !(tables[i+1][WW-1]);
			ans.push(mp(i,WW-1));
		}
	}
	cout << ans.size() << endl;
	while(ans.size()!=0){
		temps = ans.front();
		ans.pop();
		if(temps.second==WW-1){
			cout << temps.first+1 << " " << temps.second+1 << " " << temps.first+1+1 << " " << temps.second+1 <<endl;
		}
		else{
			cout << temps.first+1 << " " << temps.second+1 << " " << temps.first+1 << " " << temps.second+1+1 <<endl;	
		}
	}
	return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}

int main(){
	int a, b, ans;
	cin >> a >> b;
	ans = (a>0 && a<10 && b>0 && b<10)? a*b : -1;
	cout << ans << endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cout <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cout <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;

const int max_n = 1e5 + 5;
int n, m;
const int mod = 1e9 + 7;
char s[1005][1005];
int dp[1005][1005];

int main () {
	read2(n, m);
	FOR(i,0,n) {
		scanf("%s", s[i]);
	}
	dp[0][0] = 1;
	FOR(i,0,n) {
		FOR(j,0,m) {
			if (i == 0 && j == 0) continue;
			if (s[i][j] == '#') dp[i][j] = 0;
			else {
				dp[i][j] = 0;
				if (i > 0) dp[i][j] += dp[i-1][j];
				if (j > 0) dp[i][j] += dp[i][j-1];
				if (dp[i][j] >= mod) dp[i][j] -= mod;
			}
		}
	}
	printf("%d\n", dp[n-1][m-1]);

}	





Measured memory_bytes: 5120
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 998244353
#define floop(i,a,b) for (int i=(a);i<(b);i++)
#define rloop(i,a,b) for (int i=(a);i>=(b);i--)
#define floopeq(i,a,b) for (int i=(a);i<(b);i++)
#define pa pair<int,int>
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll modInverse(ll a, ll m) 
{ ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0; while (a > 1){ ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } 
    if (x < 0) x += m0; return x; 
}
ll power(ll x, ll y, ll p)  
{  
    ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)  
    {if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;  }  return res;  
}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b){if(a.fi==b.fi)return b.se>a.se;return a.fi>b.fi;}
void run(vector<int>v){for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;}
void solve()
{
    ll n;
    cin>>n;
    ll a[n];ll top = 1e18;ll ans=1;
    floop(i,0,n)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            cout<<0<<endl;return;
        }
    }
    floop(i,0,n)
    {
        if(a[i]>(top/ans))
        {
            cout<<-1;return;
        }
        else
            ans = ans*a[i];
    }
    cout<<ans<<endl;return;

}

int main() 
{ 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
        solve();
        
    
    
    return 0; 
} 

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b; 
        return true;
    }
    return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b; 
        return true;
        
    }
    return false;
}

void Main(){
    string s; cin >> s;
    int n = s.size() + 1;
    vi a(n);
    rep(i, n-1){
        if(s[i] == '<'){
            chmax(a[i+1], a[i]+1);
        }
    }
    rep3rev(i, n-2, 0){
        if(s[i] == '>'){
            chmax(a[i], a[i+1]+1);
        }
    }
    ll sum = 0;
    rep(i, n){
        sum += a[i];
    }
    cout << sum << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 5788
n = int(input())
a = list(map(int, input().split()))

cnt = 0
flg = True
while flg:
  flg = False
  minus = 0
  for i in range(0, len(a)):
    if not a[i+minus]%2:
      a[i+minus] = a[i+minus] / 2
      flg = True
      cnt += 1
      break
    else:
      a.pop(i+minus)
      minus -= 1

print(cnt)

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

using namespace std;

using int64 = long long;

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

  int n, k;
  cin >> n >> k;
  if (k > (n - 1) * (n - 2) / 2) {
    cout << -1;
    return 0;
  }

  vector<pair<int, int>> edges;
  for (int i = 2; i <= n; i++) {
    edges.push_back(make_pair(1, i));
  }

  int count = (n - 1) * (n - 2) / 2;
  for (int i = 2; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (count == k) continue;
      edges.push_back(make_pair(i, j));
      count--;
    }
  }

  cout << edges.size() << endl;
  for (auto edge : edges) {
    cout << edge.first << " " << edge.second << endl;
  }
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int K, A, B;
    cin >> K >> A >> B;
    for (int i = A; i <= B; i++) {
        if (i%K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3048
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

const int K = 30;

int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<bool> visit(K);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    sum ^= x;
    int k = 0;
    while (x % 2 == 0) x /= 2, k += 1;
    visit[k] = true;
  }

  int ret = 0;
  for (int k = K - 1; k >= 0; --k) {
    if ((sum >> k) & 1) {
      if (!visit[k]) {
        cout << -1 << '\n';
        return 0;
      }
      sum ^= (1 << (k + 1)) - 1;
      ++ret;
    }
  }
  cout << ret << '\n';

  return 0;
}


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

int main() {
  
  int N ;
   
  cin >> N ;
  
  if(N%10 == 3){
  	cout << "bon" << endl;    
  }else if(N%10==0||N%10==1||N%10==6||N%10==8){
  	cout << "pon" << endl;
  }else{
  	cout << "hon" << endl;
  }
  
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
void f(char c,int n=1){
  for(int i=0;i<n;++i)cout<<c;
}
main(){
  int sx,sy,tx,ty,dx,dy;
  cin>>sx>>sy>>tx>>ty;
  dx=tx-sx;
  dy=ty-sy;
  f('R',dx);
  f('U',dy);
  f('L',dx);
  f('D',dy);
  
  f('D');
  f('R',dx+1);
  f('U',dy+1);
  f('L');
  
  f('U');
  f('L',dx+1);
  f('D',dy+1);
  f('R');
  cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<numeric>
#include<algorithm>
#define int long long
const int inf=1145141919;
const int mod=1000000007;
using namespace std;
template<class T>void chmax(T &x,const T &y){
	x=max(x,y);
}
template<class T>void chmin(T &x,const T &y){
	x=min(x,y);
}
int N,M;
signed main(){
	int i,j,k;
	string s;
	cin>>s;
	if(s.size()>=4&&s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

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

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  int yaku;
  for (int j = 1; j <= n; j=j+2) {
    for (int i = 1; i <= j; ++i) {
      if (j % i == 0) yaku++;
    }
    if (yaku == 8) ans++;
    yaku = 0;
  }

  cout << ans << endl;
  return 0;
}


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

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

vector<pair<ll, int>> factorize(ll n)
{
    vector<pair<ll, int>> res;
    for (ll i = 2; i * i < n; i++)
    {
        if (n % i)
            continue;
        res.emplace_back(i, 0);
        while (n % i == 0)
        {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1)
        res.emplace_back(n, 1);
    return res;
}

int main()
{
    ll a, b;
    cin >> a >> b;

    ll g = gcd(a, b);
    auto f = factorize(g);
    int ans = f.size() + 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

const int N=100005;
const int P=998244353;

int a,b,c;
int x,y;

void init(){
	cin>>a>>b>>c>>x>>y;
	if(2*c>=a+b){
		printf("%d\n",a*x+b*y);
	}
	else{
		printf("%d\n",
			min(
			(x-min(x,y))*a+(y-min(x,y))*b+min(x,y)*c*2,
			max(x,y)*c*2
			)
			);
	}
}

int main(){
	init();
	return 0;
}

Measured memory_bytes: 256
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n,a,b;
		cin>>n>>a>>b;
		ll int d=n/(a+b);
		ll int ans=d*a;
		n-=d*(a+b);
		ans+=min(a,n);
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 256
function Main(input){
  var arr = input.split(" ");
  arr.sort(function(a,b){
    return (a < b ? 1 : -1);
  });
  var sum = parseInt(arr[0],10) * 10  + parseInt(arr[1],10) + parseInt(arr[2],10)
  console.log(sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
N = int(input())
a = []
for i in range(N):
    a.append(list(map(int, input().split())))
    
number = 0
    
for i in range(N):
  abc = a[i-1]
  first = abc[0]
  last = abc[1]
  abc_number = last - first + 1
  number += abc_number

print(int(number))  

Measured memory_bytes: 3188
def countingSort(A,k):
    #カウント配列初期化
    C=[0 for _ in range(k+1)]

    #Aの各要素の出現数をカウント
    for i in range(len(A)):
        C[A[i]]+=1

    #カウント配列の累積和をとる->AにC[i]以下の数はいくつあるかわかる
    for i in range(1,k+1):
        C[i]=C[i]+C[i-1]

    B=[0 for _ in range(len(A))]
    for i in range(len(A)-1,-1,-1):
#        print(i,A,B,C)
        C[A[i]]-=1
        B[C[A[i]]] = A[i]

    return B


n=int(input())
a=list(map(int,input().split()))
ans=countingSort(a, max(a))
print(*ans)



Measured memory_bytes: 224384