akhauriyash/Code-Regression huggingface dataset:
N = int(input())
ans = [0 for i in range(N)]
for x in range(1, N+1):
    for y in range(1, N+1):
        for z in range(1, N+1):
            if x**2 + y**2 + z**2 + x*y + y*z + x*z > N:
                break
            else:
                ans[x**2 + y**2 + z**2 + x*y + y*z + x*z -1] += 1
for i in ans:
    print(i)

Measured memory_bytes: 69216
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	n := getInt()
	xs := getIntSlice(n)

	a, b := func() (int, int) {
		tmp := make([]int, n)
		copy(tmp, xs)
		sort.Ints(tmp)
		return tmp[n/2-1], tmp[n/2]
	}()

	ans := make([]string, n)
	for i, x := range xs {
		if x <= a {
			ans[i] = strconv.Itoa(b)
		} else {
			ans[i] = strconv.Itoa(a)
		}
	}

	fmt.Println(strings.Join(ans, "\n"))
}

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;
const int K = 500;
const int maxN = 50;

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(all(a));
	int ans = 0;
	for (int i = 0; i < n - k; i++) {
		ans += a[i];
	}
	cout << ans;
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

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

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int res = 0;
    for (int i = 0; i <= N / R; i++) {
        for (int j = 0; j <= N / G; j++) {
            int rest = N - i * R - j * G;
            if (rest % B == 0 && rest >= 0) {
                res++;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

public class Main {

    public static void main(String args[]) {
        String line = "";
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
            while ((line = bufferedReader.readLine()) != null) {
                double volume =  Math.pow((double)Integer.parseInt(line), 3d);
                System.out.println((int)volume);
            }


        } catch (IOException e) {

        }
    }
}



Measured memory_bytes: 24208
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iterator>
#include <string>
#include <cmath>

# define PI 3.14159265358979323846

using namespace std;

int main(void) {
    int a, b, c;
    cin >> a >> b >> c;

    int loops = 0;
    while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
        int na, nb, nc;
        na = b / 2 + c / 2;
        nb = a / 2 + c / 2;
        nc = a / 2 + b / 2;
        if (a == na || b == na || c == nc) {
            loops = -1;
            break;
        }
        a = na;
        b = nb;
        c = nc;
        ++loops;
    }
    cout << loops << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
#define ll long long 
const int maxn=1000010;
const ll mod=1e9+7;
int n;
ll f[maxn][2][2];
int main(){
    scanf("%d",&n);
    f[1][0][0]=8;
    f[1][1][0]=1;
    f[1][0][1]=1;
    for (int i=2;i<=n;++i){
        f[i][0][0]=f[i-1][0][0]*8%mod;
        f[i][1][0]=(f[i-1][0][0]+f[i-1][1][0]*9%mod)%mod;
        f[i][0][1]=(f[i-1][0][0]+f[i-1][0][1]*9%mod)%mod;
        f[i][1][1]=(f[i-1][0][1]+f[i-1][1][0]+f[i-1][1][1]*10%mod)%mod;
    }
    printf("%lld",f[n][1][1]%mod);
    return 0;
}

Measured memory_bytes: 34972
#include <cstdio>
#include <cstdlib>
#include <cstring>

int main(){
	char tbl[6][5] = {{'a', 'b', 'c', 'd', 'e'},
						{'f', 'g', 'h', 'i', 'j'},
						{'k', 'l', 'm', 'n', 'o'},
						{'p', 'q', 'r', 's', 't'},
						{'u', 'v', 'w', 'x', 'y'},
						{'z', '.', '?', '!', ' '}};
	
	char m[1000];
	char om[1000];
	
	while(scanf("%s", m) != EOF){
		int len = strlen(m);
		if(len % 2 == 0){
			int j = 0;
			bool na = false;
			for(int i = 0; i < len-1; i+=2){
				int c, c1;
				c = m[i] - '0';
				c1 = m[i+1] - '0';
				if(c < 1 || c > 6 || c1 < 1 || c1 > 5){
					na = true;
					break;
				}
				om[j] = tbl[c-1][c1-1];
				j++;
			}
			if(na){
				printf("NA");
			}else {
				for(int i = 0; i < j; i++){
					printf("%c", om[i]);
				}
			}
			putchar('\n');
		}else {
			printf("NA\n");
		}
	}
}

Measured memory_bytes: 972
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <cmath>
using namespace std; 
int main() 
{ 
	 long long int a;
	 cin>>a;
	 cout<<a+a*a+a*a*a<<endl;
return 0; 
} 


Measured memory_bytes: 3592
import numpy as np
n,W = [int(e) for e in input().split()]
v = np.zeros(n,dtype='int64')
w = np.zeros(n,dtype='int64')

for i in range(n):
    w[i],v[i] = [int(e) for e in input().split()]

dp = np.zeros(W+1,dtype='int64')

for i in range(n):
    dp[w[i]:] = np.maximum(dp[:W-w[i]+1]+v[i],dp[w[i]:])

print(dp[-1])

Measured memory_bytes: 15520
a = list(map(int,input().split()))
a1 = a[:3]
b = sorted(a1)
num = a[3] // b[2]
count = 0
if num >= 1:
  for i in range(num+1):
    c = a[3] - (b[2] * i)
    num1 = c // b[1]
    if num1 >= 1:
      for j in range(num1+1):
        d = c - (b[1] * j)
        num3 = d / b[0]
        if num3.is_integer() is True:
          count += 1
    elif num1 == 0:
      num2 = c / b[0]
      if num2 >=0 and num2.is_integer() is True:
        count += 1
elif num < 1:
  num4 = a[3] // b[1]
  if num4 >= 1:
    for i in range(num4+1):
      g = a[3] - (b[1] * i)
      num5 = g / b[0]
      if num5.is_integer() is True:
          count += 1
  else:
    num6 = a[3] / b[0]
    if num6 >= 0 and num6.is_integer() is True:
      count += 1
elif a[3] < a[2] and a[3] < a[1] and a[3] < a[0]:
  count = 0 
print(count)

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

int main(){
  string S;
  cin >> S;
  
  string ans = "Yes";
  rep(i,S.size()){
    if(0 == i%2 && 'L' == S.at(i)){
      ans = "No";
      break;
    }else if(1 == i%2 && 'R' == S.at(i)){
      ans = "No";
      break;
    }
  }
  
  cout << ans << endl;
}

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

#define int long long

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int n;
	cin >> n;

	if (n % 1000 == 0) {
		cout << 0;
	}
	else {
		while ( n > 0) {
			n -= 1000;
		}
		cout << -1 * n;
	}



	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    string u; cin >> u;
    if(s == u) a--;
    if(t == u) b--;
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;

int main(){
int A;
cin>>A;
cout<<A*6.28<<endl;



}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int k,s;
  cin >> k>>s;
  int ans=0;
  rep(x,k+1){
    rep(y,k+1){
      if(s-x-y>=0 &&s-x-y<=k){
        ans++;
      }
    }
  }
  cout <<ans;
}
  
      

Measured memory_bytes: 3600
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;
#define pb(x)                       push_back(x)
#define ts(x)                       to_string(x)
#define ti(x)                       stoi(x)
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define mine(v)                     *min_element(all(v))
#define maxe(v)                     *max_element(all(v))
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"
inline ll input(){ll n; cin >> n ; return n;}
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;
ll n, w;
ll wei[110],v[110];
ll dp[110][MAXN];


int main()
{
    fast_io;
    cin >> n >> w;
    for (int i = 1; i <= n;i++){
        cin >> wei[i] >> v[i];
    }
    for (int i = 1; i <= n;i++){
        for (int j = w;j >= 0;j--){
            if (j < wei[i]){
                dp[i][j] = dp[i - 1][j];
            }
            else{
                dp[i][j] = max(dp[i-1][j - wei[i]] + v[i],dp[i - 1][j]);
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i <= w;i++)
        ans = max(ans,dp[n][i]);
    cout << ans << endl;
}


Measured memory_bytes: 79360
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(key=lambda x: x[1], reverse=True)
d = []
i = 0

while len(d) <= n and i < len(bc):
    d += ([bc[i][1]] * bc[i][0])
    i += 1

if len(d) > n:
    d = d[:n]

a += d
a.sort(reverse=True)

print(sum(a[:n]))


Measured memory_bytes: 34524
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

const int N = 30;
int memo[2*N+1][2*N+1];

int rec(int X, int Y){
    int& ret = memo[X][Y];
    if(ret != -1) return ret;

    ret = 0;
    rep(i, 2, X+1){
        if(i % 2) continue;
        ret |= (rec(X - i, Y + i / 2) ^ 1);
    }
    rep(i, 2, Y+1){
        if(i % 2) continue;
        ret |= (rec(X + i / 2, Y - i) ^ 1);
    }

    return ret;
}

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

    if(false){
        rep(i, 2*N+1) rep(j, 2*N+1) memo[i][j] = -1;
        rep(i, N+1){
            rep(j, N+1){
                rec(i, j);
            }
        }
        rep(i, N+1){
            rep(j, N+1){
                char c = 'x';
                if(memo[i][j] == 1) c = 'A';
                if(memo[i][j] == 0) c = 'B';
                cerr << c << " ";
            }
            cerr << endl;
        }
        return 0;
    }

    ll X, Y; cin >> X >> Y;
    cout << (abs(X - Y) <= 1 ? "Brown":"Alice") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,k,y=1;
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
    	if(y+k>y*2)y*=2;
    	else y+=k;
    }
    cout<<y<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef long long ll;
const int N = 2e5+10 , OO = 0x3f3f3f3f , mod = 1e9 + 7;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
 

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
  int k;
  string s;
  cin >> k >> s;
  int len = s.size();
  if(len > k){
    s = s.substr(0 , k);
    cout << s << "...\n";
  }
  else 
    cout << s << "\n";

  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
//#define TASK "file"

#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long i64;
typedef long double dbl;
const dbl PI = acos(-1.0L);
const dbl EPS = 1e-12L;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

namespace task {
int n, a;
set<int> s;

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    s.insert(a);
  }
  if (s.size() == n) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(11);
  cout.setf(ios::fixed);
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#elif defined(TASK)
  freopen(TASK".in", "r", stdin);
  freopen(TASK".out", "w", stdout);
#endif
  return task::main();
}


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

int main() {
  int a, b, c, sum = 0;
  cin >> a >> b >> c;

  sum = a + b + c;
  if (sum >= 22) {
    cout << "bust" << endl;
  }
  else if (sum <= 21) {
    cout << "win" << endl;
  }
}


Measured memory_bytes: 256
fun main() {
    var n = readLine()!!.toInt()
    var a = readLine()!!.split(" ").map{it.toInt()}

    var c = 0
    for(i in 0 until n) {
        if((i + 1) % 2 == 1 && a[i] % 2 == 1) c++
    }
    println(c)
}

Measured memory_bytes: 36452
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1<<30

int main()
{
    map<char,int> mp;
    string w;
    cin>>w;
    for(int i=0;w[i];i++)
    {
        mp[w[i]]++;
    }
    int s=0;
    for(auto it:mp)
    {
        if(it.second%2==0)
            s++;
    }
    if(s==mp.size())
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}



Measured memory_bytes: 384
import itertools

n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
ans=[]

for li in itertools.product([0,1], repeat=n-1):
  if li.count(1) < k-1:
    continue
  cost,height=0,A[0]
  for i in range(1,n):
    if height < A[i]:
      height=A[i]
      continue
    if li[i-1]:
      cost += (height-A[i]+1)
      height += 1 
  ans.append(cost)
  
print(min(ans))

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

//dp[i][j] represents cost from i to j


signed main()
{
	long long int n;
	cin>>n;
	
	vector<long long int> x(n);
	
	for(long long int i=0;i<n;i++)
	cin>>x[i];

	vector<long long int> ab(n+2,0);
	vector<vector<long long int> > dp(n+2,ab);
	vector<long long int> prefix(n+1);
	long long int count=0;

	for(long long int i=1;i<=n;i++)
		{
			for(long long int j=1;j<=n;j++)
				dp[i][j]=LONG_MAX;
				// dp[i][j]=INT_MAX;
		}
	for(long long int i=0;i<n;i++)
	{
		count+=x[i];
		prefix[i+1]=count;
	}
	for(long long int i=1;i<n;i++)
	{
		dp[i][i+1]=x[i]+x[i-1];
		dp[i][i]=0;
	}
	dp[n][n]=0;

	for(long long int len=2;len<=n-1;len++)
	{
		for(long long int i=1;i<=n-len;i++)
		{
			long long int j=i+len;
			// dp[i][j]=long long int_MAX;
			
			for(long long int k=i;k<j;k++)
			{
			
			
			long long int sum2=prefix[j],sum1=0;
			
			
			if(i-1>=1)
				sum1=prefix[i-1];
			
			dp[i][j]=min(dp[i][j],(dp[i][k]+dp[k+1][j]) - sum1+ sum2);
			
			}
		}
	}

	cout<<dp[1][n];

	return 0;


}

Measured memory_bytes: 1536
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let s = get_string_input();
    let mut answer = 0u32;
    let mut tmp_answer = 0u32;
    for c in s.chars() {
        if c == 'A' || c == 'C' || c == 'G' || c == 'T' {
            tmp_answer += 1;
        } else {
            if answer < tmp_answer {
                answer = tmp_answer;
            }
            tmp_answer = 0;
        }
    }
    if answer < tmp_answer {
        answer = tmp_answer;
    }
    println!("{}", answer);
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}


Measured memory_bytes: 4352
import bisect
import math

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def ncr(n, r, mod=DIV):
	r = min(r, n-r)
	ret = 1
	for i in range(1, r+1):
		ret = ret * (n-i+1) % mod
		ret = ret * mod_inv(i, mod) % mod
	return ret


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % mod) % mod
    return CONV()


def getStan(n,prevAlpha):
    if n==0:
        return [""]
    if n==1:
        return [[p] for p in range(prevAlpha+2)]
    else:
        ret = []
        for p in range(prevAlpha+1):
            gs = getStan(n-1, prevAlpha)
            ret += [[p]+g for g in gs]
        gs = getStan(n-1, prevAlpha+1)
        ret+=[[prevAlpha+1]+g for g in gs]
        return ret

def main():
    N = iRaw()
    s = "a"*N
    base = ord("a")
    lastS = [chr(ord("a")+n) for n in range(N)]
    gs = getStan(N-1,0)
    for g in gs:
        print ("".join(["a"]+[chr(c+base) for c in g]))

if __name__ == "__main__":
    main()


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

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

  int x, y;
  cin >> x >> y;

  bool range = 2*x <= y && y <= 4*x;
  bool even = y % 2 == 0;

  if (range && even) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef std::vector<ll> lls;
constexpr ll INF = 1LL << 60;
template<class T> inline void chmin(T& a, T b) { if (a > b) a = b; }
template<class T> inline void chmax(T& a, T b) { if (a < b) a = b; }

void cinv(lls& llVec, ll n, bool to_0_origin = false) {
	ll val;
	llVec.reserve((size_t)(n));
	for (ll i = 0; i < n; i++) {
		cin >> val;
		if (to_0_origin) val--;
		llVec.push_back(val);
	}
}


int main()
{
	ll N;
	cin >> N;
	lls h;
	cinv(h, N);

	lls tbl(N, INF);
	tbl[0] = 0;

	for (ll i = 0; i < N - 1; i++) {
		if (i + 1 < N) {
			chmin(tbl[i + 1], tbl[i] + std::abs(h[i] - h[i + 1]));
		}
		if (i + 2 < N) {
			chmin(tbl[i + 2], tbl[i] + std::abs(h[i] - h[i + 2]));
		}
	}

	cout << tbl[N-1] << '\n';

	return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int A, B;
  cin >> A >> B;
  cout << A*B << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int m, n;
    cin >> m >> n;
    cout << mint(m).pow(n) << endl;
}


Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;

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

  vector<int> cost(N);
  cost[0] = 0;
  cost[1] = abs(h[1] - h[0]);

  for (int i = 2; i < N; i++)
  {
    cost[i] = min(cost[i - 2] + abs(h[i] - h[i - 2]), cost[i - 1] + abs(h[i] - h[i - 1]));
  }

  cout << cost[N - 1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    queue<int> que;
    int n, ch;
    cin >> n;
    vector<int> b(n + 1), c(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> ch;
        que.push(ch);
    }
    for (int i = 1; i <= n; i++)
        cin >> b[i];
    for (int i = 1; i < n; i++)
        cin >> c[i];
    
    int ans = 0;
    while (!que.empty())
    {
        int cur = que.front();
        que.pop();
        ans += b[cur];
        if (cur == que.front() - 1)
        {
            ans += c[cur];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

int n, q;
string s;
vector<pair<char, char>> query;

bool check(int pos, char c){
    rep(i, q){
        if(s[pos] != query[i].first){
            continue;
        }
        if(query[i].second == 'L'){
            if(pos == 0){
                return c == 'L';
            }
            pos--;
        }else{
            if(pos == n - 1){
                return c == 'R';
            }
            pos++;
        }
    }
    return false;
}

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

    cin >> n >> q >> s;

    query = vector<pair<char, char>>(q);
    rep(i, q){
        char t, d;
        cin >> t >> d;
        query[i] = {t, d};
    }

    int lo, hi;

    lo = -1;
    hi = n;
    while(hi - lo > 1){
        int mid = (lo + hi) / 2;

        if(check(mid, 'L')){
            lo = mid;
        }else{
            hi = mid;
        }
    }
    int l = lo;

    lo = -1;
    hi = n;
    while(hi - lo > 1){
        int mid = (lo + hi) / 2;

        if(check(mid, 'R')){
            hi = mid;
        }else{
            lo = mid;
        }
    }
    int r = hi;

    cout << n - (l + 1 + n - r) << endl;

    return 0;
}


Measured memory_bytes: 1020
#include <stdio.h>

int main()
{
    int n;
    int a[100000];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int b[100000];
    for(int i=0;i<n;i++)
    {
        b[a[i]-1]=i+1;
    }
    for(int i=0;i<n;i++)
    {
        printf("%d%s",b[i],i==n-1?"\n":" ");
    }
    return 0;
}

Measured memory_bytes: 1536
from collections import Counter

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

if n == 1:
    for t, d in td:
        if s[0] == t:
            print(0)
            exit()
    print(1)
    exit()

def vanish(x):
    for t, d in td:
        if s[x] == t:
            if d == 'L':
                x -= 1
                if x == -1:
                    return -1
            else:
                x += 1
                if x == n:
                    return n
    return x

L = 0
R = n
U = 0
ans = n

while R - L > 1:
    M = (L + R) // 2
    ret = vanish(M)
    if ret == -1:
        L = M
    else:
        R = M

ret = vanish(L)
if ret == -1:
    ans -= L + 1
else:
    ans -= L

L = 0
R = n

while R - L > 1:
    M = (L + R) // 2
    ret = vanish(M)
    if ret == n:
        R = M
    else:
        L = M

ret = vanish(L)
if ret == n:
    ans -= n - L
else:
    ans -= n - 1 - L

print(ans)




Measured memory_bytes: 30512
# 2019-11-19 19:43:48(JST)
import sys
# import collections
from math import pi, atan2
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    a, b, v = map(int, sys.stdin.readline().split())

    if v / a >= a * b / 2:
        ans = atan2(2 * (b - v / a ** 2), a) * 180 / pi 
    else:
        ans = atan2(a * b ** 2, 2 * v) * 180 / pi
    
    print(ans)

if __name__ == "__main__":
    main()


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

double dp[100000][20];int pos[100000][20];
int n;
int kura[20], d[20], sen[20];

double solve(int S, int v, int weight) {
    if (S == ((1 << n) - 1)) return dp[S][v] = 0;
    if (dp[S][v] >= 0) return dp[S][v];

    double res = 1000*1000*1000;
    for (int i = 0; i < n; i++) {
        if (!(S & (1 << i))) {
            double td = abs(d[i]-d[v]);
            double ts = 2000.0/(double)(70+weight);
            double tres = solve(S | (1 << i), i, sen[i]*20 + weight) + td/ts;
            if (res > tres) {
                res = tres;
                pos[S][v] = i;
            }
        }
    }
    return dp[S][v] = res;
}

int main() {
    cin >> n;for (int i = 0; i < 100000; i++) fill(dp[i], dp[i]+20, -1);
    for (int i = 0; i < n; i++) {cin >> kura[i] >> d[i] >> sen[i];}
    d[n] = 0;solve(0, n, 0);
    int S = 0, cur = n;
    vector<int> r;
    for (int i = 0; i < n; i++) {
        int next = pos[S][cur];
        r.push_back(next);
        S = (S | (1 << next));
        cur = next;
    }
    for (int i = 0; i < n-1; i++) cout << kura[r[i]] << ' ';
    cout << kura[r[n-1]] << endl;
    return 0;
}

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

int main(){
  int n, l,sum=0,min,ans;
  cin >> n >> l;
  vector<int> aji(n);

  for(int i=0; i<n ; ++i){
    aji[i] = l+(i+1)-1;
    sum += aji[i];
  }
  min =(aji[0])*(aji[0]);
  for(int i=1; i<n ; ++i){
    if(aji[i]*aji[i] < min){
      min = aji[i]*aji[i];
      ans = i;
    }
  }
  
  cout << sum-aji[ans] << endl;
  return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long
long long INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
    int b;
    char s[101];
    bool a=false;
    cin >> b;
    REP(i,b) cin >> s[i];
    REP(i,b){
        if(s[i] == 'Y') a = true;
    }
    if(a) cout << "Four" << endl;
    else cout << "Three" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
  
const int V_SUM_MAX=100010; 
const int N_MAX=100; 
const int W_MAX=1000000010; 
  
int dp[V_SUM_MAX + 1][N_MAX]; 
bool v[V_SUM_MAX + 1][N_MAX]; 
int w[N_MAX],val[N_MAX];
int n,C;
int solveDp(int r, int i) 
{ 
    if (r <= 0) return 0; 
    if (i == n) return W_MAX; 
    if (v[r][i]) return dp[r][i]; 
    v[r][i] = 1; 
    dp[r][i] = min(solveDp(r, i + 1), w[i] + solveDp(r - val[i], i + 1)); 
    return dp[r][i]; 
} 
  
int main(){
    int flag=0;
    cin >> n >> C;
    for(int i=0;i<n;i++) cin >> w[i] >> val[i]; 
    for (int i=V_SUM_MAX;i>=0;i--) if(solveDp(i, 0)<=C)  {cout << i << endl;flag=1;break;} 
    if(flag==0) cout << flag << endl;
    return 0; 
}

Measured memory_bytes: 49024
#include<bits/stdc++.h>
using namespace std;
#define MAX 50
int a[MAX][MAX];
int main()
{
	int a[5];
	int j;
	for(int i=0;i<5;++i) 
	{
		cin>>a[i];
		if(a[i]==0) j=i;
	}
	cout<<j+1;
	
	 return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner

object Main {
  def main(args:Array[String]):Unit = {
    val sc = new Scanner(System.in)
    val a, b, c = sc.nextInt()

    val tmp = Array(a, b, c).sorted

    if (tmp(0) + tmp(1) == tmp(2)) println("Yes") else println("No")
  }
}

Measured memory_bytes: 27416
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = 100 * in.nextInt() + 10 * in.nextInt() + in.nextInt();
            out.println((n & 3) == 0 ? "YES" : "NO");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



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

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

    static class CExceptionHandling {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int max = 0;
            int smax = 0;
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                int temp = in.nextInt();
                a[i] = temp;
                if (temp >= max) {
                    smax = max;
                    max = temp;
                } else if (temp >= smax) {
                    smax = temp;
                }
            }
            for (int i = 0; i < n; i++) {
                if (a[i] == max) {
                    out.println(smax);
                } else {
                    out.println(max);
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

  ll a, b, k;
  cin >> a >> b >> k;

  if ((b - a + 1) <= k * 2) {
    repi(i, a, b + 1) {
      cout << i << endl;
    }
  } else {
    repi(i, a, a + k) {
      cout << i << endl;
    }

    repi(i, b - k + 1, b + 1) {
      cout << i << endl;
    }
  }

  return 0;
}

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

int main()
{
    ll n,m;
    cin >> n >> m;
    ll ans = 0;
    if(2*n <= m){
        ans = n;
        ans += (m - 2*n)/4;
    }
    else{
        ans = m/2;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define fill(x,y) memset(x,y,sizeof(x))
#define name(x) #x
using namespace std;


const int INF = INT_MAX-100;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

template< typename T >
using Edges =vector< edge<T> >;
template< typename T >
using WeightedGraph =vector< Edges<T> >;
using UnWeightedGraph =vector< vector<int> >;
template< typename T >
using Matrix =vector< vector<T> >;



int main() {
    // if double is required
    //cout<<fixed<<setprecision(10);

    int a1,b1,a2,b2,a3,b3;
    int city[4] = {0};
    cin >> a1 >> b1 >> a2 >> b2 >> a3>> b3;
    city[a1-1]++;
    city[a2-1]++;
    city[a3-1]++;
    city[b1-1]++;
    city[b2-1]++;
    city[b3-1]++;
    
    int count1 = 0;
    int count2 = 0;
    for(auto i = 0; i<4; i++){
        
        if (city[i] == 1){
            count1++;
        }else if (city[i] == 2){
            count2++;
        }
        
    }
    
    if (count1 == 2 && count2 == 2){
        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++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main()
{
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
  {
    int ans = 0;
    for (int x = 1; x < 100; x++)
    {
      for (int y = 1; y < 100; y++)
      {
        for (int z = 1; z < 100; z++)
        {
          int v = x * x + y * y + z * z + x * y + y * z + z * x;
          if (v > i)
            break;
          if (v == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3564
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    
    let s = get();
    
    let ans: i32 = match s {
    "SUN" => 7,
    "MON" => 6,
    "TUE" => 5,
    "WED" => 4,
    "THU" => 3,
    "FRI" => 2,
    "SAT" => 1,
    _ => unreachable!(),
    };
    
    println!("{}", ans);
}

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

int x[26];

int main(){
  string s; cin >> s;
  int n = s.size();
  int k; cin >> k;
  for (int i = 0; i < n; i++) {
    x[s[i]-'a']++;
  }
  set<string> se;
  while(true){
    int u;
    for (int i = 0; i < 26; i++) {
      if (x[i] != 0) {
        u = i;
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      if (s[i]-'a' == u) {
        for (int j = 1; j <= k && j+i-1 < n; j++) {
          se.insert(s.substr(i, j));
        }
      }
    }
    x[u] = 0;
    if (se.size() >= k) break;
  }
  for (set<string>::iterator it = se.begin(); it != se.end(); it++) {
    k--;
    if (k == 0) {
      cout << *it << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	int A=sc.nextInt();
    	int B=sc.nextInt();
    	int C=sc.nextInt();
    	int D=sc.nextInt();
    	int E=sc.nextInt();
    	int F=sc.nextInt();

    	Set<Integer> water=new TreeSet<Integer>();

    	for(int i=0;i<=F/(100*A);i++) {
    		for(int j=0;j<=F/(100*B);j++) {

    			int buf=100*A*i+100*B*j;

    			if(buf<=F) {
    				water.add(buf);
    			}

    		}
    	}

    	Set<Integer> sugar=new TreeSet<Integer>();

    	for(int i=0;i<=F/C;i++) {
    		for(int j=0;j<=F/D;j++) {

    			int buf=C*i+D*j;

    			if(buf<=F) {
    				sugar.add(buf);
    			}

    		}
    	}

    	double  max=-999;
    	double den=0;
    	double denE=getD(100,E);

    	int satoumizu=0;
    	int satou=0;
    	for(Integer w:water) {
    		for(Integer s:sugar) {

    			if(w+s<=F) {
    				den=getD(w,s);

    				if(den!=-1 && den<=denE) {

    					if(max<den) {
    						max=den;

    						satoumizu=w+s;
    						satou=s;
    					}
    				}
    			}


    		}
    	}

    	System.out.println(satoumizu+" "+satou);






    }

    public static double getD(int water,int sugar) {

    	double den=-1;
    	if(water!=0) {
    		den=(double)(100*sugar);
    		den/=(double)(water+sugar);
    	}
    	return den;
    }
}


Measured memory_bytes: 24172
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;
using LL = long long;

int main() {
	int n;
	cin >> n;
	int a2 = 0, a4 = 0;
	int a;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a % 4 == 0)a4++;
		else if (a % 2 == 0)a2++;
	}
	if (n / 2 <= a4) {
		cout << "Yes" << endl;
	}
	else if (n - a4 * 2 <= a2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

using namespace std;
using llint = long long;
using pint = pair<int,int>;

#define LOG(x) cout << "# " << #x <<" => "<< (x) <<endl

const int INF = 1<<28;
const llint LLINF = 1LL<<60;

int x, a;

int main() {
    // Input
    cin >> x >> a;

    // Output
    if (x < a)
    {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  int a[3];
  while (n--) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    string res;
    if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) {
      res = "YES";
    } else {
      res = "NO";
    }
    cout << res << endl;
  }
}

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  int R;
  cin >> R;
  if(R < 1200){
    cout << "ABC" <<endl;
  } else if(R < 2800){
    cout << "ARC" <<endl;
  } else{
    cout << "AGC" <<endl;
  }
}

Measured memory_bytes: 3584