akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.StringTokenizer;

public class Main{

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Twinkle little = new Twinkle();
        little.star(1, in, out);
        out.close();


    }
static class Twinkle {
        public void star(int testNumber, InputReader in, PrintWriter out) {
            int test = in.nextInt();
            if(test==25)
                System.out.println("Christmas");
            else if(test ==24)
                System.out.println("Christmas Eve");
            else if(test==23)
                System.out.println("Christmas Eve Eve");
            else if(test==22)
                System.out.println("Christmas Eve Eve Eve");
}
}
  


    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
      public   String nextLine()
        {
            String str = "";
            try
            {
                str = reader.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

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

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

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

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(line);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }
    }
}


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

ll gcd(ll a, ll b){
	if (a == 0) return b;
	return gcd(b  %a, a);
}

ll lcm(ll a, ll b){
	return (a*b) / gcd(a, b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll x,n,i,j;

	cin >> x >> n;

	map <ll,ll> a;

	for(i=0;i<n;i++)
	{
		ll y;
		cin >> y;

		a.insert(make_pair(y,1));
	}

	for(i=0;i<101;i++)
	{
		if(a.find(x-i) == a.end())
		{
			cout << x-i << endl;
			break;
		}
		if(a.find(x+i) == a.end())
		{
			cout << x+i << endl;
			break;
		}

	}


}

Measured memory_bytes: 3660
#include <cstdio>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

const int mod = 998244353;

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int mul(int a, int b) {
  return (int)((long long)a * b % mod);
}

const int N = 100'009;

int pw[N];
vector<pair<int, int>> u[N];
vector<pair<int, int>> d[N];
int w[2][2];
int a[N][2][3];
int color[N];
int cnt[N];
int f[N][2];

int main() {
  pw[0] = 1;
  for (int i = 1; i < N; ++i) {
    pw[i] = mul(pw[i - 1], 2);
  }
  int n, m;
  scanf("%d %d", &n, &m);
  memset(w, -1, sizeof w);
  for (int i = 0; i < n; ++i) {
    u[i].clear();
    d[i].clear();
  }
  for (int i = 0; i < m; ++i) {
    int r, c, v;
    scanf("%d %d %d", &r, &c, &v);
    --r;
    --c;
    if (r <= 1 && c <= 1) {
      w[r][c] = v;
    } else
    if (c >= r) {
      u[c].emplace_back(r, v);
    } else {
      d[r].emplace_back(c, v);
    }
  }
  memset(a, -1, sizeof a);
  memset(color, -1, sizeof color);
  for (int i = 2; i < n; ++i) {
    cnt[i] = 0;
    for (auto &e : u[i]) {
      int dist = abs(e.first - i);
      if (dist <= 2) {
        a[i][0][dist] = e.second;
      } else {
        color[e.first] = e.second;
        ++cnt[i];
      }
    }
    for (auto &e : d[i]) {
      int dist = abs(e.first - i);
      if (dist <= 2) {
        a[i][1][dist] = e.second;
      } else
      if (color[e.first] == -1) {
        ++cnt[i];
      } else
      if (color[e.first] != e.second) {
        puts("0");
        return 0;
      }
    }
    for (auto &e : u[i]) {
      if (abs(e.first - i) > 2) {
        color[e.first] = -1;
      }
    }
  }
  memset(f, 0, sizeof f);
  for (int i = 0; i <= 1; ++i) {
    if (w[0][0] != -1 && i != w[0][0]) {
      continue;
    }
    for (int j = 0; j <= 1; ++j) {
      if (w[0][1] != -1 && j != w[0][1]) {
        continue;
      }
      for (int k = 0; k <= 1; ++k) {
        if (w[1][0] != -1 && k != w[1][0]) {
          continue;
        }
        for (int h = 0; h <= 1; ++h) {
          if (w[1][1] != -1 && h != w[1][1]) {
            continue;
          }
          if ((i ^ j ^ k ^ h) == 0) {
            add(f[1][h], 1);
          }
        }
      }
    }
  }
  for (int i = 2; i < n; ++i) {
    for (int j = 0; j <= 1; ++j) {
      for (int nj = 0; nj <= 1; ++nj) {
        if (a[i][0][0] != -1 && nj != a[i][0][0]) {
          continue;
        }
        if (a[i][0][1] != -1 && a[i][1][1] != -1 && (j ^ nj ^ a[i][0][1] ^ a[i][1][1]) == 1) {
          continue;
        }
        if (a[i][0][2] != -1 && a[i][1][2] != -1 && (j ^ a[i][0][2] ^ a[i][1][2]) == 1) {
          continue;
        }
        int bad = cnt[i];
        if (a[i][0][1] != -1 || a[i][1][1] != -1) {
          ++bad;
        }
        if (a[i][0][2] != -1 || a[i][1][2] != -1) {
          ++bad;
        }
        add(f[i][nj], mul(f[i - 1][j], pw[i - bad]));
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= 1; ++i) {
    add(ans, f[n - 1][i]);
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,j,x,y,s=0;
    cin>>n>>k;
    vector< int >vec(n+1,0);
    for(i=0;i<k;i++){
        cin>>x;
        //vec[x]=1;
        for(j=0;j<x;j++){
            cin>>y;
            vec[y]=1;

        }
    }
    for(i=1;i<=n;i++){
        if(vec[i]==0)
            s++;
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>

int main(){
  long a,b,c,d;
  scanf("%ld %ld",&a,&b);
  if(1<=a && a<=1000000000 && 1<=b && b<=1000000000){
  c = a	/ b;
  d = a	% b;
  double f = a;
  double g = b;
  double e = f / g;
  printf("%ld %ld %.5lf\n",c,d,e);
  }
  return 0;
}

Measured memory_bytes: 1068
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache



def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)



def main():
    a,b=map(int,input().split())
    print(a*b)










if __name__ == "__main__":

    main()

Measured memory_bytes: 72628
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define bg begin()
#define ed end()
#define fi first()
#define se second()
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int,int>;
using vpint = vector<pint>;
template <typename T>
T sq(T x){
  return x * x;
}
ll mod = 1e9 + 7;

signed main (){
char a;  
cin >> a;

if(isupper(a)){
cout << 'A' << endl;
}else{
  cout << 'a' << endl;
} 
  return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
//priority_queue<long long, vector<long long>, greater<long long>> pq;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long


const double pi = acos(-1.0);

LL mod = 1e9 + 7;

int n;
LL dp[2005][2005];
pair<LL, LL> a[2005];

int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  reverse(a, a + n);

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

  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    LL w = a[i].first;
    LL x = a[i].second;
    for(int j = 0; j <= i; j++) {
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + w * abs(j - x));
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + w * abs(n - 1 - (i - j) - x));
    }
  }
  LL ans = 0;
  for (int i = 0; i <= n; i++) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {

	int a, b, c, x, A;
	cin >> a >> b >> c >> x;

	A = 0;

	for (int i = 0; i <= a; i++) {
		int sum = 0;
		sum += 500 * i;

		for (int j = 0; j <= b; j++) {
			int sum1 = sum;
			sum1 += 100 * j;

			for (int k = 0; k <= c; k++) {
				int sum2 = sum1;
				sum2 += 50 * k;
//				printf("%d\n", sum2);
				if (sum2 == x) {
					A++;
				}
			}
		}
	
	}
	cout << A << endl;
	return 0;

}

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

int main() {
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n, k;
  cin >> n >> k;
  int a[n];
  map<int, int> cnt;
  for(int i = 0;i< n;i++){
    cin >> a[i];
    cnt[a[i]]++;
  }
  multiset<int> ss;
  for(auto el : cnt)
    ss.insert(el.second);
  int s = 0;
  int res = 0;
  for(auto el : ss){

    if(ss.size() - s <= k)break;
    res += el;
    s++;
  }
  cout << res;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector <string> s(n);
    rep(i,n){
        string t;
        cin >> t;
        sort(all(t));
        s[i] = t;
    }
    
    sort(all(s));

    vector <long> num(0);

    long tmpnum = 1;
    string tmps = s[0];
    for(int i=1; i<n; i++){
        if(tmps == s[i]){
            tmpnum ++;
            if(i==n-1){
                num.push_back(tmpnum);
            }
        }
        else{
            num.push_back(tmpnum);
            tmpnum = 1;
            tmps = s[i];
            if(i==n-1){
                num.push_back(tmpnum);
            }
        }
    }

    long ans=0;
    for(long x:num){
        ans += x*(x-1)/2;
    }
    cout << ans << endl;

}

Measured memory_bytes: 6904
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}
int main(void){
  int i,j;
  int ii[100];
  int len,flg;
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&flg);
    if((flg %2)==0){
      if((flg %3)==0 || (flg %5)==0){
        ;
      }
      else{
          printf("DENIED");
          return 0;
      }
    }
  }
  		printf("APPROVED");
  return 0;

}


Measured memory_bytes: 128
/* 
    HARSHAD VAGHASIYA

        @DAIICT
    
          H_M_Vaghasiya
    
  */
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAX_INT 100000
#define ld long double
int main()
{
   ll n,i,j,d,x,y;
   cin>>n;
   ld sum=0,k;
   vector<ll> a(n);
   for(i=0;i<n;i++){
       cin>>a[i];
   }
   sort(a.begin(),a.end());
   sum=(ld)(a[0]+a[1])/2;
   for(i=2;i<n;i++){
       sum=(ld)(sum+a[i])/2;
   }
   cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline


def dijkstra_v2(start: int, matrix: list) -> list:
    """dijkstra法: 始点startから各頂点への最短距離を求める
    計算量: O(V^2)
    """
    INF = 10 ** 18
    n = len(matrix)
    used = [False] * n
    dist = [INF] * n
    dist[start] = 0
    while True:
        v = -1
        for u in range(n):
            if not used[u] and (v == -1 or dist[u] < dist[v]):
                v = u
        if v == -1:
            break
        used[v] = True
        for nxt_v in range(n):
            dist[nxt_v] = min(dist[nxt_v], dist[v] + matrix[v][nxt_v])
    return dist
  

n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
INF = 10 ** 18

matrix = [[INF] * n for i in range(n)]
for a in range(n):
    matrix[a][a] = 0
    for j in range(1, len(info[a]) // 2):
        b, cost = info[a][slice(2 * j, 2 * (j + 1))]
        matrix[a][b] = cost

dist = dijkstra_v2(0, matrix)
for v, ans in enumerate(dist):
    print(v, ans)


Measured memory_bytes: 5952
N, K, Q = map(int, input().split(' '))
score = [K for player in range(N)]
answers = [int(input()) - 1 for q in range(Q)]

for answer in answers:
    score[answer] = score[answer] + 1

score = [point - Q for point in score]

for result in score:
    if result > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 13748
S = input()
K = int(input())

if S[0] != "1":
  print(S[0])
  exit()
  
else:
  index = 10**18+1
  for i in range(2,10):
    tmp = S.find(str(i))
    if 0< tmp < index:
      index = tmp
      ans = i
  if index <= K-1:
    print(ans)
  else:
    print(1)

Measured memory_bytes: 3060
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
AM=A[0:M]
asum=sum(A)
rate=asum/4/M

for idx in AM:
    if idx<rate:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 9068
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let s: String = read();
    let (mut n, m) = {
        let mut ws = s.split_whitespace(); // 空白区切りの単語に分解する
        let n: i32 = ws.next().unwrap().parse().unwrap(); // イテレータから値を取り出して整数に
        let m: i32 = ws.next().unwrap().parse().unwrap();
        (n, m)
    };

    let a: Vec<i32> = read_vec();
    for i in &a {
        n -= i;
        if n < 0 {
            break;
        }
    }

    if n < 0 {
        println!("-1");
    } else {
        println!("{}", n);
    }
}


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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)
        cin>>a[i];

    sort(a,a+n);
    int score = 0;
    bool alice = true;
    for(int i = n-1;i >= 0;i--){
        if(alice){
            score += a[i];
        } else {
            score -= a[i];
        }
        alice = !alice;
    }
    cout << score << endl;
}

Measured memory_bytes: 256
/*
 
@author
_      _          _                 _      _
\\    // /\    | | \  |     |    /\ \\    //     
 \\  // /__\   | |_/  |_____|   /__\ \\  //
  \\// /    \  | | \  |     |  /    \ \\//
   \/ /      \ | |_/  |     | /      \ \/
@ Indian Institute of Technology Bhilai

With practice comes perfection,
with knowledge comes wisdom.
Incorporate wisdom in you, practice will harvest better results.
Always learn from others, your method is good but someone's even better.
Results take time, run for wisdom, for innovation, for getting better.
Points are mere objects, either you solve first or you solve better.
Seek for betterment, for quality, pace is important but cannot outstand
the quality you persist.
Times are bad just as now but it'll improve, this is my passion and I promise 
I won't let it go. I'll build myself again like a fighter gets back up after 
being thrown to the ground.
I'll learn. I bet that. I promise that.
*/
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
#define rep(i,n) for(ll i=0; i<n; i++)
#define rep1(i,n) for(ll i=1; i<=n; i++)
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define alla(arr,n) arr, arr+n
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define fsync ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll maxx =  1e9+7;

bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b){
    return a.fi>b.fi;
}

ll inline power(ll a, ll b, ll p){
    a %= p;
    ll ans = 1;
    while(b>0){
        if(b & 1)
            ans = (ans*a)%p;
        a = (a*a)%p;
        b >>= 1;
    }
    return ans;
}

ll inv(ll n, ll p){
    return power(n,p-2, p);
}

bool inline isPrime(ll n) { 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; 
}

template<class T>
void printv(T &v, ll n){
    if(n==-1)
        n = v.size();
    rep(i,n)
        cout << v[i] << " ";
    cout << "\n";
}

void solve(){
    ll a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    ans+=min(a,k);
    k-=min(a,k);
    k-=min(k,b);
    ans -= k;
    cout << ans << "\n";
}

int main(){
    fsync
    ll test=1;
    // cin >> test;
    while(test--){
        solve();
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>
#include <set>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x)
#define PUT(x) printf("%d\n",x)
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };

ll digit_sum(ll n) {
	ll s = 0;
	while (n != 0) s += n % 10, n /= 10;
	return s;
}

int main(void) {

	ll a, b, c, k;

	cin >> a >> b >> c >> k;

	if (k % 2 == 0) {
		cout << a - b << endl;
	}
	else {
		cout << b - a << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(i=a;i<b;i++)
#define rloop(i,a,b) for(i=a;i>=b;i--)
#define vi vector<int>
#define vs vector<string>
const int inf=1e9+1;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846

void swap(vi &v,int a,int b){
	int temp;
	temp=v[a];
	v[a]=v[b];
	v[b]=temp;
}
int main(){
	int n,i,j,temp;
	cin>>n;
	vi a(n);
	loop(i,0,n){
		cin>>a[i];
	}
	i=-1;
	int x=a[n-1];
	loop(j,0,n-1){
		if(a[j]<=x){
			i++;
			swap(a,i,j);
		}
	}
	swap(a,i+1,n-1);
	loop(j,0,n){
		if(j==i+1){
			cout<<"["<<a[j]<<"] ";
		}else if(j!=n-1){
			cout<<a[j]<<" ";
		}else{
			cout<<a[j]<<endl;
		}
	}
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s;
    int ans = 0;
    rep(i, 0, n){
        cin >> t;
        //start
        rep(j, 0, t.size()){
            //dist                
            rep(k, 1, t.size()){
                string r = ""; 
                int now = j;            
                rep(l, 0, s.size()){
                    r += t[now];
                    now += k;
                    if(now >= t.size()) break;
                }
                if(s == r){
                    ans++;
                    // cout << i << ' ' << j << ' ' << k << ' ' << r << endl;
                    k = t.size(); j = t.size();
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1216
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int i;
	double L;
	char buf[32], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	L = atof(ch);

	printf("%f\n", L * L * L / 27.0);

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(){
    int m, f, r;
    while (1) {
        scanf("%d %d %d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1)  break;
        if ((m == -1 || f == -1) || m + f <30) printf("F\n");
        else if (m + f >= 80) printf("A\n");
        else if (m + f >= 65) printf("B\n");
        else if (m + f >= 50 || (m + f <= 30 && r >= 50)) printf("C\n");
        else printf("D\n");
    }
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int d;
	while( cin >> d ) {
		int area = 0;

		for( int x = d; x < 600; x += d ) {
			area += x*x * d;
		}

		cout << area << '\n';
	}
}



Measured memory_bytes: 3116
//msol2020_c.cpp
//Sun Aug  2 20:38:42 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

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

	int a[n];
	rep(i,n) cin >> a[i];

	for (int i=k;i<n;i++){
		if (a[i-k]<a[i]){
			cout << "Yes" << endl;
		}else {
			cout << "No" << endl;
		}
	}

}

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

int main() {
  int A,B,C,D;
  string AA;
  cin>>AA;
  vector<char> vec;
  int count =0;
  A = AA.size();
  //cout<<A<<endl;
  for(int i=0;i<(A/2);i++){
  	if(AA.at(i)!=AA.at(-i+A-1)){
  		count++;
  	}
  }
  cout<<count<<endl;

}

Measured memory_bytes: 256
import queue
n,m = map(int,input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
q = queue.Queue()
q.put(0)
d = [-1]*n
d[0] = 0

while not q.empty():
    v = q.get()
    for i in g[v]:
        if d[i] != -1:
            continue
        d[i] = v
        q.put(i)
if -1 in d:
    print("No")
else:
    print("Yes")
    for i in d[1:]:
        print(i+1)

Measured memory_bytes: 35280
#include <cstdio>
#include <cmath>
using namespace std;

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

	// k * k - 1 * k - 1 ...
	int ans = pow((k - 1), (n - 1)) * k;
	
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let ans = if (a+b) % 2 == 1 { (a+b) / 2 + 1 } else { (a+b) / 2 };
    println!("{}", ans);
}

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed 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")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int D = Integer.parseInt(sc.next());
        int[][] X = new int[N][D];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < D; j++) {
                X[i][j] = Integer.parseInt(sc.next());
            }
        }

        int res = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                if (diff(X[i], X[j])) {
                    res++;
                }
            }
        }

        System.out.println(res);

    }

    private static boolean diff(int[] X, int[] Y) {
        int tmp = 0;
        for (int i = 0; i < X.length; i++) {
            tmp += Math.pow(Math.abs(X[i] - Y[i]), 2);
        }

        double d = Math.sqrt(tmp);
        return d == (int) d;
    }
}


Measured memory_bytes: 21716
package main

import (
	"fmt"
)

func main() {
	var a string
	fmt.Scan(&a)

	if a == "A" {
		fmt.Print("T")
	} else if a =="T" {
		fmt.Println("A")
	} else if a == "G" {
		fmt.Println("C")
	} else if a == "C" {
		fmt.Println("G")
	}
	
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  set<int> xset, yset;
  vector<pair<int, int>> xy;
  rep(i, n) {
    int x, y;
    cin >> x >> y;
    xset.insert(x);
    yset.insert(y);
    xy.emplace_back(x, y);
  }
  vi32 xs, ys;
  each(x, xset) xs.push_back(x);
  each(y, yset) ys.push_back(y);
  int m = sz(xs) + sz(ys);
  vector<vi32> g(m);
  rep(i, n) {
    int x, y;
    tie(x, y) = xy[i];
    int xi = lower_bound(all(xs), x) - xs.begin();
    int yi = lower_bound(all(ys), y) - ys.begin();
    yi += sz(xs);
    g[xi].emplace_back(yi);
    g[yi].emplace_back(xi);
  }
  i64 ans = 0;
  vi32 seen(m);
  int cnts;
  vi32 cnt(2);
  auto dfs = [&](auto dfs, int u, int mod) {
    if (seen[u]) return;
    seen[u] = 1;
    cnt[mod]++;
    cnts += sz(g[u]);
    each(v, g[u]) {
      dfs(dfs, v, 1 - mod);
    }
  };
  rep(i, m) {
    if (seen[i]) continue;
    cnt.assign(2, 0);
    cnts = 0;
    dfs(dfs, i, 0);
    ans += (i64) cnt[0] * cnt[1] - cnts / 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 13944
n, a, b = map(int, input().split())
dp = [2 ** 60] * (n + 1)
dp[0] = 0
p = list(map(int, input().split()))
for i in range(n):
    dp[i + 1] = dp[0]
    dp[0] += a
    for j in range(i):
        if p[j] < p[i]:
            dp[i + 1] = min(dp[i + 1], dp[j + 1])
            dp[j + 1] += a
        else:
            dp[j + 1] += b
print(min(dp))

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

int main(){
	stack<int> st;
	int n;

	while(cin >> n){
		if(n!=0){
			st.push( n );
		}else{
			cout << st.top() << endl;
			st.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 0
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  ll n;
  cin>>n;
  ll a[n];
  ll i,cnt=0;
  for(i=0;i<n;i++)
  {
      cin>>a[i];
      if(i%2==0&&a[i]%2==1)
      cnt++;
  }
  cout<<cnt;
}



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

int main(){
  int n;
  cin >> n;
  double r_inv = 0;
  double r;
  for(int i = 0; i < n; i++){
    cin >> r;
    r_inv += 1/r;
  }
  
  cout << 1/r_inv << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    int c0 = count(begin(S), end(S), '0');
    int c1 = count(begin(S), end(S), '1');

    cout << S.size() - abs(c0 - c1) << endl;

    return 0;
}


Measured memory_bytes: 952
const val mod = 1000000007L

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').let { it[0].toInt() to it[1].toInt() }
    val arr = readLine()!!.split(' ').map { it.toLong() }.sorted()
    val comb = FermatCombination(n, mod)
    val result = arr.foldIndexed(0L) { i, acc, v -> (acc + v * (comb.combine(i, k - 1) - comb.combine(n - i - 1, k - 1))) % mod }
    println(result)
}

class FermatCombination(size: Int, val mod: Long) {
    var factrial: LongArray = LongArray(size + 1)
    var inverse: LongArray = LongArray(size + 1)

    init {
        factrial[0] = 1
        inverse[0] = 1
        for (i in 1..size) {
            factrial[i] = factrial[i - 1] * i % mod
            inverse[i] = pow(factrial[i], mod.toInt() - 2) % mod
        }
    }

    fun combine(n: Int, k: Int): Long {
        if (n < k || n < 0 || k < 0) return 0
        return factrial[n] * inverse[k] % mod * inverse[n - k] % mod
    }

    fun pow(x: Long, n: Int): Long {
        var x = x
        var n = n
        var ans: Long = 1
        while (n > 0) {
            if (n and 1 == 1) {
                ans = ans * x % mod
            }
            x = x * x % mod
            n = n shr 1
        }
        return ans
    }
}


Measured memory_bytes: 74400
s = input()
for x in list(map(chr, range(ord('a'), ord('z')+1))):
    p = None
    for i, c in enumerate(s):
        if c!=x: continue
        if p is not None and i-p<=2:
            print(p+1, i+1)
            exit()
        p = i

print(-1, -1)

Measured memory_bytes: 3188
package main

import (
	"fmt"
)

func main() {

	// 読み込み数取得
	var day string
	fmt.Scan(&day)

	// 曜日データ取得
	days := [...]string{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}

	for i, checkDay := range days {
		if checkDay == day {
			fmt.Printf("%d", 7-i)
		}

	}

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  int N;cin>>N;
  int ans=1;
  for(int i=1;i<=N;i++){
    ans*=i;
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] m = new char[h][w];
		int[][] c = new int[h][w];
		for(int i=0;i<h;i++)m[i]=sc.next().toCharArray();
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)c[i][j]=m[i][j]-'0';
		int[][] dp = new int[h][w];
		dp[h-1][w-1]=c[h-1][w-1];
		for(int j=w-2;j>=0;j--)dp[h-1][j]=dp[h-1][j+1]+c[h-1][j];
		for(int i=h-2;i>=0;i--)dp[i][w-1]=dp[i+1][w-1]+c[i][w-1];
		for(int i=h-2;i>=0;i--)for(int j=w-2;j>=0;j--)dp[i][j] = c[i][j] + Math.min(dp[i+1][j], dp[i][j+1]);
		System.out.println(dp[0][0]);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

struct edge {
    ll m_to; ll m_en; ll m_sn;
    edge(ll to, ll en, ll sn) : m_to(to), m_en(en), m_sn(sn) {}
};
vector<vector<edge> > G;
vector<ll> en, sn;

int main(int argc, const char * argv[]) {
    ll n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    G = vector<vector<edge> > (n);
    en = vector<ll> (n);
    sn = vector<ll> (n);
    for (ll i = 0; i < m; ++i) {
        ll u, v;
        ll a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        G[u].push_back(edge(v, a, b));
        G[v].push_back(edge(u, a, b));
    }
    
    priority_queue<pll, vector<pll>, greater<pll> > Q;
    fill(en.begin(), en.end(), INFLL);
    en[s] = 0;
    Q.push(pll(0, s));
    
    while (!Q.empty()) {
        pll p = Q.top(); Q.pop();
        ll to = p.second;
        if (en[to] < p.first) continue;
        for (ll i = 0; i < G[to].size(); ++i) {
            edge E = G[to][i];
            if (en[E.m_to] > en[to] + E.m_en) {
                en[E.m_to] = en[to] + E.m_en;
                Q.push(pll(en[E.m_to], E.m_to));
            }
        }
    }
    
    fill(sn.begin(), sn.end(), INFLL);
    sn[t] = 0;
    Q.push(pll(0, t));
    while (!Q.empty()) {
        pll p = Q.top(); Q.pop();
        ll to = p.second;
        if (sn[to] < p.first) continue;
        for (ll i = 0; i < G[to].size(); ++i) {
            edge E = G[to][i];
            if (sn[E.m_to] > sn[to] + E.m_sn) {
                sn[E.m_to] = sn[to] + E.m_sn;
                Q.push(pll(sn[E.m_to], E.m_to));
            }
        }
    }
    
    for (ll i = 0; i < n; ++i) {
        en[i] += sn[i];
    }
    
    for (ll i = n-2; i >= 0; --i) {
        en[i] = min(en[i], en[i+1]);
    }
    
    for (ll i = 0; i < n; ++i) {
        cout << (ll)1e15 - en[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 12792
#include <iostream>
#include <stack>
#include <string>

using namespace std;

int main()
{
  bool isBalanced;
  string str;
  stack<char> bracket;

  while (1) {
    getline(cin, str);
    if (str == ".") break;
    while (!bracket.empty()) {
      bracket.pop();
    }
    isBalanced = true;
    for (int i = 0; i < str.size(); i++) {
      if (str[i] == '(' || str[i] == '[') {
        bracket.push(str[i]);
      } else if (str[i] == ')') {
        if (bracket.empty()) {
          isBalanced = false;
          break;
        }
        if (bracket.top() == '(') {
          bracket.pop();
        } else {
          isBalanced = false;
          break;
        }
      } else if (str[i] == ']') {
        if (bracket.empty()) {
          isBalanced = false;
          break;
        }
        if (bracket.top() == '[') {
          bracket.pop();
        } else {
          isBalanced = false;
          break;
        }
      }
    }
    if (!bracket.empty()) {
      isBalanced = false;
    }
    isBalanced ? cout << "yes" << endl : cout << "no" << endl;
  }
}



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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 1e6 + 5;
const int   mod = 998244353;

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}
int mul(int a,int b)    {
    return  1ll * a * b % mod;
}
int Pow(int a,int b)    {
    int ans = 1;
    while (b)   {
        if(b & 1)   ans = mul(ans,a);
        a = mul(a,a);   b >>= 1;
    }
    return  ans;
}
int inv(int a,int p)    {
    return  a == 1 ? 1 : p - 1ll * p * inv(p % a,a) / a;
}

typedef pair<int,int>   ii;

vector<int> dvs[N];

int f[N];
int linear_sum[N];
int square_sum[N];

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    for(int i = 1 ; i < N ; ++i)
    for(int j = i ; j < N ; j += i)
        dvs[j].pb(i);

    f[1] = 1;

    for(int i = 2 ; i < N ; ++i)    {
        f[i] = inv(i,mod);

        for(int x : dvs[i]) if (x < i)
            sub(f[i],f[x]);
    }

    int n;  cin >> n;

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

        for(int d : dvs[x]) {
            add(linear_sum[d],x);
            add(square_sum[d],mul(x,x));
        }
    }
    int ans = 0;

    for(int i = 1 ; i < N ; ++i)    {
        int cur = Pow(linear_sum[i],2);

        sub(cur,square_sum[i]);
        add(ans,mul(cur, f[i]));
    }
    cout << mul(ans,inv(2,mod)) << endl;
}

Measured memory_bytes: 126464
// ~zaletaet~

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define bpc __builtin_popcountl
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
struct chash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + RANDOM);
  }
};

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const db EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

#define int ll

int32_t main() {
  fre("");
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

  int a, v;
  cin >> a >> v;
  int b, w;
  cin >> b >> w;
  int t;
  cin >> t;
  if (a < b) {
    int l = 0, r = t;
    while (l <= r) {
      int m = (l + r) >> 1;
      if (a + m * v >= b + m * w) {
        cout << "YES\n";
        return 0;
      } else if (a + m * v < b + m * w) {
        l = m + 1;
      } else {
        r = m - 1;
      }
    }
    cout << "NO\n";
  } else {
    int l = 0, r = t;
    while (l <= r) {
      int m = (l + r) >> 1;
      if (a - m * v <= b - m * w) 
{        cout << "YES";
        return 0;
      } else if (a - m * v < b - m * w) {
        r = m - 1;
      } else {
        l = m + 1;
      }
    }
    cout << "NO";
  }

  return 0;
}

// uniform_int_distribution<int>(l, r)(rng) -> random in range [l, r]
// assert(condition) -> if (condition == false) Runtime Error
// order_of_key(x) -> number of elements smaller than x
// *find_by_order(k) -> k-th element in 0-based indexation
// gp_hash_table<T, U, chash> -> fast unordered_map
// m.count(x) <-> (m.find(x) != m.end())


Measured memory_bytes: 3648
function main(lines) {
  const [N, M] = splitN(lines[0]);

  const map = Array(N+1).fill(0).map(() => []);
  for (let i = 1; i <= M; i++) {
    const [a, b] = splitN(lines[i]);
    map[a].push(b);
    map[b].push(a);
  }
  const res = [null];
  for (let current = [1]; true; ) {
    const next = [];
    current.forEach(c => {
      map[c].forEach(n => {
        if (res[n-1] !== undefined) return;
        res[n-1] = c;
        next.push(n);
      });
    });
    if (!next.length) break;
    current = next;
  }
  
  res[0] = 'Yes';
  console.log( res.join('\n') );
}


main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );



function splitN(s) {
  return s.split(' ').map(Number);
}

Measured memory_bytes: 111324
<>;
for(<>){
	($A,$B)=glob;
	$C=int(sqrt($A*$B));
	$C-=$C*$C==$A*$B;
	if($C*($C+1)>=$A*$B){
		print$C*2-2,$/
	}else{
		print$C*2-($A!=$B),$/
	}
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int dp[]={};
int main(){
    fast_io
    
    ll n;
    cin>>n;
    ll sum=0;
    ll tmp;
    for(tmp=1;tmp<=n;tmp++){
        sum+=tmp;
        if(sum>=n) break;
    }
    for(int j=1;j<=tmp;j++){
        if(j==sum-n) continue;
        cout<<j<<endl;
    }
    return 0;
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int e;
    while(cin>>e, e) {
        int m = INF;
        for(int z=0; z*z*z<=e; ++z) {
            for(int y=0; y*y<=e-z*z*z; ++y) {
                int x = e - z*z*z - y*y;
                m = min(m, x+y+z);
            }
        }
        cout << m << endl;
    }
    return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;
    cout << max(A - B * 2, 0) << endl;

    return 0;
}



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

X = int(input())

while True : 
    flag = 1
    for i in range(2, X, 1) : 
        if X%i == 0 : 
            flag = 0
    
    if flag == 1 : 
        break
    else : 
        X += 1
        
print(X)

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

int main(){
  int N,M; cin >> N >> M;
  int mid[200000]={};
  for(int i=0; i<M; i++){
    int a,b; cin >> a >> b;
    if(a==1) mid[b-1]++;
    if(b==N) mid[a-1]++;
  }
  for(int i=0; i<N; i++){
    if(mid[i]==2){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 1024