akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;
using ll = long long;

int n;
vector<ll>a;
vector<ll>rui;

bool cond(int md)
{
	ll slime = rui[md + 1];
	bool flag = true;
	for (int ind = md + 1; ind < n; ++ind)
	{
		if (slime + slime < a[ind])
		{
			flag = false;
			break;
		}
		slime += a[ind];
	}
	return flag;
}
int main(void)
{
	cin >> n;
	a.reserve(n);
	for (int i = 0; i < n; ++i)
	{
		ll aa; cin >> aa; a.push_back(aa);
	}
	sort(a.begin(), a.end());
	rui.reserve(n + 1);
	rui.push_back(0);
	for (const int &aa : a)rui.push_back(rui.back() + aa);
	int up = n - 1;
	int dn = 0;
	if (cond(dn))
	{
		cout << n << endl; return 0;
	}
	while (dn + 1 < up)
	{
		int md = (up + dn) / 2;
		
		if (cond(md))
		{
			up = md;
		}
		else
		{
			dn = md;
		}
	}
	cout << n - up << endl;
	return 0;
}


Measured memory_bytes: 1792
class AC:
    @staticmethod
    def inputStr(char):
        return input().split(char)
    
    @staticmethod
    def inputInt(char):
        a = input().split(char)
        for i in range(len(a)):
            a[i] = int(a[i])
        return a

inp = AC.inputStr(" ")
print(inp[1]+inp[0])

Measured memory_bytes: 38256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n,m;
	int a[5],b[5],res[3]={0};
	cin>>n>>m;
	if(n==1&&m==0){
		cout<<"0";
		return 0;
	}
	int flag=0,flag2=0;
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		if(n!=1&&a[i]==1&&b[i]==0)
			flag=1;
		if(n==1&&b[i]==0)
			flag2=1;
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<m;j++){
			if(a[i]==a[j]){
				if(b[i]==b[j])
					continue;
				else
					flag=1;
			}
		}
	}
	if(flag)
		cout<<"-1";
	else if(flag2)
		cout<<'0';
	else{
		for(int i=0;i<m;i++){
			res[a[i]-1]=b[i];
		}
		if(res[0]==0)
			res[0]=1;
		for(int i=0;i<n;i++)
			cout<<res[i];
		
	}
	return 0;
}

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

int main()
{
	int n;

	cin >> n;

	while (n > 0) {
		int p = 0, d = 0;

		for (int i = 0; i < n; i++) {
			int d1, d2, pk;

			cin >> pk >> d1 >> d2;

			if (d1 + d2 > d) {
				p = pk;
				d = d1 + d2;
			}
		}

		cout << p << " " << d << endl;
		cin >> n;
	}
	
	return 0;
}



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

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

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

  if (x >= a && x <= a + b) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  string s, t;
  bool ans = true;
  cin >> s;
  cin >> t;
  REP(i, s.size()){
    if(s[i] != t[i]){
      ans = false;
    }
  }

  if(t.size() != s.size() + 1) ans = false;

  if( ans == true) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	bool ch=false;
	for(ll i=0;i<3;i++){
		if(s[i]-'0'==7){
			ch=true;
		}
	}
	if(ch){
		cout <<"Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=305,INF=1<<25;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        string S;cin>>S;
        if(S=="#") break;
        int N=S.size();
        vector<string> SE;
        vector<int> deta(28);
        
        for(int bit=0;bit<(1<<N);bit++){
            bool ok=true;
            string T=S;
            for(int i=0;i<N;i++){
                if(bit&(1<<i)){
                    T[i]++;
                }
            }
            for(int i=0;i<28;i++) deta[i]=0;
            
            for(int i=0;i<N;i++){
                if(T[i]=='a') continue;
                if(T[i]=='{'){
                    ok=false;
                    break;
                }
                if(deta[T[i]-'a']==0){
                    if(T[i]==S[i]){
                        ok=false;
                        break;
                    }else{
                        deta[T[i]-'a']++;
                    }
                }else{
                    if(T[i]!=S[i]){
                        ok=false;
                        break;
                    }
                }
            }
            
            if(ok) SE.push_back(T);
        }
        sort(all(SE));
        
        cout<<SE.size()<<endl;
        if(SE.size()<=10){
            for(int i=0;i<SE.size();i++) cout<<SE[i]<<endl;
        }else{
            for(int i=0;i<5;i++) cout<<SE[i]<<endl;
            for(int i=SE.size()-5;i<SE.size();i++) cout<<SE[i]<<endl;
        }
        
    }
}





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

int main() {
    int N;
    cin >> N;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i*j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Main {
	public static final void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String line = scanner.nextLine();
		Map<String, Long> count = Arrays.stream(line.split("")).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
		System.out.println(count.getOrDefault("+", 0L) -count.getOrDefault("-", 0L));
	}
}


Measured memory_bytes: 36200
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)



signed main(){
	int A,B;
	cin>>A>>B;
	if(A>=13){
		cout<<B<<endl;
	}
	else if(A>=6){
		cout<<B/2<<endl;
	}
	else{
		cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc051/tasks/abc051_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int k, s, cnt = 0;

  cin >> k >> s;

  REP(i, k + 1)
  {
    if (s < i)
      break;
    REP(j, k + 1)
    {
      if (s - k <= i + j && i + j <= s)
        cnt++;
    }
  }

  cout << cnt << '\n';

  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		//Ae2+Be2=Ce2
		
		int N=sc.nextInt();
		String S=sc.next();
		//W 87 || //E 69 || 
		int ew[][]=new int[2][N];
		char a[]=S.toCharArray();
		
		for(int i=0;i<N;i++) {
			if(a[i]==87) {
				if(i==0) {
					ew[0][i]=1;
					ew[1][i]=0;
				}else {
				ew[0][i]=ew[0][i-1]+1;
				ew[1][i]=ew[1][i-1];
				}
			}else {
				if(i==0) {
					ew[0][i]=0;
					ew[1][i]=1;
					
				}else {
				ew[0][i]=ew[0][i-1];
				ew[1][i]=ew[1][i-1]+1;
				}
			}
		}
		int ans=100000009;
		for(int i=0;i<N;i++) {
			if(i==0) {
				ans=ew[1][N-1]-ew[1][0];
				continue;
			}
			ans=Math.min(ans, (ew[0][i-1]+ew[1][N-1]-ew[1][i]));
			
		}
		
		p(ans);
		
		
		}
		
		
	
	
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 33220
function main(input) {
    var a = input[0].split(" ")[0]-0;
    var b = input[0].split(" ")[1]-0;
    console.log(!(a>8||b>8)?"Yay!":":(");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7372
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	char c;
	scanf("%c",&c);
	puts(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'?"vowel":"consonant");
}

Measured memory_bytes: 128
/*
 * written by Yaqi Zhang (zhang623@wisc.edu)
 * University of Wisconsin-Madison
 * 2020
 */
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> nums(n);
    for(int i = 0; i < n; ++i) cin >> nums[i];
    int total = accumulate(nums.begin(), nums.end(), 0);
    int mn = total;
    int left = 0;
    for(int num : nums) {
        left += num;
        int cur = abs(left - (total - left));
        mn = min(mn, cur);
    }
    cout << mn << endl;
    return 0;
    
}



Measured memory_bytes: 256
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;

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

    vector<int> h(n);

    for(int i = 0; i < n; ++i)
        cin >> h[i];

    vector<ll> cnt(n);
    cnt[n - 1] = 0;

    ll out = 0;
    for(int i = n - 2; i >= 0; --i) {
        if(h[i] < h[i + 1])
            continue;

        cnt[i] += cnt[i + 1] + 1;
        out = max(out, cnt[i]);
    }

    cout << out << endl;

    return 0;
}


Measured memory_bytes: 1408
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debugg cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll n,m,x,y,ans;
void solve()
{
    ll x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    ll diff1=x2-x1,diff2=y2-y1;
    cout<<x2-diff2<<" "<<y2+diff1<<" "<<x1-diff2<<" "<<y1+diff1<<endl;
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}


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

int main(){
  int N;
  cin >>N;
  
  double A;
  double sum = 0.0;
  rep(i,0,N){
    cin >> A;
    sum += 1.0/A;
  }
  
  double ans = 1/sum;
  cout <<ans<<endl;
}

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

int main( void ) {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if( x + r <= w && x - r >= 0 && y + r <= h && y - r >= 0 ) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[2];
    rep(i,2){
        cin >> A[i];
    }
    cout << (A[0]%A[1]==0? 0 : 1) << endl;
}

Measured memory_bytes: 504
import           Data.List

-- task-scheduling-problem.hs ---

-- author: Seong Yong-ju <sei40kr@gmail.com>

solve ::[Int] ->Int
solve [a1, a2, a3] = (sum . take 2 . sort) ds
  where
    ds = [abs $ a1 - a2, abs $ a2 - a3, abs $ a3 - a1]

main :: IO ()
main = do
  as <- map (read :: String -> Int) . take 3 . words <$> getLine
  print $ solve as


Measured memory_bytes: 508
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()
n=I()
lis=["".join(sorted(list(input().rstrip()))) for i in range(n)]
c=Counter(lis)
#print(c)
ans=0
for j in c:
    ans+=(c[j]*(c[j]-1))//2
print(ans)

Measured memory_bytes: 19848
import Data.List

main = do
  str <- getLine
  let [n, m] = map read (words str) ::[Int]
  str <- getLine
  let a = take n $ map read (words str) ::[Int]
  let a' = reverse $ sort a
  let dt =  filter (>= ceiling ((fromIntegral (sum a) ::Float) / (fromIntegral (4*m) ::Float))) a'
  if length dt >= m
    then putStrLn "Yes"
    else putStrLn "No"

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A, B;
    cin >> A >> B;
    const int h = 100, w = 100;
    cout << h << ' ' << w << endl;
    vector<vector<char>> field(h, vector<char>(w));
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++) {
            if(i < 50) field[i][j] = '#';
            else field[i][j] = '.';
        }
    }
    A--;
    B--;
    while(A > 0){
        for(int i = 1; i < 49; i += 2){
            if(A == 0) break;
            for(int j = 1; j < w - 1; j++){
                if(A == 0) break;
                if(j % 2 == 1) {
                    field[i][j] =  '.';
                    A--;
                }
            }
        }
    }
    while(B > 0){
        for(int i = 51; i < h - 1; i += 2){
            if(B == 0) break;
            for(int j = 1; j < w - 1; j++){
                if(B == 0) break;
                if(j % 2 == 1) {
                    field[i][j] = '#';
                    B--;
                }
            }
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << field[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll h, w;
  cin >> h >> w;
  if (h == 1 || w == 1) {
    cout << 1 << endl;
    return 0;
  }
  ll ans = ((w + 1) / 2) * ((h + 1) / 2) + (w / 2) * (h / 2);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}


const int inf = 1000000000;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	vector<vector<int>> g(n,vector<int>(n,inf));
	vector<int> a(m),b(m),c(m);
	rep(i,m){
		cin >> a.at(i) >> b.at(i) >> c.at(i);
		a.at(i)--;
		b.at(i)--;
		g[a.at(i)][b.at(i)] = c.at(i);
		g[b.at(i)][a.at(i)] = c.at(i);
	}
	vector<vector<int>> dist = g;
	rep(k,n){
		rep(i,n){
			rep(j,n){
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	int ans = 0;
	rep(i,m){
		if(g[a.at(i)][b.at(i)] != dist[a.at(i)][b.at(i)]) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <climits>
#include <cmath>
#include <utility>
#include <vector>
#include <string>

using namespace std;

class Tree
{
private:
  struct Node
  {
    int id;
    int parent;
    vector<int> children;
  };
public:
  int size;
  vector<Node> nodes;
  Tree(int n)
  {
    size = n;
    nodes.resize(n);
    for(int i = 0; i < n; i++)
    {
      nodes[i].id = i;
      nodes[i].parent = i;
    }
  }
  void addChild(int id,int x)
  {
    nodes[id].children.push_back(x);
    nodes[x].parent = id;
  }
  bool isRoot(int id)
  {
    return id == nodes[id].parent;
  }
  int depth(int id)
  {
    int x = id;
    int cnt = 0;
    while(x != nodes[x].parent)
    {
      x = nodes[x].parent;
      cnt++;
    }
    return cnt;
  }
  char* printType(int id)
  {
    if(id == nodes[id].parent)
      return (char *)"root";
    else if(nodes[id].children.size() == 0)
      return (char *)"leaf";
    else return (char *)"internal node";
  }
  void printInfo(int id)
  {
    printf("node %d: ",id);
    printf("parent = %d, ",isRoot(id)?-1:nodes[id].parent);
    printf("depth = %d, ",depth(id));
    printf("%s, ", printType(id));
    printf("[");
    for(int i = 0; i < nodes[id].children.size(); i++)
    {
      printf("%d",nodes[id].children[i]);
      if(i != nodes[id].children.size()-1)
        printf(", ");
    }
    printf("]\n");
  }
};

int main()
{
  int n;
  cin >> n;
  Tree tree(n);
  for(int i = 0; i < n; i++)
  {
    int id, k;
    cin >> id >> k;
    for(int j = 0; j < k; j++)
    {
      int child;
      cin >> child;
      tree.addChild(id,child);
    }
  }
  for(int i = 0; i < n; i++) tree.printInfo(i);
  return 0;
}

Measured memory_bytes: 4964
#include<stdio.h>

int main(void) 
{
	int n;
	int a[100];
	int i, j;
	int max, num;
	int* pnum;
	int alice = 0;
	int bob = 0;

	//入力部分　始まり
	scanf("%d", &n);

	for ( i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	//入力部分　終わり

	//処理部分　始まり
	for (i = 0; i < n; i++)
	{
		max = 0;
		num = 0;
		pnum = &num; //pnumはnumのアドレス

		for (j = 0; j < n; j++)
		{
			if (max < a[j])//参照した値がmaxより大きい場合
			{
				max = a[j];//maxを参照した値に置き換える
				*pnum = j; //ifの外にあるnumに値を返したいのでポインタを使う

			}

			if (j == n - 1) //n番目まで比較したら一番大きい要素の中身を0に変える
			{
				a[num] = 0;
			}
			
		}

		//1回おきにAliceとBobに代入
		if (i % 2 == 0)
		{
			alice += max;
		}
		else
		{
			bob += max;
		}
		
	}
	//処理部分終わり

	printf("%d", alice - bob);

	return 0;
}

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

int main(void) {
	const char* target = "E869120";
	int N;
	int mizuhasu = 0;
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		char S[128];
		if (scanf("%127s", S) != 1) return 1;
		if (strcmp(S, target) == 0) mizuhasu++;
	}
	printf("%d\n", mizuhasu);
	return 0;
}



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

#define LL long long

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	string s1,s2;
	LL res = 0;
	cin >> s1 >> s2;
	for (LL i = 0; i < s1.size(); i++)
		if (s1[i] == s2[i])
			res++;
	cout << res << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1e9+7;
const int INF=1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin>>n;
    int x[n];
    for(int i=0;i<n;++i){
        cin>>x[i];
    }
    ll ans=LINF;
    for(int i=1;i<=100;++i){
        ll tmp=0;
        for(int j=0;j<n;++j){
            tmp+=(x[j]-i)*(x[j]-i);
        }
        ans=min(tmp,ans);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
var
	x,i,j,l,r,t:Longint;
begin
	writeln(3870);
	writeln('+ 0 1 3');
	writeln('< 2 3 3');
	for x:=0 to 1 do begin
		writeln('+ 3 ',x,' ',x);
		for i:=0 to 29 do begin
			if i>0 then writeln('+ ',x+4,' ',x+4,' ',x+4);
			writeln('+ ',x+4,' 3 6');
			for j:=i to 28 do writeln('+ 6 6 6');
			writeln('< 6 ',x,' ',i+7+x*30);
			writeln('+ ',x+4,' ',i+7+x*30,' ',x+4);
		end;
	end;
	for t:=0 to 58 do begin
		if t>0 then writeln('+ 2 2 2');
		l:=t-29;
		if l<0 then l:=0;
		r:=29;
		if r>t then r:=t;
		for i:=l to r do begin
			writeln('+ ',i+7,' ',t-i+37,' 4');
			writeln('< 3 4 4');
			writeln('+ 2 4 2');
		end;
	end;
end.

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


void pri(int y,char c){
  for(int i=0;i<y;i++)
    cout<<c;
}

int main(void){
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;

  int x = tx-sx;
  int y = ty-sy;

  pri(y,'U');
  pri(x,'R');
  pri(y,'D');
  pri(x+1,'L');
  pri(y+1,'U');
  pri(x+1,'R');
  cout<<'D';
  cout<<'R';
  pri(y+1,'D');
  pri(x+1,'L');
  cout<<'U'<<endl;

  return 0;
}

Measured memory_bytes: 256
from collections import deque
h,w = map(int,input().split())
sq = [list(input()) for i in range(h)]
prt = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    c = i + j
    if sq[i][j] == "#":
      c += 1
    prt[i][j] = c%2
que = deque([])
ans = 0
visited = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if visited[i][j] != 1:
      que.append((i,j))
      cnt = 0
      cntb = 0
      while que:
        x,y = que.popleft()
        if visited[x][y] != 1:
          cnt += 1
          if sq[x][y] == "#":
            cntb += 1
          visited[x][y] = 1
          for n_x,n_y in ((x+1,y),(x-1,y),(x,y+1),(x,y-1)):
            if 0<=n_x<h and 0<=n_y<w:
              if visited[n_x][n_y] != 1 and prt[n_x][n_y] == prt[x][y]:
                que.append((n_x,n_y))
      ans += cntb*(cnt-cntb)

print(ans)


Measured memory_bytes: 7404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

ll INF=1000000000;

int main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> cost(M);
    vector<ll> S(M,0);
    vector<bool> can(N,false);
    rep(i,M){
        int a,b;
        cin >> a >> b;
        cost[i]=a;
        rep(j,b){
            int c;
            cin >> c;
            c--;
            S[i]|=(1<<c);
            can[c]=true;
        }
    }
    bool d=false;
    rep(i,N){
        if (!can[i]){
            d=true;
        }
    }
    if (d){
        cout << -1 << endl;
    }
    else {
        vector<ll> dp(1<<N,INF);
        dp[(1<<N)-1]=0;
        for (int bit=(1<<N)-2;bit>=0;bit--){
            rep(j,M){
                rep(k,N){
                    if (!(bit&(1<<k))&&S[j]&(1<<k)){
                        dp[bit]=min(dp[bit],dp[bit|S[j]]+cost[j]);
                        }
                }
            }
        }
        cout << dp[0] << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y sevcond
#define pb emplace_back
#define eb pb
#define rep(X,Y) for(int X=0;X<(Y);++X)
#define reps(X,O,Y) for(int X=(O);X<(Y);++X)
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
using ll=long long;
const ll INF=1e18;

int main(){
	int n;
	cin>>n;
	vector<int> xs(n);
	using Graph=vector<vector<int>>;
	Graph g(n);
	rep(i,n) cin>>xs[i];
	int t;
	{
		ll s=accumulate(all(xs),0ll);
		rep(i,n) xs[i]-=s/n;
		t=s%n;
	}
	rep(i,n-1){
		int x,y;
		cin>>x>>y; --x; --y;
		g[x].pb(y);
		g[y].pb(x);
	}
	vector<ll> sum(n),sz(n);
	{
		function<void(int,int)> dfs=
			[&](int v,int p){
				++sz[v]; sum[v]+=xs[v];
				for(int w:g[v])if(w!=p){
						dfs(w,v);
						sum[v]+=sum[w];
						sz[v]+=sz[v];
					}
			};
		dfs(0,-1);
	}
	vector<vector<ll>> dp(n);
	function<void(int,int)> dfs=
		[&](int v,int p){
			dp[v].pb(0);
			for(int w:g[v])if(w!=p){
					dfs(w,v);
					auto tmp=dp[v];
					dp[v].clear();
					dp[v].resize(tmp.size()+dp[w].size(),INF);
					rep(i,tmp.size())rep(j,dp[w].size()){
						dp[v][i+j]=min(dp[v][i+j],tmp[i]+dp[w][j]+abs(j-sum[w]));
						dp[v][i+j+1]=min(dp[v][i+j+1],tmp[i]+dp[w][j]+abs(j+1-sum[w]));
					}
				}
		};
	dfs(0,-1);
	// rep(i,n){
	// 	cout<<i<<endl;
	// 	for(auto x:dp[i]) cout<<x<<",";cout<<endl;
	// }
	cout<<min(dp[0][t],dp[0][max(0,t-1)])<<endl;
}



Measured memory_bytes: 101832
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    int k;
    cin >> k;
    int ans = abs(k-x);
    for (int i = 0; i < n-1; ++i) {
        int j;
        cin >> j;
        ans = __gcd(abs(j-k), ans);
        k = j;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y, int m) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y, int m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, a[200010], b[200010];
queue<int> que;
int ans;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++)cin >> b[i];
	for (int i = 0; i < n; i++) {
		if (b[(i - 1 + n) % n] + b[(i + 1) % n] <= b[i])que.push(i);
	}
	while (!que.empty()) {
		int p = que.front(); que.pop();
		int x = b[(p - 1 + n) % n] + b[(p + 1) % n];
		int s = b[p] % x;
		if (s < a[p]) {
			if ((b[p] - a[p]) % x) {
				cout << -1 << endl;
				return 0;
			}
			ans += (b[p] - a[p]) / x;
			b[p] = a[p];
		}
		else {
			ans += b[p] / x;
			b[p] = s;
		}
		if (b[(p - 2 + n) % n] + b[p] <= b[(p - 1 + n) % n])que.push((p - 1 + n) % n);
		if (b[p] + b[(p + 2) % n] <= b[(p + 1) % n])que.push((p + 1) % n);
	}
	for (int i = 0; i < n; i++)if (a[i] != b[i]) {
		cout << -1 << endl;
		return 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4224
#include <stdio.h>
int main(){
  int N;
  int Ap[100000];
  int Am[100000];
  int A;
  int i,j=0,k=0;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&A);
    if (A >= 0){
      Ap[j] = A;
      j++;
    }else if(A < 0){
      Am[k] = A;
      k++;
    }
  }
  int max = -20000;
  int min = 20000;
  long sum = 0;
  long tmp;
  int a,b;
  if (j == N){
    j = 0;
    for (j=0;j<N;j++){
      sum += Ap[j];
      if (Ap[j] < min){
        min = Ap[j];
        i = j;
      }
    }
    printf("%ld\n",sum - 2*Ap[i]);
    j = 0;
    tmp = min;
    if (i == 0){
      for(j=2;j<N;j++){
        printf("%ld %d\n",tmp,Ap[j]);
        tmp = tmp - Ap[j];
      }
      printf("%d %ld\n",Ap[1],tmp);
    }else{
      for(j=1;j<N;j++){
        if(j != i){
          printf("%ld %d\n",tmp,Ap[j]);
          tmp = tmp - Ap[j];
        }
      }
      printf("%d %ld\n",Ap[0],tmp);
    }
  }else if(k == N){
    k = 0;
    for (k=0;k<N;k++){
      sum -= Am[k];
      if (Am[k] > max){
        max = Am[k];
        i = k;
      }
    }
    printf("%ld\n",sum + 2*Am[i]);
    k = 0;
    tmp = max;
    for(k=0;k<N;k++){
      if(k != i){
        printf("%ld %d\n",tmp,Am[k]);
        tmp = tmp - Am[k];
      } 
    }
  }else{
    for(a=0;a<j;a++){
      sum += Ap[a];
    }
    for(b=0;b<k;b++){
      sum -= Am[b];
    }
    printf("%ld\n",sum);
    a = 1;
    b = 1;
    tmp = Am[0];
    for(a=1;a<j;a++){
      printf("%ld %d\n",tmp,Ap[a]);
      tmp = tmp - Ap[a];
    }
    printf("%d %ld\n",Ap[0],tmp);
    tmp = Ap[0] - tmp;
    for(b=1;b<k;b++){
      printf("%ld %d\n",tmp,Am[b]);
      tmp = tmp - Am[b];
    }
  }
  return 0;
}

Measured memory_bytes: 2176
/* ***********************************************
Author        :yang12138
Created Time  :2017年04月17日 星期一 10时49分21秒
File Name     :C.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)

const int N=1e5+10;
int x[N],d[N];

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
   	int n,l,t; 
	scanf("%d%d%d",&n,&l,&t);
	int tot=0;
	for(int i=1;i<=n;i++){
		scanf("%d%d",x+i,d+i);
		int tmpt=t,tmpx=x[i];
		if(d[i]==1){
			if(tmpt>=l-tmpx) tmpt-=l-tmpx,tmpx=0,tot++;
			tmpx+=tmpt,tot+=tmpt/l;
		}
		else{
			if(tmpt>=tmpx+1) tmpt-=tmpx+1,tmpx=l-1,tot--;
			tmpx-=tmpt,tot-=tmpt/l;
		}
		tot%=n,x[i]=(tmpx%l+l)%l;
	}
	sort(x+1,x+n+1);
	int pos=(1+tot)%n;
	if(pos<=0) pos+=n;

	for(int i=pos;i<=n;i++) printf("%d\n",x[i]);
	for(int i=1;i<pos;i++) printf("%d\n",x[i]);


    return 0;
}


Measured memory_bytes: 1920
#include<iostream>

using namespace std;

int main() {
	
	double r;
	
	while( cin >> r  ) {
		
	double area, pre;
	
	area = 	r * r * 3.141592653589;
	pre = r * 2 * 3.141592653589;
	
	cout << fixed << area << " "
		 << pre << "\n";
	
	}
		
	return 0;
}


Measured memory_bytes: 3272
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vector<vector<P>> G(n);
    rep(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(make_pair(b, i));
        G[b].pb(make_pair(a, i));
    }

    ll K = 0;
    rep(i, n) {
        chmax(K, (ll)G[i].size());
    }
    
    // BFS。計算量はO(V+E)
    vl color(n-1);  // color[i] : 辺iの色
    vl visited(n);  // 訪れた頂点は1
    vl x(n);  // x[i] : 頂点iとiの親を結ぶ辺の色
    queue<ll> Q;
    const ll sv = 0;  // BFSを始める頂点(デフォルトは0)
    Q.push(sv);
    while(!Q.empty()) {
        ll v = Q.front();
        Q.pop();
        visited[v] = 1;
        ll num = 1;
        for(auto p1 : G[v]) {
            ll u = p1.first;
            ll e = p1.second;
            if(visited[u]) {  // 逆流を防ぐ
                continue;
            }
            if(x[v] == num) {
                num++;
            }
            color[e] = num;
            x[u] = num;
            num++;
            Q.push(u);
        }
    }

    out(K);
    rep(i, n-1) {
        out(color[i]);
    }

    re0;
}

Measured memory_bytes: 12416
#include <iostream>

int main() {
	int inputnum = 0;
	int editnum = 0;
	int digitsum = 0;

	std::cin >> inputnum;

	editnum = inputnum;

	for (int i = 0; i < 8; i++) {
		digitsum += (editnum % 10);
		editnum = editnum / 10;
	}

	if ((inputnum % digitsum) == 0) {
		std::cout << "Yes";
	}
	else {
		std::cout << "No";
	}

	return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<double> p(n+1);
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	vector<vector<double>> dp(n+1, vector<double>(n+1, 0));
	
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i][j] = dp[i-1][j] * (1 - p[i]);
			if (j > 0) {
				dp[i][j] += dp[i-1][j-1] * p[i];
			}
		}
	}
	
	double res = 0;
	for (int i = n; i >= 0; i--) {
		if (i > n-i) {
			res += dp[n][i];
		} else {
			break;
		}
	}
	
	cout << setprecision(9) << res << endl;
}

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

int main()
{
    int t,d,ans=0;
    cin>>t>>d;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        long double x=sqrt(pow(a,2)+pow(b,2));
        if(x<=d)
            ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3672
#include <stdio.h>

int main(){
 int a,b,c;
 scanf("%d %d",&a,&b);
 if(a<b){
  c=a;
  a=b;
  b=c;
 }
 while(b){
  c=b;
  b=a%b;
  a=c;
 }
 printf("%d\n",a);
 return 0;
}

Measured memory_bytes: 1020
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;



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

	vector< vector<int> > v;


	rep(i, 0, n) {
		int x, y, h;
		cin >> x >> y >> h;
		v.push_back({x,y,h});
	}



	rep(cx, 0, 101) {
		rep(cy, 0, 101) {
			int H;
			rep(i, 0, n) {
				if (v[i][2] != 0) {
					H = v[i][2] + abs(v[i][0] - cx) + abs(v[i][1] - cy);
				}
			}

			int cnt = 0;
			rep(i, 0, n) {
				if (v[i][2] == max(0, H - abs(cx-v[i][0]) - abs(cy-v[i][1]))) {
					cnt++;
				}
				if (cnt == n) {
					cout << cx << " " <<  cy << " " << H << endl;
					exit(0);
				}
			}
			
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int main(){
  int n;
  while(cin>>n, n){
    int arr[2][n];
    int *next = arr[1], *prev = arr[0];
    int cnt = -1;
    REP(i,n) cin>>arr[0][i];
    do{
      cnt++;
      REP(i,n) next[i] = (int)count(prev, prev+n, prev[i]);
      swap(prev, next);
    }while(memcmp(prev, next, sizeof(int) * n) != 0);
    printf("%d\n",cnt);
    REP(i,n) printf("%d%c",prev[i],i==n-1?'\n':' ');
  }
  return 0;
}

Measured memory_bytes: 0
// Problem B

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>

#define MAXN 1000
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;

int n, m, a[MAXN];

int main() {
  cin >> n >> m;
  int sum = 0;
  for (int i=0; i<n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  
  sort(a, a+n, greater <>());
  if (4*m*a[m-1] >= sum) cout << "Yes\n";
  else cout << "No\n";
  
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>		
#include <stdio.h>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < int(n); i++)
#define mod 1000000007
#define fst first
#define pb push_back

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

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

#define int long long
#define ff first
#define ss second
#define loop(i,k,n) for(int i=k;i<n;++i)
#define rloop(i,n,k) for(int i=n;i>=k;i--)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpii vector<pair<int,int> >
#define all(v) v.begin(),v.end()
#define mset(a,i) memset(a,i,sizeof(a))
#define mii map<int,int>
#define mci map<char,int>  
#define pii pair<int,int>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007  
#define endl "\n"
#define inf 1e18
#define sp(x,y) fixed<<setprecision(y)<<x

void get_it_done(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int gcd(int a, int b){ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
void swap(int &a,int &b){
    a^=b;b^=a;a^=b;
}
const int N = 3e3+5;
double dp[N][N];
int n;
double a[N];


int32_t main(){
    get_it_done();
    int t=1;
    // cin >> t;
    while (t--){
        cin>>n;
        loop(i,1,n+1) cin>>a[i];
        int numHeads = n/2+1;
        int numTails = n/2;
        mset(dp,0);
        dp[0][0] = 1;
        loop(i,1,n+1){
            double head = a[i];
            double tail = 1-a[i];
            dp[0][i] = tail*dp[0][i-1];
            loop(h,1,i+1){
                dp[h][i] = (head*dp[h-1][i-1])+(tail*dp[h][i-1]);
            }
        }
        double ans = 0;
        loop(i,n/2+1,n+1){
            ans += dp[i][n];
        }
        cout<<sp(ans,10)<<endl;



    }
}


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

int main(){
  int n;
  cin >> n;
  vector<long> a(n);

  for(int i=0;i<n;++i){
    cin >> a.at(i);
  }
  
  long sum = 0;
  for(int r=0;r<n;++r){
    sum += a.at(r);
  }
  
  long h = 0;
  for(int w =0;2*h < sum;++w){
    h += a[w];
  }
  
  if(2*h == sum){
  cout << 0 << endl;
    return 0;
  }
  
  if( n == 2){
  cout << abs(a[0]-a[1]) << endl;
  return 0;
  }
  
  
  long hr =sum-h;
  long m = h-hr;
  
  
  reverse(a.begin(),a.end());
    
     h = 0;
  for(int w =0;2*h < sum;++w){
    h += a[w];
  }
  
   hr =sum-h;
  
  cout << min(m,h-hr) << endl;
  
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<assert.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define gc getchar()
#define lint long long
#define mp make_pair
#define fir first
#define sec second
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
#define N 100010
using namespace std;
typedef pair<lint,int> plii;typedef set<plii> splii;typedef splii::iterator spliit;int lst[N*6];
queue<int> q;vector<lint> vec;splii s1[N*6],s2[N*6];vector<plii> v1[N*6],v2[N*6];lint x[N],y[N],d;
int vis[N],xpy[N],xmy[N],xpypd[N],xpymd[N],xmypd[N],xmymd[N];inline lint gabs(lint x) { return x<0?-x:x; }
inline int inn() { int x,ch;while((ch=gc)<'0'||ch>'9'); x=ch^'0';while((ch=gc)>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^'0');return x; }
inline int getid(lint x) { return lower_bound(vec.begin(),vec.end(),x)-vec.begin()+1; }
inline int ins(int i) { return s1[xpy[i]].insert(mp(x[i],i)),s2[xmy[i]].insert(mp(x[i],i)),0; }
inline int del(int i) { return s1[xpy[i]].erase(mp(x[i],i)),s2[xmy[i]].erase(mp(x[i],i)),vis[i]=1,0; }
inline int tour(splii &s,lint a,lint b,int c=0)
{
	for(spliit it=s.lower_bound(mp(a,0));it!=s.end()&&it->fir<=b;it=s.lower_bound(mp(it->fir+1,0)))
		lst[++c]=it->sec,q.push(it->sec);rep(i,1,c) del(lst[i]);return 0;
}
inline int _ins(int i) { return v1[xpy[i]].pb(mp(x[i],i)),v2[xmy[i]].pb(mp(x[i],i)),0; }
inline int _init(vector<plii> &v) { return sort(v.begin(),v.end()),0; }
inline int query(vector<plii> &v,lint x)//<=x
{ int L=0,R=(int)v.size()-1,mid=(L+R)>>1;for(;L<=R;mid=(L+R)>>1) if(v[mid].fir<=x) L=mid+1;else R=mid-1;return L; }
inline int query(vector<plii> &v,lint a,lint b) { return query(v,b)-query(v,a-1); }
inline int query(int i)
{ return query(v1[xpypd[i]],x[i],x[i]+d-1)+query(v2[xmypd[i]],x[i]+1,x[i]+d)+query(v1[xpymd[i]],x[i]-d+1,x[i])+query(v2[xmymd[i]],x[i]-d,x[i]-1); }
int main()
{
	int n=inn(),a=inn(),b=inn();
	rep(i,1,n) x[i]=inn(),y[i]=inn();
	d=gabs(x[a]-x[b])+gabs(y[a]-y[b]);
	rep(i,1,n) vec.pb(x[i]+y[i]),vec.pb(x[i]-y[i]),vec.pb(x[i]+y[i]+d),vec.pb(x[i]-y[i]+d),vec.pb(x[i]+y[i]-d),vec.pb(x[i]-y[i]-d);
	sort(vec.begin(),vec.end()),vec.erase(unique(vec.begin(),vec.end()),vec.end());
	rep(i,1,n)
		xpy[i]=getid(x[i]+y[i]),xmy[i]=getid(x[i]-y[i]),
		xpypd[i]=getid(x[i]+y[i]+d),xpymd[i]=getid(x[i]+y[i]-d),
		xmypd[i]=getid(x[i]-y[i]+d),xmymd[i]=getid(x[i]-y[i]-d);
	rep(i,1,n) ins(i);q.push(a),q.push(b),del(a),del(b);
	while(!q.empty())
	{
		int i=q.front();q.pop();
		tour(s1[xpypd[i]],x[i],x[i]+d),tour(s1[xpymd[i]],x[i]-d,x[i]),
		tour(s2[xmymd[i]],x[i]-d,x[i]),tour(s2[xmypd[i]],x[i],x[i]+d);
	}
	lint ans=0ll;rep(i,1,n) if(vis[i]) _ins(i);
	rep(i,1,(int)vec.size()) _init(v1[i]),_init(v2[i]);
	rep(i,1,n) if(vis[i]) ans+=query(i);return !printf("%lld\n",ans/2);
}

Measured memory_bytes: 111208
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
int a[16][16];
ll val[(1<<16)],dp[(1<<16)];
int main(){
	fastio;
	cin>>n;
	forn(i,n) forn(j,n) cin>>a[i][j];
	forsn(m,1,(1<<n)){
		forn(i,n){
			if((m&(1<<i))==0) continue;
			forsn(j,i+1,n){
				if((m&(1<<j))==0) continue;
				val[m]+=a[i][j];
			}
		}
	}
	dp[0]=0;
	forsn(m,1,(1<<n)){
		auto &x=dp[m];
		x=-1e18;
		for(int s=m;s;s=(s-1)&m){
			x=max(x,val[s]+dp[s^m]);
		}
	}
	cout<< dp[(1<<n)-1] << ln;
	return 0;
}

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

char s[234567], t[234567];

int main() {
	cin>>s>>t;
	int ans = 0;
	for(int i=0; s[i]; i++)
		if(s[i] != t[i])
			ans ++;
	cout<<ans<<endl;
	return 0;
}


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

const int inf = 1e9;
const ll linf = 1e18;

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

    ll n; cin >> n;
    ll ans = 0;
    if (n % 2 == 0) {
        ll d = 5;
        while (d <= n) {
            ans += (n / d) / 2;
            d *= 5;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math

line = input().rstrip()
line = line.split(' ')
A = int(line[0])
B = line[1].split('.')
if len(B) == 1:
    B = int(B[0]) * 100
elif len(B[1]) == 1:
    B = int(B[0]) * 100 + int(B[1]) * 10
else:
    B = int(B[0]) * 100 + int(B[1])

C = A * B // 100
print(C)

Measured memory_bytes: 62156