akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<climits>
using namespace std;

#define chmax(a,b)  a = max(a, b)
#define chmin(a,b)  a = min(a, b)

typedef long long ll;

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

    t /= 2;

    ll tmpmin = 1e10, score = -1, a;
    int ans = 1;

    for(int i = 0; i < n; i++){
        cin >> a;
        ll tmpscore = (a-tmpmin) * t;

        if(tmpscore > score){
            score = tmpscore;
            ans = 1;
        }else if(tmpscore == score){
            ans++;
        }
        
        chmin(tmpmin, a);
    }
    
    cout << ans << endl;

    return 0;
}

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

vector<int> veze[200005];
int bio[200005];
int sol = 1, cnt;

int main() {
    int n, m, a, b;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        veze[a].push_back(b);
        veze[b].push_back(a);
    }

    for (int i = 1; i <= n; i++) {
        if (bio[i] > 0) {continue;}
        bio[i] = 1;
        cnt = 1;
        queue<int> Q;
        Q.push(i);
        while (!Q.empty()) {
            a = Q.front();
            Q.pop();
            for (auto b : veze[a]) {
                if (bio[b] > 0) {continue;}
                bio[b] = 1;
                Q.push(b);
                cnt ++;
                sol = max(sol, cnt);
            }
        }
    }

    cout << sol << endl;

}


Measured memory_bytes: 15764
import collections 
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
dic = collections.Counter(A)
suma = sum(A)
output = []

for q in range(Q):
    b, c = map(int, input().split())
    if b in dic:
        suma += dic[b] * c
        suma -= dic[b] * b
        dic[c] += dic[b]
        dic[b] = 0

    output.append(suma)

print(*output, sep="\n")


    

    


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 212345;
int A[MAX_N];
int B[MAX_N];

int Ax[MAX_N * 2];
int Bx[MAX_N];

struct RollingHash {
  using HashType = tuple<ll,ll,ll>;

  const ll mod1 = 999999893;
  const ll mod2 = 999999929;
  const ll mod3 = 999999937;
  const ll b1 = 3422539;
  const ll b2 = 1245103;
  const ll b3 = 22961;
  vector<ll> h1, h2, h3;
  vector<ll> pow1, pow2, pow3;

  RollingHash(int n, int* s) {
    h1.assign(n+1, 0);
    h2.assign(n+1, 0);
    h3.assign(n+1, 0);
    pow1.assign(n+1, 1);
    pow2.assign(n+1, 1);
    pow3.assign(n+1, 1);
    REP(i, n) {
      h1[i+1] = (h1[i] * b1 + s[i]) % mod1;
      h2[i+1] = (h2[i] * b2 + s[i]) % mod2;
      h3[i+1] = (h3[i] * b3 + s[i]) % mod3;
      pow1[i+1] = pow1[i] * b1 % mod1;
      pow2[i+1] = pow2[i] * b2 % mod2;
      pow3[i+1] = pow3[i] * b3 % mod3;
    }
  }

  HashType get(int l, int r) {
    ll v1 = ((h1[r] - h1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
    ll v2 = ((h2[r] - h2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
    ll v3 = ((h3[r] - h3[l] * pow3[r-l]) % mod3 + mod3) % mod3;
    return HashType {v1, v2, v3};
  }
};

int main2() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();
  REP(i, N) B[i] = nextInt();

  if (N == 1) {
    cout << 1 << " " << (A[0]^B[0]) << endl;
    return 0;
  }

  if (N == 2) {
    REP(k, 2) {
      int ex = B[0] ^ A[k];
      bool same = true;
      REP(i, N) {
        if (ex != (B[i] ^ A[(i+k)%N])) same = false;
      }
      if (same) {
        cout << k << " " << ex << endl;
      }
    }
    return 0;
  }

  REP(i, N) Ax[i] = A[i] ^ A[(i+1)%N];
  REP(i, N) Ax[i+N] = Ax[i];
  REP(i, N) Bx[i] = B[i] ^ B[(i+1)%N];

  RollingHash AA(2*N, Ax);
  RollingHash BB(N, Bx);

  REP(k, N) {
    bool same = (AA.get(k, k+N) == BB.get(0, N));
    if (same) {
      printf("%d %d\n", k, B[0]^A[k]);
    }
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 35712
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        num: i32,
    }
    let mut s = num;
    let h = s / 3600;
    s = s % 3600;
    let m = s / 60;
    s = s % 60;
    println!("{}:{}:{}", h, m, s);
}


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

// using namespace std;
// typedef long long ll;
// 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; }
// #define rep(i,j,n) for (ll i = j; i < (n); i++)
// #define CLR(mat,f) memset(mat, f, sizeof(mat))
// #define IN(a, b, x) (a<=x&&x<b)
// #define out(ans) cout << ans << endl
// typedef pair<ll,ll>P;
// const ll mod=1e9+7;
// const ll INF = 1LL << 60;
// ll dp[100010];

// int main(){

//   int n;cin>>n;
//   int k;cin>>k;
//   int h[n+10];rep(i,0,n)cin>>h[i];

//   rep(i,0,n)dp[i]=INF;
//   dp[0]=0;
//   rep(i,0,n){
//     for(int next=i+1;next<=min((ll)n-1,i+k);next++){
//       chmin(dp[next],dp[i]+abs(h[next]-h[i]));
//     }
//   }

//   out(dp[n-1]);

//   return 0;
// }
// #include "bits/stdc++.h"

using namespace std;
typedef long long ll;
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; }
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL << 60;
ll dp[100010];

int main(){

  int n;cin>>n;
  int k;cin>>k;
  int h[n+10];rep(i,0,n)cin>>h[i];

  rep(i,0,n)dp[i]=INF;
  dp[0]=0;
  rep(i,0,n){
    for(int next=i+1;next<=min((ll)n-1,i+k);next++){
      chmin(dp[next],dp[i]+abs(h[next]-h[i]));
    }
  }

  out(dp[n-1]);

  return 0;
}


Measured memory_bytes: 1408
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  vector<ll> dp(n);
  REP(i,n){
    cin >> h[i];
    dp[i]=INF;
  }
  dp[0] = 0;

  for(int i=0;i<n;i++){
    for(int j=1;j<=k;j++){
      if(i+j>n-1) continue;
      dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]),dp[i+j]);
    }
  }

  cout << dp[n-1] << endl;
  return 0;
}

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

int main()
{
    ll n,W;
    cin>>n>>W;
    ll w[n+1],v[n+1];
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    ll dp[100001];
    dp[0]=0;
    for(ll i=1;i<=100000;i++)
        dp[i]=W+W;
    for(int i=1;i<=n;i++)
    {
        for(int j=100000;j>=v[i];j--)
            dp[j]=min(dp[j],w[i]+dp[j-v[i]]);
        
    }
    ll ans=0;
    for(ll i=1;i<=100000;i++)
        if(dp[i]<=W)
            ans=i;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
char a[5]={'a','e','i','o','u'};
int main(){
    char c;
    c=getchar();
    for(int i=0;i<5;i++)
    {
        if(c==a[i])
        {
            cout<<"vowel"<<endl;
            return 0;
        }
    }
    cout<<"consonant"<<endl;
    return 0;
}

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

using namespace std;

using ll = long long;

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

    int a, b;
    cin >> a >> b;
    if ((a * b) % 2 == 0) cout << "Even\n";
    else cout << "Odd\n";

    return 0;
}


Measured memory_bytes: 256
X, N = map(int, input().split())
P = list(map(int, input().split()))

Q = [q for q in range(-1, 102) if q not in P]  # -1以上101以下整数のうちPに存在しないもの
ans = min(Q, key=lambda q: (abs(q - X), q))  # maspyさん解法
print(ans)

Measured memory_bytes: 9104
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
max_num = 0
ans = 1
for i in range(1, N+1):
    tmp = i
    num = 0
    while tmp % 2 == 0:
        num += 1
        tmp /= 2
    if num > max_num:
        ans = i
        max_num = num

print(ans)

Measured memory_bytes: 3064
import copy
h,w,k=map(int,input().split())
c=[[[".","#"].index(i)for i in input()]for j in range(h)]
l=0
for i in range(2**h):
    for j in range(2**w):
        x,y=bin(i)[2:].zfill(h),bin(j)[2:].zfill(w)
        a,b=[],[]
        for p in range(h):
            if x[p]=="1":
                a+=[p]
        for p in range(w):
            if y[p]=="1":
                b+=[p]
        d=copy.deepcopy(c)
        for x in a:
            d[x]=[2]*w
        for x in b:
            for y in range(h):
                d[y][x]=2
        p=[]
        for x in d:
            p+=x
        l+=(k==p.count(1))
print(l)

Measured memory_bytes: 77228
/*
 Abu Jafor Mohammad Saleh
 ios_base :: sync_with_stdio(false);
 cin.tie(NULL);
 */

#include<cstdio>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<limits>
#include <algorithm>
#include <unordered_map>
#include<fstream>
#define f first
#define s second
#define MOD 1000000007

#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define BOUNDARY(i, j) ((i >= 0 && i < rows) && (j >= 0 && j < coloums))
#define mx 6e5 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//#include<bits/stdc++.h>
#define ll long long
const int maxn = 20005;
using namespace std;
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
int rows,coloums;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}


int main ()
{
    fast;
    ll a,b;
    cin>>a>>b;
    ll arr[b+1];
    map<ll,ll> mp;
    ll s =0;
    for(int i=0;i<b;i++)
    {
        cin>>arr[i];
     //   mp[arr[i]]++;
        s += arr[i];
    }
    
    if(s>=a)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    //sort(arr,arr+b);
    //reverse(arr,arr+b);
    
    
    
    
}


Measured memory_bytes: 1024
n = int(input())
al = list(map(int, input().split()))
count = [0] * 8
overred = 0

for a in al:
    if a < 400:
        count[0] += 1
    elif a < 800:
        count[1] += 1
    elif a < 1200:
        count[2] += 1
    elif a < 1600:
        count[3] += 1
    elif a < 2000:
        count[4] += 1
    elif a < 2400:
        count[5] += 1
    elif a < 2800:
        count[6] += 1
    elif a < 3200:
        count[7] += 1
    else:
        overred += 1

color = 8 - count.count(0)

if color != 0:
    color_min = color
    color_max = color_min + overred
else:
    color_min = 1
    color_max = overred

print(color_min, color_max)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;
/**==Info==
*Program:3
*Problem:Shorten Diameter
*Date:2017-8-8
*Algorithm:Teacher's DFS
*Stats:WA on pretest*/
int n,k;
vector<int> nei[2005];

int dfs(int now,int parent,int distance,int max){
	int ans=1;
	if(distance!=max){
		for(int i=0;i<nei[now].size();i++){
			if(nei[now][i]!=parent){
				ans+=dfs(nei[now][i],now,distance+1,max);
				//cout<<"I am "<<now<<" I add "<<nei[now][i]<<" As "<<distance+1<<endl;
			}
		}
	}
	//cout<<"Broadcast:::"<<now<<" has answer "<<ans<<endl;
	return ans;
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		nei[a].push_back(b);
		nei[b].push_back(a); 
	}
	
	int ans=0;
	if(k%2==0){
		for(int i=0;i<n;i++){
			ans=max(ans,dfs(i,-1,0,k/2));
		}
	}else{
		for(int i=0;i<n;i++){
			for(int j=0;j<nei[i].size();j++){
				ans=max(ans,dfs(nei[i][j],i,0,k/2)+dfs(i,nei[i][j],0,k/2));
			}
		}
	}
	
	cout<<n-ans;
	return 0;
}


Measured memory_bytes: 384
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
 
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;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;
	cin >> n >> m;
	string s;
	cin >> s;
	int now = n;
	bool flg = true;
	vector<int> ans;
	while(true){
		for(int i = m;i >= 1;--i){
			if(now - i >= 0 && s[now-i] == '0'){
				now -= i;
				ans.emplace_back(i);
				break;
			}
			if(i == 1) return cout << -1 << '\n',0;
		}
		if(now <= 0) break;
	}
	n = ans.size();
	reverse(all(ans));
	rep(i,n){
		cout << (i == 0 ? "" : " ") << ans[i];
	}
	cout << '\n';
	return 0;
}



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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

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

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

LL n,k;

int main(){
	cin >> n >> k;
	if(n >= 10) cout << k << endl;
	else{
		cout << k + 100 * (10 - n) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

template <typename T>
inline std::string to_bin_str(T n) {
    std::string str;
    while (n > 0) {
        str.push_back('0' + (n & 1));
        n >>= 1;
    }
    std::reverse(str.begin(), str.end());
    return str;
}

int main(){
    ll n; cin>>n;
    if(n==0){
        cout<< 0 <<endl;
        return 0;
    }
    bool sgn=(n>=0 ? true : false);
    n=abs(n);
    rep(i,0,50){
        if(i%2==0){
            if((n>>i)&1LL){
                if(!sgn) n+=(1LL<<(i+1));
            }
        }else{
            if((n>>i)&1LL){
                if(sgn) n+=(1LL<<(i+1));
            }
        }
    }
    cout<< to_bin_str(n) <<endl;

}

Measured memory_bytes: 256
/*
ID: lyr14721
PROG: 
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll a,b;
	cin>>a>>b;
	ll c=__gcd(a,b);
	ll ans=(a*b)/c;
	cout<<ans; 
	return 0;
}


Measured memory_bytes: 256
a=input()
#print(len(list(a)))
b=10000000
for i in range(len(list(a))-2):
	if abs(int(str(a[i])+str(a[i+1])+str(a[i+2]))-753)<b:
		b=abs(int(str(a[i])+str(a[i+1])+str(a[i+2]))-753)
print(b)


Measured memory_bytes: 2940
from operator import itemgetter

def main():
    num_prefecture, num_city = map(int, input().rstrip().split())
    
    prefecture_list = [[] for i in range(num_prefecture)]
    
    '''prefecture_list[prefecture_number-1] = [[city index, born year], ...]'''
    for idx_city in range(num_city):
        p_belong, y_born = map(int, input().rstrip().split())
        p_belong -= 1 # convert so that index starts from 0
        prefecture_list[p_belong].append([idx_city, y_born])
    
    # sort in the order of city birth year in an each prefecture
    prefecture_list = [sorted(each_prefecture_list, key = itemgetter(1)) for each_prefecture_list in prefecture_list]
    
    id_list = []
    for idx_p, each_prefecture_list in enumerate(prefecture_list):
        for city_order, [idx_city, y_born] in enumerate(each_prefecture_list):
            id_first = '{0:06d}'.format(idx_p + 1)
            id_end = '{0:06d}'.format(city_order + 1)
            id_num = str(id_first) + str(id_end)
            id_list.append([idx_city, id_num])
    
    # sort in the order of city number
    id_list.sort(key = itemgetter(0))
    
    for id_num in id_list:
        print(id_num[1])
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 50264
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    for i in 1..=110 {
        let x = a * i;
        if x % b == c {
            println!("YES");
            return;
        }
    }
    println!("NO");
}


Measured memory_bytes: 2144
while 1:
  a, op, b = input().split()
  if op == '?':
    break
  a = int(a)
  b = int(b)
  if op == '+':
    print(a+b)
  elif op == '-':
    print(a-b)
  elif op == '*':
    print(a * b)
  elif op == '/':
    print(a // b)

Measured memory_bytes: 7636
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 4010;
const long long mod = 998244353;
long long dp[maxn][maxn];
int n;
int v[maxn] = {0};
int main()
{
	std::ios::sync_with_stdio(false);
	string s;
	int cnt = 0;
	cin >> s;
	n = s.size();
	for(int i = 0; i < s.size(); i ++)
		v[i] = s[i] - '0';
	dp[0][0] = 1;
	for(int i = 0; i < 2 * n; i ++)
	{
		if(i < n)
			cnt ++;
		else
			cnt --;
		for(int j = 0; j <= 2 * n; j ++)
		{
			if(cnt - j - v[i] >= 0)
			(dp[i + 1][j + v[i]] += dp[i][j]) %= mod;
			if(j + v[i] - 1 >= 0)
				(dp[i + 1][j + v[i] - 1] += dp[i][j]) %= mod;
		}
	}
	cout << dp[2 * n][0] << endl;
	return 0;
}

Measured memory_bytes: 125568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
static const int INF (1<<30);

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

  vector<pair<int, int> > x(M);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    x[i] = make_pair(a, b);
  }

  sort(all(x));

  int ans = 0, minb = x[0].second;
  rep(i, M) {
    if (x[i].first >= minb) {
      ans++;
      minb = x[i].second;
    } else {
      minb = min(minb, x[i].second);
    }
  }
  ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var A = Number(lines[0].split(" ")[0]);
    var B = Number(lines[0].split(" ")[1]);
    var C = Number(lines[0].split(" ")[2]);

    if (A <= C && C <= B) {
        console.log("Yes");
    }
    else if (B <= C && C <= A) {
        console.log("Yes");
    }
    else {
        console.log("No");
    }
});

Measured memory_bytes: 21320
// Inshallah, Boys played well !!

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int> 
#define vpi vector<pair<int,int> >
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ff(i,s,e) for(int i=s;i<=e;i++)
#define fb(i,e,s) for(int i=e;i>=s;i--)
#define maxn 100005
vector<int> graph[maxn];
int kitna[maxn];
int vis[maxn];

void dfs(int u){
    vis[u]=1;
    for(auto i:graph[u]){
        if(vis[i]){
            kitna[u]=max(kitna[u],kitna[i]+1);    
            continue;
        }
        dfs(i);
        kitna[u]=max(kitna[u],kitna[i]+1);
    }
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m,x,y,z;
    cin >> n >> m;
    ff(i,1,m){
        cin >> x >> y;
        graph[x].pb(y);
    }
    ff(i,0,n)
        kitna[i]=vis[i]=0;
    ff(i,1,n){
        dfs(i);
    }
    int ans=0;
    ff(i,1,n)
        ans=max(ans,kitna[i]);
    cout << ans ;
}

Measured memory_bytes: 9344
#define Bobyama
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll N, M, K;

ll calc() {
    ll t1 = 0;
    for (ll i = 0; i < M; ++i) {
        t1 += mod(i*(M-i), MOD);
        t1 = mod(t1, MOD);
    }
    t1 = mod(t1*N%MOD*N%MOD, MOD);

    ll t2 = 0;
    for (ll i = 0; i < N; ++i) {
        t2 += mod(i*(N-i), MOD);
        t2 = mod(t2, MOD);
    }
    t2 = mod(t2*M%MOD*M%MOD, MOD);

    return mod((t1 + t2)*2, MOD);
}

const int MAX_N = 200000;
ll fact[MAX_N+1];
ll inv_fact[MAX_N+1];

//整数a,bに対し、ax + by = gcd(a,b) を満たす整数x,y,gcd(a,b) を計算する
ll extgcd(ll a, ll b, ll& x, ll& y) {
  ll d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b) * x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

//ax ≡ gcd(a,m) (mod m) を満たすxを計算する。
ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a, m, x, y);
  return (m + x%m) % m;
}


void init(ll n, ll mod) {
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) fact[i] = (fact[i-1]*i)%mod;

  for (int i = 0; i <= n; ++i) inv_fact[i] = mod_inverse(fact[i], mod);
}

ll mod_comb(ll n, ll r, ll mod) {
  return fact[n]*inv_fact[r]%mod*inv_fact[n-r]%mod;
}

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

  cin >> N >> M >> K;
  init(N*M, MOD);

  ll t = calc();

  ll ans = mod(t*mod_comb(K, 2, MOD)%MOD*fact[M*N-2]%MOD*inv_fact[N*M-K]%MOD*inv_fact[K], MOD);

  cout << ans << endl;

  return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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 ll MRINF = 5000000000000000;

int main() {


  string S; cin >> S;

  string ans[] = {"abc", "acb", "bca", "bac", "cab", "cba"};

  REP(i, 6){
    if(S==ans[i]){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
    

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3568
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define MAX ((ll)1<<(ll)31)-1

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <iterator>
#include <iomanip>
#include <climits>
using namespace std;

vector<long long> a;

long clp2(long x) {
    long p2 = 1;
    for(; ;) {
        if (p2 >= x) return p2;
        p2 <<= 1;
    }
 return 0;
}

long long get_max (long long v, long long tl, long long tr, long long l, long long r) {
	if (l > r)
		return 0;
	if (l == tl && r == tr)
		return a[v];
	long long tm = (tl + tr) / 2;
    return max(get_max(v*2, tl, tm, l, min(r,tm)), get_max(v*2+1, tm+1, tr, max(l,tm+1), r));
}

int main(){
    long long n, t;
    cin >> n >> t;
    long long k = clp2(n);
    a.assign(2 * k, -1e9);
    for(int i = k; i < k + n; ++i) cin >> a[i];
    for(int i = k - 1; i > 0; --i) a[i] = max(a[2 * i], a[2 * i + 1]);
    vector<long long> d(n);
    for(int i = 0; i < n; ++i){
        long long mx = get_max(1, 1, k, i + 1, n);
        d[i] = mx * t - a[k + i] * t;
    }
    cout << count(d.begin(), d.end(), *max_element(d.begin(), d.end()));
}


Measured memory_bytes: 3072
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e3 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
int N, arr[maxn];
signed main()
{
    N = read();
    int sum = 0;
    for (ri i = 1; i <= N; ++i) {
        arr[i] = read(), sum += arr[i];
    }
    int M = read();
    for (ri i = 1; i <= M; ++i) {
        int p = read(), t = read();
        int tmp = sum;
        tmp -= arr[p], tmp += t;
        writeln(tmp);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


int main(){
    char X, Y;
    cin >> X >> Y;
    if (X < Y) cout << "<\n";
    else if (X > Y) cout << ">\n";
    else cout << "=\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public long solve(int n, int []arr) {
        long [][]dp = new long[n][n];

        for(int i = 0; i < n - 1; i++) {
            dp[i][i + 1] = arr[i] + arr[i + 1];
        }

        long []sum = new long[n];
        sum[0] = arr[0];
        for(int i = 1; i < n; i++) {
            sum[i] = sum[i - 1] + arr[i];
        }

        for(int len = 2; len < n; len++) {
            for(int start = 0; start + len < n; start++) {
                int end = start + len;
                dp[start][end] = (long) 1e18;

                for(int cut = start; cut < end; cut++) {
                    long rangeSum = sum[end] - (start == 0 ? 0 : sum[start - 1]);
                    dp[start][end] = Math.min(dp[start][cut] + dp[cut + 1][end] + rangeSum, dp[start][end]);
                }
            }
        }

        return dp[0][n - 1];
    }


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int []arr = new int[n];
        for(int i = 0; i < arr.length; i++) {
            arr[i] = in.nextInt();
        }

        System.out.println(new Main().solve(n, arr));
    }
}

Measured memory_bytes: 38768
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int N = 2e5 + 7;

bool used[N];

void solve() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    int ans = 0;
    loop(i, t.size()) {
        char win = (t[i] == 'r' ? 'p' : (t[i] == 's' ? 'r' : 's'));
        char wink = (i < k || !used[i - k] ? 'y' : (t[i - k] == 'r' ? 'p' : (t[i - k] == 's' ? 'r' : 's')));
        if (win != wink) {
            ans += (win == 'r' ? r : (win == 's' ? s : p));
            used[i] = 1;
        }
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3868
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

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

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush

def prime_factorization(n):
    res = []
    for i in range(2, int(pow(n, 0.5))+1):
        if n % i: continue
        ex = 0
        while n % i == 0:
            n = n // i
            ex += 1
        res.append((i, ex))
    if n != 1:
        res.append((n, 1))
    return res

def solve():
    n = II()

    f = prime_factorization(n)
    # print(f)

    if len(f) == 0:
        print(0)
        return

    ans = 0
    for (num, ex) in f:
        a = 1
        while ex > 0:
            ex -= a
            if ex >= 0:
                ans += 1
            a += 1
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9700
#include<cstdio>
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include <set>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(int argc, char* argv[]){
  string s;
  cin >> s;
  int len = s.length();
  if(len == 2){
    cout << s << endl;
    return 0;
  }
  else{
    reverse(s.begin(),s.end());
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 256
var
	s:String;
	cnt:Array[1..5]of int64;
	ans:int64;
	i,n:Longint;
begin
	readln(n);
	for i:=1 to n do begin
		readln(s);
		if s[1]='M' then inc(cnt[1])
		else if s[1]='A' then inc(cnt[2])
		else if s[1]='R' then inc(cnt[3])
		else if s[1]='C' then inc(cnt[4])
		else if s[1]='H' then inc(cnt[5]);
	end;
	writeln(cnt[1]*cnt[2]*(cnt[3]+cnt[4]+cnt[5])+cnt[1]*cnt[3]*(cnt[4]+cnt[5])+
		cnt[1]*cnt[4]*cnt[5]+cnt[2]*cnt[3]*(cnt[4]+cnt[5])+cnt[2]*cnt[4]*cnt[5]+
		cnt[3]*cnt[4]*cnt[5]);
end.


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

using namespace std;

int main(void) {
	long long N, A, B;
	cin >> N >> A >> B;
	long long ans = A * (N / (A + B));
	if(N % (A + B) <= A) {
		ans += N % (A + B);
	} else {
		ans += A;
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=200010,D=26;
char s[N];
int ext[N];
struct ccnt{
	lint cnt[26];
	inline void operator += (const ccnt &b){
		for(int i=0;i<D;i++){
			cnt[i]+=b.cnt[i];
		}
	}
}_cnt[N],f[N];
lint g[N];
inline ccnt work(lint x){
	assert(x>=0);
	if(x<=g[1]){
		return _cnt[x];
	}
	int t=0;
	for(;g[t]<=x;t++);
	assert(t);
	ccnt ans=f[t-1];
	ans+=work(x-g[t-1]);
	return ans;
}
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1)>>1;
	s[n+1]=0;
	memset(ext,0,sizeof(ext));
	for(int i=2,j=0;i<=n+1;i++){
		ext[i]=max(min(ext[i-j+1],j+ext[j]-i),0);
		for(;s[1+ext[i]]==s[i+ext[i]];ext[i]++);
		if(i+ext[i]>j+ext[j]){
			j=i;
			if(i+ext[i]>n){
				g[0]=i-1;
				break;
			}
		}
	}
	memset(_cnt,0,sizeof(_cnt[0]));
	for(int i=1;i<=n;i++){
		_cnt[i]=_cnt[i-1];
		_cnt[i].cnt[s[i]-'a']++;
	}
	f[0]=_cnt[g[0]];
	g[1]=n,f[1]=_cnt[n];
	lint l=next_num<lint>(),r=next_num<lint>();
	for(int i=2;g[i-1]<=r;i++){
		g[i]=g[i-1]+g[i-2];
		f[i]=f[i-1];
		f[i]+=f[i-2];
	}
	ccnt ansl=work(l-1),ansr=work(r);
	for(int i=0;i<D;i++){
		printf("%lld ",ansr.cnt[i]-ansl.cnt[i]);
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 23808
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
ostream &operator<<(ostream &os, const vector<int> &a) {
	os<<"[";
	rep(i,a.size()){
		os<<a[i];
		if(i<a.size()-1) os<<",";
	}
	os<<"]";
	return os; 
}
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
struct unionf{
	vector <int> data;
	unionf(int size):data(size,-1){}
	bool unions(int x,int y){
		x=root(x);y=root(y);
		if(x!=y){
			if(data[y]<data[x]){int d=x;x=y;y=d;}
			data[x]+=data[y];data[y]=x;
		}
		return x!=y;
	}
	bool finds(int x,int y){
		return root(x)==root(y);
	}
	int root(int x){
		return data[x]<0?x:data[x]=root(data[x]);
	}
	int find(int x){
		return -data[x];
	}
};
unionf uni(200100);
vector<int> gr[200100];
int out[200100];
bool ka[200100];//ランドマークになる点
vector<int> num[200100];//そこから出る余計に踏む点の数
int dp[200100];//ゴールまでのステップ
int dfs(int v,int u,int pre,int pre2){
	if(v>pre){
		rep(i,gr[v].size()){
			int w=gr[v][i];
			if(u==w) continue;
			//cout<<v<<u<<w<<endl;
			num[v].pb(dfs(w,v,v,pre));
		}
		ka[v]=true;
		return 0;
	}
	if(v>pre2){
		rep(i,gr[v].size()){
			int w=gr[v][i];
			if(u==w) continue;
			dfs(w,v,pre,pre2);
		}
		return 0;
	}
	int ret=1;
	rep(i,gr[v].size()){
		int w=gr[v][i];
		if(u==w) continue;
		ret+=dfs(w,v,pre,pre2);
	}
	return ret;
}
void dfs2(int v,int u,int now){
	if(ka[v]){
		out[v]=now+1;
		rep(i,num[v].size()) out[v]+=num[v][i];
		//cout<<v<<num[v]<<endl;
		int it=0;
		rep(i,gr[v].size()){
			int w=gr[v][i];
			if(u==w) continue;
			dfs2(w,v,out[v]-num[v][it]);
			it++;
		}
	}
	else{
		if(!uni.finds(v,u)) now+=uni.find(uni.root(v));
		out[v]=now;
		rep(i,gr[v].size()){
			int w=gr[v][i];
			if(u==w) continue;
			dfs2(w,v,now);
		}
	}
}
int main()
{
	int n,a,b;
	cin>>n;
	rep(i,n-1){
		cin>>a>>b;gr[a].pb(b);gr[b].pb(a);
	}
	memset(ka,false,sizeof(ka));
	dfs(1,0,0,0);
	REP(i,1,n+1) rep(j,gr[i].size()){
		int k=gr[i][j];
		if(!ka[i] && !ka[k]) uni.unions(i,k);
	}
	dfs2(1,0,-1);
	REP(i,2,n+1){
		cout<<out[i];
		if(i<n) cout<<' ';else cout<<endl;
	}
}


Measured memory_bytes: 50304
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b;
   cin>>a>>b;
   for (int i=0;i<=100000;i++)
   {
       double g=0.08*i;
       double h=0.1*i;
       if (floor(g)==a and floor(h)==b)
       {
           cout<<i;
           return 0;
       }
   }
   cout<<-1;
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

int N;

ll A[MAX_N + 1], B[MAX_N + 1], C[MAX_N + 1], BC[MAX_N + 1], SB[MAX_N + 1];

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

    cin >> N;

    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    for (int i = 1; i <= N; i++) {
        cin >> B[i];
    }
    for (int i = 1; i <= N; i++) {
        cin >> C[i];
    }

    sort(A + 1, A + N + 1);
    sort(B + 1, B + N + 1);
    sort(C + 1, C + N + 1);

    for (int i = 1; i <= N; i++) {
        BC[i] = C + N + 1 - upper_bound(C + 1, C + N + 1, B[i]);
    }

    for (int i = 1; i <= N; i++) {
        SB[i] = SB[i - 1] + BC[i];
    }

    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += SB[N] - SB[upper_bound(B + 1, B + N + 1, A[i]) - B - 1];
    }

    /*
    for (int i = 1; i <= N; i++) {
        cout << "i = " << i << ", BC = " << BC[i] << "\n";
    }
    */

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 7584
N = int(input())
jobs = [0] * N
for i in range(N):
    Ai,Bi = list(map(int,input().split()))
    jobs[i] = (Bi,Ai)
jobs = sorted(jobs)
flag = True
sumT = 0
for bi,ai in jobs:
    sumT += ai
    if bi < sumT:
        flag = False
        break

if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 60316
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (long long i = (a); i <= (b); i++)
#define FORD(i,a,b) for (long long i = (a); i >= (b); i--)
#define REP(i,a) FOR(i,0,(long long)(a)-1)
#define reset(a,b) memset(a,b,sizeof(a))
#define all(x) x.begin(), x.end()
#define uni(x) x.erase(unique(all(x)), x.end());
#define BUG(x) cout << #x << " = " << x << endl
#define BUGP(x) cout << #x << " = " << x._1 << ", " << x._2 << endl
#define PR(x,a,b) {cout << #x << " = "; FOR (_,a,b) cout << x[_] << ' '; cout << endl;}
#define CON(x) {cout << #x << " = "; for(auto _i:x) cout << _i << ' '; cout << endl;}
#define mod 1000000007
#define pi acos(-1)
#define eps 1e-8
#define pb push_back
#define sqr(x) (x) * (x)
#define _1 first
#define _2 second

int n, nok[333], lis[666][666];
string grid[333];

int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  REP (i, n) cin >> grid[i];
  REP (i, 2 * n - 1) REP (j, 2 * n - 1) lis[i][j] = grid[i % n][j % n] - 'a';
  REP (i, 2 * n - 1) REP (j, 2 * n - 1) REP (k, n) {
    int i2 = i + k;
    int j2 = j - k;
    if (i2 >= 2 * n - 1 || j2 < 0) continue;
    if (lis[i][j] != lis[i2][j2] && i < n && j2 < n) nok[(i - j2 + n) % n] = 1;
  }
  int ans = 0;
  REP (i, n) ans += 1 - nok[i];
  cout << ans * n;
}


Measured memory_bytes: 1920
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
int main()
{
	char S[20];
	int L = 0, an = 0;
	scanf("%s", S);
	int i = 0;
	while (S[i] != '\0') {
		if (S[i] != 'A' && S[i] != 'C' && S[i] != 'G' && S[i] != 'T') {
			L = 0;
		}
		else {
			L++;
			if (L > an) {
				an = L;
			}
		}
		i++;
	}
	printf("%d",an);
	return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;
import java.util.regex.Pattern;





public class Main {

	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct 

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long mod = (long)(1e9+7);
	public static void main(String[] args) {
		 FastReader sc = new FastReader();
		int n = sc.nextInt();
		int[] p = new int[n];
		for(int i=0;i<n;++i) p[i] = sc.nextInt();
		int ans = 0;
		for(int i=1;i+1<n;++i) {
			int[] a = {p[i-1],p[i],p[i+1]};
			Arrays.sort(a);
			if(p[i] == a[1]) ++ans;
		}
		out.println(ans);
		out.close();
		 
	}
	

}


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

int X[69], Y[69];
set< pair<int, int> > S;

int func(int p, int q, int N)
{
    int ans = N;

    for(int i=1; i<=N; i++)
      if (S.find({X[i] + p, Y[i] + q}) != S.end())
        ans--;
    
    return ans;
}

int main()
{
    ios::sync_with_stdio(0);
    
    int N;
    cin >> N;

    for(int i=1; i<=N; i++)
    {
        cin >> X[i] >> Y[i];
        S.insert({X[i], Y[i]});
    }

    int ans = N;

    for(int i=1; i<=N; i++)
        for(int j=i+1; j<=N; j++)
        {
            int p = X[j] - X[i];
            int q = Y[j] - Y[i];

            ans = min(ans, func(p, q, N));
        }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a[101],n,d,x,i,sam=1,cnt=0,ans=0;
  cin>>n;
  cin>>d>>x;
  for(i=0; i<n; i++){
    cin>>a[i];
  }
  for(i=0; i<n; i++){
    sam=1;
    while(sam<=d){
      cnt++;
      sam+=a[i];
    }
  }
  ans=x+cnt;
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  int n,k,q;
  cin >> n >> k >> q;
  std::vector<int> a(n,k);
  rep(i,q) {
    int x;
    cin >> x;
    x--;
    a.at(x)++;
  }

  rep(i,n) {
    if (a.at(i) - q <= 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
}


Measured memory_bytes: 3768