akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    
    if(n == 3){
        printf("2 5 63");
        return 0;
    }
    if(n < 30){
        printf("3 9 ");
        if((n-2) % 3 == 0 || (n-2) % 3 == 2){
            for(int i = 1; i <= n-2; i++){
                printf("%d ", 2 * i);
            } 
        } else {
            for(int i = 1; i <= n-2; i++){
                printf("%d ", 2 * i + 4);
            }
        }
        return 0;
    }
    
    
    int nNumTwo, nNumThree, nNumFive;  //それぞれ和が30の倍数となるように作る
    nNumFive = min(2000 , (n / 6) * 2);   //5の倍数\2または3の倍数の個数
    nNumThree = min(5000 , (n / 30) * 10);  //3の倍数\2の倍数の個数
    nNumTwo = n - nNumFive - nNumThree;  //2の倍数の個数
    
    int nSum = 0;
    for(int i = 1; i < nNumTwo; i++){
       printf("%d ", 2 * i);
       nSum += 2 * i;
    }
    int nTwoLast = (2 * nNumTwo + 60) / 30;
    nTwoLast *= 30;
    nTwoLast -= (nSum % 30);
    printf("%d ", nTwoLast);
    
    for(int i = 0; i < nNumThree; i++){
        printf("%d ", 6 * i + 3);
    }
    
    for(int i = 0; i < nNumFive; i++){
        if(i % 2 == 0){
            printf("%d ", 15 * i + 5);
        }
        else {
            printf("%d ", 15 * i + 10);
        }
    }
  
    return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)

const ll INF=1LL<<29;

signed main() {
  int h,w;
  cin >> h >> w;
  int c[10][10];
  rep(i,10) rep(j,10) cin >> c[i][j];
  rep(k,10) rep(i,10) rep(j,10) c[i][j] = min(c[i][j], c[i][k] + c[k][j]); 

  int ans = 0;
  rep(i,h) rep(j,w) {
    int a; cin >> a;
    if(a !=-1) ans += c[a][1];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3556
import sys
import itertools


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    d, g = list(map(int, input().rstrip('\n').split()))
    pc = [[(i + 1) * 100, pc[0], pc[1]]for i, pc in enumerate(list(map(int, input().rstrip('\n').split())) for _ in range(d))]
    pc.sort(reverse=True)
    min_cnt = 10 ** 10
    for v in itertools.product([True, False], repeat=d):
        cnt = 0
        t = 0
        max_p = -1
        limit_c = -1
        for i, vv in enumerate(v):
            if vv:
                cnt += pc[i][1]
                t += pc[i][0] * pc[i][1] + pc[i][2]
            else:
                if max_p < pc[i][0]:
                    max_p = pc[i][0]
                    limit_c = pc[i][1]
        if t >= g:
            min_cnt = min(min_cnt, cnt)
        else:
            if 1 <= (g - t + max_p - 1) // max_p <= limit_c:
                min_cnt = min(min_cnt, cnt + (g - t + max_p - 1) // max_p)
    print(min_cnt)


if __name__ == '__main__':
    solve()


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using PL = pair<ll,ll>;
const ll INF = 1e15;


int main()
{
	int n;
	cin >> n;
	vector<vector<ll>> dist(n, vector<ll>(n));
	ll sum =0;
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) {
		cin >> dist[i][j];
		sum += dist[i][j];
	}
	set<P> edge;

	for(int k = 0; k < n; k++) {
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {

				if(dist[i][j] > dist[i][k] + dist[k][j]) {
					cout << -1 << endl;
					return 0;
				}

				if(dist[i][j] == dist[i][k] + dist[k][j] && dist[i][k] > 0 && dist[k][j] > 0) {
					edge.emplace(i, j);
				}

			}
		}
	}
	for(auto i : edge) {
		sum -= dist[i.first][i.second];
	}
	cout << sum / 2 << endl;

}

Measured memory_bytes: 5120
import java.util.*;

public class Main {
    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        Set<Integer> set = new HashSet<Integer>();
        int result = 0;
        set.add(s);
        for (int i = 2; i < 1000000; i++) {
            s = s % 2 == 0 ? (s / 2) : (3 * s + 1);
            if (set.contains(s)) {
                result = i;
                break;
            } else {
                set.add(s);
            }
        }
        System.out.println(result);
    }
}


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

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }
    else
    {
        for (int i = 0; i < n / 2; i++)
        {
            if (s[i] != s[n / 2 + i])
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

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

    int count;
    for (int i = a; i <= b; i++)
    {
        std::stringstream ss;
        ss << i;
        std::string s = ss.str();
        if(s[0] == s[4] && s[1] == s[3]){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
H,W=map(int,input().split())

queue=[]
mat=[[True]*(W+2)]
for i in range(1,H+1):
  array=[True]+[x=="#" for x in input()]+[True]
  mat.append(array)
  for j in range(1,W+1):
    if array[j]:
      queue.append((i,j))
mat.append([True]*(W+2))
#print(mat)
#print(queue)

d=0
while queue:
  new_queue=set()
  for q in queue:
    i,j=q
    #print(q)
    if not mat[i-1][j]:
      new_queue.add((i-1,j))
      mat[i-1][j]=True
    if not mat[i+1][j]:
      new_queue.add((i+1,j))
      mat[i+1][j]=True
    if not mat[i][j-1]:
      new_queue.add((i,j-1))
      mat[i][j-1]=True
    if not mat[i][j+1]:
      new_queue.add((i,j+1))
      mat[i][j+1]=True
      
  queue=list(new_queue)
  d+=1
  
print(d-1)

Measured memory_bytes: 131308
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

struct int_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

struct pair_hash {
    size_t operator()(pair<int, int> x) const {
        return int_hash{}(x.first) ^ (int_hash{}(x.second) << 16);
    }
};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e7;
const int MX = 100001; //check the limits, dummy

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

    string s; cin >> s;
    cout << string(s.size(), 'x') << endl;
}

Measured memory_bytes: 256
#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){
		puts("0");
		return 0;
	}
	
	long long prod=1;
	for(int i=0;i<n;i++){
		if(a[i]<=1000000000000000000/prod){
			prod*=a[i];
		}else{
			puts("-1");
			return 0;
		}
	}
	printf("%lld",prod);
}

Measured memory_bytes: 2456
s = str(input())
cnt_1, cnt_2 = 0, 0
for i in range(len(s)):
    if s[i] == 'A':
        cnt_1 = i
        break
for i in range(len(s)):
    if s[i] == 'Z':
        cnt_2 = i
print(cnt_2 - cnt_1 + 1)

Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool) *this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t) v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<(unsigned) 1e9 + 7>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  V<> a(n); for (auto&& e : a) cin >> e;
  V<> b(m); for (auto&& e : b) cin >> e;
  VV<Mint> dp(n + 1, V<Mint>(m + 1));
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;
  for (int j = 0; j <= m; ++j) dp[0][j] = 1;
  for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) {
    dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j];
    if (a[i] == b[j]) dp[i + 1][j + 1] += dp[i][j];
  }
  cout << dp[n][m] << '\n';
}

Measured memory_bytes: 16000
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String[] line = br.readLine().split(" ");
	    double a = Double.parseDouble(line[0]);
	    double b = Double.parseDouble(line[1]);
	    double C = Double.parseDouble(line[2]);

	    double S = (a * b * Math.sin(Math.toRadians(C))) / 2d;
	    double L = a + b + Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(Math.toRadians(C))));
	    double h = b * Math.sin(Math.toRadians(C));

	    StringBuilder sb = new StringBuilder();
	    sb.append(S).append("\n");
	    sb.append(L).append("\n");
	    sb.append(h).append("\n");

	    System.out.print(sb.toString());
	}
}

Measured memory_bytes: 24460
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
c=0
for i in range(n-1):
  if A[i]+1==A[i+1]:
    c+=C[A[i]-1]
print(sum(B)+c)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, i, j, d;
  cin >> A >> B;
  int sum = 0;
  int dig[5];
  
  for (i = 0; i < B - A + 1; i++) {
    d = 1;
    for (j = 0; j < 5; j++) {
      dig[j] = (A + i) / d % 10;
      d *= 10;
    }
    if ((dig[4] == dig[0]) && (dig[3] == dig[1])) sum++;
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 256
package main

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

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

	a := make([]int, n, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		scanner.Scan()
		a[i], _ = strconv.Atoi(scanner.Text())
	}
	answer := a[0]
	for i := 1; i < n; i++ {
		answer = gcd(a[i], answer)
	}
	fmt.Println(answer)
}

func gcd(n1 int, n2 int) int {
	if n1 % n2 == 0 {
		return n2
	} else {
		return gcd(n2, n1 % n2)
	}
}


Measured memory_bytes: 3072
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll H,W,k;
string s[1000];
ll J[1000][1000];
ll O[1000][1000];
ll I[1000][1000];
ll X1,Y1,X2,Y2;
bool ok(ll y,ll x){
	return 0<=x&&x<W&&0<=y&&y<H;
}
int main()
{
	scanf("%lld%lld%lld",&H,&W,&k);
	for(ll i=0;i<H;i++){
		cin>>s[i];
		for(ll j=0;j<W;j++){
			if(s[i][j]=='J') J[i][j]++;
			if(s[i][j]=='O') O[i][j]++;
			if(s[i][j]=='I') I[i][j]++;
		}
	}
	for(ll i=1;i<H;i++){
		for(ll j=0;j<W;j++){
			J[i][j]+=J[i-1][j];
			O[i][j]+=O[i-1][j];
			I[i][j]+=I[i-1][j];
		}
	}
	for(ll i=0;i<H;i++){
		for(ll j=1;j<W;j++){
			J[i][j]+=J[i][j-1];
			O[i][j]+=O[i][j-1];
			I[i][j]+=I[i][j-1];
		}
	}
	for(ll i=0;i<k;i++){
		scanf("%lld%lld%lld%lld",&Y1,&X1,&Y2,&X2);
		X1--;
		X2--;
		Y1--;
		Y2--;
		printf("%lld %lld %lld\n",J[Y2][X2]-(ok(Y2,X1-1)?J[Y2][X1-1]:0)-(ok(Y1-1,X2)?J[Y1-1][X2]:0)+(ok(Y1-1,X1-1)?J[Y1-1][X1-1]:0)
								 ,O[Y2][X2]-(ok(Y2,X1-1)?O[Y2][X1-1]:0)-(ok(Y1-1,X2)?O[Y1-1][X2]:0)+(ok(Y1-1,X1-1)?O[Y1-1][X1-1]:0)
								 ,I[Y2][X2]-(ok(Y2,X1-1)?I[Y2][X1-1]:0)-(ok(Y1-1,X2)?I[Y1-1][X2]:0)+(ok(Y1-1,X1-1)?I[Y1-1][X1-1]:0)
				
				);
	}
	return 0;
}

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

void print(vector<vector<ll>> arr) {
    int n = arr.size();
    int m = arr[0].size();
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++)
            cout << arr[i][j] << " ";
        cout << endl;
    }
}

string lcs(string s, string t) {
    int n = s.length();
    int m = t.length();
    vector<vector<ll>> dp(n+1, vector<ll>(m+1, 0));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (s[i-1] == t[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
//    print(dp);
//    cout << dp[n][m] << endl;
    string ans = "";
    int i = n, j = m;
    while(i > 0 && j > 0) {
        if (s[i-1] == t[j-1])
            ans = s[i-1] + ans,
            i--,
            j--;
        else if (dp[i][j] == dp[i-1][j]) i--;
        else j--;
    }
    return ans;
}

int main() {
    string s, t;
    cin >> s >> t;
    cout << lcs(s, t) << endl;
    return 0;
}

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

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

  vector<int> a(n);
  rep(i, n) cin >> a.at(i);

  int max_diff = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int diff = abs(a.at(i) - a.at(j));
      max_diff = max(max_diff, diff);
    }
  }

  cout << max_diff << endl;
  return 0;
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long

struct XX{
    ll la;
    ll lb;
    ll ra;
    ll rb;
    ll q;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.q) == (riRight.q)){
            return riLeft.q < riRight.q;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.q) < (riRight.q);
    }
};


//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}

int asum(string P){
    int sum=0;
    int strength=1;
    for(int i=0;i<P.size();i++){
        if(P.substr(i,1)=="S"){
            sum+=strength;
        }else{
            strength*=2;
        }
    }
    return sum;
}

int main(int argc, const char * argv[])
{
    //scanf("%s",S);
    //scanf("%d",&N);
    //scanf("%lld %lld",&target1,&target2);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //ifstream ifs( "1_06.txt" );//テスト用
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    cin >> N;
    int x[200000];
    int xx[200000];
    for(int i=0;i<N;i++){
        cin >> x[i];
        xx[i]=x[i];
    }
    sort(x,x+N);
    int m1=x[N/2-1];
    int m2=x[N/2];
    
    for(int i=0;i<N;i++){
        if(xx[i]<m1){
            cout << m2 << endl;
        }else if(xx[i]==m1){
            cout << m2 << endl;
        }else if(xx[i]==m2){
            cout << m1 << endl;
        }else{
            cout << m1 << endl;
        }
    }
    
    
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    
    return 0;
}



Measured memory_bytes: 3712
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A, B, C, D = map(int, input().split())
# 文字列の入力
#s = input()
#print(s[0:K-1]+s[K-1].lower()+s[K:N])

while(1):
    C = C-B
    if C <= 0:
        print("Yes")
        break
    A = A-D
    if A <= 0:
        print("No")
        break


Measured memory_bytes: 9164
// ------------------------------------
// Date:2018/ 2/ 3
// Problem:AtCoder Petrozavodsk Contest a.cpp
//
// ------------------------------------

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <random>

using namespace std;

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

int main()
{
    long long X,Y;
    cin >> X >> Y;
    if (X>=Y && X%Y==0) {
        cout << -1 << endl;
    } else {
        cout << X << endl;
    }
    return 0;
}


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



int main(){
	ll n,a,b,c,d;
	string s;
	cin>>n>>a>>b>>c>>d>>s;
	if((b<c&&c<d)||c<b){
		ll cnt=0;
		for(int i=b-1;i<d;i++){
			if(s[i]=='#'){
				cnt++;
				if(cnt>=2){
					cout<<"No";
					return 0;
				}
			}else cnt=0;
		}
		cnt=0;
		for(int i=a-1;i<c;i++){
			if(s[i]=='#'){
				cnt++;
				if(cnt>=2){
					cout<<"No";
					return 0;
				}
			}else cnt=0;
		}
	}
	if(d<c){
		ll cnt=0;
		bool f=0;
		for(int i=b-2;i<=d;i++){
			if(s[i]=='.'){
				cnt++;
				if(cnt>=3){
					f=1;
				}
			}else cnt=0;
		}
		if(!f){
			cout<<"No";
			return 0;
		}
		cnt=0;
		for(int i=a-1;i<c;i++){
			if(s[i]=='#'){
				cnt++;
				if(cnt>=2){
					cout<<"No";
					return 0;
				}
			}else cnt=0;
		}
	}
	cout<<"Yes";
	return 0;
}


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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i64 a, b, c;
    cin >> a >> b >> c;
    i64 s1 = (c - a - b);
    i64 s2 = 4 * a * b;
    cout << YN("Yes", "No",  s1 > 0 && s1 * s1 > s2) << endl;
}


Measured memory_bytes: 3612
n,m=map(int,input().split())
h=list(map(int,input().split()))
graph=[set([]) for _ in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    graph[a-1].add(b-1)
    graph[b-1].add(a-1)

ans=0


for i in range(n):
    t=h[i]
    df=i
    if list(graph[i])==[]:
        ans+=1
    else:
        fa=True
        for j in list(graph[i]):
            if t<=h[j]:
                fa=False
        if fa:
            ans+=1

print(ans)

Measured memory_bytes: 45272
import math
PI=3.14159265358979323846
a,b,h,m = map(float, input().split())
i=(h+m/60.0)*PI/6.0;
j=m*PI/30.0;
if i>j and i-j>PI:
    n=2*PI-(i-j)
elif i>j and i-j<=PI:
    n=i-j
elif j>=i and j-i>PI:
    n=2*PI-(j-i)
elif j>=i and j-i<=PI:
    n=j-i
x=math.sqrt(a*a+b*b-2*a*b*math.cos(n))
print(x)

Measured memory_bytes: 9476
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集 

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s; cin >> s;
  if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			int M = sc.nextInt();
			int Q = sc.nextInt();
			if (N == 0) break;
			StringBuilder sb = new StringBuilder();
			boolean[][] sw = new boolean[Q][N];
			boolean[][] on = new boolean[Q][M];
			for (int i = 0; i < Q; ++i) {
				char[] S = sc.next().toCharArray();
				char[] B = sc.next().toCharArray();
				for (int j = 0; j < N; ++j) {
					sw[i][j] = S[j] == '1';
				}
				for (int j = 0; j < M; ++j) {
					on[i][j] = B[j] == '1';
				}
			}
			for (int i = 1; i < Q; ++i) {
				for (int j = 0; j < N; ++j) {
					sw[i][j] ^= sw[i-1][j];
				}
			}
			for (int i = 0; i < M; ++i) {
				boolean[] ng = new boolean[N];
				for (int j = 0; j < Q; ++j) {
					if (on[j][i]) {
						for (int k = 0; k < N; ++k) {
							if (!sw[j][k]) ng[k] = true;
						}
					} else {
						for (int k = 0; k < N; ++k) {
							if (sw[j][k]) ng[k] = true;
						}
					}
				}
				int res = -1;
				for (int j = 0; j < N; ++j) {
					if (ng[j]) continue;
					res = res == -1 ? j : -2;
				}
				sb.append((char) (res == -2 ? '?' : (res < 10 ? res + '0' : res - 10 + 'A')));
			}
			System.out.println(sb);
		}
	}
}

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

int main(void)
{
    string s;
    cin >> s;
    int ans = 0;

    if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') ans = 3;
    else if (s[0] == 'R' && s[1] == 'R') ans = 2;
    else if (s[1] == 'R' && s[2] == 'R') ans = 2;
    else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') ans = 1;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    string s,t,u;
    cin>>s>>t>>a>>b>>u;
    if(s==u){
        a--;
    }else{
        b--;
    }
    printf("%d %d",a,b);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

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

		for(int i=0;i<=10000;i++) {
			int x=sc.nextInt();
			if(x==0) {
				break;
			}else {
				System.out.println("Case "+(i+1)+": "+x);
			}
		}


	}

}



Measured memory_bytes: 41460
#include<bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 1e7;
#define mod 1000000007
 
const int mxN = 1e5 + 1;
ll n, k;
ll dp[mxN], a[mxN];
 
int main()
{
FIO
 
    cin >> n >> k;
    FOR(n) cin >> a[i];
    dp[0] = 0;
    Rep(j,1,k)
    {
        Rep(i,1,n)
        {
            if(j >= a[i] && !dp[j-a[i]])
                dp[j] = 1;
        }
    }

    cout << (dp[k] ? "First" : "Second") << endl;
}

Measured memory_bytes: 4412
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, m, p, k, l;
vector<V> vvi;
bool f[100];

int main(){
	while (cin >> n&&n){ 
		vvi.clear();
		fill(f, f + 100, 1);
		REP(i, n){
			cin >> m;
			V vi;
			REP(j, m){
				cin >> p;
				vi.push_back(p);
			}
			vvi.push_back(vi);
		}
		cin >> k;
		REP(i, k){
			cin >> l;
			REP(j, vvi.size()){
				if (find(ALL(vvi[j]), l) == vvi[j].end()){
					f[j] = 0;
				}
			}
		}
		int co = 0;
		REP(i, n){
			if (f[i])co++;
		}
		if (co == 1){
			REP(i, n){
				if (f[i])cout << i + 1 << endl;
			}
		}
		else{
			cout << -1 << endl;
		}
	}
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,a) for(int i = 0; i < (a); i++)
using namespace std;
 
int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int b[n] = {};
	int black = 0;
	REP(i,n){
		if(s[i] == '#')black++;
		b[i] = black;
	}
	int w[n] = {};
	int white = 0;
	for(int i = n - 1; i >= 0; i--){
		if(s[i] == '.')white++;
		w[i] = white;
	}
	int min = 1e9;
	REP(i,n){
		if(w[i] + b[i] < min)min = w[i] + b[i];
	}
	cout << min - 1	<< endl;
}

Measured memory_bytes: 2180
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(int i = a; i < n; ++i)
#define pb push_back
#define mp make_pair
//#define f first
//#define sex second

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <set>
#include <ostream>
#include <queue>
#include <functional>
#include <sstream>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#pragma comment(linker, "/STACK:228228000")
const ll mod = 9982443530;

ll n;
vector<ll> a;

ll cal(ll q)
{
	ll ret = 0;
	while (q > 0)
	{
		ret += q % 10;
		q /= 10;
	}
	return ret;
}

int main()
{
	/*

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	*/


	cin >> n;

	ll ad = 0;

	for(ll i = 1; i <= 1e13; i *= 10)
	{
		forn(j, 1, 1000)
		{
			a.push_back(j*i + ad);
		}
		ad += i * 9;
	}

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

	vector<ll> b;
	b.push_back(a.back());

	forn(i, 1, a.size())
	{
		ll f, s;
		f = b.back();
		s = a[a.size() - 1 - i];
		if (f != s)
		{
			if(f*cal(s) >= s*cal(f))
			b.push_back(s);
		}
	}

	forn(i, 0, n)
		cout << b[b.size() - 1 - i] << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b,dp[100010],to[100010];
vector <int> v[100010];
queue <int> q;

int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;++i){
		scanf("%d%d",&a,&b);
		v[a].push_back(b);
		to[b]++;
	}	
	for(int i=1;i<=n;++i)if(to[i]==0)q.push(i);
	while(!q.empty()){
		int x=q.front();
		q.pop();
		for(int i=0;i<v[x].size();++i){
			if(dp[x]+1>dp[v[x][i]]){
				dp[v[x][i]]=dp[x]+1;
			}
			to[v[x][i]]--;
			if(to[v[x][i]]==0)q.push(v[x][i]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;++i)ans=max(ans,dp[i]);
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  int N, K ,S;
  cin >> N >> K >> S;
  int p = N-K+1;
  vector<int> A(N,S/p);
  int q = S%p;
  if (S/p == 0) {
    A.assign(N,1000000000);
    for (int i = 0; i < K; i++) A[i] = S;
  }
  else {
    for (int i = 1; i <= q; i++) {
      for (int j = p-i; j < N; j += p) {
        A[j] += 1;
      }
    }
  }
  
  for (int i = 0; i < N; i++) {
    cout << A[i];
    if (i < N-1) cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector> 
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

int main()
{
	// 要素数
	int n;
	cin >> n;

	bool bFirst = true;	
	char state = 0;
	int a, b;
	int total = 1;
	for( int i = 0;i < n;++i )
	{
		bool bNextArray = false;
		cin >> a;
		if( bFirst )
		{
			bFirst = false;
		}
		else
		{
			if( state == 0 )
			{
				if( a > b ) state = 1;
				else if( a < b ) state = -1;
			}
			else if( state > 0)
			{
				if( a < b )
					bNextArray = true;
			}
			else if( state < 0 )
			{
				if( a > b )
					bNextArray = true;
			}
		}
		if( bNextArray )
		{
			state = 0;
			++total;
		}
		b = a;
	}
	cout << total << endl;	
}


Measured memory_bytes: 384
import java.util.Scanner;

public 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();
	    
	    if((a == b+c) || (b == a+c) || (c == a+b)) {
	    	System.out.println("Yes");
	    }else {
	    	System.out.println("No");
	    }
	    
	}
	
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    int2(h, w);
    vector<string> board(h);
    rep(i, h) cin >> board[i];
    vvi used(h, vi(w, 0));
    vp point;

    rep(i, h) {
        rep(j, w) {
            if (board[i][j] == 'B' &&
                    !used[i][j]) {
                used[i][j] = 1;
                point.pb({i, j});
                break;
            }
        }
        for (int j = w-1; j >= 0; j--) {
            if (board[i][j] == 'B' &&
                    !used[i][j]) {
                used[i][j] = 1;
                point.pb({i, j});
                break;
            }
        }
    }

    rep(j, w) {
        rep(i, h) {
            if (board[i][j] == 'B' &&
                    !used[i][j]) {
                used[i][j] = 1;
                point.pb({i, j});
                break;
            }
        }
        for (int i = h-1; i >= 0; i--) {
            if (board[i][j] == 'B' &&
                    !used[i][j]) {
                used[i][j] = 1;
                point.pb({i, j});
                break;
            }
        }
    }

    /*
    rep(i, point.size()) {
        cout << point[i].fir << " " << point[i].sec << endl;
    }
    */

    int ans = 0;
    rep(i, point.size()) {
        for (int j = i+1; j < point.size(); j++) {
            ans = max(ans, abs(point[i].fir - point[j].fir) +
                    abs(point[i].sec - point[j].sec));
        }
    }

    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 9628
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int C = stdIn.nextInt();
		int D = stdIn.nextInt();
		int ans = 0;
		for(;;){
			C = C - B;
			A = A - D;
			if(C <= 0){
				ans = 0;
				break;
			}
			else if(A <= 0){
				ans = 1;
				break;
			}
		}
		if(ans == 0){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");		}
		stdIn.close();
	}
}

Measured memory_bytes: 35820
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
int ddx[8]={0,0,-1,1,1,1,-1,-1};
int ddy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int N,K;
	cin>>N>>K;
	ll ans=3999999996000000001*2;

	vector<ll> x,y;
	for(int i=0;i<N;i++){
		ll a,b;
		cin>>a>>b;
		x.pb(a),y.pb(b);
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			ll left=min(x[i],x[j]),right=max(x[i],x[j]);
			for(int k=0;k<N;k++){
				for(int l=0;l<N;l++){
					ll top=max(y[k],y[l]),bot=min(y[k],y[l]);
					int poi=0;
					for(int m=0;m<N;m++){
						if(left<=x[m] && x[m]<=right && bot<=y[m] && y[m]<=top)
							poi++;
					}
					if(poi>=K){
						ans=min(llabs(right-left)*llabs(top-bot),ans);
						//cout<<right<<" "<<left<<" "<<top<<" "<<bot<<endl;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int dp[100010][3];

int main()
{
 int N;
 int a[100010],b[100010],c[100010];
 cin >> N;
 for(int i = 1; i <= N; i++) cin >> a[i] >> b[i] >> c[i];
 //dp初期条件
 for(int X = 0; X < 3; X++) dp[0][X]= 0;
 for(int i = 0; i < N; i++){
     dp[i + 1][0] = max(dp[i][1],dp[i][2]) + a[i + 1];
     dp[i + 1][1] = max(dp[i][0],dp[i][2]) + b[i + 1];
     dp[i + 1][2] = max(dp[i][0],dp[i][1]) + c[i + 1];
 }
 cout << max(max(dp[N][0],dp[N][1]),dp[N][2]);   
 return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
using namespace std;
string a;
int maxn,ans=0;
int main()
{
    cin>>a;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')ans++;
        else ans=0;
        maxn=max(maxn,ans);
    }
    cout<<maxn;
    return 0;
}

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

int main ()
{
  
bool f [100001];
int c [100002]={};
int N ,L , R ;
  for (int i =2;i<=100000;i++)
    if (!f[i])
      for (int j=i+i;j<=100000;j+=i)
        f[j]= true;
  for (int i=3;i<=100000;i+=2)
    if (!f[i]&&!f[(i+1)/2])c[i]++;
  for (int i=3;i<=100000;i++)c[i]+=c[i-1];
  cin>>N;
  while (N--)
    {
      cin>>L>>R;
      cout<<c[R]-c[L-1]<<endl;
 }
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  vector<int> h(n);
  REP(i, n) cin >> h[i];
  int ans = 0, mx = 0;
  REP(i, n){
    if(mx <= h[i]){
      ans++;
      mx = h[i];
    }
  }
  cout << ans << endl;
  return 0;
}

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

long long gcd(long long a, long b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

long long lcm(long long a, long long b)
{
    return a * b / gcd(a, b);
}


int main() {
	long long a, b;
	cin >> a >> b;
	cout << lcm(a, b) << endl;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n,a,b;cin>>n>>a>>b;
    int ans=min(n*a,b);
    cout<<ans <<endl;
    return 0;
}


Measured memory_bytes: 3592
# https://atcoder.jp/contests/agc036/tasks/agc036_a

S = int(input())
x1 = 0
y1 = 0
x2 = 1000000000
y2 = 1
v = 1000000000
x = (v - S % v) % v
y = (S + x) // v

print("{} {} {} {} {} {}".format(x1, y1, x2, y2, x, y))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,mikassa=1;
    scanf("%d %d",&n,&k);
    for(int i=1; i<=n; i++)
        mikassa+=min(mikassa,k);
    printf("%d\n",mikassa);    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>                   
#include <string>                     
using namespace std;                  
                                      
int main(void){                       
  string s;                           
  cin >> s;                           
  int a = (int)s[0];                  
  char b = '0';                       
  int count = 0;                      
  for(int i = 0; i < s.size();++i){   
    if(i % 2 == 0){                   
      if(a == 0) b = '1';             
      else if(a == 1) b = '0';        
      if((int)s[i] != a){             
        s[i] =  b;                    
        count++;                      
      }                               
    }                                 
    else{                             
      if(a == 0) b = '1';             
      else if(a == 1) b = '0';        
      if((int)s[i] == a){             
        s[i] = b;                     
        count++;                      
      }                               
    }                                 
  }                                   
  cout << count << endl;              
  return 0;                           
}                                     
                                      
                                      

Measured memory_bytes: 512
def searchP(dic,x):
    p =dic[x]['p'] 
    if p==x:
        return x
    dic[x]['p']= searchP(dic,p)
    return dic[x]['p']

N,M=list(map(int,input().split()))
arr =list(map(int,input().split()))

dic={i:{'p':i,'length':0} for i in range(1,N+1)}
for i in range(M):
    x,y=list(map(int,input().split()))
    x=searchP(dic,x)
    y=searchP(dic,y)
    
    if dic[x]['length']<dic[y]['length']:
        dic[x]['p']=y
    else:
        dic[y]['p']=x

group={}
ans=0
for i,v in enumerate(arr):
    if searchP(dic,v)== searchP(dic,i+1):
        ans+=1
print(ans)

Measured memory_bytes: 47812
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a;
  cin>>a;
  vector<int> b(a),c(a),d(a);
  rep(i,a)
  cin>>b[i]>>c[i]>>d[i];
  int dp[1000000][3];
  dp[0][0]=b[0];dp[0][1]=c[0];dp[0][2]=d[0];
rep1(i,a){
dp[i][0]=max(dp[i-1][1]+b[i],dp[i-1][2]+b[i]);
dp[i][1]=max(dp[i-1][0]+c[i],dp[i-1][2]+c[i]);
dp[i][2]=max(dp[i-1][1]+d[i],dp[i-1][0]+d[i]);
  }
  cout<<max(dp[a-1][0],max(dp[a-1][1],dp[a-1][2]))<<endl;
}

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

int main() {
    int n;
    cin >> n;
    int w[n];

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

    int minimum = 1e5;
    for(int i = 0; i < n - 1; i++) {
        left += w[i];
        right -= w[i];
        int diff = abs(left - right);

        if(minimum > diff) minimum = diff;

    }

    cout << minimum << endl;

    return 0;
}

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

int gcd(int x, int y) {
  while (y > 0) {
    int c = x;
    x = y;
    y = c % y;
  }
  return x;
}

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

  int total_gcd = arr[0];
  for (int a: arr) {
    total_gcd = gcd(total_gcd, a);
  }
  cout << total_gcd << endl;
}


Measured memory_bytes: 640
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
#include <cmath>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n'&&c!=EOF;)s+=c;return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

int main() {
	int n {in}, m {in}, d {}, p {};
	vector<int> r(n);
	for (int i: range(1, n))
		r[i] = r[i - 1] + (int) in;
	times (i, m) {
		int a {in};
		d = (d + (int) abs(r[p + a] - r[p])) % 100000;
		p += a;
	}
	outl(d);
}


Measured memory_bytes: 2616
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

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

	std::vector< std::vector<double> > colors(N, std::vector<double>(3));
	for (int i = 0; i < N; i++) {
		cin >> colors[i][0];
		cin >> colors[i][1];
		cin >> colors[i][2];
	}

	std::vector< std::vector<double> > dis(N, std::vector<double>(N));
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			if ( i == j ) {
				dis[i][j] = 0;
			}
			else {
				dis[i][j] = pow(colors[i][0]-colors[j][0],2) + pow(colors[i][1]-colors[j][1],2) + pow(colors[i][2]-colors[j][2],2);
				dis[j][i] = dis[i][j];
			}
		}
	}

	double max = 0;
	double now;
	bool update = false;
	std::vector<int> c(M);
	for (int i = 0; i < M; i++) {
		c[i] = i;
	}

	if ( M > 1 ) {
		while ( !(c[0] > N-M) ) {
			now = 0;
			for (int i = 0; i < M-1; i++) {
				for (int j = i+1; j < M; j++) {
					now += dis[c[i]][c[j]];
				}
			}

			if ( now > max ) {
				max = now;
			}

			update = false;
			int t = 0;
			for (int i = M-1; !(i > M) && !(update); i--) {
				if ( i == 0 ) {
					c[i]++;
					update = true;
					for (int j = 0; j < t; j++) {
						c[M-1-j] = c[M-1-t] + t - j;
					}
				}
				else if ( c[i] < N-1-(M-i-1) ) {
					c[i]++;
					update = true;
					for (int j = 0; j < t; j++) {
						c[M-1-j] = c[M-1-t] + t - j;
					}
				}
				else {
					t++;
				}
			}
		}
	}

	cout << std::setprecision(30) << max << endl;

	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int n,a[3];
double dp[305][305][305];
int main(){
	n=read();
	for(int i=0;i<n;i++){
		int x=read();
		a[x-1]++;
	}
	for(int k=0;k<=n;k++)
		for(int j=0;j+k<=n;j++)
			for(int i=0;i+j+k<=n;i++)
				if(i+j+k){
					double &x=dp[i][j][k];
					x=n;
					if(i)x+=dp[i-1][j][k]*i;
					if(j)x+=dp[i+1][j-1][k]*j;
					if(k)x+=dp[i][j+1][k-1]*k;
					x/=i+j+k;
				}
	printf("%.10lf",dp[a[0]][a[1]][a[2]]);
	return 0;
}

Measured memory_bytes: 219392
# abc109c

def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcd(r, b)

N,X = map(int,input().split())
x = list(map(int,input().split()))

x.append(X)
x.sort()
diff = [x[1]-x[0]]
for i in range(N):
    diff.append(x[i+1]-x[i])

D = gcd(diff[0],diff[1])
for i in range(2,N+1):
    D = gcd(D,diff[i])
print(D)

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

ll A, B, C;
void solve() {
  if ((A <= C && C <= B) ||( A >= C && C >= B)) {
    cout << "Yes\n";
    return;
  }
  else {
    cout << "No\n";
    return;
  }
}

int main() {
  cin >> A >> B >> C;
  solve();
  return 0;
}


Measured memory_bytes: 256
i = [int(x) for x in input().split()]
 
if i[0]==i[1]:
  if i[1]!=i[2]:
    print("Yes")
  else:
    print("No")
elif i[0]==i[2]:
  print("Yes")
elif i[1]==i[2]:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int i,j,len;
	char s[1001],alf[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ",
		 cea[]="DEFGHIJKLMNOPQRSTUVWXYZABC";
	cin>>s;
	len=strlen(s);
	for(i=0;i<len;i++){
		for(j=0;j<26;j++){
			if(s[i]==cea[j]){
				cout<<alf[j];
				break;
			}
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3104