akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <cctype>
#include<math.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	sort(begin(s), end(s));
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3])cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
from math import sqrt
a,b=map(int,input().split())
if(a==1 or b==1):
    print('1')
    exit()
if(a%2==0):
    a//=2
    print(a*b)
elif(b%2==0):
    b//=2
    print(a*b)
else:
    print((a*b)//2+(a*b)%2)

Measured memory_bytes: 38384
n, m = map(int, input().split())
dp = [[int(2e8) for _ in range(2**n)] for _ in range(2)]
dp[0][0] = 0
dp[1][0] = 0
for i in range(m):
    a, _ = map(int, input().split())
    k = sum(map(lambda c: 1 << (c - 1), list(map(int, input().split()))))
    for j in range(2**n):
         dp[(i + 1) % 2][j] = min(dp[(i + 2) % 2][j], dp[i % 2][j])
    for j in range(2**n):
         dp[(i + 1) % 2][j | k] = min(dp[(i + 1) % 2][j | k], dp[i % 2][j] + a)
ans = min(dp[0][-1], dp[1][-1])
if int(1e8) < ans:
    ans = -1
print(ans)

Measured memory_bytes: 48472
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

using vl    = vector<long long>;
using vvl   = vector<vl >;
using vvvl  = vector<vvl >;

template<typename Type>
struct Dinic{
	struct Edge{				//Edge:=(辺の情報を表す構造体).
		int to;//to:=(行先). 
		Type cap;//cap:=(容量).
		int rev;//rev:=(逆辺).
	};
	
	vector<vector<Edge> > g;	//g[i]:=(ノードiの隣接リスト).
	vi level;					//level[i]:=(sからiまでの距離).
	vi iter;					//iter[i]:=(ノードiの隣接ノードをどこまで調べたか).
	Type inf;
	
	Dinic(int vn):g(vn),level(vn),iter(vn){//constructor.
		if(typeid(Type)==typeid(int)) inf=1e9;
		else if(typeid(Type)==typeid(long long)) inf=1e18;
	}
	
	void add_egde(int from,int to,Type cap){//fromからtoへ向かう容量capの辺をグラフに追加する.
		g[from].push_back((Edge){to,cap,(int)g[to].size()});
		g[to].push_back((Edge){from,0,(int)g[from].size()-1});
	}
	void bfs(int s){//sからの最短距離を計算する.
		fill(ALL(level),-1);
		level[s]=0;
		queue<int> que;
		que.push(s);
		while(!que.empty()){
			int v=que.front();
			que.pop();
			REP(i,g[v].size()){
				Edge &e=g[v][i];
				if(e.cap>0 and level[e.to]<0){
					level[e.to]=level[v]+1;
					que.push(e.to);
				}
			}
		}	
	}
	Type dfs(int v,int t,Type f){//増加パスを探す.
		if(v==t) return f;
		for(int &i=iter[v];i<g[v].size();++i){
			Edge &e=g[v][i];
			if(e.cap>0 and level[v]<level[e.to]){
				Type d=dfs(e.to,t,min(f,e.cap));
				if(d>0){
					e.cap-=d;
					g[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	Type max_flow(int s,int t){//sからtへの最大流を求める. O(|E|*(|V|^2)).
		Type flow=0;
		while(1){
			bfs(s);
			if(level[t]<0) return flow;
			fill(ALL(iter),0);
			Type f;
			while((f=dfs(s,t,inf))>0) flow+=f;
		}
	}
};

int main(){//Refering other editorials.
	const llong inf=1e18;

	int n;
	cin>>n;
	
	vl a(n);
	REP(i,n) cin>>a[i];
	
	Dinic<llong> ob(n+2);
	REP(i,n){
		if(a[i]<=0) ob.add_egde(n,i,-a[i]);
		else ob.add_egde(i,n+1,a[i]);
	}
	
	for(int i=1;i<=n;++i)for(int j=i+i;j<=n;j+=i){
		ob.add_egde(i-1,j-1,inf);
	}
	
	llong sum=0LL;
	REP(i,n) if(a[i]>0) sum+=a[i];
	
	cout<<sum-ob.max_flow(n,n+1)<<endl;
	return 0;
}

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

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<int> sz;
    UnionFind(int n) {
        par.assign(n, 0);
        iota(par.begin(), par.end(), 0);
        rank.assign(n, 0);
        sz.assign(n, 1);
    }
    int find(int x) {
        if (par[x] == x) {
            return x;
        }
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            par[x] = y;
            sz[x] = sz[y] = sz[x] + sz[y];
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) {
                rank[x]++;
            }
            sz[y] = sz[x] = sz[x] + sz[y];
        }
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        x = find(x);
        return sz[x];
    }
};

int main()
{    
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    vector<vector<int>> like(n);
    vector<vector<int>> block(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (uf.find(a) != uf.find(b)) {
            uf.unite(a, b);
        }
        like[a].push_back(b);
        like[b].push_back(a);
    }
    rep(i, k) {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        block[c].push_back(d);
        block[d].push_back(c);
    }
    rep(i, n) {
        if (i > 0) cout << " ";
        int ans = uf.size(i);
        for (auto v : like[i]) {
            if (uf.same(i, v)) {
                ans--;
            }
        }
        for (auto v : block[i]) {
            if (uf.same(i, v)) {
                ans--;
            }
        }
        cout << ans - 1;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 13048
#include<stdio.h>
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int op= 1;
    for(int i = 0;i<n;i++)
    {
        if(op< k) op *= 2    ;
        else{
            op +=k;
        }
    }
    printf("%d\n",op);
}

Measured memory_bytes: 2152
#define _CRT_SECURE_NO_WARNINGS

//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int flag[3] = { 1, 1, 1 };
int num[4];

int  checkOP(int n){
	//printf("n=%d, %d %d %d\n", n,flag[0], flag[1], flag[2]);
	int i;
	if (n == 3) {
		int tmp = num[0];
		//printf("tmp=%d\n", tmp);
		for (i = 1; i <= 3; i++) {
			if (flag[i-1]) {
				tmp += num[i];
			}
			else {
				tmp -= num[i];
			}
			//printf("tmp=%d\n", tmp);
			if (tmp == 7)return 1;
		}
	}
	for (i = n+1; i <= 3;i++) {
		flag[i-1] = 1;
		if(checkOP(i))return 1;
		flag[i-1] = 0;
		if (checkOP(i))return 1;
	}
	return 0;
}

int main() {
#ifdef DEBUG

#endif
	int N;
	scanf("%d", &N);
	int sum = 0;
	sum += num[3] = N % 10; N /= 10;
	sum += num[2] = N % 10; N /= 10;
	sum += num[1] = N % 10; N /= 10;
	sum += num[0] = N;
	checkOP(0);
	printf("%d", num[0]);
	int i;
	for (i = 1; i <= 3; i++) {
		if (flag[i - 1] == 1) {
			printf("+");
		}
		else {
			printf("-");
		}
		printf("%d", num[i]);
	}
	printf("=7\n");

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define u128 __int128
#define pb push_back

#define N 100010
#define MOD 1000000007

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

	ll a, b;
	cin >> a >> b;
	ll m = a + b >> 1;
	if(abs(a- m) == abs(b - m))
		cout << m;
	else
		cout << "IMPOSSIBLE\n";
	return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.000000001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main(){
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int k, i, j, w, h;
	cin >> h >> w;
	vector2d(tile, char, h + 2, w + 2, 0);
	for (i = 0; i < w + 2; i++) tile[0][i] = '.';
	for (k = 1; k <= h; k++){
		string tmp;
		cin >> tmp;
		tile[k][0] = '.';
		for (i = 1; i <= w; i++) tile[k][i] = tmp[i - 1];
		tile[k][w + 1] = '.';
	}
	for (i = 0; i < w + 2; i++) tile[h + 1][i] = '.';
	for (i = 1; i <= h; i++){
		for (j = 1; j <= w; j++){
			if (tile[i][j] == '#' && tile[i - 1][j] == '.' && tile[i][j - 1] == '.' && tile[i + 1][j] == '.' && tile[i][j + 1] == '.'){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
// Aizu Vol0 0008: Sum of 4 Integers
// 2017.7.28

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

char *gets(char *);

int main()
{
	char buf[1000];
	int a, b, c, d, n;
	int ab, abc;
	int ans[60];

	for (n = 0; n <= 50; n++) ans[n] = 0;
	for (a = 0; a < 10; a++) {
		for (b = 0; b < 10; b++) {
			ab = a + b;
			for (c = 0; c < 10; c++) {
				abc = ab + c;
				for (d = 0; d < 10; d++) ans[abc + d]++;
			}
		}
	}

#if 0
	for (n = 0; n <= 50; n++) printf("Debug (%d)=%d\n", n, ans[n]);
#endif

	while (gets(buf) != NULL) {
		printf("%d\n", ans[atoi(buf)]);
	}
	return 0;
}

Measured memory_bytes: 524
n = int(input())
sum = 0
sub = 101
for i in range(n):
    store = int(input())
    sum += store
    if store % 10 != 0 and store < sub:
        sub = store
if sum % 10 != 0:
    print(sum)
else:
    if sub == 101:
        print(0)
    else:
        print(sum - sub)


Measured memory_bytes: 2940
import heapq
import math
N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))
heapq.heapify(A)

while M > 0:
  a = heapq.heappop(A)
  heapq.heappush(A, a/2)
  M -= 1


ans = 0
for a in range(N):
  ans += math.floor(-A[a])

print(ans)


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

int main()
{
  int n;
  double ans = 0;
  cin >> n;
  vector<double> vec(n);
  for (int i = 0; i < n; i++)
  {
    cin >> vec.at(i);
    ans += 1 / vec.at(i);
  }
  ans = 1 / ans;
  printf("%.10lf\n", ans);
}

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

int gcd(int m, int n);

int main(int argc, const char * argv[])
{
    //std::cout << "Hello World\n";
    int n, m;
    while(cin >> n >> m){
        //std::cout << n << "," << m << "\n";
        cout << gcd(n, m) << "\n";
    }
    return 0;
}

int gcd(int m, int n){
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

Measured memory_bytes: 1160
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n,d=n1()

a=2*d+1
print(n//a if n%a==0 else n//a+1)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
	char s[101];
	int i,j,len,flag1=0,flag2=0;
	gets(s);
	len=strlen(s);
	for(i=1;i<len+1;i++)
	{
		if(i%2!=0)
		{
			if(s[i-1]=='R'||s[i-1]=='U'||s[i-1]=='D')
			{
				flag1=1;
			}
			else
			{
				flag1=0;
				break;
			}	
		}
		else
		{
			if(s[i-1]=='L'||s[i-1]=='U'||s[i-1]=='D')
			{
				flag1=1;
			}
			else
			{
				flag1=0;
				break;
			}	
		}	
	}
	if(flag1==1)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
class mint {
 private:
  ll _num,_mod;
  mint set(const ll &num){ 
      _num = num ;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
      return *this;
  }
  ll imod()const{
    ll n=_mod-2;
    ll ans = 1,x=_num;
    while(n != 0){
        if(n&1) ans = ans*x%_mod;
        x = x*x%_mod;
        n = n >> 1;
    }
    return ans;
  }
 public:
  explicit mint(const ll &num=0,const ll &M=1000000007):_mod(M){
      set(num);
  }
  mint(const mint &cp){_num=cp._num;_mod=cp._mod;}
  
  mint operator+ (const mint &x)const{ return mint(_num + x._num , _mod); }
  mint operator- (const mint &x)const{ return mint(_num - x._num , _mod);}
  mint operator* (const mint &x)const{ return mint(_num * x._num , _mod); }
  mint operator/ (const mint &x)const{ return mint(_num * x.imod() , _mod);}
  
  mint operator+=(const mint &x){ return set(_num + x._num); }
  mint operator-=(const mint &x){ return set(_num - x._num); }
  mint operator*=(const mint &x){ return set(_num * x._num); }
  mint operator/=(const mint &x){ return set(_num * x.imod());}

  mint operator= (const ll &x){ return set(x); }
  mint operator+ (const ll &x)const{return *this + mint(x,_mod); }
  mint operator- (const ll &x)const{ return *this - mint(x,_mod); }
  mint operator* (const ll &x)const{ return *this * mint(x,_mod); }
  mint operator/ (const ll &x)const{ return *this/mint(x);}

  mint operator+=(const ll &x){ *this = *this + x;return *this; }
  mint operator-=(const ll &x){ *this = *this - x;return *this; }
  mint operator*=(const ll &x){ *this = *this * x;return *this;}
  mint operator/=(const ll &x){ *this = *this / x;return *this;}

  bool operator==(const mint &x)const{return _num==x._num;}
  bool operator!=(const mint &x)const{return _num!=x._num;}

  friend mint operator+(const ll &x,const mint &m){return mint(m._num + x , m._mod);}
  friend mint operator-(const ll &x,const mint &m){return mint( x - m._num , m._mod);}
  friend mint operator*(const ll &x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend mint operator/(const ll &x,const mint &m){return mint(m.imod() * (x % m._mod) , m._mod);}

  explicit operator ll() { return _num; }
  explicit operator int() { return (int)_num; }
  
  friend std::ostream& operator<<(std::ostream &os, const mint &x){ os << x._num; return os; }
  friend std::istream& operator>>(std::istream &is, mint &x){ll val; is>>val; x.set(val); return is;}
};
int main(){
    int N,K;
    int a[100];
    cin>>N>>K;
    REP(i,N) cin>>a[i];
    vector<vector<mint>> dp(N+1,vector<mint>(2*K+2));
    dp[N][K]=1;
    for(int i=N-1;i>=0;--i) for(int j=K;j>=0;--j){
        dp[i][j]=dp[i+1][j]+dp[i][j+1]-dp[i+1][j+a[i]+1];
    }
    cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 319232
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
ll a,b,c;
cin>>a>>b>>c;
cout<<min({a+b,b+c,c+a})<<endl;
}









Measured memory_bytes: 256
a, b = map(int,input().split())
count = 1
a_s = 0
b_s = 0
for i in range(b):
    a_s += a*count
    count = 10**(i+1)
count = 1
for i in range(a):
    b_s += b*count
    count = 10**(i+1)
if a > b:
    print(str(b_s))
else:
    print(str(a_s))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int **mat_a, **mat_b;
    long long int **mat_c;
    int n, m, l, i, j, k, sum;

    scanf("%d %d %d", &n, &m, &l);

    mat_a = (int **)malloc(sizeof(int *) * n);
    for (i=0; i<n; i++) {
        mat_a[i] = (int *)malloc(sizeof(int) * m);
    }

    mat_b = (int **)malloc(sizeof(int *) * m);
    for (i=0; i<m; i++) {
        mat_b[i] = (int *)malloc(sizeof(int) * l);
    }

    mat_c = (long long int **)malloc(sizeof(long long int *) * n);
    for (i=0; i<n; i++) {
        mat_c[i] = (long long int *)malloc(sizeof(long long int) * l);
    }

    for (i=0; i<n; i++) {
        for (j=0; j<m; j++) {
            scanf("%d", &mat_a[i][j]);
        }
    }
    
    for (i=0; i<m; i++) {
        for (j=0; j<l; j++) {
            scanf("%d", &mat_b[i][j]);
        }
    }

    for (i=0; i<n; i++) {
        for (j=0; j<l; j++) {
            mat_c[i][j] = 0;
            for (k=0; k<m; k++) {
                mat_c[i][j] += mat_a[i][k] * mat_b[k][j];
            }  
        }
    }

    for (i=0; i<n; i++) {
        printf("%lld", mat_c[i][0]);
        for(j=1; j<l; j++) {
            printf(" %lld", mat_c[i][j]);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <list>
#include <cmath>
#include <fstream>
#include <queue>
#include <sstream>
#include <algorithm>
#include <cstring>
using namespace std;

template <class T> void change(T &a, T &b)// 交&#25442;
{
	T temp;
	temp = a;
	a = b;
	b = temp;
}
template <class T> void quicksort(vector<T> &S,int a,int b) // 快速排序
{
     int x = a;
	 int y = b;
	 T mid = S[(a+b)>>1];
     while (x <= y)
     {
           while (S[x] < mid) x++;
           while (S[y] > mid) y--;
           if (x <= y)
           {
              change(S[x], S[y]);
              x++;
              y--;
           }
     }
     if (x < b) quicksort(S, x, b);
     if (y > a) quicksort(S, a, y);
}

int main()
{
	vector<int> v(3);
	int ncase;
	cin >> ncase;
	while(ncase--)
	{
		cin >> v[0] >> v[1] >> v[2];
		quicksort(v,0,2);
		bool flag = (v[0]*v[0] + v[1]*v[1] == v[2]*v[2]);
		cout << (flag? "YES" :"NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    ll a, b, c; cin >> a >> b >> c;
    ll ans = 0;
    if(b >= c) ans = b + c;
    else{
        ans += b*2;
        c -= b;
        if(a < c) ans += a+1;
        else ans += c;
    }
    cout << ans << endl;
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 256
s = input()
A = int(s[:2])
B = int(s[2:])
lis = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
if A in lis:
	a = 1
else:
	a = 2
if B in lis:
	b = 1
else:
	b = 2
if a == 1 and b == 1:
	print("AMBIGUOUS")
elif a == 1 and b == 2:
	print("MMYY")
elif a == 2 and b == 1:
	print("YYMM")
else:
	print("NA")

Measured memory_bytes: 3064
import string
A2Z="abcdefghijklmnopqrstuvwxyz"
R=range(26)
def decode(msg,L):
    x=""
    for c in msg: x+=(L[A2Z.index(c)] if "a"<=c<="z" else c)
    return x

def affine(msg, a, b):
    L="".join([A2Z[(i*a+b)%26]for i in R])
    s = decode(msg,L)
    return s

def rot(msg, a):
    a = a % 26
    L = A2Z[a:]+A2Z[:a]
    s = decode(msg,L)
    return s

def checkkey(s):
    c0="t"
    for i in R:
        a = 0
        x = affine(s,i,0)
        c = A2Z.index(x[0])
        if c!=19:
            a = (19-c)%26
            x = rot(x,a)
        if x in['this','that']: return i,a
    return -1,-1

n = input()
while n:
    n-=1
    s = raw_input()
    for w in s.split():
        if len(w)==4:
            a,b = checkkey(w)
            if a!=-1: break
    print affine(s,a,b)

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

int main(int argc, char **argv)
{
    int N;
    std::cin >> N;

    std::vector<int> a(N);
    for(int i = 0; i < N; i++){
        std::cin >> a.at(i);
    }

    std::sort(a.begin(), a.end());
    std::reverse(a.begin(), a.end());

    int alice = 0, bob = 0;
    int alice_turn = true;
    for(int i = 0; i < N; i++){
        if(alice_turn){
            alice += a.at(i);
        }else{
            bob += a.at(i);
        }
        alice_turn = !alice_turn;
    }

    std::cout << (alice - bob) << std::endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll x, y;
  cin >> x >> y;
  bool ans = false;

  rep(i, x+1) {
    if (2*i + 4*(x-i) == y) ans = true;
  }

  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll H,W,m;
  cin>>H>>W>>m;
  vi h(m),w(m);
  rep(i,m) cin>>h[i]>>w[i];
  rep(i,m){
    h[i]--; w[i]--;
  }
  set<P> sp;
  rep(i,m) sp.insert(make_pair(h[i],w[i]));
  vi yoko(H,0),tate(W,0);
  rep(i,m){
    yoko[h[i]]++; tate[w[i]]++;
  }
  vector<P> a(H),b(W);
  rep(i,H){
    a[i].fi=yoko[i];
    a[i].se=i;
  }
  rep(i,W){
    b[i].fi=tate[i];
    b[i].se=i;
  }
  sort(all(a)); sort(all(b));
  reverse(all(a)); reverse(all(b));
  ll x=a[0].fi,y=b[0].fi;
  set<ll> ymemo,tmemo;
  rep(i,H){
    ymemo.insert(a[i].se);
    if(i==H-1) break;
    if(a[i].fi>a[i+1].fi) break;
  }
  rep(i,W){
    tmemo.insert(b[i].se);
    if(i==W-1) break;
    if(b[i].fi>b[i+1].fi) break;
  }
  ll k=0;
  for(P p:sp){
    if(ymemo.count(p.fi)&&tmemo.count(p.se)){
      k++;
    }
  }
  if(ymemo.size()*tmemo.size()-k>0) out(x+y);
  else out(x+y-1);
  //for(ll x:ymemo) out(x);
  //for(ll x:tmemo) out(x);
  //for(P p:sp) outp(p);
  //cout<<x<<y<<endl;
}

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


Measured memory_bytes: 68904
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == "AC":
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE":
        tle += 1
    elif S == "RE":
        re += 1
print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}' )
print(f'RE x {re}')

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

int main(){
    string s;
    cin >> s;
    if(s == "AKIHABARA" 
    || s == "KIHABARA" 
    || s == "AKIHBARA" 
    || s == "AKIHABRA" 
    || s == "AKIHABAR" 
    || s == "KIHBARA" 
    || s == "KIHABARA" 
    || s == "AKIHABRA" 
    || s == "KIHABAR"
    || s == "AKIHBRA"
    || s == "AKIHBAR"
    || s == "AKIHABR"
    || s == "KIHBRA"
    || s == "KIHBAR"
    || s == "KIHABR"
    || s == "AKIHBR"
    || s == "KIHBR"
    )
     {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

bool dp[1000005];
int cnt[1000005];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	dp[1] = true;
	int x, y;
	rep(i,m){
		cin >> x >> y;
		dp[y] |= dp[x];
		cnt[x]--;
		cnt[y]++;
		if(cnt[x] == -1) dp[x] = false;
	}
	int ans = 0;
	rep(i,n){
		if(dp[i+1]) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;

	for (int i = 0; i < n; i++) {
		cout << s.at(i);
		cout << t.at(i);
	}

 	return 0;
 }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();

        for (int i = n; i > 0; ) {
            String ss = s.substring(i) + s.substring(0, i);
            if (ss.equals(t)) {
                System.out.println("Yes");
                break;
            } else {
                i = i - 1;
            }
            if (i < 1) {
                System.out.println("No");
            }
        }

    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <cmath>
#include <climits>
using namespace std;
 
int main() {
	int n,k;
	cin>>n>>k;
	int i,j;
	int a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	int b[n]={0};
	b[0]=0;
	b[1]=abs(a[1]-a[0]);
	if(k<n){
	for(i=2;i<k;i++){
		int min=INT_MAX,l;
		for(j=1;j<=i;j++){
			l=b[i-j]+abs(a[i]-a[i-j]);
			if(l<min)
				min=l;
		}
		b[i]=min;
	}
	}
	for(i=k;i<n;i++){
		int min=INT_MAX,l;
		for(j=1;j<=k;j++){
			l=b[i-j]+abs(a[i]-a[i-j]);
			if(l<min)
				min=l;
		}
		b[i]=min;
	}
	cout<<b[n-1];
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
T, A = map(int, input().split())
lst = list(map(int, input().split()))
x = 10**9
loc = 0
for i in range(N):
    a = abs(A-T+0.006*lst[i])
    if a < x:
        loc = i
        x = a
print(loc+1)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
 
int solve(int,int);
 
int n;
int A[21];
 
int main(){
  int q,i,s;
  int m[201];
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(A[i]<1 || A[i]>2000){
      exit(1);
    }
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
    if(m[i]<1 || m[i]>2000){
      exit(8);
    }
  }
 
  for(i=0;i<q;i++){
    s=solve(0,m[i]);
    if(s==1){
      printf("yes\n");
    }else if(s==0){
      printf("no\n");
    }
  }
 
  return 0;
}
 
int solve(int i,int m){
  int res;
 
  if(m==0){
    return 1; //true
  }
 
  if(i>=n){
    return 0; //false
  }
 
  res=solve(i+1,m) || solve(i+1,m-A[i]);
 
  return res;
}

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

int main()
{
  int h,w;
  cin >> h >> w;
  string board[50];
  for(int i = 0;i < h;i++) cin >> board[i];

  const int dx[8] = {1,0,-1,0,1,-1,-1,1};
  const int dy[8] = {0,1,0,-1,1,1,-1,-1};

  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(board[i][j] == '#') continue;

      int num = 0;
      for(int d = 0; d < 8;d++){
        const int ni = i + dy[d];
        const int nj = j + dx[d];

        if(ni < 0 or h <= ni ) continue;
        if(nj < 0 or w <= nj ) continue;
        if(board[ni][nj]  == '#') num++;
      }

      board[i][j] = char(num + '0');
    }
  }
  for(int i = 0;i < h;i++) cout << board[i] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  vector<int> A(N);
  for (auto& a : A) cin >> a;
  map<int, int> m{};
  for (auto a : A) {
    ++m[a];
  }
  // map<int, int> res{};
  ll res{};
  for (const auto& p : m) {
    auto a = p.first;
    ll b = p.second;
    auto sum = (b-1) * b / 2;
    res += sum;
  }
  for (int i = 0; i < N; ++i) {
    auto r = m[A[i]];
    auto ans = res - (r - 1);
    cout << ans << CRLF;
  }
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
typedef long long ll;
typedef int64_t in;
using namespace std;



int main(){
    while(1){
        string s;
        vector<vector<int>> xy(9,vector<int>(9));
        vector<char> jfen;
        int a,b,c,d;
        int index=0;
        int intstr=0;
        int x=0, y=0;
        int X=0, Y=0;
        cin >> s;
        if(s == "#") break;
        cin >> a >> b >> c >> d;
        while(index < s.size()){
            if(s[index] == 'b') {
                xy[y][x] = -1;
                x++;
                index++;
            }else if(s[index] == '/'){
                y++;
                x=0;
                index++;
            }else{
                intstr = (int) s[index] - '0';
                //cout << intstr;
                for(int i=0; i<intstr; i++){
                    xy[y][x] = 0;
                    x++;
                }
                index++;
            }
        }
        //cout << index << x << y << endl;

        xy[a-1][b-1] = 0;
        xy[c-1][d-1] = -1;
        intstr = 0;
        while(Y <= y){
            if(X==x){
                if(Y==y) break;
                if(intstr != 0){
                    char st = (char) intstr + '0';
                    jfen.push_back(st);
                    intstr = 0;
                }
                jfen.push_back('/');
                X = 0;
                Y++;
                continue;
            }
            if(xy[Y][X] == -1){
                if(intstr != 0){
                    char st = (char) intstr + '0';
                    jfen.push_back(st);
                    intstr = 0;
                }
                jfen.push_back('b');
                X++;
            }else{
                intstr += 1;
                X++;
            }
        }
        if(intstr != 0){
            char st = (char) intstr + '0';
            jfen.push_back(st);
            intstr = 0;
        }
        
        for(int i=0; i<jfen.size(); i++){
            cout << jfen.at(i);
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m, x, y; cin >> n >> m >> x >> y;
    int max_a = x;
    for(int i = 0; i < n; ++i) {
        int z; cin >> z;
        max_a = max(z, max_a);
    }

    int min_b = y;
    for(int i = 0; i < m; ++i) {
        int z; cin >> z;
        min_b = min(z, min_b);
    }
    cout << (max_a < min_b  ? "No War" : "War");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#include <atcoder/all>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N, D;
	cin >> N >> D;
	vector<vi> P(N);
	rep(i, N) {
		P[i].resize(2);
		cin >> P[i][0] >> P[i][1];
	}
	two_sat ts(N);
	rep(i, N) {
		rep(j, N) {
			if (i >= j)
				continue;
			rep(bi, 2) {
				rep(bj, 2) {
					if (abs(P[i][bi] - P[j][bj]) < D)
						ts.add_clause(i, !bi, j, !bj);
				}
			}
		}
	}
	string ans = ts.satisfiable() ? "Yes" : "No";
	cout << ans << endl;
	if (ans == "Yes") {
		vb anslist = ts.answer();
		rep(i, N)
			cout << P[i][anslist[i]] << endl;
	}
	return 0;
}

Measured memory_bytes: 3792
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
pq = []
for i, b in enumerate(B):
    if A[i] != b:
        heappush(pq, (-b, i))
ans = 0
while pq:
    _, i = heappop(pq)
    s = B[(i-1) % N] + B[(i+1) % N]
    q, r = divmod(B[i] - A[i], s)
    B[i] = A[i] + r
    ans += q
    if q == 0:
        ans = -1
        break
    if B[i] > A[i]:
        heappush(pq, (-B[i], i))
print(ans)

Measured memory_bytes: 122828
use proconio::{input, fastout};
use proconio::marker::Chars;
use itertools::iproduct;

type Tri = (usize, usize, usize);

fn contain(s: &Vec<usize>, v: &Tri) -> bool {
  let v = [v.0, v.1, v.2];
  let mut idx = 0;
  for c in s {
    if *c == v[idx] {
      idx += 1;
    }
    if idx >= 3 {
      return true;
    }
  }
  false
}

#[fastout]
fn main() {
  input!{
    n: usize,
    s: Chars
  };
  let s: Vec<usize> = s.iter().map(|x| { x.to_digit(10).unwrap() as usize }).collect();
  // // let mut dp = vec![vec![(false, false, false);10];4];
  // let mut dp = vec![vec![vec![(false, false, false);10];10];10];
  // let mut ans = 0;
  // for i in s {
  //   for j in 0..10 {
  //     for k in 0..10 {
  //       let a = &dp[j][k][i];
  //       if a.0 && a.1 && !a.2{
  //         dp[j][k][i] = (true, true, true);
  //         ans += 1;
  //       }
  //     }
  //   }
  //   for j in 0..10 {
  //     for k in 0..10 {
  //       let a = &dp[j][i][k];
  //       if a.0 && !a.1 {
  //         dp[j][i][k] = (true, true, false);
  //         // ans += 1;
  //       }
  //     }
  //   }
  //   for j in 0..10 {
  //     for k in 0..10 {
  //       let a = &dp[i][j][k];
  //       if !a.0 {
  //         dp[i][j][k] = (true, false, false);
  //         // ans += 1;
  //       }
  //     }
  //   }
  // }
  let ans = iproduct!(0..10, 0..10, 0..10).filter(|v| {contain(&s, v)})
    .collect::<Vec<Tri>>().len();
  println!("{}", ans);
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

int A, B, C, D;

void solve()
{
    cin >> A >> B >> C >> D;
    cout << max(A*B, C*D) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char stringMain[101];   //max input + '\0'
    char stringPrimer[101]; //max input + '\0'
    char trash;             //trach for'/n'
    int i, i2, i3;          //loop count
    int result = 0;         //for return print 
    
    //input
    scanf("%s\0", stringMain);
    scanf("%c", trash);
    scanf("%s\0", stringPrimer);
    scanf("%c", trash);
    
    //loop for reading point in Main 
    for(i = 0; stringMain[i] != '\0'; i++){
        
        //initialize for primer first point
        i2 = i;
        i3 = 0;
        
        //read untill not mutching or all mutching with Priimer
        for(;;){
            
            //not mutching, next Main start point
            if(stringMain[i2] != stringPrimer[i3]){
                break;
            } 
            
            //rounder for Main 
            i2++;
            if(stringMain[i2] == '\0'){
                i2 = 0;
            }
            
            //next loo or pall mutch with Primer
            i3++;
            if(stringPrimer[i3] == '\0'){
                result = 1;
                break;
            }
            
        } 
    
    }
    
    //print result
    switch(result){
    case 1:
        printf("Yes\n");
        break;
    case 0:
        printf("No\n");
        break;
    }

    return 0;
}


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

using namespace std;

#define int long long

int MOD = 1e9 + 7;

vector<int> pred(700000);

void fact() {
    pred[0] = 1;
    for (int x = 1; x <= 700001; ++x) {
        pred[x] = pred[x - 1] * x % MOD;
    }
}

int pw(int x, int y) {
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 1) {
        return pw(x, y - 1) * x % MOD;
    }
    else {
        return pw(x * x % MOD, y / 2);
    }
}

signed main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fact();
    int x, y;
    cin >> x >> y;
    int kol_1 = 0;
    int kol_2 = 0;
    for (int i = 0; i < 500050; ++i) {
        if (x - i * 1 >= 0 && x - i * 1 == (y - i * 2) * 2) {
            kol_1 = i;
            kol_2 = y - i * 2;
        }
        //cout << "* " << i << endl;
    }
    if (kol_1 + kol_2 == 0) {
        cout << 0 << endl;
    }
    else {
        //cout << "!!! " << kol_1 + kol_2;
        int now = pred[kol_1 + kol_2];
        now *= pw(pred[kol_1], MOD - 2);
        now %= MOD;
        now *= pw(pred[kol_2], MOD - 2);
        now %= MOD;
        cout << now << endl;
    }
    return 0;
}



Measured memory_bytes: 5760
#https://atcoder.jp/contests/abc164/tasks/abc164_b
A,B,C,D = map(int,input().split())
Senkou_N,Senkou_Amari = divmod(C,B)
if Senkou_Amari != 0:
    Senkou_N += 1
Koukou_N,Koukou_Amari = divmod(A,D)
if Koukou_Amari != 0:
    Koukou_N += 1

if Senkou_N <= Koukou_N:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9012
# Problem: https://atcoder.jp/contests/abc088/tasks/abc088_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(allCards, eachCards):
    eachCardSort = sorted(eachCards, reverse=True)
    AlicesTotal = 0
    BobsTotal = 0
    for j in range(0, allCards, +1):
        if j % 2 == 0:
            AlicesTotal = AlicesTotal + eachCardSort[j]
        else:
            BobsTotal = BobsTotal + eachCardSort[j]
    # algorithm
    return AlicesTotal - BobsTotal


if __name__ == "__main__":
    N = II()
    AN = LI()
    print("{}".format(solver(N, AN)))


Measured memory_bytes: 3064
using System;

namespace ABC059B
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            char before = '0';
            char grand_before = '0';

            for (int i = 0; i < s.Length; i++)
            {
                char current = s[i];
                if (before == current)
                {
                    Console.WriteLine("" + i + " " + (i + 1));
                    return;
                }
                if (grand_before == current)
                {
                    Console.WriteLine("" + (i - 1) + " " + (i + 1));
                    return;
                }

                grand_before = before;
                before = current;
            }
            Console.WriteLine("-1 -1");
        }
    }
}

Measured memory_bytes: 13140
/*---> 26 January 2020 <--- > 17:35:43 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	int n,k;
	cin>>n>>k;
	vi a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	if(k>=n)
		cout<<0<<"\n";
	else{
		sort(rall(a));
		int ans=0;
		for(int i=0;i<n;i++){
			if(i>=k)
				ans+=a[i];
		}
		cout<<ans<<"\n";
	}
return 0;
}

Measured memory_bytes: 1792