akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>//min/max/sort(rand-access it)/merge
#include <array>
#include <bitset>
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
#include <iomanip>//setfill/setw
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <list>
#include <queue>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <tuple>
#include <utility>//pair
#include <valarray>
#include <vector>

#define PRIME_SHORT 10007
#define PRIME 1000000007

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<ull, int> puli;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pllll;
typedef pair<ull, ull> pulul;
typedef pair<double, double> pdd;
typedef tuple<int, int, int> ti3;
typedef tuple<int, int, int, int> ti4;

const bool debug = false;

void rar(int n, int* a);
void rar2(int n, int m, int** a);

int ipow(int base, int exp);
int left(int current, bool swap);
int right(int current, bool swap);
int griddist(int x, int y, int s, int t);
int griddist(pii one, pii two);
double sqeucldist(double x, double y, double s, double t);
double sqeucldist(pii one, pii two);

int main(void) {
	string x;
	cin >> x;
	ul n = x.size();
	vector<bool> b;

	b.push_back(x[0] == 'S');

	for (int i = 1; i < n; ++i)
	{
		if (x[i] == 'T')
		{
			if(b.back())
			{
				b.erase(b.end() - 1);
			} else {
				b.push_back(false);
			}
		} else {
			b.push_back(true);
		}
	}



    //debug output
    if (debug)
    {
        //1D
        cout << "arr" << endl;
        for (vector<bool>::iterator it = b.begin(); it != b.end(); ++it)
        {
            cout << (*it);
        }
    }

    cout << b.size() << endl;

    return 0;
}

void rar(int n, int* a)
{
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    return;
}

void rar2(int n, int m, int** a)
{
    for (int i = 0; i < n; ++i)
    {
        a[i] = new int[m];
        for (int j = 0; j < m; ++j)
        {
            cin >> a[i][j];
        }
    }
    return;
}



















int ipow(int base, int exp) {
    int result = 1;
    while (exp)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        base *= base;
    }

    return result;
}
int griddist(int x, int y, int s, int t) {
    return abs(x-s) + abs(y-t);
}
int griddist(pii one, pii two) {
    return abs(one.first - two.first) + abs(one.second - two.second);
}
double sqeucldist(double x, double y, double s, double t) {
    double a = x-s;
    double b = y-t;
    return a*a+b*b;
}
double sqeucldist(pii one, pii two) {
    double a = one.first - two.first;
    double b = one.second - two.second;
    return a*a+b*b;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
    if (b==0) return a;
    else return gcd(b,a%b);
}

//最小公倍数, 複数の時はlcm(a,lcm(b,c))みたいな感じで
template <class T>
T lcm(T a,T b){
    return a*(b/gcd(a,b));
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll ans=1;
    rep(i,n){
        ll t;
        cin>>t;
        ans=lcm(ans,t);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	int n,a;
	cin>>n>>a;
	n =n%500;
	if(n<=a){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long x,y,z,i=0;
	cin>>x>>y>>z;
	while(i*y+(i+1)*z<=x)
	{
		i++;
	}
	printf("%lld\n",i-1);
}
	

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import java.util.stream.Stream;;

public class Main {

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

  public void run() {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = br.readLine().split(" ");
      // int  n = Integer.parseInt(lines[0]);
      long z = Long.parseLong(lines[1]);

      final Pattern delim = Pattern.compile(" ");
      long d = delim
        .splitAsStream(br.readLine())
        .mapToLong(Long::parseLong)
        .map(l -> l-z)
        .map(Math::abs)
        .reduce(Main::gcd)
        .getAsLong();
      
      System.out.println(d);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
  
  public static long gcd(long x, long y) {
    if( x<y ) {
      long tmp = x; x = y; y = tmp;
    }
    if( (x%y) == 0 ) return y;
    else return gcd(y,x%y);
  }
}

Measured memory_bytes: 38316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=100010, inf=2e9;

int n, k;
int A[MX];

int ceil(int x, int y){
    return (x+y-1)/y;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
    for(int i=1; i<=n; i++) cin>>A[i];
    cout<<ceil((n-k), k-1)+1;
    return 0;
}

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

signed main(){
  int N;
  cin>>N;
  if(N<1000)cout<<"ABC"<<endl;
  else cout<<"ABD"<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int r; cin >> r;
	cout << r * r << endl;
	return 0;
}

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

int main(){
  int N,decrease = 0;
  cin >> N;
  char S[100000];
  cin >> S;
  for(int i = 0;i < N - 1;i++){
    if(S[i] == S[i + 1])
      decrease++;
  }
  cout << N - decrease << endl;
  return 0;
}


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

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, ans=0;
    
    cin>>N;
    rep(i,N){
        int a,b; cin>>a>>b;
        ans+=(b-a+1);
    }
    cout1(ans)
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n, k;
int a[200000];

int Count(int x) {
	int i;
	
	int ret = 0;
	
	int ok, ng, mid;
	
	rep(i, n) {
		if (a[i] >= 0) {
			ok = -1; ng = n;
			while (ng - ok >= 2) {
				mid = (ok + ng) / 2;
				if (a[i] * a[mid] <= x) { ok = mid; }
				else { ng = mid; }
			}
			if (ok >= i) ret += ok;
			else ret += ok + 1;
			//cout << "ok = " << ok << endl;
			//cout << "ret = " << ret << endl;
		}
		else {
			ng = -1; ok = n;
			while (ok - ng >= 2) {
				mid = (ok + ng) / 2;
				if (a[i] * a[mid] <= x) { ok = mid; }
				else { ng = mid; }
			}
			if (ok <= i) ret += n - 1 - ok;
			else ret += n - ok;
			//cout << "ok = " << ok << endl;
			//cout << "Ret = " << ret << endl;
		}
	}
	//cout << "x = " << x << ", ret = " << ret << endl;
	return ret / 2;
}

signed main() {
	int i, j;
	
	cin >> n >> k;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	
	int INF = 2 * (1e+18);
	int st = -INF, ed = INF, mid;	//(st, ed]
	while (ed - st >= 2) {
		mid = (st + ed) / 2;
		if (Count(mid) < k) st = mid; //mid以下の数が何個？
		else ed = mid;
	}
	cout << ed << endl;
	return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 110000
ll n,m,k;
ll a[N];
ll b[N];
ll dp[200][N];
ll dp2[200][N];
int main(){
    n=in();
    m=in();
    dp[0][1]=1;
    rep2(i,1,m+1)dp2[0][i]=1;
    rep2(i,1,n){
        ll t=in();
        rep2(j,1,m+1){
            dp[i][j]=(MOD+dp2[i-1][j]-dp2[i-1][(int)max(0ll,(ll)j-t-1)])%MOD;
        }
        rep2(j,1,m+1){
            dp2[i][j]=(dp2[i][j-1]+dp[i][j])%MOD;
        }
    }
    cout<<dp[n][m+1];
    return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()


int main() {
  int a,b;

  cin >> a >> b;
  
  cout << max(max(a+b,a-b),a*b) << endl;
  
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map(String::toLong)
    val numList = (1..n.toLong()).map { it }

    val pList = (0 until n).map { aList[it] + numList[it] }
    val mList = (0 until n).map { -aList[it] + numList[it] }

    val pArray = LongArray(n + 1) { 0 }
    val mArray = LongArray(n + 1) { 0 }

    pList.forEach {
        try {
            pArray[it.toInt()]++
        } catch (e: IndexOutOfBoundsException) {
            //do nothing
        }
    }
    mList.forEach {
        try {
            mArray[it.toInt()]++
        } catch (e: IndexOutOfBoundsException) {
            //do nothing
        }
    }
    var ans = 0L
    for (i in 2..n) {
        ans += pArray[i] * mArray[i]
    }
    println(ans)
}

Measured memory_bytes: 94820
// Problem : C - Connect Cities
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ff         first
#define ss         second
#define endl       '\n'
#define pb         push_back
#define int        long long
#define vi         vector<int>
#define mii        map<int, int>
#define pii        pair<int, int>
#define all(x)     (x).begin(), (x).end()
#define fill(a,b)  memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define px(a)      for(auto x: a) cout<<x<<" "; cout<<'\n';
#define pxy(a,n)   rep(i,0,n) {px(a[i])};
/*_________________________________________________________*/

const long long MOD=1e9+7,N=1e5+5;
vector<vi> v(N);
vi vis(N);
void dfs(int u){
	vis[u]=1;
	for(int x: v[u]){
		if(!vis[x]) dfs(x);
	}
}
int solve()
{
	int n,m,ans=0; cin>>n>>m;
	rep(i,0,m){
		int x,y;
		cin>>x>>y;
		 x--,y--;
		v[x].pb(y);
		v[y].pb(x);
	}
	rep(i,0,n){
		if(!vis[i]){
			ans++;
			dfs(i);
		}
	}
	return max(ans-1,0ll);
}
int32_t main()
{	
	std::ios::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<solve()<<endl;
}

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

int main(){
    int n;
    cin>>n;
    map<int,int> d;
    for(int i=0;i<n;i++){
        int dd;
        cin>>dd;
        d[dd]++;
    }
    int m;
    cin>>m;
    bool isok=true;
    for(int i=0;i<m;i++){
        int t;
        cin>>t;
        if(d.count(t)){
            if(d[t]>0){
                d[t]--;
            }
            else{
                isok=false;
            }
        }
        else{
            isok=false;
        }
    }
    cout<<(isok?"YES":"NO")<<endl;
    return 0;
}

Measured memory_bytes: 9600
import java.math.*;
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int t = 1;
		while (t-->0) {
		    int n = sc.nextInt(), m = sc.nextInt();
		    System.out.println((n*(n-1)+m*(m-1))/2);
		}
	}
	static class Query {
		int x1, x2, y, id;
		public Query(int c, int d, int e, int a){
			x1 = c;
			x2 = d;
			y = e;
			id = a;
		}
	}
	static class Compare1 implements Comparator<Query>{
		@Override
		public int compare(Query q1, Query q2){
			if(q1.x2==q2.x2) return q1.x1-q2.x1;
			return q1.x2-q2.x2;
		}
	}
	static class Pair implements Comparable<Pair>{
		int a, b;
		public Pair(int c, int d){
			a = c;
			b = d;
		}
		public int compareTo(Pair p){
		    return a-p.a;
		}
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}
		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string S;cin >> S;
    sort(all(S));
    bool ans = false;
    if(S[0] == S[1])if(S[1] != S[2])if(S[2] == S[3])ans = true;
    if(ans){
        cout << "Yes" <<endl;
    }
    else{
        cout << "No" <<endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define MAX 105
#define int long long int
using namespace std;
int dp[102][100005];

int solve(int wt[], int val[], int N,int W)
{
    if(N <= 0)
        return 0;
    if(dp[N][W] != -1)
        return dp[N][W];
    
    if(wt[N-1] <= W)
    {
        return dp[N][W] = max(solve(wt,val,N-1,W-wt[N-1])+val[N-1], solve(wt,val,N-1,W));
    }
    else return dp[N][W] = solve(wt,val,N-1,W);
}

int32_t main()
{
    int N,W;
    cin >> N >> W;
    memset(dp,-1,sizeof(dp));
    int wt[N],val[N];
    for(int i = 0 ; i < N ; i++)
        cin >> wt[i] >> val[i];
    int ans = solve(wt,val,N,W);
    cout << dp[N][W];
    
    return 0;
}


Measured memory_bytes: 83256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
const ll mod = 998244353 ;
const double pi = acos(-1);
ll fastpow(ll b, ll e) {
    if (!e)
        return 1;
    ll ret = fastpow(b, e / 2);
    ret = (ret * ret) % mod;
    if (e % 2)
        ret = (ret * b) % mod;
    return ret;
}
ll modinv(ll x) {
    return fastpow(x, mod - 2);
}
double torad(double ang) {
    return ang * pi / 180.0;
}
int prime[N];
void sieve() {
    prime[0] = prime[1] = 1;
    for (int i = 2; i < N; i++) {
        if (!prime[i]) {
            for (int j = i; j < N; j += i)
                prime[j] = i;
        }
    }
}

int n, a[N], b[N], c[N];
int dp[N][5];
int main()
{
    ///smallest/largest case
    ///initialize
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d%d%d", &a[i], &b[i], &c[i]);
    dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];
    for (int i = 1; i < n; i++) {
        dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
    }
    /*
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++)
            cout << dp[i][j] << ' ';
        cout << '\n';
    }
    */
    printf("%d", max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]));
    return 0;
}


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

int main()
{
  int n;
  cin>>n;
  map<string,int> maps;
  
  int sum=0;
  for(int i=0;i<n;i++)
  {
    string str;
    cin>>str;
    if(!maps.count(str))
    {
      maps[str]=1;
      sum++;
    }
  }
  cout<<sum<<endl;
}
  

Measured memory_bytes: 19260
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string s,t,r;
    int n,a,b;
    cin>>s>>n;
    while(n--){
        cin>>t>>a>>b;
        if(t=="print")
            cout<<s.substr(a,b-a+1)<<endl;
        else if(t=="reverse")
            reverse(s.begin()+a,s.begin()+b+1);
        else {
            cin>>r;
            s.replace(a,b-a+1,r);
        }
    }
}

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

  #define vi vector<int>
  #define all(v) v.begin(),v.end()
  #define ll long long int
  #define  IOS    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define D1(x) {cerr<<" [" <<#x<<": "<<x<<"]";cout << endl;}
  #define D2(x) {cerr<<" [" <<#x<<": ";for(auto it:x)cerr<<it<< " ";cerr<<"] ";cout << endl;}

  const ll MOD=1e9+7;

  void solve(){
     int x;
     cin >> x;
     cout << (x<1200?"ABC":"ARC");
  }


  int main(){
    IOS
       solve();
  }
// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying


Measured memory_bytes: 256
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, k;
ll h[N];
ll dp[N];

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> k;
   dp[1] = 0;
   for (int i = 1; i <= n; i ++) cin >> h[i];
   for (int i = 2; i <= n; i ++) dp[i] = inf;
   for (int i = 1; i <= n; i ++) {
      for (int j = 1; j <= k; j ++) {
         if (i + j <= n) dp[i + j] = min (dp[i + j], dp[i] + abs (h[i] - h[i + j]));
      }
   }
   cout << dp[n];
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

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

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

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

	ll A, B, V, W; cin >> A >> V >> B >> W;
	ll T; cin >> T;
	ll X = abs(A - B);

	if (X <= T * (V - W)) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 3128
# スペース区切りの整数の入力
N,M = map(int, input().split())
LR_list=[]
Card_list=[]

Min_L = 1
Max_R = N

#LR読み込み
for i in range(M):
  L,R = map(int, input().split())
  if L>Min_L:
    Min_L=L
  if Max_R>R:
    Max_R=R

if Max_R >= Min_L:
  print(Max_R - Min_L + 1)
else:
  print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

int main ( void ) {
    ll n, m, ans = 0;
    cin >> n;
    for (ll k = 1; k < sqrt(n) + 1; k++){
        if (n % k == 0) {
            m = n / k - 1;
            if (m > 0 && n % m == k) ans += m;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
//@author :  |< U $ |-|
#include<iostream>
#include<vector>
#define TakeInput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;



int main(){
    
   // #ifnakeIdef ONLINE_JUDGE
    //Tnput
    //#endif
    
    int i,j,k,n,m,c;
    cin>>n;
    string a;
    cin>>a;
    int w[n];
    int count = 0 ;
    for(i=0;i<n;i++){
        if(a[i]=='R'){
            c++;
            w[c] = count;
        }
        else{
            count++;
        }
    }
    int mini = 1000000000;
    for(i=1;i<=c;i++){
        mini = min( mini , w[i]+(c-i) - min(w[i],(c-i)));
    }
   if(mini == 1000000000)cout<<0<<endl;
    else
    cout<<mini<<endl;

}
 
 
 

Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(){
	int n, num, sum = 1, x, y;
	bool flag = false;
	scanf("%d%d", &n, &x);
	for(int i = 1; i < n; ++i){
		//cout<<sum<<endl;
		scanf("%d", &y);
		if(y == x){
			x = y;
			continue;
		}
		if(!flag){
			if(y > x) num = 1;
			else num = 2;
			flag = true;
			x = y;
			continue;
		}
		if(y > x){
			if(num != 1){
				sum ++;
				flag = false;
			} 
			x = y;
		}else{
			if(num != 2){
				sum ++;
				flag = false;
			}
			x = y;
		}
	}
	//if(flag) sum ++;
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Complex

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

main :: IO ()
main = do
    [a,b,h,m] <- map fromIntegral <$> r' :: IO [Double]
    let a' = a :+ 0
        b' = b :+ 0
        i  = 0 :+ 1
        h' = i ** (4 * (60 * h + m) / (60 * 12) :+ 0)
        m' = i ** (4 * m / 60 :+ 0)
    print $ magnitude (a' * h' - b' * m')

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

int main () {
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c || a+c==b || b+c==a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 100010
#define LL long long
#define rep(i, x, y) for(int i = (x); i <= (y); ++ i)
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	} 
	return x * f;
}
int a[M];
vector<int> res;
int main() {
	//freopen("in.txt", "r", stdin);
	int n = read(), mx = -2e9, pos;
	rep(i, 1, n) a[i] = read();
//	printf("n :%d\n", n);
	LL A = 0, B = 0;
	rep(i, 1, n) if(a[i] > mx) {
		mx = a[i]; pos = i;
	}
	rep(i, 1, n) {
		if(a[i] > 0) {
			if(i & 1) A += a[i];
			else B += a[i];	
		}
	}
	if(mx <= 0) {
		printf("%d\n", mx);
		for(int i = n; i > pos; -- i) res.push_back(i);
		rep(i, 1, pos - 1) res.push_back(1);
		printf("%d\n", res.size());
		for(int i = 0; i < res.size(); ++ i) {
			printf("%d\n", res[i]);
		}
		return 0;
	}
	int fi = 0, en = 0;
	if(A > B) {
		for(int i = 1; i <= n; i += 2) {
			if(a[i] > 0) {
				en = i;
				if(!fi) fi = i;
			}
		}
	}
	else {
		for(int i = 2; i <= n; i += 2) {
			if(a[i] > 0) {
				en = i;
				if(!fi) fi = i;
			}
		}
	}
	printf("%lld\n", max(A, B));
	for(int i = n; i > en; -- i) res.push_back(i);
	rep(i, 1, fi - 1) res.push_back(1);
	for(int i = fi + 2; i <= en; i += 2) {
		if(a[i] <= 0) res.push_back(3);
		else res.push_back(2);
	}
	printf("%d\n", res.size());
	for(int i = 0; i < res.size(); ++ i) {
		printf("%d\n", res[i]);
	}
	return 0;
}


Measured memory_bytes: 256
s = str(input())
s_list = list(s)
t = str(input())
t_list = list(t)


i = 0
n = 0
for i in range(0, len(s_list)):
  if s_list[i] != t_list[i]:
    i += 1
    n += 1
  else:
    i += 1
  
print(int(n))

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

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

typedef long long ll;

ll INF = 100000000000000;
ll MOD = 1e9+7;

int dy[2]{1,0};
int dx[2]{0,1};

int H,W;
char field[1010][1010];
ll table[1010][1010];

ll dfs(int y,int x){
    if(table[y][x] != -1){
        return table[y][x];
    }
    if(y == H-1 && x == W-1){
        table[y][x] = 1;
        return table[y][x];
    }
    ll res = 0;
    for(int i = 0;i < 2;i++){
        int ny = y + dy[i],nx = x + dx[i];
        if(0 <= ny && ny < H && 0 <= nx && nx < W){
            if(field[ny][nx] != '#'){
                res += dfs(ny,nx);
                res %= MOD;
            }
        }
    }
    table[y][x] = res;
    return res;
}

int main(){
    cin >> H >> W;
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            cin >> field[i][j];
        }
    }
    for(int i = 0;i < 1010;i++){
        for(int j = 0;j < 1010;j++){
            table[i][j] = -1;
        }
    }
    cout << dfs(0,0) << endl;
}

Measured memory_bytes: 9344
#include <iostream>
typedef long long ll;
using namespace std;

int main()
{
    ll k,n,s,i;
    cin>>n>>k>>s;
    n-=k;
    for(i=1;i<=k;i++)
    {
        cout<<s<<' ';
    }
    if(s==1e9)
    {
        for(i=1;i<=n;i++)cout<<1<<' ';
    }
    else
    {
        for(i=1;i<=n;i++)cout<<s+1<<' ';
    }
    return 0;
}


Measured memory_bytes: 1280
#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(){
    string s;cin >> s;
    if((s[0]!=s[s.size()-1])==(s.size()%2))cout <<"First" <<endl;
    else cout << "Second" <<endl;
}   

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int n;
ll a[60];

bool is_ok(ll mid){
	ll sum=0;
	// x*n-(mid-x)>=a[i]-(n-1)
	REP(i, n){
		if(a[i]-(n-1)+mid-1>=0){
			sum+=(a[i]-(n-1)+mid-1)/(n+1)+1;
		}
		if(sum>mid){
			return false;
		}
	}
	return sum<=mid;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	cin>>n;
	REP(i, n){
		cin>>a[i];
	}
	ll lb=-1, ub=1e18;
	while(ub-lb>1){
		ll mid=(lb+ub)/2;
		if(is_ok(mid)){
			ub=mid;
		}
		else{
			lb=mid;
		}
	}
	// DEBUG(ub);
	ll ans=0;
	// ubの近いところが答えだと信じて適当にループを回す
	for(ll i=max(0ll, ub-500); i<ub+1; ++i){
		if(is_ok(i)){
			ans=i;
			break;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
vector<pair<int,int> > v[32];
int sum[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		int p,q,r;scanf("%d%d%d",&p,&q,&r);
		r--;
		v[r].push_back(make_pair(p,q));
	}
	for(int i=0;i<b;i++){
		std::sort(v[i].begin(),v[i].end());
	}
	for(int i=0;i<b;i++){
		int fi=-1;
		for(int j=0;j<v[i].size();j++){
			if(fi==-1)fi=v[i][j].first;
			if(j+1==v[i].size()||v[i][j].second<v[i][j+1].first){
				sum[v[i][j].second+1]--;
				sum[fi]++;
		//		printf("%d %d\n",v[i][j].first,v[i][j].second+1);
				fi=-1;
			}
		}
	}
	for(int i=0;i<105000;i++)sum[i+1]+=sum[i];
	int ret=0;
	for(int i=0;i<105000;i++)ret=max(ret,sum[i]);
		printf("%d\n",ret);
}

Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>



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

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

  cout<<max(0LL,c-(a-b))<<endl;

}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int count = 0;
	for (int i = a; i <= b; i++)
	{
		if (c % i == 0)
			count++;
	}
	cout << count << endl;
}




Measured memory_bytes: 3096
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vvint nei(n);
    REP(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        nei[a].pb(b);
        nei[b].pb(a);
    }
    priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > pq;
    vint dep(n,INF);
    dep[0] = 0;
    vint par(n);
    par[0] = -1;
    pq.push(make_pair(0,0));
    while(!pq.empty()){
        auto p = pq.top();
        pq.pop();
        int now = p.se;
        for(int i:nei[now]){
            if(dep[i]>dep[now]+1){
                dep[i] = dep[now]+1;
                pq.push(make_pair(dep[i],i));
                par[i] = now;
            }
        }
    }
    cout << "Yes" << endl;
    REP(i,n-1){
        cout << par[i+1]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 11096
#include <iostream>
using namespace std;
using ull = unsigned long long;

int main() {
	ull N, A, B;
	cin >> N >> A >> B;
	
	ull dif = (A > B) ? A - B : B - A;
	ull ans = 0;
	
	if(dif % 2 == 0) {
		ans = dif / 2;
	} else {
		ull L = max(A, B);
		ull S = min(A, B);
		ans = min(S - 1, N - L) + (L - S) / 2 + 1;
	}
	
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define ll long long
using namespace std;

int main()
{
	ll n;
	cin >> n;
	ll sum = 0;
	vector<ll> a(n);
	for (auto& i : a) {
		cin >> i;
		sum += i;
	}

	ll half = sum / 2;
	ll tempSum = 0;
	ll halfIndex = 0;
	for (ll i = 0; i < n;++i) {
		tempSum += a[i];
		if (half <= tempSum) {
			halfIndex = i;
			break;
		}
	}

	ll ret = 2 * tempSum - sum;
	ll ret2 = 2* (sum - (tempSum - a[halfIndex])) - sum;
	if (ret2 < ret) {
		ret = ret2;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 1792
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int itemCount = int.Parse(Reader.ReadLine());
        this.Items = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
        long total = Items.Sum();
        long subtotal = Items[0];
        long ans = Math.Abs((total-subtotal)-subtotal);
        for (int i = 1; i < itemCount-1; i++) {
            subtotal += this.Items[i];
            ans = Math.Min(ans, Math.Abs((total-subtotal)-subtotal));
        }
        Console.WriteLine(ans);
    }



    private long[] Items;


	public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"
 

2
10 -10

";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 35768
#include <bits/stdc++.h>
using namespace std;
int main(){
long H,W;
  cin>>H>>W;
  if(H==1||W==1)cout<<1<<endl;
 else if(H%2==0||W%2==0)cout<<H*W/2<<endl;
  else cout<<(H*W+1)/2<<endl;
}

Measured memory_bytes: 256
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        System.out.println(IntStream.range(0, scanner.nextInt())
                .boxed()
                .collect(Collectors.groupingBy(i -> scanner.nextInt(), Collectors.reducing(false, i -> true, (a, b) -> a ^ b)))
                .values().stream()
                .filter(Boolean::booleanValue)
                .count());
    }
}

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

using namespace std;
int main(void){
    // Your code here!
    int N, W;
    cin >> N >> W;
    int dp[N+1][W+1];
    int v[N], w[N];
    
    
    
    for(int i = 0; i < N; i++){
        cin >> v[i] >> w[i];
    }
    
    dp[0][0] = 0;
    for(int i = 0; i <= W; i++) dp[0][i] = 0;
    for(int i = 1; i <= N; i++) dp[i][0] = 0;
    
    for(int i = 0; i < N; i++){
        for(int j = 1; j <= W; j++){
            if(j- w[i] >= 0){
                dp[i+1][j] = max(dp[i][j], dp[i+1][j - w[i]] + v[i]);
            } else{
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    
    cout << dp[N][W] << endl;
}



Measured memory_bytes: 7044
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1000000007, INF = 1e9;

int main()
{
    int h, w, n;
    cin >> h >> w >> n;
    int m = max(h, w);
    int ans = 0;
    while(n > 0){
        ans++;
        n -= m;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <cstdio>
int arr[100005], que[100005], he = 0, ta = 0;
long long dp[100005], mn = 1e18;
int main()
{
	// freopen("AGC007-D.in", "r", stdin);
	int n, e, t;
	scanf("%d%d%d", &n, &e, &t);
	for (int i = 1; i <= n; i++)
		scanf("%d", arr + i);
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 1, cur = 0; i <= n; i++)
	{
		while (cur < i && (arr[i] - arr[cur + 1] << 1) >= t)
		{
			if (he <= ta && que[he] == cur)
				he++;
			mn = std::min(mn, dp[cur] - (arr[cur + 1] << 1));
			cur++;
		}
		dp[i] = mn + (arr[i] << 1);
		if (he <= ta)
			dp[i] = std::min(dp[i], dp[que[he]] + t);
		while (he <= ta && dp[que[ta]] >= dp[i])
			ta--;
		que[++ta] = i;
	}
	printf("%lld\n", dp[n] + e);
	return 0;
}


Measured memory_bytes: 1664
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  string s;
  cin>>s;
  int k;
  cin>>k;

  int dp[101][2][4]={};
  dp[0][0][1]=1;
  dp[0][1][1]=s[0]-'0'-1;
  dp[0][1][0]=1;

  for(int i=1;i<s.size();i++){
    for(int c=0;c<=3;c++){
      dp[i][1][c]=dp[i-1][1][c];
      if(s[i]!='0'){
        dp[i][1][c]+=dp[i-1][0][c];
      }
      if(c>0){
        dp[i][1][c]+=dp[i-1][1][c-1]*9;
        if(s[i]!='0'){
          dp[i][1][c]+=dp[i-1][0][c-1]*(s[i]-'0'-1);
        }
      }
      if(s[i]=='0'){
        dp[i][0][c]=dp[i-1][0][c];
      }else{
        if(c>0){
          dp[i][0][c]=dp[i-1][0][c-1];
        }
      }

    }


  }

  cout<<dp[s.size()-1][0][k]+dp[s.size()-1][1][k]<<endl;

  return 0;
}




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

/* -------------------------------- Template -------------------------------- */

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }



/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  ll res = 2e18;
  if (a % 2 == 0) res = 0;
  if (b % 2 == 0) res = 0;
  if (c % 2 == 0) res = 0;
  chmin(res, a * b);
  chmin(res, a * c);
  chmin(res, c * b);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif
 
using namespace std;
 
 
int main(){
    //int n;
    vector<bool> flag(27,false);
    string s;
    cin >> s;

    for(int i=0;s[i] != '\0';i++){
        flag[s[i] - 'a'] = true;
    }

    for(int i = 0;i<26;i++){
        if(!flag[i]){
            cout << (char)(i+'a');
            break;
        }
        else if(i==25) cout << "None";
    }

    //cout << (flag ? "Yes" : "No") << endl;
    //cout << ans << endl;
    //printf("%.10f",ans_d);

    cout << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int a[100000];
	int s[100000];
	for(int i=0;i < 100000;i++)
	{
		s[i] = 0;
	}
	cin >> n;
	for(int i=0;i < n;i++)
	{
		cin >> a[i];
		if(a[i] >= 1) s[a[i] - 1]++;
		s[a[i]]++;
		if(a[i] <= 99999) s[a[i] + 1]++;
	}
	sort(s,s + 100000,greater<int>());
	cout << s[0] << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int a,b,c,d,e,f,g;
    scanf("%d%d%d",&a,&b,&c);
    
    { if(a>b)
        { d=a;
            a=b;
            b=d; } }
    { if(b>c)
        { e=b;
          b=c;
          c=e;
        }}
    { if(a>c)
        { f=a;
          a=c;
          c=f;}}
    { if(a>b)
        { g=a;
          a=b;
          b=g;
        }}
    printf("%d %d %d\n",a,b,c);
    return 0;
    
}


Measured memory_bytes: 2052
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

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

#define INF 1000000000
#define F first
#define S second
#define forn(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)

using namespace std;

int a[1234];

int main(){
	int n;
	scanf("%d", &n);
	rep(i,n) scanf("%d", &a[i]);
	sort(a,a+n);
	int sum = 0;
	rep(i,n) sum += a[i];
	int j = 0;
	if(sum % 10 == 0){
		while(j < n && a[j] % 10 == 0) j++;
		if(j == n) printf("0\n");
		else printf("%d\n", sum - a[j]);
	}
	else printf("%d\n", sum);
		

	return 0;
}


Measured memory_bytes: 128