akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   int h,w,k;
   cin >> h >> w >> k;
   int cnt=0;
    vector<vector<char>> c(h,vector<char>(w));
    rep(i,h){
      rep(j,w){
        cin >> c.at(i).at(j);
      }
    }
    rep(i,(1<<h)){
      rep(j,(1<<w)){
        vector<vector<char>> d=c;
        rep(k,h){
          if(i & (1<<k)){
            rep(a,w) d[k][a]= '.';
          }
        }
        rep(k,w){
          if(j & (1<<k)){
            rep(a,h) d[a][k]= '.';
          }
        }
        int sum=0;
        rep(k,h){
          rep(l,w){
            if(d.at(k).at(l)=='#')sum++;
          }
        }
        if(sum==k)cnt++;
      }
    }
    cout << cnt << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rp(i,n) cin >> h.at(i);
    reverse(h.begin(),h.end());
    int stairs=0;
    int max_stairs=0;
    rp(i,n-1){
        if(h.at(i)<=h.at(i+1)){
            stairs++;
            max_stairs=max(max_stairs,stairs);
        }
        else stairs=0;
    }
    cout << max_stairs << endl;
    return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//aとbの大きい方

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//aとbの小さい方

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//aとbの差の絶対値

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	char x, y;
	cin >> x >> y;
	if ((int)x < (int)y)cout << "<" << endl;
	else if ((int)x == (int)y)cout << "=" << endl;
	else cout << ">" << endl;

	return 0;
}

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define VSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef unsigned long long lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

int main() {
	ll n,k,q,i,j;
    vi a;

    cin>>n>>k>>q;
    SIZE(a,n);
    rep(i,q){
        cin>>j;
        a[j-1]++;
    }
    rep(i,n){
        if(q-a[i]>=k){
            No;
        }
        else{
            Yes;
        }
    }
    
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(){
	char b[11];
  	int i;
  	int ans = 0;
  	int count = 0;
  
  	scanf("%s", b);
  
	for(i=0; i<11;i++){
    	if(b[i] == 'A' || b[i] == 'T' || b[i] == 'C' || b[i] == 'G'){
        	count++;
        }else{
          	if(count > ans){
        		ans = count;
            }
          	count = 0;
        }
    }
  	printf("%d\n", ans);
  	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=100;
int b[N];
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n,m,c; cin>>n>>m>>c;
	int cnt=0;
	for(int i=1; i<=m; i++) cin>>b[i];
	for(int i=1; i<=n; i++) {
		ll sum=c;
		for(int j=1; j<=m; j++) {
			int a;
			cin>>a;
			sum+=a*b[j];
		}
		if(sum>0) {
			cnt++;
		}
	}
	cout<<cnt<<endl;


	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

alias Edge = Tuple!(int, "to", int, "c", int, "rev");

void main() {
    int n, m;
    scan(n, m);

    auto adj = new Edge[][](n, 0);

    foreach (i ; 0 .. m) {
        int ui, vi, ci;
        scan(ui, vi, ci);
        adj[ui] ~= Edge(vi, ci, adj[vi].length.to!int);
        adj[vi] ~= Edge(ui, 0, adj[ui].length.to!int - 1);
    }

    debug {
        //writeln(adj);
    }

    int dfs(int u, int b, bool[] visited) {
        if (u == n - 1) {
            debug {
                //writefln("%d", u);
            }
            return b;
        }

        visited[u] = true;

        //writef("%d ", u);

        foreach (ref v ; adj[u]) {
            if (v.c > 0 && !visited[v.to]) {
                int d = dfs(v.to, min(b, v.c), visited);
                if (d > 0) {
                    v.c -= d;
                    adj[v.to][v.rev].c += d;
                    return d;
                }
            }
        }

        return 0;
    }

    int ans;

    while (true) {
        auto visited = new bool[](n);
        visited[0] = true;

        int F = dfs(0, 101101, visited);

        debug {
            //writeln("F:", F);
            //writeln(adj);
        }

        if (!F) break;

        ans += F;
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

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

int main() {
  int N;
  int x = 0;
  string S;
  cin >> N;
  for (int i = 0; i<N; i++) {
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      x = 1;
      break;
    }
  }
  if (x == 0)
  cout << "Three" << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int S, W;
	cin >> S >> W;
	if (W >= S) cout << "unsafe" << endl;
	else  cout << "safe" << endl;
}


Measured memory_bytes: 3632
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int count = 0;

    for(int i=0 ; i<s.length() ; i++){
      if(s.charAt(i) != t.charAt(i)){
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 41000
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  long int a=0,b,c;
  scanf("%ld %ld",&a,&b);
  for (int i = b-a+1; i < b+a; i++) {
    printf("%d ",i);
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define piil pair<pii, ll>
#define F first
#define S second
#define pb push_back

const int SMAX = 10001;

using namespace std;

int n, ein[1010];
piil wsv[1010];
ll dp[SMAX];
vector<int> g[1010];



int main(){

	cin >> n;
	for(int i=1; i<=n; i++) cin >> wsv[i].F.F >> wsv[i].F.S >> wsv[i].S;

	for(int i=1; i<=n; i++){
		for(int j=i+1; j<=n; j++){
			int w1 = wsv[i].F.F, s1 = wsv[i].F.S;
			int w2 = wsv[j].F.F, s2 = wsv[j].F.S;
			if(w1 <= s2 && w2 <= s1){
				if(s2-w1 > s1-w2){
					ein[i]++;
					g[j].pb(i);
				} else if(s2-w1 < s1-w2){
					ein[j]++;
					g[i].pb(j);
				}
			} else if(w1 <= s2){
				ein[i]++;
				g[j].pb(i);
			} else if(w2 <= s1){
				ein[j]++;
				g[i].pb(j);
			}
		}
	}

	vector<int> ord, z;

	for(int i=1; i<=n; i++) if(!ein[i]) z.pb(i);

	for(unsigned int i=0; i<z.size(); i++){
		ord.pb(z[i]);
		for(int j : g[z[i]]){
			ein[j]--;
			if(!ein[j]) z.pb(j);
		}
	}

	for(int i=0; i<n; i++){
		int c = ord[i];
		for(int j=wsv[c].F.F; j<SMAX; j++){
			int nx = min(j-wsv[c].F.F, wsv[c].F.S);
			if(dp[j]) dp[nx] = max(dp[nx], dp[j]+wsv[c].S);
		}
		dp[wsv[c].F.S] = max(dp[wsv[c].F.S], wsv[c].S);
	}

	ll ans = 0;
	for(int i=0; i<SMAX; i++) ans = max(ans, dp[i]);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3200
import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val ls = IntArray(n){scn.nextInt()}
	ls.sort()
	val arr = Array(n-1){b -> IntArray(b){a -> ls[b]+ls[a]} }
	var ans = 0
	for (c in 2 until n){
		for (b in 1 until c){
			var l = 0
			var r = b-1
			if (arr[b][r] <= ls[c]) continue
			if (ls[c] < arr[b][l]) {
				ans += b
				continue
			}
			while (r-l>1){
				val h = (l+r)/2
				if (ls[c] < arr[b][h]) r = h
				else l = h
			}
			ans += b-r
		}
	}
	println(ans)
}

Measured memory_bytes: 50580
#include <stdio.h>
#include <string.h>

int main(){
    while(1){
        int a, b, sum;
        char str[1024];
        if(scanf("%d", &a) == EOF){
            break;
        }
        scanf("%d", &b);
        sum = a + b;
        sprintf(str, "%d", sum);
        printf("%d\n", strlen(str));
    }
    return 0;
}

Measured memory_bytes: 0
def main():
    A, B = map(int, input().split())
    while B!= 0: A, B = B, A % B 
    print(num_prime_factor(A))

def num_prime_factor(n):
    
    if n == 1: return 1
    
    ret = 1
    cursor = 2
    if n % cursor == 0: ret += 1
    while n % cursor == 0: n = n // cursor
    
    cursor = 3
    while cursor**2 <= n:
        if n == 1: return ret
        if n % cursor == 0: ret += 1
        while n % cursor == 0: n = n // cursor
        cursor += 2

    if n != 1: ret += 1
        
    return ret

if __name__ == "__main__":
    main()

Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (char c : s)
    {
        if (c == ',')
            cout << " ";
        else
            cout << c;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std; 
using namespace __gnu_pbds;
 
#define ll long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second

#define mp map<ll,ll>
#define vc vector<ll>
#define pq priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>
#define MAX  *max_element
#define MIN  *min_element
#define lcm(a,b) (a*b)/__gcd(a,b)
#define des_sort(v) sort(v.begin(),v.end(),greater<int>())
//max xor btw range of two numbers..
 
#define max_XOR(a,b) (1 << int(log2(a ^ b) + 1)) - 1
#define c_ones(number) __builtin_popcountll(number)
#define flip_bits(number) static_cast<unsigned>(~number)
 
#define all(X) X.begin(),X.end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(itr,n) for(itr=n.begin();itr!=n.end();itr++)
 
#define FLUSH fflush(stdout)
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb_ds tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define mod 1000000007
#define INF 1e18
 
const double PI = acos(-1);
 
bool compare(pair<int,int>a , pair<int,int>b){
	return a.first==b.first ? a.second<b.second : a.first < b.first;
}
 
struct hash_pair{ 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};
 
int twocount(ll n){
	int ans=0;
	while (n>0){
		n=n/2;
		ans++;
	}
	return ans;
} 

int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	if(k<=a){
		ans+=k;
		cout<<ans<<endl;
		return 0;
	}
	else{
		ans+=a;
		k=k-a;
	}
	if(k<=b){
		cout<<ans<<endl;
		return 0;
	}
	else k=k-b;
	ans=ans-k;
	cout<<ans<<endl;
}

Measured memory_bytes: 3676
n, x = map(int, input().split())
a = [int(y) for y in input().split()]
ans = 0
for i in range(1, n):
    d = a[i-1] + a[i]
    if d <= x: continue
    a[i] -= min(a[i], d - x)
    a[i-1] -= max(d - x - a[i], 0)
    ans += d - x
print(ans)


Measured memory_bytes: 19944
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll a,b;
    cin >> a >> b;

    if(b >= a ) cout << a << endl;
    else cout << a-1<<endl;


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
function main(input) {
	var inputSeparate = input.split(" ");
  	var N = inputSeparate[0];
  	var D = inputSeparate[1];
	var numOfPeople = Math.ceil(N/(D*2+1));
  	console.log(numOfPeople);
  
  	
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11468
import itertools

N, M = map(int, input().split())
pl = itertools.permutations([i for i in range(1, N + 1)])
ab = [list(map(int, input().split())) for _ in range(M)]
ans = 0
for l in pl:
    if l[0] != 1:
        continue
    f = True
    for i in range(N - 1):
        if not ([l[i], l[i + 1]] in ab or [l[i + 1], l[i]] in ab):
            f = False
            break
    if f:
        ans += 1
print(ans)

Measured memory_bytes: 3064
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const ll N = 2e3, mod = 1e9 + 7;

void solve() {
    int n, k;
    cin >> n >> k;
    vector <int> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    int dp[n + 1][k + 1];
    dp[0][0] = 1;
    for (int i = 1; i <= k; ++i) {
        dp[0][i] = 0;
    }
    for (int i = 1; i <= n; ++i) {
        int sums[k + 1];
        sums[0] = dp[i - 1][0];
        for (int j = 1; j <= k; ++j) {
            sums[j] = (sums[j - 1] + dp[i - 1][j]) % mod;
        }
        for (int j = 0; j <= k; ++j) {
            int tr = sums[j];
            int u = j - a[i] - 1;
            if (u >= 0) {
                tr = (tr - sums[u] + mod) % mod;
            }
            dp[i][j] = tr;
        }
    }
    cout << dp[n][k];
}
int main()  {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}                                   

Measured memory_bytes: 40064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    int[] inputArray;
    Set<String> set = new HashSet<>();
    int K;

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        double A = Double.parseDouble(sc.next());
        double B = Double.parseDouble(sc.next());
        String ans;
        if(A > B){
            ans = "GREATER";
        } else if(A < B){
            ans = "LESS";
        } else {
            ans = "EQUAL";
        }

        System.out.println(ans);
    }

    void substring(String s, int num){
        for(int i=1; i<=num; i++){
            if(i > K){
                break;
            }
            for(int j=0; j<num; j++){
                if(j + i-1 < num){
//                    System.out.println(s.substring(j, j+i));
                    set.add(s.substring(j, j+i));
                } else {
                    break;
                }
            }
        }
    }

    void permutation(String s, String ans){
        if(s.length() <= 1){
            System.out.println(ans + s);
        } else {
            for(int i=0; i<s.length(); i++){
                permutation(s.substring(0, i) + s.substring(i + 1), ans + s.charAt(i));
            }
        }
    }
}

Measured memory_bytes: 23764
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

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

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

    vector<int> cities(n);
    for (int i = 0; i < n; ++i)
        cin >> cities[i];

    for (int i = 0; i < n; ++i)
        cities[i] -= x;

    int d = abs(cities[0]);
    for (int i = 1; i < n; ++i)
        d = gcd(d, abs(cities[i]));
    cout << d << '\n';
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>

#include<stdio.h>
#include<stdlib.h>

#define ll long long

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a(N,0);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    vector<int> cnt(100000,0);
    for(int i=0;i<N;i++){
        cnt[a[i]]++;
    }
    int keep=0;//最大値補完計画
    for(int i=1;i<cnt.size()-1;i++){
        keep=max(keep,cnt[i-1]+cnt[i]+cnt[i+1]);
    }
    cout << keep << endl;
    return 0;
}


Measured memory_bytes: 1024
# Traveling Plan
n = int(input())
a = [0]
a += list(map(int, input().split()))
a += [0]
total = 0
for i in range(n+1):
    total += abs(a[i]-a[i+1])
for i in range(n):
    p = total -(abs(a[i]-a[i+1]) + abs(a[i+1]-a[i+2])) + abs(a[i]-a[i+2])
    print(p)


Measured memory_bytes: 14172
#include<iostream>
#include<complex>
using namespace std;
int main(){
  int i,n,k;
  cin >> n;
  cin >> k;

  double dist,x[n];
  dist = 0;
  for (i=0; i<n; i++){
    cin >> x[i];
    double dist_a = x[i];
    double dist_b = abs(x[i] - k);
    if(dist_a <= dist_b) dist += 2 * dist_a;
    else dist += 2 * dist_b;
  }

  cout << dist << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  ll A, B, C, K;
  cin >> A >> B >> C >> K;

  if(A-B > 1000000000000000000 || B-A > 1000000000000000000){
    cout << "Unfair" << endl;
  }else{
    if(K%2 == 0){
      cout << A-B << endl;
    }else{
      cout << B-A << endl;
    }
  }
}

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

using namespace std;

int main()
{
  int N, M;
  set<string> system;
  bool open = false;
  cin >> N;
  for(int i = 0; i < N; i++){
    string id;
    cin >> id;
    system.insert(id);
  }
  cin >> M;
  for(int i = 0; i < M; i++){
    string id;
    cin >> id;
    if(system.count(id)){
      if(open) cout << "Closed by " << id << endl;
      else cout << "Opened by " << id << endl;
      open = !open;
    } else {
      cout << "Unknown " << id << endl;
    }
  }
  return 0;
}

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


int main(){
  int n,sw=0;
  cin>>n;
  int A[n];
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  bool flag=1;
  for(int i=0;flag;i++){
    flag=0;
    for(int j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
        swap(A[j],A[j-1]);
        sw++;
        flag=1;
      }
    }
  }
  for(int i=0;i<n;i++){
    if(i){cout <<" ";}
    cout << A[i];
  }
  cout << endl<<sw<<endl;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    REP(i, h) {
        REP(j, w) {
            if (j < a && i < b
               || j >= a && i >= b) {
                cout << 0;
            } else {
                cout << 1;
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 1280
import java.io.BufferedReader
import java.io.InputStreamReader

class C

fun main( args: Array<String> ) {
    val st = BufferedReader( InputStreamReader( System.`in` ) )
    val n = st.nextInt()
    val s = st.readLine()
    val q = st.nextInt()
    val len = run {
        val list = st.nextInts().toMutableList()
        list.add( 3 )
        return@run list.toIntArray()
    }
    val p = Array( len.size, { it } )
    p.sortBy { len[it] }
    val r = LongArray( len.size )
    r[p[0]] = run {
        var cnt = 0L
        for ( i in 0 .. s.length - 3 ) {
            if ( s[i] == 'D' && s[i + 1] == 'M' && s[i + 2] == 'C' ) {
                cnt ++
            }
        }
        return@run cnt
    }
    val mCount = run {
        val tmp = LongArray( n + 1 )
        for ( i in s.indices ) {
            tmp[i + 1] = tmp[i] + if ( s[i] == 'M' ) 1 else 0
        }
        return@run tmp
    }
    val cCount = run {
        val tmp = LongArray( n + 1 )
        for ( i in s.indices ) {
            tmp[i + 1] = tmp[i] + if ( s[i] == 'C' ) 1 else 0
        }
        return@run tmp
    }

    for ( i in 1 until p.size ) {
        r[p[i]] = r[p[i - 1]]
        if ( len[p[i]] == len[p[i - 1]] ) {
            continue
        }

        val pairs = LongArray( s.length + 1 )
        run {
            val l = len[p[i]] - len[p[i - 1]]
            var mc = 0L
            var cc = 0L
            for ( j in s.indices.reversed() ) {
                if ( j < s.lastIndex ) pairs[j] = pairs[j + 1]
                if ( j + l < s.length ) {
                    if ( s[j + l] == 'C' ) {
                        pairs[j] -= mc
                        cc --
                    }
                    if ( s[j + l] == 'M' ) {
                        mc --
                    }
                }
                if ( s[j] == 'M' ) {
                    pairs[j] += cc
                    mc ++
                }
                if ( s[j] == 'C' ) {
                    cc ++
                }
            }
        }

        for ( j in 0 .. s.length - len[p[i - 1]] ) {
            if ( s[j] != 'D' ) continue
            r[p[i]] += ( mCount[j + len[p[i - 1]]] - mCount[j] ) * ( cCount[Math.min( cCount.lastIndex, j + len[p[i]] )] - cCount[j + len[p[i - 1]]] )
            r[p[i]] += pairs[j + len[p[i - 1]]]
        }
    }
    for ( i in 0 until q ) {
        println( r[i] )
    }
}

private fun BufferedReader.nextInt(): Int {
    return readLine().toInt()
}

private fun BufferedReader.nextInts(): IntArray {
    val s = readLine().split( " " )
    return IntArray( s.size, { s[it].toInt() } )
}


Measured memory_bytes: 284992
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>

void solve(int n, int x, int y) {
  std::vector<int> count(n, 0);
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      int dis;
      if (j <= x || i >= y) dis = j - i;
      else if (i <= x) dis = x - i + std::min(j - x, std::abs(y - j) + 1);
      else if (j <= y) dis = std::min(j - i, i - x + 1 + y - j);
      else dis = j - y + std::min(y - i, i - x + 1);
      ++count[dis];
    }
  }
  for (int i = 1; i < n; ++i) std::cout << count[i] << std::endl;
}

int main() {
  int n, x, y;
  std::cin >> n >> x >> y;
  solve(n, x, y);
  return 0;
}


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

int main(void){
	int N, K;
  cin >> N >> K;
  int h[N];
  rep(i,N) h[i] = 0;
  rep(i,K) {
  	int d;
    cin >> d;
    rep(j,d) {
    	int a;
      cin >> a;
      a--;
      h[a]++;
    }
  }
  
  int ans = 0;
  rep(i,N) if (h[i]==0) ans++;
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
void solve(int N){
    vector<int> V(N);
    rep(i,0,N){
        string s;
        cin >> s;
        V[i] = s.size();
    }
    int arr[] = {5,7,5,7,7};
    rep(i,0,N){
        int sum = 0, cur = 0;
        bool ok = 1;
        rep(j,i,N){
            sum += V[j];
            if(sum > arr[cur]){
                ok = 0;
                break;
            }else if(sum == arr[cur]){
                cur++;
                sum = 0;
            }
            if(cur == 5)break;
        }
        if(!ok || cur != 5)continue;
        cout << i+1 << endl;
        return;
    }
}
main(){
    int N;
    cin >> N;
    while(N){
        solve(N);
        cin >> N;
    }
}


Measured memory_bytes: 3124
#include <cstdio>
#include <cstring>

int main()
{
  int n;
  char s[101], t[101];
  scanf("%d%s%s", &n, s, t);
  for (int i = 0; i < n; ++i)
  {
    if (memcmp(s + i, t, n - i) == 0)
    {
      printf("%d\n", n + i);
      return 0;
    }
  }
  printf("%d\n", n + n);
  return 0;
}

Measured memory_bytes: 128
N = int(input())

a_list = list(map(int, input().split()))

judge = True
for a in a_list:
    if a % 2 ==0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            judge = False
            break

if judge is True:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int ar[14][14];
int taken[14]={0};
int mini=INT_MAX;
int sum=0;
int n,xx,m;
void fn(int x)//x iterates in n
{
	if(x==n)
	 {
	 	int yy=0;
	 	for(int i=0;i<m;i++)
	 	 {
	 	   if(taken[i]<xx) 
	 	     {
	 	        yy=1;break;   	
	 	     }
	 	 }
	 	if(yy==0) {mini=min(mini,sum);}//for(int i=0;i<m;i++) cout<<taken[i]<<" ";}
	 	return ;
	 }
	else
	{
		for(int i=0;i<m;i++)
		 taken[i]+=ar[x][i+1];
		sum+=ar[x][0]; 
		fn(x+1);
		for(int i=0;i<m;i++)
		 taken[i]-=ar[x][i+1];
		sum-=ar[x][0]; 
		fn(x+1);
	}
}
int main() {
	// your code goes here
    //int n,m,x;
    cin>>n>>m>>xx;
    //int ar[n][m+1];
    for(int i=0;i<n;i++)
     {
     	for(int j=0;j<=m;j++)
     	 cin>>ar[i][j];
     }
     fn(0);
     if(mini==INT_MAX) cout<<-1<<endl;
     else
    cout<<mini<<endl; 
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
using namespace std;
int main(){
  int m,n,ans;
  while(cin>>m){
    if(m==0) break;
    cin >> n;
    ans = 0;
    for(int i=m;i<=n;i++){
      int k = i;
      while(k%5==0) k/=5;
      while(k%3==0) k/=3;
      while(k%2==0) k/=2;
      if(k==1) ans++;  
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右下左上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, -1 };
constexpr int dy[] = { 0, 1, 0, -1, 1, 1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; ++i) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j]; return a;
        }
    };
    inp inp1;

    int c[26]; // 満足度の下がりやすさ
    int s[365][26]; // 満足度の増加数
    int t[365]; // コンテストのタイプ
    int last[26];

    int d;
}

int main() {

    int d;
    cin >> d;
    rep(i, 26) cin >> c[i];
    rep(i, d) {
        rep(j, 26) {
            cin >> s[i][j];
        }
    }

    rep(i, d) cin >> t[i];
    rep(i, 26) last[i] = -1;

    vector<int> v(d);

    int score = 0;
    rep(i, d) {
        int type = t[i] - 1;
        // 満足度の増加
        score += s[i][type];
        last[type] = i;
        // 時間による満足度の低下
        rep(j, 26) {
            score -= c[j] * (i - last[j]);
        }
        v[i] = score;
    }

    Cout(v, "\n");

    // やっと理解した

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;

    int res = 0;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (500 * i + 100 * j + 50 * k == x) {
                    res++;
                }
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
	return *(int*)a - *(int*)b;
}

int main(){

	int K, X, i;




	scanf("%d %d", &K, &X);

	for (i = X - K + 1; i <= X + K - 1; i++){
		printf("%d ", i);
	}

	printf("\n");

	return 0;

}
    


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

int main() {
  int N;
  int64_t K;
  cin >> N >> K;
  vector<bool> check(N, false);
  check.at(0) = true;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int total = 1;
  bool finish = true;
  int a = 1;
  while(finish) {
    a = A.at(a - 1);
    if (check.at(a - 1)) {
      finish = false;
    }
    else {
      check.at(a - 1) = true;
      total += 1;
    }
  }
  int b = 1;
  int count = 0;
  bool same = true;
  while(same) {
    if (b == a) {
      same = false;
    }
    else {
      b = A.at(b - 1);
      count += 1;
    }
  }
  if (K >= count) {
    int roop = total - count;
    int64_t c = (K - count) % roop;
    int d = 1;
    for (int i = 0; i < count + roop + c; i++) {
      d = A.at(d - 1);
    }
    cout << d << endl;
  }
  else {
    int d = 1;
    for (int i = 0; i < K; i++) {
      d = A.at(d - 1);
    }
    cout << d << endl;
  }
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef string str;
    typedef pair<int,int> pii;
    typedef pair<ll,ll> pll;
    typedef vector<int> vi;
    typedef vector<ll> vll;
    typedef vector <pii> vpii;
    typedef vector <pll> vpll;
    typedef map <str,int> mapsi;
    typedef map <str,int> :: iterator mapsitr;
    typedef set <int> :: iterator sitr;
    typedef set <ll> :: iterator sltr;
    #define mset multiset
    typedef mset <int> msi;
    typedef mset <ll> msll;
    typedef mset <int> :: iterator msitr;
    typedef mset <ll> :: iterator msltr;
    #define mp make_pair
    #define pb push_back
    #define pob pop_back
    #define fi first
    #define se second
    #define fs first.second
    #define ss second.second
    #define ff first.first
    #define sf second.first
    ll cx,cy,h,n;
    ll py[200][200];
    bool used[200][200];
    pair < pll , ll > data[200];
    bool found;
    ll manhattan ( pll a, pll b ){
        return (ll) ( abs(a.fi - b.fi) + abs(a.se - b.se) );
    }
    bool isvalid (){
        pair<ll,ll> center;
        center = mp (cx,cy);
        bool valid = true;

        for(int i=1;i<=n;i++){
            ll dist = manhattan (center,data[i].fi);

            if(h-dist == data[i].se){continue;}
            else if(data[i].se==0 && h-dist <=0){continue;}
            else{valid=false;break;}
        }
        return valid;
    }
    int main(){
        cin>>n;
        for(int i=1;i<=n;i++){
            ll x,y,height;
            cin>>x>>y>>height;
            py[x][y]=height;
            used[x][y]=true;
            data[i] = mp (mp(x,y),height);
        }
        ll temph;
        for(int i=1;i<=n;i++){
            if(data[i].se > 0){temph=i;break;}
        }
        for(int i=0;i<=100;i++){
            for(int j=0;j<=100;j++){
                cx = i;
                cy = j;
                if(!used[cx][cy]) h = data[temph].se + manhattan ( mp(cx,cy) , data[temph].fi);
                else{h = py[cx][cy];}

                if(h<=0)continue;
                if(isvalid()){found=true;break;}
            }
            if (found) break;
        }
        cout<<cx<<" "<<cy<<" "<<h<<endl;


    }


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
 
int main() {
  int N;
  cin >> N;
  if (N == 1) cout << "Hello World" << endl;
  if (N == 2) {
    int A, B;
    cin >> A >> B;
    int ans = A + B;
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

def dextothree(m):
    s=""
    tmp=m
    while tmp>0:
        s+=str(tmp%3)
        tmp//=3
    return s[::-1]
 
n=int(input().rstrip())
a=[int(i) for i in input().split()]
num=[]
ans=0
for i in range(n):
    num.append([a[i]-1,a[i],a[i]+1])
#print(num)
for i in range(3**n):
    now=dextothree(i).zfill(n)
    #print(now)
    cnt=1
    for i in range(n):
        cnt*=num[i][int(now[i])]
    if cnt&1==0:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
    int n,k,a[200100]= {0};
    cin>>k>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(i!=n-1)
        ans=max(abs(a[i+1]-a[i]),ans);
        else
        {
            if(abs(a[i]-a[0])>k/2)
            ans=max(k-abs(a[i]-a[0]),ans);
            else
            ans=max(abs(a[i]-a[0]),ans);
        }
    }
    cout<<k-ans;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n,m,p,x,c;
vector<int>t,v(100000);
int main()
{
    cin>>n;
    for(int i=0; i<n; ++i)
        cin>>v[i];

    cin>>m;
    for(int i=0; i<m; ++i)
    {
        int sum=0;
        cin>>p>>x;
        c=v[p-1];
        v[p-1]=x;
        for(int j=0; j<v.size(); ++j)
            sum+=v[j];
        cout<<sum<<endl;
        v[p-1]=c;
    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define el '\n'

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i]==s[i+1]) {
      cout << "Bad" << el;
      return 0;
    }
  }
  cout << "Good" << el;
  return 0;
}

Measured memory_bytes: 256
def get_root(s):
    if s != root[s]:
        root[s] = get_root(root[s])
        return root[s]
    return s

def unite(s, t):
    root_s = get_root(s)
    root_t = get_root(t)
    if not root_s == root_t:
        if rank[s] == rank[t]:
            root[root_t] = root_s
            rank[root_s] += 1
        elif rank[s] > rank[t]:
            root[root_t] = root_s
        else:
            root[root_s] = root_t

def same(s, t):
    if get_root(s) == get_root(t):
        return True
    else:
        return False

n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]
ans = 0
for i in range(m):
    root = [i for i in range(n)]
    rank = [1 for _ in range(n)]
    for j in range(m):
        if not i == j:
            unite(l[j][0] - 1, l[j][1] - 1)
    c = 0
    for j in range(n - 1):
        if not same(j, j + 1):
            c = 1
            break
    if c == 1:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
    int i,j,a,s,k;
    scanf("%d",&a);
    for(i=1; i<=sqrt(a); i++)
    {
        k=a;
        s=k/i;
        j=s*i;
        if(j==a && s>=1 && s<=9 )
        {
            printf("Yes\n");
            break;

        }
    }
    if(j!=a || s>9)
    {
        printf("No\n");
    }

}



Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;

int par[200010],sz[200010];
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i; sz[i] = 1;
	}
}

ll find(ll x){
	if(par[x]==x) return x;
	return par[x] = find(par[x]);
}

void unite(ll x, ll y){
	x = find(x); y = find(y);
	if(x==y) return;
	if(sz[x]<sz[y]) swap(x,y);
	par[y] = x; sz[x] += sz[y];
}

bool same(ll x, ll y){
	return find(x)==find(y);
}
typedef pair<ll,pair<ll,ll>> P;
priority_queue<P,vector<P>,greater<P>> que;
int main(){
	int i,n,q;
	cin >> n >> q;
	init(n);
	for(i=0;i<q;i++){
		ll a,b,c; cin >> a >> b >> c;
		que.push({c,{a,b}});
		que.push({c + 1,{(a + 1)%n,b}});
	}
	ll res = 0;
	while(que.size()){
		P p = que.top();
		que.pop();
		ll u = p.second.first,v = p.second.second;
		if(same(u,v)) continue;
		unite(u,v); res += p.first;
		p.first += 2; (p.second.first += 1) %= n; (p.second.second += 1) %= n;
		que.push(p);
	}
	cout << res << endl;
}
	

Measured memory_bytes: 16236
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        p,q = LI()
        g = fractions.gcd(p,q)
        t = q//g
        k = 1
        if t % 2 == 0:
            k *= 2
            while t % 2 == 0:
                t //= 2
        for i in range(3,int(math.sqrt(t))+2,2):
            if t % i > 0:
                continue
            k *= i
            while t % i == 0:
                t //= i
        rr.append(t*k)

        break



    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9032
def main():
    S = input()
    T = input()
    ans = 0

    if S == T:
        return ans
    else:
        for i in range(len(S)):
            if S[i] != T[i]:
                ans = ans + 1
        return ans

def main_2(): 
    ans = main()
    print(ans)

main_2()



Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,m;
    cin>>a>>b>>m;
    int reg[a+1],mic[b+1];
    int min_reg=INT_MAX,min_mic=INT_MAX;
    for(int i=1;i<=a;i++)
    {
        cin>>reg[i];
        min_reg = min(min_reg,reg[i]);
    }
    for(int i=1;i<=b;i++)
    {
        cin>>mic[i];
        min_mic= min(min_mic,mic[i]);
    }
    int ans = min_reg+min_mic;
    for(int i=1;i<=m;i++)
    {
        int z,x,v;
        cin>>z>>x>>v;
        ans = min(ans , reg[z]+mic[x]-v);
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
long long ans;
int a[N];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int n;
    cin >> n;
    for(int i = 0;i < n; ++i)
        cin >> a[i];
    for(int i = 1;i < n; ++i)
        if(a[i] == a[i-1]-1) a[i]++;
    for(int i = 1;i < n; ++i){
        if(a[i] < a[i-1]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, a, b;
    cin >> n >> a >> b;
    VL dist(n);
    ll prev_x;
    cin >> prev_x;
    ll ans = 0;
    REP(i, n - 1){
        ll x;
        cin >> x;
        ans += min((x - prev_x) * a, b);
        prev_x = x;
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 1024
//c++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
#include <fstream>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define revrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define sz(x) ((int)(x).size())

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const int INF = 1 << 30;//10^9
const ll MOD = 1000000007;
//const ll MOD = 998244353;
double EPS = 1e-10;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A){printf("%.9lf\n", A);}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};


//コンビネーション
const int MAXcomb = 2000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 500010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}

ll disit(ll s, ll base = 10){
  ll res = 0;
  while(s){
    res++;
    s /= base;
  }
  return res;
}

vector<int> divisor(int n){
    vector<int> res(0);
    for(int i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n/i) res.push_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int N;
int A[200010];
int cnt[1000010];
void solve(){
  cin >> N;
  rep(i, N) cin >> A[i];
  rep(i, N) cnt[A[i]]++;
  int ans = 0;
  rep(i, N){
    vector<int> div = divisor(A[i]);
    int sum = -1;
    for(int d: div){
      sum += cnt[d];
    }
    if(sum == 0){
      ans++;
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 8200
fun main(args : Array<String>) {
    val (n, m, k) = readLine()!!.split(" ").map { it.toInt() }

    for (i in 0..n) {
        for (j in 0..m) {
            if (i * (m - j) + (n - i) * j == k) {
                println("Yes")
                return
            }
        }
    }

    println("No")
}

Measured memory_bytes: 36656
S = list(map(int, input()))
K = int(input())
if len(S) == 1:
    print(S[0])
    exit()

cnt = 0
for s in S:
    if s == 1:
        cnt += 1
    else:
        break

if K <= cnt:
    print(1)
else:
    print(S[cnt])


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

int main(void){
  int h,w;
  while(cin>>h>>w,h||w){
    for(int i=0;i<h;++i){
      for(int j=0;j<w;++j)printf("#");
      puts("");
    }
    puts("");
  }
}

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

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

Measured memory_bytes: 640
x, n = map(int, input().split())
p = list(map(int, input().split()))
delta = 0
state_n = 0
state_p = 0
while True:
  ans_n = x - delta
  ans_p = x + delta
  for i in range(len(p)):
    if ans_n == p[i]:
      state_n = 1
    if ans_p == p[i]:
      state_p = 1
  if state_n == 0 and state_p == 0:
    ans = ans_n
    break
  if state_n == 1 and state_p == 1:
    state_n = 0
    state_p = 0
  elif state_p == 1:
    ans = ans_n
    break
  elif state_n == 1:
    ans = ans_p
    break
  delta = delta + 1

print(ans)

Measured memory_bytes: 9220