akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    int n;cin >> n;
    vl a(n);
    rep(i,n) cin >> a[i];
    multiset<ll> s;
    rep(i,n) s.insert(a[i]);
    ll ans=0;
    //cout << s.count(0) << endl;
    while(s.size()){
        ll x=*s.rbegin();
        s.erase(s.find(x));
        ll y;
        drep(i,32){
            ll sum=(1ll<<i);
            y=sum-x;
            if(s.count(y)>0) break;
            y=-1;
        }
        if(y!=-1){
            s.erase(s.find(y));
            ans++;
            //cout << x << " " << y << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
  return(0);
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long A, B;
  long N, M, L;
  cin >> N >> A >> B;
  
  M = long(N / (A+B));
  L = N % (A+B);
  
  long blue;
  blue = M * A;
  if (L > A) {
  	blue += A;
  }
  else {
  	blue += L;
  }
  cout << blue << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++) 
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
 
using namespace std;

bool isPrime(ll x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2LL==0)return false;
    
    rep(i,3,sqrt(x)+1)if(x%i==0)return false;
    return true;
}

int main(){
    
    
    ll x;
    cin>>x;
    
        int ans=INF;
        rep(i,1,sqrt(x)+1){
            if(x%i==0){
                string s=to_string(i);
                string ss=to_string(x/i);
                ans=min(ans,(int)max(s.size(),ss.size()));
            }
        }
        cout<<ans<<endl;
    
    
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
import random
import time
import math



#入力
D = int(input())
C = [int(c) for c in input().split()]
S = []
for _ in range(D):
    s = [int(x) for x in input().split()]
    S.append(s)
#初期解
T = []
for _ in range(D):
    t = random.randrange(26)
    T.append(t)


last_day = [[-1] for _ in range(26)]
for d in range(D):
    test = T[d]
    last_day[test].append(d)
for i in range(26):
    last_day[i].append(D)


T0 = 4000
time_start = time.perf_counter()
while True:
    time_now = time.perf_counter()
    if time_now - time_start > 1.8:
        break
    #時間を正規化して温度を設定
    time_n = (time_now - time_start) // 1.8
    T1 = T0 ** (1 - time_n)
    #ランダムな日のテストをランダムに入れ替え
    d = random.randrange(365)
    q = random.randrange(26)
    old = T[d]
    T[d] = q
    #日程dでの元のテストold
    l = last_day[old]
    ind_old = l.index(d)
    dd_left = l[ind_old] - l[ind_old-1] - 1
    dd_right = l[ind_old+1] - l[ind_old] - 1
    dd = l[ind_old+1] - l[ind_old-1] - 1
    dif_old = C[old] * (((dd_left * (dd_left + 1)) // 2) + ((dd_right * (dd_right + 1)) // 2) - ((dd * (dd + 1)) // 2))
    #日程dでのテストq
    l = last_day[q]
    ind_q = bisect_left(last_day[q],d)
    dd_left = d - l[ind_q-1] - 1
    dd_right = l[ind_q] - d - 1
    dd = l[ind_q] - l[ind_q-1] - 1
    dif_q = C[q] * (((dd * (dd + 1)) // 2) - ((dd_left * (dd_left + 1)) // 2) - ((dd_right * (dd_right + 1)) // 2))
    #変更による差
    dif_s = (dif_old + dif_q - S[d][old] + S[d][q])
    if (dif_s > 0) or (math.exp(dif_s / T1) > random.random()):
        del last_day[old][ind_old]
        last_day[q].insert(ind_q,d)
    else:
        T[d] = old
for d in range(365):
    print(T[d] + 1)



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

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

  int tmp = 100*n + 1800*m;
  printf("%d\n", tmp*(1<<m));
}


Measured memory_bytes: 256
//06
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n,k;cin>>n>>k,n|k;){
    int a[100000];
    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    int s=0,ms=0;
    for(int i=0;i<k;i++){
      s+=a[i];
    }
    ms=s;
    for(int i=k;i<n;i++){
      s+=-a[i-k]+a[i];
      ms=max(ms,s);
    }
    cout<<ms<<endl;
  }
  return 0;
}

Measured memory_bytes: 1232
using System;
using System.Linq;

namespace TestProject20180923
{
    class Program
    {
        static void Main(string[] args)
        {
            var vs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Array.Sort(vs);
            var result = vs[2] * 10 + vs[1] + vs[0];
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class E
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var (R, C, K) = Scanner.Scan<int, int, long>();
            var dp = new long[R + 1][][]
            .Select(x => x = new long[C + 1][]
            .Select(x => x = new long[4])
            .ToArray())
            .ToArray();

            var V = new long[R + 1][].Select(x => x = new long[C + 1]).ToArray();
            for (var i = 0; i < K; i++)
            {
                var (r, c, v) = Scanner.Scan<int, int, long>();
                V[r][c] = v;
            }

            for (var i = 1; i <= R; i++)
            {
                for (var j = 1; j <= C; j++)
                {
                    for (var k = 0; k <= 3; k++)
                    {
                        dp[i][j][k] = Math.Max(dp[i][j - 1][k], dp[i - 1][j][3]);
                        if (k > 0)
                        {
                            var tmp = Math.Max(dp[i][j - 1][k - 1], dp[i - 1][j][3]) + V[i][j];
                            dp[i][j][k] = Math.Max(dp[i][j][k], tmp);
                        }
                    }
                }
            }

            Console.WriteLine(dp[R][C][3]);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
        }
    }
}


Measured memory_bytes: 707656
loop do
  n = gets.to_i
  break if n == 0

  scores = readline.split.map(&:to_i)
  average = scores.inject(:+).to_f / n
  variance = scores.inject(0.0) {|sum, s| sum += (s - average) ** 2 } / n
  standard_deviation = Math.sqrt(variance)
  p standard_deviation
end

Measured memory_bytes: 6160
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <limits>
#include <algorithm>

constexpr long long MOD = 1000000007;

int main()
{
  std::string S;
  std::cin >> S;
  int ans = 0;
  int tmp = 0;
  for (auto c: S)
  {
    if (c == 'A' ||
        c == 'C' ||
        c == 'G' ||
        c == 'T')
    {
      ++tmp;
    }
    else
    {
      ans = std::max(ans, tmp);
      tmp = 0;
    }
  }
  ans = std::max(ans, tmp);
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))
freq = [False] * 8 + [0]
for i in range(n):
    a = arr[i]
    if a < 400:
        freq[0] = True
    elif a < 800:
        freq[1] = True
    elif a < 1200:
        freq[2] = True
    elif a < 1600:
        freq[3] = True
    elif a < 2000:
        freq[4] = True
    elif a < 2400:
        freq[5] = True
    elif a < 2800:
        freq[6] = True
    elif a < 3200:
        freq[7] = True
    else:
        freq[8] += 1
print (max(freq[0:8].count(True), 1), freq[0:8].count(True)+freq[8])

Measured memory_bytes: 9000
h,w = map(int,input().split())
l = [list(input()) for i in range(h)]

c1 = [[-1 for i in range(w)] for i in range(h)]
c2 = [[-1 for i in range(w)] for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if c1[i][j] == -1:
            n = 0
            while i+n < h:
                if l[i+n][j] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c1[i+k][j] = n
            
        if c2[i][j] == -1:
            n = 0
            while j+n < w:
                if l[i][j+n] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c2[i][j+k] = n


        ans = max(ans,c1[i][j]+c2[i][j])
print(ans-1)


Measured memory_bytes: 255240
[a,v] = [int(i) for i in input().split()]
[b,w] = [int(i) for i in input().split()]
t = int(input())
if w >= v:
    print("NO")
else:
    if  abs(a-b)/(v-w)  <= t:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 61852
#include <iostream>
#include <queue>
#include <climits>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

typedef pair<int,int> pii;

int main()
{
  int H, W, N;
  const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
  cin >> H >> W >> N;
  char map[H][W];
  int d[H][W], hp = 1, ans = 0;
  fill(d[0],d[H],INT_MAX);
  queue<pii> q;
  REP(i,H){
    REP(j,W){
      cin >> map[i][j];
      if(map[i][j] == 'S'){
        q.push({i,j});
        d[i][j] = 0;
      }
    }
  }
  while(1){
    pii p = q.front();
    q.pop();
    if(hp == map[p.first][p.second]-'0'){
      ans += d[p.first][p.second];
      hp++;
      fill(d[0],d[H],INT_MAX);
      d[p.first][p.second] = 0;
      while(!q.empty()) q.pop();
    }
    if(hp == N+1){
      cout << ans << endl;
      return 0;
    }
    REP(i,4){
      pii next_p = {p.first+dx[i],p.second+dy[i]};
      if(next_p.first < 0 || next_p.first >= H || next_p.second < 0 || next_p.second >= W || map[next_p.first][next_p.second] == 'X') continue;
      if(d[next_p.first][next_p.second] > d[p.first][p.second]+1){
        d[next_p.first][next_p.second] = d[p.first][p.second]+1;
        q.push(next_p);
      }
    }
  }
}

Measured memory_bytes: 7996
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);        
        while(true){            
            int H = sc.nextInt();
            int L = sc.nextInt();
            if(H == 0 && L == 0) break;
            for(int i=0; i < H; i++){
                for(int j=0; j < L; j++){
                    if(i == 0 || i == H-1){
                        System.out.print("#");
                    }else{
                        if(j == 0 || j == L-1){System.out.print("#");
                        }else if(j <= L-1 && 0 <= j){
                            System.out.print(".");
                        }
                    }                    
                }
                System.out.print("\n");
            }
            System.out.print("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 37204
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>

using namespace std;

const int maxn = 3002;

int n, m, ans = 0, x, y;

string s, t;

int f[maxn][maxn], pre[maxn][maxn];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> s;
	cin >> t;

	n = s.length();
	m = t.length();

	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j) {
			if (f[i-1][j] > f[i][j-1]) {
				f[i][j] = f[i-1][j];
				pre[i][j] = 0;
			} else {
				f[i][j] = f[i][j-1];
				pre[i][j] = 1;
			}

			if (s[i-1] == t[j-1] && f[i-1][j-1] + 1 > f[i][j]) {
				f[i][j] = f[i-1][j-1] + 1;
				pre[i][j] = 2;

				if (f[i][j] > ans) {
					ans = f[i][j];
					x = i;
					y = j;
				}
			}
		}

	if (ans > 0) {
		string res;

		while (x > 0 && y > 0 && f[x][y] > 0) {

			if (pre[x][y] == 0)
				--x;
			else if (pre[x][y] == 1)
				--y;
			else {
				res += s[x-1];
				--x;
				--y;
			}	
		}

		reverse(res.begin(), res.end());

		cout << res << endl;
	}

	return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int>number(n);
  vector<vector<int>>vec(n,vector<int>(m));
  for (int i = 0; i < n; i ++){
    cin >>number.at(i);
    for (int j = 0; j < number.at(i); j++){
      cin >> vec.at(i).at(j);
    }
  }
  vector<int>count(m);
  for (int i = 0; i < n; i++){
    for (int j = 0; j < number.at(i); j++){
      count.at(vec.at(i).at(j)-1)++;
      
    }
  }
  int ans = 0;
  for (int k = 0; k < m ; k++){
    if (count.at(k) == n){
      ans++;
    }
  }
  cout << ans << endl;
}

      
    



Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_HUMAN_MAX		100000									// 最大人数

// 内部変数
static FILE *szpFpI;											// 入力
static int siHCnt;												// 人数
static int siBMax;												// バス定員
static int siWait;												// 待ち時間
static int si1Time[D_HUMAN_MAX];								// 到着時刻

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// ソート関数 - int昇順
int
fSortFncIU(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// int昇順
	if (*lipVal1 > *lipVal2) {
		return 1;
	}
	else if (*lipVal1 < *lipVal2) {
		return -1;
	}

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 人数・バス定員・待ち時間 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d%d", &siHCnt, &siBMax, &siWait);

	// 到着時刻 - 取得
	for (i = 0; i < siHCnt; i++) {
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d", &si1Time[i]);
	}
	qsort(si1Time, siHCnt, sizeof(int), fSortFncIU);

	// 台数 - 取得
	int liBCnt = 0;
	int liStart = INT_MIN;
	int liHCnt;
	for (i = 0; i < siHCnt; i++) {
		if (si1Time[i] <= liStart && liHCnt < siBMax) {
			liHCnt++;
		}
		else {
			liBCnt++;
			liStart = si1Time[i] + siWait;
			liHCnt = 1;
		}
	}

	return liBCnt;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// １行出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 892
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

const int MAX = 1000010;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll X,Y;
    cin >> X >> Y;
    COMinit();
    if((X+Y)%3 != 0) cout << 0 << endl;
    else {
        ll n = (2*X-Y)/3;
        ll m = (2*Y-X)/3;
        cout << COM(n+m,n) << endl;
    }
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define bitcount(a) __builtin_popcountll(a)
#define P pair<int,int>
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long mod=1e9+7;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	int ans[n]={0};
	int sign=1;
	for(int i=0;i<n;i++)
	{
		ans[0]+=sign*a[i];
		sign*=-1;
	}
	for(int i=1;i<n;i++)
	{
		ans[i]=2*a[i-1]-ans[i-1];
	}
	for(int i=0;i<n;i++)
	cout<<ans[i]<<" ";
	return 0;
}

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

int main (void){
    string s;
    cin >> s;
    if (s[2] == s[3]) {
        if (s[4] == s[5]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3580
n=int(input())
a=list(map(int,input().split()))
r,cnts,cntx,ans=0,0,0,0
for l in range(n):
  while r<n and cnts+a[r]==cntx^a[r]:
    cnts+=a[r]
    cntx^=a[r]
    r+=1
    ans+=r-l
  if l==r:
    r+=1
  else:
    cnts-=a[l]
    cntx^=a[l]
print(ans)

Measured memory_bytes: 24840
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

#整数問題セット
def gcd(numbers): return func.reduce(frac.gcd, numbers)
def lcm(numbers): return func.reduce(LCM, numbers)
def inv(a): return pow(a, MOD-2, MOD) #逆元
def comb(n,r):
    ans = 1
    for i in range(r): ans *= n-i; ans *= inv(r-i); ans %= MOD
    return ans

n,a,b = imap()
div,mod = divmod(n,10000)
allEvents = (2**10000%MOD)**div%MOD * 2**mod%MOD
ans = allEvents - comb(n,a) - comb(n,b) - 1
ans %= MOD
print(ans)


Measured memory_bytes: 38908
#include <iostream>
#include <vector>

using namespace std;
#define ll long long int
int main(){
  int n, m, c;
  cin >> n >> m >> c;
  int b[m];
  int a[n][m];
  for ( int i = 0; i < m; ++i ) cin >> b[i];
  
  for ( int i = 0; i < n; ++i ) {
    for ( int j = 0; j < m; ++j ) {
      cin >> a[i][j];  
    }  
  }

  int ans = 0;
  for ( int i = 0; i < n; ++i ) {
    int temp = c;
    for ( int j = 0; j < m; ++j ) {
      temp += a[i][j] * b[j]; 
    }
    if ( temp > 0) ++ans;
  }
  cout << ans << endl;
  
  return 0;
}


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


int main()
{
        int n,m,n1,n2,i,j,k,v,a,b,c,s,compindx,f;
        compindx=0;
        cin>>n>>m;
        list<int> adj[100001];
        queue<int>q;
        for(i=0;i<m;i++)
        {
                cin>>n1>>n2;
                adj[n1].push_back(n2);
                adj[n2].push_back(n1);
        }
        int visited[n];
        int id[n];
        for(j=0;j<n;j++)
        {
                visited[j]=0;
        }
        for(j=0;j<n;j++)
        {
               if(visited[j]==0)
                {
                        s=j;
                        q.push(s);
                        while(q.empty()==false)
                        {
                                 v=q.front();
                                 visited[v]=1;
                                 id[v]=compindx;
                                 q.pop();
                                for(list<int>::iterator it = adj[v].begin(); it != adj[v].end(); it ++)
                                {
                                        if(visited[*it]==0)
                                        {
                                                f=*it;
                                                q.push(f);
                                                visited[*it]=1;
                                        }

                                }
                        }
                        compindx++;
                }
           }
        cin>>c;
        for(k=0;k<c;k++)
        {
                cin>>a>>b;
                if(id[a]==id[b])
                {
                        cout<<"yes"<<endl;
                }
                else
                {
                        cout<<"no"<<endl;
                }
        }

}




Measured memory_bytes: 11768
/**
 *      ABC 107 A
 *      author  : kyomukyomupurin
 *      created : 2018/08/26
**/

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

int main(){
    int n, i;
    cin >> n >> i;
    cout << n - i + 1 << endl;

    return 0;
    
}

Measured memory_bytes: 256
a = [input() for i in range(3)]
l = [0]*3
a[0] += "f"
a[1] += "f"
a[2] += "f"
now = 0
while True:
    check = a[now][l[now]]
    l[now] += 1
    
    if check == "a":
        now = 0
    elif check == "b":
        now = 1
    elif check == "c":
        now = 2
    else:
        if now == 0:
            print("A")
        elif now == 1:
            print("B")
        else:
            print("C")
        exit()




Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <bits/stdint-intn.h>

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

using namespace std;

int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  std::map<uint64_t, uint64_t> map;
  rep(i, n) {
    int tmp;
    std::cin >> tmp;
    a[i] = tmp;
    map[tmp]++;
  }

  int64_t sum = 0;
  for (auto i : map) {
    sum += i.second * (i.second - 1) / 2;
  }

  rep(i, n) {
    int64_t before = map[a[i]] * (map[a[i]] - 1) / 2;
    int64_t after = (map[a[i]] - 1) * (map[a[i]] - 2) / 2;
    std::cout << (sum - before + after) << std::endl;
  }

  return 0;
}


Measured memory_bytes: 11916
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			while (sc.hasNextInt()) {
				int d = sc.nextInt();
				int areaCulcCount = (600 - d) / d;
				long sum = 0L;

				for (int i = 1; i <= areaCulcCount; i++) {
					int x = i * d;
					int y = x * x;
					sum += y * d;
				}
				System.out.println(sum);
			}
		} finally {
			sc.close();
		}
	}
}

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

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

    vector<int> data(n);
    for (int i = 0; i < n; i++){
        cin >> data.at(i);
    }

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

    cout << (accumulate(data.begin(), --data.end(), 0) > data.at(n - 1) ? "Yes" : "No") << endl;
}

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

alice = 0
bob = 0

while(True):
    a.sort()
    alice += a.pop(-1)
    if a == []:
        break
    a.sort()
    bob += a.pop(-1)
    if a == []:
        break

print(alice-bob)


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

int main(){
    int A, B, C, X, Y; 
    cin >> A >> B >> C >> X >> Y;

    int res = 1 << 30;
    for (int c = 0; c <= max(2*X, 2*Y); c++)
    {
        int a = max(0, X - c/2);
        int b = max(0, Y - c/2);
        int price = A*a + B*b + C*c;
        if(price < res) res = price;
    }
    
    cout << res << endl;


    return 0;
}

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

struct Edge {
  int to;     // 辺の行き先
  int weight; // 辺の重み
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;

vector<int> color;
void dfs(const Graph &G, int v) {
  for (auto next_v : G.at(v)) {
    if (color.at(next_v.to) != -1) {
      continue;
    } else {
      color.at(next_v.to) = ((color.at(v) + next_v.weight) % 2);
      dfs(G, next_v.to);
    }
  }
}

int main() {
  // 頂点数と辺数
  int N;
  cin >> N;

  // グラフ
  Graph G(N);
  for (int i = 0; i < N - 1; ++i) {
    int from, to, weight;
    cin >> from >> to >> weight;
    from--;
    to--;
    G.at(from).push_back(Edge(to, weight));
    G.at(to).push_back(Edge(from, weight));
  }

  color.assign(N, -1);
  color.at(0) = 0;
  dfs(G, 0);

  rep(i, N) {
    cout << color.at(i) << endl;
  }
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,s,e) for(ll i=s;i<e;++i)

int main()
{
    ll a;
    long double b;
    cin >> a >> b;
    cout << (long long)(a*b) << endl;
    return 0;
}

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

int main(void)
{
	int a[200][3];
	int n;
	int score[200];
	int i, j;
	int flag[101];
	
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		for (j = 0; j < 3; j++){
			scanf("%d", &a[i][j]);
		}
	}
	
	memset(score, 0, sizeof(score));
	
	for (i = 0; i < 3; i++){
		memset(flag, 0, sizeof(flag));
		for (j = 0; j < n; j++){
			flag[a[j][i]]++;
		}
		for (j = 0; j < n; j++){
			if (flag[a[j][i]] == 1){
				score[j] += a[j][i];
			}
		}
	}
	
	for (i = 0; i < n; i++){
		printf("%d\n", score[i]);
	}
	
	return (0);
}

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

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

	int x = n.length();

	int c = 0;
	while (x > c) {
		if (n[c] != n[(x - 1) - c]) {
			cout << "No" << endl;
			return 0;
			
		}
		++c;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
K,T = map(int,input().split())

A = sorted(list(map(int,input().split())),reverse=True)

BOSS_CAKE = A[0] - 1
for a in A[1:]:
    BOSS_CAKE -= a
    if BOSS_CAKE<=0:
        BOSS_CAKE = 0
        break

print(BOSS_CAKE)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	Int ans = a[0] - 1;
	Int max_a = 1;
	for (int i = 1; i < N; ++i) {
		if (a[i] - max_a < 2) {
			max_a = max(max_a, a[i]);
			continue;
		}
		Int P = max_a + 1;
		ans += a[i] / P + (a[i] % P ? 0 : -1);
		a[i] = 1;
	}
	cout << ans << endl;

	return 0;
}


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

typedef long long int ll;


#define MOD (1000000007)

///****int L kintu base 2 te dewa 

ll dp[100010][2];
void Print()
{
	cout<<"DP:\n"; 
	for(int i=0;i<=8; i++){
		cout<<dp[i][0]<<" "<<dp[i][1]<<endl; 
	}
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string L;
    cin >> L;
    //cout<<"L.size()="<<L.size()<<endl; 
    dp[0][0] = 1;
    for (int i = 1; i <= (int)L.size(); i++)
    {
    	//cout<<"~~~~i="<<i<<" L[i]="<<L[i]<<endl; 
    	dp[i][0]= dp[i-1][0]%MOD; 
        dp[i][1]= (dp[i-1][1]*3)%MOD; 
        ////***Bug silo: L[i] hobe na; karon L to 0 theke start ; so L[i-1]
        if (L[i-1] == '1')
        {
        	dp[i][0]= (dp[i][0]+dp[i-1][0])%MOD; 
        	dp[i][1]= (dp[i][1]+dp[i-1][0])%MOD; 
        }
        //cout<<"After i="<<i<<endl; 
        //Print(); 
    }
    ll ans = (dp[(int)L.size()][0] + dp[(int)L.size()][1]) % MOD;
    cout << ans << endl;
}


Measured memory_bytes: 2000
#include <stdio.h>

int arr_idx = 0;
char arr1[4];
int arr[4];
char opp[2] = {'+', '-'};


bool check = false;
bool check1(int num, int idx, char op){
    if(num == 7 && idx == 3) return true;
    else if(idx == 3) return false;
    
    for(int i = 0; i < 2; i++){
        if(i == 0){
            check = check1(num + arr[idx+1], idx+1, '+');
            if(check == true){
                arr1[arr_idx++] = '+';
                return true;
            }
        }
        else{
            check = check1(num - arr[idx+1], idx+1, '-');
            if(check == true){
                arr1[arr_idx++] = '-';
                return true;
            }
        }
    }
    return false;
}

int main(){
    for(int i = 0 ; i < 4; i++){
        scanf("%1d", &arr[i]);
    }
    
    check1(arr[0], 0, '\0');
    
    printf("%d%c%d%c%d%c%d=7\n", arr[0], arr1[2], arr[1], arr1[1], arr[2], arr1[0], arr[3]);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=1000000007;
ll MOD=998244353;
int inf=1000001000;
ll INF=10000000000000000;

void Add(int &a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
 
void Mul(int &a, int b) {
  a = 1LL * a * b % MOD;
}
 
int Pow(int b, int e) {
  if (e < 0) e += MOD - 1;
  int ret = 1;
  while (e) {
    if (e & 1) ret = 1LL * ret * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return ret;
}
 
namespace Math {
  const int NMAX = (int)1e7;
  int pow2[1 + NMAX];
  int fact[1 + NMAX], tcaf[1 + NMAX];
  void Precalc() {
    fact[0] = pow2[0] = 1;
    for (int i = 1; i <= NMAX; ++i) {
      pow2[i] = pow2[i - 1];
      Add(pow2[i], pow2[i]);
 
      fact[i] = fact[i - 1];
      Mul(fact[i], i);
    }
    tcaf[NMAX] = Pow(fact[NMAX], -1);
    for (int i = NMAX - 1; i >= 0; --i) {
      tcaf[i] = tcaf[i + 1];
      Mul(tcaf[i], i + 1);
      assert(1LL * fact[i] * tcaf[i] % MOD == 1);
    }
  }
  int Choose(int n, int k) {
    if (k > n || n < 0) return 0;
    return 1LL * fact[n] * tcaf[n - k] % MOD * tcaf[k] % MOD;
  }
};

int main(){
    Math::Precalc();
    ll n;
    cin >> n;
    ll ans=Pow(3,n);
    rep(i,n/2){
        ans=(ans+2*MOD-(2LL*Pow(2,i)*Math::Choose(n,i)%MOD))%MOD;
    }
    cout << ans << endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> p(m);
    vector<string> s(m); 

    for(int i=0;i<m;i++){
        cin >> p.at(i) >> s.at(i);
    }

    vector<bool> status(n,false);

    vector<int> penalty_num(n,0);
    for(int i=0;i<m;i++){
        if(s.at(i)=="AC"){
            status.at(p.at(i)-1)=true;
        }else if(!status.at(p.at(i)-1)){
            penalty_num.at(p.at(i)-1)++;
        }
    }
    
    int correct_num=0;
    int penalty_count=0;
    for(int i=0; i<n; i++){
        if(status.at(i)){
            correct_num++;
            penalty_count+=penalty_num.at(i);
        }
    }

    cout << correct_num << " " << penalty_count << endl;
};

Measured memory_bytes: 6528
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    string s;
    cin>>s;
    if (s[2]==s[3]&&s[4]==s[5])
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
}


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


int main(){ 
    ll t,i,j,k,l,n,m;
    string s;
    cin>>s;
    ll zero = count(s.begin(),s.end(),'0');
    ll one = count(s.begin(),s.end(),'1');
    cout<<2*min(one,zero);

    return 0;
}

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

int main(void) {
	char sa[100], sb[100];
	int ra[100], rb[100],t[101];
	int la, lb;
	int N;
	int i,j,k;
	int a = 0;
	for (i = 0; i < 101; i++) {
		t[i] = 0;
	}
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%s", &sa);
		scanf("%s", &sb);
		la = strlen(sa);
		if (la > 80) {
			printf("overflow\n");
		}
		else {
			lb = strlen(sb);
			if (lb > 80) {
				printf("overflow\n");
			}
			else {
				//?????¢
				for (j = 0; j < la; j++) {
					ra[j] = sa[la - 1 - j]-48;
				}
				for (j = la; j < 100; j++) {
					ra[j] = 0;
				}
				for (j = 0; j < lb; j++) {
					rb[j] = sb[lb - 1 - j]-48;
				}
				for (j = lb; j < 100; j++) {
					rb[j] = 0;
				}
				//?¶???????????¨????
				for (j = 0; j < 100; j++) {
					//printf("/???//%d %d %d %d\n", ra[j], rb[j], t[j], t[j + 1]);
					t[j] = (a +  ra[j] + rb[j]) % 10;
					a = (a+ra[j] + rb[j]) / 10;
					//printf("/???//%d %d %d %d\n", ra[j], rb[j], t[j], t[j + 1]);
				}
				//??????
				j = 100;
				while (j > 0) {
					if (t[j] != 0) {
						break;
					}
					j--;
				}
				if (j >= 80) {
					printf("overflow\n");
				}
				else {
					for (k = j; k >= 0; k--) {
						printf("%d", t[k]);
					}
					printf("\n");
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N; cin >> N;
    long long T; cin >> T;
    vector<long long> A(N); repp(i,0,N) cin >> A[i];
    
    map<long long, int> m;
    long long minN = A[0];
    long long maxV = -1;
    repp(i,1,N) {
        minN = min(minN, A[i]);
        maxV = max(maxV, A[i] - minN);
        ++m[A[i] - minN];
    }
    cout << m[maxV] << endl; 
}


Measured memory_bytes: 7296
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//#define for(i,n) for(int i=0;i<n;i++)
#define ll long long
#define MAX 1e9
#define MIN -1e9
#define max(x,y) (x>y)?x:y
#define min(x,y) (x<y)?x:y
#define s(n) scanf("%d",&n)
#define mem memset(a, 0, sizeof(a))
#define minimum(a)	*min_element(a.begin(), a.end())
#define maximum(a)	*max_element(a.begin(), a.end())
typedef vector<int> vi;
typedef vector<string> vs;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
   int n;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       int check=i;
       int count=0;
       for(int j=1;j<=100;j++)
       {
           for(int k=1;k<=100;k++)
           {
               for(int m=1;m<=100;m++)
               {
                   if((j*j+k*k+m*m+j*k+k*m+m*j)==i)
                     {
                         count++;
                     }
                     if((j*j+k*k+m*m+j*k+k*m+m*j)>i)
                     {
                         break;
                     }
               }
           }
       }
       cout<<count<<endl;
   }
   
   
return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int n, m = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if ((i/100000==0 && i / 10000 != 0) || (i / 1000 == 0 && i / 100 != 0) || i / 10 == 0) m++;
    }
    cout << m << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
     
    int main() {
	int cards[4][13];
	for(int i=0; i<4; i++){
		for(int j=0; j<13 ;j++){
			cards[i][j]=0;
		}
	}
	int n;
	cin >> n ;
	for(int h=0; h<n ;h++){
		int num ;
		char mar ;
		cin>> mar >> num ;
		if(mar == 'S'){
			cards[0][num-1]=1;
		}
		if(mar == 'H'){
			cards[1][num-1]=1;
		}
		if(mar == 'C'){
			cards[2][num-1]=1;
		}
		if(mar == 'D'){
			cards[3][num-1]=1;
		}
	}
	for (int i=0; i<4 ; i++){
		for (int j=0 ; j<13 ; j++){
			if(cards[i][j] == 0){
				if(i == 0){cout<< "S " <<j+1 <<endl;}
				if(i == 1){cout<< "H " <<j+1 <<endl;}
				if(i == 2){cout<< "C " <<j+1 <<endl;}
				if(i == 3){cout<< "D " <<j+1 <<endl;}
			}
		}
	}
    return 0;
    }



Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String a = scanner.next();
        String b = scanner.next();
        String c = scanner.next();
        int num = 0;
        for (int i = 0; i < n; ++i) {
            char c1 = a.charAt(i);
            char c2 = b.charAt(i);
            char c3 = c.charAt(i);
            if (c1 == c2 && c2 == c3) {
                continue;
            } else if (c1 == c2 || c2 == c3 || c1 == c3) {
                ++num;
            } else {
                num += 2;
            }
        }
        System.out.println(num);
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<vector<double>> a(n, vector<double>(3));
  for (int i = 0; i < n; i++) {
    cin >> a.at(i).at(1) >> a.at(i).at(2);
    complex<double> c1(a.at(i).at(1), a.at(i).at(2));
    a.at(i).at(0) = arg(c1);
  }
  
  sort(a.begin(), a.end());
  
  for (int i = 0; i < n; i++) a.emplace_back(a.at(i));
  
  double ans = 0;
  for (int i = 0; i < n; i++) {
    complex<double> c(0, 0);
    for (int j = 0; j < n; j++) {
      complex<double> c2(a.at(i + j).at(1), a.at(i + j).at(2));
      c += c2;
      ans = max(ans, abs(c));
    }
  }
  
  cout << fixed << setprecision(15) << ans << '\n';
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
#define pii pair < ll , ll >
#define vi vector < int >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define init(x, a) memset(x, a, sizeof(x))
#define vll vector < long long int >
#define sll set < long long int >
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
    ll n,m,i,j,s=0,val=0;
    string st;
    cin>>st;
    for(char ch:st)
    {
    	if(ch=='+')val++;
    	else val--;
    }
    cout<<val;
    return(0);
}

Measured memory_bytes: 256
#include<iostream>
#include<cctype>
#include<cstdio>
using namespace std;
int main(){
    char ch;
    while(1){
        scanf("%c",&ch);
        if(islower(ch) != 0){
            ch =toupper(ch);
        }
        else if(isupper(ch)!=0){
            ch=tolower(ch);
        }
        printf("%c",ch);
        if(ch=='\n'){
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
ll int sum(ll int a, ll int b)
{
    return (b - a + 1) * (a + b) / 2;
}
void findAns()
{
    int n;
    cin >> n;

    int rem = n % 10;

    if (rem == 2 or rem == 4 or rem == 5 or rem == 7 or rem == 9)
        cout << "hon";
    else if (rem == 3)
        cout << "bon";
    else
        cout << "pon";
}
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("o1.txt", "w", stdout);
// #endif

    fastio;

    // ll int t;
    // cin >> t;,
    findAns();
}


Measured memory_bytes: 3556
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  int n; cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  int m; cin >> m;
  vi b(m);
  rep(i, m) cin >> b[i];

  for (int i = 0; i < min(n, m); ++i) {
    if (a[i] > b[i]) {
      cout << 0 << '\n'; return 0;
    } else if (a[i] < b[i]) {
      cout << 1 << '\n'; return 0;
    }
  }
  if (n >= m) {
    cout << 0 << '\n';
  } else {
    cout << 1 << '\n';
  }

  return 0;
}


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

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

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

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N; cin >> N;

  ull res{};
  for(ui tmp = 0; tmp < N; ++tmp)
  {
    ull a{}; cin >> a;
    ull k{};
    while(!(a % 2))
    {
      ++k;
      a /= 2;
    }
    res += k;
  }

  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits> 
#include <time.h>

struct edge {
    int to;
    int cost;
    edge (int to2, int cost2){
        to=to2;
        cost=cost2;
    }
};

using namespace std;
typedef pair<int, int> P;  // first: 最短距離, second: 頂点番号

#define MAX_V 1000000

int V, d[MAX_V];
vector<edge> G[MAX_V]; // 隣接リスト表現
long ROOT[MAX_V];
void dijkstra(int s) {
    for(long i=0; i<V; i++){
        d[i]=1000000;
    }
    d[s] = 0;  // 始点sへの最短距離は0
    ROOT[0]=0;

    priority_queue<P, vector<P>, greater<P> > que;  // 距離が小さい順に取り出せるようgreater<P>を指定
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;  // 更新した頂点の中で距離が最小の頂点v
        if (d[v] < p.first) {
            continue;
        }
        for (long i=0; i<G[v].size(); i++) {  // 頂点vから出る辺eを走査
            if (d[G[v][i].to] > d[v] + G[v][i].cost) {
                d[G[v][i].to] = d[v] + G[v][i].cost;
                que.push(P(d[G[v][i].to], G[v][i].to));
                ROOT[G[v][i].to]=v;
            }
        }
    }
}

int main()
{
    long M;
    std::cin >> V >> M;
    for(long i=0; i<M; i++){
        long A,B;
        std::cin >> A >> B;
        G[A-1].push_back(edge(B-1,1));
        G[B-1].push_back(edge(A-1,1));
    }
    dijkstra(0);
    std::cout << "Yes" << std::endl;
    for(long i=1; i<V; i++){
        std::cout << ROOT[i]+1 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 34844