akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;

ll NUM = 1000000007;

int main(){
  int n,m;
  cin >> n >> m;
  VI a(m+1);
  rep(i,m) cin >> a[i];
  a[m] = n+1;
  
  rep(i,m-1){
    if(a[i+1]-a[i] == 1){
      cout << 0;
      return 0;
    }
  }
  
  vector<ll> fib(100010);
  fib[0] = 1;
  fib[1] = 1;
  rep2(i,2,100010){
    fib[i] = fib[i-1] + fib[i-2];
    if(fib[i] > NUM) fib[i] = fib[i] % NUM;
  }
  
  ll ans=1;
  int cur=0;
  rep(i,m+1){
    int diff = a[i] - cur - 1;
    ans *= fib[diff];
    if(ans > NUM) ans = ans % NUM;
    cur = a[i] + 1;
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
using namespace std;
#define int long long
signed main() {
	string s;
	cin>>s;
	int n=s.size();
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	    if(s[i]!=s[j])
	    break;
	    i++;
	    j--;
	}
	if(i!=j)
	{
	    cout<<"No"<<endl;
	    return 0;
	}
	j=(n-1)/2-1;
	i=0;
	while(i<j)
	{
	    if(s[i]!=s[j])
	    {
	        cout<<"No";
	        return 0;
	    }
	    i++;
	    j--;
	}
	cout<<"Yes";
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;


int main(){
    ll x, y;
    cin>> x >> y;
    ll num=x, ans=0;
    while(num <= y){
        ans++;
        num*=2;
    }
    cout << ans << endl;
    return 0;
}

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

#define all(x) (x).begin(), (x).end()

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    int m;
    int k;
    int cnt;
    int ans;
    vector< vector<int> > p;
    vector<int> l;

    while(cin >> n, n){

        p.resize(n);

        for (auto &x : p){

            cin >> m;
            x.resize(m);

            for (auto &y : x)
                cin >> y;

        }


        cin >> k;
        l.resize(k);

        for(auto &x : l)
            cin >> x;

        sort(all(l));

        cnt = 0;
        ans = 0;

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

            sort(all(p[i]));

            if(includes(all(p[i]), all(l))){
                cnt++;
                ans = i + 1;
            }

        }

        if(cnt != 1)
            cout << -1 << endl;
        else
            cout << ans << endl;

    }

    return 0;

}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define ll_1e9 (ll)1e9
using namespace std;

const ll MOD = 1e9+7;

template <ll MOD>
struct modint{
    ll x;
    modint() : x(0) {}
    modint(ll a): x((a % MOD + MOD) % MOD) {}
    
    

    bool operator!() const{return !x;}

    bool operator<(const modint &a) const{
        modint res(*this);
        return res.x < a.x;
    }
    
    bool operator>(const modint &a) const{
        modint res(*this);
        return res.x > a.x;
    }

    modint &operator+=(const modint &a){
        if((x += a.x) >= MOD) x -= MOD;
        return *this;
    }

    modint &operator-=(const modint &a){
        if((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }

    modint &operator*=(const modint &a){
        (x *= a.x) %= MOD;
        return *this;
    }

    modint &operator/=(const modint &a){
        *this *= a.inv();
        return *this;
    }

    modint &operator%=(const modint &a){
        x %= a.x;
        return *this;
    }

    modint operator-() const{ return modint(-x); }

    modint operator+(const modint &a) const{ return modint(*this) += a; }
    modint operator-(const modint &a) const{ return modint(*this) -= a; }
    modint operator*(const modint &a) const{ return modint(*this) *= a; }
    modint operator/(const modint &a) const{ return modint(*this) /= a; }
    modint operator%(const modint &a) const{ return modint(*this) %= a; }
    bool operator==(const modint &a) const{ return x == a.x; }
    bool operator!=(const modint &a) const{ return x != a.x; }


    modint pow(ll n) const{
        modint res(1), a(x);
        while(n > 0){
            if(n & 1) res *= a;
            a *= a;
            n /= 2;
        }
        return res;
    }

    modint inv() const{
        ll a = x,b = MOD,u = 1,v = 0;
        while(b){
            ll t = a/b;
            a -= t*b; swap(a,b);
            u -= t*v; swap(u,v);
        }
        u %= MOD;
        if(u < 0) u += MOD;
        return modint(u);
    }

    friend ostream &operator<<(ostream &os, const modint &m){
        return os << m.x;
    }

    friend istream &operator>>(istream &is, modint &m){
        ll t;
        is >> t;
        m = modint<MOD>(t);
        return (is);
    }
    
    static ll get_mod(){ return MOD; }
};
using mint = modint<MOD>;


      
void comb_init(vector<vector<mint> > &comb){
  comb[1][0] = 1; comb[1][1] = 1;comb[0][0] = 1;
  rep(i,2,comb.size()){
    comb[i][i] = 1; comb[i][0] = 1;
    rep(j,1,i){
      comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
    }
  }
  return;
}

int main(){
  ll n,k;
  cin >> n >> k;
  vector<vector<mint> > comb(n+100, vector<mint>(n+100));
  comb_init(comb);


  rep(i,1,k+1){
    cout << comb[n-k+1][i]*comb[k-1][i-1] << endl;
  }

  return 0;
}


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

int main() {
    unsigned int n, i;
    int ai;
    std::vector<int> a;
    std::vector<int> dp;
    while (std::cin >> n && n) {
        for (i = 0; i < n; i++) {
            std::cin >> ai;
            a.push_back(ai);
        }
        dp.push_back(a.front());
        for (i = 1; i < n; i++) {
            dp.push_back(std::max(dp[i - 1] + a[i], a[i]));
        }
        std::cout << *std::max_element(dp.begin(), dp.end()) << std::endl;
        a.clear();
        dp.clear();
    }
    return 0;
}

Measured memory_bytes: 1272
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}
func gcd(m, n int) int {
	if n == 0 {
		return m
	}
	return gcd(n, m%n)
}
func main() {
	scanner := makeWordScanner()
	c := eGetFields(scanner)[0]
	fmt.Println(string(int(c[0]) + 1))

}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	return int(math.Pow(float64(a), float64(n)))
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define maxn 500005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, k;
ll ans;
char ch[11];
void dfs(int now,ll lasnum,ll sum){
	if(now == n){
		sum += lasnum;
		ans += sum;
		return ;
	}
	dfs(now + 1, lasnum * 10 + ch[now + 1] - '0', sum);
	dfs(now + 1, ch[now + 1] - '0', sum + lasnum);
}
int main(){
	int i, j, x, l, r, mid;
	scanf("%s", ch + 1);
	n = strlen(ch + 1);
	dfs(1, ch[1] - '0', 0);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3784
n = int(input())
val = list(map(int,input().split()))
if n == 1:
	print(val[0])
else:
	sor = sorted(val)
	sor.append((sor[0] + sor[1])/2)
	del sor[0]
	del sor[0]
	for i in range(n-2):
		sor.append((sor[0] + sor[-1])/2)
		del sor[0]
		del sor[-2]
	print(sor[0])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock
#endif
#define int long long
#define ins insert
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define g0(a) get<0>(a)
#define g1(a) get<1>(a)
#define g2(a) get<2>(a)
#define g3(a) get<3>(a)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long double ld;
typedef long long ll;
typedef tree<pair<int, int>, null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int N, M, L, Q, dist[305][305], dist2[305][305];

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> M >> L;
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			dist[i][j] = dist2[i][j] = (i == j ? 0 : 1e15);
	for (int u, v, w; M--; ) {
		cin >> u >> v >> w;
		dist[u][v] = dist[v][u] = min(dist[u][v], w);
	}
	for (int k = 1; k <= N; k++)
		for (int i = 1; i <= N; i++)
			for (int j = 1; j <= N; j++)
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			if (dist[i][j] <= L) dist2[i][j] = dist2[j][i] = 1;
	for (int k = 1; k <= N; k++)
		for (int i = 1; i <= N; i++)
			for (int j = 1; j <= N; j++)
				dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
	cin >> Q;
	for (int u, v; Q--; ) {
		cin >> u >> v;
		cout << (dist2[u][v] == 1e15 ? -1 : dist2[u][v] - 1) << '\n';
	}
}


Measured memory_bytes: 2048
n, y = map(int,input().split())
ans = [-1,-1,-1]
for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            ans = [i,j,n-i-j]
print(*ans)



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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str):
    print(YES if len(set(list(S))) == 2 else NO)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	int n=scan.nextInt();
	
	
	int c[]=new int[n];
	for(int i=0;i<n;i++)
	    {
		c[i]=scan.nextInt();
	    }
	
	
	for(int i=1;i<n;i++)
	    {
		for(int k=0;k<n;k++)
		    {
			System.out.print(c[k]+((k!=n-1)?" ":""));
		    }
		int j=i;
		while(j>=1 && c[j-1]>c[j])
		    {
			
			int temp=c[j];
			c[j]=c[j-1];
			c[j-1]=temp;
			
			j--;
			
		    }
		
		System.out.println();
		
	    }
	for(int k=0;k<n;k++)
		    {
			System.out.print(c[k]+((k!=n-1)?" ":""));
		    }
	System.out.println();
    }
}

Measured memory_bytes: 24260
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n;
    cin >> n;
    for (ll i=0;i<n;i++){
        ll a;
        cin >> a;
        if (a%2==0 and a%3!=0 and a%5!=0){
            cout << "DENIED"<< endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

mod=10**9+7

MAX_N = n+5
fac = [1,1] + [0]*MAX_N
finv = [1,1] + [0]*MAX_N
inv = [0,1] + [0]*MAX_N
for i in range(2, MAX_N):
    fac[i] = fac[i-1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i-1] * inv[i] % mod

def nCk(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

lim=n//3
ans=0
for i in range(1,n+1):
  ans+=nCk(n-3*i+i-1,i-1)
  ans%=mod

print(ans)

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

int main() {

  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());

  if (s < t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

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

int n, a[1025][1025];
bool vis[1025], flag;
bool ok() {
  for (int i = 1; i <= n; i++)
    if (a[i][0] != n) return 0;
  return 1;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n - 1; ++j) cin >> a[i][j];
    a[i][0] = 1;
  }
  for (int z = 0; z <= 0x3f3f3f3f; z++) {
    if (ok()) {
      cout << z << '\n';
      return 0;
    }
    flag = 0;
    memset(vis, 0, sizeof vis);
    for (int i = 1; i <= n; i++) {
      if (vis[i] || a[i][0] == n) continue;
      int x = a[i][a[i][0]];
      if (a[x][a[x][0]] == i && !vis[i] && !vis[x]) {
        a[i][0]++;
        a[x][0]++;
        vis[i] = vis[x] = 1;
        flag = 1;
      }
    }
    if (!flag) {
      cout << -1 << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 4352
K = int(input())
nana=7
kou=1
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
    print(kou)

Measured memory_bytes: 9044
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
a = []
for i in A:
    heapq.heappush(a, -i)

for i in range(M):
    heapq.heappush(a, -(-heapq.heappop(a) // 2))

print(-sum(a))

Measured memory_bytes: 14180
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll a,b,c,x,y;
  ll ans=0;
  cin>>a>>b>>c>>x>>y;

  if(c*2<=a+b){
    while(x!=0&&y!=0){
      ans+=c*2;
      x--;y--;
    }
  }
  if(c*2<=a){
    while(x>0){
      ans+=c*2;
      x--;y--;
    }
  }
  if(c*2<=b){
    while(y>0){
      ans+=c*2;
      x--;y--;
    }
  }
  while(x>0){
    ans+=a;
    x--;
  }
  while(y>0){
    ans+=b;
    y--;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
int x;
int ar[N];
int dp[N];

int main(){
    scanf("%d%d" , &n , &x);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &ar[i]);
    }
    dp[1] = 0;
    for(int i = 2; i <= n+1; i++){
        dp[i] = dp[i - 1] + ar[i - 1];
    }
    int cnt = 0;
    for(int i = 1; i <= n+1; i++){
        //cout << dp[i] << " ";
        if(dp[i] <= x){
            cnt++;
        }
    }
    printf("%d\n" , cnt);
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    string S, T;
    cin >> S >> T;
    int len = S.length();
    int s[50], t[50];
    REP(i, 50) s[i] = t[i] = -1;
    REP(i, len){
        int p = S[i] - 'a', q = T[i] - 'a';
        if((s[p] == -1 && t[q] == -1) || (s[p] == q && t[q] == p)){
            s[p] = q;
            t[q] = p;
            continue;
        }else{
            PRINT("No");
            return 0;
        }
    }
    PRINT("Yes");
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<long long> > task(n, vector<long long>(2));
  for (int i = 0; i < n; i++) cin >> task.at(i).at(1) >> task.at(i).at(0);
  sort(task.begin(), task.end());
  long long t = 0;
  for (int i = 0; i < n; i++) {
    t += task.at(i).at(1);
    if (t > task.at(i).at(0)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h> // imports every library in c++
using namespace std; // ; is essential | says that you are USING the libraries

//  COMMAND TO USE WHEN RUNNING CODE: g++ day1.cpp -o day1 -std=c++11 -O2  | to run: ./(name of file)  //

int a, b, n;
stack<int> S;

int main() {
    cin >> a >> b;
    if ( a > 0 and b > 0 ) {
        cout << "Positive\n";
        return 0;
    } else if ( a < 0 and b < 0 ) {
        if ( a > b ) {
            if ( (a - b) % 2 == 0 ) {
                cout << "Negative\n";
                return 0;
            } else if ( (a - b) % 2 == 1 ) {
                cout << "Positive\n";
                return 0;
            }
        } else if ( b > a ) {
            if ( (b - a) % 2 == 0 ) {
                cout << "Negative\n";
                return 0;
            } else if ( (b - a) % 2 == 1 ) {
                cout << "Positive\n";
                return 0;
            }
        }
    } else {
        cout << "Zero\n";
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = list(map(int,sys.stdin.readline().split()))
# a = [sys.stdin.readline() for _ in range(n)]
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
import sys,bisect,math
sys.setrecursionlimit(15000)

K = int(sys.stdin.readline())
A,B = map(int,sys.stdin.readline().split())

if A%K == 0 or B%K == 0:
    print("OK")
    exit()
if A//K == B//K:
    print("NG")
    exit()
print("OK")


Measured memory_bytes: 9044
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int N, D;
    cin >> N >> D;
    int X[N][D];
    REP(i, N) REP(j, D) cin >> X[i][j];

    set<int> sq;
    REP(i, 200) sq.insert(i * i);

    int c = 0;
    REP(i, N - 1) {
        FOR(j, i + 1, N) {
            int d2 = 0;
            REP(k, D) {
                d2 += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            if (sq.find(d2) != sq.end()) c++;
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int N;
  cin >> N;
  vector<pair<int, int> > X(N);
  rep(i, N) cin >> X[i].first >> X[i].second;
  double sum = 0;
  rep(i, N) rep(j, N) if(i != j)
    sum += sqrt(pow(X[i].first - X[j].first, 2) +
                pow(X[i].second - X[j].second, 2));
  int fact = 1;
  rep(i, N) fact *= (i+1);
  cout << setprecision(15) << sum / N << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <numeric>
#include <set>

using namespace std;

int main() {
    int n, m, a, b;
    scanf("%d%d", &n, &m);
    vector< set<int> > e(n);
    vector< vector<int> > d(1 << n, vector<int>(n));
    for (int i = 0; i < m; ++i) {
        scanf("%d%d", &a, &b);
        --a, --b;
        e.at(a).insert(b);
        e.at(b).insert(a);
    }
    d.at(1).at(0) = 1;
    for (int i = 1; i < (1 << n); ++i) {
        for (int j = 0; j < n; ++j) for (int k = 0; k < n; ++k) {
            if ((i & (1 << k)) == 0 && e.at(j).find(k) != e.at(j).end()) d.at(i | (1 << k)).at(k) += d.at(i).at(j);
        }
    }
    printf("%d\n", accumulate(d.back().begin(), d.back().end(), 0));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int N,K;
    cin >> N >> K;
    int h[N];
    rep(i,N) cin >> h[i];
    
    int sum=0;
    rep(i,N){
        if(h[i]>=K) sum+=1;
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3456
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
using namespace std;
typedef pair<int, int> point;

int main(void) {
    int n, r=1;
    cin >> n;
    
    vector<int> b;
    for(int i=1; i<=n; i++) {
        int a;
        cin >> a;
        if(r)
            b.push_back(a);
        else
            b.insert(b.begin(), a);
        r=1-r;
    }
    
    if(n%2==0) {
        for(int i=0; i<n; i++)
            printf("%d ", b[i]);
    }else {
        for(int i=n-1; i>=0; i--)
            printf("%d ", b[i]);
    }
}


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,q;
  cin >> a >> b >> q;
  vector<ll> s(a);
  vector<ll> t(b);
  for(int i = 0;i < a;i++)cin >> s[i];
  for(int i = 0;i < b;i++)cin >> t[i];
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  for(int i = 0;i < q;i++){
    ll x = 0;
    cin >> x;
    ll ls,lt,rs,rt;
    rs = lower_bound(s.begin(),s.end(),x) - s.begin();
    rt = lower_bound(t.begin(),t.end(),x) - t.begin();
    ls = rs - 1;
    lt = rt - 1;
    //rs = min(rs,a - 1),rt = min(rt,b - 1);
    if(rs >= a)rs = pow(10,18);
    else rs = s[rs];
    if(rt >= b)rt = pow(10,18);
    else rt = t[rt];
    //ls = max(ls,(ll)0),lt = max(lt,(ll)0);
    if(ls < 0)ls = -1 * pow(10,18);
    else ls = s[ls];
    if(lt < 0)lt = -1 * pow(10,18);
    else lt = t[lt];
    //ls = s[ls],lt = t[lt],rs = s[rs],rt = t[rt];
    ll res = 0;
    //cout << ls << " " << lt << " " << rs << " " << rt << endl;
    res = pow(10,18);
    res = min(res,abs(min(ls,lt) - x));
    //cout << res << endl;
    res = min(res,abs(max(rs,rt) - x));
    //cout << res << endl;
    res = min(res,min(abs(x - ls),abs(x - rt)) * 2 + max(abs(x - ls),abs(x - rt)));
    //cout << res << endl;
    res = min(res,min(abs(x - lt),abs(x - rs)) * 2 + max(abs(x - lt),abs(x - rs)));
    cout << res << endl;
    //return 0;
  }
  //vector<ll> a = {1,3,5};
  //cout << lower_bound(a.begin(),a.end(),8) - a.begin() << endl;
}

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

int main(){
  int K;
  cin>>K;
  if(K%2==0||K%5==0){
    cout<<-1<<endl;
    return 0;
  }
  int temp=0;
  for(int i=0;i<=K;i++){
    temp=7+temp*10;
    if(temp%K==0){
      cout<<i+1<<endl;
      return 0;
    }
    temp=temp%K;
  }
  return 0;
}



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

typedef long long ll;

using namespace std;


const ll mod=1000000007;

vector<int> fun(ll x){
    vector<int> vec;
    vec.push_back(1);
    for(ll a=2;a*a<=x;++a){
        if(x%a!=0)continue;
        while(x%a==0){
            x=x/a;
        }
        vec.push_back(a);
    }
    if(x!=1)vec.push_back(x);
    return vec;
}


int  main(){
    ll A,B;
    cin>>A>>B;

    vector<int> veca;
    vector<int> vecb;

    veca=fun(A);
    vecb=fun(B);
    /*
    for(int i=0;i<veca.size();++i){
        cout<<veca[i]<<" ";
    }
    cout<<endl;
    

       for(int i=0;i<vecb.size();++i){
        cout<<vecb[i]<<" ";
    }
    cout<<endl;
    */


    int count=0;

    for(int i=0;i<veca.size();++i){
        for(int j=0;j<vecb.size();++j){
            if(veca[i]==vecb[j]){
                ++count;
            }
        }
    }

   cout<<count<<endl;
     



 
}



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main (){
  
  string n;
  char s[10];
  int l,k,i;
  
  cin>>l; cin>>n; cin>>k;
  
  for (i=0; i<l;i++){
      if (n[i]==n[k-1]) s[i]=n[i];
      else s[i]='*';

  }
     for (i=0; i<l;i++){cout<<s[i];
  }
    
return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    S = [0]
    for i in range(N):
        A = int(input_raw[i])
        S.append(S[i] + A)
    sum_dic = {}
    for s in S:
        if s not in sum_dic:
            sum_dic[s] = 1
        else:
            sum_dic[s] += 1
    count = 0
    sum_dic[0] -= 1
    for su in sum_dic:
        count += sum_dic[su] * (sum_dic[su] - 1)/2
        if su == 0:
            count += sum_dic[su]


    print count

if __name__ == '__main__':
    main()

Measured memory_bytes: 46328
#include<bits/stdc++.h>
#define MAX 210
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int h,w;
string grid[MAX];
int mem1[MAX][MAX],mem2[MAX][MAX];

void init(){
  FOR(i,0,MAX){
    FOR(j,0,MAX){
      mem1[i][j]=inf;
      mem2[i][j]=inf;
    }
  }
}

bool in(int a,int b){
  if(a<0 || b<0 || h<=a || w<=b)return false;
  return true;
}

string solve(){
  queue<pii> q;
  FOR(i,0,h){
    FOR(j,0,w){
      if(grid[i][j]=='$'){
        q.push(mp(i,j));
        mem1[i][j]=0;
      }
    }
  }
  while(q.size()){
    pii u=q.front();
    q.pop();
    FOR(k,0,4){
      int ni=u.f+dy[k],nj=u.s+dx[k];
      if(!in(ni,nj))continue;
      if(grid[ni][nj]=='#')continue;
      if(mem1[u.f][u.s]+1<mem1[ni][nj]){
        mem1[ni][nj]=mem1[u.f][u.s]+1;
        q.push(mp(ni,nj));
      }
    }
  }
  FOR(i,0,h){
    FOR(j,0,w){
      if(grid[i][j]=='@'){
        q.push(mp(i,j));
        mem2[i][j]=0;
      }
    }
  }
  while(q.size()){
    pii u=q.front();
    q.pop();

    if(grid[u.f][u.s]=='%')return "Yes";

    FOR(k,0,4){
      int ni=u.f+dy[k],nj=u.s+dx[k];
      if(!in(ni,nj))continue;
      if(grid[ni][nj]=='#')continue;
      if(mem2[u.f][u.s]+1<mem2[ni][nj] && mem2[u.f][u.s]+1<mem1[ni][nj]){
        mem2[ni][nj]=mem2[u.f][u.s]+1;
        q.push(mp(ni,nj));
      }
    }
  }
  return "No";
}

int main()
{
  init();

  cin>>h>>w;
  FOR(i,0,h)cin>>grid[i];

  cout<<solve()<<endl;

  return 0;
}

Measured memory_bytes: 3748
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int x = vs[0], y = vs[1], z = vs[2], k = vs[3];

			long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			long[] b = Console.ReadLine().Split().Select(long.Parse).ToArray();
			long[] ab = new long[x * y];
			int index = 0;
			for (int i = 0; i < x; i++) {
				for (int j = 0; j < y; j++) {
					ab[index] = a[i] + b[j];
					index++;
				}
			}
			Array.Sort(ab);
			Array.Reverse(ab);
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", ab));

			long[] c = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int len = Math.Min(k, ab.Length);
			long[] abc = new long[len * z];
			index = 0;
			for (int i = 0; i < len; i++) {
				for (int j = 0; j < z; j++) {
					abc[index] = ab[i] + c[j];
					index++;
				}
			}
			Array.Sort(abc);
			Array.Reverse(abc);
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", abc));

			for (int i = 0; i < k; i++) {
				Console.WriteLine(abc[i]);
			}


			Console.Out.Flush();
		}
	}
}


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

#define LL long long

#define FOR(INDEX, START, END) for (int INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (int INDEX = 0; INDEX < (COUNT); ++INDEX)

LL gcd(LL a, LL b) {
    for (;;) {
        LL c = a % b;
        
        if (c == 0) {
            return b;
        }
        
        a = b;
        b = c;
    }
}

int main()
{
    LL N, X;
    cin >> N >> X;
    
    set<LL> xs;
    for (LL i = 0; i < N; ++i) {
        LL x;
        cin >> x;
        xs.insert(x);
    }
    xs.insert(X);
    
    LL before = *xs.begin();
    xs.erase(xs.begin());
    LL D = 0;
    for (LL x : xs) {
        if (D == 0) {
            D = x - before;
        } else {
            D = gcd(D, x - before);
        }
    }
    
    cout << D << endl;

    return 0;
}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define int long long
#define pb push_back
#define inf 1e9
#define mod 1000000007

string fun(vector<int>& arr, int k)
{
	bool dp[k + 1];
	memset(dp, 0, sizeof(dp));

	for (int i = 1; i <= k; i++)  //checking for the ith pile if it would lead to win
	{
		for (int x : arr)
		{
			if (x > i)
				continue;
			if (dp[i - x] == 0)  //if removing x pile leads to a losing state for opponent then put 1
				dp[i] = 1;
		}
	}
	return dp[k] ? "First" : "Second";
}


void solve()
{
	int n, k;
	cin >> n >> k;
	vector<int> arr(n);
	for (int i = 0; i < n; i++)
		cin >> arr[i];

	cout << fun(arr, k);
}

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


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
const int inf=1e9;
typedef long long ll;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
struct edge { int to,nxt; } e[N<<1];
int tot=1,h[N];
void adde(int u,int v) {
    e[++tot]=(edge){v,h[u]};h[u]=tot;
    e[++tot]=(edge){u,h[v]};h[v]=tot;
}
int n,sum=0,siz[N],mx[N],sx[N],l[N],r[N];
char s[N];
ll ans=0;
void dfs1(int u,int fa) {
    siz[u]=s[u]-'0';
    for(int i=h[u];i;i=e[i].nxt) {
        int v=e[i].to; if(v==fa) continue;
        dfs1(v,u); siz[u]+=siz[v];
        if(mx[v]+1>mx[u]) sx[u]=mx[u],mx[u]=mx[v]+1;
        else if(mx[v]+1>sx[u]) sx[u]=mx[v]+1;
    }
}
void dfs2(int u,int fa,int len) {
    r[u]=len>mx[u]?mx[u]:max(len,sx[u]);
    l[u]=s[u]-'0'?0:(sum-siz[u]?len:inf);
    if(fa) {
        if(len-1==mx[u]) ans++;
        else if(len-1<mx[u]) ans+=siz[u]<sum;
        else ans+=siz[u]>0;
    }
    for(int i=h[u];i;i=e[i].nxt) {
        int v=e[i].to; if(v==fa) continue;
        if(siz[v]) l[u]=min(l[u],mx[v]+1);
        if(mx[u]==mx[v]+1) dfs2(v,u,max(len,sx[u])+1);
        else dfs2(v,u,max(len,mx[u])+1);
    }
}
int main() {
    cin>>n;
    for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),adde(u,v);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) sum+=s[i]-'0';
    dfs1(1,0);dfs2(1,0,0);
    for(int i=1;i<=n;i++) if(l[i]<=r[i]) ans+=r[i]-l[i]+1;
    printf("%lld\n",ans);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 15360
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll MOD = 1e9 + 7;
ll H, N, M, L, K, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> H >> W;
	bool flag = 0;
	bool endlflag = 0;
	vector<vector<int>> a(H+1, vector<int>(W+1));
	pair<int, int>last;
	for (int i = 1; i <= H; i++)for (int j = 1; j <= W; j++)cin >> a[i][j];
	for (int i = 1; i <= H; i++) {
		if (i % 2) {
			for (int j = 1; j <= W; j++) {
				if (a[i][j] % 2) {
					last = { i,j };
				}
			}
		}
		else {
			for (int j = W; j > 0; j--) {
				if (a[i][j] % 2) {
					last = { i,j };
				}
			}
		}
	}
	pair<int, int>prev;
	vector<vector<int>>move;
	for (int i = 1; i <= H; i++) {
		if (i % 2) {
			for (int j = 1; j <= W; j++) {
				if (flag) {
					ans++;
					move.push_back({ prev.first,prev.second,i,j });
					prev = { i,j };
				}
				if (a[i][j] % 2) {
					prev = { i,j };
					if (flag == 0 && last==prev )break;
					flag = (flag + 1) % 2;
					if (flag)continue;
				}
			}
		}
		else {
			for (int j = W; j > 0; j--) {
				if (flag) {
					ans++;
					move.push_back({ prev.first,prev.second,i,j });
					prev = { i,j };
				}
				if (a[i][j] % 2) {
					prev = { i,j };
					if (flag == 0 && prev == last)break;
					flag = (flag + 1) % 2;
					if (flag)continue;
				}
			}
		}
	}
	cout << ans << endl;
	for (int i = 0; i < ans; i++) {
		printf("%d %d %d %d\n", move[i][0], move[i][1], move[i][2], move[i][3]);
	}
}


Measured memory_bytes: 10032
/*
AizuOnline A2001
Amida
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
#include <limits.h>
//Global data section
int m,n,a;
struct amida {
  int h;
  int p;
  int q;} ami[1000];
//
int _read()
{
  int i;
  scanf("%d %d %d",&n,&m,&a);
  if(n==0 && m==0 && a==0)
    return(0);
  for(i=0;i<m;i++)
    {
      scanf("%d %d %d",&(ami[i].h),&(ami[i].p),&(ami[i].q));
    }
  return(-1);
}
int comp(void * x,void * y)
{
  return(((struct amida *)y)->h - ((struct amida *)x)->h);
}
show()
{
  int i;
  for(i=0;i<m;i++)
      printf("%d %d %d\n",ami[i].h,ami[i].p,ami[i].q);
}
main()
{
  int i,anext,mnext,hnext;

  
  while(_read())
    {
      qsort(ami,m,sizeof(struct amida),comp);
      //show();
      anext = a;
      hnext = INT_MAX;
      for(i=0;i<m;i++)
	{
	  //printf("hn:%d\n",hnext);
	  if(ami[i].h > hnext)
	    continue;
	  if(ami[i].p == anext)
	    {
	      anext = ami[i].q;
	      hnext  = ami[i].h - 1;
	    }
	  else if(ami[i].q == anext)
	    {
	      anext = ami[i].p;
	      hnext  = ami[i].h - 1;
	    } 
	}
      printf("%d\n",anext);
    }
  
return(0);
}

Measured memory_bytes: 664
/* ****Tciitb**** */
                     
#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          int long long
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll ,ll >
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a-1;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;
#define N 100005 

 


 int main()
{
  io
  ll d,n;
  cin>>d>>n;
  if(d==0)
  {
    if(n==100)
      cout<<n+1;
    else
     cout<<n;
     return 0;
  }
  if(d==1)
  {
     if(n==100)
     cout<<100*(n+1);
   else
    cout<<100*n;
     return 0;
  }
  if(d==2)
  {
    if(n==100)
     cout<<10000*(n+1);
   else
    cout<<10000*n;
     return 0;
  }


  
}
  

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b)for(int i=(a);i<=(b);i++)
#define repR(i,n) for(int i=n;i>=0;i--)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n); rep(i, n)cin >> a[i];
	sort(ALL(a));
	vector<int>sum(n);
	int now = 0;
	rep(i, n) {
		now += a[i]; sum[i] = now;
	}
	reverse(ALL(sum));
	int ans = 1;
	rep(i, n - 1) {
		if (sum[i + 1] * 3 >= sum[i])ans++;
		else break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
main(){
	int days;
	scanf("%d",&days);
	char key[days];
	scanf("%s",key);
	int i,j;
	int a[7][days+1];//0=j,1=i,2=o,3=ji,4=jo,5=oi,6=joi
	for(i=0;i<days+1;i++){
		for(j=0;j<7;j++){
			a[j][i]=0;
		}
	}
	a[0][0]=1;
	for(i=0;i<days;i++){
		if(key[i]=='J'){
			a[0][i+1]=a[0][i]+a[3][i]+a[4][i]+a[6][i];
			a[6][i+1]=a[0][i]+a[1][i]+a[2][i]+a[3][i]+a[4][i]+a[5][i]+a[6][i];
			a[3][i+1]=a[6][i+1]-a[2][i];
			a[4][i+1]=a[6][i+1]-a[1][i];
		}
		else if(key[i]=='O'){
			a[2][i+1]=a[2][i]+a[4][i]+a[5][i]+a[6][i];
			a[6][i+1]=a[0][i]+a[1][i]+a[2][i]+a[3][i]+a[4][i]+a[5][i]+a[6][i];
			a[4][i+1]=a[6][i+1]-a[1][i];
			a[5][i+1]=a[6][i+1]-a[0][i];
		}
		else{
		a[1][i+1]=a[1][i]+a[3][i]+a[5][i]+a[6][i];
		a[6][i+1]=a[0][i]+a[1][i]+a[2][i]+a[3][i]+a[4][i]+a[5][i]+a[6][i];
		a[3][i+1]=a[6][i+1]-a[2][i];
		a[5][i+1]=a[6][i+1]-a[0][i];			
		}
		for(j=0;j<7;j++){
			if(a[j][i+1]>10007){
				a[j][i+1]%=10007;
			}
		}
	}
	int sum=0;
	for(i=0;i<7;i++){
		sum+=a[i][days];
	}
	printf("%d\n",sum%10007);
	return 0;
}

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

int n, m;
bool graph[60][60];
int a[60], b[60];
bool reached[60];

void dfs(int x) {
  if (reached[x]) return;
  reached[x] = true;

  rep(i, n) {
    if (graph[x][i]) dfs(i);
  }
}

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

  cin >> n >> m;
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }

  int ans = 0;

  rep(i, m) {
    rep(j, n) reached[j] = false;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

    dfs(0);

    rep(j, n) {
      if (!reached[j]) {
        ans++;
        break;
      }
    }

    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){
  ll N; cin >> N;
  ll i = 1;
  ll ans = 0;
  while (i*i < N){
    if (N % i == 0){
      ll m = N/i-1;
      if (m > i){
        ans += m;
      }
    }
    i++;
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a,b,emax,omax,em,om;
  emax=0;omax=0;
  vector<int> ec(100001,0);
  vector<int> oc(100001,0);
  cin>>n;
  for(int i=0;i<n/2;i++){
    cin>>a>>b;
    ec[a]++;oc[b]++;
    if(ec[a]>emax){emax=ec[a];em=a;}
    if(oc[b]>omax){omax=oc[b];om=b;}
  }
  sort(ec.rbegin(),ec.rend());
  sort(oc.rbegin(),oc.rend());
  if(em!=om){cout<<n-oc[0]-ec[0];}
  else{cout<<min(n-oc[1]-ec[0],n-ec[1]-oc[0]);}
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin>>n>>k;
  int a[n];
  FOR(i,0,n) cin>>a[i];
  if(n<=k)cout<<1<<endl;
  else cout<<(n+k-1-1-1)/(k-1)<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin >> n;

	double ans;
	for(int i=0;i<n;i++){
		double x;
		string u;
		cin >> x >> u;
		if(u=="JPY") ans += x;
		else ans += x * 380000;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define FOR(x,n)                for (ll i=x,j=x,k=x;i<n,j<n,k<n;i++,j++,k++)
#define FORR(n,x)               for (ll i=n-1,j=n-1,k=n-1;i>=x,j>=x,k>=x;i--,j--,k--)
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;
ll tc=1;

void solve()
{
   char ch;
   cin>>ch;
   if (ch>='A' and ch<='Z')cout<<"A"<<endl;
   else cout<<"a"<<endl;

}

int32_t main()
{
    FAST_IO();
   // TEST_CASES()
        solve();
}

Measured memory_bytes: 3604
import math

string = input()

a = int(string.split(" ")[0])
b = int(string.split(" ")[1])
c = int(string.split(" ")[2])
d = int(string.split(" ")[3])

t_tae = math.ceil(a / d)
a_tae = math.ceil(c / b)

if t_tae < a_tae:
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 9136