akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;
#define X first
#define Y second

const int N = 10005;
ll a[N], b[N];

void go() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int j = 0; j < n; j++) cin >> b[j];
	// sort(a,a+n); sort(b,b+n);
	ll x,y;
	x = y = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] < b[i]) {
			x += (b[i]-a[i])/2;
			if((b[i]-a[i])%2) {
				x++;
				y++;
			}
		} else {
			y += a[i] - b[i];
		}
	}
	// for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
	// for(int i = 0; i < n; i++) cout << b[i] << " "; cout << endl;
	// cout << x << " " << y << endl;
	if(x>=y) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}



Measured memory_bytes: 384
n = gets.chomp.to_i
h = gets.chomp.split().map(&:to_i)

(n-1).downto(1).each do |i|
  if h[i-1] - h[i]  == 1
    h[i-1] -= 1
  elsif h[i-1] - h[i] >= 2
    puts 'No'
    exit
  end
end

puts 'Yes'


Measured memory_bytes: 9604
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>

 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

int main(void){
    int N;
    char s[200004];
    scanf("%d",&N);
    scanf("%s",s);
    int cntb[200004];
    int cntw[200004];
    int ans=INF;
    rep(i,N+1){
        if(i==0){
            cntb[i]=0;
        }else{
            if(s[i-1]=='#'){
                cntb[i]=cntb[i-1]+1;
            }else{
                cntb[i]=cntb[i-1];
            }
        } 
    }
    for(int i=N;i>-1;i--){
        if(i==N){
            cntw[i]=0;
        }else{
            if(s[i]=='.'){
                cntw[i]=cntw[i+1]+1;
            }else{
                cntw[i]=cntw[i+1];
            }
        }
    }
    rep(i,N+1){
        ans=min(ans,cntb[i]+cntw[i]);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 1920
// Problem : A - Calc
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//mst,pq,mp,st,q
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int a;
		cin>>a;
		cout<<(a+a*a+a*a*a);		
    }
    return 0;
}


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

typedef long long ll;

int main() {
    //freopen("in.txt", "r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;
    ll d[n+1];

    int f = 1;
    int m1 = 0;
    for (int i=1;i<=n;++i){
        cin>>d[i];
        m1 += f*d[i];
        f *= -1;
    }
    cout<<m1<<" ";
    int prev = m1;
    for (int i=2;i<=n;++i){
        int m = (d[i-1] - prev/2)*2;
        cout<<m<<" ";
        prev = m;
    }

    return 0;
}

Measured memory_bytes: 2176
// Author : Rifayat Samee (Sanzee)
// Problem :
// Algorithm:

/*

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

int main(){

	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
    string a,b;
    cin >> a;
    cin >> b;
    int n= a.size();
    int m = b.size();
    //printf("%d %d\n",n,m);
    //vector<vector<int>>dp(n+5,vector<int>(m+5,0));
    vector<vector<int>>dp(n+1,vector<int>(m+1,0));
    vector<vector<int>>path(n+1,vector<int>(m+1,0));
    for(int i=0;i<n;i++){
        for(int j = 0;j<m;j++){
            if(a[i] == b[j]){
                dp[i][j] = 1 + ((i-1>=0 && j-1>=0)?dp[i-1][j-1]:0);
                path[i][j] = 1;
            }
            else{
                int r1 = ((i-1)>=0 ? dp[i-1][j]:0);
                int r2 = ((j-1)>=0 ? dp[i][j-1]:0);
                dp[i][j] = max(r1,r2);
                if(r1 > r2) path[i][j] = 2;
                else
                    path[i][j] = 3;
            }
        }
    }
    //printf("%d\n",dp[n-1][m-1]);
	string res = "";
	int i = n-1;
	int j = m-1;
	while(i>=0 && j>=0){
        if(path[i][j] == 1){
            res.push_back(a[i]);
            i--;
            j--;
        }
        else if(path[i][j] == 2){
            i--;
        }
        else{
            j--;
        }
	}
	reverse(res.begin(),res.end());
	cout << res <<endl;
	return 0;
}


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

int main(){
  int D,T,S;
  cin >> D >> T >> S;
//  cout << D << " " << T << " " << S << endl;
  
  string result;
  if (D <= T*S) {
    result = "Yes";
  } else {
    result = "No";
  }
  
  cout << result << endl;
  
  return 0;
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;

const int MAXM = 30;
const int MAXN = 60;

int n, m;

int pai[MAXN];
int val[MAXN];
int LCA[MAXN];
int sub[MAXN];

lli pot[MAXN];

pii request[MAXM];

vector< int > adj[MAXN];

void DFSInit(int cur, int p)
{
	for(int i = 0 ; i < adj[cur].size() ; i++)
	{
		int viz = adj[cur][i];

		if( viz == p ) continue;

		pai[viz] = cur;
		DFSInit( viz , cur );
	}
}

void DFSCalculate(int cur)
{
	sub[cur] = val[cur];

	for(int i = 0 ; i < adj[cur].size() ; i++)
	{
		int viz = adj[cur][i];

		if( viz != pai[cur] )
		{
			DFSCalculate( viz );
			sub[cur] += sub[viz];
		}
	}
}

int getLCA(int U, int V)
{
	memset( val , 0 , sizeof(val) );

	while( pai[U] != 0 )
	{
		val[U] = 1;
		U = pai[U];
	}

	while( pai[V] != 0 && val[V] == 0 )
		V = pai[V];

	return V;
}

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

	pot[0] = 1;

	for(int i = 1 ; i <= n ; i++)
		pot[i] = pot[i - 1]*2;

	for(int i = 1 ; i < n ; i++)
	{
		int U, V;
		scanf("%d %d",&U,&V);

		adj[U].push_back( V );
		adj[V].push_back( U );
	}

	DFSInit( 1 , 0 );

	scanf("%d",&m);

	for(int i = 0 ; i < m ; i++)
	{
		int U, V;
		scanf("%d %d",&U,&V);

		request[i] = { U , V };
		LCA[i] = getLCA( U , V ); 
	}

	lli ans = 0;

	for(int mask = 0 ; mask < (1 << m) ; mask++)
	{
		int sz = __builtin_popcount( mask );

		memset( val , 0 , sizeof(val) );

		for(int i = 0 ; i < m ; i++)
		{
			if( !( mask & (1 << i) ) ) continue;

			val[ LCA[i] ] -= 2;
			val[ request[i].first ]++;
			val[ request[i].second ]++;
		}

		DFSCalculate( 1 );

		int qtd = 0;

		for(int i = 2 ; i <= n ; i++)
			if( sub[i] == 0 ) qtd++;

		if( sz%2 == 0 ) ans += pot[qtd];
		else ans -= pot[qtd];
	}

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

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

#define ll long long
const int mod = 1e9+7 ;

int main(){
	int a , b , c , k ; 
	cin >> a >> b >> c >> k ;
	
	int res = 0 ;
	
	if( k >= a && k > 0 ){
		res = a ;
		k = k - a ;
	}
	else{
		cout << k << endl ; 
		return 0 ;
	}
	if( k >= b && k > 0 ){
		k = k - b ;
	}
	else {
		cout << res << endl ;
		return 0 ;
	}
	cout << res - k << endl ;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

ll dp[3001][3001][2];
vector<int> a;

ll fun(int l,int r,int c){
	if(r<l)
		return 0;
	ll &ans = dp[l][r][c];
	if(dp[l][r][c]!=1e17)
		return dp[l][r][c];

	if(!c)
		ans = max(a[l]+fun(l+1,r,!c),a[r]+fun(l,r-1,!c));
	else
		ans = min(-a[l]+fun(l+1,r,!c),-a[r]+fun(l,r-1,!c));

	return ans;
}

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	for(int i=0;i<3001;++i)
		for(int j=0;j<3001;++j)
			dp[i][j][0]=dp[i][j][1]=1e17;
	int n;
	cin>>n;
	a.resize(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	cout<<fun(0,n-1,0);

	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define FASTIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N = 200005, M = 1000000007, BIG = 0x3f3f3f3f;

int ct = 0;
list<char> a;
string s;
int n;
int q;

bool Read() {
  cin >> s;
  if (cin.eof())
    return 0;
  n = s.length();
  a.clear();
  for (int i = 0; i < n; i++)
    a.push_back(s[i]);
  cin >> q;

  return 1;
}

void Process() {
  int op, beg;
  char c;
  bool rev = 0;
  for (int i = 0; i < q; i++) {
    cin >> op;
    if (op == 1) 
      rev = !rev;
    else {
      cin >> beg >> c;
      if (beg == 1) {
        if (rev)
          a.push_back(c);
        else
          a.push_front(c);
      }
      else {
        if (rev)
          a.push_front(c);
        else
          a.push_back(c);
      }
    }
  }
  if (rev)
    a.reverse();
  for (char x : a)
    cout << x;
  cout << "\n";
}

int main() {
  FASTIO();

  while (Read())
    Process();

  return 0;
}

Measured memory_bytes: 10064
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int a =0;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<s.size();j++){
      if(s.at(i) == s.at(j) && i <j){
        a++;
        }
        }
        }
  if(a== 0){
    cout<<"yes"<<endl;
    }
    else{
      cout<<"no"<<endl;
      }
      }
    
        

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define MOD 998244353

ll pows(ll a, ll b)
{
  ll left=b;
  ll ans=1;
  ll ks=a;
  while(left>0)
  {
    if(left%2==1)
    {
      ans=ans*ks%MOD;
    }
    left/=2;
    ks=ks*ks%MOD;
  }
  return ans;
}

ll mod_inv(ll a)
{
  return pows(a, MOD-2);
}

int main()
{
  int n,s;cin>>n>>s;
  vector<int> a(n);
  int i,j;
  rep(i,n)cin>>a[i];
  vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
  dp[0][0]=1;
  rep(i,n)
  {
    rep(j,s+1)
    {
      dp[i+1][j]+=dp[i][j];
      if(j-a[i]>=0)
      {
        dp[i+1][j]+=dp[i][j-a[i]]*mod_inv(2);
      }
      dp[i+1][j]%=MOD;
    }
  }
  dp[n][s]*=pows(2,n);
  dp[n][s]%=MOD;
  cout<<dp[n][s]<<endl;
}


Measured memory_bytes: 73760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.OptionalInt;
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))) {

      int n = Integer.parseInt(br.readLine());
      String line = br.readLine();
      final Pattern delim = Pattern.compile(" ");
      int[] arrayS = delim
        .splitAsStream(line)
        .mapToInt(Integer::parseInt)
        .toArray();

      OptionalInt max =
        Arrays.stream(arrayS).max();

      dispIntArray( countingSort(arrayS, max.getAsInt()) );
    }
    catch ( IOException e ) {
      System.out.println("IOException!");
    }

  }

  public int[] countingSort(int[] a, int k) {

    int   aLength = a.length;
    int[] result  = new int[aLength];
    int[] counter = new int[k+1];

    for (int var : a) {
      counter[var]++;
    }

    for (int i=1, max=k+1; i < max; i++) {
      counter[i] += counter[i-1];
    }

    for (int i=aLength-1, val=0; i>=0; i--) {
      val = a[i];
      result[counter[val]-1] = val;
      counter[val]--;
    }

    return result;
  }

  public void dispIntArray(int[] target) {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


Measured memory_bytes: 169212
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string S; cin >> S;
    string ACGT = "ACGT";
    int len = (int)S.length();
    for(int i = 0; i < len;i++){
        for(int j = i; j < len;j++){
            if(ACGT.find(S[j])==string::npos) break;
            res = max(res,(ll)(j-i+1));
        }
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

ll solve() {
    ll K, N;
    cin >> K >> N;
    vector<ll> A(N+1);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    A[N] = K + A[0];
    ll m = 0;
    for ( int i = 0; i < N; i++ ) {
        m = max(m,A[i+1]-A[i]);
    }
    ll ans = K - m;
    return ans;
}

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

Measured memory_bytes: 1792
N = gets.to_i
A = gets.split.map(&:to_i)
orign = A.inject(&:+)
B = gets.split.map(&:to_i)

N.times do |i|
  if A[i] >= B[i]
    A[i] -= B[i]
  else
    B[i] -= A[i]
    A[i] = 0
    if A[i+1] <= B[i]
      A[i+1] = 0
    else
      A[i+1] -= B[i]
    end
  end
end

puts orign - A.inject(&:+)

Measured memory_bytes: 15380
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eps 1e-15

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef tuple<int,int,int> ti3;

void Main()
{
	int N, D; cin >> N >> D;
	int X[15][15];
	rep(i, N)
	{
		rep(j, D)
		{
			cin >> X[i][j];
		}
	}
	int ans = 0;
	rep(i, N)
	{
		REP(j, i+1, N)
		{
			int temp = 0;
			rep(k, D)
			{
				temp += pow((X[i][k] - X[j][k]), 2.0);
			}
			double temp2 = sqrt(temp);
			if (floor(temp2) == ceil(temp2)) {
				++ans;
			}
		}
	}
	cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


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

using namespace std;

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n,x;cin>>n>>x;
  int m,a=1000,ans=0;
  for (int i = 0; i < n; ++i){
  	cin>>m;
  	a=min(m,a);
  	x-=m;
  }
  cout<<x/a+n<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mx=1001,mod =1e9+7;
ll dp[mx][mx];
int main()
{
    int h,w;
    char ch;
    cin>>h>>w;
    dp[1][0]=1;
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            cin>>ch;
            if(ch=='.')
                dp[i][j] = dp[i-1][j] + dp[i][j-1];
            dp[i][j]%=mod;
        }
    }
    cout<<dp[h][w]<<endl;
}


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

int ans[1005][1005][3];
char JOI[1005][1005];
int main(){
    //cout<<endl;
    int m,n,k;
    char ch[3] =  {'J','O','I'};
    cin>>m>>n;
    cin>>k;
    for(int i=1; i<=m; i++) for(int j=1; j<=n; j++) cin>>JOI[i][j];
    int color[3]={0,0,0};
    for(int i=1; i<=m; i++) for(int j=1; j<=n; j++){
            for(int k=0; k<3; k++){
                if(JOI[i][j]==ch[k]) color[k]++;
                ans[i][j][k]=color[k];
            }
    }
    ans[0][0][0]=ans[0][0][1]=ans[0][0][2]=0;
    ans[1][0][0]=ans[1][0][1]=ans[1][0][2]=0;
    for(int i=2; i<=m; i++){
        for(int j=0; j<3; j++) ans[i][0][j]=ans[i-1][n][j];
    }
    for(int i=0; i<k; i++){
        int key[3]={0,0,0};
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        for(int i=0; i<3; i++){
            for(int j=a; j<=c; j++){
                key[i]+=(ans[j][d][i]-ans[j][b-1][i]);
                //cout<<"ans["<<j<<"]["<<d<<"]["<<i<<"] - "<<"ans["<<j<<"]["<<b-1<<"]["<<i<<"] = " <<ans[j][d][i]-ans[j][b-1][i]<<endl;
            }
        }
        for(int i=0; i<3; i++) {if(i)cout<<" "; cout<<key[i];}
        cout<<endl;
    }
}

Measured memory_bytes: 15636
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll n,m;
    cin>>n>>m;
    ll ans=(n*(n-1))/2 + (m*(m-1))/2;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
def resolve():
    S = input()
    ansmax = 0
    anstmp = 0
    for i in S:
        if i == "A" or i == "T" or i == "G" or i == "C":
            anstmp = anstmp + 1 
            ansmax = max(ansmax,anstmp)
        else: 
            ansmax = max(ansmax,anstmp)
            anstmp = 0
    print(ansmax)
resolve()

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

int main(){
  int N;
  long long D; cin >> N >> D;
  int count=0;
  for(int i=0; i<N; i++){
    long long X,Y; cin >> X >> Y;
    if(X*X+Y*Y<=D*D) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3616
int G(x,y){return y?G(y,x%y):x;}
main(Y,x,y,z,t,f){for(;~scanf("%d%d",&x,&y);){
Y=y;y/=G(x,y);
for(z=0;y%2==0;y/=2)z++;
for(f=0;y%5==0;y/=5)f++;
if(z>f)f=z;
if(y==1)t=0;else{z=1;t=0;do{z=z*10%y;t++;}while(z!=1);}
for(z=0;z<f+t;z++)putchar(x*10/Y+48),x=x*10%Y;puts("");
if(t){for(;f>0;f--)putchar(' ');for(;t>0;t--)putchar('^');puts("");}
}exit(0);}

Measured memory_bytes: 584
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.nextLine());
		String str = scan.nextLine();
		String[] num_str = str.split(" ");
		int[] num = new int[10000];
		int min = 0;
		int max = 0;
		long sum = 0;

		for(int i = 0; i < n; i++){
			num[i] = Integer.parseInt(num_str[i]);
			sum += num[i];
			if(i == 0){
				min = num[i];
				max = num[i];
			}
			if(num[i] < min){
				min = num[i];
			}
			if(max < num[i]){
				max = num[i];
			}
		}
		System.out.println(min + " "+ max + " "+ sum);
	}
}


Measured memory_bytes: 31732
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 998244353, N = 3e3 + 10; 

int n,s;
int dp[N][N];
int vis[N][N];
int A[N];

int dfs(int i,int sm){
   if(sm < 0) return 0;
   if(i == n){
      if(sm == 0) return 1;
      else return 0;
   }
   if(vis[i][sm]) return dp[i][sm];
   vis[i][sm] = 1;
   dp[i][sm] = 2*dfs(i+1,sm)+dfs(i+1,sm-A[i]);
   dp[i][sm] %= MOD;
   return dp[i][sm];
}


int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cin >> n >> s;
   f(i,0,n){
      cin >> A[i];
   }
   cout << dfs(0,s) << '\n';
   return 0;
}

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

int main(){
  
  int n;
  
  cin >> n;
  vector<int> A(n);
  for(int i = 0;i < n;i++) cin >> A[i];
  
  A.erase(unique(A.begin(), A.end()), A.end());
  for(int i = 0;i < A.size();i++){
    cout << (i?" ":"");
    cout << A[i];
  }
  cout << endl;
  
  return 0;
}


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

#define all(x) x.begin(), x.end()
#define int long long
#define ll long long
#define ins insert
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define ld long double
#define rsz resize
#define pii pair<int, int>

using namespace std;

mt19937 rnd(time(nullptr));

const long long INF = 1e18;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, a, b;
    cin >> n >> a >> b;
    if (a > b) {
        swap(a, b);
    }
    if ((b - a) % 2 == 0) {
        cout << (b - a) / 2;
        return 0;
    }
    cout << min(n - b + 1 + (b - a - 1) / 2, a - 1 + 1 + (b - a - 1) / 2);
    return 0;
}


Measured memory_bytes: 256
def io_tmp():
    global input
    import io
    f = io.StringIO(open(0).read())
    input = f.readline

io_tmp()


from scipy.sparse.csgraph import floyd_warshall
import numpy as np

N, M, L = map(int, input().split())
graph = [[0] * N for _ in range(N)]
for _ in range(M):
    s, t, w = map(int, input().split())
    if w <= L:
        graph[s-1][t-1] = graph[t-1][s-1] = w
dist = floyd_warshall(graph, directed=False)
graph = dist <= L
#np.fill_diagonal(graph, 0)
#graph[dist > L] = 0
dist = floyd_warshall(graph, directed=False)
dist[dist == np.inf] = 0.0
dist = dist.astype(np.int)

Q = int(input())
ans = []
for _ in range(Q):
    s, t = map(int, input().split())
    ans.append(dist[s-1][t-1] - 1)
print(*ans, sep='\n')


Measured memory_bytes: 26440
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a + b == 15) System.out.println("+");
        else if(a * b == 15) System.out.println("*");
        else System.out.println("x");
    } 
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin >> n;
  long long i=1;
  if(n==1||n==2){
    cout << 4;
    return
0
      
      
      
      
      ;
  }
  while(1){
    if(n==4){
      cout << i+3;
      return 0;
    }
    if(n%2==0)n/=2;
    else n=n*3+1;
    i++;
  }
}


Measured memory_bytes: 256
def f(a,d,T):
    try:
        return T[d+1:].index(a)+(d+1)
    except ValueError:
        return len(T)

def g(a,d,T):
    try:
        return (d-1)-T[d-1::-1].index(a)
    except ValueError:
        return 0

A=26

D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))

T=[0]
for i in range(D):
    T.append(int(input()))
            
X=0
L=[0]*(A+1)
R=[[0]*(A+1) for _ in range(D+1)]
for d in range(1,D+1):
    X+=S[d][T[d]]
    for j in range(1,A+1):
        if j!=T[d]:
            L[j]+=1
            R[d][j]=R[d-1][j]+1
            X-=C[j]*L[j]
        else:
            L[j]=0

M=int(input())
for _ in range(M):
    d,q=map(int,input().split())
    p=T[d]

    Y=(d-g(p,d,T))*(f(p,d,T)-d)
    Z=R[d][q]*(f(q,d,T)-d)
    
    h=R[d-1][p]
    for i in range(d,f(p,d,T)):
        h+=1
        R[i][p]=h

    m=0
    for j in range(d,f(q,d,T)):
        R[j][q]=m
        m+=1
    
    T[d]=q
    X+=(S[d][q]-S[d][p])+Z*C[q]-Y*C[p]
    print(X)


Measured memory_bytes: 77060
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		long x = inputs.nextInt();
		long y = inputs.nextInt();
		int red = inputs.nextInt();
		int[] r = new int[red];
		int green = inputs.nextInt();
		int[] g = new int[green];
		int clear = inputs.nextInt();
		int[] c = new int[clear];
		for(int i=0;i<red;i++) {
			r[i] = inputs.nextInt();
		}
		Arrays.sort(r);
		for(int i=0;i<green;i++) {
			g[i] = inputs.nextInt();
		}
		Arrays.sort(g);
		for(int i=0;i<clear;i++) {
			c[i] = inputs.nextInt();
		}
		Arrays.sort(c);
		PriorityQueue<Integer> app = new PriorityQueue<Integer>();
		long sum =0;
		for(int i=(int)(red-x);i<red;i++) {
			sum+=r[i];
			app.add(r[i]);
		}
		for(int i=(int) (green-y);i<green;i++) {
			sum+=g[i];
			app.add(g[i]);
		}
		int track = (int) (clear-1);
		while(track>=0) {
			long num = app.peek();
			if(c[track]>num) {
				sum-=num;
				app.remove();
				sum+=c[track];
			}
			track--;
		}
		System.out.println(sum);
	}

}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    int ans0 = 0;
    rep (i, S.size()) {
        if (i % 2 == 0) {
            if (S[i] == '1') {
                ans0++;
            }
        } else {
            if (S[i] == '0') {
                ans0++;
            }
        }
    }

    int ans1 = 0;
    rep (i, S.size()) {
        if (i % 2 == 0) {
            if (S[i] == '0') {
                ans1++;
            }
        } else {
            if (S[i] == '1') {
                ans1++;
            }
        }
    }

    cout << min(ans0, ans1) << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {

    public static  void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(scanner.nextInt());
        }

        ArrayList<Integer> temp = (ArrayList<Integer>) array.clone();
        Collections.sort(temp);
        //System.out.println(array);
        //System.out.println(temp);
        for(int i = 0; i < n; i++){
            if(array.get(i) <= temp.get(n/2-1)){
                System.out.println(temp.get(n/2));
            }else {
                System.out.println(temp.get(n/2-1));
            }
        }
    }
}

Measured memory_bytes: 95444
/*
[abc148] F - Playing Tag on Tree
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 1e5;

int N;
int TK, AO;
vector<int> g[MAX_N];
int dep[2][MAX_N];

void dfs(int k, int v, int par = -1, int d = 0) {
    dep[k][v] = d;
    for (int to : g[v]) {
        if (to == par) {
            continue;
        }
        dfs(k, to, v, d + 1);
    }
}

ll solve() {
    dfs(0, TK);
    dfs(1, AO);

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (dep[0][i] < dep[1][i]) {
            ans = max(ans, dep[1][i] - 1);
        }
    }

    return ans;
}

int main() {
    cin >> N >> TK >> AO;
    TK--, AO--;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    cout << solve() << endl;

    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split("/");

		int y = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);
		int d = Integer.parseInt(str[2]);

		if (y <= 2019) {
			if (m == 4 && d <= 30) {
				System.out.println("Heisei");
			} else {
				if (m <= 3) {
					System.out.println("Heisei");
				} else {
					System.out.println("TBD");
				}
			}
		} else {
			System.out.println("TBD");
		}
	}
}

Measured memory_bytes: 32828
num=int(raw_input())
startTime =0
startX=0
startY=0
endTime =0
endX=0
endY=0

flag=False
for i in range(num):
	test=raw_input().split(" ")
	test=map(int, test)
	endTime = test[0]
	endX = test[1]
	endY = test[2]
	now = abs(startTime-endTime) - (abs(startY-endY) + abs(startX-endX))
	if not(now >= 0 and now%2==0):
		flag=True
		break
	startY = endY
	startX = endX
	startTime = endTime

if flag:
	print("No")
else:
	print("Yes")

Measured memory_bytes: 5764
#include <iostream>

using namespace std;

void putLine(int w) {
    w +=2 ;
    while (w > 0) {
        cout << '#';
        w--;
    }
    cout << endl;
}

int main(int argc, char* argv[])
{
    int H, W; cin >> H >> W;

    putLine(W);

    for (int i = 0; i < H; i++) {
        string cin_s; cin >> cin_s;
        string s = "#" + cin_s + "#";
        cout << s << endl;
    }

    putLine(W);
    return 0;
}


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

int main()
{
  int N;cin>>N;
  vector<vector<int>> E(N+1);
  for(int i=2;i<=N;i++)
  {
    int a;cin>>a;
    E[a].push_back(i);
  }
  
  for(int i=1;i<=N;i++)
  {
    cout<< E[i].size()<<endl; 
  }
  
  
}

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

typedef long long ll;

bool canCarry(vector<int>& w, int k, int p)
{
    int c = 0;
    int t = 1;
    for (int i = 0; i < w.size(); i++) {
        if (w[i] > p) {
            return false;
        }
        if (c + w[i] <= p) {
            c += w[i];
        } else {
            c = w[i];
            t++;
        }
        if (t > k) {
            return false;
        }
    }
    return true;
}

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> w(n);
    ll u = 0;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        u += w[i];
    }
    ll l = 0;
    while (u - l > 1) {
        int m = l + (u - l) / 2;
        if (canCarry(w, k, m)) {
            u = m;
        } else {
            l = m;
        }
    }
    cout << u << endl;
}


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

int main()
{
    int n;
    std::cin >> n;

    std::vector<int> v(n);
    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }

    std::sort(v.begin(), v.end());

    double ans = (v[0] + v[1]) / 2.0;

    for (int i = 2; i < n; i++) {
        ans = (ans + v[i]) / 2.0;
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
N = int(input())
X = list(map(int,input().split(' ')))


min_sigma = 1000000000
for i in range(1,101):
    #print(i)
    sigma = 0
    for j in range(N):
        sigma= sigma + (i-X[j])**2
    if min_sigma>sigma:
        min_sigma=sigma

print(min_sigma)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	int l,r;
	int aw=0;
	for (int i=0;i<N;i++){
		cin>>l>>r;
		aw+=r-l+1;
	}
	cout<<aw<<endl;
	return 0;
}

Measured memory_bytes: 256
x,y,z,k=map(int,input().split())
a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]
L=[]
for i in range(x):
    for j in range(y):
        if (i+1)*(j+1)>k:
            break
        for m in range(z):
            if (i+1)*(j+1)*(m+1)>k:
                break
            else:
                L.append(a[i]+b[j]+c[m])
for i in sorted(L,reverse=True)[:k]:
    print(i)

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

int main(){
  int a, b, c;
  vector<int> ans;

  cin >> a >> b >> c;
  ans.push_back(a+b);
  ans.push_back(a+c);
  ans.push_back(b+c);

  sort(ans.begin(), ans.end());

  cout << ans[0] << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll n;
  cin >> n;
  cout << ((n - 1) * n) / 2;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            long[] a = in.Long(N);
            long[] b = in.Long(N);

            long ac = 0, bc = 0;
            for (int i = 0; i < N; i++) {
                if (a[i] < b[i]) {
                    long d = b[i] - a[i];
                    bc += d / 2;
                } else if (a[i] > b[i]) {
                    ac += a[i] - b[i];
                }
            }
            out.println(ac <= bc ? "Yes" : "No");
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public long Long() {
            return Long.parseLong(next());
        }

        public long[] Long(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = Long();
            }
            return a;
        }

    }
}



Measured memory_bytes: 25812
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
typedef long long tnum;
 
#define loop(i, num) for(int i = 0; i < num; i++)
#define loop1(i, num) for(int i = 1; i <= num; i++)
 
tnum* tnumAlloc(int num);
tnum getNumStdin();
tnum* getNumsStdin(int);
char* getCharsStdin(int maxlength);
string getStringStdin();
void printlnNums(int count, tnum* nums);
void printlnNum(tnum num);
void printString(string str);
 
#define min(a,b) (a <= b ? a : b)
#define max(a,b) (a >= n ? a : b)
 
/*void sort(T* start, T* end) (in <algorithm>)
example:
	int a[5] = {2, 1, 3, 5, 4};
	sort(a, a + 5);
	-> a: {1, 2, 3, 4, 5}
*/
 
 
int main() {
    tnum total = 0;
    tnum n = getNumStdin();
    
    loop1(i, n){
        if(i % 3 == 0 || i % 5 == 0)
            continue;
 
        total += i;
    }
 
    printf("%lld", total);
 
    return 0;
}
 
//------------------------------
 
//have to be free()
tnum* tnumAlloc(int num) {
	return (tnum*)calloc(num,sizeof(tnum));
}
 
tnum getNumStdin() {
	tnum ret;
	scanf("%lld", &ret);
 
	return ret;
}
 
//have to be free()
tnum* getNumsStdin(int num) {
	tnum* buf;
	tnum* tmp;
	buf = tnumAlloc(num);
	for (int i = 0; i < num; i++) {
		scanf("%lld", &buf[i]);
	}
 
	return buf;
}
 
//have to be free()
char* getCharsStdin(int maxlength) {
	char* ret = (char*)malloc(maxlength+1);
	scanf("%s", ret);
 
	return ret;
}
 
//have to be free()
string getStringStdin() {
	string ret;
	cin >> ret;
	return ret;
}
 
void printlnNum(tnum num) {
	printf("%lld\n", num);
}
 
// can be used for debugging
void printlnNums(int count, tnum *nums) {
	loop(i, count) {
		printf("%lld", nums[i]);
		if (i != count - 1) printf(" ");
	}
	printf("\n");
}
 
void printString(string str) {
	cout << str;
}

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

int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) scanf("%d", a + i);

  int cnt = 0;
  int light = 1;
  while (cnt < N) {
    light = a[light-1];
    cnt++;
    if (light == 2) break;
  }

  // 解答
  cout << (cnt == N ? -1 : cnt) << endl;

  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<D,int> pdi;

/*
bool dcmp(const pdi &a, const pdi &b){
  if( abs(a.first-b.first)<1e-8 )return a.second<b.second;
  return a.first<b.first;
}
*/

int main(){
  int h,w;
  string f[999];
  cin >> h >> w;

  vector<pdi> v;
  rep(i,h){
    cin >> f[i];
    rep(j,w){
      if( (i==0&&f[i][j]=='#') || (i!=0&&f[i][j]!=f[i-1][j]) ){
	v.push_back(pdi(arg(P(j,h-i)),-1));
	v.push_back(pdi(arg(P(j+1,h-i)),1));
      }
      if( (j==w-1&&f[i][j]=='#') || (j!=w-1&&f[i][j]!=f[i][j+1])){
	v.push_back(pdi(arg(P(j+1,h-i)),-1));
	v.push_back(pdi(arg(P(j+1,h-i-1)),1));
      }
    }
  }

  int maxv = 0, tmp = 0;
  sort(v.begin(),v.end());
  //sort(v.begin(),v.end(),dcmp);
  rep(i,v.size()){
    tmp += v[i].second;
    maxv = max(maxv,tmp);
  }
  cout << (maxv+3)/2 << endl;
}

Measured memory_bytes: 19344
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
const long long MOD = 1e9+7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}



signed main(){
	int A,B;
	cin>>A>>B;
	cout<<max({A+B,A-B,A*B})<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

    int n,i,a=100000;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        a=a*1.05;
        if(a%1000>0)
        a=a/1000*1000+1000;
    }
    printf("%d\n",a);
        return 0;
}



Measured memory_bytes: 2024
#include <iostream>
#include <string.h>

using namespace std;

void solve()
{
	int n, p;
	while(cin >> n >> p, n || p)
	{
		int have[51];
		memset(have, 0, sizeof(have));
		int pos = 0;
		int stone = p;
		while(true)
		{
			if(stone > 0)
			{
				++have[pos];
				--stone;
			}
			else
			{
				stone += have[pos];
				have[pos] = 0;
			}
			if(have[pos] == p)
			{
				cout << pos << endl;
				break;
			}
			++pos;
			if(pos == n)
			{
				pos = 0;
			}
		}
	}
}

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

Measured memory_bytes: 1160
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

int main() {
	int N, P;
	cin >> N >> P;
	vi a(N);
	int odd = 0;
	rep(i, N) {
		cin >> a[i];
		odd += a[i] % 2;
	}
	if (odd == 0) {
		if (P == 1) {
			cout << 0 << endl;
			return 0;
		}
		else {
			ll ans = 1;
			rep(i, N) {
				ans *= 2;
			}
			cout << ans << endl;
			return 0;
		}
	}
	ll ans = 1;
	rep(i, N - 1) {
		ans *= 2;
	}

	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 256
def main():
    a = input()
    tmp = 0
    pos = 0
    if a[0] == 'A':
        for i in range(2, len(a)-1):
            if a[i] == 'C':
                tmp += 1
                pos = i
        if tmp == 1:
            for i in range(len(a)):
                if i != 0 and i != pos:
                    if a[i].isupper():
                        print('WA')
                        return
            print('AC')
            return
    print('WA')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <deque>
#include <map>
#include <cmath>
#include <cstring>

long eval(long n, long m) {
    long ret;

    // cをSにする数の期待値, 偶数である必要あり
    double ideal = (m - 2 * n) * 0.5;
    ideal = std::max(0.0, ideal);

    long rslts[2];
    for (int i = 0; i < 2; i++) {
        long nconvert = static_cast<long>(ideal + i*2) & (-2L);
        long nS = n + nconvert/2;
        long nC = m - nconvert;

        rslts[i] = std::min(nS, nC/2);
    }

    return std::max(rslts[0], rslts[1]);
}

int main(void) {
    long n;
    long m;
    long rslt;

    std::cin >> n;
    std::cin >> m;

    rslt = eval(n, m);

    std::cout << rslt << std::endl;
}


Measured memory_bytes: 256
from operator import itemgetter

n=int(input())
s = [list(map(int, input().split())) for i in range(n)]

x=[]
for i in range(n):
    x.append((s[i][0]-s[i][1],s[i][0]+s[i][1]))

x=sorted(x,key=itemgetter(1))
ans=1
r=x[0][1]
for i in range(1,n):
    if r<=x[i][0]:
        ans+=1
        r=x[i][1]

print(ans)






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

int main(void){
  int i,j;
  char str[21];
  int len;



  scanf("%s" ,str);
  len = strlen(str);
  for(i = 0; i < len ;i++){
    printf("%c" ,str[len - i - 1]);   
  }
  printf("\n");

  return 0;
}

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

typedef long l;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define mp make_pair

const int DX[] = {1, 0, -1, 0, 1, 1, -1, -1}, DY[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

  int b = n % 10;

  switch (b) {
    case 3:
    cout << "bon";
    break;
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
    cout << "hon";
    break;
    default:
    cout << "pon";
    break;
  }

  cout << endl;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0;
	int b=0;
	int c=0;
	int d=0;
	int array[3][3];
	int n=0;
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>array[i][j];
		}
	}
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			for(int k=0;k<n;k++)
			{
				if(array[i][j]==v[k])
				{
					array[i][j]=0;
				}
			}
		}
	}
	for(int i=0;i<3;i++)
	{
      a=0;
		for(int j=0;j<3;j++)
		{
			a+=array[i][j];
		}
		if(a==0) break;
	}
	for(int i=0;i<3;i++)
	{
      b=0;
		for(int j=0;j<3;j++)
		{
			b+=array[j][i];
		}
		if(b==0) break;
	}
	c=array[0][0]+array[1][1]+array[2][2];
	d=array[0][2]+array[1][1]+array[2][0];
	if(a==0||b==0||c==0||d==0)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

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

int main() {
    ios::sync_with_stdio(false);

    ll n , a , b; cin >> n >> a >> b;
    ll turns = n / (a + b);
    ll ans = turns * a;

    ll add = n % (a + b);
    cout << ans + min(add, a) << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
  int main(){
    int count=0,flag=1,i,j,n,A[100],tmp;
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&A[i]);
    }
    while(flag){
      flag=0;
      for(j=n-1;j>=1;j--){
        if(A[j]<A[j-1]){
          tmp=A[j-1];
          A[j-1]=A[j];
          A[j]=tmp;
          count++;
          flag=1;
        }
      }
    }
      for(i=0;i<n-1;i++){
        printf("%d ",A[i]);
      }
      printf("%d\n",A[n-1]);
      printf("%d\n",count);
      return 0;
    }



Measured memory_bytes: 2124