akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>//文章中にその言葉が使われた数を出す//
#include<stdlib.h>
#include<string.h>

int check(char [],int);

int main (void){

	int i,count=0,counter=0,pod;
	char get,search[100];
	
	for(i=0;;i++){//探す文字を入力//
		get=getchar();
		if(get=='\n'){
			search[i]='\0';
			break;
		}
		search[i]=get;
		count++;

	}
	while(1){
		pod=check(search,count);
		if(pod==-1)
			break;
		counter+=pod;
	}
	printf("%d\n",counter);
	
	return 0;
}
	
int check(char search[],int count){

	int i,j,len,len2,flag=0;
	char word[1000],out[100]="END_OF_TEXT";

	scanf("%s",word);
	if(strcmp(out,word)==0){//入力された文字がEND_OF_TEXTなら-1を返して終了する//
		return -1;
	}
	len=strlen(word);
	len2=strlen(search);
	if(len!=len2)//探す文字と文章の単語の長さが違ったら0を返す//
		return 0;
	for(i=0;i<len;i++){
		for(j=0;j<count;j++){
			if(word[i] != search[j]&&
			word[i] + 32 != search[j]&&
			word[i] - 32 != search[j]){//探していた文字の大文字でも小文字でもなかったらflagを建てる//
				i-=j;
				flag=1;
				break;
			}
			else i++;
		}
	if(flag==1)
		return 0;
	}
	return 1;
}

Measured memory_bytes: 556
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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;
}

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   ll A, B;
   cin >> A >> B;
   if ((A + B) % 2 == 0) cout << (A + B) / 2 << endl;
   else cout << "IMPOSSIBLE" << endl;
   return 0;
}


Measured memory_bytes: 256
import java.util.*;
  
class Main{
   public static void main(String[] args){
     Scanner stdId = new Scanner(System.in);
     int W = stdId.nextInt(); 
     int H = stdId.nextInt(); 
     int x = stdId.nextInt(); 
		 int y = stdId.nextInt();
		 int r = stdId.nextInt();

     int[] Distance = {x,y,W-x,H-y};
     Arrays.sort(Distance);
     if(Distance[0]>=r) System.out.println("Yes");
     else System.out.println("No");
  }
}

Measured memory_bytes: 17364
import java.io.*;
import java.util.*;

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

		String s = in.next();
		int count = 0;
		for (int i=0; i<s.length()/2; i++)
			if (s.charAt(i) != s.charAt(s.length()-1-i))
				count++;
		System.out.println(count);
	}
}



Measured memory_bytes: 23252
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
diff = 1e100
for i in range(N):
    d = abs(A - (T - H[i] * 0.006))
    if d < diff:
        ans = i
        diff = d
print(ans + 1)


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/






int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  int a, b, d; cin >> a >> b >> d;
  cout << b/d - (a-1)/d << '\n';





/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
#define oo 666666666
#define ll long long
#define ld long double

ld P[3001];
ld DP[3001][3001];

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>P[i];

    DP[0][0]=1;
    for(int i=1; i<=n; i++)
        for(int j=0; j<=n; j++)
        DP[i][j]+= DP[i-1][j-1]*P[i] + DP[i-1][j]*(1-P[i]);

    ld ats = 0;
    for(int j=n/2+1; j<=n; j++)
        ats+=DP[n][j];

    cout<<fixed<<setprecision(13)<<ats;
}


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

int main() {
  int N;
  cin>>N;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  sort(v.begin(),v.end());
  cout<<v[N-1]-v[0]<<endl;
}


Measured memory_bytes: 256
from collections import deque
import bisect

def solve():
  N = int(input())
  A = [int(input()) for i in range(N)]
  q = deque()
  for a in A:
    if len(q) == 0 or a <= q[0]:
      q.appendleft(a)
    else:
      q[bisect.bisect_left(q, a) - 1] = a

  return len(q)

print(solve())

Measured memory_bytes: 8060
#include<bits/stdc++.h>
using namespace std;
int getMaxPoint(vector<int> v,int &p){
  int point=INT_MIN,act=-1;
    for(int i=0;i<3;i++){
      if(i==p)
        continue;
      if(v[i]>point){
        point=v[i];
      act=i;
      }
    }
  p=act;
  return point;
}
int main(){
  int n;
  cin>>n;
  vector<vector<int> > vac(n,vector<int> (3));
  for(int i=0;i<n;i++){
    cin>>vac[i][0]>>vac[i][1]>>vac[i][2];
  }
  int activity=-1;
  vector<vector<int> > dp(n,vector<int> (3));
  dp[0]=vac[0];
  for(int i=1;i<n;i++){
    dp[i][0]=vac[i][0]+max(dp[i-1][1],dp[i-1][2]);
    dp[i][1]=vac[i][1]+max(dp[i-1][0],dp[i-1][2]);
    dp[i][2]=vac[i][2]+max(dp[i-1][0],dp[i-1][1]);
  }
 cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
  return 0;
}

Measured memory_bytes: 14332
#include <stdio.h> 

int main() {
  long int a, b, c, d;
  long int ans1, ans2, ans;

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

  long int x1 = a * c;
  long int x2 = a * d;
  long int x3 = b * c;
  long int x4 = b * d;

  if (x1 < x2) {
    ans1 = x2;
  } else {
    ans1 = x1;
  }

  if (x3 < x4) {
    ans2 = x4;
  } else {
    ans2 = x3;
  }

  if (ans1 < ans2) {
    ans = ans2;
  }  else {
    ans = ans1;
  }

  printf("%ld", ans);

  return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<pair<ll, ll>> G[N];
    REP(i, N - 1)
    {
        ll u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));
    }

    vector<ll> color(N, -1);
    queue<ll> q;
    vector<bool> isVisited(N, false), isAdd(N, false);
    color[0] = 0;
    q.push(0);
    isAdd[0] = true;
    while(!q.empty())
    {
        ll u = q.front();
        q.pop();
        isVisited[u] = true;
        REPV(it, G[u])
        {
            pair<ll, ll> p = *it;
            ll v = p.first;
            if (color[v] == -1)
            {
                ll w = p.second;
                color[v] = w % 2 == 0 ? color[u] : (color[u] + 1) % 2;
                q.push(v);
            }
        }
    }
    REP(i, N)
    {
        cout << color[i] << endl;
    }
}


Measured memory_bytes: 8704
#pragma GCC optimize ("Ofast","unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define F first
#define S second
#define setpre(a) cout.precision(a),cout<<fixed;
#define ALL(a) a.begin(),a.end()
#define MEM(a,b) memset(a,b,sizeof a)
#define Tie ios::sync_with_stdio(0),cin.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

ll n,k,ans;

int main(){Tie
	cin>>n>>k;
	while(n){
		ans++,n/=k;
	}
	cout<<ans<<'\n';
}

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

const ll mod = 1e9 + 7 ;

int main(){
    ll n     ;
    cin >> n ;
    vector<ll> A(n) ;
    rep(i,n) cin >> A.at(i) ;
    ll ans = 0 ;
    rep(i,60){
        ll x = 0 ;
        rep(j,n) if( A.at(j) >> i & 1 )x++ ;
        ll tem = x*(n-x) ;
        tem %= mod ;
        rep(j,i){
            tem *= 2 ;
            tem %= mod ;
        }
        ans += tem ;
        ans %= mod ;
    }
    cout << ans << endl ;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

int main(int argc, char const* argv[])
{
    string s;
    cin >> s;
    for (int i = 1; i < (int)s.length()/2; i++) {
        string substr1, substr2;
        int len = (s.length() - 2*i) / 2;
        substr1 = s.substr(0,len);
        substr2 = s.substr(len, len);
        // cout << substr1 << " " << substr2 << " " << len << endl;
        if (substr1 == substr2) {
            cout << 2 * (int)substr1.length() << endl;
            break;
        }
    }

    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


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

class Node {
    public:
        vector<int> children;
        vector<int> edge_value;
        int value;
        int parent;
};

class Tree {
    public:
        int root;
        int node_num;
        vector<Node> node;
        
        Tree(vector<vector<int>> hen, int r) {
            root = r;
            node_num = hen.size();
            node = vector<Node>(hen.size());
            
            queue<int> v;
            v.push(root);
            node[root].parent = -1;
            int edge_num = 0;
            while(!v.empty()) {
                int tyoten = v.front();
                node[tyoten].value = tyoten;
                v.pop();
                for (int i = 0; i < hen[tyoten].size(); i++) {
                    int child = hen[tyoten][i];
                    if (child != node[tyoten].parent) {
                        node[tyoten].children.push_back(child);
                        node[tyoten].edge_value.push_back(edge_num);
                        edge_num++;
                        node[child].parent = tyoten;
                        v.push(child);
                    }
                }
            }
        }
};

vector<int> ruisekiwa(Tree tree, vector<int> weight) {
    vector<int> partial_set(tree.node_num);
    queue<Node> value;
    value.push(tree.node[tree.root]);
    queue<int> sum_weight;
    sum_weight.push(weight[tree.root]);
    while(!value.empty()) {
        Node v = value.front();
        int node_weight = sum_weight.front();
        value.pop();
        sum_weight.pop();
        
        partial_set[v.value] = node_weight;
        for (int i = 0; i < v.children.size(); i++) {
            value.push(tree.node[v.children[i]]);
            sum_weight.push(node_weight+weight[v.children[i]]);
        }
    }
    
    return partial_set;
}

int main() {
    int n, q;
    cin >> n >> q;
    
    vector<vector<int>> hen(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        hen[a-1].push_back(b-1);
        hen[b-1].push_back(a-1);
    }
    vector<pair<int, int>> px(q);
    rep(i, q) {
        int p, x;
        cin >> p >> x;
        px[i] = make_pair(p-1, x);
    }
    
    Tree tree(hen, 0);
    vector<int> r_node(n, 0);
    rep(i, q) r_node[px[i].first] += px[i].second;
    vector<int> ans = ruisekiwa(tree, r_node);
    
    rep(i, n) cout << ans[i] << endl;
}

Measured memory_bytes: 62000
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <vector>
using namespace std;
#define max(a,b) ((a)>=(b)?(a):(b))
typedef pair<int,int> P;
vector<P> points;
bool field[5001][5001];
int main() {
	int n;
	while(scanf("%d",&n),n) {
		memset(field,0,sizeof(field));
		points.clear();
		for(int i=0;i<n;i++) {
			int x,y;
			scanf("%d %d",&x,&y);
			field[x][y]=true;
			points.push_back(make_pair(x,y));
		}
		int S=0;
		for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) {
			int dx=points[j].first-points[i].first;
			int dy=points[j].second-points[i].second;
			int x1=points[j].first+dy,y1=points[j].second-dx;
			int x2=x1-dx,y2=y1-dy;
			if(0>x1||x1>5000||0>y1||y1>5000) continue;
			if(0>x2||x2>5000||0>y2||y2>5000) continue;
			if(!field[x1][y1]||!field[x2][y2]) continue;
			S=max(S,dx*dx+dy*dy);
		}
		printf("%d\n",S);
	}
}

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

using namespace std;

const int MAX = 200000 + 5;
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(long long n, long long 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() {
    long long n, k;
    cin >> n >> k;

    COMinit();
    long long ans = 0;
    for (int i = 0; i <= min(n - 1, k); ++i) {
        ans = (ans + COM(n, i) * COM(n - 1, i) % MOD) % MOD;
    }
    while (ans < 0) ans += MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
import collections

def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
a=int(input())
pl=pf(a)
c=collections.Counter(pl)
nl=list(c.values())

re=0
for x in nl:
  for y in range(1,100):
    if x*2<(y+1)*(y+2):
      re+=y
      break
      
print(re)

Measured memory_bytes: 9464
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;


int main(){
	int n;
	while(cin>>n && n > 0){
		int ans = n * n * n - 2;
		for(int i = 1; i * i * i < n * n * n; i++){
			for(int j = 1; i * i * i + j * j * j <= n * n * n; j++){
				ans = min(ans, n * n * n - i * i * i - j * j * j);
			}
		}
		cout<<ans<<endl;
	}
}

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

using namespace std;
#define int long long
int MOD = 1000000007;


signed main(){
    int N;
    cin >> N;
    
    int X;
    for(int i=1;i<=100000;i++){
        X = i*1.08;
        if(X==N){
            cout << i << endl;
            return 0;
        }
    }
    
    cout << ":(" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// to_string(数値)
// %0桁数d とすると表示桁数が「桁数」に満たない場合に0埋めされる
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// printf("%02d:%02d:%02d",hour,minute,second);
// 降順 sort(a.begin(),a.end(),greater<int>());
// bitset<ビット数> 変数名;  // すべてのビットが0の状態で初期化される
// bitset<ビット数> 変数名("ビット列");  // 指定したビット列で初期化される
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int pa = n / 2;
  int gu = (n+1)/2;
  int score = 0;
  rep(i,gu){
    if(s.at(i) == 'p') score--;
  }
  for(int i=gu;i<n;i++){
    if(s.at(i) == 'g') score++;
  }
  cout << score << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    long long t=n;
    long long sum=0;
    while(t)
    {
        sum+=(t%10);
        t/=10;
    }
    if(n%sum==0)
    {
        puts("Yes");
    }
    else
        puts("No");

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
const ll oo=1e18;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n; cin>>n;
    ll ans=1;
    vector<ll> v;
    for(int i=1;i<=n;i++){
        ll a; cin>>a;
        v.push_back(a);
        if(a==0) { cout<<0; return  0; }
        
    }
    for(int i=0;i<v.size();i++){
        ll a=v[i];
        if(ans>oo/a) {cout<<-1; return 0 ;}
        ans*=a;
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4284
n = int(input())
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
zero_flag = 0

for i in range(n):
	new_a.append(abs(a[i]))

for i in range(n):
	if a[i] < 0:
		minus_count += 1
	if a[i] == 0:
		zero_flag = 1

if zero_flag == 1:
	for i in range(n):
		sum += abs(a[i])
elif minus_count % 2 == 0:
	for i in range(n):
		sum += abs(a[i])
else:
	for i in range(n):
		sum += new_a[i]
	sum = sum - min(new_a) * 2

print(sum)

Measured memory_bytes: 14496
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    vector <ll> ls;
    REP(i, n){
        ll l; cin >> l;
        ls.push_back(l);
    }
    sort(ls.begin(), ls.end());
    ll ans = 0;
    ll two;
    for (ll i=0; i<n-1; i++){
        for (ll j=i+1; j<n; j++){
            two = ls[i] + ls[j];
            ans += lower_bound(ls.begin(), ls.end(), two) - (ls.begin() + j + 1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define inf 1e18 

using namespace std;
int power(int x, unsigned int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int a,b,c,d,i;
    cin>>a>>b>>c>>d;
    int ans=max(a*c,max(a*d,max(b*c,b*d)));
    if(a*b<=0||c*d<=0) ans=max(ans,0ll);
    cout<<ans;
}

Measured memory_bytes: 3644
//abc096_b.cpp
//Sat May  5 20:52:36 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int a;
	int b;
	int c;
	cin >> a;
	cin >> b;
	cin >> c;
	int k;
	cin >> k;

	int max = a;
	int min1 = b;
	int min2 = c;
	if (b>max){
		max = b;
		min1 = a;
		min2 = c;
	}
	if (c>max){
		max = c;
		min1 = a;
		min2 = b;
	}

	for (int i=0;i<k;i++){
		max = max*2;
	}

	cout << max+min1+min2 << endl;
}

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

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
 
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
// clang-format on

int main() {
  LL N;
  cin >> N;
  vector<int> A(N);

  int tmp;
  for (int i = 0; i < N; i++) {
    cin >> tmp;

    if (tmp % 2 == 0) {
      if ((tmp % 3 == 0) || (tmp % 5 == 0)) {
        // cout << "APPROVED" << endl;
        continue;
      } else {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }

  cout << "APPROVED" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
// #include <algorithm>
// #include <queue>
// #include <cmath>
// #include <string>
// #include <numeric>
// #include <set>
// #include <map>
// #include <iomanip>

#define MOD 1000000007
// #define INF 1000000001

using namespace std;
typedef unsigned long long ull;
// typedef long long ll;

void p_() {
    cout << "\n";
}
template<class Head, class... Body>
void p_(Head head, Body... body) {
    cout << head << ",";
    p_(body...);
}


int main(int argc, char const *argv[]) {
    ull N, K;
    cin >> N >> K;
    ull ans = 0;
    for (ull i = K; i <= N+1; ++i) {
        ull l = i * (i-1) / 2;
        ull h = i * N - l;
        // p_(i, l, h);
        ans = (ans + (h - l + 1)) % MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
N,M=map(int,input().split())
list=[[] for i in range(N+1)]
for i in range(M):
    a,b=map(int,input().split())
    list[a].append(b)
    list[b].append(a)
c=0
for i in list[N]:
    if list[i]:
        list[i].sort()
        if list[i][0]==1:
            c=1
            break
if c==1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')








Measured memory_bytes: 38320
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
 
public class Program
{
	public static void Main()
	{
		string s = Console.ReadLine();
      int firstA = 0, lastZ = 0;
      for(int i = 0; i < s.Length; i++){
        if(s[i] == 'Z') lastZ = i;
      }
      for(int i = s.Length - 1; i >= 0;i--){
        if(s[i] == 'A') firstA = i;
      }
      
      Console.WriteLine(lastZ - firstA + 1);
      
	}
}

Measured memory_bytes: 11616
n,k = map(int, input().split())
a = list(map(int, input().split()))
cnt = 1
for i in range(k):
  cnt += a[i]
pre = cnt
for i in range(n-k):
  cnt -= a[i]
  cnt += a[i+k]
  if cnt>pre:
    print('Yes')
  else:
    print('No')
  pre = cnt

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


void merge(int a[100000][3], int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	static int l[100001][3];
	static int r[100001][3];

	for (int i = 0; i <= n1 - 1; i++) {
		l[i][0] = a[left + i][0];
		l[i][1] = a[left + i][1];
		l[i][2] = a[left + i][2];
	}
	for (int i = 0; i <= n2 - 1; i++) {
		r[i][0] = a[mid + i][0];
		r[i][1] = a[mid + i][1];
		r[i][2] = a[mid + i][2];
	}

	l[n1][0] = 1000000001;
	r[n2][0] = 1000000001;

	int i = 0;
	int j = 0;

	for (int k = left; k < right; k++) {
		if (l[i][0] <= r[j][0]) {
			a[k][0] = l[i][0];
			a[k][1] = l[i][1];
			a[k][2] = l[i][2];
			i++;
		}
		else {
			a[k][0] = r[j][0];
			a[k][1] = r[j][1];
			a[k][2] = r[j][2];
			j++;
		}
	}
}

void mergesort(int a[100000][3], int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		mergesort(a, left, mid);
		mergesort(a, mid, right);
		merge(a, left, mid, right);
	}
}

int main() {
	int n, c;
	static int x[100000][3];
	int use[31][2]; //channel,endtime
	int ans;

	cin >> n >> c;

	for (int i = 0; i < n; i++) {
		cin >> x[i][0] >> x[i][1] >> x[i][2];
	}

	for (int i = 0; i <= c; i++) {
		use[i][0] = 0;
		use[i][1] = 0;
	}

	mergesort(x, 0, n);

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < c; j++) {
			if (use[j][1] < x[i][0] || (use[j][1] <= x[i][0] && use[j][0] == x[i][2])) {
				use[j][0] = x[i][2];
				use[j][1] = x[i][1];
				break;
			}
		}
	}

	for (int i = 0; i <= c; i++) {
		if (use[i][0] == 0) {
			ans = i;
			break;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back

int main(){

    char a;
    cin >> a;
    if(isupper(a)){
        cout << "A" << endl;
    }else{
        cout << "a" << endl;
    }

}

Measured memory_bytes: 3564
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>

using namespace std;
typedef long long int ll;

int n,c=0;
ll x,a[1010];

int main(){
    scanf("%d %lld",&n,&x);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    sort(a,a+n);
    for(int i=0;i<n;i++){
        c=i;
        x-=a[i];
        //printf("%lld\n",x);
        if(x<=0)break;
        
    }
    //c++;
    if(x==0)c++;
    printf("%d\n",c);
}

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

int main(){
  int s, h, m;
  cin >> s;
  h = s / 3600;
  s = s % 3600;
  m = s / 60;
  s = s % 60;
  cout << h << ":" << m << ":" << s <<  endl;

  return 0;
}



Measured memory_bytes: 3088
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxx = 28;
const int NIL = -1;
struct node {
	int parent,left,right;
};
node tree[maxx];

int get_depth(int x){
	int depth=0;
	while(tree[x].parent!=NIL){
		x=tree[x].parent;
		depth++;
	}
	return depth;
}

int get_height(int x){
	int h1=0,h2=0;
	if((tree[x].left==NIL)&&(tree[x].right==NIL)) return 0;
	if(tree[x].left!=NIL) h1=get_height(tree[x].left)+1;
	if(tree[x].right!=NIL) h2=get_height(tree[x].right)+1;
	return max(h1,h2);
}

int main (){
	for(int i = 0;i<maxx;i++) {
	tree[i].parent=NIL;
	tree[i].left=NIL;
	tree[i].right=NIL;	
	}
	int n;
	cin>>n;
	int a,b,c;
	for(int i=0;i<n;i++){
		cin>>a>>b>>c;
		tree[a].left=b;
		tree[a].right=c;
		if(b!=NIL) tree[b].parent=a;
		if(c!=NIL) tree[c].parent=a;
	}
	for(int i=0;i<n;i++){
		printf("node %d: parent = %d",i,tree[i].parent);
		if(tree[i].parent==NIL) printf(", sibling = -1");
		else if(tree[tree[i].parent].left==i) printf(", sibling = %d",tree[tree[i].parent].right);
		else printf(", sibling = %d",tree[tree[i].parent].left);
		if(tree[i].left!=NIL){
			if(tree[i].right!=NIL) printf(", degree = 2"); else printf(", degree = 1");
		}
		else{
			if(tree[i].right!=NIL) printf(", degree = 1"); else printf(", degree = 0");
		}
		printf(", depth = %d",get_depth(i));
		printf(", height = %d",get_height(i));
		if(tree[i].parent==NIL) printf(", root");
		else if(tree[i].left==NIL&&tree[i].right==NIL) printf(", leaf");
		else printf(", internal node");
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 3216
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void)
{
	char s[1001],t[1001];
	int a,b,i,j,c=0,x=10000;
	scanf("%s%s",s,t);
	a=strlen(s);
	b=strlen(t);
	for(i=0;i<a-b+1;i++){
		for(j=0;j<b;j++){
			if(s[i+j]!=t[j]) c++;
		}
		x=min(x,c);
		c=0;
	}
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 1716
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#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)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    int N,M;
    cin >> N >> M;
    int k;
    vector<vector<int>> vec(M);

    for(int i=0;i<M;++i){
        cin >> k;
        vec[i].resize(k);
        for(int j=0;j<k;++j){
            cin >> vec[i][j];
            --vec[i][j];
        }
    }
    vector<int> p(M);
    for(int i=0;i<M;++i){
        cin >> p[i];
    }
    int ans=0;
    for(int i=0;i<(1 << N); ++i){
        bool ok=true;
        for(int j=0; j< M;++j){
            int c = 0;
            for(int id : vec[j]){
                if((i >> id) & 1){
                    ++c;
                }
            }
            c %= 2;
            if(c!=p[j]){
                ok=false;
            }
        }
        if(ok){
            ++ans;
        }

    }
    cout << ans << endl;
    return 0;
    }


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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(x) x.begin(),x.end()

bool solve(vi user,vi a){
    bool ret=true;
    rep(i,a.size()){
        if(find(all(user),a[i])==user.end())ret=false;
    }
    return ret;
}


int main(){
    int n;
    while(cin>>n){
        vi user[1000];
        vi loss;
        if(n==0)break;
        rep(i,n){
            int z;
            cin>>z;
            rep(j,z){
                int tmp;
                cin>>tmp;
                user[i].pb(tmp);
            }
            sort(all(user[i]));
        }
        int k;
        cin>>k;
        rep(i,k){
            int tmp;
            cin>>tmp;
            loss.pb(tmp);
        }
        int count=0;
        int ans=-1;
        rep(i,n){
            if(solve(user[i],loss)){
                count++;
                ans=i;
            }
        }
        if(count==1){
            cout<<ans+1<<endl;
        }
        else cout<<"-1"<<endl;
        
    }
    return 0;
}

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

int main()
{
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#endif
    int k, n, ans = INT_MAX;
    scanf("%d%d", &k, &n);
    int tmp, tmp2, last;
    scanf("%d", &tmp), last = tmp;
    for (int i = 1; i != n; ++i) {
        scanf("%d", &tmp2);
        ans = min(ans, k - tmp2 + last);
        last = tmp2;
    }
    tmp += k - tmp2;
    ans = min(ans, k - tmp);
    printf("%d\n", ans);
}

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

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

int main() {
  ll n;
  cin >> n;
  map<char, int> m;
  rep(i, n) {
    char c;
    cin >> c;
    m[c]++;
  }

  if (m.size() == 3) cout << "Three" << endl;
  else cout << "Four" << endl;

  return 0;
}


Measured memory_bytes: 3640
import java.util.*;


public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        double n = s.nextInt();

        String ans;
        if(n%2 == 0) {
          ans = "0.5000000000";
        } else {
          ans = String.format("%.10f", (n+1)/(2*n));
        }

        System.out.println(ans);
    }
}

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

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

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  string s;
  cin >> s;
  string res;
  REP(i,s.length()) {
    if(s[i] != 'B') {
      res += s[i];
    }else if(!res.empty()){
      res.pop_back();
    }
  }
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 256
N = gets.to_i

# A -> 0 C -> 1 G -> 2 T -> 3
# NG = AGC + 1度入れ替えてAGCになるもの
# AGC, GAC , ACG , A?GC , AG?C
# 021, 201 , 012 , 0?21 , 02?1

ary = Array.new(101).map{Array.new(4,0).map{Array.new(4,0).map{Array.new(4,0)}}}
ary[0][3][3][3] = 1
mod = 1000000007

N.times{|len|
    4.times{|c1| # 最後から1文字目
        4.times{|c2| # 最後から2文字目
            4.times{|c3| # 最後から3文字目
                next if ary[len][c1][c2][c3] == 0
                4.times{|a| # 新規追加文字
                    next if (a == 1 && c1 == 2 && c2 == 0)
                    next if (a == 1 && c1 == 0 && c2 == 2)
                    next if (a == 2 && c1 == 1 && c2 == 0)
                    next if (a == 1 && c1 == 2 && c3 == 0)
                    next if (a == 1 && c2 == 2 && c3 == 0)
                    ary[len+1][a][c1][c2] += ary[len][c1][c2][c3]
                    ary[len+1][a][c1][c2] %= mod
                }
            }
        }
    }
}
ans = 0

4.times{|c1| # 最後から1文字目
    4.times{|c2| # 最後から2文字目
        4.times{|c3| # 最後から3文字目
            ans += ary[N][c1][c2][c3]
            ans %= mod
        }
    }
}

puts ans


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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int MAX_N = 1000;
/*Priority-que */
ll heap[MAX_N], sz = 0;

void push(ll x){
    //自分のノードの番号
    ll i = sz++;
    while (i > 0)
    {
        //親のノードの番号
        ll p = (i - 1) / 2;

        //もう逆転していないなら抜ける
        if (heap[p] <= x) break;
        heap[i] = heap[p];
        i = p;
    }
    heap[i] = x;
}

ll pop() {
    //最小値　(最大値の場合STLに標準で備わっている)
    ll ret = heap[0];
    //根に持ってくる値
    ll x = heap[--sz];

    //根から降ろしていく
    ll i = 0;
    while (i * 2 + 1 < sz) 
    {
        //子同士を比較
        ll a = i * 2 + 1, b = i *  2 + 2;
        if (b < sz && heap[b] < heap[a]) a = b;

        //もう逆転していないなら終わり
        if (heap[a] >= x) break;

        //子の数字を持ち上げる
        heap[i] = heap[a];
        i = a;
    }
    
    heap[i] = x;

    return ret;
}

int main(){
    int n, m; cin >> n >> m;
    ll x, add, ans = 0, ans_ = 0;
    ll xyz[n][3];
    for (int i = 0; i < n; i++)
        for (int j = 0; j < 3; j++){
            cin >> x;
            xyz[i][j] = x;
            }
    for (int i = 0; i < 8; i++)
    {
        ans = 0;
        sz = 0;
        for (int j = 0; j < n; j++)
        {
            add = 0;
            for (int k = 0; k < 3; k++)
            {
                if ((i >> k) & 1) add += xyz[j][k];
                else add -= xyz[j][k];
            }
            if (j < m) push(add), ans += add;
            else
            {
                ll p = pop();
                if (p < add) push(add), ans += (add - p);
                else push(p);
            }
        }
        ans_ = max(ans_, ans);
    }
    if(m == 0){
        cout << 0 << endl;
    }
    else{
        cout << ans_ << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a,b,c) = readLine()!!.split(" ").map { it.toInt() }

    if (
        a == b + c
        || b == a + c
        || c == a + b
    ) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 36120
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int n;
VI pena;
VVI gain;
int pena_sum;
int eval(VI &order)
{
    VI last(26, -1);
    int ret = 0;
    rep(i, n)
    {
        ret += gain[i][order[i]];
        last[order[i]] = i;
        rep(j, 26)
        {
            ret -= pena[j] * (i - last[j]);
        }
    }
    return ret;
}
void print(VI &order)
{
    for (auto &&x : order)
    {
        cout << x + 1 << endl;
    }
}

int choice_weighted()
{
    int r = mt() % pena_sum;
    rep(i, 26)
    {
        r -= pena[i];
        if (r <= 0)
            return i;
    }
}

void search()
{
    auto starttime = clock();
    typedef pair<int, VI> Tact;
    priority_queue<Tact> pque;
    VI base(n);
    VI last(26, -1);
    rep(i, n)
    {
        int cur = -IINF;
        int penasum = 0;
        rep(j, 26)
        {
            penasum += pena[j] * (i - last[j]);
        }
        rep(j, 26)
        {
            if (cur < gain[i][j] - penasum + pena[j] * (i - last[j]))
            {
                base[i] = j;
                cur = gain[i][j] - penasum + pena[j] * (i - last[j]);
            }
        }
        last[base[i]] = i;
    }
    auto best = base;
    int bscore = eval(base);
    //pque.push({eval(base), base});
    cerr << bscore << endl;
    int loopnum = 0;
    while (double(clock() - starttime) / CLOCKS_PER_SEC < 1.9)
    {
        base[mt() % n] = choice_weighted();
        int cscore = eval(base);
        if (cscore > bscore)
        {
            best = base;
            bscore = cscore;
        }
        else
        {
            base = best;
        }
        loopnum++;
    }
    print(best);
    cerr << bscore << endl;
    cerr << loopnum << endl;
}
int main()
{
    cin >> n;
    pena = VI(26);
    gain = VVI(n, VI(26));
    rep(i, 26)
    {
        cin >> pena[i];
        pena_sum += pena[i];
    }
    rep(i, n)
    {
        rep(j, 26)
        {
            cin >> gain[i][j];
        }
    }
    search();
    return 0;
}

Measured memory_bytes: 3668
'use strict'

function main(input) {
  input = input.split(' ').map(v => ~~v)

  let ans = input[0] + input[1]
  ans = Math.max(ans, input[0] - input[1])
  ans = Math.max(ans, input[0] * input[1])

  console.log('%d', ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int k; cin >> k;
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << a[k-1] << endl;

    return 0;
}


    


Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>
#include <bitset>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int k = -1, g = 1;
		cin >> k;
		if (k <= 0) return 0;
		vector<int> d(20);
		for (int i = 0; i < k; ++i) {
			for (int j = 0; j < g; ++j) {
				if (d[j] < 9 && (j == g - 1 || d[j] <= d[j + 1])) {
					++d[j];
					for (int k = j - 1; k >= 0; --k) {
						d[k] = max(0, d[k + 1] - 1);
					}
					goto done;
				}
			}
			for (int j = 0; j < g; ++j) {
				d[j] = 0;
			}
			++g;
			d[g - 1] = 1;
		done:
			{}
		}
		for (int i = g - 1; i >= 0; --i) {
			cout << d[i];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a[] = new int[26];
        int b[] = new int[26];
        boolean bre = false;
        for (int i = 0; i < 26; i++) {
            a[i] = -1;
            b[i] = -1;
        }
        for (int i = 0; i < s.length(); i++){
            if (a[s.charAt(i) - 'a'] >= 0) {
                if (a[s.charAt(i) - 'a'] != t.charAt(i) - 'a') {
                    bre = true;
                    break;
                }
            }
            if (b[t.charAt(i) - 'a'] >= 0) {
                if (b[t.charAt(i) - 'a'] != s.charAt(i) - 'a') {
                    bre = true;
                    break;
                }
            }
            if (a[s.charAt(i) - 'a'] < 0) {
                a[s.charAt(i) - 'a'] = t.charAt(i) - 'a';
            }
            if (b[t.charAt(i) - 'a'] < 0) {
                b[t.charAt(i) - 'a'] = s.charAt(i) - 'a';
            }
        }
        if (!bre) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26388
/*http://agc014.contest.atcoder.jp/submissions/1266693*/
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.function.LongSupplier;
import java.util.stream.IntStream;
 
public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final IntStream REPS(int v){
		return IntStream.range(0,v);
	};
	static int h,w,k;
	public static void main(String[] __){
		h=s.nextInt();
		w=s.nextInt();
		k=s.nextInt();
		char[][]f=new char[h][];
		int x=-1,y=-1;
		for(int i=0;i<h;i++) {
			String in=s.next();
			if(x==-1) {
				x=in.indexOf('S');
				y=i;
			}
			f[i]=in.toCharArray();
		}
		
		int u=y,d=y,r=x,l=x;
		
		int[]dx= {0,1,0,-1};
		int[]dy= {1,0,-1,0};
		
		
		ArrayDeque<Point> deque=new ArrayDeque<>();
		deque.add(new Point(y,x));
		for(int i=0;i<=k;i++) {
			for(int j=deque.size();j>0;j--) {
				Point poll=deque.poll();
				
				u=Math.min(u,poll.y);
				d=Math.max(d,poll.y);
				l=Math.min(l,poll.x);
				r=Math.max(r,poll.x);
				
				
				f[poll.y][poll.x]='#';
				for(int bufd=0;bufd<4;bufd++) {
					if(range(poll.y+dy[bufd],poll.x+dx[bufd])
							&&f[poll.y+dy[bufd]][poll.x+dx[bufd]]=='.') {
						deque.add(new Point(poll.y+dy[bufd],poll.x+dx[bufd]));
				f[poll.y+dy[bufd]][poll.x+dx[bufd]]='#';
					}
				}
			}
		}
		/*
		System.out.println(u);
		System.out.println(h-1-d);
		System.out.println(l);
		System.out.println(w-1-r);
		*/
		System.out.println((IntStream.of(u,h-1-d,l,w-1-r).min().getAsInt()+k-1)/k+1);
	}
	
	static final boolean range(int y,int x) {
		return 0<=y&&y<h&&0<=x&&x<w;
	}
	static class Point{
		int y,x;
		Point(int y,int x){
			this.y=y;
			this.x=x;
		}
	}
}

Measured memory_bytes: 43416