akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int mo=1000000007;
int hm,n,x,y,t,fa[200005],T[200005],e[200005],h[200005];
LL X,ans,P[200005],Q[200005],A[200005],f[200005],g[200005],H[200005];
vector <int> a[200005],b[200005];
struct cmp{
	bool operator()(int a,int b){
		return h[a]==h[b]?e[a]<e[b]:h[a]<h[b];
	}
};
priority_queue <int,vector<int>,cmp> d;
void dfs(int x,int y){
	fa[x]=y; h[x]=h[y]+1;
	hm=max(hm,h[x]); e[x]=++t;
	if (!T[x]) T[x]=x;
	b[h[x]].push_back(x);
	if (a[x].size()==1) T[a[x][0]]=T[x];
	for (int i=0;i<a[x].size();++i) dfs(a[x][i],x);
}
int main(){
	scanf("%d",&n); ++n;
	H[0]=1; for (int i=1;i<=n;++i) H[i]=H[i-1]*2%mo;
	for (int i=2;i<=n;++i){
		scanf("%d",&x);
		a[x+1].push_back(i);
	}
	t=0; dfs(1,0);
	for (int z=1;z<=hm;++z){
		for (int i=0;i<b[z].size();++i){
			x=T[b[z][i]]; d.push(x); f[x]=g[x]=1;
		}
		while (!d.empty()){
			t=0; y=fa[d.top()]; f[y]=g[y]=0;
			while (!d.empty()){
				x=d.top(); if (fa[x]!=y) break;
				A[++t]=x; d.pop();
			}
			if (!y) {(ans+=f[1]*H[n-b[z].size()]%mo)%=mo; break;}
			P[0]=1; Q[t+1]=1;
			for (int i=1;i<=t;++i) P[i]=P[i-1]*g[A[i]]%mo;
			for (int i=t;i;--i) Q[i]=Q[i+1]*g[A[i]]%mo;
			for (int i=1;i<=t;++i) f[y]=(f[y]+P[i-1]*Q[i+1]%mo*f[A[i]]%mo)%mo;
			X=1; for (int i=1;i<=t;++i) X=X*(f[A[i]]+g[A[i]])%mo;
			g[y]=(X-f[y])%mo; f[T[y]]=f[y]; g[T[y]]=g[y]; d.push(T[y]);
		}
	}
	printf("%lld\n",(ans%mo+mo)%mo);
	return 0;
}

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

int main()
{
    ll n,k;
    cin>>n>>k;
    ll a=n/k;
    ll b=a;
    ll ans=(a*a*a);
    if(k%2==0)
    {
        if(n%k>=k/2)
            b++;
        ans+=(b*b*b);
    }
    cout<<ans<<endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    vpii info;
    string s;
    int k;
    int n;
    cin>>n;
    cin>>k;
    cin>>s;
    int p=0;
    while(p<n){
        char kind=s[p];
        int cnt=0;
        while(p<n&&s[p]==kind){
            cnt++;
            p++;
        }
        pii e=make_pair(kind-'0',cnt);
        info.push_back(e);
    }
    if((info.size()+1)/2<=k){
        cout<<n<<endl;
        return 0;
    }
    int r=0;
    int cnt=0;
    int ans=0;
    int res=0;
    for(int l=0;l<info.size();l++){
        while(true){
            if(cnt<k&&r<info.size()&&info[r].first==0){
                cnt++;
                res+=info[r++].second;
            }
            else if(r<info.size()&&info[r].first==1){
                res+=info[r++].second;
            }
            else{
                break;
            }
        }
        chmax(ans,res);

        if(r==l){
            r++;
        }
        else{
            res-=info[l].second;
            if(info[l].first==0)cnt--;
        }
   }
   cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 1528
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c && c == a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
acount=0
bcount=0
ans=0

for i in range(n):
  bcount=0
  acount+=a[i]
  for j in range(i,n):
    bcount+=b[j]
    if ans<acount+bcount:
      ans=acount+bcount
print(ans)

Measured memory_bytes: 9196
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {

	auto N = readln.split[0].to!long;
	auto A = readln.split[0].to!long;
	auto B = readln.split[0].to!long;
	auto C = readln.split[0].to!long;
	auto D = readln.split[0].to!long;
	auto E = readln.split[0].to!long;
	
	auto M = min(A,B,C,D,E);
	writeln(N%M == 0 ? N/M+4 : N/M+5);
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	double a,b,c,w1,w2;
	cin>>a>>b>>c;
	w1=(a+b+c)/2;
	w2=pow(w1*(w1-a)*(w1-b)*(w1-c),0.5);
	cout<<w2<<endl;

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
using namespace std;
int a[114514], cnt[114514];
signed main() {
	int n, m, ans = 0;
	cin >> n >> m;
	rep(i, m)cin >> a[i];
	sort(a, a + m);
	for (int i = 0; i < m - 1; i++)cnt[i] = a[i + 1] - a[i];
	sort(cnt, cnt + m - 1);
	for (int i = 0; i < m - 1-(n-1); i++)ans += cnt[i];
	cout << ans << endl;
	getchar(); getchar(); return 0;
}


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

using namespace std;

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

    int dp[s.size()+1][t.size()+1]; memset(dp,0,sizeof(dp));

    for(int i=1;i<=s.size();i++){
        for(int j=1;j<=t.size();j++){
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    int n= s.size();
    int m = t.size();

    string word(dp[n][m],' ');
    int i= dp[n][m]-1;

    while(n && m){
        if(s[n-1] == t[m-1]){
            word[i] = s[n-1];
            n--; m--; i--;
        }else if(dp[n-1][m] > dp[n][m-1]){
            n--;
        }else{
            m--;
        }
    }
    
    cout << word << endl;
 }

Measured memory_bytes: 35456
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools
import heapq


INF = 10 ** 10

# N, M <= 10^5
N, M = [int(x) for x in stdin.readline().rstrip().split()]
# 最大値のheapqにするために反転
A = [-(int(x)) for x in stdin.readline().rstrip().split()]

heapq.heapify(A)

while (M > 0):
    maxn = -(heapq.heappop(A))
    if maxn == 0:
        break

    num = maxn // 2
    heapq.heappush(A, -num)

    M -= 1

# マイナスを元に戻して出力
print(-sum(A))

Measured memory_bytes: 93604
#include<iostream> //cinなど
#include<string> //文字列
#include<algorithm> //sort など
#include<math.h> //paw(冪乗など)
#include<set> // 集合
#include<map> //写像
#include<stdio.h> //printf
#include<stack>

using namespace std;
int main(){
  int x,y;
  set<int> s;
  set<int> f;
  set<int> i;
  s.insert(1);s.insert(3);s.insert(5);s.insert(7);s.insert(8);s.insert(10);s.insert(12);
  f.insert(4);f.insert(6);f.insert(9);f.insert(11);
  i.insert(2);
  cin>> x >> y;
  if((s.count(x) && s.count(y))||(f.count(x) && f.count(y))||(i.count(x) && i.count(y))){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


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

public class Main{
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        Solver s = new Solver();
        s.solve(1, in, out);
        out.close();
    }

    static class Solver {

        void solve(int test_case, InputReader in, PrintWriter out) throws IOException {
            long x = in.nextLong();
            long y = in.nextLong();
            long m = x;
            int ans = 0;
            while (x <= y) {
                x *= 2;
//                out.println(x);
                ans++;
            }
            out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
            st = null;
        }

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

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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


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

const int Maxn = 100005;
struct node {
  long long l, r, x, d;
  node(long long l, long long r, long long x, long long d) : 
    l(l), r(r), x(x), d(d) { }
  node() { l = r = x = d = 0; }
  bool operator<(const node &b) const {
    return l < b.l;
  }
};
int n, b[Maxn];
long long k, ans;
long long a[Maxn];
set <node> st;
int main() {
  scanf("%d %lld", &n, &k), ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%lld %d", a + i, b + i);
    ans += (a[i] <<= 1);
    if (a[i] > k && b[i] == 1) 
      return puts("-1") & 0;
    if (b[i] == 2) a[i] %= k;
  } st.insert({0, k, 0, 0});
  long long cur = 0;
  for (int i = 0; i < n; ++i) {
    long long d = a[i];
    long long nx = cur + d;
    (nx > k) && (nx -= k);
    if (b[i] == 1) {
      if (cur < nx) {
        auto it = st.lower_bound({cur, 0, 0, 0});
        while (it -> r < nx) st.erase(it ++);
        node x1 = *it, x2 = *it;
        st.erase(it), x2.l = nx;
        long long now = x2.x + x2.d * (x2.r - nx);
        x1 = node(cur, nx, now, 1);
        st.insert(x1);
        if (x2.l ^ x2.r) st.insert(x2);
      } else {
        auto it = st.lower_bound({cur, 0, 0, 0});
        while (it != st.end()) st.erase(it ++);
        it = st.begin();
        while (it -> r < nx) st.erase(it ++);
        node x1 = *it, x2 = *it;
        st.erase(it), x2.l = nx;
        long long now = x2.x + x2.d * (x2.r - nx);
        x1 = node(0, nx, now, 1);
        st.insert(x1);
        if (x2.l != x2.r) st.insert(x2);
        now = x1.x + x1.d * x1.r;
        x2 = node(cur, k, now, 1);
        st.insert(x2);
      } cur = (cur + a[i]) % k;
    } else {
      (cur += a[i]) %= k;
      auto it = st.lower_bound({cur, 0, 0, 0});
      if (it == st.begin()) continue;
      if ((-- it) -> r <= cur) continue;
      node x1 = *it, x2 = *it;
      st.erase(it), x2.l = cur;
      x1.x = x2.x + x2.d * (x2.r - cur);
      x1.r = cur;
      st.insert(x1), st.insert(x2);
    }
  }
  long long mn = st.begin() -> x;
  for (auto x: st)
    mn = min(mn, x.x);
  printf("%lld\n", ans + mn);
  return 0;
}

Measured memory_bytes: 9216
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int N,Co,t,min1;
 scanf("%d",&N);
 min1=N;

 for(int i=0; i<=N; i++){
   Co=0;
   t=i;
   while(t>0){
    Co+=t%6; 
    t/=6;
   }
   t=N-i;
   while(t>0){
    Co+=t%9; 
    t/=9;
   }
   min1=min(min1,Co);
 }
 std::cout<<min1<<std::endl;
}
     

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,ans=0;
	cin >> n;
	vector<int> da(n);
	for (int i = 0;i < n;i++) {
		cin >> da[i];
		ans += da[i];
	}
	if (ans % 10 != 0) {
		cout << ans << endl;
		return 0;
	}
	sort(da.begin(), da.end());
	int i = 0;
	while (da[i]%10==0&&i!=n) {
		i++;
	}
	if (i == n)
		cout << 0 << endl;
	else
		cout << ans - da[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N;  bool can = true;
    ll pos=0; vector<pair<ll,ll>> p;
    rep(i,N){
        ll x,y; cin >> x >> y;
        p.push_back(make_pair(y,x));
    }
    sort(p.begin(),p.end());
    rep(i,N){
        pos+=p[i].second;
        if(pos>p[i].first){
            can = false; break;
        }
    }
    cout << (can ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 5744
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	int val;
	cin>>val;
	int d= val%10, c = (val/10)%10, b= (val/100)%10, a=(val/1000)%10;
	if(a+b+c+d==7) {
		cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";
	} else if(a-b+c+d==7) {
		cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7";
	} else if(a+b-c+d==7) {
		cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7";
	} else if(a+b+c-d==7) {
		cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7";
	} else if(a-b-c+d==7) {
		cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7";
	} else if(a+b-c-d==7) {
		cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7";
	} else if(a-b+c-d==7) {
		cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7";
	} else if(a-b-c-d==7) {
		cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7";
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int N = sc.nextInt();
		int D = sc.nextInt();
		int[][] ary = new int[N][D];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < D; j++) {
				ary[i][j] = sc.nextInt();
			}
		}
		int ret = 0;
		for (int i = 0; i < N - 1; i++) {
			for (int j = i + 1; j < N; j++) {
				long sum = 0;
				for (int k = 0; k < D; k++) {
					sum += Math.pow(ary[i][k] - ary[j][k], 2);
				}
				double root = Math.sqrt(sum);
				if (root == (int) root) {
					ret++;
				}
			}
		}
		System.out.println(ret);

	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

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

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

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

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

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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

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

int main() {
  int n;
  cin>>n;
  int AC=0;
  int WA=0;
  int TLE=0;
  int RE=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s=="AC")AC++;
    else if(s=="WA")WA++;
    else if(s=="TLE")TLE++;
    else RE++;
  }
  cout<<"AC x "<<AC<<endl;
  cout<<"WA x "<<WA<<endl;
  cout<<"TLE x "<<TLE<<endl;
  cout<<"RE x "<<RE<<endl;
  return 0;
}
  

  

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

long long tpas[52][52];

void makeTpas(void)
{
	for (int i = 1; i <= 51; i++) {
		for (int j = 1; j <= 51; j++) {
			if (j == 1)           /* 行の左端は 1 */
				tpas[i][j] = 1;

			else if (j == i) {    /* 行の右端も 1 */
				tpas[i][j] = 1;
				break;            /* 右端まで計算したので内側のループから抜ける */
			}

			else                  /* 行の途中は一つ上の二つの要素の合計 */
				tpas[i][j] = tpas[i - 1][j - 1] + tpas[i - 1][j];
		}
	}
}

int main(void)
{
	int N, P;
	cin >> N >> P;
	int* A = new int[N];
	int odd = 0, even = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		if (A[i] % 2 == 0) {
			++even;
		} else {
			++odd;
		}
	}

	makeTpas();

	// 偶数の組合せを求める
	long long sum_even = 0;
		for (int j = 0; j <= even; ++j) {
			sum_even += tpas[even+1][j+1];
		}

	// 奇数の組合せを求める
	long long sum_odd = 0;
	if (P == 1) {
		for (int j = 1; j <= odd; j += 2) {
			sum_odd += tpas[odd+1][j+1];
		}
	} else {
		for (int j = 0; j <= odd; j += 2) {
			sum_odd += tpas[odd+1][j+1];
		}
	}

	long long sum = sum_even * sum_odd;

	cout << sum << endl;

	return 0;
}

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

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

signed main(){
    string S;
    cin >> S;
    
    sort(S.begin(),S.end());
    S.erase(unique(S.begin(),S.end()),S.end());
    
    if(S=="ENSW"||S=="EW"||S=="NS") cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;



int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i == 0) ans = i;
    }
    ans += n/ans-2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int c = sc.nextInt();
        int[] b = new int[m];
        int[][] a = new int[n][m];
        int cnt = 0;
        int sum = 0;

        for(int i=0;i<m;i++){
            b[i]= sc.nextInt();
        }
        for(int i= 0;i<n;i++){
            for(int j= 0;j<m;j++){
                a[i][j]=sc.nextInt();
            }
        }

        for(int i = 0;i<n;i++){
            for(int j =0;j<m;j++){
                sum +=(a[i][j]*b[j]);
            }
            if(sum>-c){
                cnt++;
            }
            sum =0;
        }
        System.out.println(cnt);
        
    }
}


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

using namespace std;

using ll = long long;
using db = double;
using vi = vector<int>;
#define pb push_back
#define fir first
#define sec second

char a[300000]; 
int s[300]; 

int main() {
	scanf( "%s", a ); 
	int n = strlen(a); 
	for (int i = 0; i < n; ++i) 
		s[a[i]]++; 
	ll ans = 0; 
	for (int i = 0; i < 300; ++i) 
		ans += s[i]*ll(n-s[i]); 
	cout<<ans/2+1<<endl; 
}


Measured memory_bytes: 384
program ABC_094_B_TollGates
   implicit none
   integer N, M, X, i, countN
   integer, allocatable :: A(:)
   read(*, *) N, M, X
   allocate(A(1: M))
   read(*, *) A(1: M)
   countN = 0
   do i = 1, M
       if(X > A(i)) then
	      countN = countN + 1
	   end if 
   end do
   write(*, *) min(countN, M - countN)
end program ABC_094_B_TollGates

Measured memory_bytes: 768
A, B, C, D= map(int, input().split())
i=0
while True:
    count=i%2
    if count==0:
        C=C-B
        if C<=0:
            print("Yes")
            break
    elif count==1:
        A=A-D
        if A<=0:
            print("No")
            break
    i+=1

Measured memory_bytes: 9112
N = int(input())
 
T = [0]
X = [0]
Y = [0]

for i in range(0,N):
	ti, xi, yi = map(int, input().split())
	T.append(ti)
	X.append(xi)
	Y.append(yi)
 
message = "Yes"
 
for i in range(1,N + 1):
	time_dis = T[i] - T[i-1]
	x_dis = abs(X[i] - X[i-1])
	y_dis = abs(Y[i] - Y[i-1])
	total_dis = x_dis + y_dis

	if time_dis >= total_dis and (time_dis - total_dis) % 2 == 0:
		continue
		
	else:
		message = "No"
		break
		
print(message)

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll cnt[int(1e7 + 5)];

int main(){
  int N; cin >> N;
  int now = 0;
  for (ll i = 1; i <= N; i++){
    cnt[i] = cnt[i-1] + i;
    if (N <= cnt[i]){
      cout << i << endl;
      N -= i; now = i-1;
      break;
    }
  }

  while (N > 0){
    if (N >= now){
      cout << now << endl;
      N -= now;
    }
    now--;
  }

  return 0;
}


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

const int nax = 1e5 + 5;

vector<int> edges[nax];
int dist[nax];

int dfs(int u) {
	if (dist[u] != -1) return dist[u];
	dist[u] = 0;
	for (auto v : edges[u])
		dist[u] = max(dist[u], 1 + dfs(v));
	return dist[u];
}

int main() {
	memset(dist, -1, sizeof dist);
	int n, m; scanf("%d%d", &n, &m);

	while (m--) {
		int a, b; scanf("%d%d", &a, &b);
		edges[a].push_back(b);
	}

	for (int i = 0; i <= n; i++)
		dfs(i);

	int ans = 0;
	for (int i = 0; i <= n; i++)
		ans = max(ans, dist[i]);

	cout << ans;
}

Measured memory_bytes: 7424
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<queue>
#include<unordered_map>
using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    int ans = 1;
    int cnt = 0;
    while (ans < B) {
        ans += (A-1);
        cnt += 1;
    }
    cout << cnt << endl;
    return 0;
}

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

#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()  
{ 
    FAST_INP;
    int t; 
    string ans="";
    cin >> t;
    while(t){
    	int x=t%10;
    	if(x==2||x==4||x==5||x==7||x==9) ans="hon";
    	else if(x==0||x==1||x==6||x==8) ans="pon";
    	else if(x==3) ans="bon";
    	if(ans!="") break;
    	t/=10;
	}
	cout << ans << "\n";
    return 0;
} 

Measured memory_bytes: 3644
n, a, b = map(int, input().split())
s_l  = input()
ca = 0
cb = 0
for s in s_l:
  if s == 'a' and ca + cb < a+b:
    ca += 1
    print('Yes')
  elif s == 'b' and ca + cb < a+b and cb < b:
    cb += 1
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 4016
a,b = map(int, input().split())

ans = 0

for i in range(a+1):
  for j in range(b+1):
    if len(str(j)) == 2 and i >= 2 and int(str(j)[1]) >= 2 and int(str(j)[0]) >= 2:
      if i == int(str(j)[0]) * int(str(j)[1]): 
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;
int main(void)
{
    int n, k;

    cin >> n >> k;

    int board = 1;
    int a, b;
    for (int i = 0; i < n; i++) {
        a = board * 2;
        b = board + k;

        board = min(a, b);
    }

    cout << board << endl;

    return 0;
}

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

int main() {
  char a, b; cin >> a >> b;
  string A = "";
  string B = "";
  for (int i = 0; i < (a - '0'); i++) B += b;
  for (int i = 0; i < (b - '0'); i++) A += a;
  int x = stoi(A);
  int y = stoi(B);
  cout << max(x, y) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int N, M, X, Y;

	cin >> N >> M >> X >> Y;

	int xmax = X, ymin = Y;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		if (xmax < tmp) xmax = tmp;
	}
	for (int i = 0; i < M; i++) {
		int tmp;
		cin >> tmp;
		if (ymin > tmp) ymin = tmp;
	}

	if (xmax < ymin) cout << "No War";
	else cout << "War";

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);
#define MAXN 100123
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define ps push_back
#define SZ(v) int(v.size())
#define FORINT(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,n) FORINT(i,0,n)
#define INF INT_MAX;
#define ms(v,x) memset(v,x,sizeof(v))
using namespace std;

int n,t;
string s;

int main(){_
	cin >> s;
	bool achou = false;
	
	FOR(i,SZ(s)) if(s[i]=='7') achou = true;
	cout << (achou? "Yes":"No") << endl;
	

	return 0;
}

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

using namespace std;
long long mleft[100005];
long long mright[100005];

int main() {
    long long N;
    scanf("%lld", &N);
    for (int64_t i = 0; i < N; i++) {
        scanf("%lld %lld", &mleft[i], &mright[i]);
    }
    sort(mleft, mleft + N + 1, greater<long long>());
    sort(mright, mright + N + 1);
    long long sum = 0;
    for (long long i = 0; i <= N; i++) {
        if (mleft[i] > mright[i]) {
            sum += 2 * (mleft[i] - mright[i]);
        }
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 1792
n = int(input())
b_list = list(map(int, input().split()))
a_list = [0 for _ in range(n)]
a_list[0] = b_list[0]
a_list[1] = b_list[0]

for i in range(1, len(b_list)):
    if b_list[i] > b_list[i-1]:
        a_list[i+1] = b_list[i]
    else:
        a_list[i] = b_list[i]
        a_list[i+1] = b_list[i]

print(sum(a_list))


Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	s := nextStr()
	comp := strings.Split(s, "")
	if comp[0] == comp[1] && comp[1] == comp[2] {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define veci(x,n) vector<int> x((int) (n))
#define vecs(x,n) vector<string> x((int) (n))
#define vecbf(x,n) vector<bool> x((int) (n), false)

long comb(long a){
  return (a*(a-1))/2;
}

int main(){
  int n;
  cin >> n;
  vector<vector<char>> data(n,vector<char>(10));
  rep(i,n){
    rep(j,10){
      cin >> data.at(i).at(j);
    }
  }
  rep(i,n){
    sort(data.at(i).begin(),data.at(i).end());
  }
  sort(data.begin(),data.end());
  /*
  rep(i,n){
    rep(j,10){
      cout << data.at(i).at(j);
    }
    cout << endl;
  }
  */
  long answer = 0;
  int tmp = 0;
  long count = 1;
  for(int i=1;i<n;i++){
    if(data.at(i) == data.at(tmp)){
      count++;
    }else{
      answer += comb(count);
      count = 1;
      tmp = i;
    }
  }
  answer += comb(count);
  cout << answer << endl;
}

Measured memory_bytes: 5760
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

int main(){
    int n;
    while(cin>>n){
        if(n==0)break;

        int ma=-1;
        
        rep(i,55){
            rep(j,100){
                int calc= i*i*i + (int)(j*(j+1)*(j+2)/6);
                if( calc <=n ){
                   ma=max( ma , calc );
                }
                else break;
            }
        }
        cout<<ma<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
  
N, K = map(int, input().split())
p = 10**9 +7
for i in range(K):
  print((comb(N-K+1,i+1,p)*comb(K-1,i,p))%p)

Measured memory_bytes: 74204
#B
S=input()
T=input()
a=len(S)
b=len(T)
ans=float("inf")
for i in range(0,len(S)-len(T)+1):
    K=S[i:i+len(T)]
    cnt=0
    for j in range(len(K)):
        if K[j]!=T[j]:
            cnt+=1
    ans=min(ans,cnt)
        
print(ans)

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

int Convert(string s){

  int sum=0;

  for(int i=(int)s.size()-1; i>=0; i--){
    sum += (s[i]-'0')*pow(10,s.size()-1-i);
  }
  return sum;
}

int main(){

  string s;
  int tmp;
  int n;

  cin>>n;

  for(int i=0; i<n; i++){
    cin >> s;
    sort(s.begin(),s.end());
    tmp = Convert(s);
    reverse(s.begin(),s.end());
    cout << Convert(s)-tmp << endl;
  }
  

  return 0;
}

Measured memory_bytes: 1268
#include<stdio.h>
int main(void)
{
	int n,i,f=0,j=0;;
	char a[100],b[100];
	scanf("%d%s",&n,a);
	for(i=n/2;i<n;i++){
		b[j]=a[i];
		j++;
	}
	for(i=0;i<n/2;i++){
		if(a[i]!=b[i]){
			f=1;
		}
	}
	if(f==1||n%2==1){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl

#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#else
#define DBPRT(a) if(0){}
#define DBSTART if(0){
#define DBEND }
#define PRTLST(arr,num) if(0){}
#define PRTLST2(arr2,d1,d2) if(0){}
#define PRTLST2D(arr2,d1,d2) if(0){}
#endif

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 100000
//---------------------

ll a,b;

int main(){
	cin  >> a >> b;
	string s,t;
	REP(i,b) s.PB('0'+a);
	REP(i,a) t.PB('0'+b);
	if(s<t) PRT(s); else PRT(t);
	return 0;
}









Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    }
}


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

int main(){
    int N, D, X;
    cin >> N >> D >> X;
    for(int i = 0; i < N; i++){
        int A;
        cin >> A;
        X += (D - 1) / A + 1;
    }
    cout << X << endl;
}


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

#define lli long long int
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define INF 1000000007
#define endl "\n"
#define max(aa, bb) (aa > bb ? aa : bb)
#define min(aa, bb) (aa < bb ? aa : bb)

lli dp[5][100005], v[5][100005], n;

lli dfs(lli last, lli i){
    lli &tmp=dp[last][i], cvp=0;
    if(tmp!=-1) return tmp;
    if(i>=n) return 0;

    for (lli j=0; j<3; j++){
        if(j!=last){
            cvp=max(cvp, dfs(j, i+1)+v[j][i]);
        }
    }
    return tmp=cvp;
}

int main(){

    cin>>n;
    for(lli i=0;i<n;i++){
        cin>>v[0][i]>>v[1][i]>>v[2][i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<dfs(3,0);

}

Measured memory_bytes: 16064
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <stdint.h>
#define int long long
#define oku7 1000000007
using namespace std;


//う ず ま き
int x=-1, y=0, d=1;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { -1, 0, 1, 0 };

const int MAXINT = 9223372036854775807 / 3;
int G[201][201];

signed main(){
	int N, M, R;
	cin >> N >> M >> R;
	vector<int> iku;
	for (int i = 0; i < R; i++){
		int tmp;
		cin >> tmp;
		iku.push_back(tmp);
	}
	for (int i = 0; i < 201; i++){
		for (int j = 0; j < 201; j++){
			if(i != j)G[i][j] = MAXINT;
			else G[i][j] = 0;
		}
	}
	for (int i = 0; i < M; i++){
		int a, b, c;
		cin >> a >> b >> c;
		G[a][b] = G[b][a] = c;
	}


	//ワーシャルフロイドをする
	for (int k = 1; k <= N; k++){
		for (int i = 1; i <= N; i++){
		for (int j = 1; j <= N; j++){
				if (G[i][j] > G[i][k] + G[k][j]){
					G[i][j] = G[i][k] + G[k][j];
					G[j][i] = G[i][k] + G[k][j];
				}
			}
		}
	}

	sort(iku.begin(), iku.end());
	int ans = MAXINT;
	do {
		int tmp = 0;
		for (int i = 0; i < (int)iku.size() -1; i++){
			tmp += G[iku[i]][iku[i + 1]];
		}
		if (tmp < ans) ans = tmp;
	} while (next_permutation(iku.begin(), iku.end()));
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,k;
    long long int k1=0;
   long long int i;
    cin>>a>>b>>k;
   if(a<=k)
   {
       k -= a;
       a  = 0;
       if(k>=b)
       {
           b = 0;
       }
       else
       {
           b=b-k;
       }
   }
   else
   {
       a=a-k;
   }
   //b=b-a;
   cout<<a<<" "<<b<<endl;


}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353 ;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
bool in(double A,double B,double C){
	//angle in
	//角度がAとBの間かどうかを調べる
	if(A>B){swap(A,B);}
	return ((A<C&&C<B)==(B-A<pai));
}
double R(double X){return (X>0?X-pai:X+pai);}
int main(void){
	int n,i,j;cin>>n;
	
	//各点について考えるだけでok?
	vector<pair<double,double>>pot(n);
	for(i=0;i<n;i++){cin>>pot[i].fir>>pot[i].sec;}
	bool can=true;
	for(i=1;i<n-1;i++){
		double A=atan2(pot[i-1].fir-pot[i].fir,pot[i-1].sec-pot[i].sec);
		double B=atan2(pot[i+1].fir-pot[i].fir,pot[i+1].sec-pot[i].sec);
		//AとBの間がセーフ
		for(j=0;j<i;j++){
			double C=atan2(pot[j].fir-pot[i].fir,pot[j].sec-pot[i].sec);
			if(in(B,R(A),C)){can=false;break;}
			if(in(A,B,C)){A=C;}
			if(in(A,B,R(C))){B=R(C);}
		}
		for(j=i+1;j<n;j++){
			double C=atan2(pot[j].fir-pot[i].fir,pot[j].sec-pot[i].sec);
			if(in(A,R(B),C)){can=false;break;}
			if(in(A,B,C)){B=C;}
			if(in(A,B,R(C))){A=R(C);}
		}
	}
	cout<<(can?"P":"Imp")<<"ossible\n";
	return 0;
}



Measured memory_bytes: 3476
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, ar[N], ans;
map<int, int> m;

int f2p(int x) {
	for(int i = 0; i <= 30; i++)
		if(x < (1 << i))
			return (1 << i);
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> ar[i];
		m[ar[i]]++;
	}
	sort(ar + 1, ar + n + 1, greater<int>());
	for(int i = 1; i <= n; i++) {
		int t = f2p(ar[i]) - ar[i];
		if(t == ar[i] && m[t] == 1)
			continue;
		if(m[t] && m[ar[i]])
			m[t]--, m[ar[i]]--, ans++;
	}
	cout << ans;
}

Measured memory_bytes: 19840
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#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;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
int main()
{
  int n; cin >> n;
  vector<int> a(n+1);
  rep1(i,n) cin >> a[i];

  int res = 0;
  rep1(i,n) {
    if(i % 2 == 1 && a[i] % 2 == 1) res++;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 3592
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

ans = []

ans.extend(sorted(p,reverse=True)[:x])
ans.extend(sorted(q,reverse=True)[:y])
ans.extend(r)
ans.sort(reverse=True)

print(sum(ans[:x+y]))

Measured memory_bytes: 23328
#include<stdio.h>
int main(void){
	
	int n,a,min=1000000,max=-1000000,i;
	long s=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&a);
		
		s+=a;
		
		if(min>a){
			min=a;
		}
		if(max<a){
			max=a;
		}
	}
	printf("%d %d %ld\n",min,max,s);
	return 0;
}


Measured memory_bytes: 2104
/*
  -> Sayan Bose
  -> Do Good Die Great
*/
#include <bits/stdc++.h>
#define int long long int
#define pii pair<int, int>
#define ff first
#define ss second
#define eb emplace_back
#define pb push_back
#define MOD 1000000007
#define Hiraishin                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr);
#define tests \
    int t;    \
    cin >> t; \
    while (t--)
using namespace std;

int binpow(int a, int b)
{
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = ((res % MOD) * (a % MOD)) % MOD;
        a = ((a % MOD) * (a % MOD)) % MOD;
        b >>= 1;
    }
    return res;
}
 
// Extended Euclid's (a / b) % m = (a * inv(b)) % m
int modInverse(int a)
{
    int m = MOD;
    int m0 = m;
    int y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1) {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}
 
// Euclid's Gcd
int gcd(int a, int b)
{
    int temp = a % b;
    while (temp) {
        a = b;
        temp = a % b;
    }
    return a;
}

// global

 
void solve()
{
    int n;
    cin >> n;
    cout << n + n*n + n*n*n;
}
 
signed main()
{
    Hiraishin
        //tests
        solve();
    return 0;
}

Measured memory_bytes: 3632
#include <complex>
#include <cmath>
#include <iostream>
#include <stdio.h>

using namespace std;
typedef complex<double> xy_t;
xy_t P[110];

int main(){
  int N = 0;
  double x,y ;

  while (~scanf("%lf,%lf", &x, &y)){
    P[N++] = xy_t(x,y);
  }
  double sum = 0.0;
  for (int i=0;i+2<N;++i){
    xy_t a=P[0],b=P[i+1], c= P[i+2];
    sum += (abs((b.real()-a.real())*(c.imag()-a.imag()))-abs((c.real()-a.real())*(b.imag()-a.imag())))/2.0;
  }
  printf("%.6f\n",abs(sum));
  // return 0;
}

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

int main()
{
	ll m,i,j,k,s=0,x=0,y=0,z,a,b,c,g,minn=INT_MIN;
	cin>>n>>m>>a;
	x=max(n,m);
	if(a%x==0) cout<<a/x;
	else cout<<a/x+1;
	
	
}

Measured memory_bytes: 256
N = int(input())
A = []
B = []
C = []
for i in range(N):
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)

dp = [ [0 for _ in range(N)] for i in range(3) ]
flag = ""

dp[0][0] = A[0]
dp[1][0] = B[0]
dp[2][0] = C[0]

for j in range(0, N-1):
    dp[0][j+1] = max([dp[1][j] + A[j+1], dp[2][j] + A[j+1]])  
    dp[1][j+1] = max([dp[0][j] + B[j+1], dp[2][j] + B[j+1]])
    dp[2][j+1] = max([dp[0][j] + C[j+1], dp[1][j] + C[j+1]])  

print( max([dp[0][N-1], dp[1][N-1],dp[2][N-1]]))

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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << (abs(a-c)<=d || ((abs(a-b)<=d)&&(abs(c-b)<=d))?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
//to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

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

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */

int main(void) {

	int a, b;
	cin >> a >> b;
	if (a >= 10) {
		cout << b << rt;
	}
	else {
		cout << b + (100 * (10 - a)) << rt;
	}

	please AC;
}
//参考：---

Measured memory_bytes: 256