akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	vector<vector<long long int>>v(N,vector<long long int>(M));
	for (auto &i : v) {
		for (auto &j : i)cin >> j;
	}
	for (int i = 1; i < N; i++) {
		if (v[i][0] < v[i - 1][0]) {
			cout << -1 << endl;
			return 0;
		}
	}
	if (M == 1) {
		for (int i = 1; i < N; i++) {
			if (v[i][0] <= v[i - 1][0]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	vector<long long int>num(N);
	vector<long long int>box(M);
	bitset<5000>bs;
	for (int i = N - 1; i > 0; i--) {
		if (v[i][0] != v[i - 1][0])continue;
		bs.flip(i);
		if (v[i] > v[i - 1]) {
			box = v[i - 1];
			int dif = v[i][1] - v[i - 1][1];
			if (dif%v[i - 1][0]) {
				num[i] = -dif / v[i - 1][0];
			}
			else {
				dif /= v[i - 1][0];
				if (dif >= 100000) {
					dif--;
					num[i] = -(dif);
					continue;
				}
				int sz = M;
				for (int j = 0; j < dif; j++) {
					int sum = box[0];
					for (int k = 1; k < sz; k++) {
						sum += box[k];
						box[k] = sum;
						if (sum > MOD) {
							sz = k;
							break;
						}
					}
				}
				if (box < v[i]) {
					num[i] = -dif;
				}
				else num[i] = -(dif - 1);
			}
		}
		else {
			box = v[i];
			int dif = v[i-1][1] - v[i][1];
			if (dif%v[i][0]) {
				num[i] = dif / v[i][0] + 1;
			}
			else {
				dif /= v[i][0];
				if (dif >= 100000) {
					num[i] = dif;
					continue;
				}
				int sz = M;
				for (int j = 0; j < dif; j++) {
					int sum = box[0];
					for (int k = 1; k < sz; k++) {
						sum += box[k];
						box[k] = sum;
						if (sum > MOD) {
							sz = k;
							break;
						}
					}
				}
				if (box <= v[i-1]) {
					num[i] = dif + 1;
				}
				else num[i] = dif;
			}
		}
	}
	long long int ans = 0;
	long long int used = 0;
	for (int i = 1; i < N; i++) {
		if (bs.test(i)) {
			ans += max(0LL, used + num[i]);
			used= max(0LL, used + num[i]);
		}
		else {
			used = 0;
		}
		//cout << ans << endl;
	}
	cout << ans << endl;
}


Measured memory_bytes: 10112
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007

int dp[100][100005];
int a[100];

int main(){
	int n,k;
	cin>>n>>k;
	for(int i = 0;i < n; i++){
		cin>>a[i];
	}
	
	for(int i = 0; i <= a[0]; i++){
		dp[0][i] = 1;
	}
	
	for(int i = 1; i < n; i++)
	{
		vector<int> prefix_sum(k+1);
		prefix_sum[0] = dp[i-1][0];
		for(int j = 1; j<=k; j++){
			prefix_sum[j] = (prefix_sum[j-1] + dp[i-1][j]) % mod;
		}
		for(int j = 0; j < k+1; j++){
			if(j > a[i])
				dp[i][j] = (prefix_sum[j] + mod - prefix_sum[j-a[i]-1]) % mod;
			else
				dp[i][j] = prefix_sum[j];
		}
		
	}
	cout << dp[n-1][k];
}


Measured memory_bytes: 42960
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() (int, int, int) {
	return scanInt(sc), scanInt(sc), scanInt(sc)
}

func resolve(k, a, b int) int {
	if a+2 >= b {
		return 1 + k
	}
	if k+1 <= a {
		return 1 + k
	}
	life := k - a + 1
	sum := a
	sum += (b - a) * (life / 2)
	sum += life % 2
	return sum
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<queue>
#include<map>

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double db;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mp make_pair
#define case_for(n) for(int i = 1 ; i <= n ; i ++) { cout<<"Case "<<i<<": "<<endl; solve();}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll power(ll a, ll b, ll p) { ll ans = 1; while (b) { if (b & 1) ans = ans * a % p; a = a * a % p, b /= 2; }return ans; }
int hw_check(string a, int l, int r) { int ans = r - l + 1; for (l, r; l < r; l++, r--)if (a[l] != a[r]) return 0; return ans; }
string movesubstr(string a, int l, int r) { string s = "";	for (int i = l; i <= r; i++) s.push_back(a[i]);	return s; }

int a[500];
void solve()
{
	
	int n, k; cin >> n >> k;
	for (int i = 0; i < k; i++)
	{
		int d; cin >> d;
		for (int j = 0; j < d; j++)
		{
			int s; cin >> s;
			a[s]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) if (a[i] == 0)
	{
		ans++;
		//cout << i << endl;
	}
	cout << ans << endl;
}
	
/*
3 3
3 3 3
4 1 3
4 1 3
*/
int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(nullptr),cout.tie(0);

	/*int t; cin >> t;
	while (t--) 
	{
		solve();
	}*/
	solve();
	return 0;
}
/*

*/

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

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

    sort(a, a + N, greater<int>());
    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>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#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 pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<ll, ll>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int n, z, w, a[2005], X[2005], Y[2005];

int main(void) {
  cin >> n >> z >> w;
  rep(i, 0, n) scanf("%d", &a[i]);
  
  for (int i=n-2; i>=0; i--) {
    int ymin, xmax;
    ymin = xmax = abs(a[i]-a[n-1]);
    for (int j=i+1; j<n-1; j++) {
      ymin = min(ymin, Y[j]);
      xmax = max(xmax, X[j]);
    }
    X[i] = ymin;
    Y[i] = xmax;
  }
  
  int ans = abs(w-a[n-1]);
  rep(i, 0, n-1) ans = max(X[i], ans);
  
    cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int a, b, c; cin >> a >> b >> c;
	cout << a+b+c - max({a, b, c}) << endl;
	return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7
S = input()

l = len(S)
nAB = [0]*(l+1)
nA = [0]*(l+1)
nB = [0]*(l+1)
nC = [0]*(l+1)
nABC = [0]*(l+1)

add = 1
for i,s in enumerate(S):
    if s == '?':
        nA[i+1] = 3*nA[i] + add
        nB[i+1] = 3*nB[i] + add
        nC[i+1] = 3*nC[i] + add
        nAB[i+1] = 3*nAB[i] + nA[i]
        nABC[i+1] = 3*nABC[i] + nAB[i]
        add = (add * 3) % MOD
    if s == 'A':
        nA[i+1] = nA[i] + add
        nB[i+1] = nB[i]
        nC[i+1] = nC[i]
        nAB[i+1] = nAB[i]
        nABC[i+1] = nABC[i]
    if s == 'B':
        nA[i+1] = nA[i]
        nB[i+1] = nB[i] + add
        nC[i+1] = nC[i]
        nAB[i+1] = nAB[i] + nA[i]
        nABC[i+1] = nABC[i]
    if s == 'C':
        nA[i+1] = nA[i]
        nB[i+1] = nB[i]
        nC[i+1] = nC[i] + add
        nAB[i+1] = nAB[i]
        nABC[i+1] = nABC[i] + nAB[i]
    nA[i+1] = nA[i+1] % MOD
    nB[i+1] = nB[i+1] % MOD
    nC[i+1] = nC[i+1] % MOD
    nAB[i+1] = nAB[i+1] % MOD
    nABC[i+1] = nABC[i+1] % MOD

print(nABC[l] % MOD)



Measured memory_bytes: 47856
s = str(input())
k = int(input())

#最初何個1が続くか確かめる
cont1 = 0
lastdig = ""
for i in range(len(s)):
    if s[i] == "1":
        cont1+=1
    else:
        lastdig = s[i]
        break

if k<=cont1:
    print("1")
else:
    print(lastdig)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >>s >> t;
    t = t.substr(0, s.length());
    if(s == t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(void){
  int k,a,b,i=0;
  scanf("%d",&k);
  scanf("%d",&a);
  scanf("%d",&b);
  if((b - a + 1) >= k){
    printf("OK");
    return 0;
  }
  for(i=a;i<=b;i++){
    if((i % k)==0){
      printf("OK");
      return 0;
    }
  }
  printf("NG");
  return 0;
}

Measured memory_bytes: 1728
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {

	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {

	public void solve(InputReader in, PrintWriter out) {
		HashSet<Integer> st = new HashSet<Integer>();

		for (int i=0; i<3; ++i)
			st.add(in.nextInt());

		out.println(st.size());
	}
}

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 int nextInt() {
		return Integer.parseInt(next());
	}

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

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


Measured memory_bytes: 19924
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 701;
const int INF = 1e9 + 7;
bitset <N> dp;
bool h[N][N];
vector <int> g[N];
bool used[N], c[N];
void col(int u) {
    used[u] = 1;
    for (int v : g[u]) {
        if (!used[v]) {
            c[v] = c[u] ^ 1;
            col(v);
        }   
    }   
}   
int n, m;
void check() {
    for (int i = 1; i <= n; ++i) {
        if (!used[i]) col(i);
    }   
    for (int u = 1; u <= n; ++u) {
        for (int v : g[u]) {
            if (c[u] == c[v]) {
                cout << "-1\n";
                exit(0);
            }   
        }   
    }   
}   

pair <int, int> dfs(int u) {
    used[u] = 1;
    pair <int, int> ans = {0, 0};
    if (!c[u]) ++ans.first;
    else ++ans.second;
    for (int v : g[u]) {
        if (!used[v]) {
            auto t = dfs(v);
            ans.first += t.first; ans.second += t.second;
        }   
    }   
    return ans;
}   

int get(int n) {
    return n * (n - 1) / 2;
}   

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        h[u][v] = h[v][u] = 1;
    }   

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (i != j && !h[i][j]) g[i].push_back(j);
        }   
    }   

    check();

    dp[0] = 1;

    memset(used, 0, sizeof used);
    for (int i = 1; i <= n; ++i) {
        if (!used[i]) {
            auto t = dfs(i);

            #ifdef HOME
            cout << t.first << ' ' << t.second << '\n';
            #endif

            dp = (dp << t.first) | (dp << t.second);
        }   
    }   

    int ans = INF;
    for (int i = 0; i <= n; ++i) {
        if (dp[i]) {
            ans = min(ans, get(i) + get(n - i));
        }   
    }   
    cout << ans << '\n';
}

Measured memory_bytes: 5888
N = int(input())
a = input().split()
d = {}
ans = 0

for i in a:
    if (i in d) == False:
        d[i] = 1
    else :
        d[i] += 1

for i in d:
    if d[i] != int(i):
        if d[i] > int(i):
            ans += d[i] - int(i)
        else:
            ans += d[i]

print(ans)

Measured memory_bytes: 20596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans;
int main()
{
	int n;
	scanf("%d", &n);
	ans = 1ll * n * (n + 1) * (n + 2) / 6;
	for(int i = 1; i < n; ++i)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		if(u > v) swap(u, v);
		ans -= 1ll * u * (n - v + 1); 
	}
	cout << ans << endl;
	return 0;
}
		

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

int main(){
	vector<int> v;
	int n;
	cin >> n;
	for(int i = 0; i < n;i++){
		int x;
		cin >> x;
		v.push_back(x);
	}
	sort(v.begin(), v.end());
	v.push_back(1e9 + 1);//番兵
	int ans = 0;
	int num;
	int cur = 0;
	for(int i = 0;i < n;i++){
		num = v[i];
		cur++;
		if(v[i] != v[i+1]){
			if(v[i] > cur){
				ans += cur;
			}else{
				ans += cur - v[i];
			}
			cur = 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define BITSEARCH(i,n) for(int i=0;i<(1<<(n));++i)
#define BITCHK(i,j) (i) & (1<<(j))

/* BITSEARCH 使い方
 
BITSEARCH(i,n){
  vector<int> h;
  REP(j,n){
    if (BITCHK(i,j)){
      h.push_back(j+1);
    }
  }
}

*/

using namespace std;

// 最大公約数
int64_t gcd(int64_t a, int64_t b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
int64_t lcm(int64_t a, int64_t b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main(){
  int n,a;
  cin >> n >> a;
  if (n%500 <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
int main(void){
  int card[3][3];
  int bingo[3][3];
  memset(card,0,sizeof(card));
  memset(bingo,0,sizeof(bingo));
  
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> card[i][j];
    }
  }
  
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    int sel;
    cin >> sel;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        if(sel == card[i][j]){
          bingo[i][j] = 1;
        }
      }
    }
  }
  
  bool isBingo = false;
  for(int i=0;i<3;i++){
    if(bingo[i][0] >0 && bingo[i][1] > 0 && bingo[i][2] > 0){
      isBingo = true;
    }
  }
  for(int j=0;j<3;j++){
    if(bingo[0][j] >0 && bingo[1][j] > 0 && bingo[2][j] > 0){
      isBingo = true;
    }
  }
  
  if(bingo[0][0] >0 && bingo[1][1] > 0 && bingo[2][2] > 0){
    isBingo = true;
  }
  if(bingo[0][2] >0 && bingo[1][1] > 0 && bingo[2][0] > 0){
    isBingo = true;
  }
  
  
  cout << (isBingo ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
	stack<int> S1;
	stack<pair<int, int> > S2;
	stack<int> res;
	char c;
	int i = 0;
	int j = 0;
	int v, all = 0;
	while(cin >> c)
	{
		i++;
		switch(c)
		{
			case '\\':
				S1.push(i);
				break;
			case '/':
				if (S1.size() == 0) break;
				j = S1.top();
				S1.pop();
				v = i - j;
				all += v;
				while (S2.size() > 0 && S2.top().first > j)
				{
					v += S2.top().second;
					S2.pop();
				}
				S2.push(make_pair(j, v));
				break;
			default:
				break;
		}
	}
	cout << all << endl;
	cout << S2.size();
	while(S2.size() > 0) 
	{
		res.push(S2.top().second);
		S2.pop();
	}
	while(res.size() > 0)
	{
		cout << " " << res.top();
		res.pop();
	}
	cout << endl;
}

Measured memory_bytes: 1284
<?php
fscanf(STDIN, '%d', $n);
for ($i  = 0; $i < $n; $i++) {
    fscanf(STDIN, '%s', $s[]);
}
$count = array_count_values($s);
arsort($count);
$c = 0;
$ans = [];
foreach ($count as $k => $v) {
    if ($c == 0) $c = $v;
    elseif ($c != $v) break;
    $ans[] = $k;
}
sort($ans);
foreach ($ans as $k => $v) {
    echo $v . PHP_EOL;
}

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

#define debug(x) cout << (#x) << " is " << x << endl;
#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;

#define N 1000006
int a[N];
vector<int> p;

int main()
{
	for(int i=2; i<=1000; i++){
		bool fl = true;
		for(int j=2; j*j<=i; j++){
			if(i%j == 0) fl = false;
		}
		if(fl) p.push_back(i);
	}
	//cout << p.size() << endl;
    int n;
    cin >> n;
    int gc = 0;
    for(int i=0; i<n; i++){
		scanf("%d", &a[i]);
		gc = __gcd(gc, a[i]);
	}
	if(gc != 1){
		printf("not coprime\n");
	}
	else{
		map<int, int> mp;
		for(int i=0; i<n; i++){
			int fx = a[i];
			for(int x: p){
				while(fx%x == 0){
					mp[x]++;
					fx /= x;
				}
			}
			if(fx != 1) mp[fx]++;
		}
		for(int i=0; i<n; i++){
			int fx = a[i];
			for(int x: p){
				int cnt = 0;
				while(fx%x == 0){
					fx /= x;
					cnt++;
				}
				if(cnt && mp[x] > cnt){
					printf("setwise coprime\n");
					return 0;
				}
			}
			if(fx != 1){
				if(mp[fx] > 1){
					printf("setwise coprime\n");
					return 0;
				}
			}
		}
		printf("pairwise coprime\n");
	}
	
 
    return 0;
}


Measured memory_bytes: 10896
#include <cstdio>
#include <algorithm>

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	int a[100];
	int all = 0;
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", a + i);
		all += a[i];
	}
	int count = 0;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] * 4 * m >= all)
		{
			count += 1;
		}
	}
	puts(count >= m ? "Yes" : "No");
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    int a, b, k;
    cin >> a >> b >> k;

    int cnt = 0;
    for (int i = 100; i >= 1; i--) {
        if (i > a || i > b) continue;
        if (a % i == 0 && b % i == 0) {
            cnt++;
            if (cnt == k) {
                cout << i << '\n';
                return 0;
            }
        }
    }

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

map<ll, ll> PrimeFactorization(ll N){
    map<ll, ll> m;
    for(ll i=2;i<=N;i++){
        while(N%i==0){
            if(m.count(i)==0) m[i] = 0;
            m[i]++;
            N /= i;
        }
    }
    return m;
}

int main()
{
    ll N;
    cin >> N;

    map<ll,ll> sum;
    for(int i=2;i<=N;i++){
        auto m = PrimeFactorization(i);
        for(auto v : m){
            if(sum.count(v.first)==0) sum[v.first]=0;
            sum[v.first] += v.second;
        }
    }
    ll n2 =count_if(sum.begin(), sum.end(), [](pair<ll,ll> x){return x.second>=2;});
    ll n4 =count_if(sum.begin(), sum.end(), [](pair<ll,ll> x){return x.second>=4;});
    ll n14=count_if(sum.begin(), sum.end(), [](pair<ll,ll> x){return x.second>=14;});
    ll n24=count_if(sum.begin(), sum.end(), [](pair<ll,ll> x){return x.second>=24;});
    ll n74=count_if(sum.begin(), sum.end(), [](pair<ll,ll> x){return x.second>=74;});
    ll res = 0;
    res += n4*(n4-1)/2 * (n2-2);//3*5*5
    res += n14*(n4-1);//15*5
    res += n24*(n2-1);//25*3
    res += n74;//75
    cout<<res<<endl;

    return 0;
}



Measured memory_bytes: 256
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    ret = sum(B)
    for i, i1 in zip(A, A[1:]):
        if i1 == i + 1:
            ret += C[i - 1]
    print(ret)


main()

Measured memory_bytes: 3060
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#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>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
int main(void){
  int x,y,z;
  cin>>x>>y>>z;
  int res=0;
  res = floor((double)x/(y+z));
  if(x - res*(y+z) < z)res--;
  cout<<res<<endl;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n,m,l;
    scanf("%d %d %d", &n, &m, &l);
    int A[n][m];
    int B[m][l];

    int i,j,k;
    for(i = 0; i < n; i++){for(j = 0; j < m; j++){scanf("%d", &A[i][j]);}}
    for(i = 0; i < m; i++){for(j = 0; j < l; j++){scanf("%d", &B[i][j]);}}

    //int C[n][l];
    long int C[n][l];
    for(i = 0; i < n; i++){for(j = 0; j < l; j++){C[i][j] = 0;}}
    for(i = 0; i < n; i++){
        for(j = 0; j < l; j++){
           for(k = 0; k < m; k++){
               C[i][j] += A[i][k] * B[k][j];
           }
           printf("%ld", C[i][j]);
           if(j != l-1){printf(" ");}
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    ll c[n], s[n], f[n];
    rep1(i,n-1){
        cin >> c[i]>>s[i] >> f[i];
    }
    rep1(i,n-1){
        double l = 0;
        for(ll j = i;j < n-1; j++){
            double tmp = s[j] + c[j] +l*f[j] - s[j+1];
            if(tmp < 0){
                l = 0;
            }else{            
                l = ceil(tmp/f[j+1]);
            }
        }
        cout << s[n-1] + l*f[n-1] + c[n-1] << endl;
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3276
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>

using namespace std;

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

  int v[100005] = {0};
  int ans = 0, now = 0;
  for (int i=0; i<n; i++)
    cin>>v[i];

  int top = v[0];
  for (int i=0; i<n; i++)
    if (i==0 || v[i] > v[i-1]) {
      now = 0;
      top = v[i];
    }   
    else {
      now++;
      ans = max(ans, now);
    }   
  cout<<ans<<endl;
 
  return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[m];
        int[] d = new int[m];
        for(int i = 0;i < n + m;i++) {
            if(i < n) {
                a[i] = sc.nextInt();
                b[i] = sc.nextInt();
            }
            else {
                c[i - n] = sc.nextInt();
                d[i - n] = sc.nextInt();
            }
        }
        
        for(int i = 0;i < n;i++) {
            int min = Integer.MAX_VALUE;
            int num = -1;
            for(int j = 0;j < m;j++) {
                int distance = Math.abs(c[j] - a[i]) + Math.abs(d[j] - b[i]);
                if(min > distance) {
                    num = j;
                    min = distance;
                }
            }
            System.out.println(num + 1);
        }
        
    }
}


Measured memory_bytes: 23636
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 998244353

#############
# Main Code #
#############

N = getN()
A = []
B = []
for i in range(N):
    a, b = getNM()
    A.append(a)
    B.append(b)
A.sort()
B.sort()
# 範囲がN個ある
# Xは整数
# 中央値のmin, maxは？
# Nが偶数、奇数の場合
# 奇数の場合 中央値は絶対に整数
# 中央値のmin: Aの中央値、max: Bの中央値
# 偶数の場合
# 中央値のmin: (Ai-1 + Ai) / 2 max: (Bi-1 + Bi) / 2
# いくつある？

# 中央値は最低でも0.5刻み
# 偶数の場合は奇数の2N - 1になる？
# Ai-1とAiを自由にいじることで0.5, 1, 1.5と言う風に中間値を作れそう
if N % 2 == 0:
    opt_a = (A[(N // 2) - 1] + A[N // 2]) / 2
    opt_b = (B[(N // 2) - 1] + B[N // 2]) / 2
    # opt_b - opt_aを0.5で割って +1
    print(int((opt_b - opt_a) * 2 + 1))
else:
    opt_a = A[N // 2]
    opt_b = B[N // 2]
    # 中央値は絶対に整数
    print(opt_b - opt_a + 1)

Measured memory_bytes: 102320
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vaibhav Pulastya
 */
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);
        BDigits solver = new BDigits();
        solver.solve(1, in, out);
        out.close();
    }

    static class BDigits {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int dig = 0;
            while (n > 0) {
                n /= k;
                dig++;
            }
            out.println(dig);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32524
n = int(input())
h = list(map(int, input().split()))
ans = 0
temp = 0
i = 0
while i < n-1:
    if h[i] < h[i+1]:
        ans = max(ans, temp)
        temp = 0
    else:
        temp += 1
    i += 1

print(max(ans, temp))


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

int main() {
  int n,m;
    cin>>n>>m;
  vector<pair<long long int,long long int> >vec(n);
  for(int i=0;i<n;i++){
    cin>>vec[i].first>>vec[i].second;
  }
  
  sort(vec.begin(), vec.end());
   long long int sum=0;
  for(int i=0;i<n;i++){
    if(m>vec[i].second){
      sum+=vec[i].second*vec[i].first;
      m-=vec[i].second;     
    }
    else{
      sum+=vec[i].first*m;
      break;
    }
  }
    cout<<sum<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 100000
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int w, h, dp[123][123][5];
signed main() {
	while (cin >> w >> h, w) {
		for1(i, w)for1(j, h)for1(k, 4)dp[i][j][k] = 0;
		/*
			1...RR
			2...RU
			3...UR
			4...UU
		*/
		for1(i, w) {
			for1(j, h) {
				if (i + j <= 3);
				else if (i + j == 4) {
					if (i == 1)dp[i][j][4] = 1;
					else if (i == 2) {
						dp[i][j][2] = 1; dp[i][j][3] = 1;
					}
					else dp[i][j][1] = 1;
				}
				else {
					if (i > 1) dp[i][j][1] = (dp[i - 1][j][1] + dp[i - 1][j][3]) % mod;
					if (j > 1) dp[i][j][2] = dp[i][j - 1][1];
					if (i > 1) dp[i][j][3] = dp[i - 1][j][4];
					if (j > 1) dp[i][j][4] = (dp[i][j - 1][2] + dp[i][j - 1][4]) % mod;
				}
			}
		}
		cout << (dp[w][h][1] + dp[w][h][2] + dp[w][h][3] + dp[w][h][4]) % mod << endl;
	}
}


Measured memory_bytes: 3476
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N;
    cin>>N;
    vll A(N);
    for (size_t i = 0; i < N; i++)
    {
        cin>>A[i];
    }
    ll M = 1000,K=0,nextMindex =N,nextMaxindex = N;
    for (ll i = 0; i < N-1; i++)
    {
        for (ll j = i+1; j < N; j++)
        {
            if(A[i]<A[j])
            {
                chmin(nextMaxindex,j);
            }
            if(A[i]>A[j])
            {
                chmin(nextMindex,j);
            }
        }
        if(nextMindex < nextMaxindex)
        {
            M += K*A[i];
            K=0;
        }
        else if(nextMindex > nextMaxindex)
        {
            K += M/A[i];
            M %= A[i];
        }
        nextMaxindex = N;
        nextMindex = N;
    }
    cout<<M+A.back()*K<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
vi v1,v2;
ll dp[101][100001]={-1};
ll ks(ll n, ll b){

   ll K[n+1][b+1]; 
  
   // Build table K[][] in bottom up manner 
   for (int i = 0; i <=n; i++) 
   { 
       for (int j = 0; j <= b; j++) 
       { 
           if (i==0 || j==0) 
               K[i][j] = 0; 
           else if (v1[i-1] <= j) 
                 K[i][j] = max(v2[i-1] + K[i-1][j-v1[i-1]],  K[i-1][j]); 
           else
                 K[i][j] = K[i-1][j]; 
       } 
   } 
  
   return K[n][b]; 
} 
    

int main(){
	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a,b,k,o;
        cin>>a>>b;
        rep(i,0,a){
            cin>>k>>o;
            v1.pb(k);
            v2.pb(o);
        }
        ll ans=ks(v1.size(),b);
        cout<<ans;
        return 0;}

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

int main(){
    int N, P[100000], pos[100001];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> P[i];
        pos[P[i]] = i;
    }
    multiset<int64_t> st = {-1, -1, N, N};
    int64_t ans = 0;
    for(int i=N; i>0; i--){
        st.insert(pos[i]);
        auto it = st.lower_bound(pos[i]);
        auto l1 = prev(it);
        auto l2 = prev(l1);
        auto r1 = next(it);
        auto r2 = next(r1);
        int64_t num = (*l1 - *l2) * (*r1 - pos[i]) + (pos[i] - *l1) * (*r2 - *r1);
        ans += i * num;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
	int N, M,ans;
	cin >> N >> M;
	vector<string> A(N), B(M);
	string comp;
	for (size_t i = 0; i < N; i++)//N*NのAをインプット
	{
		cin >> A.at(i);
	}
	for (size_t i = 0; i < M; i++)//M*MのBをインプット
	{
		cin >> B.at(i);
	}
	for (size_t i = 0; i <= N-M; i++)//(探索範囲は左上頂点のy座標がN-M-1となる場所まで)
	{
		for (size_t j = 0; j <= N-M; j++)//(x座標も同様)
		{
			ans = 1;
			for (size_t k = 0; k < M; k++)//完全一致でyes;
			{
				if (A.at(i+k).substr(j,M)!=B.at(k))//
				{
					ans = 0;
				}
			}
			if (ans == 1) {
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long int  n, con=1, sum=0;
    cin >> n;
    long long arr[n+1];
    for(long long i=0;i<=n;i++)
        {
            arr[i]=con;
            con++;
        }
    for(long long i=0;i<n;i++)
    {
        if(arr[i]%5!=0 && arr[i]%3!=0)
            {
            sum+=arr[i];
           // cout << sum << " " ;
            }
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 11332
from collections import deque
import sys
h,w = map(int,input().split())
mp = [list(input()) for _ in range(h)]

visited = [[0]*w for _ in range(h)]

dxdy = [[1,0],[0,1],[-1,0],[0,-1]]

queue = deque()
queue.append([0,0,1])
visited[0][0]=1

while queue:
    x,y,d = queue.popleft()
    for dx,dy in dxdy:
        nx,ny = x+dx,y+dy
        if -1<nx<h and -1<ny<w and visited[nx][ny]==0 and mp[nx][ny]!="#":
            visited[nx][ny]=d+1
            queue.append([nx,ny,d+1])
            #[print(*visited[l]) for l in range(h)]
            #print("---------------")            

if visited[-1][-1]==0:
    print(-1)
    sys.exit()

cnt = 0
for i in range(h):
    for j in range(w):
        if mp[i][j]!="#":
            cnt += 1

print(cnt-visited[-1][-1])

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[100100];

int main() {
    li n;
    cin >> n;
    bool has_zero = false;
    rin{
        cin >> a[i];
        if (a[i] == 0) {
            has_zero = true;
        }
    }
    if (has_zero) {
        puts("0");
        return 0;
    }
    li res = 1;
    rin{
        if (1000000000000000000ll / res < a[i]) {
            puts("-1");
            return 0;
        }
        res *= a[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
inline int read()
{
	int w=1,d=0; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1; ch=getchar();}
	while(ch>='0'&&ch<='9') d=d*10+ch-'0',ch=getchar();
	return w*d;
}
const int N = 1e5+7,M = 1e5+1;
bool p[N],v[N];
inline void primes()
{
	memset(v,0,sizeof(v));
	for(register int i=2;i<=N;i++)
	{
		if(v[i]) continue;
		p[i]=1;
		for(int j=2;j*i<=N;j++) v[i*j]=1;
	}
}
long long sum[N];
int main()
{
	primes();
	for(register int i=2;i<=M;i++)
	if(p[i]&&p[(i+1)/2])
	{
		sum[i]=sum[i-1]+1;
	}
	else sum[i]=sum[i-1];
	int q=read();
	while(q--)
	{
		int x=read(),y=read();
		printf("%d\n",sum[y]-sum[x-1]);
	}
}

Measured memory_bytes: 1664
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
x=[]
for i in range(n):
    a,b=l[i][0],l[i][1]
    x.append([a-b,a+b])
x.sort(key=lambda x:x[1])
now=x[0][1]
ans=1
for i in range(1,n):
    if x[i][0]>=now:
        ans+=1
        now=x[i][1]
print(ans)


Measured memory_bytes: 74968
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<utility>
#include<map>
#include<queue>

using namespace std;

#define LL long long
#define Linf (LL)1e18
const int dx[4] = { 1,-1,0,0 };
const int dy[4] = { 0,0,1,-1 };

int main(){
	int x,y;
	cin >> x >> y;
	int ans=0;
	if(x==1&&y==1)ans=1000000;
	else {
		if (x == 3)ans += 100000;
		else if (x == 2)ans += 200000;
		else if (x == 1)ans += 300000;
		if (y == 3)ans += 100000;
		if (y == 2)ans += 200000;
		if (y == 1)ans += 300000;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

A, V = LI()
B, W = LI()
T = I()

flag = False

s = abs(A-B)

if s == 0:
    flag = True
else:
    if W >= V:
        flag = False
    else:
        t = V - W

        if s <= T*t:
            flag = True

YESNO(flag)


Measured memory_bytes: 67216
N = int(input())
List=list(map(int,input().split()))

cnt4 = 0
for i in range(N):
  a = List[i]
  if a%4 == 0:
    cnt4 += 1

cnt2 = 0
for i in range(N):
  a = List[i]
  if a%2 == 0:
    cnt2 += 1
cnt2 = int(cnt2 - cnt4)

if cnt2 == 0:
  if cnt4 >= N -cnt4 -1:
    print("Yes")
  else:
    print("No")
else:
  if cnt4-1 >= (N-cnt2) -cnt4-1:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 14252
import java.util.*;
import java.io.*;

public class Main {

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int a=sc.nextInt();
	     int b=sc.nextInt();
	     int c=sc.nextInt();
	     if(c>=a&&c<=b) {
	       System.out.println("Yes");
	     }else {
	       System.out.println("No");
	     }
	}


	static boolean vis[]=new boolean[10001];
	      static long gcd(long a, long b) 
	      { 
	          if (a == 0) 
	              return b; 
	          return gcd(b % a, a); 
	      } 

static long nCr(int n,int r) {
  int dp[][]=new int[2001][2001];
  for(int i=0;i<2001;i++) {
    dp[0][i]=0;
  }
  for(int i=0;i<2001;i++) {
    dp[i][0]=1;
  }
  for(int i=1;i<2001;i++) {
    for(int j=1;j<2001;j++) {
      if(i==j) {
        dp[i][j]=1;
      }else {
        dp[i][j]=dp[i-1][j-1]+dp[i][j-1];
      }
    }
  }
  return dp[n][r];
}


      
}
class pair{
  int wt,val;
  pair(int wt,int val){
    this.wt=wt;
    this.val=val;
  }
}

Measured memory_bytes: 35796
#include<bits/stdc++.h>
using namespace std ;
int x ;
int main()
{
	int sum = 0 , y ;
	cin >> x ;
	y= x ;
	while ( y > 0 ) 
		sum += y% 10 , y/=10 ;
	if ( x % sum == 0 ) 
		cout << "Yes" <<"\n" ;
	else
		cout << "No"<< endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
using namespace std;

int main() {
	ll N; cin >> N;
	vector<ll> P(N+1);
	for (int i = 1; i <= N; i++)cin >> P[i];

	ll m = 2 * 1000000;
	ll ans = 0;
	for (int i = 1; i <= N; i++) {
		if (m >= P[i]) {
			ans++;
			m = P[i];
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main()
{
    /*istringstream iss;

    string value = "32 40 50 30 60";
    int arr[5];
    iss.str (value); //what does this do???
    for (int i = 0; i < 5; i++)
    {
        int val;
        iss >> val;
        iss>>arr[i];


        cout << i << "-> " << val <<typeid(val).name()<<endl;
    }
    for(int i=0;i<5;i++){
        cout<<arr[i]<<" ";
    }*/
    int r;
    scanf("%d",&r);
    double ans=2*3.1416*r;
    printf("%f\n",ans);

    return 0;
}


Measured memory_bytes: 1752
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */

#include <bits/stdc++.h>

using namespace std;

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

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

void ANot(std::istream& in, std::ostream& out) {
    int x;
    in >> x;
    out << 1 - x << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    ANot(in, out);
    return 0;
}

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

typedef long long ll; 
ll m=1e9+7;
ll dp[2002][1002];


ll dfs(ll a,ll b){
  dp[0][0]=1;
  if(a<b)return 0;
  if(dp[a][b])return dp[a][b];
  ll res=0;
  if(a)res+=dfs(a-1,b);
  if(a&&b)res+=dfs(a-1,b-1);
  res%=m;
  return dp[a][b]=res;
}

int main(){
  ll n,k;
  cin>>n>>k;
  n-=k;
  cout<<dfs(k+n-1,k-1)<<endl;
  return 0;
}



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

int main() {
  int A, B, C, max_factor, max;
  cin >> A >> B >> C;
  if (A >= B && A >= C)
    max = 10 * A + B + C;
  else if (B >= A && B >= C)
    max = A + 10 * B + C;
  else
    max = A + B + 10 * C;
  cout << max;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll A, B;
    cin >> A >> B;
    if(A % B == 0) {
        cout << -1 << endl;
    } else {
        cout << A << endl;
    }
    return 0;
}

Measured memory_bytes: 256