akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VL vector<LL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e18;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    /*
    int t,n;
    cin>>t;
    loop(t1,1,t+1)
    {
        int a[n];
        loop(i,0,n) cin>>a[i];
    }
    */

    LL a;
    string s;
    cin>>a>>s;
    LL b = 0, mul = 100;
    loop(i,0,4)
    {
        if(s[i] != '.') {b += ((s[i] - '0') * mul); mul/=10;}
    }

    LL ans = (a * b)/100;
    cout<<ans<<'\n';

    /*
    if(f) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    */

    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define rALL(x) x.rbegin(), x.rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<vector<char>> g;
int main(){
    string s;   cin >> s;
    vector<ll> key(26, 0);
    REP(i, s.size()){
        key[s[i]-'a'] += 1;
    }
    if(s.size()==26){
        set<char> st;
        st.insert(s.back());
        FORD(i, s.size()-1, 1){
            for(auto x: st){
                if(s[i-1]<x){
                    cout << s.substr(0, i-1) << x << endl;
                    return 0;
                }
            }
            st.insert(s[i-1]);
        }
    }else{
        cout << s;
        REP(i, 26){
            if(key[i]) continue;
            printf("%c\n", i+'a');
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long long n;
    cin >> n;
    long long ln = (int)(0.9 + sqrt((double)n));
    long long mindigi = 9223372036854775807;
    for (long long i = 1; i <= ln; ++i)
    {
        if (n%i == 0)
        {
            long long a = i;
            long long b = n/i;
            long long c = max(a, b);
            long long digi = 0;
            while (c != 0)
            {
                ++digi;
                c /= 10;
            }
            mindigi = min(mindigi, digi);
        }
    }
    cout << mindigi << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
	int k,a,b;
	scanf("%d",&k);
	scanf("%d%d",&a,&b);
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			printf("OK\n");
			return 0;
		}
	} 
	printf("NG\n");
	return 0;
} 

Measured memory_bytes: 1624
//08-03-2020

#include<bits/stdc++.h>
using namespace std;
#define MKM(i,a,b) for(int i=a;i<b;i++)
int main()
{
    int i,len,cnt=0;
    char s[11];
    cin>>s;
    len=strlen(s);
    //cout<<len<<"\n";
    for(i=0;i<len;i+=2)
        {
        if(s[i]=='h' && s[i+1]=='i')
            {
            cnt=0;

            }
            else
            {

                cnt=1;
                break;
            }

    }if(cnt==0)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;
	cin>>a>>b;
	int m=1,d=1;
	int count=0;
	for(int m=1;m<=a;m++){
		if (m==a&&d>b){
			break;
		}
		else if (m==d){
			count++;
		}
		d++;
	}
	cout<<count;
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+10;
int n,k,h[N];
ll ans;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)
	scanf("%d",&h[i]);
	sort(h+1,h+n+1);
	for(int i=1;i<=n-k;++i)
	ans+=h[i];
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x;
	cin >> x;
	int ans = 1;
	for(int b = 2; b <= x; ++b){
		for(int p = 2; pow(b,p) <= x; ++p){
			int cmp = pow(b, p);
			if(cmp > x) continue;
			chmax(ans, cmp);
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int n;
    int count[30];
    while(cin >> n, n){
        for(int i = 0;i < n;++i){
            count[i] = i < 3 ? 1 : 0;
        }
        for(int i = 0;i < n;++i){
            for(int j = 1;j < 4;++j){
                if(i + j >= n) break;
                count[i + j] += count[i];
            }
        }
        cout << count[n - 1] / 3650 + 1 << endl;
    }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll,ll>
#define mod 1000000007
#define pll pair<ll,ll>
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>0;i--)
#define prll(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" "; }
#define ain(a) for(auto &i:a) cin>>i
#define mms(a) memset(a,0,sizeof(a))
// cout << fixed << setprecision(0) << pi <<" "<<npi<<endl; 


ll max_ll(ll a,ll b,ll c){
	return max(a,max(b,c));
}

ll min_ll(ll a,ll b,ll c){
	return min(a,min(b,c));
}


bool sortBySec(pair<ll,ll> a,pair<ll,ll> b){
    if(a.second==b.second)
		return a.first<b.first;
    return (a.second < b.second); 
}

long long binexpmod(long long a, long long b){
    long long res =1;
    while(b>0){
        if(b&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        b>>=1;
    }
    return(res);
}


ll lcm(ll a,ll b){
	ll x=__gcd(a,b);
	a/=x;
	b/=x;
	ll sum=a*b*x;
	return sum;
}
void solve(){
    ll n,k,res=0;
	cin>>n>>k;
    vi a(n);
    ain(a);
    ll dp1[n];
    rep(i,n) dp1[i] = 1000000000;
    dp1[0]=0;
    for(ll i=1;i<n;i++){
        rep1(j,min(k,i)){
            dp1[i] = min(dp1[i],dp1[i-j]+abs(a[i]-a[i-j]));
        }
    }
	cout<<dp1[n-1]<<endl;
	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9; //INF should be large enough
int main() {
	int n,k;
	cin>>n>>k;
	vector < int > dp(n,INF),h(n);
	for(int i = 0; i < n ; i++) {
		cin>>h[i];	
	}
	dp[0] = 0;
	for(int i = 0 ; i < n ; i++) {
		for(int j = i+1 ; j <= i+k ; j++) {
			if(j<n) {
				dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
			}
		}
	}
	cout<<dp[n-1];
	
	return 0;
}
//Errichto's code


Measured memory_bytes: 1152
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int k=0,m,n,i=0,j=0,s=0,l,sum=0;
    long long arr[105][105],bb[105][1005],cc[105][105];
    cin>>n>>m>>l;

    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            cin>>arr[i][j];
        }
    }
    for(i=0; i<m; i++)
        for(j=0; j<l; j++)
            cin>>bb[i][j];

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            for (int k = 0; k < m; k++)
            {
                cc[i][j]+=arr[i][k]*bb[k][j];
            }


        }
    }
    for(i=0; i<n; i++)
    {
        for(j=0; j<l; j++)
        {
            if(j==l-1)
            cout<<cc[i][j];
            else
                cout<<cc[i][j]<<" ";
        }
        cout<<endl;


    }
}





Measured memory_bytes: 3744
#include <iostream>
using namespace std;
int main(){
  string s;cin>>s;
  int mn = 0;
  int mx = s.size()-1;
  int ans = 0;
  while(mn < mx){
    if(s[mn] == s[mx]){
      mn++;mx--;
    }else if(s[mn] == 'x'){
      mn++;
      ans++;
    }else if(s[mx] == 'x'){
      mx--;
      ans++;
    }else{
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
n=int(input())
v_seq=list(map(int,input().split()))
v_seq.sort()
while len(v_seq)>=2:
    cmp=(v_seq[0]+v_seq[1])/2
    v_seq[0]=cmp
    del v_seq[1]
    v_seq.sort()
print(v_seq[0])


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 100000002;

int main(){
	int r; cin >> r;
	double pi = 3.141592;
	cout << pi * r * 2 << endl;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int a,b,c;
  cin >>a >>b>>c;
  cout<< min(b/a,c)<<endl;


}


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

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define all(a) (a).begin(), (a).end()
typedef long long ll;

ll get(ll n, ll m) {
    if (n == m) return n;
    if (n > m) swap(n, m);
    // m-n*z <= n
    // m <= n * (z+1)
    // m / n <= z+1
    ll z = (m + n - 1) / n - 1;
    return 2LL * z * n + get(n, m - z * n);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, x;
    cin >> n >> x;
    cout << n + get(n - x, x);
    return 0;
}


Measured memory_bytes: 3576
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long[] A = new long[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextLong();
        }
        long ans = 1000;
        for (int i = 1; i < N; i++) {
            if (A[i-1] < A[i]) {
                long t = ans / A[i-1];
                ans += (A[i]-A[i-1]) * t;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,count=0;
	cin>>a>>b>>c;
	while(1)
	{
		int a1,b1,c1;
		if(a%2!=0||b%2!=0||c%2!=0||count>100000)break;
		a1=(b+c)/2;
		b1=(a+c)/2;
		c1=(a+b)/2;
		count++;
		a=a1;
		b=b1;
		c=c1;
		
	}
	if(count>=100000)
	cout<<"-1"<<endl;
	else
	cout<<count<<endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	long long int a,b;
	scanf("%lld%lld",&a,&b);
	long long int temp;
	if(a==1||b==1){
		printf("1");
		return 0;
	}
	if(b%2==0){
		temp=b/2;
		printf("%lld",a*temp);
	}
	else {
		temp=b/2+1;
		if(a%2==0){
			printf("%lld",a/2*(b/2+b/2+1));
		}
		else printf("%lld",a/2*(b/2+b/2+1)+temp);
	}
	return 0;
}

Measured memory_bytes: 128
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  d <- VM.new 4
  VM.set d (0::Int)

  replicateM_ n $ do
    (c:_) <- getLine
    let i | c == 'A' = 0
          | c == 'W' = 1
          | c == 'T' = 2
          | c == 'R' = 3
    t <- VM.read d i
    VM.write d i (t+1)

  let labels = ["AC", "WA", "TLE", "RE"]

  forM_ [0..3] $ \i -> do
    x <- VM.read d i
    putStr $ labels !! i
    putStr " x "
    print x


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

using namespace std;

typedef long long ll;

const int N = 200000 + 3;

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

  vector<int> a(n, 0);
  for(int i = 0; i < n; ++i) scanf("%d", &a[i]);

  //important:
  //a + b - a ^ b = 2 * (a & b)
  //if x = a[l] ^ a[l + 1] ^ ... ^ a[r]
  //then a[l + 1] ^ ... ^ a[r] = x ^ a[l]
  //monotonic increasing function -> 2 pointers

  int l = 0, r = 0;
  int calc = 0;
  ll ans = 0;
  while(l < n) {
    while(r < n && (calc ^ a[r]) == calc + a[r]) {
      calc = calc ^ a[r];
      ++r; ++ans;
    }
    calc = calc ^ a[l];
    ++l;
    ans += r - l;
  }

  printf("%lld\n", ans);
  return 0;
}


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

using ll = long long int;
using P = pair<ll, int>;

const ll INF = (ll)(1e18 + 5);
const int MAX_N = (int)(1e5 + 5);
const int MAX_M = (int)(1e5 + 5);

class edge {
public:
  int to;
  ll cost;
  edge (int to, ll cost) {this->to = to; this->cost = cost;}
};

int n, m, s, t;

vector<edge> aG[MAX_N];
vector<edge> bG[MAX_N];
ll stoindex[MAX_N];
ll ttoindex[MAX_N];
ll score[MAX_N];

ll ans[MAX_N];

void dijkstraA(int start) {
  priority_queue<P, vector<P>, greater<P>> que;

  fill(stoindex, stoindex + n + 3, INF);
  stoindex[start] = 0;
  que.push(P(0, start));

  while (!que.empty()) {
    P p = que.top(); que.pop();
    int v = p.second;

    if (stoindex[v] < p.first) continue;

    for (int i = 0; i < aG[v].size(); ++i) {
      edge e = aG[v][i];
      if (stoindex[e.to] > stoindex[v] + e.cost) {
        stoindex[e.to] = stoindex[v] + e.cost;
        que.push(P(stoindex[e.to], e.to));
      }
    }
  }
}

void dijkstraB(int start) {
  priority_queue<P, vector<P>, greater<P>> que;

  fill(ttoindex, ttoindex + n + 3, INF);
  ttoindex[start] = 0;
  que.push(P(0, start));

  while (!que.empty()) {
    P p = que.top(); que.pop();
    int v = p.second;

    if (ttoindex[v] < p.first) continue;

    for (int i = 0; i < bG[v].size(); ++i) {
      edge e = bG[v][i];
      if (ttoindex[e.to] > ttoindex[v] + e.cost) {
        ttoindex[e.to] = ttoindex[v] + e.cost;
        que.push(P(ttoindex[e.to], e.to));
      }
    }
  }
}

int main(void) {
  // Here your code !
  scanf("%d %d %d %d", &n, &m, &s, &t);

  for (int i = 1; i <= m; ++i) {
    int u, v;
    ll a, b;
    scanf("%d %d %lld %lld", &u, &v, &a, &b);
    aG[u].push_back(edge(v, a));
    aG[v].push_back(edge(u, a));
    bG[u].push_back(edge(v, b));
    bG[v].push_back(edge(u, b));
  }

  dijkstraA(s);
  dijkstraB(t);

  for (int i = 1; i <= n; ++i) {
    score[i] = stoindex[i] + ttoindex[i];
  }

  fill(ans, ans + n + 3, 1e15);

  ll tmp = INF;
  for (int i = n; i >= 1; --i) {
    tmp = min(tmp, score[i]);
    ans[i] -= tmp;
  }

  for (int i = 1; i <= n; ++i) {
    printf("%lld\n", ans[i]);
  }

	return 0;
}


Measured memory_bytes: 19908
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

h,w,K = na()
g = []
for i in range(h):
    g.append(ns())

ans = 0
for i in range(2**h):
    for j in range(2**w):
        a = 0
        for k in range(h):
            for l in range(w):
                if g[k][l] == '#' and ((i >> k) & 1) and ((j >> l) & 1):
                    a += 1
        if a == K:
            ans += 1

print(ans)

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

string W[45];
int Len[45];
int haiku[] = {5,7,5,7,7,0};
bool used[45];
int n;

/*
bool rec(int i, int cur, int nokori) {
    
    //printf("i:%d cur:%d nokori:%d\n", i, cur, nokori);
    if(cur >= 5) {
        // 結果を出力

        for(int i = 0; i < n; ++i) {
            if(used[i]) {
                cout << (i+1) << endl;
                break;
            }
        }

        return true;
    }

    // for(int j = i; i < n; ++j) にしていて無限にバグった。。
    for(int j = i; j < n; ++j) {
        if(Len[j] < nokori) {
            used[j] = true;
            bool flg = rec(j+1, cur, nokori - Len[j]);
            if(flg) return true;
            used[j] = false;
        } else if(Len[j] == nokori) {
            used[j] = true;
            bool flg = rec(j+1, cur+1, haiku[cur+1]);
            if(flg) return true;
            used[j] = false;
        }
    }
    return false;
}
*/

bool check(int f){
    int cur = 0, nokori = haiku[0];
    for(int i = f; i < n; ++i) {
        nokori -= Len[i];
        if(nokori < 0) return false;
        else if(nokori == 0) nokori = haiku[++cur];
        
        if(cur >= 5) return true;
    }
    return false;
}

bool solve()
{
    cin >> n;
    if(n == 0) return false;
    for(int i = 0; i < n; ++i) {
        cin >> W[i];
        Len[i] = W[i].size();
        used[i] = false;
    }
    //printf("n:%d\n", n);
    //rec(0, 0, haiku[0]);
    for(int i = 0; i < n; ++i) {
        if(check(i)) { cout << i + 1 << endl; break;}
    }

    return true;
}

int main()
{
    while(solve());
    return 0;
}


Measured memory_bytes: 3000
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    size_t N, K;

    scanf("%zu %zu", &N, &K);

    printf("%"PRIu64, N - K + 1);

    return 0;
}


Measured memory_bytes: 128
from collections import Counter
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

K = max(A)
table = [0]*(K+1)

table[0] = M
for b, v in Counter(B).items():
    for j in range(b, K+1, b):
        table[j] -= b*v
    for j in range(b+1, K+1, b):
        table[j] += b*v
table = list(accumulate(table))
table[0] = 0
table = list(accumulate(table))

print(sum(table[a] for a in A))


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

N,K = list(map(int,input().split()))
count = {}
for i in range(N):
    a,b= list(map(int,input().split()))
    if a in count:
        count[a] += b
    else:
        count[a] = b
ct = sorted(count.items())

for i in range(len(ct)):
    if ct[i][1] >= K:
        print(ct[i][0])
        exit()
    else:
        K -= ct[i][1]



Measured memory_bytes: 20072
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
int main(){
    int A[3][3];
    int N;
    int flag=0;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin>>A[i][j];
        }
        
    }
    cin>>N;
    
    int b[N];
    for (int i = 0; i < N; i++)
    {
        cin>>b[i];
    }
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < N; k++)
            {
                if (b[k]==A[i][j])  
                {
                    A[i][j]=1000;
                }
                
            }
            
        }
        
    }
    for (int i = 0; i < 3; i++)
    {
        if(A[i][0]+A[i][1]+A[i][2]==3000||A[0][i]+A[1][i]+A[2][i]==3000||
        A[0][0]+A[2][2]+A[1][1]==3000||A[0][2]+A[1][1]+A[2][0]==3000){
            cout<<"Yes";
            flag=1;
            break;
        }
        
    }
    if (flag==0 )
    {
        cout<<"No";
    }
    

    
 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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  int a,b;
  cin>>a>>b;
  if(b%a==0){
    cout<<a+b<<endl;
  }else{
    cout<<b-a<<endl;
  }


  return 0;
}

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

int main(int argc, char *argv[])
{
    int n, m;
    int A[100][100];
    int b[100];

    scanf("%d %d\n", &n, &m);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            scanf("%d", &A[i][j]);
        }
    }
    for (int i = 0; i < m; i++) {
        scanf("%d", &b[i]);
    }
    
    for (int i = 0; i < n; i++) {
        int ans = 0;
        for (int j = 0; j < m; j++) {
            ans += A[i][j] * b[j];
        }
        printf("%d\n", ans);
    }


    return 0;
}


Measured memory_bytes: 2100
A , B = map(int , input().split())

def aorb(A , B):
    if A == B:
        return "Draw"
    elif A == 1 or A > B and B != 1:
        return "Alice"
    else:
        return "Bob"

if __name__ == '__main__':
    ans = aorb(A , B)
    print(ans)

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll n;
	cin >> n;
	vector<ll> ans;

	ll num = 0;
	for(ll i = 1; i <= n; i++) {
		if (i * (i - 1) / 2 >= n - i) {
			ans.pb(i);
			num = i;
			break;
		}
	}

	ll tmp = n - num;
	for (ll i = num - 1; i >= 1; --i) {
		if (tmp >= i) {
			tmp -= i;
			ans.pb(i);
		}
	}

	rep(i, sz(ans)) {
		out(ans[i]);
	}

	return 0;
}

Measured memory_bytes: 384
program speedrun
implicit none
integer(16)::N,M
integer(16),allocatable,dimension(:)::a
integer(16)::D,T
logical::Check2
integer(16)::i
read*,N,M
allocate(a(N))
read*,A
D=0_16
do
    if(mod(a(1),2_16**(D+1_16))/=0_16)exit
    D=D+1_16
end do
Check2=.true.
do i=1,N
    if(mod(A(i),2**D)/=0.or.mod(A(I),2**(D+1_16))==0_16)Check2=.false.
end do
T=(A(1)/2)
do i=2_16,N
    T=T*(A(i)/2_16)/gcd(T,A(i)/2_16)
end do
print"(i0)",merge((M/T+1_16)/2_16,0_16,Check2)
contains
integer(16) recursive function gcd(l, b)result(res)
  integer(16), intent(in)::l, b
  res=merge(b, gcd(b, mod(l, b)),mod(l, b)==0_16)
end function
end program speedrun

Measured memory_bytes: 2432
h, w, d = map(int, input().split())
a = []
for _ in range(h):
    a.append(list(map(int, input().split())))
q = int(input())
querys = []
for _ in range(q):
    l, r = map(int, input().split())
    querys.append((l-1, r-1))
coor = [None]*(h*w)
for i in range(h):
    for j in range(w):
        coor[a[i][j]-1] = (i, j)
accu = [0]*(h*w)
for i in range(d, h*w):
    px, py = coor[i-d]
    x, y = coor[i]
    accu[i] = accu[i-d] + abs(x-px) + abs(y-py)
for l, r in querys:
    print(accu[r]-accu[l])

Measured memory_bytes: 36468
#include <bits/stdc++.h>
#define ll long long
inline int roundup(int a, int b) { return (((a + (b -1)) / b)); }
using namespace std;

signed main(void) {
    ll a[200000];
    ll n, count = 0;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if(i != 0) {
            if(a[i-1] > a[i]) {
                count += (a[i-1] - a[i]);
                a[i] += (a[i-1] - a[i]);
            }
        }
    }
    cout << count << endl;
    return 0;
}

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

using namespace std;

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

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

	if((a + b) & 1) cout << "IMPOSSIBLE";
	else cout << (a + b) / 2;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a%b);
}
int main()
{
    int a, b;
    cin >> a >> b;
    cout << (long long)a * b / gcd(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int sb(int x,int y)
{
	return x>y;
}
int main()
{
	int n,k,a[100010],i,sum=0;
	cin>>n>>k;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1,sb);
	for(i=1;i<=k;i++)
	{
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long ll;
#define pb push_back

const ll MOD = 1e9 + 7;

ll modexpo(ll a, ll b, ll mod)
{
    a %= mod;
    if (b == 0)
        return 1 % mod;
    if ((b & 1) == 1)
        return a * (modexpo(a, b - 1, mod)) % mod;
    else
    {
        ll u = modexpo(a, b >> 1, mod);
        return (u * u) % mod;
    }
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //your code starts here

    int n;
    cin >> n;

    if (n <= 2)
    {
        cout << 0;
        return 0;
    }
    else if (n > 2 && n <= 5)
    {
        cout << 1;
        return 0;
    }

    ll MOD = 1e9 + 7;

    ll dp[n + 1];

    dp[0] = dp[1] = dp[2] = 0LL;
    dp[3] = dp[4] = dp[5] = 1LL;

    for (int i = 6; i <= n; i++)
    {
        dp[i] = 1LL;
        for (int j = 3; j < i; j++)
            (dp[i] += dp[i - j] % MOD + MOD) % MOD;
    }
    cout << (dp[n] + MOD) % MOD;
    return 0;
}


Measured memory_bytes: 3640
class KMP():
    def __init__(self, pattern):
        self.pattern = pattern
        self.n = len(pattern)
        self.create_k_table()
    
    def create_k_table(self):
        ktable = [-1]*(self.n+1)
        j = -1
        for i in range(self.n):
            while j >= 0 and self.pattern[i] != self.pattern[j]:
                j = ktable[j]
            j += 1
            if i+1 < self.n and self.pattern[i+1] == self.pattern[j]:
                ktable[i+1] = ktable[j]
            else:
                ktable[i+1] = j
        self.ktable = ktable

    def match(self,s):
        n = len(s)
        j = 0
        ret = [0]*n
        for i in range(n):
            while j >= 0 and (j == self.n or s[i] != self.pattern[j]):
                j = self.ktable[j]
            j += 1
            if j == self.n:
                ret[(i-self.n+1)%n] = 1 
        return ret

def main():
    s = input()
    t = input()
    n = len(s)
    m = len(t)
    k = 1 - (-(m-1)//n)
    si = s*k
    a = KMP(t)
    b = a.match(si)
#    edges = [[] for i in range(n)]
#    for i in range(n):
#        if b[i]:
#            edges[i].append((i+m)%n)
#    
#    def dfs(node):
#        if visited[node] == 1:
#            return True
#        if visited[node] == 2:
#            return False
#        visited[node] = 1
#        for nei in edges[node]:
#            if dfs(nei):
#                return True
#        visited[node] = 2
#        res.append(node)
#        return False
#    visited = [-1] * n
#    res = []
#    for i in range(n):
#        if dfs(i):
#            return -1
#    dp = [0] * n
#    ans = 0
#    for i in range(n-1, -1, -1):
#        t = res[i]
#        for c in edges[t]:
#            dp[c] = max(dp[c], dp[t] + 1)
#            ans = max(ans, dp[c])
#    return ans

            
    visited = [0]*n
    loop = False
    ans = 0
    for i in range(n):
        if visited[i]:
            continue
        visited[i] = 1
        cur = i
        right = 0
        while b[cur]:
            nxt = (cur + m) % n
            if visited[nxt]:
                loop = True
                break
            visited[nxt] = 1
            cur = nxt
            right += 1
        cur = i
        left = 0
        while b[(cur-m)%n]:
            nxt = (cur-m) % n
            if visited[nxt]:
                loop = True
                break
            visited[nxt] = 1
            cur = nxt
            left += 1
        if not loop:
            ans = max(ans, right+left)
        else:
            ans = -1
            break
    return ans

if __name__ == "__main__":
    print(main())

Measured memory_bytes: 74184
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll R, G, B, N;

int main() {
  std::cin >> R >> G >> B >> N;

  ll ans = 0;

  rep( r, (N+R-1)/R+1 ) rep( g, (N+G-1)/G+1 ) {
    ll rest = N-r*R-g*G;

    if( rest >= 0 && rest % B == 0 ) {
      ++ans;
    }
  }

  std::cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
int solve(int n,int x){
	int ans =0;
	while(n){
		ans++;
		n/=x;
	}
	return ans;
}
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		
		int n;
		cin >> n;
		int x =0;
		fn{
			cin >> ar[i];
		}
		x = accumulate(ar,ar+n,0ll);
		int x2 = (x+n-1)/n;
		x/=n;
		int ans =0;
		fn{
			ans+=(x-ar[i])*(x-ar[i]);
		}
		int ans2=0;
		fn{
			ans2+=(x2-ar[i])*(x2-ar[i]);
		}
		cout << min(ans2,ans);
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 2304
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Math.*;

public class Main {
    BufferedReader rd;

    Main() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        int[] q = intarr();
        int n = q[0];
        int a = q[1];
        int b = q[2];
        out(min(b,n*a));
    }

    private int[] intarr() throws IOException {
        return intarr(rd.readLine());
    }

    private int[] intarr(String s) {
        String[] q = split(s);
        int n = q.length;
        int[] a = new int[n];
        for(int i=0;i<n;i++) {
            a[i] = Integer.parseInt(q[i]);
        }
        return a;
    }

    private String[] split(String s) {
        if(s == null) {
            return new String[0];
        }
        int n = s.length();
        int start = -1;
        int end = 0;
        int sp = 0;
        boolean lastWhitespace = true;
        for(int i=0;i<n;i++) {
            char c = s.charAt(i);
            if(isWhitespace(c)) {
                lastWhitespace = true;
            } else {
                if(lastWhitespace) {
                    sp++;
                }
                if(start == -1) {
                    start = i;
                }
                end = i;
                lastWhitespace = false;
            }
        }
        if(start == -1) {
            return new String[0];
        }
        String[] res = new String[sp];
        int last = start;
        int x = 0;
        lastWhitespace = true;
        for(int i=start;i<=end;i++) {
            char c = s.charAt(i);
            boolean w = isWhitespace(c);
            if(w && !lastWhitespace) {
                res[x++] = s.substring(last,i);
            } else if(!w && lastWhitespace) {
                last = i;
            }
            lastWhitespace = w;
        }
        res[x] = s.substring(last,end+1);
        return res;
    }

    private boolean isWhitespace(char c) {
        return c==' ' || c=='\t';
    }

    private static void out(Object x) {
        System.out.println(x);
    }

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


Measured memory_bytes: 21204
#include<iostream>
#include<iomanip>
#include<stdio.h>

using namespace std;

int main()
{
    int n,i,j,k;
    int b,f,r,v;
    cin >> n;
    int A[4][3][10] ={{{0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0}},
                      {{0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0}},
                      {{0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0}},
                      {{0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0},
                       {0,0,0,0,0,0,0,0,0,0}}};
    for(i = 0;i < n;i++){
        cin >> b >> f >> r >> v;
        A[b-1][f-1][r-1] += v;
    }
    for(i = 0;i < 4;i++){
        for( j = 0;j < 3;j++){
            for( k = 0;k < 10;k++){
                if(k || k - 9) cout << " ";
                cout << A[i][j][k];
            }
            cout << endl;
        }
        if(i-3) cout << "####################" << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

void InputSet(std::vector<int> & a) {
	int n;
	cin >> n;
	a.resize(n,0);
	for(int i=0;i<n;++i) {
		cin >> a.at(i);
		a.at(i)--;
	}
}
void BFS(vector<vector<int> > & Ad,
		 vector<int> & V,
		 queue<int> & Q
		 )
{
	while(!Q.empty()) {
		int u = Q.front();
		Q.pop();
		for(int i=0;i<(int)Ad[u].size();++i) {
			int next = Ad[u][i];
			if (V[next] < 0) {
				V[next] = V[u] + 1;
				Q.push(next);
			}
		}
	}
}
int main(){
	int n;
	cin >> n;
	vector<vector<int> > Ad(n);
	vector<int> V(n,-1);
	queue<int> Q;
	for(int k=0;k<n;++k) {
		int u;
		cin >> u;
		--u;
		InputSet(Ad[u]);
	}
	Q.push(0);
	V[0]=0;
	BFS(Ad,V,Q);

	for(int i=0;i<n;++i){
		cout << i + 1 << " " << V[i] << endl;
	}
}

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

const int A = 1e6 + 1;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> c(A);
  rep(i, n) {
    cin >> a.at(i);
    c.at(a.at(i))++;
  }

  bool pairwise = true;
  for (int i = 2; i < A; i++) {
    int cnt = 0;
    for (int j = i; j < A; j += i) {
      cnt += c.at(j);
    }
    if (cnt > 1) pairwise = false;
  }
  if (pairwise) {
    cout << "pairwise coprime" << endl;
    return 0;
  }

  int g = 0;
  rep(i, n) g = __gcd(g, a.at(i));
  if (g == 1) {
    cout << "setwise coprime" << endl;
    return 0;
  }

  cout << "not coprime" << endl;
  return 0;
}

Measured memory_bytes: 11180
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60
const mod int = 1e9 + 7

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := ri()

	h := make([]int, n)
	for i := 0; i < n; i++ {
		h[i] = ri()
	}

	prev := -1
	ok := true
	for _, now := range h {
		// fmt.Println(prev, now)
		if prev <= now {
			if now > prev {
				now--
			}
			prev = now
			continue
		} else {
			ok = false
			break
		}
	}

	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1408
import math
n,d=input().split()
n=int(n)
d=int(d)
def combinations(n, r):
    return math.factorial(n)/(math.factorial(n-r)*math.factorial(r))
x=[]
for i in range(n):
    xa=[int(s) for s in input().split()]
    x.append(xa)
    a=[]
for i in range(n-1):
    for j in range(i+1,n):
        t=[]
        for k in range(d):
            c=(x[i][k]-x[j][k])*(x[i][k]-x[j][k])
            t.append(c)
        if k==d-1:
            a.append(sum(t))
answer=list(map(lambda x:pow(x,1/2),a))
count=0
for l in range(len(answer)):
    if answer[l].is_integer()==True:
        count=count+1
print(count)

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

using namespace std;

template<typename T>
T gcd(T a,T b){
    if(b==0)return a;
    return gcd(b,a%b);
}

template<typename T>
T lcm(T a,T b){
    T d=gcd(a,b);
    return (a/d)*b;
}

long long mypow10(int n){
    long long ret=1;
    while(n>=1){
        --n;
        ret=ret*10;
    }
    return ret;
}

int main(){
    string s;
    cin>>s;
    long long a=0;
    long long b=0;
    long long c=0;
    int bbit=0;
    int cbit=0;
    bool rep=false;
    bool dot=false;
    for (int i = 0; i < s.size(); ++i) {
        if(s[i]=='.'){
            dot=true;
            continue;
        }
        if(!dot){
            a=a*10;
            a+=s[i]-'0';
        }
        else{
            if(s[i]=='('){
                ++i;
                rep=true;
                while(s[i]!=')'){
                    c=c*10;
                    c+=s[i]-'0';
                    ++i;
                    ++cbit;
                }
                break;
            }
            else{
                b=b*10;
                b+=s[i]-'0';
                ++bbit;
            }
        }
    }
    long long u,d;
    u=b;
    d=mypow10(bbit);

    long long comd;

    comd=gcd(u,d);
    u=u/comd;
    d=d/comd;

    if(rep){
        long long cu,cd;
        cu=c;
        cd=mypow10(bbit+cbit)-mypow10(bbit);

        comd=gcd(cu,cd);
        cu=cu/comd;cd=cd/comd;

        long long comm;
        comm=lcm(d,cd);

        u=u*(comm/d);
        u+=cu*(comm/cd);

        d=comm;

    }

    comd=gcd(u,d);
    u=u/comd;
    d=d/comd;

    u+=a*d;

    cout<<u<<"/"<<d<<endl;
    return 0;
}


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {

            var n = int.Parse(Console.ReadLine());
            var str = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var count = 0;
            var max = 0;

            for (var x = 0; x < n; ++x)
            {
                if(max <= str[x])
                {
                    max = str[x];
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
# -*- coding: utf-8 -*-
import heapq
import math
import sys

tmp = input()
H, W = [int(a) for a in tmp.split()]
is_evens = [a % 2 == 0 for a in [H, W]]
H2, W2 = [(a+1) // 2 for a in [H, W]]

chars = []
for i in range(H):
    tmp = input()
    chars = chars + [a for a in tmp]
char_counts = {}
for char in chars:
    if char not in char_counts:
        char_counts[char] = 0
    char_counts[char] += 1

valids = {'4': 0, '2': 0, '1': 0}
if is_evens[0] and is_evens[1]:
    valids['4'] = H2 * W2
elif is_evens[0] and not is_evens[1]:
    valids['4'] = (W2 - 1) * H2
    valids['2'] = H2
elif is_evens[1] and not is_evens[0]:
    valids['4'] = (H2 - 1) * W2
    valids['2'] = W2
else:
    valids['4'] = (H2 - 1) * (W2 - 1)
    valids['2'] = (H2 - 1) + (W2 - 1)
    valids['1'] = 1
nows = {'4': 0, '2': 0, '1': 0}
for c, num_ in char_counts.items():
    num = num_
    if num % 2 == 1:
        nows['1'] += 1
        num -= 1
        if nows['1'] > valids['1']:
            print('No')
            sys.exit()
    if num % 4 == 2:
        nows['2'] += 1
        num -= 2
        if nows['2'] > valids['2']:
            print('No')
            sys.exit()
    nows['4'] += (num // 4)
if nows['4'] > valids['4']:
    amari = nows['4'] - valids['4']
    nows['2'] += amari * 2
    if nows['2'] > valids['2']:
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 3556
#include <iostream>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std; 
typedef long long int ll;

int main(){
    /*input*/
    char x, y;	cin >> x >> y;
    /*calculation*/
    /*output*/
    if(x - y > 0){
	cout << ">" << endl;
    }else if(x == y){
	cout << "=" << endl;
    }else{
	cout << "<" << endl;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
char s[max_n];
int sta[max_n],tot;
int dp[max_n];
int dfs(int now,bool lim)
{
    if(!lim&&dp[now])return dp[now];
    if(now==0)return 1;
    int maxx=lim?sta[now]:1;
    int res=0;
    for(int i=0;i<=maxx;i++)
    {
        int x=i?2:1;
        res=Add(res,Mul(x,dfs(now-1,lim&&i==maxx)));
    }
    if(!lim)dp[now]=res;
    return res;
}
int solve()
{
    tot=strlen(s+1);
    for(int i=tot;i>=1;i--)sta[i]=s[tot+1-i]-'0';
    return dfs(tot,1);
}
int main()
{
    scanf(" %s",s+1);
    printf("%d\n",solve());
}


Measured memory_bytes: 5248