akhauriyash/Code-Regression huggingface dataset:
import copy ; import sys ;input = sys.stdin.readline; sys.setrecursionlimit(11451419);from collections  import deque 
n=int(input())
G=[[] for i in range(n)]
for i in range(n):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
seen=[0 for i in range(n)]

hist=deque([]) #頂点の訪問履歴
pos=-1  #サイクルの1成分 -1はサイクル未発見

def dfs(x,p):  #pはxの親
    global pos #global!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    seen[x]=1
    hist.append(x)  #訪れたらhistにappend
    for to in G[x]:
        if to==p:continue  #親なら無視
        if seen[to]==1:
            pos=to
            return    #サイクルを発見したら、即すべてのdfsを終える
        #残りはseen[x]=0のみ
        dfs(to,x)
        if pos != -1:return  #帰りがけ、サイクルが検出済みなら何もしない
    hist.pop()  #stackの末尾を消す
    #ループなく平和に終わったらpopできる
    return  #まあなくてもいいけどreturnは終了であることを強調

dfs(0,-1)

#この状態だと、サイクルに入る前に通った枝葉がhistに入ってる。
#枝葉が終わったら、posからループの順番に頂点番号が入ってる。
cycle=set([])
while hist:
    qwe=hist.pop()
    cycle.add(qwe)
    if qwe==pos:break
    #そっかこっちの方が速いよね～～～～～indexだとちょっとアレだよね～～～～～～～～～～～～～～～～～～～～～～はい
    
m=int(input())
for i in range(m):
    a,b=map(int,input().split())
    if a-1 in cycle  and  b-1 in cycle:
        print(2)
    else:
        print(1)



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

using ll = long long;
using ull = unsigned long long;

using namespace std;

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

    ll a,b;
    cin>>a>>b;
    cout<<6-(a+b)<<'\n';

    return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, a, b = na()
mod = 1000000007

def comb(n, r, mod):
    if n < 0 or r < 0 or r > n: return 0
    nu = 1
    de = 1
    for i in range(r):
        nu = nu * (n-i) % mod
        de = de * (i+1) % mod
    return nu * inv(de, mod) % mod

def inv(a, mod):
    b = mod
    p, q = 1, 0
    while b > 0:
        c = a//b
        d = a; a = b; b = d % b
        d = p; p = q; q = d-c*q
    return p+mod if p < 0 else p

print((pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) + 2*mod + mod - 1)%mod)


Measured memory_bytes: 39152
f = open(0)
N, M, L = map(int, f.readline().split())
A = [list(map(int, f.readline().split())) for i in range(N)]
B = [list(map(int, f.readline().split())) for i in range(M)]
C = [[0]*L for i in range(N)]
for i in range(N):
    for j in range(L):
        C[i][j] = str(sum(A[i][k]*B[k][j] for k in range(M)))
for line in C:
    print(*line)


Measured memory_bytes: 7276
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, P;
    cin >> N >> P;
    vector<int> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    vector<vector<ll>> dp(N + 1, vector<ll>(5050, 0));
    dp[0][0] = 1;
    rep(i, 0, N) rep(j, 0, 5050) {
        dp[i + 1][j] += dp[i][j];
        if (j + A[i] < 5050) {
            dp[i + 1][j + A[i]] += dp[i][j];
        }
    }
    ll ans = 0;
    rep(i, 0, 5050) {
        if (i % 2 == P) {
            ans += dp[N][i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int N, D, Q;
ll d[500100], pos[500100], mxs[500100];

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

    std::cin >> N >> D;
    for(int i=1;i<=N;++i){
        std::cin >> d[i];
    }

    pos[0] = D;
    for(int i=0;i<N;++i){
        int nd = abs(pos[i] - d[i + 1]);
        if(nd < pos[i]){
            pos[i + 1] = nd;
        }else{
            pos[i + 1] = pos[i];
        }
    }

    // for(int i=0;i<=N;++i){
    //     std::cout << pos[i] << " -> ";
    // }
    // std::cout << std::endl;
    
    ll mx = 0;
    for(int i=N;i>0;--i){
        int t = d[i];
        if(t <= mx * 2 + 1){
            mx += t;
        }
        mxs[i - 1] = mx;
    }

    // for(int i=0;i<=N;++i){
    //     std::cout << mxs[i] << " -> ";
    // }
    // std::cout << std::endl;
    
    std::cin >> Q;
    for(int i=0;i<Q;++i){
        ll q;
        std::cin >> q;

        bool can = true;
        if(pos[N] != 0){
            
        }else if(pos[q - 1] == 0){
            can = false;
        }else if(pos[q - 1] <= mxs[q]){
            can = false;
        }

        static string YESNO[2] = {"NO", "YES"};
        std::cout << YESNO[can] << std::endl;
    }
}


Measured memory_bytes: 13696
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

win_lose = ['w']*k
ans = 0
for i in range(n):
    if i <= k-1:
        if t[i] == 'r':
            ans += p
        elif t[i] == 's':
            ans += r
        else:
            ans += s
    else:
        if t[i-k] == t[i]:
            if win_lose[i-k] == 'w':
                win_lose.append('l')
            else:
                if t[i] == 'r':
                    ans += p
                elif t[i] == 's':
                    ans += r
                else:
                    ans += s
                win_lose.append('w')
        else:
            if t[i] == 'r':
                ans += p
            elif t[i] == 's':
                ans += r
            else:
                ans += s
            win_lose.append('w')

print(ans)


Measured memory_bytes: 4212
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<math.h>
using namespace std;

int main(){
    
    int N, K;
    cin >> N >> K;
    vector<int> A(N+10,0);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }
    
    vector<int> res(N+10, 0);
    int alltot=0;
    for(int i=0; i<N; i++){
        res.at(A.at(i))++;
    }
        sort(res.begin(), res.end(), greater<int>());
    for(int i=0; i<N; i++){
        alltot+=res.at(i);
    }
    

    int tot=0;
    for(int i=0; i<K; i++){
        tot+=res.at(i);
    }
    
    //cout << "alltot=" << alltot << " tot=" << tot << endl;
    
    //for(int i=0; i<N; i++){
        //cout << i << " " << res.at(i) << endl;
    //}
    
    cout << alltot - tot << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		switch(n){
			case 1:
				System.out.println("Hello World");
				break;
			case 2:
				System.out.println(sc.nextInt()+sc.nextInt());
		}
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <math.h>
int main()
{
	int x, a, b, A, B;
	scanf("%d %d %d",&x,&a,&b);
	A = abs(x - a);
	B = abs(x - b);
		if (B > A)
		printf("A");
	else
		printf("B");
		
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt(); sc.nextLine();
        String S = sc.nextLine();
        int count = 0;
        for (int i = 0; i < S.length(); i++) {
            if (S.startsWith("ABC", i)) {
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	string s;
	cin>>s;
	char c=s[0];
	int ans=1,flag=1;
	for(int i=1;i<4;++i){
		if(s[i]==c) ++ans;
		else{
			c=s[i];
			ans=1;
		}
		if(ans==3){
			cout<<"Yes";
			flag=0;
			break;
		}
	}
	if(flag==1) cout<<"No";
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

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



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	c := nextInt()
	cnt := 0

	// そもそも1回もできない場合
	if a%2 == 1 || b%2 == 1 || c%2 == 1 {
		fmt.Println("0")
		return
	}

	// 連立方程式を解いた
	if a == (b+c)/2 && b == (a+c)/2 && c == (a+b)/2 {
		fmt.Println("-1")
		return
	}

	for i := 0; i < 1000; i++ {
		atmp := b/2 + c/2
		btmp := a/2 + c/2
		ctmp := a/2 + b/2
		a = atmp
		b = btmp
		c = ctmp

		cnt++
		if a%2 == 1 || b%2 == 1 || c%2 == 1 {
			break
		}
	}

	fmt.Println(cnt)

}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
a = input()
c = map(int,list(a))
b = []
for i in c:
    b.append(i)
if(b[0] + b[1] + b[2] + b[3]==7):
    print(a[0]+"+"+a[1]+"+"+a[2]+"+"+a[3]+"=7")
elif(b[0] + b[1] + b[2] - b[3]==7):
    print(a[0]+"+"+a[1]+"+"+a[2]+"-"+a[3]+"=7")
elif(b[0] + b[1] - b[2] + b[3]==7):
    print(a[0]+"+"+a[1]+"-"+a[2]+"+"+a[3]+"=7")
elif(b[0] + b[1] - b[2] - b[3]==7):
    print(a[0]+"+"+a[1]+"-"+a[2]+"-"+a[3]+"=7")
elif(b[0] - b[1] + b[2] + b[3]==7):
    print(a[0]+"-"+a[1]+"+"+a[2]+"+"+a[3]+"=7")
elif(b[0] - b[1] + b[2] - b[3]==7):
    print(a[0]+"-"+a[1]+"+"+a[2]+"-"+a[3]+"=7")
elif(b[0] - b[1] - b[2] + b[3]==7):
    print(a[0]+"-"+a[1]+"-"+a[2]+"+"+a[3]+"=7")
elif(b[0] - b[1] - b[2] - b[3]==7):
    print(a[0]+"-"+a[1]+"-"+a[2]+"-"+a[3]+"=7")

Measured memory_bytes: 3188
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

const ll MAX_N=100,MAX_W=100000;
ll N,W;
ll w[MAX_N],v[MAX_N];
ll dp[MAX_N+1][MAX_W+1];

void solve(){
    dp[0][0]=0;
    for(int i=1;i<=N;i++){
        for(int j=0;j<=W;j++){
            dp[i][j]=dp[i-1][j];
            if(j-w[i-1]>=0) dp[i][j]=max(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }
    cout<<dp[N][W]<<endl;
}

int main(){
    cin>>N>>W;
    rep(i,N) cin>>w[i]>>v[i];
    solve();
}

Measured memory_bytes: 78336
#include <stdio.h>
#include <string.h>
 
int main(void){
  int K;
  scanf("%d",&K);
  char S[100];
  scanf("%s",S);
  
  if(strlen(S)>K){
    int i=0;
    while(i != K){
      printf("%c",S[i]);
      i++;
    }
    printf("...\n");
  }else{
    printf("%s\n",S);
  }
  return 0;
}

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

int main() {

	int a, b, c; cin >> a >> b >> c;
	bool can = false;
	for (int i = 1; i <= b; i++) {
		if (a * i % b == c) {
			can = true;
			break;
		}
	}
	if (can) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    int ans = 0;
    rep(i, h){
        cin >> s.at(i);
        rep(j, w) if(s.at(i).at(j) == '.') ans++;
    }
    s.at(0).at(0) = '$';
    int f = 0;
    for(int l=0; l>=0; l++){
        rep(i, h){
            rep(j, w){
                if(s.at(i).at(j) == '$'){
                    if(i-1 >= 0) if(s.at(i-1).at(j) == '.') s.at(i-1).at(j) = 'k';
                    if(i+1 < h) if(s.at(i+1).at(j) == '.') s.at(i+1).at(j) = 'k';
                    if(j-1 >= 0) if(s.at(i).at(j-1) == '.') s.at(i).at(j-1) = 'k';
                    if(j+1 < w) if(s.at(i).at(j+1) == '.') s.at(i).at(j+1) = 'k';
                }
            }
        }
        rep(i, h){
            rep(j, w){
                if(s.at(i).at(j) == '$') s.at(i).at(j) = '&';
            }
        }
        rep(i, h){
            rep(j, w){
                if(s.at(i).at(j) == 'k') s.at(i).at(j) = '$';
            }
        }
        if(s.at(h-1).at(w-1) == '$'){
            ans -= l+2;
            break;
            break;
        }
        if(l == 120){ f = 1; break; break;}
    }
    if(f == 0){
        cout << ans << endl;
    }else{
        cout << -1 << endl;}
    return 0;
}

Measured memory_bytes: 256
import math


def calc_energy_sum(x_list, p):
    energy_list = [(x - p) ** 2 for x in x_list]
    energy_sum = sum(energy_list)
    return energy_sum


N = int(input())
X_list = [int(s) for s in input().split()]

p = sum(X_list) / len(X_list)
# print(p)

p_l = math.floor(p)
# print(p_l)
energy_sum_l = calc_energy_sum(X_list, p_l)
# print(energy_sum_l)

p_u = math.ceil(p)
# print(p_u)
energy_sum_u = calc_energy_sum(X_list, p_u)
# print(energy_sum_u)

energy_sum = min([energy_sum_l, energy_sum_u])
print(energy_sum)


Measured memory_bytes: 3064
import java.util.*;
public class Main{

	public static void main(String[]args){
		Scanner scan  = new Scanner(System.in);
		int n = scan.nextInt();
		int[] h = new int[n+1];
		for(int i=1;i<=n;i++){
			h[i] = scan.nextInt();
		}
		int[] dp = new int[n+1];
		Arrays.fill(dp,-1);
		jump(1,n,h,dp);
		System.out.println(dp[1]);
	}
	public static int jump(int i,int n,int []h,int[] dp){
//		System.out.println("start "+i);
		if(i==n) return 0;
		if(i>n) return (int)1e5;
		if(dp[i]!=-1)return dp[i];
		int k = 100005;
		int g = 100005;
		if(i+1<=n){
			k = Math.abs(h[i+1]-h[i])+jump(i+1,n,h,dp);
			//System.out.println("k= "+k+" "+i+"->"+(i+1));
		}
		if(i+2<=n){
			g = Math.abs(h[i+2]-h[i])+jump(i+2,n,h,dp);
			//System.out.println("g= "+g+" "+i+"->"+(i+2));
		}
		dp[i]=Math.min(k,g);
		return dp[i];

	}
}


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

int main() {
  int n; cin>>n;
  string s; cin>>s;
  string t; cin>>t;
  for(int i=0;i<=n;i++) {
    if (s.substr(i,n-i)==t.substr(0,n-i)) {
      cout<<n+i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 2000003;
const int MOD = 1000000007;

//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

        signed main() {
    cout<<fixed<<setprecision(15);
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        for(int i=0;i<n;i++){
                if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0){
                        cout<<"DENIED";
                        return 0;
                }
        }
        cout<<"APPROVED";

        }


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int A = sc.nextInt();
      	int B = sc.nextInt();
      	int C = sc.nextInt();
      	int K = sc.nextInt();
      
      	if(K <= A){
        	System.out.println(K);
        }else if(K <= A+B){
        	System.out.println(A);
        }else{
        	System.out.println(2*A-K+B);
        }
    }
}

Measured memory_bytes: 26780
package main

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

func main() {
	fmt.Println(resolve(parseProblem(os.Stdin)))
}

func parseProblem(r io.Reader) int {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines

	return scanInt(sc)
}

func resolve(n int) int {
	t := eratosthenes(8 * n)
	for i := n; i < len(t); i++ {
		if t[i] {
			return i
		}
	}
	// may not pass here
	return -1
}

func isPrime(n int) bool {
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func eratosthenes(n int) []bool {
	t := make([]bool, n)
	for i := 2; i < len(t); i++ {
		t[i] = true
	}
	for i := 2; i < len(t); i++ {
		if !t[i] {
			continue
		}
		for j := 2; j*i < len(t); j++ {
			t[j*i] = false
		}
	}
	return t
}

func primes(n int) chan int {
	ch := make(chan int)
	go func() {
		t := eratosthenes(n)
		for i := 2; i < len(t); i++ {
			if !t[i] {
				continue
			}
			ch <- i
		}
		close(ch)
	}()
	return ch
}

func primeFactories(n int) (terms map[int]int) {
	terms = map[int]int{}
	num := n
	for f := 2; f*f <= n; f++ {
		if num%f != 0 {
			continue
		}
		terms[f] = primeExponent(num, f)
	}
	if num > 1 {
		terms[num] = 1
	}
	return
}

func primeExponent(n, p int) (ex int) {
	for n%p == 0 {
		n /= p
		ex++
	}
	return
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1408
n,k,q=[int(i) for i in input().split()]
ini = [k]*(n)
pre=[0]*(n+2)
for i in range(q):
    a=int(input())
    pre[1]+=1
    pre[a]-=1
    pre[a+1]+=1
    pre[n+1]-=1
    #print(*pre)
for i in range(1,n+2):
    pre[i]+=pre[i-1]
for i in range(len(ini)):
    ini[i]-=pre[i+1]

for i in ini:
    if(i>0):
        print('Yes')
    else:
        print('No')



Measured memory_bytes: 11780
#include<iostream>

using namespace std;

int main() {


	int n, m;

	int b[25];
	int a[25];
	int c;
	int ans = 0;
	cin >> n >> m >> c;

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

	for (int i = 0; i < n; i++) {
		int calc = 0;
		for (int i = 0; i < m; i++) {
			cin >> a[i];
			calc += a[i] * b[i];
		}
		calc += c;

		if (calc > 0) {
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3628
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

n = int(input())
if n >= 15002:
  if n % 2 == 0:
    a = [i*2 for i in range(1,15001)] + [i*6 + 3 for i in range(n - 15000)]
  else:
    a = [i*2 for i in range(1,15000)] + [i*6 + 3 for i in range(n - 14999)]
  print(*a)
elif n == 3:
  print(*[2,5,63])
else:
  b = prime_factors((n-1)*(n-2))
  b.sort()
  c = 0
  for i in b:
    if i >= 3:
      c = i
      break
  d = [i*2 for i in range(1,n-1)] + [c,c*3]
  print(*d)

Measured memory_bytes: 4556
using System;
using System.Linq;

namespace ABC085_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var d = new int[N];
            for (int i = 0; i < N; i++)
                d[i] = int.Parse(Console.ReadLine());
            Console.WriteLine(d.Distinct().Count());

        }
    }
}


Measured memory_bytes: 13276
#include<stdio.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MIN(a,b) ((a)<(b)?(a):(b))

void run (void) {
  i64 l, r;
  scanf ("%" SCNi64 "%" SCNi64, &l, &r);
  const i32 mod = 2019;
  i32 min = mod;
  for (i64 i = l; i < r && i < l + mod; ++i) {
    for (i64 j = i + 1; j <= r && j < i + mod; ++j) {
      min = MIN (min, i * j % mod);
    }
  }
  printf ("%" PRIi32 "\n", min);
}

int main (void) {
  run();
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i =0; i < (n); i++)
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s.at(i);
  
  map<string,int> mp;
  rep(i,n) mp[s.at(i)]++;
  
  int max_count = 0;
  for (auto i : mp) {
    int count = 0;
    count = i.second;
    max_count = max (max_count, count);
  }
  
  for (auto i : mp) {
    if (i.second == max_count) {
      cout << i.first << endl;
    }
  }
}

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

int days(int y, int m, int d){
    --y; --m; --d;
    int ret = 195 * y + y / 3 * 5 + m * 19 + (m+1) / 2 + d;
    if(y%3 == 2){
        ret += m / 2;
    }
    return ret;
}

int main(){
    int N;
    for(scanf("%d", &N); N--;){
        int y, m, d;
        scanf("%d%d%d", &y, &m, &d);
        printf("%d\n", days(1000, 1, 1) - days(y, m, d));
    }
    return 0;
}

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

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

ll lcm(ll a, ll b){
  return a/gcd(a,b) * b;
}
ll func2(ll n){
  ll res = 0;
  while(n%2 == 0){
    n /= 2;
    res++;
  }
  return res;
}

ll zyou(ll a,ll b){//a＾b
  ll res = 1;
  for(int i = 1;i<=b;i++){
    res *= a;
  }
  return res;
}
struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t),weight(w){ }
};

typedef pair<int,int> P;
using Graph = vector<vector<Edge>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}



bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int dfs(int x,int y,int H,int W,vector<vector<char>> &masu){
  if(masu[x][y] == '#'){

  }
}
bool palin(string S){
  int n = S.size();
  bool flag = true;
  if(n%2 == 0){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  else if(n%2 == 1){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  return flag;
}
int main(){
  double L;
  cin >> L;
  cout << fixed << setprecision(10);
  cout << (L/3)*(L/3)*(L/3) << endl;
}

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

class TreeNode{
    private:
    vector<TreeNode*> neighbors;
    public:
    void clear(){
        this->neighbors.clear();
    }
    void addNeighbor(TreeNode *neighbor){
        this->neighbors.push_back(neighbor);
    }
    int numOfNeighbors(){
        return (int)this->neighbors.size();
    }
    TreeNode *getNeighbor(const int offset){
        return this->neighbors[offset];
    }
} tree[2048];

int nodetest(TreeNode *node, TreeNode *prev, const int curdist, const int maxdist){
    int cnt=0;
    if(curdist>maxdist){
        cnt++;
    }
    for(int i=0; i<node->numOfNeighbors(); i++){
        TreeNode *neighbor=node->getNeighbor(i);
        if(neighbor==prev){
            continue;
        }
        cnt+=nodetest(neighbor, node, curdist+1, maxdist);
    }
    return cnt;
}

int edgetest(TreeNode *u, TreeNode *v, const int maxdist){
    return nodetest(u, v, 0, maxdist)+nodetest(v, u, 0, maxdist);
}

int minRemove(TreeNode *node, TreeNode *prev, const int maxlen){
    int foo=0x3f3f3f3f;
    if(!(maxlen&1)){
        foo=min(foo, nodetest(node, NULL, 0, maxlen>>1));
    }
    for(int i=0; i<node->numOfNeighbors(); i++){
        TreeNode *neighbor=node->getNeighbor(i);
        if(neighbor==prev)continue;
        if(maxlen&1){
            foo=min(foo, edgetest(node, neighbor, (maxlen-1)>>1));
        }
        foo=min(foo, minRemove(neighbor, node, maxlen));
    }
    return foo;
}

int main(){
    int n, m;
    while(scanf("%d%d", &n, &m)!=EOF){
        for(int i=0; i<n; i++)tree[i].clear();
        for(int i=1; i<n; i++){
            int u, v;
            scanf("%d%d", &u, &v);
            u--;
            v--;
            tree[u].addNeighbor(&tree[v]);
            tree[v].addNeighbor(&tree[u]);
        }
        printf("%d\n", minRemove(&tree[0], NULL, m));
    }
    return 0;
}


Measured memory_bytes: 640
// c-forbidden-list.yml
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
template <typename V> using uset = unordered_set<V>;
template <typename K, typename V> using umap = unordered_map<K, V>;
template <typename C> int sz(C &v) { return v.size(); }

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

    int X, N;
    cin >> X >> N;

    vector<bool> good(102, true);
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        good[x] = false;
    }

    int best = 1e9, besti = 1e9;
    for (int i = 0; i < 102; i++) {
        if (good[i]) {
            int d = abs(i - X);
            if (d < best)
                best = d, besti = i;
            else if (d == best)
                besti = min(besti, i);
        }
    }

    cout << besti << '\n';

    return 0;
}



Measured memory_bytes: 3660
import collections as c
import sys
input = sys.stdin.readline
ip = lambda : map(int, input().split())
mod = 10**9+7
# ##############
N = int(input())
dic = {}
for i in range(N):
    s = input()
    s = s[:-1]
    dic[s] = dic.get(s,0) + 1
m = max(dic.values())
ans = []
for i in dic:
    if dic[i]==m:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 32480
#include <iostream>
using namespace std;
int main(void){
    long long N,ans = 0,max = 0;
    cin >> N;
    int A[N];
    for(int i = 0;i < N;i++){
        cin >> A[i];
    }
    
    for(int i = 0;i < N;i++){
        while(1){
            if(A[i] < max){
                A[i]++;
                ans++;
            }else{
                break;
            }
        }
        max = A[i];
    }
    
    cout << ans << endl;
    
}

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

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

    int l = 0;
    int r = 1;
    vector<vector<int>> appeared_at(26);

    for (int i = 0; i < s.size(); i++)
    {
        appeared_at[s[i] - 'a'].push_back(i + 1);
    }

    for (int i = 0; i < 26; i++)
    {
        if (appeared_at[i].size() < 2)
        {
            continue;
        }
        for (int j = 0; j < appeared_at[i].size() - 1; j++)
        {
            for (int k = j + 1; k < appeared_at[i].size(); k++)
            {
                if ((appeared_at[i][k] - appeared_at[i][j] + 1) < 2 * (k - j + 1))
                {
                    cout << appeared_at[i][j] << " " << appeared_at[i][k] << endl;
                    return 0;
                }
            }
        }
    }
    cout << "-1 -1" << endl;
}


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

using namespace std;

#define int long long
#define INT int
#define MOD 1000000007

#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>()
#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;

signed main()
{

    double pi = 3.141592653589793;

    double a, b, h, m;
    cin >> a >> b >> h >> m;
    // 角度
    double l, t;

    t = 6.0 * m;
    l = 30.0 * h + m / 2.0;

    // 差
    double s = max(t - l, l - t);
    s = min(s, 360.0 - s);

    double r = s / 180.0 * pi;

    double temp = a * a + b * b - 2.0 * a * b * cos(r);

    double ans = sqrt(temp);

    cout << std::fixed << std::setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 4256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <queue>

#define pb push_back
     
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
     
bool debug = false;
     

struct state
{
    ll a,b,c;

    state(ll a, ll b, ll c) : a(a), b(b), c(c)
    {

    }

  bool operator==(const state &other) const
  { return (a == other.a
            && b == other.b
            && c == other.c);
  }
};


struct KeyHasher
{
    size_t operator()(const state& k) const
  {
    //using std::size_t;
    //using std::hash;
    //using std::string;

    return ((hash<ll>()(k.a)
               ^ (hash<ll>()(k.b) << 1)) >> 1)
               ^ (hash<ll>()(k.c) << 1);
  }
};  


void solve(ll casen)
{
    ll res = 0;
    
    cout << "Case #" << casen << ": " << res << endl;
}

int main()
{
    // $ g++ -std=c++14 -Wshadow -Wall -o c C.cpp

    // !!! Here, unordered map was too slow!!!
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    
   ll a,b;
   cin >> a;
   cout << a + a*a + a*a*a << endl;
  

    return 0;
}

Measured memory_bytes: 3596
n = int(input())
s = []
for i in range(n):
  s.append(input())

ls = []
rs = []
tot = 0
for si in s:
  b = 0
  h = 0
  for c in si:
    if c == '(':
      h += 1
    else:
      h -= 1
    b = min(h,b)
  if h > 0:
    ls.append((b,h))
  else:
    rs.append((b-h,-h))
  tot += h
ls.sort(reverse = True)
rs.sort(reverse = True)

def check(x):
  t = 0
  for bx,hx in x:
    if t+bx < 0:
      return False
    t += hx
  return True

if check(ls) and check(rs) and tot == 0:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 185596
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

bool comp(ii a, ii b) {
	if(a.ss < b.ss) return true;
	else if(a.ss > b.ss) return false;
	else if(a.ff > b.ff) return true;
	else return false;
}

void solve() {
	int n;
	cin >> n;
	
	vii p(n);
	for(int i = 0; i < n; i++) cin >> p[i].ff >> p[i].ss;
	
	sort(all(p), comp);
	ll t = 0;
	for(int i = 0; i < n; i++) {
		t += p[i].ff;
		if(t > p[i].ss) {
			cout << "No" << endl;
			return;
		}
	}
	
	cout << "Yes" << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 4800
s=input()

if s[0]==s[1] and s[0] != s[2] and s[2]==s[3]:print('Yes')
elif s[0]==s[2] and s[0]!=s[1] and s[1]==s[3]:print('Yes')
elif s[0]==s[3] and s[0]!=s[1] and s[1]==s[2]:print('Yes')
else :
  print('No')

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

int main()
{
    int n[3], k;
    cin >> n[0] >> n[1] >> n[2] >> k;
    sort(n, n+3);
    cout <<  n[2]*(int)pow(2, k)+n[1]+n[0]<< "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i)

string alpha = "abcdefghijklmnopqrstuvwxyz";
const int mod = 1e9+7;
const int inf = 2e18+5;
const int nax = 200010;
const int mod1 = 998244353;
signed main()
 {
   
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
  int n,b;
  cin>>n>>b;
  int count = 0;
  while(n>0)
  {
    n /= b;
    count++;
  }
  cout<<count;
  return 0;
}

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

int main() {
	string w;
	bool jud;
	jud = false;
	cin >> w;
	int judge[25] = { 0 };
	int size;
	
	for (int i = 0; i < w.size(); i++) {
		int num;
		num = w[i] - 'a';
		judge[num]++;
	}

	for (int i = 0; i < 25; i++) {
		if (judge[i] % 2 == 1) {
			jud = true;
			break;
		}
	}

	if (jud == true) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  int a,b,n;cin>>a>>b>>n;
  int x,y;cin>>x>>y;
  string s,t;cin>>s>>t;
  int i;
  int tmp=x;
  bool sente=false;
  rep(i,n){
    if(s[i]=='D') tmp++;
    if(tmp>a){cout<<"NO"<<endl;return 0;}
    if(t[i]=='U') tmp--;
    tmp=max(tmp,1);
  }
  tmp=x;
  rep(i,n){
    if(s[i]=='U') tmp--;
    if(tmp==0){cout<<"NO"<<endl;return 0;}
    if(t[i]=='D') tmp++;
    tmp=min(tmp,a);
  }
  tmp=y;
  rep(i,n){
    if(s[i]=='R') tmp++;
    if(tmp>b){cout<<"NO"<<endl;return 0;}
    if(t[i]=='L') tmp--;
    tmp=max(tmp,1);
  }
  tmp=y;
  rep(i,n){
    if(s[i]=='L') tmp--;
    if(tmp==0){cout<<"NO"<<endl;return 0;}
    if(t[i]=='R') tmp++;
    tmp=min(tmp,b);
  }
  cout<<"YES"<<endl;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int a[N];
int main(){
    int m,n;
    cin >> m >>n;
    double su = 0;
    for(int i=1;i<=m;++i){
        cin >> a[i];
        su += a[i];
    }
    su = su / 4 / n;
    int cnt = 0;
    for(int i=1;i<=m;++i){
        if(a[i] >= su){
            cnt++;
        }
    }
    if(cnt >= n){
        cout <<"Yes\n";
    }else{
        cout <<"No\n";
    }




    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(void){
  char x[11];
  scanf("%s",x);
  if(strlen(x)>=4&&x[0]=='Y'&&x[1]=='A'&&x[2]=='K'&&x[3]=='I')printf("Yes\n");
  else printf("No\n");
  
    
}


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

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

int main()
{
  int n;
  while (n = in()){
    string deck;
    cin >> deck;
    vector<int> players(n, 0);
    int pool = 0;
    rep(i, deck.size()){
      switch (deck[i]){
        case 'M':
          players[i % n]++;
          break;
        case 'S':
          pool += players[i % n] + 1;
          players[i % n] = 0;
          break;
        case 'L':
          players[i % n] += pool + 1;
          pool = 0;
          break;
      }
    }
    sort(players.begin(), players.end());
    show(players, ' ', ' ');
    cout << pool << endl;
  }
  return 0;
}

Measured memory_bytes: 1252
Scanf.(Array.(scanf" %d"@@fun n ->
	let p = init n (fun _->scanf" %d"@@fun v->v) in
	let c = make n 0 in
	iteri (fun i v -> c.(v-1) <- i+1) p;
	iteri (fun i _ -> 
		Printf.printf "%d " (20000*(i+1));
	) p; print_newline ();
	iteri (fun i _ -> 
		Printf.printf "%d " (20000*(n-(i+1))+c.(i));
	) p; print_newline ()));;

Measured memory_bytes: 5376
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

a,b = inp
p [a+b,a-b,a*b].max

Measured memory_bytes: 1788
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int getLP(vector<list<int>> &G, int v, vector<int> &dp)
{
    if(dp[v] != -1)
    {
        return dp[v];
    }
    
    int lp = 0;
    for(auto it = G[v].begin(); it != G[v].end(); it++)
    {
        lp = max(lp,getLP(G,*it,dp));
    }
    
    if(!G[v].empty())
    {
        lp++;
    }
    
    dp[v] = lp;
    
    return lp;
}

int main()
{
    int n,m;
    cin >> n >> m;
    
    vector<list<int>> G(n+1);
    
    for(int i = 0; i < m; i++)
    {
        int x,y;
        cin >> x >> y;
        G[x].push_back(y);
    }
    
    int ans = 0;
    vector<int> dp(n+1,-1);
    for(int i = 1; i <= n; i++)
    {
        ans = max(ans,getLP(G,i,dp));
    }
    
    for(int i = 1; i <= n; i++)
    {
        // cout << i << "-> ";
        // for(auto it = G[i].begin(); it != G[i].end(); it++)
        // {
        //     cout << *it << " ";
        // }
        // cout << '\n';
        // cout << i << " " << dp[i] << '\n';
    }
    
    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string w;
  cin >> w;
  
  vector<int> vec(26, 0);
  for (int i = 0; i < w.size(); i++) {
    
    if (w.at(i) == 'a') vec.at(0)++;
    if (w.at(i) == 'b') vec.at(1)++;
    if (w.at(i) == 'c') vec.at(2)++;
    if (w.at(i) == 'd') vec.at(3)++;
    if (w.at(i) == 'e') vec.at(4)++;
    if (w.at(i) == 'f') vec.at(5)++;
    if (w.at(i) == 'g') vec.at(6)++;
    if (w.at(i) == 'h') vec.at(7)++;
    if (w.at(i) == 'i') vec.at(8)++;
    if (w.at(i) == 'j') vec.at(9)++;
    if (w.at(i) == 'k') vec.at(10)++;
    if (w.at(i) == 'l') vec.at(11)++;
    if (w.at(i) == 'm') vec.at(12)++;
    if (w.at(i) == 'n') vec.at(13)++;
    if (w.at(i) == 'o') vec.at(14)++;
    if (w.at(i) == 'p') vec.at(15)++;
    if (w.at(i) == 'q') vec.at(16)++;
    if (w.at(i) == 'r') vec.at(17)++;
    if (w.at(i) == 's') vec.at(18)++;
    if (w.at(i) == 't') vec.at(19)++;
    if (w.at(i) == 'u') vec.at(20)++;
    if (w.at(i) == 'v') vec.at(21)++;
    if (w.at(i) == 'w') vec.at(22)++;
    if (w.at(i) == 'x') vec.at(23)++;
    if (w.at(i) == 'y') vec.at(24)++;
    if (w.at(i) == 'z') vec.at(25)++;
  }
  
  bool ans = true;
  for (int x : vec) {
    if (x % 2 != 0) ans = false;
  }
  
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
    
}

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

using namespace std;

int main(void)
{
    int cards_count;
    int gates_count;
    vector<int> granted_low;
    vector<int> granted_high;

    cin >> cards_count >> gates_count;

    for(int i = 0; i < gates_count; i++){
        int low, high;
        cin >> low >> high;

        granted_low.push_back(low);
        granted_high.push_back(high);
    }

    sort(granted_low.begin(), granted_low.end(), greater<int>());
    int granted_min = granted_low[0];
    sort(granted_high.begin(), granted_high.end());
    int granted_max = granted_high[0];

    
    cout << max(min(granted_max, cards_count) - granted_min + 1, 0) << endl;

    return 0;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=2e5+1;
 
typedef long long ll;
typedef long double ld;
 
void test_case()
{
    ll a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if((a[0]==a[1] && a[1]!=a[2]) || (a[1]!=a[0] && a[1]==a[2]))
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
int main()
{
    IOS();
   
    int tc=1;
    while(tc--)
        test_case();
    return 0;
}

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

signed main(){
	int N;
	cin >> N;
	vector<int> dp(100000+5, 0);
	dp[0] = 1;
	for(int i=0;i<N;i++)
	{
		int a,b;
		cin >> a >> b;
		dp[a]++;
		dp[b+1]--;
	}
	for(int i=1;i<=100001;i++){
		dp[i] += dp[i-1];
	}
	for(int i=100001;i>=0;i--){
		if(dp[i]>=i){
			cout << i-1 << endl;
			break;
		}
	}
}


Measured memory_bytes: 3080
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int n[3], i;
    for (i = 0; i < 3; i++)
    {
        cin >> n[i];
    }
    for (i = 0; i <= 2; i++)
    {
        sort(n, n + 3);
        if (i != 2)
            cout << n[i] << ' ';
        else
            cout << n[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3148
import math
def search(x,n):
	curPos=0
	log2=int(math.log(n,2))
	newPos=0
	if s[curPos]==x:
		return True
	while log2 >=0:
		newPos=curPos + (1 << log2)
		if newPos < n and s[newPos]<=x:
			curPos=newPos
		if s[curPos]==x:
			return True
		log2-=1
	return False

s=input()
s=list(s)
s.sort()
n=len(s)
s_str=[chr(x) for x in range(97,123)]
Found=False
for i in s_str:
	res=search(i,n)
	if not res:
		print(i)
		Found=True
		break
if not Found:
	print('None')

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

int main() {
    int n, mx = 0;
    cin >> n;
    bool limit = false;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (i * j > n) {
                limit = true;
                break;
            }
            if (i * j == i * i) {
                if (mx < max(mx, i * i)) {
                    mx = max(mx, i * i);
                }
                break;
            }
        }
        if (limit) break;
    }
    cout << mx << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int A ,B;
   cin >>A>>B;
   if (A>B&&B!=1){
    cout <<"Alice"<<endl;
   }else if (A<B&&A!=1){
   cout <<"Bob"<<endl;
   }else if (A>B&&B==1){
     cout <<"Bob"<<endl;
       }else if (A<B&&A==1){
     cout <<"Alice"<<endl;
       }else {
   cout << "Draw"<<endl;
   }
       return 0;
}


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

using namespace std;

int main()
{
    int a,b,c,k;
    cin >> a >> b >> c;
    cin >> k;
    int imax=max(a,b);
    imax=max(imax,c);
    int sum=a+b+c-imax;
    for(int i=0;i<k;i++)
        imax*=2;
    sum+=imax;
    cout << sum << endl;
    return 0;
}


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

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define INF INT_MAX
#define NINF INT_MIN
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << "\n";
    err(++it, args...);
}

const int MAX_N = 1e5+100;

int cnt[MAX_N], dp[MAX_N];
vvi adj(MAX_N);
int n, m;

int main() {

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

	tik(i,0,m) {
		int x, y;
		cin >> x >> y;
		adj[x].pb(y);
		cnt[y]++;
	}

	vi sat;
	tik(i,1,n+1)
		if(cnt[i] == 0)
			sat.pb(i);

	vi topos;

	while(!sat.empty()) {
		int u = sat.back();
		sat.pop_back();
		for(auto v : adj[u]) {
			cnt[v]--;
			if(cnt[v] == 0)
				sat.pb(v);
		}
		topos.pb(u);
	}

	// for(auto v : topos)
	// 	cout << v << " ";

	// cout << endl;
	dp[topos[n-1]] = 0;
	int res = 0;

	tok(i,n-2,0) {
		int u = topos[i];
		for(auto v : adj[u]) {
			dp[u] = max(dp[u], 1+dp[v]);
		}

		res = max(res,dp[u]);
	}

	// tik(i,1,n+1)
	// 	cout << dp[i] << " ";
	cout << res;

}

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

signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	long long n, ans = 0, u, v;
	cin >> n;
	for (int i = 1; i <= n; ++i) 
		ans += i * (n - i + 1LL);
	for (int i = 2; i <= n; ++i) {
		cin >> u >> v;
		if (u > v)
			swap(u, v);
		ans -= u * (n - v + 1);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 3648
// 2011/07/20 Tazoe

#include <iostream>
using namespace std;

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

		for(int i=0; i<n; i++){
			int pm, pe, pj;
			cin >> pm >> pe >> pj;
			if(pm==100||pe==100||pj==100)
				cout << 'A' << endl;
			else if((pm+pe)/2>=90)
				cout << 'A' << endl;
			else if((pm+pe+pj)/3>=80)
				cout << 'A' << endl;
			else if((pm+pe+pj)/3>=70)
				cout << 'B' << endl;
			else if((pm+pe+pj)/3>=50&&(pm>=80||pe>=80))
				cout << 'B' << endl;
			else
				cout << 'C' << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
using namespace std;
#define ll long long
#define mod 1000000007;

int main() {
	ll n, h[100010], ans = 0, hoge = 0;
	cin >> n;
	for (ll i = 0; i < n; i++)cin >> h[i];

	bool flag = false;
	for (ll i = 0; i < n - 1; i++) {
		if (h[i] >= h[i + 1]&&flag) {
			hoge++;
			ans = max(hoge, ans);
		}
		else if(h[i]>=h[i+1]&&!flag){
			hoge = 1;
			flag = true;
			ans = max(hoge, ans);
		}
		else {
			flag = false;
			ans = max(hoge, ans);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a;
	scanf("%d",&a);
	if(65<=a && 90>=a){
		printf("1\n");
	}
	else if(97<=a && 122>=a){
		printf("2\n");
	}
	else{
	printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 2112