akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#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++)
#define VREP(it, v) for (vector<int>::iterator it = v.begin(); it != v.end(); it++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;

template <typename T>
using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename K, typename V>
using pbds_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;
char s[3];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> s[0] >> s[1] >> s[2];
	if (s[0] == s[1] && s[0] == s[2] && s[0] == 'R'){
		cout << 3 << endl;
	} else if (s[0] == s[1] && s[0] == 'R'){
		cout << 2 << endl;
	} else if (s[1] == s[2] && s[1] == 'R'){
		cout << 2 << endl;
	} else if (s[0] == s[1] && s[0] == s[2] && s[0] == 'S'){
		cout << 0 << endl;
	} else {
		cout << 1 << endl;
	}
	
}

//cout.flush()
//cout << fixed << setprecision(9) << x << endl;

Measured memory_bytes: 3648
ops = input().split()
stack = []

for op in ops:
    if op == '+':
        op2 = stack.pop()
        op1 = stack.pop()
        stack.append(op1 + op2)
    elif op == '-':
        # ['3', '4', '-'] should be '-1'
        op2 = stack.pop()
        op1 = stack.pop()
        stack.append(op1 - op2)
    elif op == '*':
        op2 = stack.pop()
        op1 = stack.pop()
        stack.append(op1 * op2)
    else:
        stack.append(int(op))

print(stack.pop())



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

int  main(){
  int N,A,Maxi,Mini;
  cin >> N >> A;
  Maxi=A;
  Mini=A;
  int loop;
  for(loop=1;loop<N;loop++){
    cin >> A;
    if(A>Maxi){
      Maxi=A;
    }else if(A<Mini){
      Mini=A;
    }
  }
  cout << Maxi-Mini << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

vector<int> G[9];
int visited[9];
int N, M;
int dfs(int u = 0, int cnt = 1) {
    visited[u] = true;
    int ret = (cnt == N);
    for(auto to: G[u]) {
        if(visited[to]) continue;
        ret += dfs(to, cnt + 1);
    }
    visited[u] = false;
    return ret;
}
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N >> M;
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    cout << dfs() << endl;

    return 0;
}


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

int main() {
  string s;
  cin >> s;
  if (s.at(0) == '9' || s.at(1) == '9') {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;


int main()
{
    ciosup;
    int a, b, c;
    cin >> a >> b >> c;
    int ans;
    ans = c - (a - b);
    if (ans < 0)
        ans = 0;
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){

	int A, B; cin >> A >> B;
	int d = abs(A-B);

	if(d % 2 == 0){
		cout << min(A, B) + d / 2 << endl;
	}else{
		cout << "IMPOSSIBLE" << endl;
	}


	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    rep(0, i, N)
    {
        cin >> S.at(i);
    }
    sort(all(S));
    rep(0, i, N)
    {
        cout << S.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 256
-- | Main entry point to the application.
module Main where
 
import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe
import Text.Printf

-- | The main entry point.
main :: IO ()
main = do
    [s] <- concatMap (fmap (read :: String -> Int) . words) . lines <$> getContents
    -- let s = 46979
    printf "%d:%d:%d\n" (s `div` 3600) (s `mod` 3600 `div` 60) (s `mod` 60)

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<vector<ll>> Matrix;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

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

  ll n;
  cin >> n;
  string s;
  cin >> s;
  if (s.length()<=n) {
    cout << s << endl;
    return 0;
  }else {
    string ans;
    rep(i, n) ans += s[i];
    ans += "...";
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<int> A(M);
  for(int i=0;i<M;i++){
   	cin>>A.at(i);
    N-=A.at(i);
    //cout<<N<<endl;
  };
  if(N<0)cout<<-1;
  else cout<<N;
  return 0;
}

Measured memory_bytes: 3632
// ABC102B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
	int N;
	cin >> N;
	int A[100] ;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	int max = A[N-1] - A[0];
	cout << max << endl;
	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cstring>

using namespace std;

#define forsn(i,s,n) for(int i=(s); i<(int)(n); i++)
#define forn(i,n) forsn(i,0,n)

typedef long long int tint;

const int LIM = 301;
const tint MOD = 1000000007;

tint suma(tint a, tint b){
	return ((a+b)%MOD+MOD)%MOD;
}

struct restriccion{
	int inicio;
	int fin;
	int colores;
	
	restriccion(int l, int r, int x){
		inicio = l;
		fin = r;
		colores = x;
	}
	
	bool enRango(int x){
		return x >= inicio && x <= fin;
	}
	
	bool coherentePara(int r, int g, int b){
		int coloresRango = enRango(r) + enRango(g) + enRango(b);
		return coloresRango == colores;
	}
};

tint dp[LIM][LIM][LIM];
vector<vector<restriccion>> restriccionesPorFin;

void propagar(int r, int g, int b, int N, tint& res){
	int k = max(r, max(g, b));
	forn(i, restriccionesPorFin[k].size()){
		if(!restriccionesPorFin[k][i].coherentePara(r, g, b)){
			dp[r][g][b] = 0;
			return;
		}
	}
	if(k < N){
		dp[k+1][g][b] = suma(dp[k+1][g][b], dp[r][g][b]);
		dp[r][k+1][b] = suma(dp[r][k+1][b], dp[r][g][b]);
		dp[r][g][k+1] = suma(dp[r][g][k+1], dp[r][g][b]);
	} else {
		res = suma(res, dp[r][g][b]);
	}
}

int main(){
	int N, M; cin >> N >> M;
	restriccionesPorFin = vector<vector<restriccion>>(LIM);
	forn(i, M){
		int l, r, x;
		cin >> l >> r >> x;
		restriccionesPorFin[r].push_back(restriccion(l, r, x));
	}
	
	memset(dp, sizeof(dp), 0);
	dp[0][0][0] = 1;
	tint res = 0;
	
	forn(x, LIM){
		// Los tres son el máximo
		propagar(x, x, x, N, res);
		forn(y, x){
			// Hay dos máximos
			propagar(x, x, y, N, res);
			propagar(x, y, x, N, res);
			propagar(y, x, x, N, res);
			forn(z, x){
				// Un solo máximo
				propagar(x, y, z, N, res);
				propagar(y, x, z, N, res);
				propagar(y, z, x, N, res);
			}
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 213376
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	out(180*(N-2));
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	// 整数の入力
	String a = sc.next();
	String a1 = a.substring(0, 1);
	String a2 = a.substring(1, 2);
	String a3 = a.substring(2, 3);

    	
	// 出力
	if(a1.equals("7") || a2.equals("7") || a3.equals("7"))
	{
    	System.out.print("Yes");
	} else {
    	System.out.print("No");
	}
	}
}


Measured memory_bytes: 35704
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n;
	char c;
	char s [10001];
	memset(s,0,1001);
	scanf("%d",&n);
	scanf("%s",s);
	for (int i = 0; s[i] != '\0'; ++i){
		c = (s[i] + n)%91;
		if(c < 'A'){
			s[i] = 'A' + c; 
		}else{
			s[i] = c;
		}
	}
	printf("%s", s);
	return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

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

int main() {
	int N, K; cin >> N >> K;
	cout << N-K+1 << endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i, n) cin >> vec.at(i);
  int count = 0;
  rep(i, n) {
    if(vec.at(i) != i+1) count++;
  }
  if(count == 0 || count == 2) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

// void search(ll n, ll len)
// {
//     --n;
//     vector<char> ans(len, 'a');
//     ll r = 0, id = 0;
//     while(n > 0)
//     {
//         r = n % 26;
//         ans[id] += r;
//         n /= 26;
//     }
// }

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

    ll len = 1, sum = 0, prev = 0, a = 1, apre = 1;
    constexpr ll x = 26;
    vector<ll> ps;
    ps.push_back(a);
    while(true)
    {

        prev = sum;
        apre = a;
        a *= x;
        ps.push_back(a);
        sum += a;
        if (n <= sum && n > prev)
        {
            n -= prev;
            break;
        }
        ++len;
    }
    --n;
    vector<char> ans(len, 'a');
    ll r = 0, id = 0;
    while(n > 0)
    {
        r = n % 26;
        ans[id] += r;
        n /= 26;
        id++;
    }
    for (int i = len - 1; i >= 0; --i)
    {
        cout << ans[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main (){
    char a[3][2];
    char b[3][2];
    bool ans = true;
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 2; j++){
            cin >> a[i][j];
            b[2-i][1-j] = a[i][j];
        }
    }
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 2; j++){
            if (a[i][j] != b[i][j]) ans = false;
        }
    }
    if (ans == true) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}



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

int main() {
    int n; cin >> n;
    int a[100000];
    rep(i,n) cin >> a[i];
    multiset<int> s;
    s.insert(-a[0]);
    for (int i=1; i < n; i++) {
        auto t = s.upper_bound(-a[i]);
        if (t == s.end()) s.insert(-a[i]);
        else {
            s.erase(t);
            s.insert(-a[i]);
        }
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 8556
import sys

input = sys.stdin.readline
H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]

max_damage = max(damage for damage, cost in magic)
dp = [0] * (H + max_damage)

for x in range(1, H + max_damage):
    dp[x] = min(dp[x - damage] + cost for damage, cost in magic)

ans = min(dp[H:])

print(ans)


Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
using namespace std;
#define INF 1010101010
#define MOD 1000000007
#define LL long long
 
int main() {
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int W = sc.nextInt();
    int H = sc.nextInt();
    int N = sc.nextInt();
    int xmin = 0;
    int xmax = W;
    int ymin = 0;
    int ymax = H;
    for(int i = 0; i < N; i++) {
      int x = sc.nextInt();
      int y = sc.nextInt();
      int a = sc.nextInt();
      if(a == 1) xmin = Math.max(xmin, x);
      if(a == 2) xmax = Math.min(xmax, x);
      if(a == 3) ymin = Math.max(ymin, y);
      if(a == 4) ymax = Math.min(ymax, y);
    }
    int ans = Math.max(0, xmax - xmin) * Math.max(0, ymax - ymin);
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int dp[100004];
int jump(int arr[],int n,int k){
	//base case
	if(n==1){
		return 0;
	}
	
	if(n<1){
		return INT_MAX;
	}
	if(dp[n]!=-1) return dp[n];
	int minn=INT_MAX;
	for(int i=1;i<=k;i++){
		if(n-i-1<0)break;
		minn=min(minn,abs(arr[n-1]-arr[n-i-1])+jump(arr,n-i,k));
	}
	return dp[n]=minn;
}



int main(){
	memset(dp,-1,sizeof(dp));
	int n,k;
	cin>>n>>k;
	int arr[n];
	
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	cout<<jump(arr,n,k);
	
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(10);
		   int n;
           cin>>n;
           vector<pair<int,P>> r(n);
           rep(i,0,n){
             int x,y,h;
             cin>>x>>y>>h;
             r[i]=mp(h,mp(x,y));
           }
           sort(all(r));
           reverse(all(r));
           
           //全探索
           
           rep(i,0,101){
             rep(j,0,101){
               int g=-1;
               bool ok=true;
               rep(k,0,n){
                 
                 if(g==-1)g=r[k].first+abs(i-r[k].second.first)+abs(j-r[k].second.second);
                 else{
                   if(r[k].first==0){
                     if(g-abs(i-r[k].second.first)-abs(j-r[k].second.second)>0)ok=false;
                   }
                   else if(g-abs(i-r[k].second.first)-abs(j-r[k].second.second)!=r[k].first)ok=false;
                 }
               }
               if(ok){
                cout<<i<<" "<<j<<" "<<g<<endl;
                 return 0;
               }
             }
           }
}

Measured memory_bytes: 3620
$N,$A,$B,$C = gets.split.map(&:to_i)
$L = Array.new($N) {gets.to_i}
$INF = 10**9
$min = $INF

class Node
  attr_accessor :depth, :is_visited, :array
  def initialize(depth, is_visited, array)
    @depth = depth
    @is_visited = is_visited
    @array = array
  end
end

def calc(array)
  mp = -30
  a = 0
  b = 0
  c = 0
  array.each_with_index do |v, i|
    case v
    when 0 then
      a+=$L[i];mp+=10
    when 1 then
      b+=$L[i];mp+=10
    when 2 then
      c+=$L[i];mp+=10
    end
  end

  if [a,b,c].min == 0 then
    return $INF
  else
    return mp + (a-$A).abs + (b-$B).abs + (c-$C).abs
  end
end

def dfs()
  stack = [Node.new(0, true, [])]
  while !stack.empty?
    v = stack.pop()
    if v.depth > $N-1 then
      c = calc(v.array)
      $min = c if $min > c
    else
      childs = Array.new(4) do |i|
        Node.new(v.depth+1, false, v.array+[i])
      end

      childs.each do |v|
        if !v.is_visited then
          v.is_visited = true
          stack.push(v)
        end
      end
    end
  end
end

dfs()
puts $min

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

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

	set<string> items;
	unsigned long int T, count = 0;
	cin >> T;
	while (T--) {
		string str;
		cin >> str;
		if (items.find(str) == items.end()) count++;
		items.insert(str);
	}
	cout << count;
}

Measured memory_bytes: 19196
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for B - Addition and Multiplication
	var N, K int
	fmt.Scanf("%d\n%d", &N, &K)

	var answer int = 1
	for i := 0; i < N; i++ {
		answer = int(math.Min(float64(answer*2), float64(answer+K)))
	}
	fmt.Println(answer)
}


Measured memory_bytes: 1836
#include "bits/stdc++.h"
#define pb push_back
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
#define INF 300000000000001
#define ll_max 9000000000000000000
#define PI 3.14159265358979323846L
#define fill(a, n, x) for(int i = 0; i < n; i++) a[i] = x;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define db(args...) {string _ss = #args; replace(_ss.begin(), _ss.end(), ',' , ' '); stringstream ___s(_ss) ; debug(___s, args);}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long int ll;
typedef long double ld;
typedef vector<pair<ll,ll> > vll;
typedef vector<int> vi;
typedef pair<ll,ll> pll;
ll mod = 1000000007;
const ll N = 300001;
const ll M = log2(N);

struct point
{
    ll x, y;
};

struct node
{
    ll t, p, d, i;
};

void debug(stringstream &s) {}
template <typename T, typename... Args>
void debug(stringstream &s, T a, Args... args)
{
    string word;
    s >> word;
    cerr << word << " = " << a << endl;
    debug(s, args...);
}

ll fast_exp(ll x, ll n)
{
    if(n == 0) return 1;
    if(n & 1) return fast_exp(x, n - 1) * x % mod;
    else
    {
        ll ans = fast_exp(x, n / 2);
        return ans * ans % mod;
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    int _ = 1;
    //cin >> _;
    int test = 0;
    while(_--)
    {
        test++;
        ll n, m, x = 0, y = 0, k, ans = 1;
        cin >> n;
        ll a[n + 1];
        for(int i = 1; i <= n; i++) {
            cin >> a[i];
        }
        a[0] = 1;
        k = 1000;
        ll dp[n + 1] = {};
        dp[1] = k;
        for(int i = 1; i < n; i++)
        {
            for(int j = i + 1; j <= n; j++)
            {
                if(a[i] < a[j])
                    dp[j] = max(dp[j], (dp[i] / a[i]) * a[j] + dp[i] % a[i]);
                else dp[j] = max(dp[j], dp[i]);
            }
        }
        ans = dp[n];
        cout << ans << "\n";
    }
    return 0;
}


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

int main() {
  int a[3];
  scanf("%d %d %d",&a[0],&a[1],&a[2]);
  sort(a,a+3);
  cout<<10*a[2]+a[1]+a[0]<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S= sum(A)

R1 = S
for i in range(N//2):
    R1-=2*A[2*i+1]
R = [R1]

for j in range(1, N):
    R.append(A[j-1]*2-R[-1])

print(" ".join(str(n) for n in R))

Measured memory_bytes: 101996
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,w,h,x,y,s,t,num,sum;
	while(cin>>n){
		sum=0;
		if(n==0) break;
		cin>>w>>h;
		int p[w][h];
		for(int i=0;i<w;i++){
			for(int j=0;j<h;j++){
				p[i][j]=0;
			}
		}
		for(int i=0;i<n;i++){
			cin>>x>>y;
			p[x-1][y-1]=1;
		}
		cin>>s>>t;
		for(int i=0;i<=w-s;i++){
			for(int j=0;j<=h-t;j++){
				num=0;
				for(int ii=0;ii<s;ii++){
					for(int jj=0;jj<t;jj++){
						num=num+p[i+ii][j+jj];
					}
				}
				sum=max(num,sum);
			}
		}
		cout<<sum<<endl;
	}
    return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>
#define N 100
#define WHITE 1
#define BLACK 2
#define GRAY 3

int time,color[N],f[N],d[N],adj[N][N];

void visit(int u,int n){
  int v;
  color[u]=GRAY;
  d[u]=++time;
  for(v=0;v<n;v++){
    if(adj[u][v]==0) continue;
    if(color[v]==WHITE) visit(v,n);
  }
  color[u]=BLACK;
  f[u]=++time;
}

void dfs(int n){
  int u;
  for(u=0;u<n;u++){
    color[u]=WHITE;
  }

  time=0;

  for(u=0;u<n;u++){
    if(color[u]==WHITE) visit(u,n);
  }

  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main(){
  int n,i,j,u,k,v;

  scanf("%d",&n);

  for(i=0;i<n;i++) for(j=0;j<n;j++) adj[i][j]=0;

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    if(k!=0){
      for(j=1;j<=k;j++){
	scanf("%d",&v);
	v--;
	adj[u][v]=1;
      }
    } 
  }
    
  dfs(n);
  
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
using namespace std;
int main() {
  string str;
  int n;
  getline(cin, str);
  for(int i = 0; i < (int)str.length(); ++i) {
	n = str[i] - 'A' + 23;
	if(n >= 26) {
	  n -= 26;
	}
	str[i] = char(n + 'A');
	cout << str[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 3156
s = input()
n = len(s)
if n % 2 == 1:
  print('No')
elif n % 2 == 0 :
  n = n // 2
  moji =''
  for i in range(n):
    moji += 'hi'
  if s == moji:
    print('Yes')
  else:
    print('No')
  

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

ll modpow(ll x, ll n)
{
    if (n == 0) return 1%mod;
    long long u = modpow(x,n/2);
    u = (u*u)%mod;
    if (n%2 == 1) u = (u*x)%mod;
    return u%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     ll n;
     cin>>n;
     vector <ll> v;
     ll ar[100000]={0};
     ll m =-1;
     for(ll x = 0; x <n; x++)
     {
        ll d;
        cin>>d;
        v.push_back(d);
        ar[v[x]]++;
        if(v[x]>m)
        {
            m = v[x];
        }
     }
     if(v[0]!=0)
     {
         cout<<0<<"\n";
         return 0;
     }
     //cout<<m<<"\n";
     for(ll x = 0; x<=m; x++)
     {
         if(ar[x]==0)
         {
             cout<<0<<"\n";
             return 0;
         }
     }
     if(!(ar[0]==1))
     {
         cout<<0<<"\n";
         return 0;
     }
     ll ans = 1;
     for(ll x = 1; x<=m; x++)
     {
         ll power = modpow(ar[x-1],ar[x]);
         ans = ((ans%mod)*(power%mod))%mod;
     }
     cout<<ans%mod<<"\n";
}

Measured memory_bytes: 2168
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = 10**9 + 7
result = 0

a_sum = sum(a)

for v in a:
    result += v * (a_sum - v)
    a_sum -= v

if result < MOD_VALUE:
    print(result)
else:
    print(result % MOD_VALUE)


Measured memory_bytes: 31708
#include <iostream> 
#include <cstdlib>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
    char c;
    cin >> c;
    if (c == 'a') {
        cout << "vowel" << endl;
    } else if (c == 'i') {
        cout << "vowel" << endl;
    } else if (c == 'u') {
        cout << "vowel" << endl;
    } else if (c == 'e') {
        cout << "vowel" << endl;
    } else if (c == 'o') {
        cout << "vowel" << endl;
    } else cout << "consonant" << endl;
}



Measured memory_bytes: 256
import std.stdio, std.algorithm, std.range, std.conv, std.string;

int exchange = 0;

void main()
{
    int n = readln.chomp.to!int;
    auto s = readln.chomp.split.map!(to!int).array;
    mergeSort(s).map!(to!string).join(" ").writeln;
    exchange.writeln;
}

int[] merge(int[] left, int[] right)
{
    int[] result;

    while (true) {
        if (left.empty) {
            result ~= right;
            exchange += right.length;
            break;
        } else if (right.empty) {
            result ~= left;
            exchange += left.length;
            break;
        } else {
            if (left[0] <= right[0]) {
                result ~= left[0];
                left = left[1..$];
            } else {
                result ~= right[0];
                right = right[1..$];
            }

            exchange++;
        }
    }

    return result;
}

int[] mergeSort(int[] a)
{
    if (a.length < 2)
        return a;

    auto mid = a.length / 2;
    int[] left = a[0..mid];
    int[] right = a[mid..$];
    return merge(mergeSort(left),  mergeSort(right));
}

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

int n;

int main(){
  cin >> n;
  vector<long long> a(n);
  
  for(int i = 0; i < n; i++){
    cin >> a[i];
    a[i] -= (i + 1);
  }
  sort(a.begin(), a.end());
  
  int b;
  if(n % 2 == 1) b = a[n/2];
  else b = (a[n/2] + a[n/2 - 1]) / 2;
  
  long long sad = 0;
  for(int i = 0; i < n; i++){
    sad += abs(a[i] - b);
  }
  
  cout << sad << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner InData = new Scanner(System.in);
    int t = InData.nextInt();
    int s = t%60;
    int m = t/60;
    int h = m/60;
    m = m%60;
    System.out.println(h+":"+m+":"+s);
    }
}

Measured memory_bytes: 26284
import math

def primeFactors(n): 
	  
	# Print the number of two's that divide n 
	d = {}
	while n % 2 == 0: 
	    # print 2, 
	    # x.add(2)
	    if(2 not in d):
	    	d[2] = 1
	    else:
	    	d[2]+=1
	    n = n / 2
	      
	# n must be odd at this point 
	# so a skip of 2 ( i = i + 2) can be used 
	for i in range(3,int(math.sqrt(n))+1,2): 
	      
	    # while i divides n , print i ad divide n 
	    while n % i== 0: 
	        # print i, 
	        # x.add(i)
	        if(i not in d):
	        	d[i] = 1
	        else:
	        	d[i]+=1
	        n = n / i 
	          
	# Condition if n is a prime 
	# number greater than 2 
	if n > 2: 
	    # print n 
	    # x.add(n)
	    if(n not in d):
	    	d[n] = 1
	    else:
	    	d[n]+=1
	return d

n = int(input())

d = primeFactors(n)
if(not d):
	print(0)
else:
	ans = 0
	for i in d:
		if(d[i] == 1):
			ans+=1
		else:
			ans += int((-1 + math.sqrt(1 + 8 * d[i])) // 2);

	print(ans)





Measured memory_bytes: 9300
#include<bits/stdc++.h>
using namespace std;
using Int = __int128_t;

istream &operator>>(istream &is, Int &val){
    string s;
    is>>s;
    val=0;
    for(int i=0;i<(int)s.size();i++)
      if(isdigit(s[i])) val=val*10+s[i]-'0';
    if(s[0]=='-') val*=-1;
    return is;
}



signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  auto calc=[](Int x){
    if(x <= 9) return x + 1;
    Int res=10;
    Int t = 10;
    Int k = 2;
    while( t * 10 <= x){
      res += k * (t * 9);
      k++;
      t *= 10;
    }
    return res + (x - t + 1) * k;
  };

  //cout<<calc(101)<<endl;
  //cout<<calc(13)<<endl;
  
  auto sub=[](string s,Int k){
    return s.substr(s.size()-k);
  };

  auto inc=[](string s){
    for(Int i=s.size()-1;i>=0;i--){
      if(s[i]=='9'){
	s[i]='0';
	continue;
      }
      s[i]++;
      break;
    }
    return s;
  };
  
  string s;
  
  while(cin>>s,s!="#"){
    Int ans=1e18;
    for(Int i=1;i<min(Int(17),Int(s.size()));i++){
      string t=s.substr(0,i),u=s.substr(i);
      if(u.front()=='0'||u.size()>16) continue; 
      //cout<<t<<"::"<<u<<endl;
      for(Int j=max((Int)t.size(),(Int)u.size());j<17;j++){
	string x=inc(t),y=u;
	//cout<<i<<" "<<j<<":"<<x<<":"<<y<<endl;
	x=string(j-t.size(),'$')+x;
	y=y+string(j-u.size(),'$');
	bool f=0;
	for(Int k=0;k<j;k++){
	  if(k+1!=j){
	    f|=(isdigit(x[k])&&isdigit(y[k])&&x[k]!=y[k]);
	  }
	  f|=(x[k]=='$'&&y[k]=='$');
	}
	if(f) continue;
	if(y.back()!='$'){
	  if(x.back()-'0'!=y.back()-'0') continue;
	}
	
	for(Int k=0;k<j;k++){
	  if(y[k]!='$') continue;
	  y[k]=isdigit(x[k])?x[k]:'0';
	}
	if(y=="1") continue;
	Int tmp=calc(stoll(y)-1)-i;
	//cout<<i<<" "<<j<<":"<<x<<":"<<y<<":"<<tmp<<endl;
	ans=min(ans,tmp);
	
      }
    }
    //cout<<"SPL"<<endl;
    for(Int i=1;i<17;i++){
      for(Int j=0;j<i;j++){
	if(j+i>(Int)s.size()) continue;
	string t=s.substr(j,i);
	if(t.front()=='0') continue;
	Int x=stoll(t);
	//cout<<t<<" "<<x<<endl;
	if(j){
	  if(x==1) continue;
	  string u=to_string((long long)(x-1));
	  //cout<<s.substr(0,j)<<":"<<u<<" "<<sub(u,j)<<endl;
	  if(s.substr(0,j)!=sub(u,j)) continue;
	}
	Int p=j+i;
	bool f=1;
	while(p<(Int)s.size()){
	  string u=to_string((long long)++x);
	  string v=s.substr(p,min((Int)u.size(),(Int)s.size()-p));
	  //cout<<u<<":"<<v<<endl;
	  u=u.substr(0,v.size());
	  f&=(u==v);
	  p+=u.size();
	}
	if(!f) continue;
	Int tmp=calc(stoll(t)-1)-j;
	//cout<<i<<" "<<j<<" "<<":"<<t<<" "<<tmp<<endl;
	ans=min(ans,tmp);
      }
    }
    if(ans==1e18){
      ans=calc(stoll("1"+s)-1)+1;
    }
    cout<<(long long)ans<<endl;
  }
  return 0;
}

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

const ll MAXN = 200000;

ll N, ans=10000000000, tmp=0;
vector<ll> A, B;
string S;
signed main(){
    cin >> N >> S;
    A.resize(N+1);
    B.resize(N+1);
    A[0] = 0;
    B[N]=0;
    for(int i=1;i<=N;i++) {
        if(S[i-1]=='#') A[i] = A[i-1] + 1;
        else A[i] = A[i-1];
    }
    for(int i=N-1;i>=0;i--) {
        if(S[i+1]=='.') B[i] = B[i+1] + 1;
        else B[i] = B[i+1];
    }
    for(int i=0;i<=N;i++) {
        ans = min(ans, A[i]+B[i]);
    }
    cout << ans << endl;
    return 0;
}

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

#define ll int long long
#define dll double long long
#define forei(i,n,x) for(int i=n;i<=x;i++)
#define fored(i,n,x) for(int i=n;i>=x;i--)
#define forni(i,n,x) for(int i=n;i<x;i++)
#define fornd(i,n,x) for(int i=n;i>x;i--)
#define SQ(a) (a)*(a)
#define MOD 1000000007
#define sortvi(v) sort(v.begin(),v.end())
#define sortvd(v) sort(v.rbegin(),v.rend())
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pv(v) for(auto it: v) cout<<it
#define endl '\n'   //Take care in case of interactive problems
#define  MAX2 200005
#define  MAX1 100005
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define INPA(arr,n) forni(i,1,n)cin>>arr[i]


typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
    /* write your code here */
    
   int n,k;cin>>n>>k;
   int arr[n+1];
   INPA(arr,n+1);
   sort(arr+1,arr+n+1);
   int sum=0;
   for(int i=0;i<k;i++)
    sum+=arr[i+1];
    
    cout<<sum<<endl;
    
    return 0;
}






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

int main()
{
    int n,i,min,max;
    int a[101];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(i==0)
        {
           min=a[i];
           max=a[i];
        }
        else
        {
            if(max<a[i])
                max=a[i];
            if(min>a[i])
                min=a[i];
        }
    }
    printf("%d",max-min);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2005000
#define MOD 1000000007
#define N 2005
#define M 1000005
#define LOG 20
#define KOK 4000000
using namespace std;

int n,m,q,a,b,c,d;
char s[N][N];
int pren[N][N],pred1[N][N],pred2[N][N];

int main() {

	//freopen("input.txt","r",stdin);

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

	for(int i=1;i<=n;i++) {

		scanf("%s",s[i]+1);

	}

	for(int i=1;i<=n;i++) {

		for(int j=1;j<=m;j++) {

			pren[i][j]=pren[i][j-1]+pren[i-1][j]-pren[i-1][j-1]+(s[i][j]=='1');
			pred1[i][j]=pred1[i][j-1]+pred1[i-1][j]-pred1[i-1][j-1]+(s[i][j]=='1' && s[i-1][j]=='1');
			pred2[i][j]=pred2[i][j-1]+pred2[i-1][j]-pred2[i-1][j-1]+(s[i][j]=='1' && s[i][j-1]=='1');			

		}

	}

	for(int i=1;i<=q;i++) {

		scanf("%d %d %d %d",&a,&b,&c,&d);

		int ted=pred2[c][d]-pred2[a-1][d]-pred2[c][b]+pred2[a-1][b]+pred1[c][d]-pred1[a][d]-pred1[c][b-1]+pred1[a][b-1];
		int tn=pren[c][d]-pren[a-1][d]-pren[c][b-1]+pren[a-1][b-1];

//		printf("ted %d tn %d\n",ted,tn);

		//assert(ted<=tn-1);

		printf("%d\n",tn-ted);

	}

}

Measured memory_bytes: 52864
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long int ull;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define all(v) (v).begin(),(v).end()
#define clr(a,b) memset((a),(b),sizeof(a))
#define sz size()
#define pb push_back
#define print(x) cout << x << endl
int n,m;
int ans;
string s,t;
// int w[1000],v[1000];
// int d[1001],dp[1001][1001];
vector<int> vec;

int main(){
  ll a,b;
  cin >> a >> b;
  ans = a-b;
  if(ans < 0)puts("0");
  else print(ans);
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

ll n, m, q, ans = 0;
ll a[50], b[50], c[50], d[50];
ll A[10];

void dfs(int dep, int num) {
  if (dep == n) {
    ll t = 0;
    rep(i, q) if (A[b[i]] - A[a[i]] == c[i]) t += d[i];
    ans = max(ans, t);
  } else {
    for (int i = num; i <= m; ++i) A[dep] = i, dfs(dep + 1, i);
  }
}

int main() {
  cin >> n >> m >> q;
  rep(i, q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--, b[i]--;
  }

  dfs(0, 1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for i in range(M)]

min_id = 1
max_id = float('INF')
na_flag = False
for m in range(M):
    left = LR[m][0]
    right = LR[m][1]
    if right < min_id or max_id < left:
        na_flag = True
        break

    if min_id < left and left <= max_id:
        min_id = left
    if right < max_id and min_id <= right:
        max_id = right

if na_flag:
    print(0)
else:
    print(max_id - min_id + 1)


Measured memory_bytes: 59992
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    let S = arg[0].split("");
    const N = S.length;
    
    for(let i=0; i<N; i++) {
        S.pop();
        
        const first = S.slice(0, Math.ceil(S.length / 2));
        const last  = S.slice(Math.ceil(S.length / 2) * -1);
        
        // console.log(`first:${first}`);
        // console.log(`last:${last}`);
        
        if(first.join("") === last.join("") && S.length % 2 === 0) {
            console.log(S.length);
            return;
        }
    }
    
    console.log(1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 9420
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    loop {
        let a:i32 = sc.read();
        let op:String = sc.read();
        let b:i32 =sc.read();
        match op.as_str() {
            "+" => println!("{}", a + b),
            "-" => println!("{}", a - b),
            "*" => println!("{}", a * b),
            "/" => println!("{}", a / b),
            _=> break
        }
    }
}

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
 
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


Measured memory_bytes: 5032
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main implements Runnable {
	static final int INF = (int)1e9+7;
	int N;
	int[] R,S,P,C;

	public boolean check(int x,int y,int z){
		int[] sum = new int[N];

		int[] rank_s = new int[N],rank_p = new int[N],rank_c = new int[N];
		int[] rank_all = new int[N];

		//smile
		for(int i = 0;i < N;i++){
			for(int j = i+1;j < N;j++){
				int add = 0;
				if(i == 0)add = x;
				if(S[i]+add < S[j])rank_s[i]++;
				else if(S[i]+add > S[j])rank_s[j]++;
			}
		}
		//pure
		for(int i = 0;i < N;i++){
			for(int j = i+1;j < N;j++){
				int add = 0;
				if(i == 0)add = y;
				if(P[i]+add < P[j])rank_p[i]++;
				else if(P[i]+add> P[j])rank_p[j]++;
			}
		}
		//cool
		for(int i = 0;i < N;i++){
			for(int j = i+1;j < N;j++){
				int add = 0;
				if(i == 0)add = z;
				if(C[i]+add < C[j])rank_c[i]++;
				else if(C[i]+add > C[j])rank_c[j]++;
			}
		}

		for(int i = 0;i < N;i++){
			sum[i] = R[rank_s[i]] + R[rank_p[i]] + R[rank_c[i]];
		}

		for(int i = 0;i < N;i++){
			for(int j = i+1;j < N;j++){
				if(sum[i] < sum[j])rank_all[i]++;
				else if(sum[i] > sum[j])rank_all[j]++;
			}
		}

		return rank_all[0] <= 7;
	}

	public void solve() {
		N = nextInt();

		R = new int[N];
		S = new int[N];
		P = new int[N];
		C = new int[N];
		for(int i = 0;i < N;i++){
			R[i] = nextInt();
		}

		for(int i = 0;i < N;i++){
			S[i] = nextInt();
			P[i] = nextInt();
			C[i] = nextInt();
		}

		int low = 0;
		int high = INF;
		for(int i = 0;i < 100;i++){
			int mid = high+low>>1;
			if(check(mid,0,0) || check(0,mid,0) || check(0,0,mid)){
				high = mid;
			}else{
				low = mid;
			}
		}
		if(high == INF)out.println("Saiko");
		else out.println(high);


	}

	public static void main(String[] args) {
		new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

	public long nextLong() {
		return Long.parseLong(next());
	}

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

	@Override
	public void run() {
		out.flush();
		new Main().solve();
		out.close();

	}
}

Measured memory_bytes: 28904
from collections import deque
h,w = map(int,input().split())
m = ["#"*(w+2)]+["#"+input()+"#" for i in range(h)]+["#"*(w+2)]
temp = [[-1]*(w+2) for i in range(h+2)]
sy,sx = 1,1
temp[sy][sx] = 0
opt = [(1,0),(0,1),(-1,0),(0,-1)]
dq = deque([(sy,sx)])
while dq:
    y,x = dq.popleft()
    for i in opt:
        y1 = y+i[0]
        x1 = x+i[1]
        if m[y1][x1] == "." and temp[y1][x1] == -1:
            temp[y1][x1] = temp[y][x]+1
            dq.append((y1,x1))

cnt = 0
for i in m:
    cnt+=i.count("#")
if temp[h][w] == -1:
    print(-1)
else:
    print((h+2)*(w+2)-cnt-temp[h][w]-1)

Measured memory_bytes: 3316
function bomb(x){
   var str="";
   for(var i=0;i<x.length;i++){
      str+=x[i];
   }
   x=str;
   var L=0;
   while(L!=x.length){
      L=x.length;
      x=x.replace(/1111+|2222+|3333+/,"");
   }
   min=Math.min(min,x.length);
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var I=0;
while(true){
   var N=Arr.shift()-0;
   if(N==0 || I==4)break;
   I++;
   var arr=[];
   for(var i=0;i<N;i++){
      var v=Arr.shift()-0;
      arr.push(v);
   }
   var min=Infinity;
   for(var i=0;i<N;i++){
      var memo=arr[i];
      if(i<N-1)arr[i]=arr[i+1];
      bomb(arr);
      if(i>0)arr[i]=arr[i-1];
      bomb(arr);
      arr[i]=memo;
   }
   console.log(min);
}

Measured memory_bytes: 44304
Fact=[1]
for i in range(1,50+1):
    Fact.append(Fact[-1]*i)

def nCr(n,r):
    return Fact[n]//(Fact[r]*Fact[n-r])
N,P=map(int,input().split())
A=list(map(int,input().split()))

Odd,Even=0,0
for a in A:
    if a%2:
        Odd+=1
    else:
        Even+=1

T=0
for r in range(P,Odd+1,2):
    T+=nCr(Odd,r)
print(T*(2**Even))


Measured memory_bytes: 62020
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        int n = Reader.NextUInt;
        int last = 0;
        int cur = 0;
        int max = 0;
        for (int i = 0; i < n; i++)
        {
            var h = Reader.NextUInt;
            if (last >= h) max = Max(max, ++cur);
            else cur = 0;
            last = h;
        }
        Console.WriteLine(max);
    }
}

static class Reader
{
    const int BUF_SIZE = 1 << 12;
    static Stream Stream = Console.OpenStandardInput();
    static byte[] buffer = new byte[BUF_SIZE];
    static int ptr = 0;

    private static void Read() { Stream.Read(buffer, 0, BUF_SIZE); }

    private static byte Next { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (ptr >= buffer.Length) { Read(); ptr = 0; } return buffer[ptr++]; } }

    public static int NextUInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0; byte next; do { next = Next; } while (next < 48);
            do { res = res * 10 + next - 48; next = Next; } while (48 <= next);
            return res;
        }
    }
}


Measured memory_bytes: 11092
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;
 
int main() {
    int n;
    scanf("%d", &n);
    int A[n];
    int B[n];
    int C[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
        scanf("%d", &B[i]);
        scanf("%d", &C[i]);
    }
    int dp[n][3];
    dp[0][0] = A[0];
    dp[0][1] = B[0];
    dp[0][2] = C[0];
    for (int  i = 1; i < n; i++) {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + A[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + B[i];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + C[i];
    }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) <<endl;
    return 0;
}


Measured memory_bytes: 2560
X, Y = map(float,input().split())

#print(2*X-Y/2)
#print(Y/2-X)

if (2*X-Y/2).is_integer() and (Y/2-X).is_integer() and (2*X-Y/2)>=0 and (Y/2-X)>=0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9040
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n=0,ma=0,cnt=0;
  vector<int> a(3);
  cin>>a[0]>>a[1]>>a[2];
  while(true){
    sort(a.begin(),a.end());
    if(a[0]==a[1]&&a[1]==a[2]){
      cout<<n;
      return 0;
    }else if(a[1]==a[2]){
      a[0]+=2;
      n++;
    }else{
      a[0]++;
      a[1]++;
      n++;
    }
  }
}

Measured memory_bytes: 256