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

using namespace std;

#define LL long long
#define int long long
#define fi first
#define se second
#define double long double
#define pll pair<LL, LL>
#define pii pair<LL, LL>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

constexpr int N = 1e6+5;
constexpr int M = 1e9+7;

// #define DEBUG 1  //调试开关
struct IO {
#define MAXSIZE (1 << 20)
#define isdigit(x) (x >= '0' && x <= '9')
    char buf[MAXSIZE], *p1, *p2;
    char pbuf[MAXSIZE], *pp;

    IO() : p1(buf), p2(buf), pp(pbuf) {}
    ~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); }

    inline char gc() {
        if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);
        return p1 == p2 ? ' ' : *p1++;
    }
    inline bool blank(char ch) {
        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
    }
    template <class T>
    inline void read(T &x) {
    double tmp = 1;
    bool sign = 0;
    x = 0;
    char ch = gc();
    for (; !isdigit(ch); ch = gc())
        if (ch == '-') sign = 1;
    for (; isdigit(ch); ch = gc()) x = x * 10 + (ch - '0');
    if (ch == '.')
        for (ch = gc(); isdigit(ch); ch = gc())
        tmp /= 10.0, x += tmp * (ch - '0');
    if (sign) x = -x;
    }
    inline void read(char *s) {
    char ch = gc();
    for (; blank(ch); ch = gc())
        ;
    for (; !blank(ch); ch = gc()) *s++ = ch;
    *s = 0;
    }
    inline void read(char &c) {
    for (c = gc(); blank(c); c = gc())
        ;
    }
    inline void push(const char &c) {
    #if DEBUG  //调试，可显示字符
    putchar(c);
    #else
    if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
    *pp++ = c;
    #endif
    }
    template <class T>
    inline void write(T x) {
    if (x < 0) x = -x, push('-');  // 负数输出
    static T sta[35];
    T top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) push(sta[--top] + '0');
    }
    template <class T>
    inline void write(T x, char lastChar) {
    write(x), push(lastChar);
    }
} io;

int w, s;

signed main() {
    fastio;
    cin >> s >> w;
    cout << (w >= s ? "unsafe" : "safe") << endl;
    return 0;
}

Measured memory_bytes: 3648
/*
name:       Egyptian Tourist
PlatForm:   CodeForces/SPOJ...etc
LANG:       C++
DIV:        Training
TIME:       *
RATE:       *
*/

/*
Time Consumed:*
Problem Topics: *
*/
#include <bits/stdc++.h>
#include <iostream>

using namespace std;
//----------------------------------//

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

//-------------------------------------------------------//
#define rep(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define repr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define lp(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define lpr(i,n) for (int i = (n) - 1; ~i; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
//-------------------------------------------------------------------------------------//

#define clr(ar, val) memset(ar, val, sizeof(ar))
//----------------------------------------------//

#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define PI 3.1415926535897932385
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define pob pop_back
#define bit(n) (1<<(n))
#define Last(i) ( (i) & (-i) )
#define all(v) ((v).begin()), ((v).end())
#define sq(x) ((x) * (x))
#define INF INT_MAX
#define Ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

//-------------------------------------------------------------//
#ifndef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " : " << arg1 << std::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...);
}
#else
#define debug(...)
#endif
#define _ist_ cout << "\nSTART OF INPUT DISPLAYING CHECK\n";
#define _iend_ cout << "\nEND OF INPUT DISPLAYING CHECK\n";
//------------------------------------------------------------//
template<class T, class T2>
T _f_pow(T a, T2 b)
{
    T res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
#define N (int)1e5+5
int dp[N];
vector<int> adj[N];
int n, m;
int dfs(int node)
{
    int& ret = dp[node];
    if(~ret)
        return ret;
    ret = 0;
    for(auto ch:adj[node])
        ret = max(ret, dfs(ch) + 1);
    return ret;
}

int main()
{
    Ios;
    //inn;//outt;
    //auto tt = clock();
    cin >> n >> m;
    while(m--)
    {
        int x, y;
        cin >> x >> y;
        adj[x].pb(y);
    }
    clr(dp, -1);
    int mx = 0;
    rep(i, 1, n)
    {
        mx = max(mx, dfs(i));
    }

    cout << mx << "\n";
    //cout << (double(clock() - tt)/CLOCKS_PER_SEC * 1.00) << endl;
    return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n , m , x;
   cin >> n >> m >> x;
   int a[n][m] , c[n];
   for(int i = 0 ; i < n ; i++){
      cin >> c[i];
      for(int j = 0 ; j < m ; j++)
         cin >> a[i][j];
   }
   int k[m];
   int ans = mod;
   for(int i = 0 ; i < (1 << n) ; i++){
      memset(k , 0 , sizeof(k));
      int sum = 0;
      for(int j = 0 ; j < n ; j++)
         if((1 << j) & i){
            for(int p = 0 ; p < m ; p++)
               k[p] += a[j][p];
            sum += c[j];
         }
      for(int j = 0 ; j < m ; j++)
         if(k[j] < x)
            sum = mod;
      ans = min(ans , sum);
   }
   if(ans == mod)
      ans = -1;
   cout << ans;
   return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int a,b,h;
  cin >>  a >> b >> h;
  cout << (a+b)*h/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

/*
  UnionFind Tree
*/
class UnionFind {
    private: 
        vector<int> par;
        vector<int> rank;
        vector<int> cnt;
    
    public:
        UnionFind(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        int count(int x);
        void printStatus();
};

UnionFind::UnionFind(int n) {
    for (int i = 0; i < n; i++) {
        par.push_back(i);
        rank.push_back(0);
        cnt.push_back(1);
    }
}
int UnionFind::find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}
void UnionFind::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
        cnt[y] += cnt[x];
        par[x] = y;
    } else {
        cnt[x] += cnt[y];
        par[y] = x;
        if (rank[x] == rank[y]) rank[x]++;
    }
}
bool UnionFind::same(int x, int y) {
    return find(x) == find(y);
}
int UnionFind::count(int x) {
    return cnt[find(x)];
}
void UnionFind::printStatus() {
    printf("----------------\n");
    for (int i = 0; i < par.size(); i++) {
        printf("[node %d]: parent = %d, rank = %d, count = %d\n", i, par[i], rank[i], cnt[i]);
    }
}

int main() {

    int N, M;
    cin >> N >> M;

    UnionFind tree(N);

    rep(i,M) {
        int x, y, z;
        cin >> x >> y >> z;
        x--; y--;
        tree.unite(x, y);
    }

    vector<int> count(N, 0);
    rep(i,N) count[tree.find(i)]++;
    int ans = 0;
    rep(i,N) if (count[i] > 0) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2028
import sys 
N,K = map(int,input().split())
l = list(map(int,input().split()))
m = [0 for i in range(N)]
location = 0
count = 0
for i in range(K):
    location = l[location] -1
    m[location] += 1
    if m[location] == 2:
        start = location
        for j in range(K-i-1):
            location = l[location] -1
            count += 1
            if location == start:
                for k in range((K-i-j-2)%count):
                    location = l[location] -1
                print(location + 1)
                sys.exit()
        print(location + 1)
        sys.exit()
print(location + 1)

Measured memory_bytes: 32384
use std::io::{Read, stdin};
use std::str::FromStr;
use std::cmp::max;

fn main() {
    let w: i64 = read();
    let a: i64 = read();
    let b: i64 = read();
    let mut ans = 0;
    if (a <= b && b <= a + w) || (a <= b + w && b + w <= a + w) {
        ans = 0;
    } else {
        ans = max(b - (a + w), a - (b + w));
    }
    println!("{}", ans);
}


fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

Measured memory_bytes: 4352
function Main(input) {
  input = input.split("\n");
  var h = parseInt(input[0].split(" ")[0]);
  var w = parseInt(input[0].split(" ")[1]);
  a = new Array(h);
  for(i=0;i<h;i++){
    tmp=input[i+1].split(" ");
    asub=new Array(w);
    for(j=0;j<w;j++){
      asub[j]=parseInt(tmp[j]);
    }
    a[i]=asub;
  }
  var ans="";
  var cnt=0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(a[i][j]%2==1&&j<w-1){
          a[i][j]--;
          a[i][j+1]++;
          var m1=i+1;
          var m2=j+1;
          var m3=j+2;
          ans=ans+m1+" "+m2+" "+m1+" "+m3+"\n";
          cnt++;
      }
      if(a[i][j]%2==1&&i<h-1){
          a[i][j]--;
          a[i+1][j]++;
          var m1=i+1;
          var m2=j+1;
          var m3=i+2;
          ans=ans+m1+" "+m2+" "+m3+" "+m2+"\n";
          cnt++;
      }
    }
  }
  ans=cnt+"\n"+ans;
  ans=ans.slice(0,-1);


  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};

int main() {
  string s, t;
  cin >> s >> t;
  ll n = stoi(s + t);

  bool ans = 0;
  for (int i = 1; i * i <= n; i++)
    if (i * i == n)
      ans = 1;

  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

#define ll long long
#define vec vector
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
	ll n,ans=0,buf=0;
	string s;

	cin >> s;

	forll(i, 0, s.size())
	{
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G')
			buf++;
		else
		{
			ans = max(ans,buf);
			buf=0;
		}
	}

	ans = max(ans, buf);

	cout << ans;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define fbo find_by_order //returns iterator
#define fok order_of_key //return index
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=998244353;
//string s=bitset<32>(n).to_string();
typedef tree<lli,null_type,less<lli>,rb_tree_tag, // change both to lli if set is req insted of multiset
tree_order_statistics_node_update> indexed_set;
lli power(lli x, lli y, lli p)   
{  
    lli res = 1;     // Initialize result  ! 
    x = x % p; // Update x if it is more than or  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 

int main()
{
	lli n,x,y;
	cin>>n>>x>>y;
	lli arr[n+1][n+1];
	for(lli i=1;i<=n;i++){
		for(lli j=1;j<=n;j++)
		arr[i][j]=abs(i-j);
	}
	for(lli i=1;i<=n;i++){
		for(lli j=1;j<=n;j++){
		 	arr[i][j]=arr[j][i]=min(arr[i][j],min(arr[i][x]+arr[j][y]+1,arr[i][y]+arr[j][x]+1));
		}
	}
	
	
	
	
	
	
	
	
	
	lli temp[n+1]={0};
		for(lli i=1;i<=n;i++){
		for(lli j=1;j<=n;j++)
		temp[arr[i][j]]++;
	}
	loop(i,1,n)cout<<temp[i]/2<<endl;
	
	/*
	for(lli i=1;i<=n;i++){
		for(lli j=1;j<=n;j++)
		cout<<arr[i][j]<<" ";
		cout<<endl;
	}
	*/
	
	
	
	
    return 0;
}

Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
inline ll mod(ll val, ll m) {long long res = val % m;if (res < 0) res += m;return res;}
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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const ll MOD = 1000000007;
int main(){
    STR(s,t);
    int ans = 0;
    for(int i = 0; i < s.size(); ++i) {
        if(s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;

int d(int i){
  int ans = 0;
  while(i > 0){
    ans +=i % 10;
    i /= 10;
  }
  return ans;
}

int main(){
  cin >> N;
  int ans = 1e9;
  rep(i,1,N - 1){
    int j = N - i;
    ans = min(ans , d(i) + d(j));
  }
  cout << ans <<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(int X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 
#define CERR if(false) cerr

using namespace std;

int main(){

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

    cout << ((a * b) % 2 == 0 ? "Even" : "Odd") << endl;
    return 0; 
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
 
#pragma comment(linker, "/STACK:336777216")  
 
using namespace std;

const int MAXN = 200000 + 10;
const int INF = 1000000000;

int N;
char S[MAXN];
char T[] = "AKIHABARA";
int dp[MAXN][10];

void Work()
{
	scanf("%s", S);
	N = strlen(S);
	
	dp[0][0] = 1;
	for (int i = 0; i <= N; i ++)
		for (int j = 0; j <= 9; j ++)
			if (dp[i][j])
			{
				//printf("%d %d\n", i, j);
				if (i < N && S[i] == T[j]) dp[i + 1][j + 1] = 1;
				if (T[j] == 'A') dp[i][j + 1] = 1;
			}
	printf(dp[N][9] ? "YES\n" : "NO\n");
}

int main()
{
	Work();

	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		String[] str = { "JOI", "IOI" };
		while (scanner.hasNext()) {
			String line = scanner.next();
			for (String s : str) {
				int p = 0;
				int ans = 0;
				while (true) {
					p = line.indexOf(s, p) + 1;
					if (p == 0)
						break;
					ans++;
				}
				System.out.println(ans);
			}
		}
	}
}

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

#define ll  long long


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;

    ll t= n/(a+b);
    ll ans=0;

    ans+= t*a;
    if(n-t*(a+b)>=a)ans+=a;
    else{
        ans+=(n-t*(a+b));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
l=len(a)
a.sort(reverse=True)
alice=bob=c=0
for i in range(l):
    if c%2==0:
        alice+=a[i]

    else:
        bob+=a[i]
    c+=1
print(alice-bob)



Measured memory_bytes: 61840
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long a,b,k;
  cin >> a >> b >> k;
  if(a>=k){
    cout << a-k << " " << b << endl;
  }
  else if(a+b-k>=0){
    cout << 0 << " " << a+b-k <<endl;
  }
  else{
    cout << 0 <<  " " << 0 << endl;
  }
  }

Measured memory_bytes: 3652
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main()
{
    int n = 0;
    std::cin >> n;
    std::vector<int> scaffoldCost(n);
    int inputCost = 0;
    for(int i = 0; i < n; ++i)
    {
        std::cin >> inputCost;
        scaffoldCost.at(i) = inputCost;
    }
    
    std::vector<long long> minCosts(n);
    minCosts.at(1) = std::abs(scaffoldCost.at(0) - scaffoldCost.at(1));
    for(int index = 2; index < n; ++index)
    {
        minCosts.at(index)= std::min(
            minCosts.at(index - 2) + std::abs(scaffoldCost.at(index) - scaffoldCost.at(index - 2))
            ,minCosts.at(index - 1) + std::abs(scaffoldCost.at(index) - scaffoldCost.at(index - 1)));
    }
    std::cout << minCosts.back() << std::endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cmath>
const int N=2005;
using namespace std;
int n,m,num[30],FLAG,color[30],a[N][N];
char s[N];
void dfs(int x,int y)
{
	if(x==n&&y==m+1)
	{
	  int flag=1;
	  for(int i=1;i<=n;++i)
	  {
	  	memset(color,0,sizeof(color));
	  	for(int j=1;j<=m;++j) color[a[i][j]]++;
	  	int all=0;
	  	for(int j=0;j<26;++j) if(color[j]&1) all++;
	  	if(all>1) flag=0;
	  }
	  for(int j=1;j<=m;++j)
	  {
	  	memset(color,0,sizeof(color));
	  	for(int i=1;i<=n;++i) color[a[i][j]]++;
	  	int all=0;
	  	for(int i=0;i<26;++i) if(color[i]&1) all++;
	  	if(all>1) flag=0;
	  }
	  if(flag) FLAG=1;	  
	  return ;
	}
    if(y==m+1) x=x+1,y=1;
    
	for(int j=0;j<26;++j)
	 if(num[j])
	 {
	 	num[j]--;
		a[x][y]=j;
	    dfs(x,y+1);
	    num[j]++;
	    if(FLAG) return;
	 }
}
bool work1()
{
	FLAG=0;
	dfs(1,1);
	return FLAG;
}
bool work2()
{
	int now=0;
	for(int i=0;i<26;++i)
	 if(now&1)
	  now++;
	if(now<=1) return 1;
	else return 0;
}
bool work3()
{
	int now=0;
	int flag=1;
	for(int i=0;i<26;++i)
	 {
	 	if(num[i]&1) flag=0;
	 	else 
	 	{
	 	   if(num[i]%4==2) now++;	
		}
	 }
	if(!flag) return 0;
	else 
      if(flag)
	{
	   if(now<=1) return 1;
	   else return 0;	
	} 
}
bool work4()
{
	int now=0;
	for(int i=0;i<26;++i)
	 if(num[i]%4)
	  now++;
	if(now>0) return 0;
	else return 1;
}
bool work6()
{
	int all=0;
	int now=0;
	for(int i=0;i<26;++i)
	{
		if(num[i]%4==0) continue;
		if(num[i]%4)
		{
			if(num[i]%2)
			{
			  if(num[i]%4==3) all++,now++;
			  else all++;
		    }
			else now++;
		}
	}
	if(all>1) return 0;
	else 
	{
	   if(now>(n+m-2)/2) return 0;
	   else return 1;
	}
}
bool work5()
{
	int all=0;
	int now=0;
	for(int i=0;i<26;++i)
	{
		if(num[i]%4==0) continue;
		if(num[i]%4)
		{
			if(num[i]%2)
			{
			  if(num[i]%4==3) all++,now++;
			  else all++;
		    }
			else now++;
		}
	}
	if(all>0) return 0;
	else 
	{
	   if(n&1)
	   {
	   	 if(now>m/2) return 0;
	   	 else return 1;
	   }
	   if(m&1)
	   {
	   	 if(now>n/2) return 0;
	   	 else return 1;
	   }
	}
}
int main()
{
//	freopen("quilt.in","r",stdin);
//	freopen("quilt.out","w",stdout);
	int t;
//	scanf("%d",&t);
    t=1;
 	while(t--)
	{
		scanf("%d%d",&n,&m);
	    memset(num,0,sizeof(num));
	    int flag=0;
	    for(int i=1;i<=n;++i)
	   {
	     scanf("%s",s+1);
	     for(int j=1;j<=m;++j) num[s[j]-'a']++;
	   }
//	   if(n==1) flag=work2();
//	   else 
//	   {
//	    if(n==2) flag=work3();
//	    else 
//		  {
//		   if(n*m<=12)  flag=work1();
//	       else 
//		   {
		    if((n%2==0)&&(m%2==0))flag=work4();
	        else 
			 {
			  if((n%2)&&(m%2)) flag=work6();
	          else flag=work5();
			 }
//		   }
//		  }
//	   }
	   if(flag) printf("Yes\n");
	   else printf("No\n");
	}
	return 0;
}
/*
1
3 3
aaa
bbb
ccc
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;


int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    vector<int> c(n);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>c[i];
    }
    for(int i=0;i<n;i++)
    {
        if(v[i]>c[i])
            ans+=(v[i]-c[i]);
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
n, m, l = [int(i) for i in input().split()]
a = [[int(i) for i in input().split()] for j in range(n)]
b = [[int(i) for i in input().split()] for j in range(m)]
ans = [[0]*l for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            ans[i][j] += a[i][k]*b[k][j]
print("\n".join(" ".join(map(str, i)) for i in ans))


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

const ll mod = 1e9 + 7 ;

ll ruiseki_xor ( ll a ){
    if( a <= 0 ) return 0 ;
    if( ( a - 3 )%4 == 0 ) return 0     ;
    if( ( a - 4 )%4 == 0 ) return a     ;
    if( ( a - 1 )%4 == 0 ) return 1     ;
    if( ( a - 2 )%4 == 0 ) return a + 1 ;
}

int main(){
    ll a , b ;
    cin >> a >> b ;
    ll ans = ruiseki_xor(b) ^ ruiseki_xor(a-1) ;
    cout << ans << endl ;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>

using namespace std;

int f(int n) {
	int count = 0;
	for (int x = 1; x*x <= n ; ++x) {
		int x2 = x*x;
		for (int y = x; y*y <= n-x2; ++y) {
			int y2 = x2+y*y+x*y;
			for (int z = y; z*z <= n-y2; ++z) {
				if (y2+z*z+y*z+x*z==n) {
					if (x == y && x == z) count++;
					else if (x == y || x == z || y == z) {
						count += 3;
					} else count += 6;
				}
			}
		}
	}
	return count;
}

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cout << f(i) << endl;
	}
	return 0;
}


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

int main()
{
	int N;
	long long D;
	cin >> N >> D;
	vector<long long> X( N );
	vector<long long> Y( N );
	for( int i = 0; i < N; i++ ) {
		cin >> X[i] >> Y[i];
	}

	int ans = 0;
	for( int i = 0; i < N; i++ ) {
		if( X[i] * X[i] + Y[i] * Y[i] <= D * D ) ans++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 6424
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>; // intの2次元の型に vvi という別名をつける
const ll llMAX=9223372036854775807LL; 
const ll llMIN=-9223372036854775808LL;

void myprint1D(vi &data)
{
  REP(i,data.size())
    cout<<data[i]<<" ";
  cout<<endl;
}

//配列を[y][x]で表示
void myprint2D_T(vvi &data)
{
  REP(i,data.size())
    myprint1D(data[i]);
}

//配列を[x][y]で表示
void myprint2D(vvi &data)
{
  ll l1=data.size();
  ll l2=data[0].size();
  REP(j,l2){
    REP(i,l1)
      cout<<data[i][j]<<" ";
    cout<<endl;
  }
}

//print(a,b...)って使い方
void print1(ll a){cout<<a<<endl;}
void print2(ll a,ll b){cout<<a<<" "<<b<<endl;}
void print3(ll a,ll b,ll c){cout<<a<<" "<<b<<" "<<c<<endl;}
void print4(ll a,ll b,ll c,ll d){cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;}
void print5(ll a,ll b,ll c,ll d,ll e){cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;}


ll n,k,x,y;


//moddivとnCk
//c剰余下でaをbで割った値
ll moddiv(ll a,ll b,ll c){
	ll x0=c,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0LL) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%c;
      if (x2==1LL){
        ans=(n2+c)%c;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%c)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n,ll c){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1LL) ans=ans*aa%c;
    aa=aa*aa%c;
    beki/=2LL;
    if (beki==0LL)break;
  }
  return ans;
}

//nCk
vi mulmod(500001);//0!,1!,2!,3!,4!,,,,
void first_nCk(){
  mulmod[0]=1LL;
  for(ll i=1;i<500001;i++){
    mulmod[i]=mulmod[i-1]*i%MOD;
  }
}
ll nCk(ll nn,ll kk){
  return moddiv(mulmod[nn],mulmod[kk]*mulmod[nn-kk]%MOD,MOD);
}

ll modinv(ll a,ll b){
  return moddiv(1,a,b);
}

ll garner(ll a,ll b,ll ar,ll br){
  return ar+(br-ar+b)%b*modinv(a,b)%b*a;
}
ll garner2(ll a,ll b,ll ar,ll br){
  ar%=a;
  br%=b;
  ll ret=(ar+(br-ar)%b*moddiv(1,a,b)%b*a+a*b)%(a*b);
  return ret;
}

ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0LL){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}





int main(){
  ll ans=0;
  cin >> n;

  if (n==1){
    cout<<1<<endl;
    return 0;
  }
  if (n%2==0){
    ans=2*n-1;
  }else{
    ans=n-1;
  }

  n*=2;
  for(ll i=2;i<=n+2;i++){
    if (i*i>n)break;
    if (n%i==0){
      ll val0=i;
      ll val1=n/i;
      if (val0==1)continue;
      if (val1==1)continue;
      if (gcd(val0,val1)==1){
        ll ans0=garner2(val0,val1,1,0)-1+val0*val1;
        ll ans1=garner2(val0,val1,0,1)-1+val0*val1;
        ans0%=val0*val1;
        ans1%=val0*val1;
        if (ans0>1)
          ans=min(ans,ans0);
        if (ans1>1)
          ans=min(ans,ans1);
      }
    }
  }


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

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

const int mod = 998244353;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
const int MAXS = 1000010;
int fac[MAXS], inv[MAXS];
int C(int a, int b) { return a < b ? 0 : (LL) fac[a] * inv[b] % mod * inv[a - b] % mod; }
int main() {
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for (int i = 2; i != MAXS; ++i) {
		fac[i] = mul(fac[i - 1], i);
		inv[i] = mul(inv[mod % i], mod - mod / i);
	}
	for (int i = 2; i != MAXS; ++i) inv[i] = mul(inv[i - 1], inv[i]);
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	int n, m; std::cin >> n >> m;
	int ans = std::max(n, m), a2 = 0;
	for (int i = std::min(n, m); i; --i)
		reduce(a2 += mul(C(i * 2, i), C(n + m - i * 2, n - i)) - mod);
	a2 = pow(mul(C(n + m, n), 2), mod - 2, a2);
	reduce(ans += a2 - mod);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 8064
import java.util.*;
class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int R = scan.nextInt();
        
        if(N>= 10) System.out.println(R);
        else System.out.println(R+100*(10-N));
        scan.close();
    }
}


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<pair<int, int>> a_cnt(n);
  
  rep(i, n) {
    int a;
    cin >> a;
    a_cnt[i].first = a;
    a_cnt[i].second = i+1;
  }
  
  sort(a_cnt.begin(), a_cnt.end());
  
  rep(i, n) {
    cout << a_cnt[i].second << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3900
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var a = int.Parse(input[0]);
        var b = int.Parse(input[1]);
        if ((a + b) % 2 == 0)
        {
            Console.WriteLine(((a+b)/2).ToString());
        }
        else
        {
            Console.WriteLine("IMPOSSIBLE");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
string S;
void input(){
    fast_io();
    cin >> N;
    cin >> S;
}

int solve(){
    int cnt = 0;
    int dep = 0;
    for (int i = 0; i < N; i++)
    {
        if(S[i]=='(') cnt++;
        else if(S[i]==')') cnt--;
        dep = min(dep,cnt);
    }
    cnt += abs(dep);
    string le(abs(dep),'(');
    string ri(cnt,')');
    S = le+S+ri;
    cout << S << endl;
    
    return 0;
}   

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
	int n,k;cin>>n>>k;
	vector<ll> v(n);
	rep(i,n)cin>>v[i];
	int ans = 0;
	for(int i=0;i<=k; i++){
		for(int j=0; j<=k; j++){
			if(i+j==0)continue;
			if(i+j > n)break;
			if(i+j > k)break;
			vector<int> t;
			int s = k-i-j;
			for(int f=0; f < i; f++)t.push_back(v[f]);
			for(int b=n-1; b > n-1-j; b--)t.push_back(v[b]);
			sort(all(t));
			rep(ss,s){
				if(t.size()==0)break;
				if(t[0] < 0)t.erase(t.begin());
				else break;
			}
			ans = max(ans,acc(t));
		}
	}
	cout << ans << endl;
}

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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i ,n) cin >> a[i];
    int m; cin >> m;
    vector<int> b(m);
    rep(i ,m) cin >> b[i];
    vector<int> result1;
    vector<int> result2;
    set_difference(a.begin(),a.end(),b.begin(),b.end(),inserter(result1,result1.end()));
    set_difference(b.begin(),b.end(),a.begin(),a.end(),inserter(result2,result2.end()));
    rep(i , result1.size()) result2.push_back(result1[i]);
    sort(result2.begin(),result2.end(),less<int>());
    for( auto x : result2 ){
        cout << x << endl;
    }
}


Measured memory_bytes: 7240
// #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
int solve(){
    int n, k, v,s=0;
    cin>>n>>k;
    priority_queue<int> q;
    while(n--){
      cin>>v;
      q.push(v);
      if(q.size()>k) q.pop();
    }
    while(!q.empty()){
      s+=q.top();
      q.pop();
    }
    return s;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << solve() << "\n";
  return 0;
} 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define yes "YES"
#define no "NO"
#define rsort(a) sort(a.rbegin(),a.rend())
const int mod=1000000007;
//void dfs(int i);
long long modular_expo(long long x,long long y);

bool cmp(pair<double,int>p1,pair<double,int>p2)
{
    if(p1.first>p2.first)
        return true;
    else
    {
        if(p1.first<p2.first)
            return false;
        else if(p1.first==p2.first)
        {
            if(p1.second<p2.second)
                return true;
            else
                return false;
        }
    }
}
/*bool cmp1(map<int,int>a,map<int,int>b)
{
    if(a.first<b.first)
        return true;
    else
        return false;
}*/
//ll m;


/*
void bsf(int t)
{
    queue<int>q;
    visited[t]=true;
    q.push(t);
    while(!q.empty())
    {
        int temp=q.front();
        //cout<<temp<<" ";
        if(temp==n)
            {
                vector<int>ans;
    ans.pb(n);
        int tttt=n;
    for(int i=0;i<tttt;i++)
    {
        ans.pb(parent[n]);
        n=parent[n];
        if(n==1)
            break;
    }
    if(n!=1)
    {
        break;
    }
    cout<<ans.size()<<endl;
    for(int i=ans.size()-1;i>=0;i--)
        cout<<ans[i]<<" ";
        f=1;

            }
        q.pop();
        //cout<<temp<<" ";
        for(auto i=l[temp].begin();i!=l[temp].end();i++)
        {
            if(!visited[*i])
            {
                q.push(*i);
                parent[*i]=temp;
                visited[*i]=true;
            }
        }
    }
}
*/
long long modular_expo(long long x,long long y)
{

    if(y==0)
        return 1;
    if(y%2==0)
        return (modular_expo((x*x),y/2));
    if(y%2==1)
        return ((x)*modular_expo((x*x),(y-1)/2));


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

    ll x,k,d,i,ans;
    cin>>x>>k>>d;
    x=llabs(x);
    i=x/d;
    if(i<=k)
    {
        ll a,b;
        a=x-(i)*d;
        i=k-i;
         b=x-k*d;
            b=llabs(b);
        if(i==0)
            {
                cout<<a<<endl;
                return 0;
            }

        if(i%2==0)
        {

            cout<<min(a,b);
        }
        else if(i%2==1)
        {
            if(min(a,b)==b)
            {
                cout<<min(a,b)<<endl;
            }
            else{
            cout<<min(min(a,b)+d,llabs(min(a,b)-d))<<endl;
            }
        }


    }
    else
    {
        cout<<llabs(x-k*d);
    }

}




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

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

            int N = int.Parse(Console.ReadLine());

            //var A = Console.ReadLine().Split(' ')
            //.Select(x => long.Parse(x)).ToList();
            Console.WriteLine(3.1416 * N * 2);
            


        }
       

    }
}


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

using namespace std;

void c()
{
    long long int n, y;
    cin >> n >> y;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= n; ++j) {
            long long int z = y - (long long int)(10000 * i) -(long long int)(5000 * j);
            if(z >= 0 && z % 1000 == 0)
            {
                if(i + j + (z / 1000) == n) {
                    cout << i << " " << j << " " << (z / 1000) << endl;
                    return;
                }
            }
        } 
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

void d()
{
    int n, h;
    cin >> n >> h;
    vector<pair<long long int, long long int>> knifes(n);
    vector<int> bs(n);
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        bs[i] = b;
        knifes[i] = {a, b};
    }
    sort(knifes.begin(), knifes.end());
    sort(bs.begin(), bs.end());
    vector<unsigned long long int> dp(n);
    dp[0] = bs.back();
    for(int i = 1; i < n; i++)
    {
        if(bs[n - i - 1] < knifes.back().first)
        {
            dp[i] = dp[i - 1] + knifes.back().first;
        }else{
            dp[i] = dp[i - 1] + bs[n - i - 1];
        }
    }
    int l = 0;
    int r = 1000000001;
    int minimum = r;
    while (r - l > 1)
    {
        int m = (r + l) / 2;
        bool can = false;
        if(m > n)
        {
            unsigned long long int result = dp[n - 1] + knifes.back().first * (m - n);
            if(result >= h)
            {
                can = true;
            }
        }else {
            for (int i = 0; i < m; i++) {
                unsigned long long int result = dp[i] + knifes.back().first * (m - i - 1);
                if(result >= h)
                {
                    can = true;
                    break;
                }
            }
        }
        if(can)
        {
            r = m;
            minimum = m;
        }else{
            l = m;
        }
    }
    cout << r << endl;
}

int main() {
    c();
    return 0;
}


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

long long int N, P, F, ans, l, i, j, k;

int main(void){
	scanf("%lld%lld", &N, &P);
	if(N==1){printf("%lld\n", P);return 0;}
	if(P==1){printf("1\n");return 0;}
	ans=1;
	j=0;while(P%2==0){P/=2;j++;}if(j/N!=0){for(k=0; k<j/N; k++){ans*=2;}}
	j=0;while(P%3==0){P/=3;j++;}if(j/N!=0){for(k=0; k<j/N; k++){ans*=3;}}
	j=0;while(P%5==0){P/=5;j++;}if(j/N!=0){for(k=0; k<j/N; k++){ans*=5;}}
	for(i=5, l=sqrt(P)+1; i<l; i+=6){
		j=0;while(P%i==0){P/=i;j++;}if(j/N!=0){for(k=0; k<j/N; k++){ans*=i;}}
		j=0;while(P%(i+2)==0){P/=(i+2);j++;}if(j/N!=0){for(k=0; k<j/N; k++){ans*=(i+2);}}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    bool isTrue = false;
    for(int i=0;i<=x;i++)
    {
        if(i*4+(x-i)*2==y)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cmath>

using namespace std;

int i,j,k,t,c,ax[51],ay[51],bx[51],by[51];
long long int n,a,b;

int main() {
	scanf("%lld",&n);
    for (i = 1;i <= floor(sqrt(n)) + 1;i++) {
    	if (n % i == 0) {
    		a = n / i;
    		k = 0;
    		while (a >= 10) {
    			a = a / 10;
    			k = k + 1;
    	    }
    		t = k + 1;
    	}
    }
    printf("%d\n",t);
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-

import sys
import numpy as np

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def bisearch_min(mn, mx, func):
    """ 条件を満たす最小値を見つける二分探索 """

    ok = mx
    ng = mn
    while ng+1 < ok:
        mid = (ok+ng) // 2
        if func(mid):
            # 下を探しに行く
            ok = mid
        else:
            # 上を探しに行く
            ng = mid
    return ok

N, K = MAP()
A = LIST()

def check(omit):
    # 部分和DP
    dp = np.zeros((N+1, K), dtype=np.bool)
    dp[0,0] = 1
    for i in range(N):
        # まとめて遷移
        dp[i+1] |= dp[i]
        if i != omit and A[i] < K:
            dp[i+1,A[i]:] |= dp[i,:K-A[i]]
    # 今回の値A[omit]を足してKに到達できるような部分和があれば、これは必要
    for j in range(max(0, K-A[omit]), K):
        if dp[N,j]:
            return True
    # なければ不要
    return False

A.sort()
print(bisearch_min(-1, N, check))


Measured memory_bytes: 38248
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
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 const INF = 1001001001;

struct BipartiteMatching {
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp;

  BipartiteMatching(int n) : graph(n), alive(n, 1), used(n, 0), match(n, -1), timestamp(0) {}

  void add_edge(int u, int v) {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int idx) {
    used[idx] = timestamp;
    for(auto &to : graph[idx]) {
      int to_match = match[to];
      if(alive[to] == 0) continue;
      if(to_match == -1 || (used[to_match] != timestamp && dfs(to_match))) {
        match[idx] = to;
        match[to] = idx;
        return true;
      }
    }
    return false;
  }

  int bipartite_matching() {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return ret;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      if(i < match[i]) {
        cout << i << "-" << match[i] << endl;
      }
    }
  }
};


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

int n; cin >> n;
vi a(n),b(n),c(n),d(n);
rep(i,n) cin >> a[i] >> b[i];
rep(i,n) cin >> c[i] >> d[i];

BipartiteMatching bm(2*n);

rep(i,n) {
    rep(j,n) {
        if(a[i] < c[j] && b[i] < d[j]) bm.add_edge(i, n+j);
    }
}
cout << bm.bipartite_matching() << endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  int e = 0;
  while(a > 0){
    int b,c,d;
    cin >> b >> c;
    d = c - b + 1;
    e += d;
    a--;
  }
  cout << e << endl;
}
    


Measured memory_bytes: 256