akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
//import java.util.Random;

class Main{
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		
		int n=stdIn.nextInt();
		String s=stdIn.next();
		
		int[] cnt=new int[3];
		for(int i=0;i<n;++i){
			char c=s.charAt(i);
			if(c=='R') cnt[0]++;
			else if(c=='G') cnt[1]++;
			else if(c=='B') cnt[2]++;
		}
		
		long ans=1;
		for(int i=0;i<3;++i) ans*=cnt[i];
		
		for(int i=0;i<n;++i){
			int l=1;
			while(0<=i-l && i+l<n){
				if(s.charAt(i-l)==s.charAt(i) || s.charAt(i)==s.charAt(i+l) || s.charAt(i+l)==s.charAt(i-l)){}
				else ans--;
				l++;
			}
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 37564
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class Main {
    
    int LOG = 40;
    
    void solve() {
        long A = in.nextLong(), B = in.nextLong();
        
        long ans = xor(B) ^ xor(A - 1);
        out.println(ans);
    }
    
    long xor(long n) {
        if (n <= 0) return 0;
        long res = 0;
        for (int i = 0; i < LOG; i++) {
            long period = 1L << (i + 1);
            long zeros = period / 2, ones = period / 2;
            long q = (n + 1) / period, r = (n + 1) % period;
            long v = 0;
            if (q % 2 == 1 && ones % 2 == 1) v ^= 1;
            if (r > zeros && (r - zeros) % 2 == 1) v ^= 1;
            res |= v << i;
        }
        return res;
    }
    
    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new Main().solve();
        out.close();
    }
    
    static FastScanner in;
    static PrintWriter out;
    
    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;
        
        public FastScanner(BufferedReader in) {
            this.in = in;
        }
        
        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        
        public long nextLong() {
            return Long.parseLong(nextToken());
        }
        
        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


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

//static const int MAX_V = 400 * 400 + 10;
const int INF = 1e9;
int V;
using namespace std;
static const int N = 100;
static const int INFTY = (1 << 21);
static const int white = 0;
static const int gray = 1;
static const int black = 2;

int H , W;
int ans = 0;
int sy, sx, gy, gx;
int M[N][N];
int d[N][N];
int color[N][N];
vector<string> S;

void bfs(int sy, int sx){
    queue<pair<int, int> > Q;
    color[sy][sx] = gray;
    d[sy][sx] = 0;
    Q.push(make_pair(sy, sx));//全てはスタート地点をqueueに突っ込んでからは閉まる
    while(!Q.empty()){
        pair<int,int> u = Q.front();Q.pop();
        color[u.first][u.second] = black;//動いたら黒に
        if(u.first + 1 < H){//配列の参照範囲内であることを確認したら
            if(color[u.first + 1][u.second] == white){//まだ踏んでいないor可動範囲であることを確認して
                Q.push(make_pair(u.first+1,u.second));//queueに突っ込む
                color[u.first + 1][u.second] = gray;//突っ込んだらgray色にすることを忘れない
                d[u.first + 1][u.second] = d[u.first][u.second] + 1;//距離は元の場所から1足す
            }
        }//以下同様,今回は2次元迷路なので4方向確認している。
        if(u.first - 1 >= 0){
            if(color[u.first - 1][u.second] == white){
                Q.push(make_pair(u.first-1,u.second));
                color[u.first - 1][u.second] = gray;
                d[u.first - 1][u.second] = d[u.first][u.second] + 1;
            }
        }
        if(u.second + 1 < W){
            if(color[u.first][u.second+1] == white){
                Q.push(make_pair(u.first,u.second+1));
                color[u.first][u.second+1] = gray;
                d[u.first][u.second+1] = d[u.first][u.second] + 1;
            }
        }
        if(u.second - 1 >= 0){
            if(color[u.first][u.second-1] == white){
                Q.push(make_pair(u.first,u.second-1));
                color[u.first][u.second-1] = gray;
                d[u.first][u.second-1] = d[u.first][u.second] + 1;
            }
        }
        
    }
    rep(i, 0, H) rep(j, 0, W) if(d[i][j] != INF) ans = max(ans, d[i][j]);

}
int main(){
    cin >> H >> W;
    S.resize(H);
    rep(i, 0, H) cin >> S[i];
    //rep(i, 0, H * W) rep(j, 0, H * W) d[i][j] = INF;
    rep(i, 0, H) rep(j, 0, W){
        rep(k, 0, H) rep(l, 0, W){
            d[k][l] = INF;
            if(S[k][l] == '.') color[k][l] = white;
            else color[k][l] = black;
        }
        if(S[i][j] == '.')bfs(i,j);
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
use input::Input;

fn main() {
    let mut input = Input::default();

    let n = input.parse::<u32>();

    for i in 0..n {
        println!("{}", f(i + 1));
    }
}

fn f(n: u32) -> u32 {
    let mut res = 0u32;
    for i in 1..=n {
        if i * i > n {
            break;
        }
        for j in i..=n {
            if j * j > n {
                break;
            }
            for k in j..=n {
                if k * k > n {
                    break;
                }
                if i * i + j * j + k * k + i * j + j * k + k * i == n {
                    if i == j && j == k {
                        res += 1;
                    } else if i != j && j != k && k != i {
                        res += 6;
                    } else {
                        res += 3;
                    }
                }
            }
        }
    }
    res
}

#[allow(dead_code)]
pub mod input {
    #[derive(Default)]
    pub struct Input(Vec<String>);

    impl Input {
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok().expect("read error");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            let x = if let Some(x) = self.0.pop() {
                x
            } else {
                let s = self.read_line();
                self.0 = s.split_whitespace().map(String::from).rev().collect();
                self.0.pop().expect("reached EOF")
            };
            x.parse().ok().expect("parse error")
        }
    }
}


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

import numpy as np
import scipy as sp

def main():
    try:
        N = int(input())
        li = list(map(int, input().split()))
        min_diff_ab = 1e100

        g1 = []
        g2 = li

        for i in range(N):
            g1.append(g2[i])
            g2[i] = 0

            if abs(sum(g1) - sum(g2)) < min_diff_ab:
                min_diff_ab = abs(sum(g1) - sum(g2))

        print(min_diff_ab)
    except:
        pass

if __name__ == '__main__':
    main()


Measured memory_bytes: 12508
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 998244353LL;
const int maxn = 3000010;
ll qpow(ll a,ll x){
    ll ret=1;
    while (x){
        if (x&1)
            ret = ret*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return ret;
}
ll fac[maxn],inv[maxn];
 
ll init(){
    fac[0]=1;
    for (int i=1;i<maxn;i++)
        fac[i]=fac[i-1]*i%mod;
    inv[maxn-1]=qpow(fac[maxn-1],mod-2);
    for (int i=maxn-2;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
    return 0;
}
 
ll c(ll n,ll m){
    if (n<m) return 0;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
    init();
    ll N,A,B,K;
    cin>>N>>A>>B>>K;
    ll ans=0;
    for(int i=0;i<=N;i++){
        if(K-A*i<0) continue;
        if((K-A*i)%B!=0) continue;
        ll y=(K-A*i)/B;
        if(y>N)continue;
        ans=(ans+c(N,i)*c(N,y)+mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 47104
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;


int main(){

    int K,X;
    cin >> K >> X;

    if(500*K >= X){
        cout << "Yes";
    }else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
from sys import stdin

s = stdin.readline().rstrip()
f = True

for i, s in enumerate(s):
  if i % 2 == 0:
    if not s in ['R', 'U', 'D']:
      f = False
      break
  else:
    if not s in ['L', 'U', 'D']:
      f = False
      break
      
if f:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N, i, bigger=0, smaller=0;
    scanf("%d",&N);
    int A[N], D[N], B;
    long sum=0;
    for (i=0; i<N; i++) 
        scanf("%d",&A[i]);
    for (i=0; i<N; i++) {
        scanf("%d",&B);
        D[i] = A[i] - B;
        if (A[i] < B) {
            sum += B - A[i];
            smaller++;
        }
    }
    sort(D, D+N, greater<int>());
    while (sum > 0) {
        if (D[bigger] <= 0) {
            printf("-1\n");
            return 0;
        }
        sum -= D[bigger];
        bigger++;
    }
    printf("%d\n",bigger+smaller);
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

def solve(n,fr,to):
    rates = [(f,t) for f,t in zip(fr,to) if f < t]
    rates.sort()
    if not rates:
        return n
    dp = [i for i in range(n+1)]
    for f,t in rates:
        for i in range(f,n+1):
            dp[i] = max(dp[i], dp[i-f] + t)
    return dp[-1]

n = solve(N,A,B)
print(solve(n,B,A))

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	ull n = 0;
	cin >> n;
	vector<pair<ll,bool>> a( n, pair<ll,bool>() );
	REP(i, n) {
		cin >> a[i].first;
		a[i].second = a[i].first >= 0;
	}
	sort( ALL( a ) );

	if( (*a.begin()).second ) (*a.begin()).second = false; 
	if( !(*a.rbegin()).second ) (*a.rbegin()).second = true;

	ll sum = 0;
	REP( i, n )
	{
		sum += a[i].first * ( a[i].second ? 1 : -1 );
	}
	cout << sum << endl;

	ll plusIdx = a.size() - 1;
	ll minusIdx = 0;
	ll now = a[minusIdx].first;
	REP( i, n ) if( i != plusIdx && i != minusIdx )
	if( a[i].second )
	{
		cout << now << " " << a[i].first << endl;
		now -= a[i].first;
	}
	cout << a[plusIdx].first << " " << now << endl;
	now = a[plusIdx].first - now;
	REP( i, n ) if( i != plusIdx && i != minusIdx )
	if( !a[i].second )
	{
		cout << now << " " << a[i].first << endl;
		now -= a[i].first;
	}

	return 0;
}

Measured memory_bytes: 3456
#include<iostream>
using namespace std;
int main(){
  double p[4][2],m[2][2],mi[2][2],det,x[2],a[2];
  while(cin >>p[0][0]>>p[0][1]>>p[1][0]>>p[1][1]>>p[2][0]>>p[2][1]>>p[3][0]>>p[3][1]){
    for(int i=1; i<4; i++) for(int j=0; j<2; j++) p[i][j]-=p[0][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) m[i][j] = p[j+1][i];
    for(int i=0; i<2; i++) x[i] = p[3][i];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    mi[0][0] = m[1][1]/det;
    mi[0][1] = -m[0][1]/det;
    mi[1][0] = -m[1][0]/det;
    mi[1][1] = m[0][0]/det;
    for(int i=0; i<2; i++) a[i] = mi[i][0]*x[0]+mi[i][1]*x[1];
    if(a[0]>0 && a[1]>0 && a[0]+a[1]<1) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

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

int main() {
int N; int K; string S;
  cin>>N>>K;
  cin>>S;
  if(S.at(K-1)=='A')
    S.at(K-1)='a';
  else if(S.at(K-1)=='B')
    S.at(K-1)='b';
  else S.at(K-1)='c';
  cout<<S<<endl;
}

Measured memory_bytes: 256
N = int(input())
L = sorted(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if len({L[i], L[j], L[k]}) < 3:
                continue
            if L[k] < L[i] + L[j] and L[i] < L[j] + L[k] and L[j] < L[k] + L[i]:
                ans += 1
print(ans)


Measured memory_bytes: 9196
#include <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
int main() {
  int A, B, M;
  ins(A, B, M);

  vi a(A), b(B);
  int min_a = 1e5, min_b = 1e5;
  rep(i, A) {
    cin >> a[i];
    chmin(min_a, a[i]);
  }
  rep(i, B) {
    cin >> b[i];
    chmin(min_b, b[i]);
  }

  int ans = min_a + min_b;
  rep(i, M) {
    int x, y, c;
    ins(x, y, c);

    chmin(ans, a[x-1] + b[y-1] - c);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <vector>
#define INF 1000000001
using namespace std;
struct E{
	int rel,cost;
};
vector <E> grh[100000];
int v,e,r;

void dijkstra(){

	priority_queue < pair <int,int> > Q;
	int sum = 0;
	int d[100000];
	for(int i=0;i<v;i++) d[i] = INF;
	d[r] = 0;
	Q.push(make_pair(0,r));
	int s,f;
	while(!Q.empty()) {
		f = Q.top().first;
		s = Q.top().second;
		Q.pop();
		for(int i=0;i<grh[s].size();i++) {
			E e = grh[s][i];
			if(d[e.rel] > e.cost - f) {
				d[e.rel] = e.cost - f;
				Q.push(make_pair(-d[e.rel],e.rel));
			}
		}
	}
	for(int i=0;i<v;i++) {
		if(d[i] == INF ) cout << "INF"<<endl;
		else cout << d[i] << endl;
	}
}

int main() {
	cin >> v >> e >> r; 
	int a,b,c;
	for(int i=0;i<e;i++) {
		cin >> a >> b>> c;
		grh[a].push_back((E){b,c});
	}
	dijkstra();

	return 0;
}

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

int main(){
    string s; cin >> s;
    
    rep(pat, pow(2, 3)){
        int ans = s.at(0) - '0';
        vector <char> op;
        for(int i = 0; i < 3; i ++){
            if((pat >> i & 1)){
                ans += s.at(i + 1) - '0';
                op.push_back('+');
            }
            else{
                ans -= s.at(i + 1) - '0';
                op.push_back('-');
            }
        }

        if(ans == 7){
            rep(i, 4){
                if(i != 0){
                    cout << op.at(i - 1);
                }
                cout << s.at(i);
            }
            cout << "=7" << endl;
            return 0;
        }
    }
     
}

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

int main(){
    bool Flag = false;
    string S;
    cin >> S;
    char c;
    for (int i=0;i<(int)S.size(); i++){

        c = S[i];
        if (Flag){
            if (c == 'F'){
                cout << "Yes" << endl;
                return 0;
            }
        }else if(c == 'C'){
            Flag = true;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

int main(){
	int n;
	cin >> n;
	int l[n];
	for(int i = 0; i < n; i++)cin >> l[i];
	int max = 0;
	int sum = 0;
	for(int i = 0; i < n; i++){
		if(l[i] > max)max = l[i];
		sum += l[i];
	}
	if(max < sum - max)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    cout<<max({2*a-1,2*b-1,a+b});
    
    return 0;
    
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD

def factorize(num: int) -> dict:
    """ 素因数分解 """
    from math import sqrt
    from collections import Counter

    d = Counter()
    # 終点はルート切り捨て+1
    for i in range(2, int(sqrt(num))+1):
        # 素因数分解：小さい方から割れるだけ割って素数をカウント
        while num % i == 0:
            num //= i
            d[i] += 1
        # 1まで分解したら終了
        if num == 1:
            break
    # 最後に残ったnumは素数(ただし1^1は1^0なので数に入れない)
    if num != 1:
        d[num] += 1
    return d

def mul(C1, C2):
    return C1 + C2

def div(C1, C2):
    return C1 - C2

def gcd(C1, C2):
    return C1 & C2

def lcm(C1, C2):
    for k, v in C2.items():
        C1[k] = max(C1[k], v)
    return C1
    # return C1 | C2

N = INT()
A = LIST()

# 素因数の状態で全体のLCMを出す
A2 = [factorize(a) for a in A]
l2 = Counter()
for a in A2:
    l2 = lcm(l2, a)

# 通常の値に戻す
l = 1
for k, v in l2.items():
    l *= pow(k, v, MOD)
    l %= MOD

ans = 0
for a in A:
    ans += fermat(l, a, MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 52952
H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
ans = []
for i in range(H):
    for j in range(W):
        if a[i][j] % 2 == 1:
            a[i][j] -= 1
            if j < W - 1:
                ans.append((i + 1, j + 1, i + 1, j + 2))
                a[i][j + 1] += 1
            elif i < H - 1:
                ans.append((i + 1, j + 1, i + 2, j + 1))
                a[i + 1][j] += 1
print(len(ans))
for y, x, y_, x_ in ans:
    print(y, x, y_, x_)


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

long long comb(long long m, long long r, vector<vector<long long>> &history){
  if(r > m){
    return 0;
  }else if(history[m][r] != -1){
    return history[m][r];
  }else if(r == 0 || r == m){
    history[m][r] = 1;
    return 1;
  }else{
    history[m][r] = (comb(m - 1, r - 1, history) + comb(m - 1, r, history)) % 1000000007;
    return history[m][r];
  }
}

int main(){
  long long n, k;
  cin >> n >> k;
  
  vector<vector<long long>> history(max(n - k + 2, k), vector<long long>(k + 1, -1));
  
  for(long long i = 1; i <= k; i++){
    cout << ((comb(n - k + 1, i, history) %1000000007) * (comb(k - 1, i - 1, history) % 1000000007)) % 1000000007 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 31744
#include <iostream>

int main(){
    using namespace std;

    int W, H, x, y, r = 0;
    cin >> W >> H >> x >> y >> r;

    if( (r <= x) && ((x+r) <= W) &&
        (r <= y) && ((y+r) <= H) )
    {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

int main()
{

  string str;
  cin>>str;
  unsigned long long int  sum = 0;
  int i = 0, j =0;
  int n = str.size();
  string temp ;
  for(i = 0; i<n; i++)
  {
    for(j = i; j<n; j++)
    {
      temp = str.substr(i, (j-i+1));
      unsigned long long int  k = 0, m = 1;

      for(int i1 =j; i1>= i; i1--)
      {
        k += (str[i1] - '0')*m;
        m *= 10;
      }
    //  cout<<"Value of K: "<<k<<endl;
      unsigned long long int  s;
      // if(j!= n-1 && i == 0)
      // s = k*1*pow(2,(n-j-1-1));
      // else
      //  if(j != n-1 && i!= 0)
      //  s  = k*pow(2,i)*pow(2, (n-j-1-1));
      // else
      // s = k*pow(2,i)*1;

      s = k*pow(2, ((i>0)? i-1: 0))* pow(2, ((n-j-1-1 >0)?n-j-2:0));
      sum += s;
      //cout<<"sum : "<<sum<<" s : "<<s<<endl;
    }
  }

  cout<<sum<<endl;
  return 0;

}


Measured memory_bytes: 384
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 入力数字の数 */
	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			Map<Integer, Integer> map = new HashMap<>();
			IntStream.range(0, N).forEach(i -> {
				int a = scanner.nextInt();
				map.put(a, map.getOrDefault(a, 0) + 1);
			});
			System.out.println(((2 == map.getOrDefault(5, 0)) && (1 == map.getOrDefault(7, 0))) ? "YES" : "NO");
		}
	}
}


Measured memory_bytes: 35876
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t L, R, a = 2019;
  cin >> L >> R;
  if (R - L > 2018) cout << 0 << endl;
  else {
      for (int i = 0; L + i < R; i++){
          for (int j = i + 1; L + j <= R; j++) {
              if(((L + i) * (L + j)) % 2019 < a) {
                  a = ((L + i) * (L + j)) % 2019;
              }
            }
        }
    cout << a << endl;
  }
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;

int main()
{
    string s;
    int k;
    cin >> s >> k;
    set<string> tmp;

    for (int i = 1; i <= int(s.size()); i++) {
        for (int j = 0; j < int(s.size()) && i <= k; j++) {
            if (i+j > int(s.size())) break;
            tmp.insert(s.substr(j, i));
        }
    }
    int i = 1;
    for (auto x: tmp) {
        if (i == k) cout << x << endl;
        i++;
    }

    return 0;
}



Measured memory_bytes: 1664
using System;
using System.Collections.Generic;

class _0040 {
    static int Mod(int n, int k) {
        return n % k + ((n % k < 0) ? k : 0);
    }
    static int Inv(int a) {
        switch (a) {
            case 1: return 1;
            case 3: return 9;
            case 5: return 21;
            case 7: return 15;
            case 9: return 3;
            case 11: return 19;
            case 15: return 7;
            case 17: return 23;
            case 19: return 11;
            case 21: return 5;
            case 23: return 25;
            case 25: return 25;
            default: return 0;
        }
    }
    static void MakeTable(Dictionary<string, int[]> tiT, Dictionary<string, int[]> taT) {
        string ti = "this", ta = "that";
        int[] at = { 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25 };
        int b;
        char[] str = new char[4];
        int[] res;

        tiT.Clear(); taT.Clear();
        for (int i = 0; i < at.Length; i++) {
            for (b = 0; b < 26; b++) {
                res = new int[] { at[i], b, Inv(at[i]) };
                for (int j = 0; j < 4; j++)
                    str[j] = (char)('a' + Mod(at[i] * (ti[j] - 'a') + b, 26));
                tiT.Add(new string(str), res);
                for (int j = 0; j < 4; j++)
                    str[j] = (char)('a' + Mod(at[i] * (ta[j] - 'a') + b, 26));
                taT.Add(new string(str), res);
            }
        }
    }  
    public static void Main() {
        string input;
        string[] cand;
        Dictionary<string, int[]> tiT = new Dictionary<string, int[]>();
        Dictionary<string, int[]> taT = new Dictionary<string, int[]>();
        int[] set = new int[1];
        char[] op;

        MakeTable(tiT, taT);
        int n = int.Parse(Console.ReadLine());
        for(int i = 0; i < n; i++) {
            input = Console.ReadLine();
            op = new char[input.Length];
            cand = Array.FindAll(input.Split(), str => str.Length == 4);
            for (int j = 0; j < cand.Length; j++) {
                if (tiT.ContainsKey(cand[j])) {
                    set = tiT[cand[j]];
                    break;
                } else if (taT.ContainsKey(cand[j])) {
                    set = taT[cand[j]];
                    break;
                }
            }
            for (int j = 0; j < input.Length; j++)
                if ('a' <= input[j] && input[j] <= 'z')
                    op[j] = (char)('a' + Mod(set[2] * ((input[j] - 'a') - set[1]), 26));
                else
                    op[j] = input[j];
            Console.WriteLine(new string(op));
        }
    }
}

Measured memory_bytes: 9172
#include <iostream>

using namespace std;

int selectionSort(int A[], int N) {
  int swap_n = 0;
  for (int i = 0; i < N; i++) {
    int minj = i;

    for (int j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }

    int b_i = A[i];
    int swap = A[i];
    A[i] = A[minj];
    A[minj] = swap;
    if (b_i != A[i]) {
      swap_n++;
    }
  }

  return swap_n;
}

int main() {
  int N;
  cin >> N;
  int A[100];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int swap_n = selectionSort(A, N);

  for (int i = 0; i < N; i++) {
    if (i == N - 1) {
      cout << A[i] << endl;
    } else {
      cout << A[i] << " ";
    }
  }
  cout << swap_n << endl;

  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=73,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int W,D;cin>>W>>D;
        if(W+D==0) break;
        vector<int> A(21),B(21);
        for(int i=0;i<W;i++){
            int a;cin>>a;
            A[a]++;
        }
        for(int i=0;i<D;i++){
            int a;cin>>a;
            B[a]++;
        }
        int ans=0;
        
        for(int i=1;i<=20;i++){
            ans+=max(A[i],B[i])*i;
        }
        cout<<ans<<endl;
    }
}




Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define in() ( { int a ; scanf("%d",&a); a; } )
 
const int N = 3e5 + 9;
const int mod = 1e9 + 7;
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};
map<string, int> pre;
int main()
{
    int n, i, j, mx = -1;
    string s;
    n = in();
    for (i = 0; i < n; i++){
        cin >> s;
        pre[s]++;
    }
    map<string, int>::iterator it;
    //sort(pre.begin(), pre.end());
    for (it = pre.begin(); it != pre.end(); it++)
    {
        //cout << it -> first << " " << it -> second << nl;
        mx = max(mx, it->second);
    }
    vector<string> ans;
    for (it = pre.begin(); it != pre.end(); it++){
        if(it->second == mx){
            ans.eb(it->first);
        }
    }
    sort(ans.begin(), ans.end());
    for (i = 0; i < ans.size(); i++){
        cout << ans[i] << nl;
    }
}

Measured memory_bytes: 26868
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<unordered_set> 
#include<cmath>
using namespace std;
//long long p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define fcout cout << fixed << setprecision(15)
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n, int mod) {
    if (n == 0) { return 1 % mod; }
    int x = rui(a, n / 2, mod);
    x *= x; x %= mod;
    if (n % 2 == 1) { x *= a; x %= mod; }
    return x;
}
vel pa;
int root(int x) {
    if (pa[x] == -1) { return x; }
    int ans = root(pa[x]); pa[x] = ans;
    return ans;
}
void marge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) { pa[x] = y; }
}
int gcd(int x, int y) {
    if (x < y) { return gcd(y, x); }
    if (y == 0) { return x; }
    return gcd(y, x % y);
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
vel uni(vel x) {
    if (x.size() == 0) { return x; }
    sor(x);
    int n = x.size();
    vel ans(1, x[0]);
    for (int j = 1; j < n; j++) {
        if (x[j - 1] != x[j]) { ans.push_back(x[j]); }
    }
    x = ans;
    return x;
}
void pr(vel& v) {
    int n = v.size();
    if (n != 0) {
        cout << v[0];
        rep(i, n - 1) {
            cout << " " << v[i + 1];
        }
        cout << endl;
    }
}
int sol(int x, int k) {
    if (x == 0 || k == 0) { return 0; }
    return x + sol(x / 2, k - 1);
}
signed main(){
    int n, k; cin >> n >> k;
    int ok = 0;
    int ng = k + 1;
    while (ng - ok > 1) {
        int mid = (ok + ng) / 2;
        int x = sol(mid, n);
        if (x > k) {
            ng = mid;
        }
        else { ok = mid; }
    }
    cout << ok << endl;
    return 0;
}



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

using namespace std;

int A, B, M;

int main() {
  ios_base::sync_with_stdio(0); cin.tie(NULL);
  cin >> A >> B >> M;
  vector<int> a(A); for (int &it : a) cin >> it;
  vector<int> b(B); for (int &it : b) cin >> it;
  int res = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
  while (M--) {
    int x, y, c; cin >> x >> y >> c; x--; y--;
    res = min(res, a[x] + b[y] - c);
  }
  cout << res << "\n";
  return 0;
}


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

typedef long long ll;

template <class T>
ostream & operator << (ostream &out, const vector<T> v) {
    for (int i = 0; i < int(v.size()); i++) {
        out << v[i] << " ";
    }
    return out;
}

ll solve() {
    int R, C, K;
    cin >> R >> C >> K;

    auto A = vector<vector<ll>>(R + 1, vector<ll>(C + 1, 0));
    for (int k = 0; k < K; k++) {
        int r, c, v; cin >> r >> c >> v; r--; c--;
        A[r][c] = v;
    }

    // dp[r, c, p] = maximum sum of value from (0, 0) to (r, c) 
    //               if p items are picked in previous C grids
    auto dp = vector<vector<vector<ll>>>(R + 1, vector<vector<ll>>(C + 1, vector<ll>(5, 0)));
    dp[0][0][1] = ((A[0][0] > 0) ? A[0][0] : 0);

    for (int r = 0; r < R; r++) {
        for (int c = 0; c < C; c++) {
            for (int p = 0; p < 4; p++) {
                // walk right and pick
                if (A[r][c + 1] > 0) {
                    dp[r][c + 1][p + 1] = max(dp[r][c + 1][p + 1], dp[r][c][p] + A[r][c + 1]);
                }
                // walk right and don't pick
                dp[r][c + 1][p] = max(dp[r][c + 1][p], dp[r][c][p]);
                // walk down and pick
                if (A[r + 1][c] > 0) {
                    dp[r + 1][c][1] = max(dp[r + 1][c][1], dp[r][c][p] + A[r + 1][c]);
                }
                // walk down and don't pick
                dp[r + 1][c][0] = max(dp[r + 1][c][0], dp[r][c][p]);
            }
        }
    }

    return *max_element(dp[R - 1][C - 1].begin(), dp[R - 1][C - 1].begin() + 4);
}

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

    cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 707080
import heapq
queue=[]
heapq.heapify(queue)
while True:
    order=input().split()
    if order[0][0]=='i':
        heapq.heappush(queue,-1*int(order[1]))
    elif order[0][1]=='x':
        print(heapq.heappop(queue)*(-1))
    else:break


Measured memory_bytes: 45308
import java.util.*;

public class Main{
	public static void main(String[] args){
		String input = new Scanner(System.in).nextLine();
		String[] num = input.split("\\s");
		int W = Integer.parseInt(num[0]);
		int H = Integer.parseInt(num[1]);
		int x = Integer.parseInt(num[2]);
		int y = Integer.parseInt(num[3]);
		int r = Integer.parseInt(num[4]);
		if((x - r < 0) || (x + r > W) || (y - r < 0) || ( y + r > H)){
			System.out.println("No");
		} else{
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 26356
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstdlib>
#include<set>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int r;
    cin >> r;
    if (r < 1200){
        cout << "ABC" << endl;
    }else if (r < 2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    
    
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
int n,i,a;

scanf("%d",&n);
for(i=1;i<=n;i++){
  a = i;
if(i%3==0)
  printf(" %d",i);/*３の倍数表示*/
 else {
 while(a != 0){
 if(a%10==3 ){
 printf(" %d",i);/*３のつく数字表示*/
 break ;
 }
 a/=10;
  }
 }
}
printf("\n");

return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M;
  cin>>N>>M;
  vector<vector<int> > edge(N);
  int a, b;
  for(int i=0;i<M;++i) {
    cin>>a>>b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que;
  que.push(mp(0, 0));
  pair<int, int> state;
  int node, dist;
  int ans[N];
  for(int i=0;i<N;++i) ans[i] = -1;
  while(!que.empty()) {
    state = que.top();que.pop();
    dist = state.fi;
    node = state.se;
    if(ans[node]>-1) continue;
    ans[node] = dist;
    if(dist>=2) continue;
    for(int i=0;i<edge[node].size();++i) {
      if(ans[edge[node][i]]>-1) continue;
      que.push(mp(dist+1, edge[node][i]));
    }
  }
  if(ans[N-1]==-1) cout<<"IMPOSSIBLE"<<endl;
  else cout<<"POSSIBLE"<<endl;
}



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

int main() {
  int n, d, x;
  cin >> n >> d >> x;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, d){
    rep(j, n){
      if(i % a[j] == 0) ++x;
    }
  }
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vvi to(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    queue<int> q;
    vi dist(n, -1);
    q.push(0);
    dist[0] = 0;
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int nv : to[v]) {
            if (dist[nv] >= 0) continue;
            dist[nv] = dist[v] + 1;
            q.push(nv);
        }
    }
    if (dist[n-1] != -1 && dist[n-1] <= 2) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 13168
N, M = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(M)]
red = [False for _ in range(N)]
num = [1 for _ in range(N)]

red[0] = True

for x, y in XY:
  if red[x -1] == True and num[x - 1] > 0:
    red[y - 1] = True
  num[x - 1] -= 1
  num[y - 1] += 1
  if num[x - 1] == 0:
    red[x - 1] = False

cnt = 0
for i, j in zip(red, num):
  if i == True and j > 0:
    cnt += 1
    
# print(red, num)
print(cnt)


Measured memory_bytes: 67544
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (int i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 
const int mod = 1e9 + 7, mxn = 1e5 + 1;
ll maxx = 1e18;

int solve(){
	int n;
	cin>> n;
	ll ans = 1;
	vll v(n);
	rep(i, 0, n)
		cin>> v[i];
	sort(all(v));
	rep(i, 0, n){
		ll tmp = maxx / ans;
		if(v[i] > tmp)
			return cout<< "-1\n", 0;
		ans *= v[i];
		if(ans == 0)
			return cout<< "0\n", 0;
	}
	cout<< ans<< "\n";
	return 0;	
}
 
int main()
{
    fast;
    int t = 1;
   // cin>> t;
    while(t--){  
        solve();
    }
    return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*  inv[1] = 1; // inv is ll
    for(int i=2; i<=mxn; ++i)
        inv[i]=mod-mod/i*inv[mod%i]%mod;*/
        
// lower bound   >=  
// upper bound   >
// vector<int>().swap(vec); //free memory from vec


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define f0(i,b)   for(int i=0;i<(b);i++)
#define f1(i,b)   for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define forr(i,n)    for(i=0; i<n; i++)
#define whilee(i,t)  while(i!=t)
#define pb(x) push_back(x);
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld",a)

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);//add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//scanf("%d",&x);
//printf("%d\n",x);

vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
//char ch;
string S, T;
ll i, j=0, k, a, b, c, d, f, g, h, l, m, n, p, q, r, s, t, w, x, y, z, maxx=0, minn=0, ans=0, sum=0, cnt=0;

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

    cin>>S;
    for(i=2; i<S.sz; i++)
    {
        T[0]=S[i-2];
        T[1]=S[i-1];
        T[2]=S[i];
        x=stoi(T);
        k=abs(x-753);
        A.pb(k);
    }
    cout << *min_element(A.begin(), A.end());

    return 0;
}


Measured memory_bytes: 256
a,b,c,k=map(int,input().split())
if(k%2==0):
	x=a-b
	if(x>pow(10,18)):
		print('Unfair')
	else:
		print(x)
else:
	x=b-a
	if(x>pow(10,18)):
		print('Unfair')
	else:
		print(x)


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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

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

	int n;
	cin >> n;

	vector<int> b(n + 1);
	for (int i = 1; i <= n - 1; i++) {
		cin >> b[i];
	}

	int ans = 2 * b[1];
	for (int i = 2; i <= n - 1; i++) {
		if (b[i] <= b[i - 1]) {
			ans += -b[i - 1] + 2 * b[i];
		} else {
			ans += b[i];
		}
	}

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


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

int main() {

	ll n; cin >> n;
	if (n % 2 != 0) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	ll tmp = n / 2;
	while (0 < tmp) {
		ans += tmp / 5;
		tmp /= 5;		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3584
tmp = (input().split(' '))
n = int(tmp[0])
k = int(tmp[1])
tmp = input().split(' ')
map_tmp = map(int,tmp)
grades = list(map_tmp)
j = k
while j < n:
  curr_res = grades[j]
  prev_res = grades[j-k]
  if curr_res > prev_res:
    print('Yes')
  else:
    print('No')
  
  j+=1

Measured memory_bytes: 31460
#include <iostream>

using namespace std;

string st;

int main() {

  int n, s = 1e9, m = 0, l = 0;
  cin >> n;
  for(int i =1;i <= n;i++){
    cin >> s >> l;
    m += l - s + 1;
  }
  cout << m;
  return 0;
}


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

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
	long long val;
	constexpr Fp(long long v = 0) noexcept : val(v% MOD) {
		if (val < 0) val += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr Fp operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
	constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
	constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
	constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
	constexpr Fp& operator += (const Fp& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr Fp& operator -= (const Fp& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr Fp& operator *= (const Fp& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr Fp& operator /= (const Fp& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const Fp& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Fp& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream& os, const Fp<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

//const int MOD = 1000000007;
const int MOD = 998244353;
using mint = Fp<MOD>;

int main() {
	
	int n, k; cin >> n >> k;
	vector<int> l(k), r(k);
	for (int i = 0; i < k; i++) {
		cin >> l[i] >> r[i];
	}
	vector<mint> dp(n + 1, 0);
	vector<mint> accum(n + 1, 0);
	dp[1] = 1;	
	accum[1] = 1;
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j < k; j++) {
			int li = i - r[j];
			int ri = i - l[j];
			if (ri < 0) continue;
			li = max(li, 1);
			dp[i] += accum[ri] - accum[li - 1];
		}
		accum[i] += accum[i - 1] + dp[i];
	}
	cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6380
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;
typedef pair<int,int> P;
int main(){
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[1]==s[2]){
		cout<<"Yes"<<endl;
	}else if(s[1]==s[2]&&s[2]==s[3]){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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);
  reverse(a, a + n);

  int alice = 0;
  int bob = 0;
  for (int i=0; i<n; i++) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }
  cout<<alice - bob<<endl;
}

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

int main(){
    int a,b,n;
    while(cin>>a>>b>>n){
        int ans=0;
        a%=b;
        while(n--){
            a*=10;
            ans+=a/b%10;
            a%=b;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1160