akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = (int) 1e8 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 1e5 + 5;
int n;
int s[maxn];
int f[maxn];

void solve() {
    cin >> n;
    FOR(i, 0, n) cin >> s[i];
    f[0] = 1;
    FOR(i, 0, n) {
        FORd(j, maxn, 0) if (f[j]) {
            if (j + s[i] < maxn) {
                f[j + s[i]] = 1;
            }
        }
    }
    int ans = 0;
    FOR(i, 0, maxn) if (f[i]) {
        if (i % 10) chkmax(ans, i);
    }
    cout << ans << "\n";
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main ( void ) {
    
    int Max_number = 0;
    int Arr[2] = {};
    int min = 0;
    int output = 0;
    int i = 0;
    int j = 0;
    
    scanf ( "%d", &Max_number );
    
    scanf ( "%d", &Arr[0] );
    
    scanf ( "%d", &Arr[1] );
    
    output = Arr[1] - Arr[0];
    
    if ( Arr[0] < Arr[1] ) {
        min = Arr[0];
    } else {
        min = Arr[1];
    }
    
    for ( i = 2; i < Max_number; i++ ) {
        scanf ( "%d", &Arr[0] );
        if ( output < (Arr[0] - min) ) {
            output = Arr[0] - min;
        }
        
        if ( min > Arr[0] ) {
            
            min = Arr[0];
        
        }
    }
    
    printf( "%d\n", output );
    
    return 0;
    
}


Measured memory_bytes: 2108
// 26/01/20 // 10:06 AM //

#include <bits/stdc++.h>

using namespace std;

const int MAXN = (int)(1e2) + 10;
const int MAXK = (int)(1e5) + 10;

int n, k;
int a[MAXN], memo[MAXK];

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

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

    // solve(){
    for(int h=1; h<=k; h++){
        for(int i=0; i<n && a[i]<=h; i++){
            memo[h] = !memo[h-a[i]];

            if(memo[h]) break;
        }
    }
    //}

    cout << (memo[k]?"First":"Second") << endl;

    return 0;
}



Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int inputInt = scanner.nextInt();
        int[] array = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        System.out.println(array[inputInt - 1]);
    }
}

Measured memory_bytes: 25044
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, M, inputs):
    relations = {}
    visited_all = (2 ** N) - 1
    for i in range(1, N + 1):
        relations[i] = []

    for i in inputs:
        [parent, child] = string_to_int(i)
        relations[parent].append(child)
        relations[child].append(parent)

    routes = 0
    queue = deque([[1, 0]])
    while len(queue) > 0:
        [node, visited] = queue.popleft()

        if visited & (1 << (node - 1)) != 0:
            continue

        visited = visited + (1 << (node - 1))

        if visited == visited_all:
            routes += 1
            continue

        for next in relations[node]:
            queue.append([next, visited])
    return routes


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(N, M, inputs(M))
    print(ret)


Measured memory_bytes: 44912
def fac(n):
    dic = {}
    cur = n
    for i in range(2,(int(n**0.5)+2)):
        if cur % i == 0:
            count = 0
            while cur % i == 0:
                count += 1
                cur //= i
            dic[i] = count
            if cur == 1:
                break
    if cur != 1:
        dic[cur] = 1
    return dic

N = int(input())
lists = fac(N)
ans = 0
for i in lists.values():
    count = 1
    while i >= count:#count=1+2+3+...nといってもしiがcount未満の値になったら終了
        i -= count
        count += 1
        ans += 1
print(ans)

Measured memory_bytes: 63452
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,A;
    cin>>N>>A;
    
    N%=500;
    if(N<=A){
        cout1("Yes")
    }else{
        cout1("No")
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3

a,b = map(int,input().split())
aary = []
bary = []

for i in range(b):
    aary.append(a)
for i in range(a):
    bary.append(b)

anum = int("".join(map(str,aary)))
bnum = int("".join(map(str,bary)))

if a < b:
    print(anum)
else:
    print(bnum)
    


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

int main(){
  int n,k,l,j=0,ans=0;
  cin>>n>>k;
  vector<int> a(n);
  map<int, int> b;
  REP(i,n) cin >> a.at(i);
  REP(i,n) b[a.at(i)]++;  
  vector<int> c(b.size(),0);
  for(auto p:b){
    c.at(j)=p.second;
    j++;
  }
  sort(c.begin(), c.end());
  if(c.size()>k) for(j=0;j<c.size()-k;j++) ans+=c.at(j);
  cout<<ans<<endl;
}

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

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

    string S;
    cin >> S;

    string ans = "No";

    if (N % 2 == 0) {
        int halfN = N / 2;
        if (S.substr(0, halfN) == S.substr(halfN, halfN)) {
            ans = "Yes";
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a;
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputDoubleArray(a,N) double a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  //accumulateを用いる時は、第3引数がint型かどうか注意しましょう！！（自戒）
  
  //input
  inputInt3(A,B,T);
  int ans = (int)((T+0.5)/A)*B;
  //output
  output(ans);
  
  return 0;
}

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

int main(){
	
	int n; cin >> n;
	float x[n],y[n],sum=0;
	
	cout.precision(12);
	
	for (int i=0 ; i<n ; i++) cin >> x[i] >> y[i];
	
	for (int i=0 ; i<n-1 ; i++)
		for (int j=i+1 ; j<n ; j++) sum += sqrt(pow(x[i]-x[j],2) + pow(y[i]-y[j],2));
	
	cout << 2*sum/n << endl;
	
	return 0;
}

Measured memory_bytes: 3812
#E
N,X,M=map(int,input().split())

F=[0 for i in range(10**5+1)]
for i in range(10**5+1):
    F[i]=pow(i,2,M)
    
Flag=[False for i in range(10**5+1)]
A_i=X
while True:
    A_i=F[A_i]
    if Flag[A_i]:
        st=A_i
        break
    Flag[A_i]=True

A_i=X
Sum_1=0
cnt=0
while True:
    if A_i==st:
        break
    cnt+=1
    Sum_1+=A_i
    A_i=F[A_i]

roop=1
A_i=st
Sum_2=0
while True:
    Sum_2+=A_i
    A_i=F[A_i]
    if A_i==st:
        break
    roop+=1

    
A_i=st
Sum_3=0
for i in range((N-cnt)%roop):
    Sum_3+=A_i
    A_i=F[A_i]
    
    
if N-cnt>roop:
    ans=Sum_1+Sum_2*((N-cnt)//roop)+Sum_3
elif N<=cnt:
    ans=0
    A_i=X
    for i in range(N):
        ans+=A_i
        A_i=F[A_i]

else:
    ans=Sum_1
    A_i=st
    for i in range(N-cnt):
        ans+=A_i
        A_i=F[A_i]

print(ans)

Measured memory_bytes: 74872
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
#define TIME ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
    const ll N = 1e5 + 7;
    const ll mod = 1e9 + 7;

int main(){
    TIME
    set < int > st;
    int a , b , c;
    cin >> a >> b >> c;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    if(st.size() == 2){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}
///...


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

typedef long long ll ; 
typedef unsigned long long ull ; 
typedef vector<int> vi ; 
typedef vector<vi> vii ;
typedef vector<ll> vl ;
typedef vector<vl> vll ;
typedef set<int> si ; 
typedef map<int,int> mii ; 
typedef map<ll,ll>  mll ; 
typedef map<string,int> msi ;
typedef set<ll> sl ; 
typedef set<char> sc ; 
typedef pair<int,int> pii ;


#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
const int INF = 1 << 29 ; 
#define MOD (ll)(1e9+7)
#define eps 1e-6
#define pb push_back 
#define mp make_pair 
#define DEBUG(x)		cout << '>' << #x << ':' << x << endl;
#define F first 
#define S second 
#define all(s) s.begin,s.end() 

int main() 
{
	ios::sync_with_stdio(0) ;
	cin.tie(NULL) ; 
	int n ;
	cin >> n;
	long long a[n][3];
	REP(i,n) REP(j,3) cin >> a[i][j];
	long long dp[n][3];
	REP(i,n) REP(j,3) dp[i][j] = 0;
	REP(i,3) dp[0][i] = a[0][i];
	for(int i = 1; i < n; ++i) {
		REP(j,3) {
			REP(k,3) {
				if(k != j) {
					dp[i][k] = max(dp[i][k] , dp[i-1][j] + a[i][k]);
				}
			}
		}
	}
	long long ans = 0;
	REP(i,3) ans = max(ans , dp[n-1][i]);
	cout << ans << endl;
	return 0 ; 
}



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

int main() {
    int64_t n, a;
    cin >> n;
    a = 1;
    bool flg = false;
    int64_t upper = 1000000000000000000;
    for (int i =0; i < n; i++) {
        int64_t tmp;
        cin >> tmp;
        if (tmp == 0){
            a = 0;
            break;
        }else if (a > (upper / tmp)) {
            flg = true;
        }
        a *= tmp;
        if (a > upper) {
            flg = true;
        }
    }

    if (a == 0) {
        cout << a << endl;
    }else if (flg) {
        cout << -1 << endl;
    }else if (a < 0) {
        cout << -1 << endl;
    }else{
        cout << a << endl;
    }
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int main() {
  int A, B, K; cin >> A >> B >> K;
  set<int> S;
  REP(i, K) {
    S.insert(A + i);
    S.insert(B - i);
  }
  for (auto it = S.begin(); it != S.end(); ++it) {
    int x = *it;
    if (A <= x && x <= B) cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int a, b, c, s, Area;
  scanf("%d%d%d",&a,&b,&c);
  s = (a+b+c)/2;
  Area = sqrt(s*(s-a)*(s-b)*(s-c));
  printf("%d",Area);

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<set>

using namespace std;

#define fi(a,b) for(int i=a;i<b;++i)
typedef long long ll;
////////////////////

int const N = 1e5 + 41;

int n, l[N], r[N];
multiset<ll> t0, t1;
ll ans, add0, add1;

ll getmin(multiset<ll> &t){
	multiset<ll> :: iterator it = t.begin();
	return (*it);
}

ll extractmin(multiset<ll> &t){
	multiset<ll> :: iterator it = t.begin();
	ll res = (*it);
	t.erase(it);
	return res;
}

ll getmax(multiset<ll> &t){
	auto it = t.end();
	--it;
	return (*it);
}

ll extractmax(multiset<ll> &t){
	auto it = t.end();
	--it;
	ll res = (*it);
	t.erase(it);
	return res;
}

void solve(){
	t0.insert(l[0]);
	t1.insert(l[0]);
	fi(1, n){
		add0 += -(r[i] - l[i]);
		add1 += (r[i-1] - l[i-1]);
		ll x0 = add0 + getmax(t0);
		ll x1 = add1 + getmin(t1);
		if(x0 <= l[i] && l[i] <= x1){
			t0.insert(l[i] - add0);
			t1.insert(l[i] - add1);
		}else{
			if(l[i] < x0){
				ans += x0 - l[i];
				extractmax(t0);
				t0.insert(l[i] - add0);
				t0.insert(l[i] - add0);
				t1.insert(x0 - add1);
			}else{
				ans += l[i] - x1;
				extractmin(t1);
				t1.insert(l[i] - add1);
				t1.insert(l[i] - add1);
				t0.insert(x1 - add0);
			}
		}
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d",&n);
	fi(0, n) scanf("%d %d",&l[i],&r[i]);

	solve();

	printf("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 10368
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: usize = std::usize::MAX / 4;

fn main() {
    input! {
        N: usize,
        K: u64,
        mut A: [Usize1; N],
    }

    let mut now = 0;

    for d in 0..64 {
        if ((1 << d) & K) != 0 {
            now = A[now];
        }
        A = A.iter().map(|a| A[*a]).collect();
    }

    println!("{}", now + 1);
}


Measured memory_bytes: 6564
#include<iostream>
using namespace std;
 
int main(){
  unsigned long long h , w, count;
  cin >> h >> w;
  if(h == 1 || w == 1){
    count = 1;
  }else{
    count = (h * w) % 2 == 0 ? h * w / 2 : h * w / 2 + 1;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int gcd(int a,int b,int c){
  int i;
  if(b>a){
    i=b;
    b=a;
    a=i;
  }
  while(a%b!=0){
    i=a%b;
    a=b;
    b=i;
  }
  if(c>b){
    i=c;
    c=b;
    b=i;
  }
  while(b%c!=0){
    i=b%c;
    b=c;
    c=i;
  }
  return c;
}

int main(){
  int n,i,j,k,count=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      for(k=1;k<=n;k++)
        count+=gcd(i,j,k);
  printf("%d\n",count);
  return 0;
}


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

int main(){
  constexpr char sheep= 'S';
  constexpr char wolf = 'W';
  const vector<pair<char, char>> search= {make_pair(sheep, sheep)
                                         ,make_pair(sheep, wolf )
                                         ,make_pair(wolf , sheep)
                                         ,make_pair(wolf , wolf ) };
  int N;
  string S;
  cin >> N >> S;

  auto guess= [&](string cand, int pivot){
    int opponent= (pivot==0) ? 1
                             : pivot- 1;
    char flip= cand.at(opponent) ^ sheep ^ wolf;
    char ret= (cand.at(pivot)==sheep) ? (S.at(pivot)=='o') ? cand.at(opponent)
                                                           : flip
                                      : (S.at(pivot)=='o') ? flip
                                                           : cand.at(opponent);
    return ret;
  };

  string ans= "-1";
  for(auto [a0,a1]:search){
    string cand= string(N, 'X');
    cand.at(0)= a0;
    cand.at(1)= a1;
    char guess_back= guess(cand, 0);
    for(int pivot=1; pivot+1 < N; pivot++){
      cand.at(pivot+1)= guess(cand, pivot);
    }
    char guess_head= guess(cand, N-1);

    if(guess_back==cand.back() && guess_head==cand.at(0)){
      ans= cand;
      break;
    }
  }

  cout << ans << endl;
}

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

using namespace std;

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

	int n, m;
	cin >> n >> m;
	int first = 1;
	int last = n;
	for (int i = 0; i < m; i++) {
		int l, r;
		cin >> l >> r;
		if (first < l)first = l;
		if (last > r) last = r;
	}
	int ans = max(last - first + 1, 0);
	cout << ans << endl;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
s = Counter([input() for _ in range(n)])
m = int(input())
t = Counter([input() for _ in range(m)])

ans = 0
for x,y in s.items():
  a = y
  if x in t:
    a -= t[x]
  if ans < a: ans = a
print(ans)

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

using namespace std;

#define ll long long
#define mod 1000000007
  
bool ok(int a,int b,int c){
	if(a+b>c && b+c>a && a+c>b)return true;
	return false;
}

void solve(){
	int n;
	cin>>n;
	int cnt = 0;
	int arr[n];
	for(int i = 0;i<n;i++)cin>>arr[i];
	sort(arr,arr+n);
	for(int i = 0;i<n;i++){
		for(int j = i+1;j<n;j++){
			for(int k = j+1;k<n;k++){
				if(arr[i] != arr[j] && arr[j] != arr[k] && arr[i] != arr[k]){
					if(ok(arr[i],arr[j],arr[k]))cnt++;
				}
			}
		}
	}
	cout<<cnt<<endl;
}

int main(){
	int t = 1;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int  N;
  cin >> N;
  vector<int> v(N);
  vector<int> vec;
  for (int i=0;i<N;i++)
    cin >> v.at(i);
  int a,b;
  b=-1;
  while (b != 0){
    a=0;
    for (int i=0;i<N;i++){
      if (v.at(i) > a)
        a=v.at(i);
    }
    for (int i=0;i<N;i++){
      if (v.at(i)==a)
        v.at(i)=0;
    }
    vec.push_back(a);
    b=0;
    for (int i=0;i<N;i++)
      b+=v.at(i);
  }
  cout << vec.size() << endl;
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,x,s;
bitset<2000007>f;
int main()
{
	cin>>n;
	f[0]=1;
	for(register int i=1;i<=n;i++)
	{
		cin>>x;
		f|=f<<x;
		s+=x;
	}
	for(register int i=(s+1)/2;i<=s;i++)
		if(f[i]) 
		{
			cout<<i<<endl;
			break;
		}
	return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int a, b, c; cin >> a >> b >> c;
    if(a+b+c <= 21) cout << "win" << endl;
    else cout << "bust" << endl;
    return 0;
}

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

using namespace std;

#define ll long long
#define ld long double
#define ff first
#define ss second
#define rsz resize
#define ins insert 
#define mp make_pair
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define ft front() 
#define bk back()
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define deb(x) cout<<#x<<" "<<x<<'\n';
#define rep(i,a,b) for (int i = (a); i < (b); ++i)

const ll mod = 1e9+7; // 998244353;
const ll inf = 1e18; 
const ld pie = acos((ld)-1);

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};



int main(){
    	
	ll n;
	scanf("%lld\n",&n);
	vector<ll> a(n);
	for(ll i=0;i<n;++i){
		scanf("%lld",&a[i]);
	}

	ll ans = INT_MAX;
	for(ll i=-100;i<=100;++i){
		ll sum=0;
		for(ll j=0;j<n;++j){
			sum+= (a[j]-i)*(a[j]-i);
		}
		ans=min(ans,sum);	
	}

	ans==INT_MAX?printf("0\n"):printf("%lld\n",ans);


	return 0;

	/*STUFF TO LOOK:	
		1. Check the constraints
		2. Corner cases(n==0||n==1)
		3. Variables in loops
		4. Make sure two ints aren’t multiplied to get a long long
		5. Don't use scanf or printf while using ios_base
		6. using the local variable of the same name when global variable was required to be used
	*/
}


Measured memory_bytes: 3764
official_house =  [[[ 0 for r in range(10) ] for f in range(3) ]for b in range(4)]
num = int(input())
for i in range(num):
    notice = list(map(int, input().split()))
    b = notice[0]-1
    f = notice[1]-1
    r = notice[2]-1
    official_house[b][f][r] += notice[3]
for b in range(4):
    if b:
        print('#' * 20)
    for f in range(3):
        for r in range(10):
            print('', official_house[b][f][r], end ='')
        print()


Measured memory_bytes: 5632
program ABC_093_C_SameIntegers
   implicit none
   integer am, m, i,countN, a(1: 3)
   read(*, *) a(1: 3)
   do i = 1, 2
      am = maxval(a(i+1:3))
	  m  = maxloc(a(i+1:3), 1) + i
	  if (a(i) < am) then
	      a(m) = a(i)
		  a(i) = am
	  end if
   end do
   countN = 0
   if(a(1) == a(2)) then
       if(mod(a(1)-a(3),2) == 0) then
           countN = (a(1) - a(3)) / 2
           write(*, *) countN
	   else
           countN = (a(1) - a(3)) / 2 + 1 + 1
           write(*, *) countN
	   end if
   else
       if(mod(a(1)-a(3),2) == 0) then
           countN = (a(1) - a(3)) / 2
	       a(3) = a(3) + 2 * (a(1) - a(3)) / 2
       else
           countN = (a(1) - a(3)) / 2 + 1
	       a(3) = a(3) + 2 * (a(1) - a(3)) / 2 + 1
	       a(2) = a(2) + 1
       end if
       if(a(1) == a(2)) then
           write(*, *) countN
       else if(mod(a(1)-a(2),2) == 0) then
           countN = countN + (a(1) - a(2)) / 2
	       write(*, *) countN
       else
           countN = countN + (a(1) - a(2)) / 2 + 1 + 1
	       write(*, *) countN
       end if 
   end if
end program ABC_093_C_SameIntegers

Measured memory_bytes: 768
#include <iostream>

using namespace std;

typedef long long ll;

const ll mod = 1000000007;

ll c[2020][2020];

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

    for (int i = 0; i <= 2000; i++) {
        c[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            c[i][j] = (c[i-1][j-1] + c[i-1][j]) % mod;
        }
    }

    for (int i = 1; i <= k; i++) cout << (c[n-k+1][i] * c[k-1][i-1] % mod) << endl;
}

Measured memory_bytes: 30336
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

struct custom_tf : std::numpunct<char> {
  std::string do_truename() const { return "Yes"; }
  std::string do_falsename() const { return "No"; }
};

struct Initializer {
  Initializer() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(0);
    std::cout << std::fixed << std::setprecision(15) << std::boolalpha;
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_tf));
  }
} initializer;

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { std::cout<<'\n'; }
template<class T> inline void print(const T &x) { std::cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { std::cout<<x<<", "; print(y...); }
#define dump(...) std::cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);std::cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  int n, m;
  long long ans = 0;
  priority_queue<int> q;
  cin>>n>>m;
  rep(i, n) {
    int t;
    cin>>t;
    q.push(t);
  }
  while (m>0) {
    int t = q.top();
    q.pop();
    q.push(t/2);
    --m;
  }
  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 1e6 + 69;

ll n,y,m;

string s,t,u;
ll ans = 0;

int main(){

    cin>>s>>m;
    n = s.size();
    if(m==1){
        ans += (n-1) * 9;
        ans += (s[0]-'0');
        cout<<ans<<endl;
    } else
    if(m==2){

        ans += (n-1)*(n-2)/2 * 81;

        ans += (n-1) * 9 * (s[0]-'0'-1);
        int x = 1;
        while(s[x]=='0' && x<n){
            x++;
        }
        n -= x;
        if(n<=0){
            cout<<ans<<endl;
            return 0;
        }

        ans += (n-1) * 9;
        ans += (s[x]-'0');

        cout<<ans<<endl;
    } else {

        ans += (n-1)*(n-2)*(n-3)/6 * 9 * 9 * 9;

        ans += (s[0]-'0'-1) * (n-1)*(n-2) / 2 * 81;

        int x = 1;
        while(s[x]=='0' && x<n){
            x++;
        }
        m = n;
        n -= x;
        if(n<=0){
            cout<<ans<<endl;
            return 0;
        }

        ans += (n-1)*(n-2)/2 * 81;

        ans += (n-1) * 9 * (s[x]-'0'-1);
        x++;
        while(s[x]=='0' && x<m){
            x++;
        }
        n = m - x;
        if(n<=0){
            cout<<ans<<endl;
            return 0;
        }

        ans += (n-1) * 9;
        ans += (s[x]-'0');

        cout<<ans<<endl;
    }
}


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

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


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

    // N と N-1 の約数について調べる
    int ans = (N == 2)? 1: 2;  // K = N, N-1 の分

    // N について
    // N の約数は小さい方だけ考えれば良い N = x*y (x < y) のとき、N/y = x < y だから
    for(long long i = 2; i*i <= N; ++i){
        long long tmp = N;
        if(tmp%i == 0){
            while(tmp%i == 0) tmp /= i;
            if(tmp%i == 1) ++ans;
        }
    }

    // N-1 について
    // N-1 の約数は全部OK
    for(long long i = 2; i*i<= N-1; ++i){
        if((N-1)%i == 0){
            ++ans;  // 約数のうち小さい方
            if(i*i != N-1) ++ans;  // 約数のうち大きい方
        } 
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
s=input()
K=int(input())
List=[]
Length=len(s)
for i in range(Length):
    List.append(s[i])
    n=1
    while n<=4:
        if i+n>=Length:
            break
        else:
            List.append(s[i:i+n+1])
            n+=1
List_unique=list(set(List))    
List_unique.sort()
print(List_unique[K-1])

Measured memory_bytes: 5068
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>

using namespace std;

bool getnum(int n) {
    int digit[5];
    bool flag = false;
    for (int i = 4; i >= 0; i--) {
        digit[i] = n % 10;
        n /= 10;
    }
    if ((digit[0] == digit[4]) && (digit[1] == digit[3])) {
        flag = true;
    } else {
        flag = false;
    }

    return flag;
}

int main() {
    int A, B;
    int count = 0;
    cin >> A >> B;

    for(int i = A; i <= B; i++) {
        if(getnum(i)) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int counter = 0;
        for(int i = x; i <= y; i++){
            if(z % i == 0){
                counter++;
            }
        }
        System.out.println(counter);
    }
}



Measured memory_bytes: 26376
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

vector<int> G(200001);

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll n, k; cin >> n >> k;
	forl(i, 0, n) {
		int a; cin >> a; a--;
		G[i] = a;
	}
	map<int, int> vst;
	int cnt = 0;
	int cur = 0;
	while(!vst.count(cur)) {
		vst[cur] = cnt;
		cnt++;
		cur = G[cur];
		if(cnt == k) { println(++cur); return 0; }
	}
	k -= cnt;
	int diff = cnt - vst[cur];
	k %= diff;
	while(k--) {
		cur = G[cur];
	}
	println(++cur);
}


Measured memory_bytes: 11508
#include <stdio.h>

int main(void)
{
    int A, B;
    scanf("%d%d", &A, &B);

    if (A == 1) A += 13;
    if (B == 1) B += 13;

    if (A > B) {
        printf("Alice\n");
    } else if (B > A) {
        printf("Bob\n");
    } else {
        printf("Draw\n");
    }

    return 0;
}

Measured memory_bytes: 128
import sys
A,B,K=(int(i) for i in input().split())

A_list=list()
B_list=list()
C_list=list()

for i in range(A+1):
    if i==0:
        continue
    if A%i==0:
        A_list.append(i)

for x in range(B+1):
    if x==0:
        continue
    if B%x==0:
        B_list.append(x)

for y in A_list:
    for z in B_list:
        if y==z:
            C_list.append(y)



print(C_list[-K])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	long long a[100005], sum=0, d, diff, x;
	bool flag = 1;
	scanf("%d", &n);
	if(n%2 == 0) d = n/2LL * (n+1LL);
	else d = (n+1LL)/2LL * n;
	for(int i=0; i<n; i++) {
		scanf("%lld", &a[i]);
		sum += a[i];
	}
	if(sum%d != 0) printf("NO\n");
	else {
		x = sum/d;
		for(int i=0; i<n; i++) {
			diff = a[(i+1)%n] - a[i];
			if(diff > x || (x-diff)%n > 0) {
				flag = 0;
				break;
			}
		}
		if(!flag) printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 1024
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  al:string = 'abcdefghijklmnopqrstuvwxyz';
  tf,tfl,tfr:Boolean;
begin
  try
    { TODO -oUser -cConsole メイン : ここにコードを記述してください }
    Readln(n);
    count:=0;
    max  :=0;

    if n mod 2 = 0 then
      Writeln(n)
    else
      Writeln(n*2);

    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
#include <stdio.h>

int main(int argc, char argv[]){
    int input1 = 0;
    int cake = 0;
    int donut = 0;

    scanf("%d%d%d", &input1, &cake, &donut);

    int input4 = 0;

    input4 = input1 - cake;

    int input5 = 0;

    input5 = input4 % donut;

    printf("%d\n", input5);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define N 1000010
using namespace std;
    
char s1[N],s2[N];
int n,dd[N],p[N],cnt;

int main()
{
	//freopen("game.in","r",stdin);
	//freopen("game.out","w",stdout);
    scanf("%d%s%s",&n,s1+1,s2+1);
    if(strcmp(s1+1,s2+1)==0) {printf("0\n"); return 0;}
    for(int i=n,j=n,po=n;i;i=j-1,j=i)
	{
        while(s2[j-1]==s2[i]) j--;
		po=min(po,j);
		while(po&&s1[po]!=s2[i]) po--;
		if (!po){ printf("-1\n");return 0;}
		dd[po]=i;
	}
	int ans=0,las=0;
	for(int i=n;i>=1;i--) if(dd[i])
	{
	    for(las++,p[++cnt]=i;las;las--)
		{
	    	int t=cnt-las+1,tt;
	    	if(t<=0) tt=n-las+1;
			else tt=p[t]-las+1;
	    	if(tt<dd[i]) break;
		}
		ans=max(ans,las);
	}
	cout << ans << endl; return 0;
}

Measured memory_bytes: 9984
A, B, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = [input().split() for i in range(m)]
ans = min(a) + min(b)

for i in range(m):
    ai = a[int(l[i][0]) - 1]
    bi = b[int(l[i][1]) - 1]
    ci = int(l[i][2])
    nc = ai + bi - ci
    ans = min(ans, nc)
print(ans)
    

Measured memory_bytes: 45740
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  ll n;
  ll sum=0;
  cin>>n;
  sum=n*(n-1)/2;
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int A, B, C,i,j,k,flag,X;
	flag = 0;
	cin >> A >> B >> C >> X;
	for (i = 0;i <= A;i++) {
		for (j = 0;j <= B;j++) {
			for (k = 0;k <= C;k++) {
				if (500*i + 100*j + 50*k == X) {
					flag++;
				}
			}
		}
    }
	cout << flag << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

#define pi 3.14159265359

double a, b, m, h;

double sq (double x) {
    return x * x;
}


int main () {
    cin >> a >> b >> h >> m;

    double ang1 = (h) * 30.0;
    double ang2 = (m) * 6.0;

    ang1 += (m / 60.0) * (30.0);


    if (ang1 < ang2) swap(ang1, ang2);
    double dif = ang1 - ang2;

   // cout << dif << endl;

    dif *= (pi);
    dif /= 180.0;



    printf("%.15f\n", sqrt(sq(a) + sq(b) - 2 * a * b * cos(dif)));
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 4216
#include<stdio.h>
using namespace std;

int main(){
    long n,ai;
    scanf("%d",&n);
    long a[n], b[n];


    for(long i=0; i<n; i++){
        scanf("%d",&ai);
        a[i] = ai;
    }


    if( n%2==1 ){
        for(long i=n-1; i>=0; i=i-2){
            if( i!=n-1 ) printf(" ");
            printf("%d", a[i]);
        }
        for(long i=1; i<=n-2; i=i+2){
            printf(" ");
            printf("%d", a[i]);
        }
        printf("\n");
    }else{
        for(long i=n-1; i>=1; i=i-2){
            if( i!=n-1 ) printf(" ");
            printf("%d", a[i]);
        }
        for(long i=0; i<=n-2; i=i+2){
            printf(" ");
            printf("%d", a[i]);
        }
        printf("\n");        
    }


    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//


int main() {
    init();
    ll K, X, Y, tX, tY;
    cin >> K >> tX >> tY;
    X = abs(tX), Y = abs(tY);
    bool revX = (X != tX), revY = (Y != tY); //符号がひっくり返ったか
    bool swapped=false;
    if(X<Y){
        swap(X, Y);
        swapped = true; //X,Yがひっくり返ったか
    }
    // 以下X>Y>=0で考える

    if(K%2==0&&(X+Y)%2){ //構築不可
        cout << -1 << endl;
        return 0;
    }

    vc<pair<ll, ll>> ans;
    ll x = 0, y = 0;
    ll r = (X + Y) % K;
    if(r==0){ //直接構築
        while((x!=X)||(y!=Y)){
            ll rest = K;
            if(x!=X){
                ll dx = min(X - x, rest);
                x += dx;
                rest -= dx;
            }
            if(y!=Y&&rest!=0){
                y += rest;
            }
            ans.eb(x, y);
        }
    }
    else if((X+Y)<K&&r%2){
        x = X, y = -(K - X);
        ans.eb(x, y);
        x += (K + X - Y) / 2, y += (K - X + Y) / 2;
        ans.eb(x, y);
        x -= (K + X - Y) / 2, y += (K - X + Y) / 2;
        ans.eb(x, y);
    }
    else{
        ll rest=0, ly, n=(X+Y+K-1)/K+(K-r)%2;
        if (X + Y < K) 
            ly = (2*K-X-Y)/2;
        else
            ly = (n*K-X-Y)/2;
        x = K - ly, y = -ly;
        ans.eb(x, y);
        while(x!=X){
            rest = K;
            ll dx = min(X - x, rest);
            x += dx;
            rest -= dx;
            if (rest == 0) ans.eb(x, y);
        }
        if(rest!=0){
            y += rest;
            ans.eb(x, y);
        }
        while(y!=Y){
            rest = K;
            ll dy = min(Y - y, rest);
            y+=dy;
            ans.eb(x, y);
        }
    }

    ll N = ans.size();
    if (swapped) rep(i, N) swap(ans[i].first, ans[i].second);
    rep(i, N){
        if(revX)ans[i].first *= -1;
        if(revY)ans[i].second *= -1;
    }

    cout << N << endl;
    rep(i,N){
        cout << ans[i].first << " " << ans[i].second << "\n";
    }
}

Measured memory_bytes: 5484
#include <iostream>
using namespace std;
int main() {
	int time[100] = { 0 };

	int A, B, C, D;
	int cnt=0;

	cin >> A >> B >> C >> D;

	for (int i = A; i < B; i++)
	{
		time[i] = 1;
	}
	for (int i = C; i < D; i++)
	{
		if (time[i] != 0)
			cnt++;
	}

	cout << cnt << endl;

	return 0;
}

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

int fun(int cur,vector<long long int> &dp,vector<long long int> &h,int k){
	if(dp[cur]!=-1) return dp[cur];
	long long int ans=1e10;
	for(int i=max(0,cur-k);i<cur;i++){
		ans = min(ans,fun(i,dp,h,k) + abs(h[cur]-h[i]));
	}
	dp[cur]=ans;
	return dp[cur];
}
int main(){
	long long int n,x,k;
	cin>>n>>k;
	vector<long long int> h,dp(n,-1);
	for(int i=0;i<n;i++){
		cin>>x;
		h.push_back(x);
	}
	dp[0]=0;
	dp[1] = abs(h[1]-h[0]);
	cout<<fun(n-1,dp,h,k)<<endl;
}

Measured memory_bytes: 12608
#include <iostream>

using namespace std;

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}


int main()
{

    int cnt = 0;
    int loop, tmp;

    cin >> loop;

    for (int i = 0; i < loop; i++) {
        cin >> tmp;
        if (isPrime(tmp)) cnt++;
    }
    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 3116
import java.io.PrintWriter;
import java.util.*;

public class Main{


    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);

        char a=sc.next().charAt(0);
        if(a=='A')out.println('T');
        if(a=='T')out.println('A');
        if(a=='G')out.println('C');
        if(a=='C')out.println('G');

        out.close();
    }



}

Measured memory_bytes: 23636
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int a, b;
    cin >> a >> b;
    int h, w;
    h = w = 100;
    vector<string> ret(h, string(w, '.'));
    for (int i = 0; i < 100; i += 2) {
        for (int j = 0; j < 100 - 1; ++j) {
            ret[i][j] = '#';
        }
    }
    for (int i = 0; i < 100; ++i) {
        ret[i][0] = '#';
    }
    int xx = 2;
    int yy = 1;
    while (a != 1) {
        ret[yy][xx] = '#';
        a--;
        yy += 2;
        if (yy >= 100) {
            yy = 1;
            xx += 2;
        }
    }
    xx = 97;
    yy = 0;
    while (b != 1) {
        ret[yy][xx] = '.';
        b--;
        yy += 2;
        if (yy >= 100) {
            yy = 0;
            xx -= 2;
        }
    }
    cout << 100 << " " << 100 << endl;
    for (auto &s : ret) {
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
struct HUKU{
	int min;
	int max;
	int point;
};
HUKU huk[250];
int day[250];
int n,m;
int memo[250][120][120];

int check(int DAY,int point,int mae)
{
	if(memo[DAY][point][mae]!=-1)return memo[DAY][point][mae];
	int ans=0;
	for(int i=0;i<m&&DAY!=n-1;i++)
	{
		if(day[DAY+1]>=huk[i].min&&day[DAY+1]<=huk[i].max)
		ans=max(check(DAY+1,huk[i].point,point),ans);
	}
	
	return memo[DAY][point][mae]=ans+max(point,mae)-min(point,mae);
	
	
	
}





int main ()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>day[i];
	for(int i=0;i<m;i++)
		cin>>huk[i].min>>huk[i].max>>huk[i].point;
	memset(memo,-1,sizeof(memo));

	int ans=0;
	for(int i=0;i<m;i++){
		if(day[0]>=huk[i].min&&day[0]<=huk[i].max)
		ans=max(ans,check(0,huk[i].point,huk[i].point));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15252
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define dbg(x) cerr << #x << " = " << x << endl
#define endl "\n"
#define int long long int
#define double long double
#define pb push_back
#define mp make_pair
#define PI acos(-1)

//const int INF=1e9+5;//billion
int primes[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89};
string alpha = "abcdefghijklmnopqrstuvwxyz";
/*----------JU IS LOVE----------*/
//int power(int a,int b,int m){int ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
//int power(int a, int b){int ans=1;while(b){if(b&1)ans=ans*a;b/=2;a=a*a;}return ans;}


signed main() {
     
	crap;
 	
 	int r;
 	cin>>r;

 	cout<< r * r * 3 <<endl;

	return 0;
}






Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] A = new long[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = in.nextLong();
		}
		long ans = 0;
		for (int i = 0; i < N; i++) {
			ans = gcd(ans, A[i]);
		}
		System.out.println(ans);
		in.close();
	}

	static long gcd(long x, long y) {
		if (x < y) {
			long tmp = y;
			y = x;
			x = tmp;
		}
		if (y == 0) {
			return x;
		}
		return gcd(x % y, y);
	}
}

Measured memory_bytes: 50328
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int account=0;
        boolean[] accepted=new boolean[n];
        int[] wacount=new int[n];
        int tmpnum;
        boolean ac;
        for(int i=0;i<m;i++){
            tmpnum=sc.nextInt()-1;
            ac=sc.next().equals("AC");
            if(!ac){
                if(!accepted[tmpnum]){
                    wacount[tmpnum]++;
                }
            }else{
                if(!accepted[tmpnum])account++;
                accepted[tmpnum]=true;
            }
        }
        int sum=0;
        for(int i=0;i<n;i++){
            if(accepted[i])sum+=wacount[i];
        }
        System.out.println(account+" "+sum);
 
    }


}


Measured memory_bytes: 63384
def findn(m):
    n = 0
    if m % 4 in (1, 2):
        n += 1
    for i in range(1, len(bin(m)) - 2):
        bit = 2 ** i
        nextbit = 2 * bit
        if m % nextbit >= bit and (m % nextbit - bit) % 2 == 0:
            n += bit
    return n


A, B = map(int, input().split())
print(findn(A - 1) ^ findn(B))


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(void){
  int N,Y;
  cin >> N >> Y;
  bool flag=true;
  for(int i =0;flag==true && i<=N;i++){
    for(int j=0;flag ==true&&j<=N-i;j++){
      int k=N-i-j;
      if(Y==i*10000+j*5000+k*1000){
        cout << i << " " << j << " " << k <<endl;
        flag=false;
      }
    }
  }
  if(flag)cout<<"-1 -1 -1"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define w(x) int x; cin>>x; while(x--)
using namespace std;
bool sieve[100007];
void sieve_make() 
{
	memset(sieve,true,sizeof(sieve));
	sieve[0]=sieve[1]=false;
	for(int i=2;i*i<=100006;i++)
	{
		if(sieve[i])
		{
			for(int j=2*i;j<=100006;j+=i)
				sieve[j]=false;
		}
	}
}

int max(int a,int b)
{
	if(a>b)
		return a;
	return b;
}
int min(int a,int b)
{
	if(a<b)
		return a;
	return b;
}
int modexp(int a,int b,int c)
{
	if(a==0) return 0;
	if(b==0) return 1;

	int ans;
	if(b%2==0)
	{
		int small=modexp(a,b/2,c);
		ans=(small*small)%c;
	}
	else
	{
		int small=modexp(a,b-1,c);
		ans=(a%c);
		ans=(small*ans)%c;
	}
	return (ans+c)%c;
}

string rev(string s)
{
	reverse(s.begin(), s.end());
	return s;
}
bool sign(int x)
{
	if(x>0)
		return true;
	return false;
}

int base3(string b)
{
	int ans=0,c=0;
	for(int i=b.length()-1;i>=0;i--)
	{
		ans+=(b[i]-'0')*pow(3,c++);
	}
	return ans;
}


int32_t main()
{
	ios::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
	
	
	string s,t;
		cin>>s>>t;
		if(s+t.back()==t)
		cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
}

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

int main() {
  int n, d;
  cin >> n >> d;
  if ( n % (2*d + 1) == 0) cout << n / (2*d + 1) << endl;
  else cout << n / (2*d + 1) + 1 << endl;
}

Measured memory_bytes: 256