akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    if(i!=0) a.at(i)=a.at(i-1)+x;
    else a.at(i)=x;
  }
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    if(i!=0) b.at(i)=b.at(i-1)+x;
    else b.at(i)=x;
  }
  
  int ans=a.at(0)+b.at(n-1);
  
  for(int i=1;i<n;i++){
   ans=max(ans,a.at(i)+b.at(n-1)-b.at(i-1));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int n = sc.nextInt();
int[][] a=new int[2][n+1];
    for (int i = 0; i <2; i++) {
        for (int j = 1;j<=n; j++) {
            a[i][j]=a[i][j-1]+sc.nextInt();
        }
    }
    int ans=0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            ans=max(ans,a[0][i]+(a[1][n]-a[1][i-1]));
        }
    }
    out.println(ans);
}}

Measured memory_bytes: 23764
#include <iostream>
#include <utility>
#include <stdint.h>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
  double a, b, x;
  cin >> a >> b >> x;

  double t = (2*x)/(a*a) - b;
  double theta;
  if (t > 0)
    theta = atan2(b-t,a);
  else {
    double c = (x/a)/b*2;
    theta = M_PI/2. - atan2(c,b);
  }

  cout << setprecision(10) << theta * 180 / M_PI << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

struct UnionFind{
    int sz;     // vertex number
    vector<int> par;
    vector<int> rank;

    UnionFind(int n) : sz(n) {
        par.resize(sz);
        rank.assign(sz, 0);
        for(int i = 0; i < sz; ++i){
            par[i] = i;
        }
    }

    int find(int x){
        if(par[x] == x) return x;
        else    return par[x] = find(par[x]);
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    void unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y)  return;
        if(rank[x] < rank[y])   par[x] = y;
        else{
            par[y] = x;
            if(rank[x] == rank[y])  ++rank[x];
        }
    }
};

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

    int N, M;
    cin >> N >> M;
    UnionFind uf(N);
    for(int i = 0; i < M; ++i){
        int X, Y, Z;
        cin >> X >> Y >> Z;
        uf.unite(X - 1, Y - 1);
    }
    vector<int> v;
    for(int i = 0; i < N; ++i)  v.emplace_back(uf.find(i));
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    cout << v.size() << endl;
}

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

public class Main {
    static int n;
    static boolean[][] map;
    static ArrayList<ArrayList<Integer>> next;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = Math.max(a - 2 * b, 0);
        System.out.println(c);
    }



    private static class FastScanner {
        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: 23124
fun main(args: Array<String>) {
    val (N, X) = readLine()!!.split(" ").map{it.toLong()}

    val t = Array(60) { 0L }
    val p = Array(60) { 0L }

    t[0] = 1
    p[0] = 1
    for (i in 1 until t.size) {
        t[i] = t[i - 1] * 2 + 3
        p[i] = p[i - 1] * 2 + 1
    }

    fun rec(n: Int, x: Long): Long {
        if (t[n] <= x) {
            return p[n]
        }

        if (n == 0) {
            return 0L
        }

        var r = 0L

        if (x < t[n - 1] + 1) {
            r += rec(n - 1, x - 1)
        }

        if (x >= t[n - 1] + 1) {
            r += p[n - 1]
        }

        if (x >= t[n - 1] + 2) {
            r += 1L
        }

        if (x > t[n - 1] + 2) {
            r += rec(n - 1, x - t[n - 1] - 2)
        }

        return r
    }

    println(rec(N.toInt(), X))
}


Measured memory_bytes: 38044
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   int h,w;cin>>h>>w;
   vector<string>s(h);
   rep(i,h)cin>>s[i];
   rep(i,w+2)cout<<'#';
   cout<<endl;
   rep(i,h){
       cout<<'#'<<s[i]<<'#'<<endl;
   }
   rep(i,w+2)cout<<'#';
}



Measured memory_bytes: 256
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,k;
    cin >> n >> k;
    vi a(n);
    cin >> a;
    int ok = 1000000000,ng = 0;
    auto f = [&](int x) {
        ll cnt = 0;
        rep(i,n) cnt += (a[i]+x-1)/x-1;
        return cnt <= k;
    };
    while(abs(ok-ng) > 1) {
        int mid = (ng+ok)/2;
        if(f(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll  long long
#define endl '\n'
#define pi 3.14159265
//seen soln
int main()
{       
    IOS;
    ll n,m;
    cin>>n>>m;
    ll red[n+1]={0};
    ll num[n+1];
    for(ll i=1;i<=n;i++)
    {
    	num[i]=1;
    	red[i]=0;
    }
    red[1]=1;
    for(ll i=1;i<=m;i++)
    {
    	ll x,y;
    	cin>>x>>y;
    	if(red[x])
    		red[y]=1;
    	num[x]--;
    	num[y]++;
    	if(num[x]==0)
    		red[x]=0;
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    	ans+=red[i];
    cout<<ans;
}   

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

int		main(void)
{
	int		n;
	cin >> n;
	string s;
	cin >> s;
	long long	r = 0;
	long long	g = 0;
	long long	b = 0;
	for (int i = 0; i < n; i++){
        if(s[i] == 'R')
            r++;
        if(s[i] == 'G')
            g++;
        if(s[i] == 'B')
            b++;
    }
    long long sum = r * g * b;

	for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            int k = j * 2 - i;
            if (i < k && k < n)
            {
                if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k])
                    sum--;
            }
        }
    }
	cout << sum << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <vector>
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    cout << pow(n, 3) << endl;
    return 0;
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
#define REP3(i,x,n) for(ll i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    IOS;
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> A(n),B(m);
    int temp;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
        if(i>0){
            A[i] += A[i-1];
        }
    }
    for (int j = 0; j < m; j++)
    {
        cin >> B[j];
        if(j>0){
            B[j] += B[j-1];
            
        };
    }
    int ans = 0;
    int l = 0, r = n + m;
    while(l<=r){
        ll mid = (l+r)/2;
        ll mn = 1e15;
        for (int i = 0; i <= min(mid,n); i++)
        {
            int j  = mid -i;
            if(j>m)continue;
            if(i == 0)mn = min(mn,B[j-1]);
            else if(j == 0)mn = min(mn,A[i-1]);
            else mn = min(mn,B[j-1]+A[i-1]);

        }
        if(mn <=k||mid == 0){
            ans = mid;
            l = mid +1;
        }else{
            r = mid-1;
        }
        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6344
//AtCoder ABC131
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    string s;
    cin>>s;
    bool ans = (s[0]==s[1]||s[1]==s[2]||s[2]==s[3]);
    cout<<(ans?"Bad":"Good")<<endl;
    return 0;
}

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

#define array_sort_asc(array,size) sort(array, array+size);
#define array_sort_desc(array,size) sort(array, array+size,greater<>());

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

    cout << pow(n,3) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	int sum = 0;
	if(a < b){
		if (b < c) {
			sum = a + b;
		} else {
			sum = a + c;
		}
	} else {
		if (a < c) {
			sum = a + b;


		} else {
			sum= b + c;
		}
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

//繰り返し二乗法
ll EX(ll x,ll n){
    if(n == 0) return 1;
    else if(n%2 == 1) return EX(x,n-1)*x;
    else return EX(x*x,n/2);
};

//ユークリッドの互除法
ll gcd(ll x,ll y){
    if(x > y) swap(x,y);
    if(x == 0) return y;
    return gcd(x,y%x);
}
//最小公倍数
ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    int cnt2 = 0;
    int tmp = a[0];
    while(tmp%2 == 0){
        if(tmp == 0) break;
        tmp /= 2;
        cnt2++;
    }

    bool end = false;
    for(int i = 0; i < n; i++){
        if(a[i]%EX(2,cnt2) != 0) end = true;
        else if(a[i]%EX(2,cnt2+1) == 0) end = true;
        if(end){
            cout << 0 << endl;
            return 0;
        }
    }
    for(int i = 0; i < n; i++) a[i] /= 2;
    ll x = 1;
    for(int i = 0; i < n; i++){
        x = lcm(x,a[i]);
        if(x > m) break;
    }
    int k = m/x;
    cout << (k+1)/2 << endl;
    return 0;
}

Measured memory_bytes: 4036
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(donuts(n))
}

func donuts(n int) string {
	for i := 0; i < 25; i++ {
		for j := 0; j < 15; j++ {
			if 4*i+7*j == n {
				return "Yes"
			}
		}
	}
	return "No"
}


Measured memory_bytes: 512
n,k=map(int,input().split())
p=list(map(int,input().split()))
a=[None]*(n-k+1)
a[0]=sum(p[0:k])
for i in range(1,n-k+1):
    a[i]=a[i-1]-p[i-1]+p[i+k-1]
b=max(a)
c=(b/2)+(0.5*k)
print(c)

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

using namespace std;

#define int long long

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

typedef pair<int, int> PII;

//--------

int reLu(int a){
    if(a >= 0) return a;
    else return 0;
}

int subete(int num, int count){
    num++;
    int ret = (num / (count * 2)) * count;
    int amari = reLu(num % (count * 2) - count);
    //cout << num << "-" << count << endl;
    //cout << ret << " " << amari << endl;
    return ret + amari;
}

signed main(){  
    int A, B;
    cin >> A >> B;

    if(A == 0){
        cout << B << endl;
        return 0;
    }
    A--;

    int ans = 0;
    int count = 1;
    while(count <= B){
        int b = subete(B, count);
        int a = subete(A, count);

        //cout << a << b << endl;

        int y = (b - a) % 2;

        ans += y * count;

        count = count << 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 300000 + 10, mod = 998244353;
char s[N];
int sum[N][3];
vector<int> v[3],p1[3],p2[3],pp1[3],pp2[3];
int main(){
    int n; scanf("%d%s",&n,s+1);
    for(int i=1;i<=3*n;i++){
        for(int j=0;j<3;j++) sum[i][j] = sum[i-1][j];
        if(s[i]=='R') v[0].push_back(i), sum[i][0]++;
        if(s[i]=='G') v[1].push_back(i), sum[i][1]++;
        if(s[i]=='B') v[2].push_back(i), sum[i][2]++;
    }
    for(int i=0;i<n;i++){
        vector<pair<int,int> > vec;
        vec.push_back({v[0][i],0});
        vec.push_back({v[1][i],1});
        vec.push_back({v[2][i],2});
        sort(vec.begin(),vec.end());
        p1[vec[0].second].push_back(vec[1].first);
        p2[vec[2].second].push_back(vec[1].first);
        pp1[vec[0].second].push_back(vec[0].first);
        pp2[vec[2].second].push_back(vec[2].first);
    }
    ll ans = 1;
    for(int i=0;i<3;i++){
        sort(p1[i].begin(),p1[i].end());
        for(int j=0;j<(int)p1[i].size();j++){
            int num = upper_bound(pp1[i].begin(),pp1[i].end(),p1[i][j]) - pp1[i].begin();
            ans = ans * (num-j) % mod;
        }
    }
    for(int i=0;i<3;i++){
        sort(p2[i].begin(),p2[i].end());
        int cnt = 0;
        for(int j=(int)p2[i].size()-1;j>=0;j--){
            int num = upper_bound(pp2[i].begin(),pp2[i].end(),p2[i][j]) - pp2[i].begin();
            num = pp2[i].size() - num;
            ans = ans * (num-cnt) % mod;
            cnt++;
        }
    }
    for(int i=1;i<=n;i++) ans = ans * i % mod;
    cout<<ans<<endl;
}


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

int main(){
  int N;
  cin>>N;
  vector<long long> V(N);
  int mod=1000000007;
  long long sum=0;
  long long s=0;
  for(int i=0;i<N;i++)
  {
	  cin>>V[i];
	  sum+=V[i];
	  sum%=mod;
  }
  for(int i=0;i<N;i++)
  {
	  sum-=V[i];
	  if(sum<0) sum+=mod;
	  s+=sum*V[i];
	  s%=mod;
  }
  cout<<s%mod<<endl;
}

Measured memory_bytes: 4780
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <iostream>
#include <queue>
#include <cstdlib>
#include <set>
#include <complex>

using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;

typedef complex<double> P;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
    abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}
bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
    cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const L &l, const P &p) {
  return abs(cross(l[1]-p, l[0]-p)) < EPS;
}
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
    ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}
P reflection(const L &l, const P &p) {
  return p + 2.0 * (projection(l, p) - p);
}
double distanceLP(const L &l, const P &p) {
  return abs(p - projection(l, p));
}
double distanceLL(const L &l, const L &m) {
  return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double distanceLS(const L &l, const L &s) {
  if (intersectLS(l, s)) return 0;
  return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}

vector<P> input(int n, int ue){
  vector<P> ret(n + 2);

  REP(i,n){
    const int x = getInt();
    const int y = getInt();
    ret[i + 1] = P(x, y);
  }

  ret[0] = P(0, 1000 * ue);
  ret[n + 1] = P(1000, 1000 * ue);

  return ret;
}

int main(){
  const int n1 = getInt();
  vector<P> p1 = input(n1, 0);
  const int n2 = getInt();
  vector<P> p2 = input(n2, 1);

  double ret = 10000;
  REP(i,n1+1) REP(j,n2+1){
    L s1(p1[i], p1[i + 1]);
    L s2(p2[j], p2[j + 1]);
    ret = min(ret, distanceSS(s1, s2));
  }

  printf("%.9f\n", ret);

  return 0;
}

Measured memory_bytes: 1248
from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  # results = [str(A.count(i))+'\n' for i in range(1, N+1)]
  # print('\n'.join(results))

if __name__ == "__main__":
  resolve()

Measured memory_bytes: 35480
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

ll N;
ll A[100000];
bool zero=false;

int main(){
    cin>>N;
    rep(i,N){
        cin>>A[i];
        if(A[i]==0) zero=true;
    }
    if(zero){
        cout<<0<<endl;
        return 0;
    }

    ll ans=1;
    rep(i,N){
        if(A[i]<=1'000'000'000'000'000'000/ans){
            ans*=A[i];
        }else{
            ans=-1;
            break;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

vector<int> to[100005];
int n;

vector<int> dist;
void dfs(int v, int d = 0, int p = -1) {
    dist[v] = d;
    for(auto u : to[v]) {
        if (u == p) continue;
        dfs(u, d+1, v);
    }
}
vector<int> calcDist(int s) {
    dist = vector<int>(n);
    dfs(s);
    return dist;
}

int main()
{
    int u, v;
    cin >> n >> u >> v;
    u--; v--;
    rep(i,n-1) {
        int a, b;
        cin >> a >> b;
        a --; b --;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    vector<int> distU = calcDist(u);
    vector<int> distV = calcDist(v);
    int ans = 0;
    rep(i, n) {
        if (distU[i] < distV[i])
            chmax(ans, distV[i]);
    }
    cout << ans - 1 << "\n";
    return 0;
}


Measured memory_bytes: 10744
#include <stdio.h>

int main(void) {

	for (;;) {
		int num;
		int nmin;
		int nmax;

		scanf("%d %d %d", &num, &nmin, &nmax);
		if (num == 0 && nmin == 0 && nmax == 0) {
			break;
		}

		int prev;
		int max = 0;
		int i;
		for (i = 1; i <= nmin; i++) {
			scanf("%d", &prev);
		}

		int n;
		for (; i <= nmax + 1; i++) {
			int score;
			scanf("%d", &score);
			int gap = prev - score;

			if (max <= gap) {
				max = gap;
				n = i - 1;
			}

			prev = score;
		}
		for (; i <= num; i++) {
			int score;
			scanf("%d", &score);
		}

		printf("%d\n", n);
	}
	return 0;
}

Measured memory_bytes: 2724
import numpy

n,m,q=map(int,input().split())
M=[]
Q=[]
for i in range(m):
    M.append(list(map(int,input().split())))
for i in range(q):
    Q.append(list(map(int,input().split())))

#print(M)
#print(Q)

A=[[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
    A[M[i][0]][M[i][1]]+=1

#B=[[0 for i in range(n+1)] for j in range(n+1)] #Aの累積和のリスト

#B[0][0]=A[0][0]
#for i in range(1,n+1):
#    B[i][0]=A[i][0]+B[i-1][0]
#    B[0][i]=A[0][i]+B[0][i-1]

#for i in range(1,n+1):
#    for j in range(1,n+1):
#        B[i][j]=A[i][j]+B[i-1][j]+B[i][j-1]

#print(A)
#print(B)

A = numpy.cumsum(A,axis=0)
A = numpy.cumsum(A,axis=1)
#A.cumsum(axis=0)
#A.cumsum(axis=1)
#C=A
#print(C)

for i in range(q):
    lem1=Q[i][0]-1
    ri=Q[i][1]
    print(A[ri][ri]-A[ri][lem1]-A[lem1][ri]+A[lem1][lem1])


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 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; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 




int main() {
char a, b;
cin >> a >> b;

if(a == b) print("H");
else print("D");
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = list(readline().rstrip().decode())
t = list(readline().rstrip().decode())
s.sort()
t.sort(reverse=True)
for ss, tt in zip(s, t):
    if ss < tt:
        print('Yes')
        exit()
    if ss > tt:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define For( i, j, k ) for( int i = j; i <= k; ++i ) 
using std::cin;
using std::cout;
using std::pair;
const int N = 3e5 + 1;
int n, m, SC1[ N ], SC2[ N ];
pair < int, int > p[ N ];
bool cmp( pair < int, int > p1, pair < int, int > p2 ) { return p1.second - p1.first < p2.second - p2.first; }
void Add( int x )
{
 while( x <= n )
  ++SC2[ x ],
  x += x & -x;
 return;
}
void Sub( int x )
{
 while( x <= n )
  --SC2[ x ],
  x += x & -x;
 return;
}
int Sum( int x )
{
 int res = 0;
 while( x )
  res += SC2[ x ],
  x -= x & -x;
 return res;
}
int main( )
{
 std::ios::sync_with_stdio( false );
 cin >> m >> n;
 For( i, 1, m )
  cin >> p[ i ].first >> p[ i ].second;
 std::sort( p + 1, p + 1 + m, cmp );
 For( i, 1, m )
  SC1[ p[ i ].second - p[ i ].first + 1 ]++;
 for( int i = n - 1; i; --i )
  SC1[ i ] += SC1[ i + 1 ];
 int cur = 1, ans = 0;
 For( d, 1, n )
 {
  ans = SC1[ d ];
  for( int i = d; i <= n; i += d )
   ans += Sum( i );
  cout << ans << '\n';
  while( cur <= m && p[ cur ].second - p[ cur ].first + 1 == d )
  {
   Add( p[ cur ].first );
   Sub( p[ cur ].second + 1 );
   cur++;
  }
 }
 return 0;
}

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

long long gcd(long x, long y)
{    if (y == 0)
        return x;
    return gcd(y, x % y);}
long long lcm(long x, long y){ return x * y / gcd(x, y);}


int main()
{
    int N,A[110]={},odd=1,ans=1,zcnt=0;
    cin>>N;


    for(int i=1;i<=N;i++){
        ans*=3;

        cin>>A[i];
    
        if(A[i]%2==0){
            odd*=2;
        }
    }

    cout<<ans-odd<<endl;

    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n, k; cin >> n >> k;
    vi p(n); 
    vi ok(n, 0), sum(n, 0);
    ok[0] = 1;
    rep(i, n) {
        cin >> p[i];
        if(i > 0) {
            ok[i] = (p[i] > p[i-1]);
            sum[i] = sum[i-1] + ok[i];
        }
    }
    
    vector<bool> sp(n, false);
    int spc = 0;
    rep(i, n - k + 1){
        if(sum[i+k-1] - sum[i] == k-1) {
            sp[i] = true;
            spc++;
        }
    }
    
    int ans = n - k + 1;
    if(spc > 1) ans -= (spc - 1);
    
    set<P> st;
    rep(i, k+1) st.insert({p[i], i});
    /*
    for(auto [v, id] : st){
        cout << v << "," << id << " | "; 
    }        
    cout << endl;
    */        
    rep(i, n - k){
        auto itl = st.begin();
        auto itr = st.rbegin();
        if(!sp[i] && itl->se == i && itr->se == i+k){
            // cout << i << " " << itl->se << " " << itr->se << endl;
            ans--;
        }
        st.erase(st.find({p[i], i}));
        st.insert({p[i+k+1], i+k+1});
    }
    
    cout << ans << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 15076
#include <stdio.h>
int main(void){
    // Your code here!
    int A,B;
    
    scanf("%d%d",&A,&B);
    
    if(A == B){
        printf("Draw\n");
    }
    else if(A == 1){
        printf("Alice\n");   
    }
    else if(B == 1){
        printf("Bob\n");
    }
    else if(A > B){
        printf("Alice\n");
    }
    else{
        printf("Bob\n");
    }
    
    
    
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
typedef long long ll;
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 (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    int N; cin >> N;
    priority_queue<double, vector<double>, greater<double>> que;
    rep(i, N) {
        double v; cin >> v;
        que.push(v);
    }
    while (que.size() > 1) {
        double x = que.top(); que.pop();
        x = (x + que.top()) / 2.0; que.pop();
        que.push(x);
    }
    printf("%.16f\n", que.top());
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;


int main(){
	string s,t;
    cin>>s>>t;
    REP(i,SZ(t)){
    printf("%c",t[i]);
    }
    REP(i,SZ(s)){
        printf("%c",s[i]);
    }
    printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int x, ans;
int main()
{
    int n; 
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> x;
        if(i % 2 == 1 && x % 2 == 1){
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3564
#include<iostream>
using namespace std;using ll=long long;ll n,k,a=0,i,j,m=1e9+7,v[2<<20];ll f(ll k){return(k*(k+1)/2)%m;}main(){cin>>n>>k;for(i=0;i<n;i++)cin>>v[i];for(i=0;i<n;i++)for(j=0;j<n;j++){if(i==j)continue;if(v[i]>v[j]){if(i<j)a+=k;(a+=f(k-1))%=m;}}cout<<a<<endl;}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int zekken[123];
int main(){
	int num, student;
	scanf("%d%d", &student, &num);
	for (int a = 0; a < student; a++){
		scanf("%d", &zekken[a]);
	}
	for (int a = 1; a <= num; a++){
		for (int b = 1; b < student; b++){
			if (zekken[b - 1] % a > zekken[b] % a){
				swap(zekken[b - 1], zekken[b]);
			}
		}
	}
	for (int a = 0; a < student; a++){
		printf("%d\n", zekken[a]);
	}
	return 0;
}

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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

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

    set<int> nums;
    nums.insert(A);
    nums.insert(B);
    nums.insert(C);
    
    if (nums.size()==2) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int totalCost = 0;
    rep(i, m) {
        cin >> a[i];
        totalCost += a[i];
    }

    if (totalCost > n) cout << "-1" << endl;
    else cout << n - totalCost << endl;

    return 0;
}

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

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

    vector<ll> A(N);
    ALLIN1_NUMBER(A);
    sort(ALL(A),greater<ll>());

    priority_queue<ll> circle_pri;
    circle_pri.push(A[0]);

    ll ans = 0;

    for(ll i=1;i<N;i++)
    {
        ans += circle_pri.top();
        circle_pri.pop();
        circle_pri.push(A[i]);
        circle_pri.push(A[i]);
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){
    int n, m, hold;
    cin >> n >> m;

    vector<int> c;

    for(int i = 0; i < m; i++){
        cin >> hold;
        c.push_back(hold);
    }
    sort(c.begin(),c.end());

    vector<int> dp(n+1,100000);

    dp[0] = 0;

    for(int i = 0; i < m; i++){
        for(int j = 1; j <= n; j++){
            if(j >= c[i]){
                dp[j] = min(dp[j-c[i]] + 1, dp[j]);
            }
        }
    }
    cout << dp[n] << "\n";
}



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

int main()
{
    int a,b;
    cin >> a >> b;
    if (a + b == 15)
        cout << "+" << endl;
    else if (a * b == 15)
        cout << "*" << endl;
    else
        cout << "x" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;



public class Test
{
	public static void Main()
	{
//		while(true){
		  string[] str1 = Console.ReadLine().Split(' ');
		  int n = int.Parse(str1[0]); 
		  int m = int.Parse(str1[1]); 

//		  if(n == 0) break;
		
		  int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
//		  string ss = Console.ReadLine();
//		  int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
//		  int[] c = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(s => int.Parse(s)));
		  //Console.WriteLine("改行あり N = {0} P = {1} Ai = {2}", n, p, a);
		  
		  if(n>=m) {
			Console.WriteLine("0");
		  }else{
		  
		    Array.Sort(a);
		    int[] d = new int[m-1];
		    for(int i=0; i<m-1; i++){
		      d[i]=(a[i+1]-a[i]);
		    }
		    Array.Sort(d);
		    int aa = a[m-1]-a[0];
		    for(int i=0; i<n-1; i++){
		      aa -= d[d.Length-1-i];
		    }
		  
		    Console.WriteLine(aa);
		  }
//	    }


	}

  public static int calc(int n,int m,int[] a,int[] b,int[] c) {



	  return 0;
  }
  
  


}


Measured memory_bytes: 16992
using System;
using System.IO;

class Solve
{
    static void Main(string[] args) {
        var S = Console.ReadLine();
        var len = S.Length;
        long answer = 0;
        for (int bit = 0; bit < 1 << len - 1; bit++) {
            long temp = S[0] - '0';
            for (int i = 0; i < len - 1; i++) {
                if ((bit & (1 << i)) > 0) {
                    answer += temp;
                    temp = 0;
                }
                temp = temp * 10 + S[i + 1] - '0';
            }
            answer += temp;
        }
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}


Measured memory_bytes: 25908
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <deque>
using namespace std;

int main() {
    //input
    long x , y; cin >> x >> y;
    long cal = 0;
    long xm, ym;
    xm = -1 * x;
    ym = -1 * y;


    //compute
    if(x <= y){
        cal = min(abs(y - x),abs(y - xm)+ 1);
        cal = min(cal,abs(ym - x)+ 1);
        cal = min(cal,abs(ym - xm)+ 2);
    }else{
        cal = min(abs(y - xm)+ 1,abs(ym - x)+ 1);
        cal = min(cal,abs(ym - xm)+ 2);        
    }

    //output
    cout << cal << endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  int N, K; cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(N));
  rep(i, K){
    cin >> d.at(i);
    rep(j, d.at(i)) cin >> A.at(i).at(j);
  }
  vector<int> sunuke(N);
  rep(i, K){
    rep(j, d.at(i)){
      sunuke.at(A.at(i).at(j)-1) = 1;
    }
  }
  int sum = 0;
  rep(i, N) sum += sunuke.at(i);
  cout << N-sum << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int N, M;
bool match = false;
char picA[50][51], picB[50][51];

void pfind(int sx,int sy) {
	for (int i = 0; i <M ; i++) {
		for (int j = 0; j < M; j++) {
			if (picB[i][j] != picA[i+sy][j+sx]) return;
		}
	}
	match = true;
	return;
}

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

	for (int i = 0; i < N; i++) {
		string str;
		cin >> str;
		for (int j = 0; j < N; j++) picA[i][j]=str[j];
	}

	for (int i = 0; i < M; i++) {
		string str;
		cin >> str; 
		for (int j = 0; j < M; j++) picB[i][j]=str[j];
	}

	for (int i = 0; i <= N - M; i++) {
		for (int j = 0; j <= N - M; j++) {
			pfind(j,i);
			if (match)break;
		}
		if (match)break;
	}

	if (match)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let s = scan!();
    let vs = s.split(' ').collect::<Vec<_>>();
    println!(
        "{}",
        if vs[1] == "+" {
            vs[0].parse::<i64>().unwrap() + vs[2].parse::<i64>().unwrap()
        } else {
            vs[0].parse::<i64>().unwrap() - vs[2].parse::<i64>().unwrap()
        }
    );
}


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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  char c;cin>>c;
  c++;
  cout << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <utility>
#include <set>
 
#define rep(i, n) for(int i = 0; i < n; i++)
#define lli long long int
 
using namespace std;
 
int main() {
  
  string n;

  while (1) {

    cin >> n;

    if (n == "0") {
      break;
    }

    int ans = 0;
    rep(i, n.size()) {
      ans += (int)n[i] - 48;
    }

    cout << ans << endl;

  }
  return 0;
}



Measured memory_bytes: 3176
# https://atcoder.jp/contests/abc117/tasks/abc117_d
N, upper_bit = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
beki_ary = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888]
already_min = false

ans = 0
39.step(0, -1) do |digest|
  mask = 1 << digest
  ones = A.count { |str| (str & mask) > 0 }
  if ones * 2 >= N
    already_min = true if upper_bit[digest] == 1
    ans += beki_ary[digest] * ones
  else
    if already_min || (upper_bit[digest] == 1)
      ans += beki_ary[digest] * (N - ones)
    else
      ans += beki_ary[digest] * ones
    end
  end
end
p ans


Measured memory_bytes: 8844
def judge(stock, require):
	for i in range(0, len(stock)):
		if stock[i] < require[i]:
			return 'No'
	return 'Yes'

while True:
	inpt = map(int, raw_input().split())
	if inpt[0] == 0:
		break
	else:
		n = inpt[0]
		k = inpt[1]
		stock = map(int, raw_input().split())
		require = []
		for i in range(0, k):
			require.append(0)

		for i in range(0, n):
			blood = map(int, raw_input().split())
			for j in range(0, k):
				require[j] += blood[j]

		print judge(stock, require)

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

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


int main(void) {
	string s; cin >> s;
	int ans = 0;
	for(auto u : s) if (u == 'o') ans++;
	printf("%d\n", 700 + 100 * ans);
	return 0;
}

Measured memory_bytes: 256