akhauriyash/Code-Regression huggingface dataset:
n,m,c=map(int,input().split())
b=[int(x) for x in input().split()]
ans=0
for i in range(n):
  a=[int(x) for x in input().split()]
  combined1 = [x * y for (x, y) in zip(a, b)]
  if sum(combined1) + c >0:
    ans+=1
print(ans)

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

main(){
  long long A,B;
  long long MAX=1;
  long long ANS;
  cin >>A>>B;
  if(A>B){
    for(int i=0;i<B;i++){
      if((A%(i+1)==0)&(B%(i+1)==0))MAX=i+1;
    }
  }
    else for(int i=0;i<A;i++){
      if((A%(i+1)==0)&(B%(i+1)==0))MAX=i+1;
    }

    ANS=A*B/MAX;
    cout <<ANS;
     
  return 0;
}

  
  

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

using namespace std;

typedef long long int ll;
typedef pair<double,double> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

double cross(P p,P q){
    return p.first*q.second-p.second*q.first;
}

double dot(P p,P q){
    return p.first*q.first+p.second*q.second;
}

double norm(P p){
    return sqrt(pow(p.first,2)+pow(p.second,2));
}

int ccw(P p0,P p1,P p2){ //p0p1が基準
    p1.first -= p0.first;
    p1.second -= p0.second;
    p2.first -= p0.first;
    p2.second -= p0.second;

    if(cross(p1,p2) > 0) return 1; // counter_clockwise
    if(cross(p1,p2) < 0) return -1; // clockwise
    if(dot(p1,p2)<0) return 2 ;//on_line back
    if(norm(p1)<norm(p2)) return -2; //on_line front
    return 3; // on_segment
}

int main()
{
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        P p0,p1,p2,p3;
        cin >> p0.first >> p0.second
        >> p1.first >> p1.second
        >> p2.first >> p2.second
        >> p3.first >> p3.second;

        p1.first -= p0.first;
        p1.second -= p0.second;
        p3.first -= p2.first;
        p3.second -= p2.second;


        //cout << dot(p1,p3) << endl;
        if(dot(p1,p3) == 0) cout << 1 << endl;
        else if(cross(p1,p3)==0) cout << 2 << endl;
        else cout << 0 << endl;

    }

    return 0;
}


Measured memory_bytes: 3228
defmodule Main do
  def main do
    [a, b, c, d] =
      IO.read(:line)
      |> String.trim
      |> String.split(" ")
    a = String.to_integer(a)
    b = String.to_integer(b)
    c = String.to_integer(c)
    d = String.to_integer(d)
    if ((Enum.max([a, b]) - Enum.min([a, b]) <= d) and
    (Enum.max([b, c]) - Enum.min([b, c]) <= d)) or (Enum.max([a, c]) - Enum.min([a, c]) <= d) do
    	IO.puts("Yes")
    else
    	IO.puts("No")
    end
  end
end


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

int main(){
    int v,s;
    while(1){
        cin>>v>>s;
        if(v==0&&s==0) break;
        for(int i=0;i<v;i++){
            for(int j=0;j<s;j++){
                cout<<'#';
            }
            cout<<'\n';
        }
        cout<<'\n';
    }
}


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

int main() {
  long long n;
  cin >> n;
  
  vector <long long> a;
  a.reserve(n);
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }

  vector <long long> b;
  b.reserve(n);
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    b.push_back(t);
  }
  
  vector <long long> c;
  c.reserve(n);
  for (int i = 0; i < n-1; i++) {
    int t;
    cin >> t;
    c.push_back(t);
  }
  
  long long satisfy = 0;
  long long prev = -10;
  for (int i = 0; i < n; i++) {
    int idx = a[i];
    satisfy += b[idx-1];
    if (idx == prev + 1) satisfy += c[prev-1];
    prev = idx;
    //cerr << satisfy << endl;
  }
  
  cout << satisfy << endl;
  
  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;



fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let k: u64 = read();

    let mut ans: u64 = k;

    for _i in 1..n {
        ans *= k-1;
    }
    println!("{}", ans);

}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  char n;
  cin>>n;
  if(n=='A') cout<<"T"<<'\n';
  if(n=='T') cout<<"A"<<'\n';
  if(n=='G') cout<<"C"<<'\n';
  if(n=='C') cout<<"G"<<'\n';  
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# agc034/agc034_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, A, B, C, D = i2nn()
    S = i2s()
    if '##' not in S[B-1:D] and '##' not in S[A-1:C]:
        if C < D:
            print('Yes')
        elif  '...' in S[B-2:D+1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
    return

main()


Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		int l = Integer.parseInt(sa[2]);
		long[][] d = new long[n][n];
		for (int i = 0; i < n; i++) {
			Arrays.fill(d[i], 100000000000000L);
		}
		for (int i = 0; i < m; i++) {
			sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[0]) - 1;
			int b = Integer.parseInt(sa[1]) - 1;
			int c = Integer.parseInt(sa[2]);
			if (c <= l) {
				d[a][b] = c;
				d[b][a] = c;
			}
		}
		int q = Integer.parseInt(br.readLine());
		int[] s = new int[q];
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			sa = br.readLine().split(" ");
			s[i] = Integer.parseInt(sa[0]) - 1;
			t[i] = Integer.parseInt(sa[1]) - 1;
		}
		br.close();

		int[][] ans = new int[n][n];
		long[][] ansd = new long[n][n];
		for (int i = 0; i < n; i++) {
			Arrays.fill(ans[i], 1000000000);
		}
		for (int i = 0; i < n; i++) {
			Set<Integer> set = new HashSet<>();
			for (int j = 0; j < n; j++) {
				set.add(j);
			}
			Node[] nodes = new Node[n];
			for (int j = 0; j < n; j++) {
				nodes[j] = new Node(j, 1000000000, 0);
			}
			TreeSet<Node> nset = new TreeSet<>();
			nset.add(nodes[i]);
			nodes[i].a = 0;
			ans[i][i] = 0;
			while (!nset.isEmpty() && !set.isEmpty()) {
				Node cur = nset.pollFirst();
				if (set.remove(cur.v)) {
					for (int j : set) {
						int alta = ans[i][cur.v];
						long c = d[cur.v][j];
						long altd = cur.d + c;
						if (altd >= 100000000000000L) {
							continue;
						}
						if (altd > l) {
							alta++;
							altd = c;
						}
						if (alta < ans[i][j]
								|| alta == ans[i][j] && altd < ansd[i][j]) {
							ans[i][j] = alta;
							ansd[i][j] = altd;
							nset.remove(nodes[j]);
							nodes[j].a = alta;
							nodes[j].d = altd;
							nset.add(nodes[j]);
						}
					}
				}
			}
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < q; i++) {
			int o = ans[s[i]][t[i]];
			if (o == 1000000000) {
				pw.println(-1);
			} else {
				pw.println(o);
			}
		}
		pw.flush();
	}

	static class Node implements Comparable<Node> {
		int v;
		int a;
		long d;

		public Node(int v, int a, long d) {
			this.v = v;
			this.a = a;
			this.d = d;
		}

		public int compareTo(Node o) {
			if (a != o.a) {
				return a - o.a;
			}
			if (d != o.d) {
				return Long.compare(d, o.d);
			}
			return v - o.v;
		}
	}
}


Measured memory_bytes: 157176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>

using namespace std;
typedef long long ll;


int main(){
  ll N,M;
  cin >> N >> M;
  ll a[M],b[M];
  vector<vector<int> > G(N);
  for(ll i=0;i<M;i++){
    cin >> a[i] >> b[i];
    G[a[i]-1].push_back(b[i]-1);
    G[b[i]-1].push_back(a[i]-1);
  }
  vector<int> dist(N, -1);
  vector<int> ans(N);
  queue<int> que;
  dist[0] = 0;
  ans[0] = 1;
  que.push(0); 
  while (!que.empty()) {
    int v = que.front();
    que.pop();

    for (int nv : G[v]) {
      if (dist[nv] != -1) continue; 
      dist[nv] = dist[v] + 1;
      ans[nv] = v+1;
      que.push(nv);
    }
  }
  bool ok = true;
  for(ll i=0;i<N;i++){
    if(dist[i]<0) ok=false;
  }
  if(ok){
    cout << "Yes" << endl;
    for(int j=1;j<N;j++){
      cout << ans[j] << endl;
    }
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 13340
from collections import Counter as co
n,m=map(int,input().split())
l=co("".join([input()for i in range(n)])).values()
if n%2 and m%2:
    l=list(l)
    f=1
    for v in range(len(l)):
        if l[v]%2:
            if f:f=0;l[v]-=1
            else:print("No");exit()
    if f==1:print("No");exit()
    print("Yes"if(n+m)//2-1>=len(tuple(1 for j in l if j%4==2)) else "No")
elif (n+m)%2:
    k=(n,m)[n%2]
    print("Yes"if k//2>=len(tuple(1 for j in l if j%4==2)) and 0==len(tuple(1 for j in l if j%2))else"No")
else:print("No"if len(tuple(1 for j in l if j%4))else "Yes")

Measured memory_bytes: 3316
def bubble(c):
	for i in range(len(c)):
		for j in range(len(c)-1,i,-1):
			if int(c[j][-1]) < int(c[j-1][-1]):
				c[j],c[j-1] = c[j-1],c[j]
	return c

def selection(c):
	for i in range(len(c)):
		mini = i
		for j in range(i,len(c)):
			if int(c[j][-1])<int(c[mini][-1]):
				mini = j
		c[i],c[mini]=c[mini],c[i]
	return c

n = int(input())
card = list(map(str,input().split()))
card1 = card[:]
bubble(card)
selection(card1)
print(" ".join(map(str,card)))
print("Stable")
print(" ".join(map(str,card1)))
print("Stable") if card==card1 else print("Not stable")

Measured memory_bytes: 6756
#include <iostream>
using namespace std;
int main()
{
	int D;
	cin>>D;
	if(D==25)cout<<"Christmas";
	else if(D==24)cout<<"Christmas Eve";
	else if(D==23)cout<<"Christmas Eve Eve";
	else if(D==22)cout<<"Christmas Eve Eve Eve";
	return 0;
}

Measured memory_bytes: 256
n = input()

if len(n) == 1:
  print(n)
elif len(n) == 2:
  print(9)
elif len(n) == 3:
  print(int(n) - 99 + 9)
elif len(n) == 4:
  print(909)
elif len(n) == 5:
  print(int(n) - 9999 + 909)
elif len(n) == 6:
  print(90909)

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

using namespace std;

const int MAX = 100050;
vector<vector<int>> g;
bool visited[MAX];

void dfs(int v) {
    visited[v] = true;
    for (int to : g[v]) {
        if (!visited[to]) {
            dfs(to);
        }
    }
}

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

    int nVertices, nEdges;
    cin >> nVertices >> nEdges;
    g.resize(nVertices + 1);
    for (int i = 0; i < nEdges; ++i) {
        int u, v, _;
        cin >> u >> v >> _;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int cnt = 0;
    for (int v = 1; v <= nVertices; ++v) {
        if (!visited[v]) {
            dfs(v);
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 8960
#include<stdio.h>

int main(){
  int n,i;
  char s1[52],s2[52];
  long long int sum=0;
  scanf("%d",&n);
  scanf("%s",s1);
  scanf("%s",s2);
  if(s1[0]==s2[0]){
    sum=3;
    i=1;
  }
  else{
    sum=6;
    i=2;
  }
  for(;i<n;i++){
    if(s1[i]==s2[i]&&s1[i-1]==s2[i-1])
      sum*=2;
    else if(s1[i]!=s2[i]&&s1[i-1]!=s2[i-1]){
      sum*=3;
      i++;
    }
    else if(s1[i]!=s2[i]&&s1[i-1]==s2[i-1]){
      sum*=2;
      i++;
    }
  }
  printf("%lld\n",sum%1000000007);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	string n;
 	cin >> n;
 	int ans=0;
 	for (int i = 0; i < 6; i++){
 		if(n[i]=='1'){
 			ans++;
 		}
 	}
 	cout << ans << endl;
 }

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

int main(){
  int n,k;
  cin >> n >> k;
  int sum[200010]={};
  int x;
  for(int i=0;i<n;i++){
    cin >> x;
    sum[x]++;
  }
  int ans = 0;
  sort(sum,sum+200010,greater<int>());
  for(int j=0;j<k;j++){
    ans += sum[j];
  }
  cout << n-ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
void read(int& x){ scanf("%d",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
const ll inf = (1ll<<60);

int n, Ma, Mb;

int a[50];
int b[50];
int c[50];

void in(){
	read(n, Ma, Mb);
	for(int i=0; i<n; ++i) read(a[i], b[i], c[i]);
}

int hn;

map<ll, ll> ml, mr;

ll ans=inf;

void dfs0(int p=0, int sa=0, int sb=0, int sc=0){
	if(p == hn){
		ll x=sb*1LL*Ma - sa*1LL*Mb;
		if(ml.find(x) == ml.end()) ml[x]=inf;
		ml[x]=min(ml[x], ll(sc));
		if(sb*1LL*Ma == sa*1LL*Mb && sa){
			ans=min(ans, ll(sc));
		}
		return;
	}
	dfs0(p+1, sa, sb, sc);
	dfs0(p+1, sa+a[p], sb+b[p], sc+c[p]);
}

void dfs1(int p=hn, int sa=0, int sb=0, int sc=0){
	if(p == n){
		ll x=-(sb*1LL*Ma - sa*1LL*Mb);
		if(ml.find(x) != ml.end() && sc+ml[x])
			ans=min(ans, sc+ml[x]);
		return;
	}
	dfs1(p+1, sa, sb, sc);
	dfs1(p+1, sa+a[p], sb+b[p], sc+c[p]);
}

int main()
{
    in();
    hn=n/2;
    dfs0();
    dfs1();
    if(ans == inf) ans=-1;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
S = input()

m = int(S[:2])
u = int(S[2:])

if (1 <= m <= 12) and (1 <= u <= 12):
    print("AMBIGUOUS")
elif (1 <= m <=12) and (u==0 or 13 <= u):
    print("MMYY")
elif (m==0 or 13 <= m) and (1 <= u <= 12):
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<llint, llint> P;

llint n, d, a;
P p[200005];
priority_queue<P, vector<P>, greater<P> > Q;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> d >> a;
	for(int i = 1; i <= n; i++) cin >> p[i].first >> p[i].second;
	for(int i = 1; i <= n; i++){
		p[i].second = (p[i].second+a-1) / a;
		Q.push(p[i]);
	}
	
	llint ans = 0, sum = 0;
	while(Q.size()){
		llint pos = Q.top().first, hp = Q.top().second;
		Q.pop();
		if(hp > 0){
			if(sum >= hp) continue;
			ans += hp - sum;
			Q.push(P(pos+2*d+1, -(hp-sum)));
			sum = hp;
		}
		else sum += hp;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 9456
import java.util.Scanner;

class Main {
    static class Calculator {
        enum Operator {
            NULL {
                @Override
                public int apply(int r1, int r2) {
                    if (r2 < 0 || r2 > 9999) {
                        throw new RuntimeException();
                    } else {
                        return r2;
                    }
                }
            },
            ADD {
                @Override
                public int apply(int r1, int r2) {
                    if (r1 + r2 < 0 || r1 + r2 > 9999) {
                        throw new RuntimeException();
                    } else {
                        return r1 + r2;
                    }
                }
            },
            SUB {
                @Override
                public int apply(int r1, int r2) {
                    if (r1 - r2 < 0 || r1 - r2 > 9999) {
                        throw new RuntimeException();
                    } else {
                        return r1 - r2;
                    }
                }
            },
            MULT {
                @Override
                public int apply(int r1, int r2) {
                    if (r1 * r2 < 0 || r1 * r2 > 9999) {
                        throw new RuntimeException();
                    } else {
                        return r1 * r2;
                    }
                }
            };
            public int apply(int r1, int r2) {
                return 0;
            }
        }

        private int R1 = 0;
        private int R2 = 0;
        private Operator R3 = Operator.NULL;

        private int calc(char[] input) {
            for (int i = 0; input[i] != '='; i++) {
                if (Character.isDigit(input[i])) {
                    R2 = Operator.MULT.apply(R2, 10);
                    R2 = Operator.ADD.apply(R2, input[i] - '0');
                } else if (input[i] == '+') {
                    R1 = R3.apply(R1, R2);
                    R2 = 0;
                    R3 = Operator.ADD;
                } else if (input[i] == '-') {
                    R1 = R3.apply(R1, R2);
                    R2 = 0;
                    R3 = Operator.SUB;
                } else if (input[i] == '*') {
                    R1 = R3.apply(R1, R2);
                    R2 = 0;
                    R3 = Operator.MULT;
                } else {
                    assert false;
                }
            }
            R1 = R3.apply(R1, R2);
            R2 = 0;
            R3 = Operator.NULL;
            return R1;
        }

        public void run(char[] input) {
            try {
                System.out.println(calc(input));
            } catch (Throwable e) {
                System.out.println("E");
            }
        }
    }

    private static void solve() {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            char[] input = scanner.next().toCharArray();
            new Calculator().run(input);
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 0
/**
    AUTHOR:JUNSH
    TIME:19/6/1
**/
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rev(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    cout<<(n-2)*180<<endl;
}


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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N;
vector<ll> uv[202020];

ll i, j, k;

int main(){
    scanf("%lld", &N);
    rep(i,1,N){
        ll u, v;
        scanf("%lld%lld", &u, &v);
        uv[u].push_back(v);
        uv[v].push_back(u);
    }
    ll n = 0, ans = 0;
    rep(i,0,N){
        ll a = N - i;
        //printf(" %llda", a);
        n += N - a + 1;
        rep(j,0,uv[a].size()){
            ll b = uv[a][j];
            if(b>a){
                n -= N - b + 1;
            }
        }
        
        //printf("%lld\n", ans);
        ans += n;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 15832
// header {{{
            #include <bits/stdc++.h>
            using namespace std;
                         
            void solve() {
                int n;
                cin >> n;
                // vector<int> vec(n);
                int k;
                int cnt = 0;
                for (int i = 0; i < n; i++) {
                  // cin >> vec.at(i);
                  cin >> k;
                  if ( ((i+1) % 2 == 1) && ( (k % 2) == 1) ) cnt++;
                }
            	cout << cnt << "\n" << endl;
                // cout << ans << "\n";
            }
             
            signed main() {
                
                solve();
             
                return 0;
            }

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

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};

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

    int n, m;
    cin >> n >> m;

    int cnt[50] = {0};
    rep(i, n){
        int k;
        cin >> k;
        rep(j, k){
            int a;
            cin >> a;
            cnt[a] ++;
        }
    }

    int all_cnt = 0;
    rep(i, 50){
        if(cnt[i] == n) all_cnt ++;
    }

    cout << all_cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int count = 0;
    for(int i=0;i<n;i++){
      a[i] = sc.nextInt();
    }
    for(int i = 0; i<n; i++){
      int min = i;
      int min1 = 100;
      for(int j=i;j<n;j++){
        if(a[j]<min1){
          min = j;
          min1 = a[j];
        }
      }
      if(min1 != a[i]){
        int temp = a[i];
        a[i] = min1;
        a[min] = temp;
        count++;
      }
    }
    for(int i = 0;i<n;i++){
      System.out.print(a[i]);
      if(i==n-1){
        System.out.println();
      }else{
        System.out.print(" ");
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 26352
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  vector<ll>vec(3);
  ll b=0;
  for(ll i=0;i<3;i++){
    cin>>vec.at(i);
    b+=vec.at(i);
  }
  sort(vec.begin(),vec.end());
  b+=9*vec.at(2);
  cout<<b<<endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
int MOD = 1000000007; //10^9 + 7

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


int main(void){
  int n;
  cin >> n;
  vvi a(n, vi(3));
  rep(i,n)rep(j,3) cin >> a[i][j];

  // DP テーブル
  vvi dp(100010, vi(3));

  // DP テーブル全体を初期化 (最小化問題:INF else:0)
  for (int i = 0; i < 100010; ++i) rep(j,3) dp[i][j] = 0;

  // 初期条件
  rep(j,3)dp[0][j] = 0;

  // ループ
  rep(i,n){
    rep(j,3){
      rep(k,3){
        if(j==k)continue;
        chmax(dp[i+1][j], dp[i][k] + a[i][j]);
      }
    }
  }

  // 解を得て出力
  long long res = 0;
  rep(i,3) if(res<dp[n][i])res=dp[n][i];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 14084
#include <bits/stdc++.h>
using namespace std;
int par[500010]; 
int depth[500010]; 
int sz[500010];
string S, T; 
void init(){
	for(int i = 0; i < S.size(); i++){
		par[i] = i; depth[i] = 0; sz[i] = 1; 
	}
}
int find(int x){
	if(par[x] == x){
		return x;
	}
	else{
		return par[x] = find(par[x]); 
	}
}
void unite(int x, int y){
	x = find(x); 
	y = find(y); 
	if(x == y) return;
	else if(depth[x] < depth[y]){
		par[x] = y; 
		sz[y] += sz[x]; 
	}else{
		par[y] = x; 
		sz[x] += sz[y];  
		if(depth[x] == depth[y]) depth[x] ++; 
	}
}
bool same(int x, int y){
	return find(x) == find(y); 
}
int siz(int x){
	return sz[find(x)]; 
}
int main(){
	cin >> S >> T; init(); 
	string U = T + "*" + S; 
	while(1){
		if(U.size() > S.size() + T.size() * 2) break; 
		U += S; 	
	}
	int Z[2000010] = {}; 
	Z[0] = T.size(); 
	int i = 1, j = 0; 
	while(i < U.size()){
		while(i + j < U.size() && U[j] == U[i + j]) j++;
		Z[i] = j;
		if(j == 0){
			i++; continue;
		}
		int k = 1;
		while(k < j && k + Z[k] < j){
			Z[i + k] = Z[k]; k++;
		}
		i += k; j -= k;
	}
	for(int i = 0; i < S.size(); i++){
		if(Z[T.size() + 1 + i] != T.size()) continue; 
		int k = (i + T.size()) % S.size(); 
		if(same(i, k)){
			cout << -1 << endl; return 0; 
		}
		unite(i, k); 
	}
	int ans = 0; 
	for(int i = 0; i < S.size(); i++){
		ans = max(ans, siz(i)); 
	}
	cout << ans - 1 << endl;
}

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

int main(void) {
    int64_t H;
    int cnt= 0;
    int64_t ans;
    cin >> H;
    while(H > 0) {
        H /= 2;
        cnt++;
    }

    ans = 1;
    for(int i=0;i<cnt;i++){
        ans *= 2;
    }

    cout << ans - 1 << "\n";
    return 0;
}


Measured memory_bytes: 256
while True:
  n = int(input())
  if not n:
    break

  mat = []
  for _ in range(n):
    lst = list(map(int, input().split()))
    lst.append(sum(lst))
    mat.append(lst)
  
  sum_lst = []
  for i in range(len(mat[0])):
    s = 0
    for j in range(n):
      s += mat[j][i]
    sum_lst.append(s)
  mat.append(sum_lst)

  for line in mat:
    put = ""
    for i in line:
      put += str(i).rjust(5)
    print(put)



Measured memory_bytes: 5604
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
using namespace std;

const int N = 20;
map <string, int> m[N];
string s, t, u;
int a, b;

int main() {
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;

	if (u == s)
		a--;
	else
		b--;

	cout << a << " " << b << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pr pair<int,int>
#define endl "\n"
#define MOD 1000000007 // 10^9 + 7
#define sz(x) (int)(x).size()
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
#define all(c) (c).begin(), (c).end()

#define FOR(i,b) for (int i = 0; i < (b); i++)
#define FORR(i,a,b) for (int i = a; i < (b); i++)
#define FORB(i,b) for (int i = (b); i >= (0); i--)
#define FORRB(i,a,b) for (int i = (a);i>= (b); i--)
#define MAXN 100010
using namespace std;

int n;
ll arr[MAXN];
ll dp[MAXN];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	//freopen("addin.txt","r",stdin);
	//freopen("addout.txt","w",stdout);

	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> arr[i];
	}
	dp[0] = 0; dp[1] = 0; dp[2] = abs(arr[1]-arr[0]);
	for(int i = 3;i <= n;i++){
		dp[i] = min(dp[i-1]+abs(arr[i-1]-arr[i-2]),dp[i-2] + abs(arr[i-3]-arr[i-1]));
	}
	// for(int i=0;i<=n;i++){
	// 	cout<<dp[i]<<endl;
	// }
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
using CostType = long long;
struct Edge {
  int src, dst;
  CostType cost;
  Edge(int dst_, CostType cost_ = 0) : src(-1), dst(dst_), cost(cost_) {}
  Edge(int src_, int dst_, CostType cost_) : src(src_), dst(dst_), cost(cost_) {}
};
inline bool operator < (const Edge &lhs, const Edge &rhs) { return lhs.cost < rhs.cost; }
inline bool operator <= (const Edge &lhs, const Edge &rhs) { return lhs.cost <= rhs.cost; }
inline bool operator > (const Edge &lhs, const Edge &rhs) { return lhs.cost > rhs.cost; }
inline bool operator >= (const Edge &lhs, const Edge &rhs) { return lhs.cost >= rhs.cost; }

int cnt = 0;

template <const CostType CostType_INF>
struct BellmanFord {
  BellmanFord() {}

  vector<CostType> dist;

  bool has_negative_cycle(const vector<vector<Edge> > &graph, int s) {
    int sz = graph.size();
    dist.assign(sz, CostType_INF);
    dist[s] = 0;
    prev.assign(sz, -1);
    REP(step, sz * 2) {
      bool is_updated = false;
      REP(i, sz) for (Edge e : graph[i]) {
        if (dist[i] != CostType_INF && dist[e.dst] > dist[i] + e.cost) {
          if (e.dst == sz - 1) ++cnt;
          dist[e.dst] = dist[i] + e.cost;
          prev[e.dst] = i;
          is_updated = true;
        }
      }
      if (!is_updated) return false;
    }
    return true;
  }

  vector<int> build_path(int t) {
    vector<int> res;
    for (; t != -1; t = prev[t]) res.emplace_back(t);
    reverse(ALL(res));
    return res;
  }

private:
  vector<int> prev;
};

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, m; cin >> n >> m;
  BellmanFord<LINF> bf;
  vector<vector<Edge> > graph(n);
  REP(i, m) {
    int a, b; cin >> a >> b; --a; --b;
    long long c; cin >> c;
    graph[a].emplace_back(Edge(a, b, -c));
  }
  if (bf.has_negative_cycle(graph, 0) && cnt >= 2) {
    cout << "inf\n";
    return 0;
  }
  cout << -bf.dist[n - 1] << '\n';
  return 0;
}


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

int sumOfDigits(int N)
{
  int sum = 0;
  while (N > 0)
  {
    sum += N % 10;
    N /= 10;
  }
  return sum;
}

int main()
{
  int N, A, B;
  cin >> N >> A >> B;
  int sum = 0;
  for (int i = 1; i <= N; i++)
  {
    if (A <= sumOfDigits(i) and sumOfDigits(i) <= B)
    {
      sum += i;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 384
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------
long long modpow(long long a, long long n) {//a^n(MOD)を求める
    long long res = 1;
    while (n > 0) {
         if (n & 1) res = res * a % MOD;
         a= a * a % MOD;//次の準備
         n >>= 1;
      }
 return res;
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m;cin>>n>>m;
    int ac[200005];
    int yes[200005];
    memset(ac,0,sizeof(ac));
    memset(yes,0,sizeof(yes));
    int ans=0,wa=0;
    for(int i=0;i<m;i++){
        int p;cin>>p;p--;
        string s;cin>>s;
        if(ac[p]){
            continue;
        }
        if(s=="AC"){
                ac[p]++;
                ans++;
                wa+=yes[p];
        }
        else if(s=="WA"){
            yes[p]++;
        }
        //cout<<ans<<" "<<wa<<Endl;
    }
    
    cout<<ans<<" "<<wa<<Endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------









Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int a[200001];
typedef pair<int,int>P;
LL nxt[200011];
LL pre[200011];
bool check[200011];
LL nn(int x){
	//cout<<x<<" "<<nxt[x]<<endl;
	if(x==N-1)return x;
	if(nxt[x]==N-1)return nxt[x];
	if(check[nxt[x]+1]==true)return nxt[x]=nn(nxt[x]+1);
	//cout<<"b"<<endl;
	if(nxt[x]==x)return x;
	//cout<<"a"<<endl;
	return nxt[x]=nn(nxt[x]);
}
LL pp(int x){
	if(x==0)return x;
	if(pre[x]==0)return pre[x];
	if(check[pre[x]-1]==true)return pre[x]=pp(pre[x]-1);
	if(pre[x]==x)return x;
	return pre[x]=pp(pre[x]);
}

int main(){
	cin>>N;
	vector<P>v;
	REP(i,N){
		cin>>a[i];
		v.push_back(P(a[i],i));
		nxt[i]=i;
		pre[i]=i;
		check[i]=false;
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	LL ans=0;
	REP(i,N){
		check[v[i].second]=true;
		LL a=nn(v[i].second);
		LL b=pp(v[i].second);
		//cout<<v[i].second<<" "<<a<<" "<<b<<endl;
		ans+=((a-v[i].second+1)*(v[i].second-b+1))*v[i].first;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  ll n, a = 1; in(n);
  REP(i,1,sqrt(n)+1) {
    if (n % i == 0) a = i;
  }
  ll b = n / a;
  cout << a + b - 2 << endl;
  return 0;
}


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

int m[102][102];
int w, h, xs, ys, xg, yg, f, t;

void solve(int x, int y){
  if(x < 0 || y < 0 || x >= w || y >= h || f || m[x][y] == -1) return;
  if(x == xg && y == yg){
    f = 1;
    return;
  }
  m[x][y] = -1;
  if(m[x + 1][y] == t) solve(x + 1, y);
  if(m[x - 1][y] == t) solve(x - 1, y);
  if(m[x][y + 1] == t) solve(x, y + 1);
  if(m[x][y - 1] == t) solve(x, y - 1);
}

int main(void){
  int n, c, d, x, y;
  for( ; ; ){
    cin >> w >> h;
    if(!w && !h) break;

    for(int i = 0;i <= 101; i++)
      for(int j = 0;j <= 101; j++) m[i][j] = 0;

    cin >> xs >> ys >> xg >> yg >> n;
    xs--; ys--; xg--; yg--;

    for(int i = 0;i < n; i++){
      cin >> c >> d >> x >> y;
      x--; y--;
      if(!d){
        for(int i = 0;i < 4; i++) m[x + i][y] = m[x + i][y + 1] = c;
      } else {
        for(int i = 0;i < 4; i++) m[x][y + i] = m[x + 1][y + i] = c;
      }
    }

    f = 0;
    t = m[xs][ys];
    solve(xs, ys);

    cout << (f? "OK" : "NG") << endl;
  }
}


Measured memory_bytes: 1208
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<iomanip>
#include<map>
using namespace std;
typedef pair<int, pair<int, int> >PP;
typedef long long ll;
typedef pair<int, int>P;
typedef vector<int>vec;
int inf=-1;
ll mod = pow(10, 9) + 7;

int main(){
    int n,k,q,a[100010];
    int ans[100010];
    cin>>n>>k>>q;
    fill(ans,ans+n,0);
    for(int i=0;i<q;i++){
        cin>>a[i];
        ans[a[i]-1]++;
    }
    for(int i=0;i<n;i++){
        if(ans[i]+k-q>=1){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
        ans[i]=ans[i]+k-q;
    }
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long double PI = (acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int ctoi(char c)
{
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}
int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> vec(n + 1);
    for (int i = 0; i < q; i++)
    {
        int a;
        cin >> a;
        vec[a]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (vec[i] > q - k)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
 
main(){
    INCANT;
    int n, a, l, c, r, res = INF, w, x, y, z;
    string s;
    in(n);
    int sum[n + 1] = {};
    rep(i, 1, n + 1){
        in(a);
        sum[i] = sum[i - 1] + a;
    }
    l = 1, r = 3;
    rep(c, 2, n - 1){
        while(abs(sum[c] - 2 * sum[l]) > abs(sum[c] - 2 * sum[l + 1])){
            l++;
        }
        while(abs(sum[n] - sum[c] - 2 * (sum[r] - sum[c])) > abs(sum[n] - sum[c] - 2 * (sum[r + 1] - sum[c]))){
            r++;
        }
        w = sum[l], x = sum[c] - sum[l], y = sum[r] - sum[c], z = sum[n] - sum[r];
        chmin(res, max({w, x, y, z}) - min({w, x, y, z}));
    }
    print(res);
}

Measured memory_bytes: 1792
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    long x = Integer.parseInt(sc.next());
    for (long a = 0; ; a++) {
      long l5 = (long) Math.pow(a, 5);
      long idealB5 = l5 - x;
      if (idealB5 == 0) {
        pw.println(a + " " + 0);
      }
      if (idealB5 < 0) {
        long b = (long) Math.pow(-idealB5, 1d / 5d);
        if ((long) Math.pow(b, 5) == -idealB5) {
          pw.println(a + " " + -b);
          return;
        }
      } else {
        long b = (long) Math.pow(idealB5, 1d / 5d);
        if ((long) Math.pow(b, 5) == idealB5) {
          pw.println(a + " " + b);
          return;
        }
      }
    }
  }
}


Measured memory_bytes: 38612
#include<bits/stdc++.h>
using namespace std;
 
int main(){

    int n;
    cin >> n;

    vector<int> d(n);

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

    sort(d.begin(), d.end());
    int ans = 0;

    for(int i = d[n/2-1]; i < d[n/2]; ++i){
        ++ans;
    }
    cout << ans << endl;

}

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

int main () {
  char s[5];
  scanf("%s", &s);
  if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) puts("Yes");
  else puts("No");
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define range 200010
#pragma GCC optimize ("Ofast")
#define endl '\n'
signed main(){

//    freopen("test.txt","r",stdin);
    ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin>>n;
    double x = (int)(n/2);
    cout<<(n%2?(x+1)/n:0.5)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    char a;
    cin >> a;
    if(a == 'A'){
        cout << 'T' << endl;
    }else if(a == 'C'){
        cout << 'G' << endl;
    }else if(a == 'G'){
        cout << 'C' << endl;
    }else if(a == 'T'){
        cout << 'A' << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

struct PrimeNumbers {

    vector<bool> sieve;
    vector<long long> prime;

    PrimeNumbers (int n) : sieve(n+1,true) {
        sieve[0] = sieve[1] = false;
        for (long long i = 2; i < sieve.size(); i++) {
            if (sieve[i]) {
                prime.push_back(i);
                for (long long j = i * i; j < sieve.size(); j += i) {
                    sieve[j] = false;
                }
            }
        }
    }

    bool isPrime(long long n) {
        return sieve[n];
    }

    int size(void) {
        return (int) prime.size();
    }

    long long  operator [] (int n) {
        return  prime[n];
    }

};

int main ()
{
    PrimeNumbers p(55555);
    vector < ll > cnd;
    REP(i,p.size()) {
        if (p[i] % 5 == 1) {
            cnd.push_back(p[i]);
        }
    }

    int N; cin >> N;
    REP(i,N) cout << cnd[i] << " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 384
import 'dart:convert';
import 'dart:io';
import 'dart:async';

Future main() async {
  int n = int.parse(stdin.readLineSync());
  Stream<String> aLines =
      stdin.transform(utf8.decoder).transform(LineSplitter()); // ここ大事（複数行入力）
  int lineNum;
  lineNum = 1;
  List s = [];
  List a = [];
  await for (var line in aLines) {
    lineNum = lineNum + 1;
    a.add(int.parse(line));
    if (lineNum > n) break; // ここの場所！
  }

  int ans = -1;
  int j = 0;

  int c = a[0];
  for (int i = 1; i < n; i++) {
    if (c == 2) {
      print(i);
      return;
    }
    c = a[c - 1];
  }
  print(-1);
}


Measured memory_bytes: 32356
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int t = scan.nextInt();
		int sand = x - t;
		if(sand < 0) {
			sand = 0;
		}
		System.out.println(sand);
	}
}

Measured memory_bytes: 21844
package main

import (
	"fmt"
)

func main() {
	var d int
	fmt.Scan(&d)

	if d == 25 {
		fmt.Println("Christmas")
	} else if d == 24 {
		fmt.Println("Christmas Eve")
	} else if d == 23 {
		fmt.Println("Christmas Eve Eve")
	} else if d == 22 {
		fmt.Println("Christmas Eve Eve Eve")
	}

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define  ll  long long int
#define  sz  200010

using namespace std;

ll num[sz];
ll mn=LONG_LONG_MAX;

set<ll>st;


int main()
{

    ll n,a,d;

    cin>>n;

    while(n--)
    {
        cin>>a;
        st.insert(a);
    }
    d=st.size();

    cout<<d<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  string s;
  cin >> s;
  char c = s.back();
  if(c == '2' || c == '4' || c == '5' || c == '7' || c == '9')cout << "hon" << endl;
  else if(c == '0' || c == '1' || c == '6' || c == '8')cout << "pon" << endl;
  else cout << "bon" << endl;
  return 0;
}


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

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

class UnionFind {
private:
  int size_;
  vector<int> par, rank;
  
public:
  UnionFind() : size_(0), par(vector<int>(0)), rank(vector<int>(0)) {}
  UnionFind(int size_) : size_(size_) {
    par.resize(size_), rank.resize(size_);
    rep(i,size_) par[i] = i, rank[i] = 0;
  }
  
  // 現在のsize_を返す
  int size() { return size_; }
  
  // 親を返す
  int root(int x) { return (par[x] == x) ? x : par[x] = root(par[x]); }
  
  // ２つの頂点を連結する
  void unite(int x, int y) {
    x = root(x), y = root(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }
  
  // 親が同じかを判定する
  bool same(int x, int y) { return root(x) == root(y); }
};

struct edge {
  int u, v;
  edge() {}
  edge(int u, int v) : u(u), v(v) {}
};

int n, m;
edge e[100001];

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

  cin >> n >> m;
  rep(i,m){ 
    cin >> e[i].u >> e[i].v, e[i].u--, e[i].v--;
  }

  UnionFind uf(n);

  rep(i,m) {
    if (!uf.same(e[i].u, e[i].v)) {
      uf.unite(e[i].u, e[i].v);
    }
  }

  long long x, y, z = 0;
  x = 1, y = 1;

  for (int i = 2; i < n; ++i) {
    if (uf.same(0, i)) {
      x++;
    }
    else if (uf.same(1, i)) {
      y++;
    }
    else {
      z++;
    }
  }

  if (x >= y) {
    x += z;
  }
  else {
    y += z;
  }

  long long ans = x * (x - 1) / 2 + y * (y - 1) / 2 - m;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
while True:
    W,H = map(int,input().split())
    if W==0 and H==0:
        break
    for i in range(W):
        for k in range(H):
            if (i+k)%2==0:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()
"""
    if W%2==0:
        for i in range(W//2):
            print("#."*(H//2))
            print(".#"*(H//2))
        print()
    elif W%2==1:
        if H==1:
            print("#")
        print("#."*(H//2))
        for i in range(W//2):
            print("#."*(H//2))
            print(".#"*(H//2))
        print()

while True:

    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if (i+k)%2 == 0:
                print("#",end = "")
            else:
                print(".",end = "")
        print()
"""


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

using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	int len2= t.length();
	int ops = 0;
	char temp, temp2;
	do{
		if(ops > len2){
			cout << "No" << endl;
			return 0;
		}
		ops ++;
		for(int i = 0; i < len2; i ++){
			if(i == 0){
				temp = t[(i+1)%len2];
				t[(i+1)%len2] = t[i];
			}else{
				temp2 = t[(i+1)%len2];
				t[(i+1)%len2] = temp;
				temp = temp2;
			}
		}
	}while(s.compare(t) != 0);
	cout << "Yes" << endl;
	
}

Measured memory_bytes: 256