akhauriyash/Code-Regression huggingface dataset:
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
using namespace std;

int gcd(int a, int b){
  if (a==0){
    return b;
  } else if (b==0){
    return a;
  }
  
  int r = a % b;
  
  while (r != 0){
    a=b;
    b=r;
    r= a % b;
  }
  
  return b;
}

int main(){
  
  int i,n;
  int m=0;
  cin >> n;
  vector<int> a(n);
  vector<int> l(n);
  vector<int> r(n);
  
  for (i=0; i<n; i++){
    cin >> a[i];
  }
  
  l[0]=0;
  r[n-1]=0;
  
  for (i=1; i<n; i++){
    l[i]=gcd(l[i-1], a[i-1]);
    r[n-i-1]=gcd(r[n-i], a[n-i]);
  }
  
  for (i=0; i<n; i++){
    m=max(m, gcd(l[i], r[i]));
  }
  
  cout << m << endl;
 
  return 0;
}


Measured memory_bytes: 1408
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
out = [0] * N
for i in range(N-1):
  for j in range(i+1, N):
    out[min(j-i, abs(i-X)+1+abs(j-Y))] += 1
for i in range(1, N):
  print(out[i])

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

while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        x = (c*e - b*f) / (a*e - b*d)
        y = (a*f - d*c) / (a*e - b*d)
        print('{:.3f} {:.3f}'.format(x+0, y+0))
    except:
        break

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

LL A,B,C,D;
LL rd() {LL r;cin >> r; return r;}
LL gcd(LL a, LL b) {
	return b==0 ? a : gcd(b, a%b);
}

void solve() {
	A = rd(), B = rd(), C = rd(), D = rd();

	if (A < B) {
		puts("No");
		return ;
	}

	if (B > D) {
		puts("No");
		return ;
	}

	if (B <= C) {
		puts("Yes");
		return ;
	}

	if (gcd(B, D) == 0) {
		puts("Yes");
		return ;
	}

	A %= B;
	LL k = (B-1-A) / gcd(B, D);
	if (A+k*gcd(B, D) <= C)
		puts("Yes");
	else
		puts("No");

	return ;
}

int main() {
	for (LL T=rd();T;T--) solve();
	return 0;
}

Measured memory_bytes: 256
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

N = ii()

pt = 0
px = 0
py = 0

for _ in range(N):
  t, x, y = mi()
  mnht = abs(x-px) + abs(y-py)
  if not (t-pt >= mnht and (t-pt)%2 == mnht % 2):
    print('No')
    exit()

print('Yes')




Measured memory_bytes: 41068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/*
願はくは花の下にて春死なんそのきさらぎの望月のころ（西行 1118-1190）
--This is old Japanese poem expressing the desire to die under tree on the full moon night.(written by Saigyo)
In my research, there is possibility that the tree may be seg-tree.
*/

/*Coding Space*/
int main(){
  ll a,b,c,k; cin >> a >> b >> c >> k;
  cout << (k%2? b-a : a-b) << endl;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    vector<ll>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    vector<ll>b;
    for (int i = n-1; i>=0;--i) {
        if(a[i]==1){
            b.push_back(i+1);
            a[0]=1-a[0];
            for (int j = 2; j*j<=(i+1); ++j) {
                if((i+1)%j==0){
                    a[j-1]=1-a[j-1];
                    if(j*j!=(i+1)) {
                        a[((i + 1) / j) - 1] = 1 - a[((i + 1) / j) - 1];
                    }
//                    cout <<j-1<<endl;
                }
            }
        }
    }
    ll m=b.size();
    cout <<m<<endl;
    for(auto e:b){
        cout <<e<<" ";
    }
    cout <<endl;
    return 0;
}

Measured memory_bytes: 3572
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long int


signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, d;
	cin >> n >> d;
	cout << (n / (2*d + 1)) + (n % (2*d + 1) > 0);
}

Measured memory_bytes: 256
#include<iostream>

int n,m,a[1001],b[1001],data[1001];

int main(){
	std::cin>>n>>m;
	for(int i=0;i<n;i++)std::cin>>a[i];
	for(int i=0;i<m;i++)std::cin>>b[i];
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			if(a[j]<=b[i]){
				data[j]++;
				break;
			}
		}
	}
	int max=0;
	for(int i=0;i<n;i++){
		if(data[i]>data[max])max=i;
	}
	std::cout<<max+1<<std::endl;
	return 0;
}

Measured memory_bytes: 1176
n, m = map(int, input().split())

keys = [None] * m
dlen = 2**n
inf = float("inf")
dp = [inf] * dlen

for i in range(m):
    a, _ = map(int, input().split())
    c = 0
    for num in map(int, input().split()):
        c += 2 ** (num - 1)
    
    keys[i] = (a, c)

for price, key in keys:
    for i in range(dlen):
        if dp[i] == inf: continue
        new = key | i
        dp[new] = min(dp[new], dp[i] + price)
    
    dp[key] = min(dp[key], price)

ans = dp[-1]
print(ans if ans != inf else -1)


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

// ll A, B, C;
// scanf("%ld %ld %ld", &A, &B, &C);
// printf("%ld %ld %ld", A, B, C);

int main()
{
    float L;
    float l, ans;
    cin >> L;
    l = L/3;
    // cout << "l: " << l << endl;
    ans=l*l*l;
    // cout << ans << endl;
    cout << fixed << setprecision(7) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
T = [int(input()) for _ in range(5)]

ans, remainder = 0, 10
for t in T:
    if t % 10 != 0:
        ans += (t // 10) * 10 + 10
        remainder = min(t % 10, remainder)
    else:
        ans += t
print(ans + remainder - 10)


Measured memory_bytes: 2940
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){
	char buf[101];
	int length,count = 0;
	bool FLG;

	while(scanf("%s",buf)!=EOF){
		length = 0;
		for(int i=0; buf[i] != '\0';i++)length++;
		if(length == 1){
			count++;
			continue;
		}

		FLG = true;
		for(int i = 0; i < length/2; i++){
			if(buf[i] != buf[length-1-i]){
				FLG = false;
				break;
			}
		}
		if(FLG)count++;
	}

	printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 2612
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 100005

int table[SIZE];

int main(){

	int N,num_query;
	scanf("%d %d",&N,&num_query);

	for(int i = 0; i < N; i++){

		scanf("%d",&table[i]);
	}

	sort(table,table+N);

	int left,right;
	int LEFT,RIGHT;
	int L,R,mid;

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d %d",&left,&right);

		L = 0,R = N-1,mid = (L+R)/2;
		LEFT = N;

		while(L <= R){

			if(table[mid] >= left){

				LEFT = mid;
				R = mid-1;

			}else{

				L = mid+1;
			}
			mid = (L+R)/2;
		}

		if(LEFT == N)continue;

		L = 0, R = N-1,mid = (L+R)/2;
		RIGHT = -1;

		while(L <= R){

			if(table[mid] <= right){

				RIGHT = mid;
				L = mid+1;
			}else{

				R = mid-1;
			}
			mid = (L+R)/2;
		}

		printf("%d\n",RIGHT-LEFT+1);
	}

	return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,M; cin>>N>>M;
    vector<ll> X(N);
    ll ct[100010]={};

    rep(i,N){
        cin>>X[i];
        ++ct[X[i]];
    }

    vector<ll> modM(M,0);
    vector<ll> modMs(M,0);
    vector<ll> onazi(M,0);

    rep(i,100010){
        modM[i%M]+=ct[i];
        onazi[i%M]+=(ct[i]/2)*2;
    }
    ll ans=0;

    ans+=modM[0]/2;
    //cout<< ans<<"\n";
    reps(i,1,(M+1)/2){
        ll c=min(modM[i],modM[M-i]);
        ans+=c;
        modM[i]-=c;
        modM[M-i]-=c;
        // cout<< ans <<"\n";
    }
    if(M%2==0){
        ans+=modM[M/2]/2;
        modM[M/2]=0;
    }
    reps(i,1,M){
        ans+=min(modM[i],onazi[i])/2;
        // cout<< ans <<"\n";
    }

    cout<< ans <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 4224
/* 
 * Project: AtCoder Beginners Contest 171 D - Replacing
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/21
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;

int n;
int a[100000];
int q;
int b[100000];
int c[100000];

int bin[100001]{};
long long sum;

void solve() {
    long long e;
    for (int i=0;i<q;i++) {
        e = c[i] * bin[b[i]] - b[i] * bin[b[i]];
        sum += e;
        bin[c[i]] += bin[b[i]];
        bin[b[i]] = 0;
        printf("%lld\n",sum);
    }
}

int main() {

    sum = 0;
    scanf("%d", &n);
    for (int i=0;i<n;i++) {
        scanf("%d", &a[i]);
        bin[a[i]]++;
        sum += a[i];
    }
    scanf("%d", &q);
    for (int i=0;i<q;i++) {
        scanf("%d", &b[i]);
        scanf("%d", &c[i]);
    }

    solve();
}

Measured memory_bytes: 4784
def warshall_floyd(graph):
    n_nodes = len(graph)

    froms = []
    for i in range(len(graph)):
        froms.append([])
        for j in range(len(graph[i])):
            if i == j:                          # 同じ点にかえって来る場合  
                froms[i].append(0)
            elif graph[i][j] < float("inf"):    # i -> j間に辺がある場合、ひとまずiをdestに行く直前のnodeとしておく
                froms[i].append(i)
            else:
                froms[i].append(None)

    for k in range(n_nodes):
        for i in range(n_nodes):
            for j in range(n_nodes):
                adj_cost = graph[i][k] + graph[k][j]
                if adj_cost < graph[i][j]:
                    graph[i][j] = adj_cost
                    froms[i][j] = froms[k][j]
    
    has_negative_loop = False
    for i in range(n_nodes):
        if graph[i][i] < 0:
            has_negative_loop = True
            break

    return graph, froms, has_negative_loop

def resolve():
    N, M, R = list(map(int, input().split()))
    R = list(map(int, input().split()))
    adjs = [[float("inf") for _ in range(N)] for __ in range(N)]
    for i in range(M):
        a, b, c = list(map(int, input().split()))
        adjs[a-1][b-1] = c
        adjs[b-1][a-1] = c
    costs, _, __ = warshall_floyd(adjs)
    
    import itertools
    mincost = float("inf")
    for route in itertools.permutations(R):
        src = route[0] - 1
        cost = 0
        for didx in range(1, len(route)):
            dst = route[didx] - 1
            cost += costs[src][dst]
            src = dst
        mincost = min(mincost, cost)
    print(mincost)
    
        

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 77140
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-9;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T& t,const V& v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T& t,const V& v){for(auto &e:t)fill_v(e,v);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	int n,k;
	cin >> n >> k;
	vector<vector<int>> edge;
    for (int i = 9; i <= n; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            if (((i >> j) & 1) == 1) {
            	edge.push_back(vector<int>{j + 1, i});
            }
        }
    }
    cout << edge.size() << endl;
    for(const auto& e : edge){
    	cout << e[0] << " " << e[1] << endl;
    }
    
    string judge;
    for (int i = 0; i < k; i++)
    {
        int res = 0;
        for (int j = 0; j < 8; j++)
        {
            cout << j + 1 << endl;
            cin >> judge;
            if (judge == "Yes") goto end;
            if (judge == "Near") res |= (1 << j);
        }
        cout << res << endl;
        cin >> judge;
        if (judge == "Yes") goto end;
        while (true)
        {            
            cout << res << endl;
            cin >> judge;
        }
        end:;
    }
}




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

int main() {
	int w, h;
	while (cin >> w >> h, w) {
		int move[2] = { -w,w };
		vector<vector<int>>v(w*h,vector<int>(w*h));
		int a;
		for (int i = 0; i < h - 1; i++) {
			for (int j = 0; j < w - 1; j++) {
				cin >> a;
				v[w*i + j][w*i + j + 1] = a;
				v[w*i + j + 1][w*i + j] = a;
			}
			for (int j = 0; j < w; j++) {
				cin >> a;
				v[w*i + j][w*i + j + w] = a;
				v[w*i + j + w][w*i + j] = a;
			}
		}
		for (int i = 0; i < w-1; i++) {
			cin >> a;
			v[w*(h - 1) + i][w*(h - 1) + i + 1] = a;
			v[w*(h - 1) + i + 1][w*(h - 1) + i] = a;
		}
		queue<int> q;
		vector<int>mem(w*h);
		q.push(0); mem[0] = 1;
		while (!q.empty()) {
			int buf = q.front();
			if (buf == w*h - 1) {
				break;
			}
			if (buf%w != w - 1) {
				if (v[buf][buf + 1] == 0 && mem[buf + 1] == 0) {
					q.push(buf + 1); mem[buf + 1] = mem[buf]+1;
				}
			}
			if (buf%w != 0) {
				if (v[buf][buf - 1] == 0 && mem[buf - 1] == 0) {
					q.push(buf - 1); mem[buf - 1] = mem[buf]+1;
				}
			}
			for (int j = 0; j < 2; j++) {
				if (buf + move[j] >= 0 && buf + move[j] < w*h) {
					if (mem[buf + move[j]] == 0 && v[buf][buf + move[j]] == 0) {
						q.push(buf + move[j]); mem[buf + move[j]] = mem[buf] + 1;
					}
				}
			}
			q.pop();
		}
		cout << mem[w*h-1] << endl;
	}
}

Measured memory_bytes: 6060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, m;
double p;
int x[101];

int main(){
	while (cin >> n >> m >> p&&n + m + p){
		double sum = 0;
		REP(i, n){
			cin >> x[i];
			sum += x[i];
		}
		sum *= (100 - p);
		int ans = 0;
		if (x[m - 1] != 0) ans = sum / x[m - 1];
		cout << ans << endl;
	}
}

Measured memory_bytes: 1228
#include <stdio.h>

int main(void) {
	int c[3][3];
	int f = 1;
	int i, j;

	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			scanf("%d", &c[i][j]);
		}
	}

	if (c[0][0] - c[1][0] != c[0][1] - c[1][1]) f = 0;
	if (c[0][1] - c[1][1] != c[0][2] - c[1][2]) f = 0;
	if (c[1][0] - c[2][0] != c[1][1] - c[2][1]) f = 0;
	if (c[1][1] - c[2][1] != c[1][2] - c[2][2]) f = 0;

	printf(f ? "Yes\n" : "No\n");
}


Measured memory_bytes: 128
n,k=[int(j) for j in input().split()]
s,p,r=[int(j) for j in input().split()]
t=input()
ans=0
from itertools import*
for i in range(k):
    l=[]
    for j in range(-(-n//k)):
        tmp=i+k*j
        ss=""
        if tmp<n:
            l.append(t[tmp])
    for i,j in [(k,len(list(v))) for k,v in groupby(l)]:
       ans+=eval(i)*-(-j//2)

print(ans)

Measured memory_bytes: 8884
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll m, k; cin >> m >> k;
  if (k >= (ll)pow(2, m)) {
    cout << -1 << endl;
  } else {
    if (m == 0) cout << "0 0" << endl;
    else if (m == 1) {
      if (k == 0) cout << "0 0 1 1" << endl;
      else cout << -1 << endl;
    } else {
      REP(i, (ll)pow(2, m)) {
        if (i != k) cout << i << ' ';
      }
      cout << k << ' ';
      for (ll i=(ll)pow(2,m)-1; i>=0; i--) {
        if (i != k) cout << i << ' ';
      }
      cout << k << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(){
int A,B;
scanf("%d\n %d",&A,&B);
if(A==1 && B==2){
    printf("%d\n",3);
}
else if(A==1 && B==3){
    printf("%d\n",2);
}
else if(A==2 && B==3){
    printf("%d\n",1);
}
else if(A==2 && B==1){
    printf("%d\n",3);
}
else if(A==3 && B==1){
    printf("%d\n",2);
}
else{
    printf("%d\n",1);
}
return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct d{int r,h;}d;
d ds[200];
int n,m,i,j,t,dp[201];
int c(const void *a,const void *b)
{
	d x=*(d*)a,y=*(d*)b;
	if(x.r==y.r)
		return x.h-y.h;
	else
		return x.r-y.r;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		memset(dp,0,sizeof(dp));
		for(i=0;i<n;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		for(scanf("%d",&m);i-n<m;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		qsort(ds,n+m,sizeof(d),c);
		for(i=t=0;i<n+m;i++)
		{
			for(j=0,dp[i]=1;j<i;j++)
				if(ds[j].r<ds[i].r&&ds[j].h<ds[i].h)
					dp[i]=dp[i]<dp[j]+1?dp[j]+1:dp[i];
			t=t<dp[i]?dp[i]:t;
		}
		printf("%d\n",t);
	}
	return 0;
}

Measured memory_bytes: 644
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if(a < b && b < c) System.out.println("Yes");
		else System.out.println("No");

	}

}



Measured memory_bytes: 26176
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int r, g;
	cin >> r >> g;
	cout << g * 2 - r << endl;
}


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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c;
  return 0;
}

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

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	
	int count = 0;
	REP(i,a,b+1)
	{
		if(c%i == 0) count++;
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define MAX_V 250
int heap[MAX_V]{0};

int main(){
  int n; scanf("%d",&n);
  REP(i,n) scanf("%d",&heap[i]);
  REP(i,n){
    printf("node %d: key = %d, ",i+1,heap[i]);
    if(i>0) printf("parent key = %d, ",heap[(i-1)/2]);
    if(n>2*i+1) printf("left key = %d, ",heap[2*i+1]);
    if(n>2*i+2) printf("right key = %d, ",heap[2*i+2]);
    puts("");
  }
}

Measured memory_bytes: 1016
n=int(input())
R=[list(map(int,input().split())) for _ in range(n)]
B=[list(map(int,input().split())) for _ in range(n)]
B.sort()
ans=0
for b in B:
    L = [ r for r in R if r[0]<b[0] and r[1]<b[1]]
    if len(L)!=0:
        s = L[0]
        for l in L:
            if s[1]<l[1]: s=l
        R.remove(s)
        ans += 1
print(ans)


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

const long long INF = 1LL << 61;
using ll = long long;

typedef pair<ll, ll> ii;

vector<ii> AdjList[140005];

long long W;

vector<ii> S[140005][2];
vector<ll> prefixMin[140005][2];

void dfs(int u){
    if(AdjList[u].empty()){
        S[u][0].emplace_back(0, 0);
        S[u][1].emplace_back(0, 0);
        prefixMin[u][0].push_back(0);
        prefixMin[u][1].push_back(0);
        return;
    }

    int l = AdjList[u][0].first;
    long long w_l = AdjList[u][0].second;
    int r = AdjList[u][1].first;
    long long w_r = AdjList[u][1].second;
    dfs(l);
    dfs(r);

    vector<int> set1;

    int indxC = (int)S[r][0].size()-1;
    int indxD = (int)S[r][1].size()-1;
    for(ii temp1: S[l][0]){
        long long a, b;
        tie(a, b) = temp1;
        long long tempC = INF;
        long long tempD = INF;

        while(indxD >= 0){
            ii temp2 = S[r][1][indxD];
            long long c, d;
            tie(d, c) = temp2;
            if(d <= W - a - w_l - w_r){
                tempC = prefixMin[r][1][indxD]+w_r; // to change
                break;
            }else{
                indxD --;
            }
        }
        if(indxD == -1){break;}

        if(tempC < INF){
            S[u][0].emplace_back(tempC, b+w_l);
            S[u][1].emplace_back(b+w_l, tempC);
            if(u == 1){break;}
        }
    }

    for(ii temp1: S[l][1]){
        long long a, b;
        tie(b, a) = temp1;
        long long tempD = INF;

        while(indxC >= 0){
            ii temp2 = S[r][0][indxC];
            long long c, d;
            tie(c, d) = temp2;
            if(c <= W - b - w_l - w_r){
                tempD = prefixMin[r][0][indxC]+w_r; // to change
                break;
            }else{
                indxC --;
            }
        }
        if(indxC == -1){break;}

        if(tempD < INF){
            S[u][0].emplace_back(a+w_l, tempD);
            S[u][1].emplace_back(tempD, a+w_l);
            if(u == 1){break;}
        }
    }

    if(u == 1){return;}

    sort(S[u][0].begin(), S[u][0].end());
    sort(S[u][1].begin(), S[u][1].end());

    int tempSize = S[u][0].size();
    prefixMin[u][0].assign(tempSize, 0);
    prefixMin[u][1].assign(tempSize, 0);

    for(int x = 0; x < 2; x ++){
        long long tempMin = INF;
        long long tempMax = 0;
        int cnt = 0;
        for(ii temp: S[u][x]){
            tempMin = min(temp.second, tempMin);
            prefixMin[u][x][cnt++] = tempMin;
        }
    }
}

int N;

bool boleh(long long W2){
    W = W2;
    for(int i = 1; i <= N; i ++){
        S[i][0].clear();
        S[i][1].clear();
    }
    dfs(1);
    return !S[1][0].empty();
}

int main(){
    scanf("%d", &N);

    for(int i = 2; i <= N; i ++){
        int a, v;
        scanf("%d%d", &a, &v);
        AdjList[a].push_back(ii(i, v));
    }

    long long lo = 0;
    long long hi = 1LL << 23;
    while(lo < hi){
        long long mid = (lo+hi)>>1;
        if(boleh(mid)){
            hi = mid;
        }else{
            lo = mid+1;
        }
    }

    printf("%lld", lo);
    return 0;
}


Measured memory_bytes: 213576
from sys import stdin


def iterate_tokens():
    for line in stdin:
        for word in line.split():
            yield word


def main():
    tokens = iterate_tokens()
    N = int(next(tokens))
    Q = int(next(tokens))
    S = next(tokens)
    L = [0] * Q
    R = [0] * Q
    for i in range(Q):
        L[i] = int(next(tokens)) - 1
        R[i] = int(next(tokens)) - 1
    AC = [0] * N
    pre = None
    cnt = 0
    for i, c in enumerate(S):
        if c == "A":
            pre = "A"
        elif pre == "A" and c == "C":
            cnt += 1
            pre = None
        elif pre == "A":
            pre = None
        AC[i] = cnt
    for i in range(Q):
        print(AC[R[i]] - AC[L[i]])
    return


main()


Measured memory_bytes: 14188
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int count = 0;
		int flag;
		for(int i=0;i<n;i++){
			String t = sc.next();
			for(int p=0;p<t.length();p++){
				for(int q=1;;q++){
					if(p+q*(s.length()-1)>=t.length()){
						break;
					}
					flag = 1;
					for(int r=0;r<s.length();r++){
						if(s.charAt(r)!=t.charAt(p+q*r)){
							flag = 0;
							break;
						}
					}
		  			if(flag==1){
					    count++;
					    p = t.length();
					    break;
					}
				}
			}
		}
		System.out.println(count);
	}	
}

Measured memory_bytes: 20568
#include <iostream>
#include <string>

using namespace std;

int gcd2(int a1, int a2) {
    if (a1 % a2 == 0) {
       return(a2);
   } else {
       return(gcd2(a2, a1 % a2));
   }
}

int gcd3(int a, int b, int c) {
    int g = gcd2(a, b);
    return gcd2(c, g);
}

int main(void)
{
    int K;
    cin >> K;

    int memo[201];

    for (int i = 1; i <= K; i++) {
        memo[i] = 0;

        for (int m1 = 1; m1 <= i; m1++) {
            for (int m2 = m1; m2 <= i; m2++) {
                int gcd = gcd3(m1, m2, i);

                if (m1 == i && m2 == i) {
                    // cout << "case 1: ";
                    // cout << m1 << " " << m2 << " " << i << endl;
                    memo[i] += gcd;
                } else if (m1 == m2 || m2 == i || i == m1) {
                    // cout << "case 2: ";
                    // cout << m1 << " " << m2 << " " << i << endl;
                    memo[i] += gcd * 3;
                } else {
                    // cout << "case 3: ";
                    // cout << m1 << " " << m2 << " " << i << endl;
                    memo[i] += gcd * 6;
                }
            }
        }
    }

    // for (int i = 1; i <= K; i++) {
    //     cout << i << ": " << memo[i] << endl;
    // }

    int sum = 0;
    for (int i = 1; i <= K; i++) {
        sum += memo[i];
    }

    cout << sum;


    return 0;
}


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

int main()
{
  	string s;
  	cin>>s;
  	int n = s.length();
  	if(((s[0] == s[n-1]) && (n % 2 == 1)) || ((s[0] != s[n-1]) && (n % 2 == 0)))
      	cout<<"Second\n";
  	else
      	cout<<"First\n";
	return 0;
}


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

bool arr[100100]; ll cnt[100100];

void Eratosthenes(){
  for(ll i = 0; i < 100100; i++){ arr[i] = true; cnt[i] = 0;}
  arr[0] = false; arr[1] = false;
  for(ll i = 2; i < 100100; i++){
    if( arr[i]){
      for(ll j = 2; i*j < 100100; j++){ arr[i*j] = false;}
    }
  }
}

int main(){
ll N,P; cin >> N >> P;
 Eratosthenes();
  
  for(ll i = 0; i < 100100; i++){
    if(arr[i] && P%i == 0){ //iがPの素因数である時
      while( P>1 && P%i == 0){ P /= i;  cnt[i]++;}
    }
  }
  ll ans = 1;
  for(ll i = 2; i < 100100; i++){
    if( arr[i] && cnt[i] > 0){
      ll res = cnt[i]; res /= N;
         ans *= pow(i,res);}
  }
  if( P > 1 && N == 1){ ans *= P;}
  
  cout << ans << endl; return 0;}
  
  

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=1000000;i++)
    {
        int x=i*8/100;
        int y=i/10;
        if(x==a&&y==b) return cout<<i,0;
    }
    cout<<-1;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define INF 1000000007
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int n, a[100010], ta = 1;
map<int, bool> mp;

signed main() {
	cin >> n;
	rep(i, n) cin >> a[i];
	int i = 0;
	while (1) {
		if (a[i] == 2) {
			cout << ta << endl;
			ggr
		}
		if (mp[i] == true) {
			cout << -1 << endl;
			ggr
		}
		mp[i] = true;
		i = a[i] - 1;
		ta++;
	}
	ggr
}

Measured memory_bytes: 5376
INF = float("inf") #const
MOD = 10**9+7 #const
MAX = 510000 #const

def main():
    n = int(input())
    s,t = input().split()
    ans = ""
    for i in range(n):
        ans += s[i]
        ans += t[i]
    print(ans)


if __name__ == "__main__":
    main()


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

typedef long long ll;

int main() {
    int n;
    int w;

    cin >> n >> w;


    vector<ll> weights(n);
    vector<ll> vals(n);
    
    for (int i = 0; i < n; i++)
        cin >> weights[i] >> vals[i];

    vector<ll> dp(w + 1, 0);
    for (int i = 0; i < n; i++) {
        for (int j = w; j >= 0; j--) {
            ll new_weight = j + weights[i];
            if (new_weight > w)
                continue;

            dp[new_weight] = max(dp[new_weight], dp[j] + vals[i]);
        }
    }

    ll ans = 0;
    for (int i = 0; i <= w; i++)
        ans = max(ans, dp[i]);

    cout << ans << endl;
}


Measured memory_bytes: 1024
def main():
    n, m = map(int, input().split())
    cards = [0] * (n + 1)
    for _ in range(m):
        l, r = map(int, input().split())
        cards[l - 1] += 1
        cards[r] -= 1
    x = 0
    res = 0
    for c in cards[:-1]:
        x += c
        if x == m:
            res += 1
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 4720
import Control.Monad ( replicateM )
import Data.Tree ( flatten, Tree(Node) )
import Data.Array ( (!), accumArray, array, elems, Array )
import Data.Graph ( Tree(..), buildG, dfs )
import Data.Maybe ( fromJust )
import Data.Tuple ( swap )
import qualified Data.ByteString.Char8 as BS

scanTree :: (b -> a -> b) -> b -> Tree a -> Tree b
scanTree f z (Node x ts) = Node xx (map (scanTree f xx) ts)
    where xx = f z x

accumCount :: Array Int Int -> (Int, Int) -> Int -> (Int, Int)
accumCount counts acc vertex = (vertex, snd acc + counts!vertex)

solve :: Int -> [(Int, Int)] -> Int -> [(Int, Int)] -> [Int]
solve n e q px = elems countArray
    where
        counts = accumArray (+) 0 (1, n) px
        graph = buildG (1, n) (e ++ map swap e)
        tree = (head . dfs graph) [1]
        accumulatedTree = scanTree (accumCount counts) (0, 0) tree
        countArray = array (1, n) (flatten accumulatedTree)

tuplify2 :: [a] -> (a, a)
tuplify2 (x:y:_) = (x,y)

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

main :: IO ()
main = do
    [n, q] <- map readInt . BS.words <$> BS.getLine
    e <- replicateM (n - 1) (tuplify2 . map readInt . BS.words <$> BS.getLine)
    px <- replicateM q (tuplify2 . map readInt . BS.words <$> BS.getLine)
    putStrLn $ unwords $ map show $ solve n e q px


Measured memory_bytes: 190396
#include <bits/stdc++.h>
typedef long long ll;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
using namespace std;
const ll KEY=1e18;

int a[26]={};
int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    a[s[i]-'a']++;
  }

  //すべてのアルファベットを含むとき
  if(s.size()==26){
    //keyの値が大きいほど、アルファベットは後ろへ行く
    int key = s[25]-'a';
    for(int i=24;i>=0;i--){
      if(key<(s[i]-'a')){
        key = s[i]-'a';
      }else{
        char low = 'z';
        for(int j=25;j>=i+1;j--){
          if(low>s[j] && s[i]<s[j]) low = s[j];
        }
        if(i>1) {
          cout << s.substr(0,i) << low << endl;
        }else{
          cout << char(s[0]+1) << endl;
        }
        return 0;
      }
    }
    cout << -1 << endl;
  }else{
    rep(i,26){
      if(a[i]==0){
        cout << s << char('a'+i) << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < int(n); ++(i))
#define repeat_reverse(i, n) for (int i = (n)-1; (i) >= 0; --(i))
using ll = long long;
using namespace std;

constexpr int mod = 1e9+7;
int main() {
    int n, k; scanf("%d%d", &n, &k);
    const int dp_size = n * n + 3;
    vector<ll> cur(dp_size);
    cur[0] = 1;
    ll result = 0;
    repeat_reverse (i, n) {
        vector<ll> prv = move(cur);
        cur.assign(dp_size, 0);
        ll nxt = 1; repeat (j, i) nxt = nxt * (k + 1) % mod;
        repeat (a_i, min(k, i + 1) + 1) {
            repeat (delta, dp_size) if (prv[delta]) {
                result += (a_i + delta) % (i + 1) * nxt % mod * prv[delta] % mod;
                cur[delta + (a_i + delta) / (i + 1)] += prv[delta];
            }
        }
        repeat_from (a_i, (i + 1) + 1, k + 1) {
            repeat (delta, dp_size) if (prv[delta]) {
                result += (a_i + delta) * nxt % mod * prv[delta] % mod;
                cur[delta] += prv[delta];
            }
        }
        repeat (delta, dp_size) if (cur[delta]) {
            cur[delta] %= mod;
        }
        result %= mod;
    }
    printf("%lld\n", result);
    return 0;
}


Measured memory_bytes: 384
/************************************/
/* NoobM							*/
/* File Name : untitled.cpp				*/
/* Date : 11.07.2020 18:01:43 +06	*/
/************************************/

#include <bits/stdc++.h>

#define rr(i, b)    for (int i = 0; i < int(b); i++)
#define vi(n, a) vector <int> a(n); rr(i, n) cin >> a[i]
#define pvec(a) rr(i, a.size()) cout << a[i] << " "; cout << endl
#define bug(x) cout << #x << " " << x << endl
#define ll long long
#define vii vector <int>

using namespace std;

void solve() {
	int l, r, d;
	cin >> l >> r >> d;
	
	cout << r/d - (l - 1) /d << endl;
}
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
	
	int t = 1;
	//cin >> t;
	
	while (t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <vector>
int a;
char x[1000010];
std::vector<int> V,V2;
int abs(int k)
{
	return k>0?k:-k;
}
int comb[1000010];

int main()
{
	int a;
	scanf("%d",&a);
	scanf("%s",x+1);
	for(int i=2;i<=a;i++) V.push_back(abs(x[i]-x[i-1]));
	
	int C = 2;
	for(int i=0;i<V.size();i++) if(V[i]==1) C = 1;
	if(C==2) for(int i=0;i<V.size();i++) V[i]/=2;
	
	
	for(int i=0;i<V.size();i++)
	{
		int c = V.size()-1;
		while(c)
		{
			comb[i] += (c/2);
			c/=2;
		}
		c = i;
		while(c)
		{
			comb[i] -= (c/2);
			c/=2;
		}
		c = V.size()-1-i;
		while(c)
		{
			comb[i] -= (c/2);
			c/=2;
		}
	}
	int ans = 0;
	for(int i=0;i<V.size();i++)
	{
		if(comb[i]==0)
		{
			ans += V[i];
			ans %=2;
		}
	}
	
	printf("%d",ans*C);
}

Measured memory_bytes: 9328
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Node[] nodes = new Node[N];
        for(int i = 0; i < N; i++){
            nodes[i] = new Node(i);
        }
        
        for(int i = 0; i < N - 1; i++){
            int v1 = sc.nextInt() - 1;
            int v2 = sc.nextInt() - 1;
            int w  = sc.nextInt();
            
            nodes[v1].adjacents.put(nodes[v2], w);
            nodes[v2].adjacents.put(nodes[v1], w);
        }
        
        bfs(nodes[0]);
        
        for(Node n : nodes){
            System.out.println(n.color);
        }

    }
    
    public static void bfs(Node n0){
        
        Queue<Node> queue = new LinkedList<>();
        
        n0.color = 0;
        queue.add(n0);
        
        while(!queue.isEmpty()){
            
            Node n = queue.poll();
            
            for( Node na : n.adjacents.keySet() ){
                if( na.color != -1 ) continue;
                
                int na_kyori = n.adjacents.get(na);
                if ( na_kyori % 2 == 0 ){
                    na.color = n.color % 2;
                } else {
                    na.color = (n.color + 1) % 2;
                }
                
                queue.add(na);
                
            }
        }
    }
    
    static class Node{
        int id;
        // 白 : 0、 黒 : 1
        int color = -1;
        Map<Node, Integer> adjacents = new HashMap<>();
        
        public Node(int id){
            this.id = id;
        }
    }
}


Measured memory_bytes: 120968
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;	

int main() {
	int n; cin >> n;
	string s; cin >> s;
	bool echo = true;
	if (n % 2) echo = false;
	REP(i, n / 2) if (s[i] != s[n / 2 + i]) echo = false;
	cout << (echo ? "Yes" : "No") << endl;
;}


Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] nk=cin.ArrayInt(2,0);
        int[] h=cin.ArrayInt(nk[0],0);
        int ans=0;
        for(int i=0;i<nk[0];i++)
        {
            if(nk[1]<=h[i])ans++;
        }
        Console.WriteLine(ans);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 15968
n, m, l = map(int, input().split())
A = []
B = []
C = [[0] * l for i in range(n)]
for i in range(n):
    A.append([int(s) for s in input().split()])
for i in range(m):
    B.append([int(t) for t in input().split()])
for i in range(n):
    for j in range(l):
        C[i][j] = str(sum(A[i][k] * B[k][j] for k in range(m)))
for i in range(n):
    print(' '.join(C[i]))



Measured memory_bytes: 7040
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var a = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Trim();

        Console.WriteLine(a >= 3200 ? s : "red");
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<cmath>
using namespace std;
#define int long long int
int32_t main()
{
	int n,m;
	cin>>n>>m;
	int arr[n+1];
	int j;
	for(j=1;j<=n;j++)
	{
		cin>>arr[j];
	}
	bool good[n+1];
	for(j=1;j<=n;j++)
	   good[j]=true;
	for(j=0;j<m;j++)
	{
		int x,y;
		cin>>x>>y;
		if(arr[x]<=arr[y])
		{
			good[x]=false;
		}
		if(arr[y]<=arr[x])
		{
			good[y]=false;
		}
	}
	int count=0;
	for(j=1;j<=n;j++)
	{
		if(good[j])
		{
			count++;
		}
	}
	cout<<count<<endl;
}


Measured memory_bytes: 4512
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<cmath>
#include<queue>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	scanf("%d",&n);
	if(n%10==n/100)printf("Yes\n");
		else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c,i;
  scanf("%d%d%d",&a,&b,&c);
  int sum=0;
  for(i=a;i<=b;i++){
    if(c%i==0){
      sum = sum + 1;
    }
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 1812
// 解説の実装例が分かりやすすぎて惚れた
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int m = sc.nextInt();
        long k = sc.nextLong();
        long[] a = new long[n+1];
        long[] b = new long[m+1];

        a[0] = 0;
        for (int i = 0; i < n; i++) {
            int t = sc.nextInt();
            a[i+1] = a[i] + t;
        }

        b[0] = 0;
        for (int i = 0; i < m; i++) {
            int t = sc.nextInt();
            b[i+1] = b[i] + t;
        }

        int ans = 0, j = m;
        for (int i = 0; i <= n; i++) {
            if (a[i] > k)
                break;
            while (b[j] > k - a[i])
                j--;
            ans = Math.max(i+j, ans);
        }

        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 63932
def main():
    N, M, Q = [int(n) for n in input().split()]
    imos = [[0] * N for _ in range(N)]
    for i in range(M):
        l, r = [int(i)-1 for i in input().split()]
        imos[l][r]+=1
    # print(imos)
    for h in range(N):
        for w in range(1, N):
            imos[h][w] += imos[h][w-1]
    for h in reversed(list(range(1, N))):
        for w in range(N):
            imos[h-1][w] += imos[h][w]
    # print(imos)
    ans = [0]*Q
    for q in range(Q):
        ql, qr = [int(i)-1 for i in input().split()]
        ans[q] = imos[ql][qr]
    for a in ans:
        print(a)



if __name__ == "__main__":
    main()

Measured memory_bytes: 63704
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();

    vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(k + 1, vector<int>(2)));
    dp[0][0][true] = 1;
    for(int index = 0; index < n; index++) {
        for(int count = 0; count <= k; count++) {
            for(int num = 0; num <= 9; num++) {
                if(num == 0) {
                    dp[index + 1][count][s[index] == '0'] += dp[index][count][true];
                    dp[index + 1][count][false] += dp[index][count][false];
                } else if(count + 1 <= k) {
                    if(s[index] - '0' > num) {
                        dp[index + 1][count + 1][false] += dp[index][count][true];
                    } else if(s[index] - '0' == num) {
                        dp[index + 1][count + 1][true] += dp[index][count][true];
                    }
                    dp[index + 1][count + 1][false] += dp[index][count][false];
                }
            }
        }
    }
    cout << dp[n][k][false] + dp[n][k][true] << endl;
    return 0;
}

Measured memory_bytes: 256