akhauriyash/Code-Regression huggingface dataset:
//{{{By oToToT
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <random>
#include <utility>
#include <stack>
#include <sstream>
#include <functional>
#include <deque>
#include <cassert>
using namespace std;
/* include everything for Kotori~ <3 */

using lld = int64_t;
using llu = uint64_t;
using llf = long double;
using PII = pair<int,int>;
using PIL = pair<int,lld>;
using PLI = pair<lld,int>;
using PLL = pair<lld,lld>;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
/* define some types for Ruby! */

#define FF first
#define SS second
#define SZ(x) (int)((x).size())
#define ALL(x) begin(x), end(x)
#define PB push_back
#define WC(x) while(x--)
/* make code shorter for Di~a~ */

template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
	s<<"[";
	for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
	s<<"]";
	return s;
}
template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.FF<<","<<p.SS<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
/* make output easier for Ainyan~n~ */

bool debug = 0;
#define DUMP(x) if(debug) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<'\n'
template<typename T>
void DEBUG(const T& x){if(debug) cerr<<x;}
template<typename T, typename... Args>
void DEBUG(const T& head,const Args& ...tail){
	if(debug){cerr<<head; DEBUG(tail...);}
}
/* Let's debug with Nico~Nico~Ni */
//}}}
const int N = 200000 + 5;

set<int> obs[N];

int main(int argc, char* argv[]){
	if(argc>1 and string(argv[1])=="-D") debug=1;
	if(!debug){ios_base::sync_with_stdio(0);cin.tie(0);}
	int n, m, k; cin >> n >> m >> k;
	for(int i=0;i<k;i++){
		int x, y; cin >> x >> y;
		obs[y].insert(x);
	}
	for(int i=1;i<=m;i++) obs[i].insert(n+1);
	int pos = 1, ans = n;
	for(int i=1;i<=m;i++){
		// DUMP(pos);
		ans=min(ans,*obs[i].lower_bound(pos)-1);
		pos++;//DUMP(ans);
		while(pos<=n and obs[i+1].lower_bound(pos)!=obs[i+1].end()){
			if(*obs[i+1].lower_bound(pos)==pos)++pos;
			else break;
		}
		if(pos>n) break;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;


int main(){
 int n;
 cin>>n;
  vector<double>v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  double sum=0;
  for(int i=0;i<n-1;i++){
    sum+=v[i]/std::pow(2,i+1);
  }
  sum+=v[n-1]/std::pow(2,n-1);
  cout << std::fixed << std::setprecision(10) << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)

using namespace std;

int main(void){
	int a[14][14]={};
	int x,y,size;
	int s,m;
	while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){
		x+=2;
		y+=2;
		a[x][y]++;
		a[x-1][y]++;
		a[x+1][y]++;
		a[x][y-1]++;
		a[x][y+1]++;
		if (size>1){
			a[x-1][y-1]++;
			a[x+1][y-1]++;
			a[x-1][y+1]++;
			a[x+1][y+1]++;
			if (size>2){
				a[x-2][y]++;
				a[x+2][y]++;
				a[x][y-2]++;
				a[x][y+2]++;
			}
		}
	}

	s=0; m=0;
	FOR(i,2,11){
		FOR(j,2,11){
			if (a[i][j]==0)
				s++;
			if (a[i][j]>m)
				m=a[i][j];
		}
	}
	cout << s << endl << m << endl;



	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <queue>
#include <complex>
using namespace std;
typedef complex<int> P;

int main()
{
  int w, h;
  while (cin >> w >> h && !(w == 0 && h == 0)) {
    vector<vector<bool> > grid(2*h+1, vector<bool>(2*w+1, false));
    fill(grid.front().begin(), grid.front().end(), true);
    fill(grid.back().begin(), grid.back().end(), true);
    for (int i = 1; i < 2*h; i++) {
      grid[i][0] = true;
      grid[i][2*w] = true;
      if (i % 2 == 1) {
        for (int j = 0; j < w-1; j++) {
          int x;
          cin >> x;
          if (x == 1) {
            grid[i-1][2*j+2] = true;
            grid[i][2*j+2] = true;
            grid[i+1][2*j+2] = true;
          }
        }
      } else {
        for (int j = 0; j < w; j++) {
          int x;
          cin >> x;
          if (x == 1) {
            grid[i][2*j] = true;
            grid[i][2*j+1] = true;
            grid[i][2*j+2] = true;
          }
        }
      }
    }

    queue<pair<int,P> > q;
    q.push(make_pair(0, P(1, 1)));
    grid[1][1] = true;
    while (!q.empty()) {
      const pair<int,P> p = q.front();
      q.pop();
      if (p.second == P(2*h-1, 2*w-1)) {
        cout << p.first/2+1 << endl;
        goto NEXT;
      }

      for (int d = 0; d < 4; d++) {
        static const P dir[] = {P(-1, 0), P(1, 0), P(0, -1), P(0, 1)};
        const P next = p.second + dir[d];
        if (!grid[next.real()][next.imag()]) {
          q.push(make_pair(p.first+1, next));
          grid[next.real()][next.imag()] = true;
        }
      }
    }
    cout << 0 << endl;
NEXT:
    ;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ls signed long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,k,n) for (ll i = k; i < n; ++i)
#define all(c) (c).begin(),(c).end()
#define test() ll t;cin>>t;while(t--)
#define debug(x) cout << (#x) << " is " << (x) << endl
#define hello ios_base::sync_with_stdio(0);cin.tie(0)
/* sort on the basis of the size of the  string in a vector modified sort function
	 sort(a.begin(), a.end(), [&] (const string &s, const string &t) {
		return s.size() < t.size();
		
		
			upper_bound(v.begin(),v.end(),r);
			lower_bound(v.begin(),v.end(),l)
	});
*/
//const int DR[4][2]={{1,0},{0,1},{-1,0},{0,-1}}
const ll MOD = 1e9 + 7;
const ll MAX = 1001;
void solve()
{
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	cout<<a[0]+a[1]<<endl;
	  
}
int main()
{

	hello;
	solve();
}



Measured memory_bytes: 256
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:String,
    }
    println!("{}",
             if a=="abc"{"Yes"}
             else if a=="acb"{"Yes"}
             else if a=="bac"{"Yes"}
             else if a=="bca"{"Yes"}
             else if a=="cab"{"Yes"}
             else if a=="cba"{"Yes"}
             else {"No"}
    )
}

Measured memory_bytes: 2160
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ll long long
#define F(i,a,b) for(int i=(a);i<=(b);i++)
#define mst(a,b) memset((a),(b),sizeof(a))
#define PII pair<int,int>
using namespace std;
template<class T>inline void read(T &x) {
    x=0; int ch=getchar(),f=0;
    while(ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    if(f)x=-x;
}
const int inf=0x3f3f3f3f;
int a,n,sum;
int main()
{
	cin>>a>>n;
	for(int i=1;i<=n;i++)
	{
		int x;cin>>x;
		sum+=x;
	}
	if(sum>=a) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#0516
while True:
    x = 0
    a = []
    S = []
    s = 0
    cnt = 0
    n , k = map(int,input().split())
    if n == 0 and k == 0:
        break
    for i in range(n):
        a.append(int(input()))

    S.append(sum(a[0:k]))
    
    for j in range(k,n):
        s = S[cnt] - a[j - k] + a[j]
        S.append(s)
        cnt += 1
    
    print(max(S))


Measured memory_bytes: 11724
#include<bits/stdc++.h>
using namespace std;
#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= (int)(1e19+10LL);
void solve()
{
  int n;
  sl(n);
  int sum=0;
  for(int i=1;i<=n;i++){
	  for(int j=1;j<=n;j++){
		  for(int k=1;k<=n;k++){
			int fs=__gcd(j,k);
			int ss=__gcd(i,fs);
			sum+=ss;  
		  }
	  }
  }
  cout<<sum<<endl;

		
}
 
signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();
 
   }
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    char x, y;
    cin >> x >> y;
    char ans = '>';
    if (x<y) ans = '<';
    if (x==y) ans = '=';
    
    cout << ans << endl;
    return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(24);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;

ll n, m, x, k, a , b;
string s, t;

// <------------- Implement Functions Here ----------> //

vll factor(ll x) {
	vll f;
	if(x == 1 ) return f;
	
	f.pb(x);
	for(ll i=2;i*i <= x;i++) {
		if(x%i == 0) {
			if(i*i != x) {
				f.pb(x/i);
			}
			f.pb(i);
		}
	}
	sort(all(f));
	return f;
}

unordered_map<ll , ll> factorize(ll x) {
	unordered_map<ll, ll> ans;

	vll f = factor(x);
	
	if(f.size() == 0) return ans;
	ll i = 0;
	while (x > 1) {
		ll m = f[i];
		while (x % m == 0) {
			ans[m] = (ans[m] + 1) ;
			x /= m;
		}
		i++;
	}
	return ans;
}


ll BS(ll val) {
	ll l = 0,r = 1000000;
	while(l<r) {
		ll m = ceil((ld)(l+r)/2);
		if(val < m*(m+1)/2) {
			r = m - 1;
		}
		else {
			l = m ;
		}
	}
	return l;
}


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	unordered_map<ll,ll> fact = factorize(n);
	/*for(auto it : fact) {
		cout<<it.f <<" "<<it.s;newl;
	}*/
	if(fact.size() == 0) { cout<<0; return; }

	ll ans = 0;
	for(auto it : fact) {
		ans+=BS(it.s);
	}

	cout<<ans;
}

int main() {
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3688
#include<iostream>
#include<iomanip>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int main() {
    int a, b;
    cin >> a >> b;
    int tmp = abs(a - b);
    if (tmp % 2 == 1) {
        cout << "IMPOSSIBLE\n";
    } else {
        cout << (a+b)/2 << "\n";
    }
}

Measured memory_bytes: 256
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int r = scanner.nextInt();
        int d = scanner.nextInt();
        long x = scanner.nextLong();
        for (int i = 0; i < 10; ++i) {
            x = r * x - d;
            writer.println(x);
        }
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21332
import sys
sys.setrecursionlimit(10 ** 5)
 
def erase(x, y):
    c[y][x] = '0'
    for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)):
        nx, ny = x + dx, y + dy
        if 0 <= nx < w and 0 <= ny < h and c[ny][nx] == '1':
            erase(nx, ny)
 
while True:
    w, h = map(int, input().split())
    if w == h == 0:
        break
    c = [input().split() for _ in range(h)]
    ans = 0
    for y in range(h):
        for x in range(w):
            if c[y][x] == '1':
                ans += 1
                erase(x, y)
    print(ans)

Measured memory_bytes: 9596
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

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

void solve(ll A, ll B) {
  int ans = -1;
  if (A < 10 && B < 10) {
    ans = A*B;
  }
  cout << ans << endl;
}

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int n,m;
int a[1000];
bool end;

void func(string str[],int now){
  
  //cout << "now  = " << now << endl;//

  if(now == n){
    string res = str[0];
    for(int i = 1 ; i < n ; i++){
      res += str[i][m-1];
    }
    cout << res << endl;
    end = true;

    //for(int i = 0 ; i < n; i++){
    //   cout << str[i] << endl;
    // }
    return;
  }
  
  if(now == 0){
    do{
      func(str,now+1);
      if(end)return;
    }while(next_permutation(str[now].begin(),str[now].end()));
  }
  else {
    string ps,ns;
    ps = str[now - 1];
    int cnt = 0;
    for(int i = 0 ; i < m - 1; i++){
      ns += ps[i+1];  
      if(ns[i] == '1')cnt++;
    }
    // cout << "cnt = " << cnt << endl;//
    if(cnt + 1 == a[now]){
      ns += '1';
      // cout <<"ns = " << ns << endl;//
      str[now] = ns;
      func(str,now+1);
      if(end)return;
    }
    else if(cnt == a[now]){
      ns  += '0';
      //cout <<"ns = " << ns << endl;//
      str[now] = ns;
      func(str,now+1);
      if(end)return;
    }
  }
  if(now == 0)cout << "Goofy" << endl;
}

int main(){
  while(1){
    end = false;
    cin >> n >> m;
    if(n == 0 && m == 0)break;
    string str[n];
    for(int i = 0 ;i < n ; i++){
      cin >> a[i];
    }

    int cnt = 0;
    string &tmp = str[0];
    for(int j = 0 ; j < m ; j++){
      if(cnt++ < m - a[0])tmp += '0';
      else tmp += '1';
    }
    
    //  cout << str[0] << endl;

    func(str,0);
  }
  return 0;
}

Measured memory_bytes: 1124
#include <cstdio>
using namespace std;
int G[107][107];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
    	int id, cnt;
    	scanf("%d%d", &id, &cnt);
    	for (int j = 0; j < cnt; j++) {
    		int tmp;
    		scanf("%d", &tmp);
    		G[id][tmp] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		printf("%d", G[i][1]);
		for (int j = 2; j <= n; j++) {
			printf(" %d", G[i][j]);
		}
		putchar('\n');
	}
    return 0;
}


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

int main(){
    int N; cin>>N;
    int d[N];
    for(int i=0; i<N; i++) cin>>d[i];

    set<int> values;
    for(int i=0; i<N; i++){
        values.insert(d[i]);
    }
    cout<<values.size()<<endl;
}


Measured memory_bytes: 3596
n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(n)]
c = [list(map(int,input().split())) for i in range(m)]
for a in s:
  l = [abs(a[0]-b[0])+abs(a[1]-b[1]) for b in c]
  print(l.index(min(l))+1)


Measured memory_bytes: 3060
n,a,b=gets.split.map(&:to_i)
count_a=[]
(1..n).each do |_n|
  y=_n.to_s.chars.map(&:to_i).inject(&:+)
  if y>=a && y<=b then
    count_a<< _n
  end
end
print count_a.inject(&:+)


Measured memory_bytes: 1916
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<fstream>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e9;
static const int INF = 0x3f3f3f3f;
static const int MOD = 998244353;

int main(){

    int N,M,X,Y;
    cin >> N >> M >> X  >> Y;
    int arr1[N+1];int arr2[M+1];
    arr1[N] = X;arr2[M] = Y;
    FOR(i,0,N)
        sc(arr1[i]);
    FOR(i,0,M)
        sc(arr2[i]);

    sort(arr1,arr1+N+1);
    sort(arr2,arr2+M+1);

    if(arr1[N] < arr2[0])
        cout << "No War";
    else
        cout << "War";
    return 0;
}



Measured memory_bytes: 384
c = 0
result = 0
while True:
    st = raw_input()
    if c == 0:
        s_str = st
    elif 'END_OF_TEXT' == st:
        break
    elif c > 0:
        if s_str.lower() in st.lower():
            result = result + st.lower().split(' ').count(s_str.lower())
        else:
            pass
    c = c+1
print result

Measured memory_bytes: 4200
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX
using namespace std;

#define FOR(i,s,e) for(ll (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(ll (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define debug(x) cout<<#x<<": "<<x<<endl
typedef long long ll;

/* 2010/00/00 問題 -----  Name/Link ----- */
/* -----解説等-----
問題:


*/

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int ab, cd;
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    ab = a*b;
    cd = c*d;

    int ans = max(ab, cd);



        cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import copy

def com(n,r,m):
    #a = math.factorial(n)%m
    a = 1
    for i in range(1,n+1):
        a *= i
        a %= m
    A = pow(a,m-2,m)
    
    
    b= copy.copy(A)   
    for i in range(n,r,-1):
        b = (b*i)%m
    
    c = copy.copy(A)
    for i in range(n,n-r,-1):
        c = (c*i)%m
       
    return (a*b*c)%m

def main():
    k = int(input())
    s = input()
    mod = 10**9+7
    z = [1]
    for i in range(1,k+1):
        y = z[-1]*26
        z.append(y%mod)
    l = len(s)

    N = k+2
    inv_t = [0]+[1]
    for i in range(2,N):
        inv_t.append(inv_t[mod % i] * (mod - int(mod / i)) % mod)
    #print(inv_t)
    
    ans = 0
    p = 1   #pow(25,i-len(s),mod)
    #q = z[k]
    bai = 1
    for i in range(l,l+k+1):
        #base = p*q   #pow(26,len(s)+k-i,mod)
        #base = pow(25,i-len(s),mod) * pow(26,len(s)+k-i,mod)
        #bai = r
        #bai = com(i-1,len(s)-1,mod)
        #print(i,len(s),base,bai)
        ans += p*z[l+k-i]*bai
        ans %= mod
        p *= 25
        p %= mod
        #q = z[l+k-i-1]
        bai = bai*i*inv_t[i+1-l]
        bai %= mod
    print(ans)
    
if __name__=="__main__":
    main()

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

using namespace std;

class Dice{

public:
    unique_ptr<vector<int>> nums;
    unique_ptr<vector<vector<int>>> all;

    Dice(int n){
        nums.reset(new vector<int>(6));
        all.reset(new vector<vector<int>>(24, vector<int>(6)));
    }

    void rotate(char dir){
        int a, b, c, d;
        switch(dir){
        case 'N':
            a = nums->at(0), b = nums->at(1), c = nums->at(5), d = nums->at(4);
            nums->at(0) = b;
            nums->at(1) = c;
            nums->at(5) = d;
            nums->at(4) = a;
            break;
        case 'E':
            a = nums->at(0), b = nums->at(2), c = nums->at(5), d = nums->at(3);
            nums->at(0) = d;
            nums->at(2) = a;
            nums->at(5) = b;
            nums->at(3) = c;
            break;
        case 'W':
            a = nums->at(0), b = nums->at(2), c = nums->at(5), d = nums->at(3);
            nums->at(0) = b;
            nums->at(2) = c;
            nums->at(5) = d;
            nums->at(3) = a;
            break;
        case 'S':
            a = nums->at(0), b = nums->at(1), c = nums->at(5), d = nums->at(4);
            nums->at(0) = d;
            nums->at(1) = a;
            nums->at(5) = b;
            nums->at(4) = c;
            break;
        }
    }

    void print_pattern(int i){
        for(int j = 0; j < 6; j++){ cout << " " << all->at(i).at(j); }
        cout << endl;
    }

    void rotate_all(){
        int i = 0;
        for(;i < 4; i++){
            for(int j = 0; j < 6; j++){ all->at(i).at(j) = nums->at(j); }
            rotate('E');
        }
        rotate('N');
        for(;i < 8; i++){
            for(int j = 0; j < 6; j++){ all->at(i).at(j) = nums->at(j); }
            rotate('E');
        }
        rotate('N');
        for(;i < 12; i++){
            for(int j = 0; j < 6; j++){ all->at(i).at(j) = nums->at(j); }
            rotate('E');
        }
        rotate('N');
        for(;i < 16; i++){
            for(int j = 0; j < 6; j++){ all->at(i).at(j) = nums->at(j); }
            rotate('E');
        }
        rotate('N');

        rotate('W');
        rotate('S');

        for(;i < 20; i++){
            for(int j = 0; j < 6; j++){ all->at(i).at(j) = nums->at(j); }
            rotate('E');
        }

        rotate('N');
        rotate('N');

        for(;i < 24; i++){
            for(int j = 0; j < 6; j++){ all->at(i).at(j) = nums->at(j); }
            rotate('E');
        }
    }

    bool same(Dice &other){
        for(int j = 0; j < other.all->size(); j++){
            bool flag = true;
            for(int k = 0; k < 6; k++){
                flag &= nums->at(k) == other.all->at(j).at(k);
            }
            if(flag) return true;
        }
        return false;
    }

};

int main()
{
    Dice d0(6), d1(6);
    for(int i = 0; i < 6; i++){
        cin >> d0.nums->at(i);
    }
    d0.rotate_all();
    for(int i = 0; i < 6; i++){
        cin >> d1.nums->at(i);
    }
    d1.rotate_all();

    if(d0.same(d1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


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

int main() {
	int ha,ma,hb,mb,k;
	cin>>ha>>ma>>hb>>mb>>k;
	int timea,timeb;
	timea=ha*60+ma;
	timeb=hb*60+mb;
	int ans=0;
	if(timea>=timeb)
	{
	    ans=timea-timeb+720-k;
	}
	else 
	{
	    ans=timeb-timea-k;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
    int m = 1000000007;
    int r,c;
    cin>>r>>c;
    
    vector<vector<char>> v (r,vector<char>(c,'.'));
    vector<vector<long long>> dp(r,vector<long long>(c,0));
    
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin>>v[i][j];
        }
    }
    

    
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            
            if(i==0 && j==0) dp[i][j]=1;
            
            
            else if(v[i][j]!='#'){
                
            if(i>0 && j>0){
                if(v[i][j-1]!='#' && v[i-1][j]!='#'){
                    dp[i][j] = dp[i][j-1] + dp[i-1][j];
                }
                else if(v[i][j-1]!='#'){
                    dp[i][j] = dp[i][j-1];
                }
                else if(v[i-1][j]!='#'){
                    dp[i][j] = dp[i-1][j];
                }
                
            }else if(i>0){
                if(v[i-1][j]!='#'){
                    dp[i][j] = dp[i-1][j];
                }
                
            } 
            else if(j>0){
                if(v[i][j-1]!='#'){
                    dp[i][j] = dp[i][j-1];
                }
                
            } 
            
            
            
        }
        dp[i][j] = dp[i][j]%m;
        }
        
    }
    
    cout<<dp[r-1][c-1]<<endl;
    
    // for(int i=0; i<r; i++){
    //     for(int j=0; j<c; j++){
    //         cout<<dp[i][j];
    //     }
    //     cout<<endl;
    // }
    
    
    
    
    
}

Measured memory_bytes: 12180
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin>>s;
int x=s.size();
while(x--)
{
    cout<<'x';
}
cout<<endl;
    
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = 0; i < k; i++)
    {
        if (a + i > b)
            break;
        OP(a + i);
    }
    for (int i = k - 1; i >= 0; i--)
    {
        if (b - i < a + k)
            continue;
        OP(b - i);
    }

    return 0;
}

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

#define pb push_back

using namespace std;

const int MAXN = 3e4 + 10;

int a[MAXN];

vector<int> adj[MAXN];

bool dfs(int u) {
	int f = -1;
	for (int v : adj[u]) {
		if (v != f && a[v] < a[u] && !dfs(v))
			return true;
	}
	return false;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		adj[--u].pb(--v);
		adj[v].pb(u);
	}
	for (int i = 0; i < n; i++) {
		if (dfs(i))
			cout << i + 1 << " ";
	}

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>     
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)3e5 + 100;
const int N = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
 
int n, m, used[maxn], dp[maxn];
vi order;
vi g[maxn], gr[maxn];

void dfs(int v){
	used[v] = 1;
	for(auto to : g[v])
		if(!used[to])
			dfs(to);
	order.pb(v);
}
main () {
	cin >> n >> m;
	forn(i, 1, m){
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		gr[v].pb(u);
	}
	forn(i, 1, n)
		if(!used[i])
			dfs(i);
	reverse(all(order));
	for(auto v : order){
		dp[v] = 1;
		for(auto from : gr[v])
			dp[v] = max(dp[v], dp[from] + 1);
	}
	cout << *max_element(dp + 1, dp + n + 1) - 1;
}

Measured memory_bytes: 27896
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x <<endl; 
using namespace std; 

//int _; 

string s;

int main()
{
	//for(scanf("%d",&_);_;_--)
	cin >> s;
	s=s.substr(0,3);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3636
//AtCoder AGC030 A - Poisonous Cookies
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll A,B,C; cin>>A>>B>>C;
    ll c=min(C,A+B+1);
    ll ans=B+c;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ims = [0] * (N + 1)

for _ in range(M):
    a, b = map(lambda a: int(a) - 1, input().split())
    if a > b:
        a, b = b, a
    ims[a] += 1
    ims[b] -= 1

for i in range(1, N + 1):
    ims[i] += ims[i - 1]

print('YES' if all(c % 2 == 0 for c in ims) else 'NO')


Measured memory_bytes: 6900
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

int main() {

    int n,m ;
    cin >> n >> m   ;

    int h[n] ;

    for (int i = 0; i < n; i++) cin >> h[i] ;

    int a[m],b[m] ;

    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i] ;
    }

    int check[n] ;
    for (int i = 0; i < n; i++) check[i] = 0 ;    

    for (int i = 0; i < m ; i++)
    {
        if(h[a[i]-1]<=h[b[i]-1]){
            check[a[i]-1] = -1 ;
        }
        
        if(h[a[i]-1]>=h[b[i]-1]){
            check[b[i]-1] = -1 ;
        }
    }

    int ans = 0 ;
    for (int i = 0; i < n; i++)
    {
        if(check[i]==0) ans++ ;
        // cout << check[i] << endl  ;
    }
    
    cout << ans << endl  ;

 return 0 ;
}  


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

int main(void)
{
        int n,i,l;
        char s[100];

        scanf("%d",&n);
        scanf("%s",s);

        l=strlen(s);

        if(n>=l) printf("%s",s);
        else {
                s[n]='\0';
                printf("%s...",s);
        }
        return 0;
}


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

//----------------------------------------------------------------------------------------------------------------------
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

#define mp make_pair
#define pb push_back
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
    os<<"("<<p.first<<": "<<p.second<<")";
    return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
    os<<"{";
    for(int i = 0;i < (int)v.size(); i++){
        if(i)os<<", ";
        os<<v[i];
    }
    os<<"}";
    return os;
}


//#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
//----------------------------------------------------------------------------------------------------------------------




int main()
{
    fastio;

    char c;
    cin >> c;
    cout << (char)(c + 1);


    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

inline void swap(int &a, int &b){
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
}

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b) swap(a, b);
    if(a > c) swap(a, c);
    if(b > c) swap(b, c);
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
int main() {
	int N;
	cin >> N;
	vector<int>A(N), B(N), C(N);
	int countA = 0;
	int countC = 0;
	int countB = 0;
	for (int i = 0; i < N; ++i) cin >> A[i];
	for (int i = 0; i < N; ++i) cin >> B[i];
	for (int i = 0; i < N; ++i) cin >> C[i];
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	ll res = 0;
	for (int i = 0; i < N; ++i) {
		ll na = distance(A.begin(), lower_bound(A.begin(), A.end(), B[i]));
		ll nc = distance(upper_bound(C.begin(), C.end(), B[i]), C.end());
		res += na * nc;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1408
N, M, X = map(int, input().split())
C = []; A = []; T = []
for _ in range(N):
    s = list(map(int, input().split()))
    C.append(s[0])
    A.append(s[1:])

INF = 10**9
ans = INF
# シフトで2^nまで全探索
# 全ての組み合わせに対してforを回す
# 部分集合を全探索するならbit全探索
# 左シフト<< 桁を左にずらし，0を入れていく
for s in range(0, 1 << N):
    # 習得度をいれるリストを定義
    smart = [0] * M
    cost_sum = 0
    # sには一旦10進数が入る
    # 得られた１組あわせに対して，2進数でそのitemを用いているかを (s >> i) & 1で確認する
    # これは，右シフト
    # 012のループ
    for i in range(N):
        # 買っているかを
        if (s >> i) & 1:
            cost_sum += C[i]
            for j in range(M):
                smart[j] += A[i][j]
    ok = True
    if min(smart) < X:
        ok = False
    if ok:
        ans = min(ans, cost_sum)

if ans == INF:
    print(-1)
else:
    print(ans)

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

using namespace std;

int main()
{
    int n,ma,mb;
    int inf = 1000000000;
    cin >> n >> ma >> mb;
    int dp[n + 1][n * ma + 1][n * mb + 1];
    int array[n + 1][3];
    for(int i = 1;i <= n;i++){
        cin >> array[i][0] >> array[i][1] >> array[i][2];
    }
    for(int i = 0;i <= n;i++){
        for(int j = 0;j <= n*ma;j++){
            for(int k = 0;k <= n*mb;k++)
            dp[i][j][k] = inf;
        }
    }
    dp[0][0][0] = 0;
    for(int i = 1;i <= n;i++){
        for(int j = 0;j <= n*ma;j++){
            for(int k = 0;k <= n*mb;k++){
                dp[i][j][k] = dp[i - 1][j][k];
                if(j >= array[i][0] && k >= array[i][1]){
                dp[i][j][k] = min(dp[i][j][k],dp[i - 1][j - array[i][0]][k - array[i][1]] + array[i][2]);
            }
        }
    }
    }
    int ans = inf;
    for(int i = 1;i <= n*ma;i++){
        for(int j = 1;j <= n*mb;j++){
        if(i*mb == j*ma)ans = min(ans,dp[n][i][j]);
        }
    }
        if(ans == inf)cout << -1;
        else cout << ans;
        return 0;
    }


Measured memory_bytes: 23424
#include <stdio.h>
#define N 10000

    int A[N + 1],n,key;
    
int linearSearch(){
    int i = 0;
    A[n] = key;
    while(A[i] != key) i++;
    if(i == n) return 1;
    return 0;
}

int main(void){
    int i;
    int q,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&key);
        if(linearSearch() == 0) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}


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

using namespace std;

using ll = long long;

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll ans = 0;
	ans += min(k, a);
	k -= min(k, a);
	ans += min(k, b) * 0;
	k -= min(k, b);
	ans += k * -1;
	cout << ans;

	return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A[3];
    rep(i, 3) cin >> A[i];
    sort(A, A + 3);
    if (A[0] == A[1] && A[1] != A[2]) {
        cout << "Yes" << endl;
    } else if (A[0] != A[1] && A[1] == A[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 1000000000000000000ll
#define ldb long double
#define pb push_back
#define put_(x) printf("%d ",x);
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define gi(x) scanf("%lf",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE ll i=p;i<=n;++i)
#define go(x) for(ll i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE ll i=n;i>=p;--i)
#define pii pair<ll,ll>
#define mk make_pair
#define RE register
#define P 1000000007
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define uint unsigned long long
#define ui unsigned
#define EPS 1e-8
#define sq sqrt
#define mod 323232323
#define F first
#define S second
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    RE ll x=0,f=1;RE char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=100010;
ll T;
ll n,A,B,C,D,ans;
map<ll,ll>H;
priority_queue<pii>q;
inline void gx(ll x,ll w)
{
	if(w>=ans)return;
	if(H.find(x)==H.end())H[x]=w,q.push(mk(x,-w));
	else
	{
		if(w>=H[x])return;
		H[x]=w;q.push(mk(x,-w));
	}
}
signed main()
{
	//freopen("1.in","r",stdin);
	get(T);
	while(T--)
	{
		get(n);get(A);get(B);get(C);get(D);
		H.clear();q.push(mk(n,0));
		ans=INF;H[n]=0;
		int cnt=0;
		while(q.size())
		{
			ll x=q.top().F;
			ll w=-q.top().S;
			q.pop();
			if(w>ans)continue;
			if(H[x]!=w)continue;
			//考虑直接减到0
			if(INF/D>x)ans=min(ans,D*x+w);
			if(x%2)gx(x/2,w+D+A),gx(x/2+1,w+D+A);
			else gx(x/2,w+A);
			if(x%3)gx(x/3,w+x%3*D+B),gx(x/3+1,w+(3-x%3)*D+B);
			else gx(x/3,w+B);
			if(x%5)gx(x/5,w+x%5*D+C),gx(x/5+1,w+(5-x%5)*D+C);
			else gx(x/5,w+C);
			//put(++cnt);
		}
		putl(ans);
	}
	return 0;
}


Measured memory_bytes: 4452
#include <iostream>
using namespace std;
int main(){
    int n, scoreA, scoreB;
    while(cin >> n, n != 0){
        scoreA = 0; scoreB = 0;
        int a,b;
        for (int i = 0; i < n; i++){
            cin >> a >> b;
            if (a > b){
                scoreA += (a+b);
            }else if (b > a){
                scoreB += (a+b);
            }else{
                scoreA += a; scoreB += b;
            }
        }
        cout << scoreA << " " << scoreB << endl;
    }
}

Measured memory_bytes: 1160
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln endl
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inp freopen("input.txt", "r", stdin)
#define outp freopen("output.txt", "w", stdout)
#define dbgm(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
typedef long long int  ll;
typedef long double  ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 2e5+5, MOD = 1e9+7, EPS = 1e-9;
int t,n,m,k,x,y;
int main(){
	fastio;
	cin>>n;
	ll dp[n+1][3];
	forn(i,n+1){
		forn(j,3){
			dp[i][j] = 0;
		}
	}
	int a,b,c;
	forsn(i,1,n+1){
		cin>>a>>b>>c;
		forn(j,3){
		if(j==1){
			dp[i][j] = max(dp[i-1][2],dp[i-1][0]) + b;
		}
		else if(j==2){
			dp[i][j] = max(dp[i-1][1],dp[i-1][0]) + c;
		}
		else if(j==0){
			dp[i][j] = max(dp[i-1][1],dp[i-1][2]) + a;
		}}
	}
	cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<ln;
	return 0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    string A, B, C;
    cin >> A >> B >> C;

    int ans = 0;
    REP(i, N) {
        char a = A[i], b = B[i], c = C[i];
        if (a == b && b == c) continue;
        if (a == b)
            ans++;
        else if (b == c)
            ans++;
        else if (c == a)
            ans++;
        else {
            ans += 2;
        }
    }

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

Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 30.09.2017 15:03:06       
**/
#include <bits/stdc++.h>

using namespace std;

const int MAX = 3500;

int main() {
  long long n;
  cin >> n;
  for (long long a = 1; a <= MAX; a++) {
    for (long long b = 1; b <= MAX; b++) {
      long long x = n * a * b;
      long long y = 4 * a * b - n * b - n * a;
      if (y > 0 && x % y == 0) {
        long long c = x / y;
        cout << a << " " << b << " " << c << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256