akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
using ll = long long;
class UnionFind
{
public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1)
    {
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_)
    {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x)
    { // 根の検索
        while (par[x] != x)
        {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y])
            swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y)
    { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x)
    { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main(void)
{
    int n, m, k;
    cin >> n >> m >> k;
    set<int> friends[n];
    vector<pair<int, int>> pairs;
    UnionFind uf(n);
    REP(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.merge(a, b);
        /*
        friends[a].insert(b);
        friends[b].insert(a);
        */
        pairs.push_back(make_pair(a, b));
    }
    for (auto p : pairs)
    {
        int a = p.first;
        int b = p.second;
        if (uf.issame(a, b))
        {
            friends[a].insert(b);
            friends[b].insert(a);
        }
    }

    REP(i, k)
    {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        if (uf.issame(c, d))
        {
            friends[c].insert(d);
            friends[d].insert(c);
        }
    }

    bool flg = true;
    REP(i, n)
    {
        int s1 = uf.size(i) - 1;
        int s2 = friends[i].size();
        if (flg)
        {
            cout << s1 - s2;
            flg = false;
        }
        else
        {
            cout << " " << s1 - s2;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 26612
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<iomanip>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007
#define MAXS(x,y) (x = max(x,y))
#define MINS(x,y) (x = min(x,y))

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

int N;

int main(){
  cin >> N;

  double dp[N+1][N+1];
  
  REP(i,N+1)REP(j,N+1)dp[i][j]=0;
  dp[0][0] = 1.0;

  vector<double> p(N);

  REP(i,N) cin >> p[i];

  REP(i,N){
    dp[i+1][0] = dp[i][0] * (1.0-p[i]);
    FOR(j,1,i+2){
      dp[i+1][j] = dp[i][j-1] * (p[i]) + dp[i][j] * (1.0-p[i]);
    }
  }

  double ans = 0;
  FOR(i, N/2+1, N+1){
    ans += dp[N][i];
  }
  cout << setprecision(10) << ans << endl;  
}

Measured memory_bytes: 70528
while true do
    n = gets.to_i
    break if n == 0

    answer = a = Array.new(n) { Array.new(n,0) }

    row = (n-1)/2+1
    col = (n-1)/2
    value = 1
    answer[row][col] = value
    value += 1

    size = n*n
    while value <= size do
        row = (row+1) % n
        col = (col+1) % n
        if answer[row][col] == 0
            answer[row][col] = value
            value += 1
        else
            row = (row+1) % n
            col = (col-1) % n
            answer[row][col] = value
            value += 1
        end
    end

    answer.each do |r|
        r.each do |e|
            print e.to_s.rjust(4)
        end
        puts
    end
end



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

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) cin >> P.at(i);
  
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (P.at(i) == i + 1) {
      swap(P.at(i), P.at(i + 1));
      ans++;
    }
  }
  if (P.at(N - 1) == N) {
    swap(P.at(N - 1), P.at(N - 2));
    ans++;
  }
  
  cout << ans << endl;
}

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

using namespace std;

int id, abcd[4];
string s;

int Hash() {
	if (isalpha(s[id])) return abcd[s[id++] - 'a'];
	if (s[id] == '[') {
		id++;
		char c = s[id++];
		int res = Hash();
		switch (c) {
		case '+': res |= Hash(); break;
		case '*': res &= Hash(); break;
		case '^': res ^= Hash(); break;
		}
		id++;
		return res;
	}
}

int main() {
	while (cin >> s, s != ".") {
		string p; cin >> p;
		for (int i = 0; i < 4; ++i) abcd[i] = p[i] - '0';
		int ans = 0, P = Hash();
		for (abcd[0] = 0; abcd[0] < 10; ++abcd[0])
			for (abcd[1] = 0; abcd[1] < 10; ++abcd[1])
				for (abcd[2] = 0; abcd[2] < 10; ++abcd[2])
					for (abcd[3] = 0; abcd[3] < 10; ++abcd[3], id = 0)
						if (P == Hash()) ans++;
		cout << P << " " << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
int a[100005];
long long sum1;
int k;
int A,B;
int main()
{
	int x;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[x]++;
		sum1+=x;
	}
	cin>>k;
	for(int i=1;i<=k;i++)
	{
		cin>>A>>B;
		a[B]+=a[A];
		sum1+=(B-A)*a[A];
		a[A]=0;
		cout<<sum1<<endl;
	}
}

Measured memory_bytes: 3932
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int A[4];
  A[3]=N%10;
  N/=10;
  A[2]=N%10;
  N/=10;
  A[1]=N%10;
  N/=10;
  A[0]=N%10;
  
  char op[3];
  
  for(int tmp=0;tmp<(1<<3);tmp++){
    bitset<3> s(tmp);
    
    int sum=A[0];
    
    for(int i=0;i<3;i++) {
      if(s.test(i)){
        sum+=A[i+1];
        op[i]='+';
      }
      else{
        sum-=A[i+1];
        op[i]='-';
      }
    }
    if(sum==7){
      break;
      
    }
  }
  cout<<A[0]<<op[0]<<A[1]<<op[1]<<A[2]<<op[2]<<A[3]<<"=7"<<endl;
  
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double theta = 2*M_PI*abs(60*h - 11 * m)/720;
  double c = sqrt(a*a + b*b - 2*a*b*cos(theta));
  printf("%.10lf\n",c);
}

Measured memory_bytes: 4164
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m,x,y = inpl()
res = 0
if n%2==0 and m%2==0 and n//2==x and m//2==y:
    res = 1
print((n*m)/2,res)

Measured memory_bytes: 63980
{-# LANGUAGE BangPatterns, OverloadedStrings #-}

import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  s <- getLine
  putStrLn $ solve s

solve s = if foldl1' (\a x -> if a /= x then 'Y' else x) s == 'Y'
  then "Yes"
  else "No"

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

Measured memory_bytes: 380
#include<stdio.h>

int main() {
  long long int a, b, x, c, ab, bc, ca, k, kk;
  
  scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
  
  kk = k / 2;
  
  while (kk != 0) {
    ab = a + a + b + c;
    bc = a + b + b + c;
    ca = a + b + c + c;
    kk--;
    k = k - 2;
  }
    
  
  while(k != 0) {
    ab = a + b;
    bc = b + c;
    ca = a + c;
    a = bc;
    b = ca;
    c = ab;
    k--;
  }
  
  x = a - b;
  
  if(x <= 1000000000000000000) {
    printf("%lld", x);
  }
  else {
    puts("Unfair");
  }
  return 0;
}


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

ll solve() {
    ll H, W;
    cin >> H >> W;
    ll ans = 0;
    if ( H == 1 ) return 1;
    if ( W == 1 ) return 1;
    if ( H & 1 ) {
        ans += W * (H/2);
        ans += (W+1)/2;
    } else {
        ans += W * (H/2);
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<string ,int > m; 
long long C(long long n)
{
	return (n*(n-1))/2;
}
long long ans;
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		string ss;
		cin>>ss;
		sort(ss.begin(),ss.end());
		ans+=m[ss];
		m[ss]++; 
	}
	cout<<ans<<endl;
	
}

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


class Main {
    void run() throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] ri = {"y","u","i","o","p","h","j","k","l","n","m"};

        while(true){
            int ans = 0;
            int pref = 2;
            String[] num = in.readLine().split("",0);
            if(Objects.equals(num[0],"#")) break;
            int flag = 0;
            for(int i = 0; i < num.length; i++) {
                if(Arrays.asList(ri).contains(num[i])){
                    flag = 1;
                }
                else{
                    flag = 0;
                }
                if(flag!=pref&&pref!=2){
                    ans+=1;
                }
                pref=flag;
            }
            System.out.println(ans);
        }
    }
    public static void main(String[] args) throws IOException{
        Main ma = new Main();
        ma.run();
    }
}

Measured memory_bytes: 27212
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll gcd(ll a, ll b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}//GCD

int l[1000005];

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    bool pairwise=1;
    bool setwise=1;
    ll now=1;
    rep(i,n){
        cin >> a[i];
        
        if(i==0){
            now=a[i];
        }else{
            now=gcd(now,a[i]);
        }
        
        int b=a[i];
        int temp=0;
        
        int d=2;
        while(b%d==0){
            temp++;
            b/=d;
        }
        if(l[d]>0&&temp>0)pairwise=0;
        l[d]+=temp;
        temp=0;
        for(d=3;d<=b&&b>1&&d<=sqrt(a[i])+1;d+=2){
            while(b%d==0){
                temp++;
                b/=d;
            }
            if(l[d]>0&&temp>0)pairwise=0;
            l[d]+=temp;
            temp=0;
        }
        if(b>1){
            if(l[b]>0)pairwise=0;
            l[b]++;
        }
    }
    if(now>1){
        setwise=0;
    }
    if(pairwise){
        cout<<"pairwise coprime"<<endl;
    }else if(setwise){
        cout<<"setwise coprime"<<endl;
    }else{
        cout<<"not coprime"<<endl;
    }
    return 0;
}

Measured memory_bytes: 14844
#include<bits/stdc++.h>
#define ll long long
#define reg register
using namespace std;
ll n,m,p,x,sum1,sum2,a[1005];
int main()
{
    scanf("%lld",&n);
    for(reg int i=1;i<=n;i++)
	{
        scanf("%lld",&a[i]);
        sum1+=a[i];
        sum2+=a[i];
    }
    scanf("%lld",&m);
    while(m--)
	{
        scanf("%lld%lld",&p,&x);
        sum1+=x>=a[p]?x-a[p]:-a[p]+x;
        printf("%lld\n",sum1);
        sum1=sum2;
    }
    return 0;
}

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

using namespace std;

int main() {
	int N, M;

	cin >> N >> M;
	vector<pair<long long, int>> shop(N);

	for (int i = 0; i < N; i++) {
		cin >> shop[i].first >> shop[i].second;
	}

	sort(shop.begin(), shop.end());

	long long ans = 0,i = 0;
	while (M > 0) {
		if (M <= shop[i].second) {
			ans += shop[i].first * M;
			M = 0;
		}
		else {
			M -= shop[i].second;
			ans += shop[i].first * shop[i].second;
		}
		i++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62


YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(X: int, Y: int):

    if Y%2:
        print(NO)
        return
    a = Y//2 - X
    if X- a < 0:
        print(NO)
        return
    if  a < 0:
        print(NO)
        return
    print(YES
          )
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 64888
#include <cstdio>

int main() {
  int a, b;
  scanf("%d%d", &a, &b);

  int d = a / b;
  int r = a % b;
  double f = 1.0 * a / b;

  printf("%d %d %f", d, r, f);

  return 0;
}


Measured memory_bytes: 2736
import java.util.Scanner;

public class Main {
	static String getFigure(Scanner sc) {
		StringBuilder str = new StringBuilder();
		int m = sc.nextInt();
		int startx = sc.nextInt();
		int starty = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int way;
		String dir = "";
		if (startx == x) {
			if (y - starty > 0) {
				way = 0;
			} else {
				way = 2;
			}
		} else {
			if (x - startx > 0) {
				way = 1;
			} else {
				way = 3;
			}
		}
		int length = Math.abs(x - startx) + Math.abs(y - starty);
		str.append(length);
		for (int j = 2; j < m; j++) {
			int nextx = sc.nextInt();
			int nexty = sc.nextInt();
			if (nextx == x) {
				if (nexty - y > 0) {
					dir = way == 1 ? "L" : "R";
					way = 0;
				} else {
					dir = way == 1 ? "R" : "L";
					way = 2;
				}
			} else {
				if (nextx - x > 0) {
					dir = way == 0 ? "R" : "L";
					way = 1;
				} else {
					dir = way == 0 ? "L" : "R";
					way = 3;
				}
			}
			str.append(dir);
			length = Math.abs(x - nextx) + Math.abs(y - nexty);
			str.append(length);
			x = nextx;
			y = nexty;
		}
		return str.toString();
	}

	private static String Reverse(String str) {
		StringBuilder origin_rev = new StringBuilder();
		StringBuilder num = new StringBuilder();
		for (char c : str.toCharArray()) {
			if (Character.isDigit(c)) {
				num.append(c);
			} else if (c == 'L') {
				origin_rev.insert(0, num);
				origin_rev.insert(0, 'R');
				num = new StringBuilder();
			} else {
				origin_rev.insert(0, num);
				origin_rev.insert(0, 'L');
				num = new StringBuilder();
			}
		}
		origin_rev.insert(0, num);
		return origin_rev.toString();

	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			String origin = getFigure(sc);
			String origin_rev = Reverse(origin);
			for (int i = 0; i < n; i++) {
				String figure = getFigure(sc);
				if (origin.equals(figure) || origin_rev.equals(figure)) {
					System.out.println(i + 1);
				}
			}
			System.out.println("+++++");
		}
	}
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    ll N, M;
    cin >> N >> M;
    ll cnt = 0;
    for (ll i = 1; i <= M / 2; ++i) {
        if (cnt == M) {
            break;
        }
        cout << i << " " << M + 1 - i << endl;
        ++cnt;
    }

    for (ll i = 1; i <= M / 2 + 1; ++i) {
        if (cnt == M) {
            break;
        }
        cout << M + i << " " << 2 * M + 2 - i << endl;
        ++cnt;
    }
}

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

int main(){
  int K, N;
  cin >> K >> N;
  vector<int> vec(0);
  for (int i = 0; i < K * 2 - 1; i++){
    vec.push_back(N - K + 1 + i);
  }
  sort(vec.begin(), vec.end());
  
  for (int i = 0; i < K * 2 - 1; i++){
    cout << vec[i] << " ";
    if (i + 1 == vec.size()){
      cout << endl;
    }
  }
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
#define PI 3.14159265358979323846
struct Point{ double x, y;};

double kock(int n, Point p1, Point p2){
    if(n == 0) return 0;

    double rad = PI * 60.0 / 180.0;
    Point s, t, u;

    s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
    s.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
    t.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
    t.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;
    
    u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
    u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;

    kock(n-1, p1, s);
    printf("%.8f %.8f\n", s.x, s.y);
    kock(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    kock(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    kock(n-1, t, p2);
}


int main(){

    int n; cin >> n;
    Point a = {0.0, 0.0}, b = {100.0, 0.0};
    printf("%.8f %.8f\n", a.x, a.y);
    kock(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);
    return 0;
}

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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
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;
}

signed main() {
	int n, v[114], c[114], ans = 0;
	cin >> n;
	rep(i, n) cin >> v[i];
	rep(i, n) cin >> c[i];
	rep(i, n) {
		if (v[i] > c[i]) {
			ans += v[i] - c[i];
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	
	cin>>n;
	int count;
	count=n;
	vector<int>d(n);

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

	sort(d.begin(),d.end());

	for(int i=0;i<n-1;i++){
		if(d.at(i)==d.at(i+1)){
			count--;
		}
	}

	cout<<count<<endl;
	return 0;
}

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

int main() {
  vector<int> An(5);
  for (int i = 0; i < 5; i++) {
    cin >> An.at(i);
  }
  int k, count;
  count = 0;
  cin >> k;
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if (An.at(i) - An.at(j) < -1 * k || An.at(i) - An.at(j) > k) {
        count++;
      }
    }
  }
  
  if (count == 0) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort(reverse=True)
ans = A[0]
cnt = 1
for x in A[1:]:
    if cnt == N-1:
        break
    if cnt == N-2:
        ans += x
        cnt += 1
    else:
        ans += 2*x
        cnt += 2
print(ans)


Measured memory_bytes: 33056
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'a')+1)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=100010;
//const ll Mod=1000000007;
const ll Mod=998244353;
using namespace std;

int h,w;
char s[200][200];

int v[200][200];

int dp[200][200];

int main()
{
    sync;
    cin>>h>>w;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cin>>s[i][j];
            dp[i][j]=100000;
        }
    }
    
    if(s[1][1]=='#')
        dp[1][1]=1;
    else
        dp[1][1]=0;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(s[i][j]=='#')
            {
                if(i!=1)
                {
                    if(s[i-1][j]=='.')
                        dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
                    else
                        dp[i][j]=min(dp[i][j],dp[i-1][j]);
                }
                if(j!=1)
                {
                    if(s[i][j-1]=='.')
                        dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
                    else
                        dp[i][j]=min(dp[i][j],dp[i][j-1]);
                }
            }
            else
            {
                if(i!=1)
                {
                    dp[i][j]=min(dp[i][j],dp[i-1][j]);
                }
                if(j!=1)
                {
                    dp[i][j]=min(dp[i][j],dp[i][j-1]);
                }
            }
//            cout<<dp[i][j]<<' ';
        }
//        cout<<endl;
    }
    cout<<dp[h][w]<<endl;
    
    return 0;
}


Measured memory_bytes: 384
import sys
read = sys.stdin.read
from math import gcd
def main():
    n, *a = map(int, read().split())
    r = gcd(a[0], a[1])
    if n == 2:
        print(r)
        sys.exit()
    for i1 in range(2, n):
        r = gcd(r, a[i1])
    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 20040
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] strlist = str.split(" ");
		int a = Integer.parseInt(strlist[0]);
		int b = Integer.parseInt(strlist[2]);
		int answer = 0;

		if(strlist[1].equals("+")){
			answer = a + b;
		}else {
			answer = a - b;
		}


		System.out.println(answer);


	}

}


Measured memory_bytes: 8148
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	int n,i,j,ans=0;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			int ind=lower_bound(a,a+n,(a[i]+a[j]))-a;
			ans+=(ind-(j+1));
		}
	}
	cout<<ans<<"\n";
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 3640
x=int(input())
z=x/100
x=x%100
f=0
j=0
m=0
for i in range(1,1000):
    if i>z:
        break
    else:
        j+=1
        m=6+5*(j-1)
        if x<m:
            f=1
            break
if f:
    print("1")
else:
    print("0")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N; cin >> N;
  ll res = 1;
  for (int i = 1; i <= N; ++i) {
    res *= i;
    res %= MOD;
  }
  cout << res << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>

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

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

int main(int argc, const char * argv[]) {
    ll a;
    string b;
    cin >> a >> b;
    
    for(ll i=b.size()-1; i>=0; i--){
        if(b[i]=='.'){
            b.erase(i, 1);
        }
    }
    long double bb = stoi(b);
    a = a * bb;
    
    string aa = to_string(a);
    if(aa.size()<3) aa= "0";

    cout << aa.substr(0, aa.size()-2);
    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<long> a(n);
    long sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int count = 0;
    for (int v : a) {
        if (v >= sum/(4.0*long(m))) {
            count++;
            if (count >= m) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

using namespace std;


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000007
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;
	for (int i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

vector<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	vi primes;
	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.pb(i);
	}
	return primes;
}



set<int> primeFactors(int  n)
{
	set<int> factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors.insert(2);

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		while (n % i == 0)
		{
			factors.insert(i);
			n /= i;
		}
	}
	if (n > 2)
		factors.insert(n);
	return factors;
}


// int power(int x, unsigned int y, int p)
// {
// 	int res = 1;     // Initialize result

// 	x = x % p; // Update x if it is more than or
// 	// equal to p

// 	if (x == 0) return 0; // In case x is divisible by p;

// 	while (y > 0)
// 	{
// 		// If y is odd, multiply x with result
// 		if (y & 1)
// 			res = (res * x) % p;

// 		// y must be even now
// 		y = y >> 1; // y = y/2
// 		x = (x * x) % p;
// 	}
// 	return res;
// }
// Graph------------------------------------------------------------------------
int32_t main()
{
	FIO;
	// c_p_c();
//--------------------------------------------------


	int n, k;
	cin >> n >> k;
	mk(arr, n, int);
	for (int i = 0; i < n; i++)
		cin >> arr[i];

	vector<int> dp(n, 1e9 + 5);
	dp[0] = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j <= i + k; j++)
		{
			if (j < n)
			{
				dp[j] = min(dp[j], dp[i] + abs(arr[i] - arr[j]));
			}

		}

	}

	cout << dp[n - 1] << endl;



}



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  int s = accumulate(all(l), 0);
  rep(i, n) if (s - l[i] <= l[i]) {
    out("No");
    return 0;
  }
  out("Yes");
}


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

using ll = long long;
#define pq priority_queue
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int t[] = {500, 100, 50, 10, 5, 1};
   while (1) {
      int n, ans = 0;
      cin >> n;
      if (n == 0) break;
      n = 1000 - n;
      for (int i = 0; i < 6; i++) {
         ans += n / t[i];
         n %= t[i];
      }
      cout << ans << endl;
   }
   return 0;
}


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-3;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll dp[1 << 17][2];
vector<int> G[1 << 17];
bool used[1 << 17];
int n;
void dfs(int id) {
	used[id] = true;
	vector<int> v;
	rep(j, G[id].size()) {
		int to = G[id][j];
		if (used[to])continue;
		dfs(to);
		v.push_back(to);
	}
	dp[id][0] = dp[id][1] = 1;
	rep(j, v.size()) {
		int to = v[j];
		(dp[id][0] *= (dp[to][0] + dp[to][1]) % mod) %= mod;
		(dp[id][1] *= dp[to][0]) %= mod;
	}
}
int main() {
	cin >> n;
	rep(i, n-1) {
		int x, y; cin >> x >> y; x--; y--;
		G[x].push_back(y); G[y].push_back(x);
	}
	dfs(0);
	ll ans = (dp[0][0] + dp[0][1]) % mod; cout << ans << endl;
	//stop
	return 0;
}

Measured memory_bytes: 16512
K,N=map(int,input().split())
a=[int(i) for i in input().split()]
a.append(a[0])

max=0
b=0
for i in range(N-1):
    b=a[i+1]-a[i]
    if(b>=max):
        max=b
    
m=K-a[i+1]+a[0]

if(m>max):
    max=m

kyori=K-max

print(kyori)


Measured memory_bytes: 77516
def count2(n):
	cnt = 0
	now = n
	while now % 2L == 0:
		cnt = cnt + 1L
		now = now / 2L
	return cnt

N = long(raw_input())
A = map(long, raw_input().split())
sum = 0L
for i in range(0, N):
	sum = sum + count2(A[i])
print sum

Measured memory_bytes: 3588
n = int(input())
lis = list(map(int,input().split()))
ans = 0
num = 0
for i in range(n-1):
  if lis[i] > lis[i+1]:
    ans += lis[i]-lis[i+1]
    lis[i+1] = lis[i]
print(ans)

Measured memory_bytes: 32380
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int r,g,b,n;
    cin >>r >> g >> b >> n;
    int ans = 0;
    REP(i,0,3001) REP(j,0,3001) {
        int bn = n - i * r - j * g;
        if (bn >= 0 && bn % b == 0) ++ans;
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

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

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

const int MAX_N = 2010;
ll fact[MAX_N], finv[MAX_N], inv[MAX_N];

void init_combination(ll p) {
    fact[0] = fact[1] = finv[0] = finv[1] = inv[1] = 1;
    for (int i = 2; i < MAX_N; ++i) {
        inv[i] = inv[p % i] * (p - p / i) % p;
        fact[i] = fact[i - 1] * i % p;
        finv[i] = finv[i - 1] * inv[i] % p;
    }
}

ll comb(int n, int k, ll p) {
    if (n < k || n < 0 || k < 0) return 0;
    return fact[n] * (finv[k] * finv[n - k] % p) % p;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    ll p = (ll) 1e9 + 7;
    cin >> n >> k;
    init_combination(p);
    for (int i = 1; i <= k; ++i) {
        cout << comb(k - 1, i - 1, p) * comb(n - k + 1, i, p) % p << "\n";
    }
}

Measured memory_bytes: 256
n, k, q = [int(v) for v in input().split()]
a_s = [int(input()) for _ in range(q)]
points = [0] * n

for a1 in a_s:
  a = a1 - 1
  points[a] += 1

for i in range(n):
  if k - (q - points[i]) > 0:
    print('Yes')
  else:
    print('No') 

Measured memory_bytes: 8644
#include <stdio.h>
long long a [100010];
int main (){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	int zero =0;
	for(int i=0;i<n;i++)if(a[i]==0) zero ++;
	if(zero >0){
		printf("0\n");
		return 0;
	}
	long long prod =1;
	for(int i=0;i<n;i++){
		if(a[i ] <=1000000000000000000/ prod ){
			prod *=a[i];
		}else{
			printf("-1\n");
			return 0;
		}
	}
	printf("%lld\n",prod );
}

Measured memory_bytes: 2456
#include <bits/stdc++.h>
#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 rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define ALL(i) (i).begin(),(i).end()
#define RALL(i) (i).begin(),(i).end(),greater<int>()
using namespace std;
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }

typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
// #define int long long

signed main(){
    int N;
    cin>>N;
    int C[TENFIVE],S[TENFIVE],F[TENFIVE];

    rep(i,N-1){
        cin>>C[i]>>S[i]>>F[i];
    }
    
    rep(i,N-1){
        ll time=S[i]+C[i];
        
        FOR(j,i+1,N-1){
            if(time<S[j])time =S[j];
            if(time % F[j] != 0 ){
                int rest = time % F[j];
                time += F[j] - rest;
            }
            time+=C[j];
            
        }
    print(time);
    }
    cout<<0<<endl;

    return 0;
}


Measured memory_bytes: 256
s=list(map(int,input().split()))
t=[int(input()) for i in range(s[2])]
a=s[1]-s[2]
list=[]
for i in range(s[0]):
  list.append(a)
for j in range(s[2]):
  list[t[j]-1]=list[t[j]-1]+1
for l in range(s[0]):
  if list[l]>0:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 10512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long

#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second


using namespace __gnu_pbds;
using namespace std;
const int mod=1e9+7;
 // const int mod=998244353;
 // const int mod=1e9+9;
const int INF=4e18+10;
// const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i;


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

template<typename T1,typename T2>
void set_min(T1& a, T2 b)
{
    a=min(a, (T1)b);
}


int multiply(int a, int b, int in_mod){return (a*b)%in_mod;}
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);

        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}


void solve()
{
    int x, y;
    cin>>x>>y;

    for(int c=0;c<=100;c++)
    {
        for(int t=0;t<=100;t++)
        {
            if(c+t== x)
            {
                if(2*c+4*t==y)
                {
                    cout<<"Yes"<<endl;
                    return;
                }
            }
        }
    }
    cout<<"No"<<endl;

}

signed main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen("INPUT.txt", "r", stdin);
        freopen("OUTPUT.txt", "w", stdout);
    }
#endif
    auto clk = clock();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------

    int t = 1;
    // cin>>t;

    for (int test = 1; test <= t; test++)
    {
        // cout<<"Case #"<<test<<": ";
        // cout<<endl;
        solve();
        // cout<<endl;
    }

    // -------------------------------------Code ends here------------------------------------------------------------------

    clk = clock() - clk;
    // cerr << fixed << setprecision(6) << "Time: " << ((long double)clk) / CLOCKS_PER_SEC << "\n";
    return 0;
}


Measured memory_bytes: 3652
#!/usr/bin/env python3
#CODEFESTIVAL2016Final C

import sys
import math
import bisect
import time
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])
    return par[x]

def union(x,y):
    x = root(x)
    y = root(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

n,m = LI()
par = [i for i in range(n)]
rank = [0]*n
language = [[] for _ in range(m)]
for i in range(n):
    a = LI()
    k = a[0]
    for j in range(1,k+1):
        language[a[j]-1].append(i)
for i in range(m):
    l = len(language[i])
    for j in range(l-1):
        if root(language[i][j]) != root(language[i][j+1]):
                union(language[i][j],language[i][j+1])
for i in range(m)[::-1]:
    l = len(language[i])
    for j in range(l-1):
        if root(language[i][j]) != root(language[i][j+1]):
            union(language[i][j],language[i][j+1])
for i in range(n-1):
    if par[i] != par[i+1]:
        print('NO')
        quit()
print('YES')


Measured memory_bytes: 83228
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def main():
    *s,=map(len,input().split("T"))
    x,y=map(int,input().split())
    start=s[0]
    n=s[2::2]
    m=s[1::2]
#    print(n,m)
    dx={start}
    dy={0}
#    print(dx)
    for i in n:
        dx={r+j for j in dx for r in{-i,i}}
#        print(dx)
    for i in m:
        dy={r+j for j in dy for r in{-i,i}}
#        print(dy)
    if x in dx and y in dy:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 5876
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
      Scanner sc = new Scanner(System.in);
      int k = sc.nextInt();
      int s = sc.nextInt();
      sc.close();
      int answer = 0;
      for (int x=0; x<=k; x++) {
        for (int y=0; y<=k; y++) {
          int z = s - x - y;
          if (z >= 0 && z <= k){
            answer++;
          }
        }
      }
      System.out.println(answer);
    }
}


Measured memory_bytes: 25300
# include<bits/stdc++.h>
# define LL long long
using namespace std;
string a,b;
map<char,int> ma,ma1;
char A[201];
int main()
{
	cin>>a>>b;
	a+=a;
	if(a.find(b)==string::npos) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
// SPDX-License-Identifier: X11
// 2020-06-28

#include <stdio.h>

int main(void) {
  long N;
  scanf("%ld", &N);

  long n = 0,
       m;
  for (long i = 1; i <= N; i++) {
    m = N / i;
    n += i * m * (m + 1) / 2;
  }

  printf("%ld\n", n);
}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

typedef long long ll;

void add_mod(ll& val, ll add_val) {
	val = (val + add_val) % 100000007;
}

int main (int argc, char* argv[]) {
	int n, k;
	cin >> n >> k;
	int res = 0;
	for (int i = 0; i < n; i++) {
		int c;
		cin >> c;
		if (c >= k) {
			res++;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256