akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,ans;
pii a[100005];
bool cmp(pii x,pii y){return x.se<y.se;}
int main()
{
    scanf("%d",&n);
    rep(i,1,n){
        int x,y;
        scanf("%d%d",&x,&y);
        a[i]=mpr(x-y,x+y);
    }
    sort(a+1,a+n+1,cmp);
    int l=-1000000001;
    rep(i,1,n){
        if(a[i].fi<l) continue;
        l=a[i].se;
        ans++;
    }
    printf("%d\n",ans);
    return 0;
}

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

struct data {
  int order;
  int people;
};

bool cmp(const data &a, const data &b) {
  return a.people < b.people;
}

int main() {
  int N, tmp;
  cin >> N;
  
  vector<data> A(N);
  
  for(int i=0; i<N; i++) {
    cin >> tmp;
    A[i].order = i;
    A[i].people = tmp;
  }
  
  sort(A.begin(), A.end(), cmp);
  
  for(int i=0; i<N; i++) {
    cout << A[i].order + 1 << " ";
  }
  
  return 0;
}

Measured memory_bytes: 1536
T = [[0, 0]]
for i in range(int(input())):
    t, x, y = map(int, input().split())
    T.append((t, x + y))

    dt = T[i+1][0] - T[i][0]
    dxy = abs(T[i+1][1] - T[i][1])

    if dt < dxy or dt % 2 != dxy % 2:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 22528
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

int odd[100001];
int even[100001];

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

    int oddNum = -1;
    int oddMax = 0;
    int evenNum = -1;
    int evenMax = 0;

    rep(i, n) {
        int v;
        cin >> v;
        if (i % 2) {
            odd[v]++;
            if (oddMax < odd[v]) {
                oddMax = odd[v]; 
                oddNum = v;       
            }
        } else {
            even[v]++;
            if (evenMax < even[v]) {
                evenMax = even[v]; 
                evenNum = v;       
            }
        }
    }
    sort(odd, odd+100001, greater<int>());
    sort(even, even+100001, greater<int>());

    if (oddNum == evenNum) {
        oddMax = max(odd[1], even[1]);
    }

    int ans = n - oddMax - evenMax;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<ll, ll> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}

const int oo = 1e9;

int n, m, xo, yo, xi, yi;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

bool ok(int x, int y){
	return x >= 0 && x < n && y >= 0 && y < m;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> n >> m >> xo >> yo >> xi >> yi;

	xo--, yo--;
	xi--, yi--;

	vector<vector<char>> a(n, vector<char>(m));
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			cin >> a[i][j];

	vector<vector<int>> d(n, vector<int>(m, oo));
	priority_queue<pair<int, pii>, vector<pair<int, pii>>, greater<pair<int, pii>>> pq;
	d[xo][yo] = 0;
	pq.push({0, {xo, yo}});

	while(!pq.empty()){
		int w = pq.top().first;
		int x = pq.top().second.first;
		int y = pq.top().second.second;
		pq.pop();

		if(d[x][y] != w)
			continue;

		for(int i = 0; i < 4; i++){
			int nx = x + dx[i];
			int ny = y + dy[i];

			if(ok(nx, ny) && a[nx][ny] == '.'){
				if(d[nx][ny] > d[x][y]){
					d[nx][ny] = d[x][y];
					pq.push({d[nx][ny], {nx, ny}});
				}
			}
		}

		for(int i = -2; i <= 2; i++){
			for(int j = -2; j <= 2; j++){
				int nx = x + i;
				int ny = y + j;

				if(ok(nx, ny) && a[nx][ny] == '.'){
					if(d[nx][ny] > d[x][y] + 1){
						d[nx][ny] = d[x][y] + 1;
						pq.push({d[nx][ny], {nx, ny}});
					}
				}
			}
		}
	}

	int ans = d[xi][yi];
	if(ans == oo)
		ans = -1;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8752
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.length();
    if(n>=4&&(s.substr(0,4)=="YAKI")){
        cout<< "Yes"<<endl;
    }else{
        cout << "No" <<endl;
    }
    return 0;
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

int INF = 1 << 30;
//ll INF = 1ll << 60;

int a[15][1010] = {0}, s[15][1010] = {0};

void chmin(int &a, int b){
  if(a > b)
    a = b;
}

int main(){
  int H, W, k;
  cin >> H >> W >> k;
  
  rep(i, 0, H){
    int tmp = getchar();
    rep(j, 0, W){
      int c= getchar();
      a[i][j] = c - '0';
      s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1] + a[i][j];
    }
  }
  
  int ans = INF;
  
  rep(tmp, 0, (1 << H-1)){
    bitset<10> bit(tmp);
    vi cut_h(0);
    
    rep(i, 0, 10){
      if(bit.test(i))
        cut_h.push_back(i);
    }
    cut_h.push_back(H-1);
    
    int nh = -1, nw = -1;
    vvi sum(H, vi(W, 0));
    vi cut_w(0);
    
    rep(w, 0, W){
      bool check = false;
      nh = -1;
      
      for(int h : cut_h){
        sum[h][w] = s[h][w] - s[nh][w] - s[h][nw] + s[nh][nw];
        nh = h;
        if(sum[h][w] > k)
          check = true;
      }
      
      if(check){
        cut_w.push_back(w-1);
        nw = w-1;
      }
      
    }
    
    if(cut_w.size() != 0 && cut_w[0] == -1)
      continue;
    
    int cnt = cut_h.size() + cut_w.size() -1;
    chmin(ans, cnt);
    
  }
  
  cout << ans << endl;
  
  return 0;
  
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
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; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int n, m;
  cin >> n >> m;
  int x;
  cin >> x;
  vector<int> c(n);
  vector<vector<int> > a(n, vector<int>(m));
  rep(i, n) {
    cin >> c[i];
    rep(j, m) cin >> a[i][j];
  }
  int ans = inf;
  rep(i, 1 << n) {
    int sum = 0;
    vector<int> v(m);
    rep(j, n) {
      if (i & (1 << j)) {
        sum += c[j];
        rep(k, m) {
          v[k] += a[j][k];
        }
      }
    }
    rep(k, m) {
      if (v[k] < x) break;
      if (k == m - 1) {
        chmin(ans, sum);
      }
    }
  }
  cout << (ans == inf ? -1 : ans) << endl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
int n, k;
long long res;
int main() {
    DAU
    cin >> n >> k;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        a[i] = (a[i] + a[i-1]) % k;
    }
    for (int i = 1; i <= n; ++i)
        a[i] = (a[i] + k - i % k) % k;
    map<int, int> freq;
    freq[0] = 1;
    for (int i = 1; i <= n; ++i) {
        if (i >= k)
            --freq[a[i-k]];
        res += freq[a[i]]++;
    }
    cout << res;
    PLEC
}


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

using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;

    string front = s.substr(0, 2);
    string back = s.substr(2);

    if (stoi(front) >= 1 && stoi(front) <= 12) { // MM?? or YY??
        if (stoi(back) >= 13 || stoi(back) == 0) {
            cout << "MMYY" << endl;
        } else {
            cout << "AMBIGUOUS" << endl;
        }
    } else {    // YY??
        if (stoi(back) >= 1 && stoi(back) <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x); //define stack
int pop();

int main() {
    int a,b;
    top = 0;
    char s[100];
    while( scanf("%s", s) != EOF ) {
        if ( s[0] == '+' ) { //manipulate from top
            a = pop();
            b = pop();
            push(a + b);
        } else if ( s[0] == '-' ) {
            b = pop(); 
            a = pop();
            push(a - b);
        } else if ( s[0] == '*' ) {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    return 0;
}

void push( int x ) {
    S[++top] = x;  //top +1 substitute
}

int pop() {
    top--;
    return S[top+1];
}




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

int main() {
    int H, W;
    cin >> H >> W;
    string C;
    rep(i, H) {
        cin >> C;
        cout << C << endl << C << endl;
    }
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

int main() {
    ll N, M;
    cin >> N >> M;
    string S, T;
    cin >> S >> T;

    ll ans = -1;

    ll L = N / __gcd(N, M) * M;
    ll a = L / N;
    ll b = L / M;
    ll c = a / __gcd(a, b) * b;
    ll d = c / a;
    ll e = c / b;

    bool flg = true;
    for (ll k = 0; k < min(N / d, M / e); k++) {
        if (S[k * d] != T[k * e]) {
            flg = false;
            break;
        }
    }

    if (flg)
        cout << L << endl;
    else
        cout << "-1" << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;




int main() {
  ll H,W;
  cin>>H>>W;
  vector<string> Map(H);
  vector<vector<ll>> dp(H+1,vector<ll>(W+1));
  for(int i=0;i<H;i++){
    cin>>Map.at(i);
  }
  //cout<<H;
  for(int i=0;i<=H;i++){
    for(int j=0;j<=W;j++){
      if(i*j==0){
        dp.at(i).at(j)=0;
        continue;
      }
      if(i*j==1){
        dp.at(i).at(j)=1;
        continue;
      }
      if(Map.at(i-1).at(j-1)=='#'){
        dp.at(i).at(j)=0;
      }
      else{
        dp.at(i).at(j)=(dp.at(i-1).at(j)+dp.at(i).at(j-1))%MOD;
      }
    }
  }
  cout<<dp.at(H).at(W);
}


Measured memory_bytes: 9216
Row = list(map(int, input().split()))
#print(Row)

List = [list(map(int, input().split())) for i in range(Row[1]*2)]
#print(List)
sunuke = [0]*Row[0]

for i in range(1, len(List), 2):
  #print(List[i])
  for j in List[i]:
    sunuke[j-1] += 1
#print(sunuke)
count = 0
for i in range(len(sunuke)):
     if( sunuke[i] == 0):
               count+=1
print(count)

Measured memory_bytes: 9212
#include<stdio.h>
int main(void)
{
    int a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    if(a+b*5+c*10+d*50+e*100+f*500>=1000){printf("1\n");}
    else{printf("0\n");}
    return 0;
}

Measured memory_bytes: 584
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int ary[] = new int[3];

        int n = sc.nextInt();
        while (n-- > 0) {
            for (int i = 0; i < ary.length; i++)
                ary[i] = sc.nextInt();

            Arrays.sort(ary);

            int a = ary[0];
            int b = ary[1];
            int c = ary[2];

            System.out.println((a*a + b*b == c*c) ? "YES" : "NO");
        }
    }
}

Measured memory_bytes: 33252
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int x; cin >> x;
	vector<bool> isPrime(1e6, true);
	isPrime[0] == isPrime[1] == false;
	for (int i = 2; i < 1e6; ++i)
	{
		if (!isPrime[i]) continue;
		for (int j = i + i; j < 1e6; j += i)
		{
			isPrime[j] = false;
		}
	}
	for (int i = x; ; ++i)
	{
		if (isPrime[i])
		{
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int a,b,c,dp[3],d,e,f;
	cin>>a>>b>>c;
	dp[0]=a;
	dp[1]=b;
	dp[2]=c;
	for(int i=1;i<n;i++){
		cin>>a>>b>>c;
		d=(dp[1]>dp[2])?dp[1]+a:dp[2]+a;
		e=(dp[0]>dp[2])?dp[0]+b:dp[2]+b;
		f=(dp[1]>dp[0])?dp[1]+c:dp[0]+c;
		dp[0]=d;dp[1]=e;dp[2]=f;//cout<<dp[0]<<" "<<dp[1]<<" "<<dp[2]<<endl;	
	}
	cout<<max(dp[0],max(dp[1],dp[2]));
	return 0;
}

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

#define int long long
#define INF 9223372036854775807

int memo[100009];

vector<int> v(100009);

int n;
int k;

int dp(int index){
    if(index >= n) return INF/2;
    if(index == n-1) return 0;
    if(memo[index] != -1) return memo[index];
    memo[index] = INF;
    for(int i = 1; i<= k; i++){
        memo[index] = min(dp(index+i)+abs(v[index+i]-v[index]), memo[index]);
    }
    return memo[index];
}

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

    cin >> n; cin >> k;
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < 100009; i++){
        memo[i] = -1;
    }
    cout << dp(0) << endl;
}


Measured memory_bytes: 6528
package main

import "fmt"

func main() {

  var s string
  fmt.Scan(&s)
  var count = 0
  var pre = s[0]
  for i:= 1; i< len(s); i++ {
    if s[i] == pre {
      count ++
      if pre == '0' {
        pre = '1'
      }else {
         pre = '0'
      }
    } else {
      pre = s[i]
    }
  }

  fmt.Print(count)
  
}




Measured memory_bytes: 1280
#include <iostream>

using namespace std;

int main() {

	int N;
	cin >> N;

	int* A = new int[N];
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	for (int i = 0; i < N; ++i)
	{
		if (A[i] % 2 == 0) {
			if (A[i] % 3 == 0 || A[i] % 5 == 0);
			else {
				cout << "DENIED";
				return 0;
			}
		}
	}

	cout << "APPROVED";
	return 0;
}

Measured memory_bytes: 256
N = int(input())
X = input()
#X = "196341362415710923461093419237419237417234162348162390471092374190237410982374901"*300
#N = len(X)
M = { }
A = set()
A.add(X[0]+X[1])
for i in range(2, N) :
    i = X[i]
    for j in tuple(A):
        M[j + i] = 1
        A.add(j[0]+i)
        A.add(j[1]+i)

    if len(M) == 1000:
        break
print(len(M))


Measured memory_bytes: 3188
import itertools
import numpy
N, M, Q = map(int,input().split())
abcd = []*Q
d_list = []
sum_d = 0
for _ in range(Q):
  abcd.append(list(map(int,input().split())))

A = [1 for i in range(N)]
for A in itertools.combinations_with_replacement(range(1, M+1), N):
  for i in range(Q):
    if A[abcd[i][1]-1]-A[abcd[i][0]-1] == abcd[i][2]:
      d_list.append(abcd[i][3])
  if sum_d <= sum(d_list):
    sum_d = sum(d_list)
  d_list.clear()
print(sum_d)

Measured memory_bytes: 27024
#include <stdio.h>

int ti[5] = {0, 6000, 4000, 3000, 2000};

int main(){
  int t, n, i;
  for(i = 0; i < 4; ++i){
    scanf("%d%d", &t, &n);
    printf("%d\n", ti[t] * n);
  }
  return 0;
}

Measured memory_bytes: 600
#include<cstdio>

int date[3];

int main()
{
	while(true){
	for(int i=0;i<3;i++)
	{
		if(scanf("%d",&date[i])==EOF)goto end;
	}
	int sum=date[0]+date[1];
	double ave=(55-sum-date[2])/7;
	if((20-sum)>=ave)printf("YES\n");
	else printf("NO\n");
	}

end:
	return 0;
}

Measured memory_bytes: 0
#include <cmath>
#include <iomanip>
#include <iostream>
#include <utility>

using namespace std;

#define EPS 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
public:
  double x, y;
  Point() {};
  Point(double x, double y): x(x), y(y) {}

  Point operator + (const Point &p) { return Point(x + p.x, y + p.y); }
  Point operator - (const Point &p) { return Point(x - p.x, y - p.y); }
  Point operator * (double d) { return Point(d * x, d * y); }
  Point operator / (double d) { return Point(x / d, y / d); }

  bool operator < (const Point &p) const {
    return (x == p.x ? y < p.y : x < p.x);
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

  friend ostream& operator << (ostream &os, Point &p) {
    return os << "Point(" << p.x << ", " << p.y << ")";
  }
};

class Circle {
public:
  Point c;
  double r;
  Circle() {}
  Circle(double x, double y, double r): c(x, y), r(r) {}
};

typedef Point Vector;

double norm(Point p) {
  return p.x * p.x + p.y * p.y;
}

double abs(Point p) {
  return sqrt(norm(p));
}

double atanned(Point p) {
  return atan2(p.y, p.x);
}

Vector vec(double r, double deg) {
  return Vector(r * cos(deg), r * sin(deg));
}

double dot(Vector v1, Vector v2) {
  return v1.x * v2.x + v1.y * v2.y;
}

double cross (Point p1, Point p2) {
  return p1.x * p2.y - p1.y * p2.x;
}

Point PS[101];
int N;

int ppc(Point p) {
  bool x = false;

  for (int i = 0; i < N; i++) {
    Vector a = PS[i] - p, b = PS[(i + 1) % N] - p;

    if (abs(cross(a, b)) < EPS && dot(a, b) < EPS) return 1; // on
    if (a.y > b.y) swap(a, b);
    if (cross(a, b) > EPS && a.y < EPS && b.y > EPS) x = !x;
  }

  return (x ? 2 : 0);
}

int main() {
  cin >> N;

  for (int i = 0; i < N; i++) {
    int x, y; cin >> x >> y;
    PS[i] = Point(x, y);
  }

  int q; cin >> q;

  for (int i = 0; i < q; i++) {
    int x, y; cin >> x >> y;
    cout << ppc(Point(x, y)) << endl;
  }
}

Measured memory_bytes: 1164
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cstdio>
#include <cmath>
#include <cctype>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	string s, ans;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B'&&ans.size() != 0)ans.pop_back();
		else if (s[i] == '0')ans.push_back('0');
		else if (s[i] == '1')ans.push_back('1');
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
while 1 do
  q=0
  s1=Array.new
  s2=Array.new
  s1=gets.split("\"")
  if s1[0]==".\n"&&s1.length==1 then 
    break
  end
  s2=gets.split("\"")
  if s1.length!=s2.length then 
    q=2 
  end
  s1.length.times do |i|
    if s1[i]!=s2[i] then
      if i%2==1&&q==0 then
        q=1
      else 
        q=2
        break
      end
    end
  end
  case q
  when 0 then print "IDENTICAL\n"
  when 1 then print "CLOSE\n"
  when 2 then print "DIFFERENT\n"
  end
end


Measured memory_bytes: 6904
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		int[] pre = new int[0];
		for (; sc.hasNextLine();) {
			String buffer = sc.nextLine();
			String[] num = buffer.split(",");
			int[] in = new int[num.length];
			for (int i = 0; i < num.length; i++) {
				in[i] = Integer.valueOf(num[i]);
			}
			if (num.length > pre.length) {
				if (pre.length != 0) {
					in[0] += pre[0];
					for (int i = 1; i < num.length; i++) {
						if (i == pre.length) {
							in[i] += pre[i - 1];
						} else {
							in[i] += Math.max(pre[i - 1], pre[i]);
						}
					}
				}
			} else {
				for (int i = 0; i < num.length; i++) {
					in[i] += Math.max(pre[i + 1], pre[i]);
				}
				if(in.length == 1){
					pre = in;
					break;
				}
			}
			pre = in;
		}
		System.out.println(pre[0]);
	}

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

Measured memory_bytes: 12000
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
min = 10000000
ans = 0
for each in range(N):
    temp = T - 0.006 * H[each]
    if min > abs(A-temp):
        min = abs(A-temp)
        ans = each

print(ans+1)


Measured memory_bytes: 38256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
#define what(x) cerr << #x << " is " << x << endl;
const ll INF = 1LL << 60;

int main() {
    ll N;
    cin >> N;
    vl A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    vl A2 = A;
    for (int i = 0; i < N - 1; ++i) {
        if (A[i] < 0) {
            A[i] *= -1LL;
            A[i + 1] *= -1LL;
        }
    }
    bool ok = A[N - 1] >= 0;
    ll ret = 0;
    ll mi = INF;
    for (int i = 0; i < N; ++i) {
        ll ab = abs(A[i]);
        ret += ab;
        mi = min(mi, ab);
    }
    cout << (ok ? ret : ret - 2 * mi) << endl;
    return 0;
}

Measured memory_bytes: 1792
// Legends Never Die.

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

namespace fastIO
{
	const UI BUFFER_SIZE = (UI) 1 << 15;
	char buffer[BUFFER_SIZE], *cur, *ed;

	inline char getc() { return *(cur == ed ? ed = buffer + fread(buffer, 1, BUFFER_SIZE, stdin), cur = buffer : cur)++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }

// END tpl.

const int MAXN = 20, MAXK = 1 << MAXN;

int n, K;

inline char safe_getc()
{
	register char ch(getc());
	while(!isdigit(ch)) ch = getc();
	return ch;
}

int g[MAXN + 5][1 << MAXN];

inline void input()
{
	n = read<int>(), K = read<int>();
	for(int i = 0; i <= n; ++i)
		for(int S = 0; S < 1 << i; ++S)
			g[i][S] = safe_getc() == '1';
}

inline void solve()
{
	static int *f[MAXN + 5][MAXN + 5];

	for(int k = 1; k <= n; ++k)
	{
		for(int i = 0; i <= k; ++i)
		{
			f[k][i] = new int[1 << k];
			memset(f[k][i], 0, sizeof(int) * (1 << k));
		}
		for(int S = 0; S < 1 << k; ++S) if(g[k][S]) ++f[k][0][S];
	}

	static int pos[2][1 << MAXN], bit[MAXN + 5];

	for(int d = 0; d < 2; ++d)
		for(int S = 0; S < 1 << n; ++S)
		{
			pos[d][S] = n;
			for(int i = 0; i < n; ++i) if((S >> i & 1) == d) { pos[d][S] = i; break; }
		}

	for(int i = 0; i <= n; ++i) bit[i] = (1 << i) - 1;

	for(int k = n; k >= 1; --k)
		for(int i = 0; i < k; ++i)
			for(int S = 0; S < 1 << k; ++S) if(f[k][i][S])
			{
				for(int d = 0; d < 2; ++d)
				{
					int S0 = S & bit[i], T0 = S >> i, t = pos[d][T0];
					if(t < k - i) f[k - t][i + 1][S0 | (T0 >> t) << i] += f[k][i][S];
				}
				if(i > 0) f[i][i][S & bit[i]] += f[k][i][S];
			}

	for(int k = n; k >= 1; --k)
		for(int S = 0; S < 1 << k; ++S) if(f[k][k][S] >= K)
		{
			for(int i = k - 1; i >= 0; --i) putchar('0' + (S >> i & 1));
			putchar('\n');
			return;
		}
	puts("");
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



Measured memory_bytes: 220032
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n";
int main()
{
    IOS;
    long long a,b,c,d,e,h,l,n,t,f,m,x,y,z,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,sum=0,sum1=0,ma=0,ma1=0,mi=1000000000000000001;
    long long g,co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0,sum3=0,mu=1,mu1=1;
    double pi=2 * acos (0.0), dou;
    char ch,ch1,ch2;
    string str,str1,str2;
    cin>>n;
    m=1000000000+7;
    vector<long long>v(n),v1(n);
    for(int i=0; i<n; i++)
    {
        cin>>v[i];
        v1[i]=v[i];
    }
    reverse(v1.begin(),v1.end());
    for(int i=1; i<n; i++)
    {
        v1[i]+=v1[i-1];
    }
    reverse(v1.begin(),v1.end());
    for(int i=0; i<n-1; i++)
    {
        sum=sum+((v[i]*(v1[i+1]%m))%m);
        sum=sum%m;
    }
    cout<<sum%m<<endl;
    return 0;
}


Measured memory_bytes: 6364
import sys #再帰関数の上限,10**5以上の場合python
import time
t0=time.time()
import random
def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print(*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    D = int(input())
    #N, K = map(int, input().split())
    cs = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    S = tuple(tuple(map(int, input().split())) for i in range(D)) #改行行列
    lss=[]
    ls=[0]*26
    anss=[-1]*D
    for i in range(D):
        s=S[i]
        if i==0:
            msc=-1000000
            ans=-1
            for j in range(26):
                sc=s[j]+cs[j]

                if msc<sc:
                    ans=j
                    msc=sc
            ls[ans]=1
            #lss.append(ls)
            anss[i]=ans+1
            continue
        msc=0
        ans=-1
        dec=[-cs[j]*(i+1-ls[j]) for j in range(26)]
        msc=-10000000
        ans=-1
        for j in range(26):
            sc=s[j]-dec[j]
            if msc<sc:
                ans=j
                msc=sc
        ls[ans]=i+1
        #lss.append(ls)
        anss[i]=ans+1
    
    def eval(anss):
        ls=[0]*26
        score=0
        for i in range(D):
            j=anss[i]-1
            ls[j]=i+1
            score+=S[i][j]
            dec=sum([cs[k]*(i+1-ls[k]) for k in range(26)])
            score-=dec
        return score
    
    def eval2(anss,score,target,val,pval):
        score=score-S[target][pval-1]+S[target][val-1]
        f1=0
        f2=0
        cp=cv=0
        if target>0:
            for i in range(target-1,-1,-1):
                a=anss[i]
                if a==pval and not f1:
                    cp=i
                    f1=1
                if a==val and not f2:
                    cv=i
                    f2=1
                if f1 and f2:
                    break
        f1=f2=0
        #printe(cp,cv)
        csv=cs[val-1]
        csp=cs[pval-1]
        tcv=(target-cv)*csv
        tcp=(target-cp)*csp
        #printe(tcv,tcp)

        score+=tcv-tcp
        for i in range(target+1,D):
            a=anss[i]
            if anss[i]==pval and not f2:
                f2=1
            if anss[i]==val and not f1:
                f1=1
            if not f1:
                score+=tcv
            if not f2:
                score-=tcp
                
            if f1 and f2:
                break

        return score

    csc=eval(anss)
    #nans=copy(anss)

    random.seed(0)
    yaki=1000
    count=0
    while time.time()-t0<1.9:
        count+=1
        target=random.randrange(0,D)
        
        pval=anss[target]
        val=pval
        while val==pval:
            val=random.randrange(0,26)+1
        #val=pval
        #nans[target]=val
        nsc=eval2(anss,csc,target,val,pval)
        
        if nsc>csc:
            csc=nsc
            anss[target]=val
            

    printl(anss)
    printe(csc,count)
    #printe(eval(anss))
    

if __name__ == "__main__":
    main()

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

int main()
{
  ios::sync_with_stdio(false);
  vector<int> v(5);
  int k, a = 5, max = 0;

  for (int i = 0; i < a; ++i)
    cin >> v[i];

  cin >> k;

  for (int i = 0; i < a; ++i)
  {
    for (int j = i + 1; j < a; ++j)
    {
      if (v[j] - v[i] > max)
        max = v[j] - v[i];
    }
  }

  if (max > k)
    cout << ":(\n";
  else
    cout << "Yay!\n";

  return 0;
}

Measured memory_bytes: 256
// https : //onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/7/ITP1_7_D
#include <iostream>

        int
        main()
{
    int n, m, l;

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

    int A[n][m] = {};
    int B[m][l] = {};
    //サイズ注意
    long long pro[n][l] = {};
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            std::cin >> A[i][j];
        }
    }

    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < l; j++)
        {
            std::cin >> B[i][j];
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            for (int k = 0; k < l; k++)
            {
                pro[i][k] += A[i][j] * B[j][k];
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            std::cout << pro[i][j];
            if (j < l - 1)
                std::cout << " ";
        }
        std::cout << std::endl;
    }
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
# define lli long long int

int main(){
	lli i,j,k=0,l,n,m;
	cin >> n >> m;
	vector<lli>in(n);
	for(i=0;i<n;i++){cin >> in[i];
	}
	sort(in.begin(),in.end());
	n=n-m;
	for(i=0;i<n;i++){k=k+in[i];
	}
	cout << k;
			return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <vector>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a, b;
  int tmp_a;
  for(int i = 0; i < n; i++){
    cin >> tmp_a;
    a.push_back(tmp_a);
  }
  for(int i = n-1; 0 <= i; i -= 2){
    b.push_back(a[i]);
  }
  int j = 0;
  if(a.size()%2 != 0) {
    j = 1;
  } 
  for(; j < n; j += 2){
    b.push_back(a[j]);
  }

  for(int i = 0; i < n; i++){
    cout << b[i] << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 5640
import java.util.Scanner;
public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()){
            String sb = sc.nextLine();

            boolean isGood = true;
            for (int i = 0; i < sb.length()-1; i++) {
                    if (sb.charAt(i) == sb.charAt(i+1)){
                        isGood = false;
                        break;
                    }
                }

            if (isGood)
                System.out.println("Good");
            else
                System.out.println("Bad");
            }


        }
    }

Measured memory_bytes: 21972
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] list = new int[n];
		int tmp = 0;
		boolean flag = true;
		int count = 0;
		for(int i = 0;i<n;i++){
			list[i] = sc.nextInt();
		}
		while(flag){
			flag = false;
			for(int j = n-1;j>0;j--){
				if(list[j] < list[j-1]){
					tmp = list[j];
					list[j] = list[j-1];
					list[j-1] = tmp;
					flag = true;
					count += 1;
				}
			}
			
		}
		for(int i = 0;i < n;i++){
			System.out.print(list[i]);
			if(i != (n-1)){
				System.out.print(" ");
			}else{
				System.out.println();
			}
		}
		System.out.println(count);
	
	}
}


Measured memory_bytes: 26272
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    ll l,r; cin >>l>>r;

    ll res = 2019;
    for (ll i = l ; i <= min(l+10000, r); i++) {
        for (ll j = i + 1; j <= min(l+10000, r); j++) {
            if (res > ((i*j) % 2019)) {
                res = (i*j) % 2019;
            } 
        }
    }

    cout << res << endl;
    return 0;
}



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

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

    string answer = "No";
    for (int a1 = 1; a1 <= 3; ++a1) {
      int b1 = c[0] - a1;
      int b2 = c[1] - a1;
      int b3 = c[2] - a1;
      int a2 = c[3] - b1;
      int a3 = c[6] - b1;

      if (c[4] != a2 + b2) continue;
      if (c[5] != a2 + b3) continue;
      if (c[7] != a3 + b2) continue;
      if (c[8] != a3 + b3) continue;
      
      answer = "Yes";
      break;
    }

    cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList array = new ArrayList<>();
		for(int i=0;i<3;i++) {
			array.add(sc.nextInt());
		}
		int max =0;
		for(int i=0;i<3;i++) {
			max=Math.max((int)array.get(i), max);
		}
		array.remove(array.indexOf(max));
		int sum=0;
		for(int i=0;i<2;i++) {
			sum+=(int)array.get(i);
		}
		if(max==sum) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

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

int main() {
    int n, m;
    cin >> n >> m;
    int city[50] = {};
    for (int i = 0; i < m*2; i++) {
        int c;
        cin >> c;
        city[c]++; 
    }
    for (int i = 1; i <= n; i++) {
        cout << city[i] << endl;
    }
}


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

int main(){
  int a, b;

  cin >> a >> b;
  if(a > b) cout << "a > b" << endl;
  else if(a < b) cout << "a < b" << endl;
  else cout << "a == b" <<endl;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const ll MOD = 1e9 + 7;

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



ll modpow(ll a, ll n) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ret;
}
ll modinv(ll a) { return modpow(a, MOD - 2); }
ll comb(ll n, ll r) {
    ll ret = 1;
    for (ll i = 0; i < r; i++) ret = ret * (n - i) % MOD;
    for (ll i = 1; i <= r; i++) ret = ret * modinv(i) % MOD;
    return ret;
}


int main() {
    ll s,ans = 0,d; cin >> s;
    ll n = s/3;

    for(int i = 1;  i<= n; i ++){
        d = s-i*3;
        ans += comb(d+i-1,i-1);
        ans %= MOD;
    }
    cout << ans;
}


Measured memory_bytes: 3636
#include <iostream>
#include<bits/stdc++.h>
//# define vv vector< vector<int>>
using namespace std;

void dfs(vector<int> adj[],bool vis[],int d[],int i){
	vis[i]=true;
	for(int j=0;j<adj[i].size();j++){
		if(!vis[adj[i][j]]){
			dfs(adj,vis,d,adj[i][j]);
		}
		d[i]=max(d[i],1+d[adj[i][j]]);
	}
}
int mxl(vector<int> adj[],int n,int m ){
	bool vis[n+1];
	int d[n+1];
	memset(d,0,sizeof d);
	memset(vis,false,sizeof vis);
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			dfs(adj,vis,d,i);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,d[i]);
	}
	return ans;
}
int main() {
	int n,m,x,y;
	cin>>n>>m;
	vector<int> adj[n+1]; 
	
	for(int i=0;i<m;i++){
		cin>>x>>y;
		adj[x].push_back(y);
	}
	cout<<mxl(adj,n,m);
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int>a(n);
    // REP(i,0,n){
    //     cin>>a[i];
    // }
    vector<int>ct(n,0);
    for(int i=0;i<n-1;i++){
        cin>>a[i];
        ct[a[i]-1]++;
    }
    REP(i,0,n){
        cout<<ct[i]<<"\n";
    }

    return 0;
}

Measured memory_bytes: 6428
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a[3],tmp,k,m=0,i=0;
    for(i;i<3;i++){
        cin>>a[i];
    }
    cin>>k;
    m=max({a[0],a[1],a[2]});
    if(m==a[0]){
        for(i=0;i<k;i++){
            m*=2;
        }
        cout<<m+a[1]+a[2];
    }
    else if(m==a[1]){
        for(i=0;i<k;i++){
            m*=2;
        }
        cout<<m+a[0]+a[2];
    }
    else if(m==a[2]){
        for(i=0;i<k;i++){
            m*=2;
        }
        cout<<m+a[0]+a[1];
    }
    
}


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 ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    string s,t;
    cin>>s>>t;
    if (s[0]==t[2]&&s[2]==t[0]&&s[1]==t[1]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()
#define int long long
typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    cout << n * (n + 1) / 2 - n;


    return 0;
}

Measured memory_bytes: 256
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
    
    def reset(self):
        t = self.tree
        for i in range(len(t)):
            t[i] = 0

# bit = Bit(10)
# bit.add(1, 1)
# bit.add(1, 1)

# # bit.add(2, 2)
# # bit.add(3, 3)
# print(bit.sum(1))

N=int(input())
queries = [tuple(map(int, input().split())) for _ in range(N)]

numl = []
for q in queries:
    if q[0] == 1:
        numl.append(q[1])
numl.sort()
val_to_key = {}

for i,v in enumerate(numl):
    if not v in val_to_key:
        val_to_key[v] = i

# print(numl)
# print(val_to_key)

cum_b = 0
cum_a = 0
bit = Bit(200005)
bit2 = Bit(200005)
cnt = 0

def abs_sum(mid):
    loc_sum = bit.sum(mid+1)
    lft_cnt = bit2.sum(mid+1)
    lef_sum = numl[mid]*lft_cnt - loc_sum
    rig_sum = cum_a-loc_sum - numl[mid]*(cnt-lft_cnt)
    return lef_sum + rig_sum

def solve(cntmid):
    left = 0
    right = len(numl)
    while left < right:
        mid = (left + right) // 2
        # print(mid+1)
        nums = bit2.sum(mid+1)
        if nums < cntmid:
            left = mid + 1
        else:
            right = mid
    return numl[left], abs_sum(left)+cum_b

for qu in queries:
    if qu[0] ==  1:
        _, a, b = qu
        # print(val_to_key[a])
        bit.add(val_to_key[a]+1, a)
        bit2.add(val_to_key[a]+1, 1)
        cnt += 1
        cum_b += b
        cum_a += a
    else:
        if cnt % 2 == 0:
            sol, val = solve(cnt//2)
            sol2, val2 = solve(cnt//2+1)
            if val > val2: sol, val = sol2, val2
        else:
            sol, val = solve(cnt//2+1)
        print("{} {}".format(sol, val))

# cum = 0
# lis = []
# for _ in range(N):
#     qu=list(map(int, input().split()))
#     if qu[0] == 1:
#         lis.append(qu[1])
#         cum += qu[2]
#     else:


Measured memory_bytes: 111832
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

import math
def dist(xx,yy,u,v):
    return math.sqrt((xx-u)**2+(yy-v)**2)

def do2(x1,y1,x2,y2):
    return ((x1+x2)/2, (y1+y2)/2, dist(x1,y1,x2,y2)/2)

def do3(x1,y1,x2,y2,x3,y3):
    p = (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)
    if p==0:
        return (0,0,-1)
    x1s = x1**2
    y1s = y1**2
    x2s = x2**2
    y2s = y2**2
    x3s = x3**2
    y3s = y3**2
    u = ((x2s+y2s-x1s-y1s)*(y3-y1)-(x3s+y3s-x1s-y1s)*(y2-y1))/(2*p)
    v = -((x2s+y2s-x1s-y1s)*(x3-x1)-(x3s+y3s-x1s-y1s)*(x2-x1))/(2*p)
    r = dist(u,v,x1,y1)
    #ddprint(f"f {x1} {y1} {x2} {y2} {x3} {y3} ret {u} {v} {r}")
    return (u,v,r)

eps = 10**(-13)
def fit(u,v,r):
    for i in range(n):
        if dist(x[i],y[i],u,v)>r+eps:
            return False
    return True

n = inn()
x = []
y = []
for i in range(n):
    xx,yy = inm()
    x.append(xx)
    y.append(yy)
mn = 2000.0
for i in range(n-1):
    for j in range(i+1,n):
        u,v,r = do2(x[i],y[i],x[j],y[j])
        if r>0 and fit(u,v,r):
            mn = min(mn,r)
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            u,v,r = do3(x[i],y[i],x[j],y[j],x[k],y[k])
            if r>0 and fit(u,v,r):
                mn = min(mn,r)
print(mn)


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

int main(){
    string s;
    cin >> s;
    int counter = 0;
    if(s[0] == '1') ++counter;
    if(s[1] == '1') ++counter;
    if(s[2] == '1') ++counter;
    cout << counter << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <functional>

using namespace std;

struct Node {
    int v, lnode, rnode;
    Node(int v) : v(v), lnode(-1), rnode(-1){};
};

int main() {
    int N;
    cin >> N;

    vector<int> preorder(N);
    for (int i = 0; i < N; ++i) {
        int v;
        cin >> v;
        preorder[--v] = i;
    }
    vector<int> inorder(N);
    for (int i = 0; i < N; ++i) {
        int v;
        cin >> v;
        inorder[--v] = i;
    }

    vector<int> id(N);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&](int i, int j) { return preorder[i] < preorder[j]; });

    vector<Node> tree({Node(id[0])});
    for (int v : id) {
        int cur = 0;
        if (tree[cur].v == v) continue;
        while (true) {
            int& to = (inorder[v] < inorder[tree[cur].v] ? tree[cur].lnode : tree[cur].rnode);
            if (to >= 0) {
                cur = to;
            } else {
                to = tree.size();
                tree.push_back(Node(v));
                break;
            }
        }
    }

    vector<int> postorder;
    function<void(int)> dfs = [&](int v) {
        if (v < 0) return;
        dfs(tree[v].lnode);
        dfs(tree[v].rnode);
        postorder.push_back(tree[v].v);
    };
    dfs(0);

    for (int v : postorder) cout << v + 1 << " \n"[v == postorder.back()];
    return 0;
}



Measured memory_bytes: 3152