akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int c[100002][2];
void merge(int i,int j,int s[][2]){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d][0]=s[b][0];
        c[d][1]=s[b][1];
        b++;
      }
      else if(j<b){
        c[d][0]=s[a][0];
        c[d][1]=s[a][1];
        a++;
      }
      else if(s[a][1]<s[b][1]){
        c[d][0]=s[a][0];
        c[d][1]=s[a][1];
        a++;
      }
      else{
        c[d][0]=s[b][0];
        c[d][1]=s[b][1];
        b++;
      }
    }
    for(d=i;d<=j;d++){
      s[d][0]=c[d][0];
      s[d][1]=c[d][1];
    }
  }
}

int main(){
  int n,i;
  scanf("%d",&n);
  int a[n+2][2];
  for(i=1;i<=n;i++){
    a[i][0]=i;
    scanf("%d",&a[i][1]);
  }
  merge(1,n,a);
  for(i=1;i<=n;i++)
    printf("%d ",a[i][0]);
  return 0;
}


Measured memory_bytes: 2304
int main(void)

{

int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(H>=y+r&&W>=x+r&&x-r>=0&&y-r>=0){

printf("Yes\n");

}

else{

printf("No\n");

}

return 0;

}

Measured memory_bytes: 584
function main(arg) {
	arg = arg.trim().split(' ');
  	arg = arg.map(str => parseInt(str, 10));
	var bj = 21, result;
	result = arg[0] + arg[1] + arg[2];
  if (result <= bj) {
  	console.log('win');
  } else {
  	console.log('bust');
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
def factrize(x):
    f = {}
    if x == 1:
        return f
    tmp = x
    i = 2
    while i**2 <= tmp:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp = tmp//i
        if cnt > 0:
            f[i] = cnt
        i += 1
    if tmp != 1 or f == {}:
        f[tmp] = 1
    return f

from fractions import gcd
A, B= map(int, input().split())
G = gcd(A, B)
dict = factrize(G)
print(1+len(dict))

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int n;cin>>n;
    ll ans=0;
    for(int i=1;i<=n;++i){
        ans+=(ll)(n/i)*(n/i+1)/2*i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

ll myabs(ll a) {
	if (a < 0) return -a;
	else return a;
}

int main() {
	ll X, K, D;
	cin >> X >> K >> D;

	if (X < 0) X = -X;

	ll ans, N = X / D;
	if (K <= N) ans = X - K * D;
	else {
		if ((K - N) % 2 == 0) ans = X - N * D;
		else ans = - (X - (N + 1) * D);
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

int main() {
  int n;
  cin >> n;
  if (n <= 3) {
    cout << 0 << endl;
    return 0;
  }
  string s;
  cin >> s;
  vector<int> r;
  vector<int> g;
  vector<int> b;
  for (int i=0; i<n; i++) {
    if (s[i] == 'R') {
      r.push_back(i);
    } else if (s[i] == 'G') {
      g.push_back(i);
    } else {
      b.push_back(i);
    }
  }

  set< vector<int> > check;
  //  cout << r.size() << endl;
  //  cout << g.size() << endl;
  //  cout << b.size() << endl;
  //  cout << (int)r.size() * (int)b.size() * (int) g.size() << endl;
  ll sum = (ll)r.size() * (ll)b.size() * (ll)g.size();
  if (sum == 0) {
    cout << sum << endl;
    return 0;
  }
  for (int i=0; i<(int)r.size(); i++) {
    for (int j=0; j<(int)g.size(); j++) {
      int rg = r[i]+g[j];
      if (rg%2==1) { continue; }
      if (rg/2>b.back()) { break; }
      sum -= (int)(binary_search(b.begin(), b.end(), rg/2));
    }
  }

  for (int i=0; i<(int)r.size(); i++) {
    for (int j=0; j<(int)b.size(); j++) {
      int rb = r[i]+b[j];
      if (rb%2==1) { continue; }
      if (rb/2>g.back()) { break; }
      sum -= (int)(binary_search(g.begin(), g.end(), rb/2));
    }
  }
  for (int i=0; i<(int)g.size(); i++) {
    for (int j=0; j<(int)b.size(); j++) {
      int gb = g[i]+b[j];
      if (gb%2==1) { continue; }
      if (gb/2>r.back()) { break; }
      sum -= (int)(binary_search(r.begin(), r.end(), gb/2));
    }
  } 

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3636
h, w = map(int, input().split())
hw = []

first_end = ["#" for _ in range(w+2)]
hw.append(first_end)

for _ in range(h):
    one_line = list(input())
    one_line.insert(0, "#")
    one_line.append("#")
    hw.append(one_line)

hw.append(first_end)

for one_line in hw:
    print("".join(one_line))


Measured memory_bytes: 3060
n = input()
k = int(input())

dp = [[[0, 0] for j in range(4)] for i in range(len(n)+1)]
dp[0][0][0] = 1

for i in range(len(n)):
    if int(n[i]) == 0:
        dp[i+1][0][0] = dp[i][0][0]
        dp[i+1][1][0] = dp[i][1][0]
        dp[i+1][2][0] = dp[i][2][0]
        dp[i+1][3][0] = dp[i][3][0]

    else:
        dp[i+1][1][0] = dp[i][0][0]
        dp[i+1][2][0] = dp[i][1][0]
        dp[i+1][3][0] = dp[i][2][0]
        dp[i+1][0][1] = dp[i][0][0]
        dp[i+1][1][1] = dp[i][1][0]
        dp[i+1][2][1] = dp[i][2][0]
        dp[i+1][3][1] = dp[i][3][0]

    dp[i+1][0][1] += dp[i][0][1]
    dp[i+1][1][1] += dp[i][1][1] + dp[i][0][1]*9 + dp[i][0][0]*max(int(n[i])-1, 0)
    dp[i+1][2][1] += dp[i][2][1] + dp[i][1][1]*9 + dp[i][1][0]*max(int(n[i])-1, 0)
    dp[i+1][3][1] += dp[i][3][1] + dp[i][2][1]*9 + dp[i][2][0]*max(int(n[i])-1, 0)


print(sum(dp[len(n)][k]))


Measured memory_bytes: 38384
#include<stdio.h>
int main(){
  int A,B,p,k,w,h;
  scanf("%d %d",&A,&B);
  p = A+B;
  k= A*B;
  w=A-B;
  if(p > k)h=p;
  else h= k;
  if(h>w)h=h;
  else h=w;
  printf("%d",h);
}
  

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

int main(){
	char ch;
	stack<int> S;
	stack< pair<int,int> > S2;
	int sum=0;
	
	for(int i=0;cin >> ch;i++){
		if(ch == '\\'){
			S.push(i);
		}else if(ch == '/' && S.size() > 0){
		
			//?????¨??£???????????????pop???????????????????????´????????§????????????????????£?????????pop?????????????????????
			int S_top = S.top(); S.pop();
			int tmpArea = i - S_top;
			sum += tmpArea;
			
			//?????????????????????S2??¨first?????????????????????first????°????????????°??????????????????
			while( !S2.empty() && S2.top().first > S_top ){
					tmpArea += S2.top().second;
					S2.pop();
			}
			
			S2.push(make_pair(S_top,tmpArea));
		}
	}
	
	vector<int> ans;
	
	while( S2.size() > 0 ){
		ans.push_back(S2.top().second);
		S2.pop();
	}
	
	reverse( ans.begin(),ans.end() );
	
	cout<<sum<<endl;
	cout<<ans.size();
	
	for(int i=0; i < ans.size() ;i++){
		cout<<" ";
		cout<<ans[i];		
	}
	cout<<endl;
}

Measured memory_bytes: 1284
import java.util.Scanner;
class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();

        while(true) {
            String str = scan.nextLine();
            if (str.equals("-")) {
                break;
            }
            int a = scan.nextInt();
            for (int i = 0;i < a; i++) {
                int h = scan.nextInt();
                str = str.substring(h,str.length()) + str.substring(0, h);
            }
            System.out.println(str);
            str = scan.nextLine();
        }
    }
}

Measured memory_bytes: 26428
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>

using namespace std;

#define int long long
#define ll long long
#define double long double
#define pii pair<int, int>
#define vec vector
#define u_map unordered_map
#define u_set unordered_set
#define str string
#define all(el) el.begin(), el.end()
#define allr(el) el.rbegin(), el.rend()
#define sz(el) (int)el.size()
#define f first
#define s second
#define pb push_back
#define in insert
#define mp make_pair
#define endl "\n"
#define forn(i, n) for (int i = 0; i < n; ++i)

inline int maxi(int &a, int b) { if (b > a) { a = b; return 1; } return 0; }

inline int mini(int &a, int b) { if (b < a) { a = b; return 1; } return 0; }

inline int maxi(double &a, double b) { if (b > a) { a = b; return 1; } return 0; }

inline int mini(double &a, double b) { if (b < a) { a = b; return 1; } return 0; }

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    cin >> n;
    vec<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans ^= a[i];
    }
    for (int i = 0; i < n; i++) {
        cout << (ans ^ a[i]) << ' ';
    }

    return 0;
}

Measured memory_bytes: 4740
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }
template<typename T = i64>
void OUT(T& x) { cout << x << endl; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

#ifdef _DEBUG
signed Main()
#else
signed main()
#endif
{
	auto S = IN<string>();
	i64 ans = 1;
	string cur = S.substr(0, 1);
	i64 idx = 1;
	bool judge = true;
	i64 s_size = SIZE(S);
	while (idx < s_size)
	{

		if (cur != S.substr(idx, 1))
		{
			ans++;
			cur = S.substr(idx, 1);
			idx++;
		}
		else
		{
			if (idx + 1 >= s_size)
			{
				judge = false;
				break;
			}

			ans++;
			cur = S.substr(idx, 2);
			idx += 2;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 720
#include<iostream>

using namespace std;

int main()
{
        int a,b,k,l;
        cin >> a >> b >> k;

        if(a<b) l=a;
        else l=b;

        int youjo[100];
        int i,j=0;
        for(i=1; i<=l; i++){
                if(a%i==0 && b%i==0){
                        youjo[j]=i;
                        j++;
                }
        }



        cout << youjo[j-k] <<endl;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define ull         unsigned long long int
#define ll          long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> 
 
const long long INF = (long long) 1e12+1;
const long long mod = (long long) 20437;
const long long hell = (long long) 1000000007;

ll power(ll x,ll y,ll m){
  ll res=1;
  while(y>0){
    if(y%2) res=(x%m*res%m)%m;
    x=(x%m*x%m)%m;    
    y=y/2;
  }
  
  return res%m;
}
 
ll modinv(ll x){
  return power(x,hell-2,1);
}

ll gcd(ll a,ll b){
    while(b!=0){
		ll t=b;
		b=a%t;
		a=t;
	}
	return a;
}    
    
void fastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
} 

ll func(int x){
    if(x==0)
    return 0;
    
    ll s=__builtin_popcount(x);
    return 1+func(x%s);
}

void solve(){
    ll n;
    string s;
    cin>>n>>s;
    
    ll cur_set=0;
    
    forn(i,0,n){
        if(s[i]=='1')
        cur_set++;
    }
    if(cur_set==0){
        forn(i,0,n){
            cout<<1<<"\n";
        }
        return;
    }
    
    ll c1=cur_set-1;
    ll c2=cur_set+1;
    
    ll rem1=0;
    ll rem2=0;
    ll p1=1;
    ll p2=1;
    
    for(int i=n-1;i>=0;i--){
        if(c1>0)
        rem1=(rem1+p1*(s[i]-48))%c1;
        rem2=(rem2+p2*(s[i]-48))%c2;     
        if(c1>0)
        p1=(p1*2)%c1;
        p2=(p2*2)%c2;    
    }
    
    ll res[n];
    memset(res,0,sizeof(res));

    for(ll i=n-1;i>=0;i--){
        if(s[i]=='1' and c1>0){
            ll cur=rem1;
            cur=(cur-power(2,n-i-1,c1)+c1)%c1;
            res[i]=1+func(cur);
            
        }else if(s[i]=='0'){
            ll cur=rem2;
            cur=(cur+power(2,n-i-1,c2)+c2)%c2;
            res[i]=1+func(cur);
            
        }
    }     
                       
    forn(i,0,n){
        cout<<res[i]<<"\n";
    }        
}    
    
int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;    
   
   while(test--)
   solve();
}    

Measured memory_bytes: 5328
import numpy as np

n = int(input())
c = np.array(list(input()))

count = 0

n_white = np.count_nonzero(c=='W')
n_red = np.count_nonzero(c=='R')

if n_red:
    if n_white:
        p_white = np.where(c == 'W')[0].tolist()
        p_red = np.where(c == 'R')[0].tolist()
        num = min(len(p_white), len(p_red))
        i = 0
        while (i < num):
            if p_white[i] < p_red[-1-i]:
                count += 1
            i += 1

print(count)

Measured memory_bytes: 37052
function Main(input) {
  input = input.split("\n");
  s = input[0];
  K = parseInt(input[1]);
  l = new Array();
  for(i=0;i<s.length;i++){
    lsub = new Array();
    for(j=Math.min(s.length,i+5);j>i;j--){
      lsub=s.slice(i,j);
      if(l.indexOf(lsub)!=-1){
        break;
      }
      l.push(lsub);
    }
  }
  //l2 = new Array(...l);
  l.sort();
  ans=l[K-1];



  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 9992
#include <iostream>
#include <vector>
#include <map>
using namespace std;

const int divisor = 1000000007;

int main(){
	vector<int> ansvec;

	// 100000!までの数をdivisorで割った余りを格納しておく
	long long* factmodary = new long long[100001];
	long long fact = 1;
	for (int i = 1; i <= 100000; i++){
		fact *= i;
		fact %= divisor;
		factmodary[i] = fact;
	}

	int* word = new int[100000] {0};

	for (;;){
		int N, R;
		cin >> N;
		if (N == 0) break;
		cin >> R;
		
		//まず0番目の単語を入れておく
		for (int i = 0; i < N; i++) word[i] = i + 1;

		for (int i = 0; i < R; i++){
			int s, t;
			cin >> s >> t;
			/* swap */
			int tmp = word[s - 1]; word[s - 1] = word[t - 1]; word[t - 1] = tmp;
		}

		//word[i]をkey, word[i]より小さい数がそれ以前にいくつ使われていたかをvalueとして格納するmap
		map<int, int> bubblehist;
		bubblehist[word[0]] = 0;

		long long ans = factmodary[N-1] * (word[0] - 1);

		for (int i = 1; i < N; i++){
			int facttime = word[i] - 1;
			int bubblenum;
			map<int, int>::iterator it = bubblehist.lower_bound(word[i]);

			if (it != bubblehist.end()){
				bubblenum = it->second;
				it--;
			}
			else {
				it--;
				bubblenum = it->second + 1;
			}
			pair<int, int> p;
			p.first = word[i];
			p.second = bubblenum;
			map<int, int>::iterator it2 = bubblehist.insert(it, p);
			//word[i]より大きい数はすべてvalueが1増える
			for (++it2; it2 != bubblehist.end(); it2++) (it2->second)++;

			facttime -= bubblenum;
			ans += factmodary[N - (i + 1)] * facttime;
			ans %= divisor;
		}
		ansvec.push_back((int)ans);
	}

	for (vector<int>::iterator it = ansvec.begin(); it != ansvec.end(); it++) cout << *it << "\n";

	delete[] word;
	delete[] factmodary;
	return 0;
}

Measured memory_bytes: 6816
#include <stdio.h>

#define SIZE 10

int paper[SIZE][SIZE];

void exist(int x, int y)
{
	if(x >= 0 && x < 10 && y >= 0 && y < 10) paper[x][y]++;
}

int main()
{
	int x, y, s, i, j, zero_count, max;

	zero_count = 0;
	max = 0;

	for(i = 0; i < SIZE; i++){
		for(j = 0; j < SIZE; j++){
			paper[i][j] = 0;
		}
	}

	while(scanf("%d,%d,%d", &x, &y, &s) != EOF){
		switch(s){
			case 1:
				exist(x, y);
				exist(x-1, y);
				exist(x, y-1);
				exist(x+1, y);
				exist(x, y+1);
				break;
			case 2:
				for(i = 0; i < 3; i++){
					for(j = 0; j < 3; j++){
						exist(x+i-1, y+j-1);
					}
				}
				break;
			case 3:
				for(i = 0; i < 3; i++){
					for(j = 0; j < 3; j++){
						exist(x+i-1, y+j-1);
					}
				}

				exist(x-2, y);
				exist(x, y-2);
				exist(x+2, y);
				exist(x, y+2);
				break;
		}
	}

	for(i = 0; i < SIZE; i++){
		for(j = 0; j < SIZE; j++){
			if(paper[j][i] == 0) zero_count++;
			if(paper[j][i] > max) max = paper[j][i];
		}
	}

	printf("%d\n%d\n", zero_count, max);

	return 0;
}

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

typedef long long ll ;

#define pb push_back

ll cc = 10000000089 ;


int main() {

    ll n ,i;
    cin >>  n ;

    ll ans = 0;
    for(i=5;i<=n;i*=5)
        ans+= (n/i)/2 ;

    if (n%2)
        ans= 0 ;

    cout<< ans << endl ;




}


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

signed main() {
  int n,m;
  cin >> n >> m;

  vector<int> a(n + 1, 0), c(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  for (int i = 1; i <= n; i++) {
    c[i] = c[i - 1] + a[i];
    c[i] %= m;
  }

  map<int,int> mp;
  for (int i = 0; i <= n; i++) {
    mp[c[i]]++;
  }

  int ans = 0;
  for (auto it : mp) {
    ans += (it.second) * (it.second - 1) / 2;
  }
  cout << ans << '\n';
  return 0;
}

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

ll solve() {
    ll N;
    cin >> N;
    ll ans = 0, m = 0, a, b;
    for ( int i = 0; i < N; i++ ) {
        cin >> a >> b;
        if ( m < a ) {
            m = a;
            ans = a + b;
        }
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    int n, min = 300000, count = 0;
    string s, s1, s2;

    cin >> n >> s;
    for(int i = 1; i < n; i++)
        if(s[i] == 'E') count++;

    min = count;

    for(int i = 1; i < n; i++){
        if(s[i - 1] == 'W') count++;
        if(s[i] == 'E') count--;

        if(count < min) min = count;
    }

    printf("%d\n", min);
    return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
        int N, X;
        cin >> N >> X;
        vector<int> L(101);
        for(int i = 0; i < N; i++) cin >> L[i];

        int d = 0;
        d += L[0];
        if(d > X) cout << '1' << endl;
        for(int i = 2; i <= N; i++)
        {
                d = d + L[i-1];
                if(d > X)
                {
                        cout << i << endl;
                        return 0;
                }
        }
        cout << N+1 << endl;

        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  vector<vector<int>> perms;
  vector<int> perm(n);
  iota(perm.begin(), perm.end(), 1);
  do {
    perms.push_back(perm);
  } while (next_permutation(perm.begin(), perm.end()));

  vector<int> p(n), q(n);
  for (int& x: p) cin >> x;
  for (int& x: q) cin >> x;
  int ans = 0;
  for (int i = 0; i < (int) perms.size(); i++) {
    if (perms[i] == p) {
      ans -= i;
    }
    if (perms[i] == q) {
      ans += i;
    }
  }
  ans = abs(ans);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3384
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int slen = s.length();
    int zennhann = (slen - 1) / 2;
    int kouhann = (slen + 3) / 2 - 1;
    String mae = s.substring(0,zennhann);
    int mlen = mae.length();
    String usiro = s.substring(kouhann,slen);
    int ulen = usiro.length();
    String aa = "";
    String bb = "";
    for(int i = 0;i < mlen;i++){
      aa = mae.substring(i,i+1);
      bb = mae.substring(mlen - i - 1 ,mlen - i);
      if(!(aa.equals(bb))){
        System.out.println("No");
        return;
      }
    }
    for(int i = 0;i < ulen;i++){
      aa = usiro.substring(i,i+1);
      bb = usiro.substring(ulen -i -1,ulen -i);
      if(!(aa.equals(bb))){
        System.out.println("No");
        return;
      }
    }
    for(int i = 0;i < slen;i++){
      aa = s.substring(i,i+1);
      bb = s.substring(slen -i -1,slen -i);
      if(!(aa.equals(bb))){
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }
}


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

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

const int M = 1e5;

bool sieve[M + 7];
int pre[M + 7];

int main()
{
	_upgrade
	for(int i = 2; i * i <= M; i++)
		if(sieve[i] == 0) for(int j = i * i; j <= M; j += i)
			sieve[j] = 1;
	sieve[1] = sieve[0] = 1;
	for(int i = 1; i <= M; i++)
	{
		pre[i] = pre[i - 1];
		if(!sieve[i] && (i & 1) && !sieve[(i + 1) / 2])
			pre[i]++;
	}
	int q; cin >> q;
	while(q--)
	{
		int l, r; cin >> l >> r;
		cout << pre[r] - pre[l - 1] << "\n";
	}
	return 0;
}


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

using namespace std;

int main(){
  int N;
  cin >> N;
  int store[N][10];
  for(int i = 0; i < N; i++) for(int j = 0; j < 10; j++) cin >> store[i][j];
  int P[N][11];
  for(int i = 0; i < N; i++) for(int j = 0; j < 11; j++) cin >> P[i][j];
  int maxScore = -1e9;
  bool openStore[10];
  for(int k = 1; k < (1<<10); k++){
    int x = k;
    int cnt = 0;
    fill(openStore,openStore+10,false);
    while(x != 0){
      if(x % 2) openStore[cnt] = true;
      cnt++;
      x/= 2;
    }
    vector<int> open2(N,0);
    for(int i = 0; i < N; i++){
      for(int j = 0; j < 10; j++){
        if(store[i][j] && openStore[j]) open2[i]++;
      }
    }
    int score = 0;
    for(int i = 0; i < N; i++) score += P[i][open2[i]];
    maxScore = max(score,maxScore);
  }
  cout << maxScore << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	string s;
	cin >> s;
	int n = s.size();

	ll res = 0;
	// map<pair<int, int>, int> mp;
	// int prf3 = 0;
	// int prf673 = 0;
	// mp[{0, 0}] = 1;
	// int pw3 = 1;
	// int pw673 = 1;
	map<int, int> mem;
	mem[0] = 1;
	int pw = 1;
	int sum = 0;

	for(int i = n - 1; i >= 0; --i){
		int d = s[i] - '0';
		// prf3 = (prf3 + d * pw3) % 3;
		// prf673 = (prf673 + d * pw673) % 673;
		// pw3 = pw3 * 10 % 3;
		// pw673 = pw673 * 10 % 673;
		// res += mp[{prf3, prf673}];
		// cout << prf3 << " " << prf673 << endl;
		// mp[{prf3, prf673}]++;
		sum = (sum + d * pw) % 2019; 
		res += mem[sum];
		mem[sum]++;
		pw = (pw * 10 % 2019);
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
long long n;
long long v[200],w[200];
long long tot;
long long dp[100010][200];
int main()
{
	cin>>n>>tot;
	for(int i=1;i<=n;i++){
		cin>>w[i]>>v[i];
	} 
	for(int i=1;i<=tot;i++){
		for(int j=1;j<=n;j++){
			if(w[j]>i) 
			   dp[i][j]=dp[i][j-1];
			else
			   dp[i][j]=max(dp[i-w[j]][j-1]+v[j],dp[i][j-1]);
		}
	}
	cout<<*(max_element(dp[tot]+1,dp[tot]+n+1));
	return 0;
}


Measured memory_bytes: 156544
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<Int, Int> P;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

vector<vector<P> > nx
{
  {P(0,5),P(1,6),P(2,7),P(3,8),P(4,9)},
  {P(0,1),P(4,3),P(9,14),P(10,15),P(5,11)},
  {P(0,4),P(5,10),P(11,16),P(6,12),P(1,2)},
  {P(1,0),P(6,11),P(12,17),P(7,13),P(2,3)},
  {P(2,1),P(7,12),P(13,18),P(8,14),P(3,4)},
  {P(3,2),P(8,13),P(14,19),P(9,10),P(4,0)},
  {P(5,0),P(10,9),P(15,19),P(16,17),P(11,6)},
  {P(6,1),P(11,5),P(16,15),P(17,18),P(12,7)},
  {P(7,2),P(12,6),P(17,16),P(18,19),P(13,8)},
  {P(8,3),P(13,7),P(18,17),P(19,15),P(14,9)},
  {P(9,4),P(14,8),P(19,18),P(15,16),P(10,5)},
  {P(15,10),P(19,14),P(18,13),P(17,12),P(16,11)}
};

signed char dp[203][203][21][21][6];
struct st{
  Int y,x,n,m,d;
  st(Int y,Int x,Int n,Int m,Int d):y(y),x(x),n(n),m(m),d(d){}
};
const Int CC = 101;
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  {
    memset(dp,-1,sizeof(dp));
    queue<st> q;
    dp[CC][CC][0][5][0]=0;
    q.emplace(CC,CC,0,5,0);
    Int dyl[6]={0,0,1,0,0,-1};
    Int dxl[6]={-1,-1,0,1,1,0};
    Int dyr[6]={0,-1,0,0,1,0};
    Int dxr[6]={1,0,-1,-1,0,1};
    Int dyo[6]={1,0,0,-1,0,0};    
    Int dxo[6]={0,1,1,0,-1,-1};

    auto push=[&](st a,st b){
      if(~dp[a.y][a.x][a.n][a.m][a.d]) return;
      dp[a.y][a.x][a.n][a.m][a.d]=dp[b.y][b.x][b.n][b.m][b.d]+1;
      q.emplace(a);
    };
    
    while(!q.empty()){
      st s=q.front();q.pop();
      if(dp[s.y][s.x][s.n][s.m][s.d]>100) break;
      
      Int k=0,l=0;
      for(Int i=0;i<12;i++)
	for(Int j=0;j<5;j++)
	  if(nx[i][j]==P(s.n,s.m)) k=i,l=j;
      
      //cout<<k<<" "<<l<<endl;
      
      {// L
	st t=s;
	t.y+=dyl[s.d];
	t.x+=dxl[s.d];
	tie(t.n,t.m)=nx[k][(l+4)%5];
	t.d=(s.d+5)%6;	
	push(t,s);
      }
      {// R
	st t=s;
	t.y+=dyr[s.d];
	t.x+=dxr[s.d];
	tie(t.n,t.m)=nx[k][(l+1)%5];
	t.d=(s.d+1)%6;	
	push(t,s);
      }
      {// O
	st t=s;
	t.y+=dyo[s.d];
	t.x+=dxo[s.d];
	swap(t.n,t.m);
	t.d=(s.d+3)%6;	
	push(t,s);
      }
    }
    
    
  }
  
  
  {
    Int x,y,n;
    while(cin>>x>>y>>n,x||y||n){
      short ans=101;
      x+=CC;y+=CC;
      for(Int i=0;i<20;i++){
	for(Int j=0;j<6;j++){
	  if(dp[y][x][n][i][j]<0) continue;
	  chmin(ans,dp[y][x][n][i][j]);
	}
      }
      cout<<ans<<endl;
    }
  }
  return 0;
}




Measured memory_bytes: 109956
name=['A','B','C','D','E']
shop = []
while True:
  a,b = map(int,input().split())
  if a == 0 and b == 0:
    break
  shop.append(a+b)
  if len(shop) == 5:
    m = max(shop)
    print(name[shop.index(m)],m)
    shop = []


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> edges(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        edges[u].emplace_back(v);
        edges[v].emplace_back(u);
    }
    vector<int> ret(n, -1);
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (auto &w : edges[v]) {
            if (ret[w] != -1)
                continue;
            ret[w] = v;
            q.push(w);
        }
    }
    cout << "Yes"
         << "\n";
    for (int i = 1; i < n; ++i) {
        cout << ret[i] + 1 << "\n";
    }
    return 0;
}

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

struct Data{
  long a;
  long b;
  long c;
};

bool cmp(const Data &a, const Data &b){
  return a.c < b.c;
}

int main(){

  int N;
  long temp, ans=0;
  cin >> N;
  bool taka = true;
  struct Data num[N];

  for(int i=0; i<N; i++){
    cin >> num[i].a >> num[i].b;
    num[i].c = num[i].a + num[i].b;
  }

  sort(num, num+N, cmp);

  for(int j=N-1; j>=0; j--){
    ans += taka ? num[j].a : -1*num[j].b ;
    taka = !taka;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,m;cin >> n >>m;
    if(n%2){
        rep(i,m){
            cout << i+1 <<" "<< n-i-1 <<endl;
        }
    }
    else{
        ll t=n/2/2;
        rep(i,min(t,m)){
            cout << i+1 <<" " << n/2-i <<endl;
        }
        rep(i,m-t){
            cout << n/2+i+1 <<" " << n-i-1 <<endl;
        }
    }
}

Measured memory_bytes: 3580
#B - Greedy Takahashi
A,B,K = list(map(int, input().split()))

if K>=A+B:
    N1 = 0
    N2 = 0
else:
    if K>=A:
        N1 = 0
        N2 = B-(K-A)
    else:
        N1 = A-K
        N2 = B

print(N1,N2)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define ll long long
#define faltu ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define binary(x) std::string binary = std::bitset<25>(x).to_string(); //to binary
#define inf 1000000007
#define mod 1000000007
#define pi pair<int,int>
#define lpi pair<int,int>
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define lvi vector<long long int>
#define pie 3.14159265358979323846
ll int MMM=inf;
int pw(int x,int y){int z=1;for(;y;y>>=1,x=1ll*x*x%MMM)if(y&1)z=1ll*z*x%MMM;return z;}
using namespace std;
vi pm;
void prm(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
              prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p]) pm.pb(p);
}
bool sortbysecdesc(const pair<ll int,ll int> &a,const pair<ll int,ll int> &b)
{
    return a.first>b.first;
}
bool cmp(int x,int y){return x>y;}
int a[40];
int main()
{
	faltu;
	string s;
	int ans=0;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		a[int(s[i])-'A']++;
	}
	for(int i=0;i<30;i++)if(a[i]!=0&&a[i]!=2)ans=1;
	if(ans==1)cout<<"No";
	else cout<<"Yes";

}








Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

long long int cnt = 0;

struct _str
{
	string str;
	struct _str *ll;
	struct _str *rr;
};

void count()
{
	cnt++;
}

int main() {
	long long int nn, res;
	cin >> nn;
	string tmp;
	cin >> tmp;
	struct _str *root;
	count();
	root = (struct _str*)malloc(sizeof(struct _str));
	root->str = tmp;
	root->rr = NULL;
	root->ll = NULL;
	struct _str *memo;
	for(long long int ii = 1;ii < nn;ii++)
	{
		cin >> tmp;
		memo = root;
		while(1)
		{
			res = memo->str.compare(tmp);
			if(res == 0)
			{
				break;
			}
			else if(res < 0)
			{
				if(memo->ll == NULL)
				{
					count();
					memo->ll = (struct _str*)malloc(sizeof(struct _str));
					memo->ll->str = tmp;
					memo->ll->ll = NULL;
					memo->ll->rr = NULL;
					break;
				}
				else
				{
					memo = memo->ll;
				}
			}
			else if(res > 0)
			{
				if(memo->rr == NULL)
				{
					count();
					memo->rr = (struct _str*)malloc(sizeof(struct _str));
					memo->rr->str = tmp;
					memo->rr->ll = NULL;
					memo->rr->rr = NULL;
					break;
				}
				else
				{
					memo = memo->rr;
				}
			}
		}
	}
	
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 22352
//
// Created by kuroneko on 2019-07-06.
//

using namespace std;

#include <iostream>
#include <vector>
#include <cmath>

typedef long long ll;

int main() {
    int P, Q, R; cin >> P >> Q >> R;

    int min_ = 1e9;
    min_ = min(min_, P + Q);
    min_ = min(min_, Q + R);
    min_ = min(min_, P + R);
    cout << min_ << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    double d;

    Double calc(Double x) {
        if (d * d - x * x < 0) return 0.0;

        Double y = sqrt(d * d - x * x);
        Double ret = x + max(1.l, y);
        return ret;
    }

    void solve() {
        cin >> d;
        Double ans = d;
        chmax(ans, sqrt(2.) * d);
        for (int i = 0; i <= 10; ++i) {
//            cerr << calc(i) << endl;
            chmax(ans, calc(i));
        }
        cout << ans << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    Solve().solve();


    return 0;
}



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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define float			double
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vc				vector<char>
#define vb				vector<bool>
#define vf				vector<float>
#define vs				vector<string>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define hashmap         unordered_map
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT64_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

template<class T>
void printV(vector<T> a) {for (auto v : a)cout << v << " ";}
template<class T>
void readV(vector<T>& a) {int n = a.size(); for (int i = 0 ; i < n ; i++)cin >> a[i];}
template<class T>
void printA(T* a , int n) {for (int i = 0; i < n  ; i++)cout << a[i] << " ";}
template<class T>
void readA(T* a , int n) {for (int i = 0 ; i < n ; i++)cin >> a[i];}
auto clk = clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
void run_time() {cout << endl<<"Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;}

void aryan_pandeya() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}


int32_t main() {
	aryan_pandeya();
	FIO;

	int a[2][2];
	cin>>a[0][0];
	cin>>a[0][1];
	cin>>a[1][0];
	cin>>a[1][1];

	int op1 = a[0][0]*a[1][0];
	int op2 = a[0][0]*a[1][1];
	int op3 = a[0][1]*a[1][0];
	int op4 = a[0][1]*a[1][1];

	int ans = max(max(op1,op2),max(op3,op4));
	cout<<ans;


	return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;
class Main{

	public static void main(String[] args) {
		int a;
		int b = 0;
		Scanner data1 = new Scanner(System.in);
	    a = data1.nextInt();
	    b = data1.nextInt();
		int area;
		int total;
		area = (a * b);
		total = ((a + b) * 2);
		System.out.println(area + " " + total );
	}

}

Measured memory_bytes: 26012
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int x, k, d; cin >> x >> k >> d;
    int cnt = abs(x) / d;
    if(cnt >= k) {
        cout << (x > 0 ? abs(x - k * d) : abs(x + k * d)) << endl;
    } else {
        k -= cnt;
        x = (x > 0 ? x - cnt * d : x + cnt * d);
        if(k % 2 == 0) cout << abs(x) << endl;
        else cout << (x > 0 ? abs(x - d) : abs(x + d)) << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3640
import math

def main():
    # A = list(map(float,input().split()))
    # B = A[0] * A[1]
    # C = str(B)
    # 
    # D = C.split('.')
    # 
    # print(int(B))


    a, b = input().split()

    a = int(a)
    b = b[0] + b[2:]
    b = int(b)

    ans = a * b // 100
    print(ans)



if __name__ == '__main__':
    main()



Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a,b,c,k;
  int x[4];
  cin>>a>>b>>c>>k;
  x[0]=a;
  x[1]=b;
  x[2]=c;
  sort(x,x+3,greater<int>());
  for(int i=0;i<k;i++){
    x[0]*=2;
  }
  cout<<x[0]+x[1]+x[2]<<endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:256000000")
#include<utility>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head
#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

// belik's shit
ll const mod = 1e9 + 7;
namespace {
	ll mult(ll& a, ll& b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) {
			val += mod;
		}
		if (val >= mod) {
			val -= mod;
		}
		return val;
	}
	ll poww(ll a, ll b)
	{
		ll val = 1;
		a %= mod;
		while (b > 0){
			if (b % 2) val = mult(a, val);
			a = mult(a, a);
			b >>= 1;
		}
		return val % mod;
	}
	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;
ll dp[maxn][3];
signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n; cin >> n;
	for (ll i = 1; i <= n; i++) {
		ll a[3]; cin >> a[0] >> a[1] >> a[2];
		for (ll j = 0; j < 3; j++) {
			for (ll jj = 0; jj < 3; jj++) {
				if (j != jj) {
					dp[i][j] = max(dp[i][j], dp[i-1][jj] + a[j]);
				}
			}
		}
	}
	cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
	return 0;
}
/*

*/

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

vector<int> to[200005];
vector<int> ans;

void dfs(int v, int p=-1){
  for(int u: to[v]){
    if(u == p) continue;
    ans[u] += ans[v];
    dfs(u, v);
  }
}

int main(){
  int N, Q;
  cin >> N >> Q;
  rep(i, N-1){
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(N);
  rep(i, Q){
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  dfs(0);
  rep(i, N){
    cout << ans[i] << " ";
  }
  cout << "\n";
}


Measured memory_bytes: 23424
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

  vector<long long> A(N);
  for(int i = 0;i < N;i++) cin >> A[i];

  map<long long,long long> S;
  long long ans = 0;
  for(int i = N-1;i >= 0;i--) {
    long long L = A[i]+i;
    ans += S[L];
    long long R = i-A[i];
    S[R]++;
  }

  cout << ans << endl;

}


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

S = str(input())
num = [i  for i in range(10)]
H = '-'
fr = 0
count = 0
if S[A] != H:
    fr += 1
for i in range(len(S)):
    for j in num:
        if i == A:
            pass
        else:
            if S[i] == str(j):
                count += 1
if count == A + B and fr == 0:
    print("Yes")
else:
    print("No")

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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 n, m;
    cin >> n >> m;

    vector<ll> h(n), a(m), b(m);
    vector<bool> ok(n, true);

    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        if (h[a[i]] == h[b[i]]) {
            ok[a[i]] = false;
            ok[b[i]] = false;
        } else if (h[a[i]] < h[b[i]]) {
            ok[a[i]] = false;
        } else {
            ok[b[i]] = false;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (ok[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 5544