akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

long double right[3], left[3], top[3], bottom[3];

long double calcSpace(long double);

int main()
{
	int N;
	scanf("%d", &N);
	// {l, 0, r}, {b, 0, t}
	for (int i{}; i < 3; i++) right[i] = -1e9;
	for (int i{}; i < 3; i++) left[i] = 1e9;
	for (int i{}; i < 3; i++) top[i] = -1e9;
	for (int i{}; i < 3; i++) bottom[i] = 1e9;

	for (int i{}; i < N; i++)
	{
		long double x, y;
		char d;
		scanf("%Lf%Lf %c", &x, &y, &d);
		if (d == 'R')
		{
			right[2] = std::max(right[2], x);
			left[2] = std::min(left[2], x);
			top[1] = std::max(top[1], y);
			bottom[1] = std::min(bottom[1], y);
		}
		else if (d == 'L')
		{
			right[0] = std::max(right[0], x);
			left[0] = std::min(left[0], x);
			top[1] = std::max(top[1], y);
			bottom[1] = std::min(bottom[1], y);
		}
		else if (d == 'U')
		{
			right[1] = std::max(right[1], x);
			left[1] = std::min(left[1], x);
			top[2] = std::max(top[2], y);
			bottom[2] = std::min(bottom[2], y);
		}
		else if (d == 'D')
		{
			right[1] = std::max(right[1], x);
			left[1] = std::min(left[1], x);
			top[0] = std::max(top[0], y);
			bottom[0] = std::min(bottom[0], y);
		}
	}
	long double min{calcSpace(0)};
	long double velo[3]{-1, 0, 1};
	for (int i{}; i < 3; i++)
	{
		int next{(i + 1) % 3};
		if (left[i] != 1e9 && left[next] != 1e9)
		{
			long double time{-(left[i] - left[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
		if (right[i] != -1e9 && right[next] != -1e9)
		{
			long double time{-(right[i] - right[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
		if (top[i] != -1e9 && top[next] != -1e9)
		{
			long double time{-(top[i] - top[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
		if (bottom[i] != 1e9 && bottom[next] != 1e9)
		{
			long double time{-(bottom[i] - bottom[next]) / (velo[i] - velo[next])};
			if (time >= 0)
				min = std::min(min, calcSpace(time));
		}
	}
	printf("%.10Lf\n", min);

	return 0;
}

long double calcSpace(long double time)
{
	long double r{std::max({right[0] - time, right[1], right[2] + time})};
	long double l{std::min({left[0] - time, left[1], left[2] + time})};
	long double t{std::max({top[0] - time, top[1], top[2] + time})};
	long double b{std::min({bottom[0] - time, bottom[1], bottom[2] + time})};
	return (r - l) * (t - b);
}


Measured memory_bytes: 256
N,M=map(int, input().split())
A=list(map(int, input().split()))
import numpy
D=list(numpy.cumsum(A))
C={}
D.append(0)
for i in D:
  d=i%M
  if d not in C:
    C[d]=1
  else:
    C[d]+=1
#print(C)
ans=0
for i in C.values():
  ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 26112
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static int n,s,ans;
		static int[][] dp;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		for(;cin.hasNext();){
			n=cin.nextInt();
			s=cin.nextInt();
			ans=0;
			dp=new int[1<<10][s+1];
			for(int i=0;i<(1<<10);i++)
				Arrays.fill(dp[i],-1);
			for(int i=0;i<10;i++){
				if(i>s)continue;
				ans+=dp(1<<i,i);
			}
			System.out.println(ans);
		}
	}
	static int dp(int used,int sum){
		if(dp[used][sum]!=-1)return dp[used][sum];
		if(Integer.bitCount(used)==n){
			if(sum==s){
				return 1;
			}
			return 0;
		}
		dp[used][sum]=0;
		for(int i=0;i<10;i++){
			if(((1<<i)&used)==0){
				int step=Integer.bitCount(used)+1;
				if(sum+i*step>s)continue;
				dp[used][sum]+=dp(used+(1<<i),sum+i*(step));
			}
		}
		return dp[used][sum];
	}
}

Measured memory_bytes: 213852
M, D = map(int,input().split())

ans = 0
for i in range(1, M+1):
    for j in range(11, D+1):
        j = str(j)
        k = int(j[0])
        l = int(j[1])
        if k >= 2 and l >= 2 and i == k * l:
            ans += 1

print(ans)

Measured memory_bytes: 9084
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  vector<int> a(5);
  int res;
  rep(i,5){
    int temp; cin >> temp;
    if(temp==0)res = i;
  }
  cout << res +1 << endl;

  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
int main(void)
{
	FIO
	int t = 1;
	// cin>>t;
	while (t--)
	{
		ll x, k;
		cin >> k >> x;
		k *= 500;
		if (k >= x) cout << "Yes\n";
		else cout << "No\n";
	}
	return 0;
}

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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        String s[]=bu.readLine().split(" ");
        int a=Integer.parseInt(s[0]),b=Integer.parseInt(s[1]),c=Integer.parseInt(s[2]),k=Integer.parseInt(s[3]);
        long sum=0;
        sum+=1l*(int)Math.min(a,k);
        k-=a+b;
        if(k>0) sum-=1l*(int)Math.min(k,c);
        System.out.print(sum);
    }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

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

int main(void){	
	int N,A;
	cin>>N>>A;
	cout<<pow(N,2)-A<<endl;
	
	return 0;
}



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

int main()
{
	int t[4],n[4],ans[4];
	for(int i=0; i<4; i++){
		cin>>t[i]>>n[i];
		if(t[i]==1)
			ans[i]=6000 * n[i];
		else if(t[i]==2)
			ans[i]=4000 * n[i];
		else if(t[i]==3)
			ans[i]=3000 * n[i];
		else if(t[i]==4)
			ans[i]=2000 * n[i];
	}
	for(int i=0; i<4; i++){
		cout<<ans[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

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

        String line;
        Integer cnt = -9;
        boolean bit2 = false;
        Map<String, String> mapping = new HashMap<>();
        List<String> inputs = new ArrayList<>();
        while ((line = br.readLine().trim()) != null && !line.isEmpty()) {
            int len = line.split(" ").length;
            if(len == 1) {
                if(bit2) {
                    cnt = Integer.parseInt(line);
                    bit2 = false;
                    continue;
                }
                inputs.add(line);
                cnt--;
                if(cnt==0){
                    output(inputs.subList(1,inputs.size()), mapping);
                    inputs.clear();
                    mapping.clear();
                    cnt = -9;
                    continue;
                }
                if(cnt <=0 && "0".equals(line)) break;
            }
            if(len == 2) {
                List<String> tmp = Arrays.stream(line.split(" ")).collect(Collectors.toList());
                mapping.put(tmp.get(0), tmp.get(1));
                bit2 = true;
            }
        }
    }

    public static void output(List<String> inputs, Map<String, String> mapping) {
        StringBuffer bf = new StringBuffer();
        inputs.forEach(s->bf.append(mapping.get(s) != null ? mapping.get(s) : s));
        System.out.println(bf.toString());
    }
}

Measured memory_bytes: 51588
def main():
    n, m = map(int, input().split())
    a = [int(x) for x in input().split()]

    threshold = sum(a) / (4 * m)
    if sum(1 for i in a if i >= threshold) >= m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
s = input()
c = len(s)-1
r = 0
x = 97
while -2 < c:
    for i in range(x, 97+26):
        if chr(i) not in s:          
            s = s+chr(i)
            r = 1
            break
    if r == 1:
        break
    elif c < 0:
        break
    else:
        x = ord(s[-1]) +1
        c -= 1
        s = s[:len(s)-1]
if r==0:
    s = '-1'
print(s)

Measured memory_bytes: 38520
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
  string Taro, Hanako;
  int Turn, markT=0, markH=0;

  cin >> Turn;

  for(int i=0; i<Turn; i++){
    cin >> Taro >> Hanako;

    if(Taro > Hanako){
      markT += 3;
    }else if(Taro < Hanako){
      markH += 3;
    }else{
      markT++;
      markH++;
    }
  }
  
  cout << markT << " " << markH << endl;
  
  return(0);

}

Measured memory_bytes: 1208
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll inf=0x1f1f1f1f1f1f1f1f;//?造了一个三倍之后不会溢出的?..... 
const ll maxn=205;
ll land[maxn][maxn],sea[maxn][maxn],num[maxn*5],cost[maxn*5][maxn];
void init(int n)
{
	memset(land,inf,sizeof(land));
	memset(sea,inf,sizeof(sea));
	memset(cost,inf,sizeof(cost));
	for(ll i=1;i<=n;++i)
	{
		sea[i][i]=land[i][i]=0;
	}
}
ll slove(ll n,ll m,ll w)
{
	for(ll k=1;k<=n;++k)
	{
		for(ll i=1;i<=n;++i)
		{
			for(ll j=1;j<=n;++j)
			{
				sea[i][j]=min(sea[i][j],sea[i][k]+sea[k][j]);
				land[i][j]=min(land[i][j],land[i][k]+land[k][j]);
			}
		}
	}
	cost[1][num[1]]=0;
	for(ll i=1;i<=w;++i)
	{
		for(ll j=1;j<=n;++j)
		{
			cost[i][j]=min(cost[i][j],cost[i-1][j]+land[num[i-1]][num[i]]);
			for(ll k=1;k<=n;++k)
			{
				cost[i][k]=min(cost[i][k],
				cost[i-1][j]+land[num[i-1]][j]+sea[j][k]+land[k][num[i]]);
			}
		}
	}
	ll ans=inf;
	for(ll i=1;i<=n;++i)
	{
		ans=min(ans,cost[w][i]);
	}
	//return *min_element(cost[w],cost[w]+n+1);
	return ans;
}
int main()
{
	ll n,m;
	while(scanf("%lld%lld",&n,&m),n|m)
	{
		init(n);
		for(ll i=0;i<m;++i)
		{
			ll a,b,c;char ch[10];
			scanf("%lld%lld%lld%s",&a,&b,&c,ch);
			if(ch[0]=='S')
			{
				sea[a][b]=sea[b][a]=min(sea[a][b],c);
			}
			else
			{
				land[a][b]=land[b][a]=min(land[a][b],c);
			}
		}
		ll w;
		scanf("%lld",&w);
		for(ll i=1;i<=w;++i)
		{
			scanf("%lld",&num[i]);
		}
		printf("%lld\n",slove(n,m,w));
	}
	return 0;
}

Measured memory_bytes: 3344
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define SP <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> Graph;

//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S  S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換
int main(){

    ll x;
    cin >> x;
    ll k = (x/11);
    k = k*2;
    if(x-(x/11)*11==0);
    else if(x-(x/11)*11<7) k+=1;
    else k+=2;
    cout << k << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int a[200000];
int n;
int main(){
	
	scanf("%d",&n);
	for(int i = 0;i < n;i ++){
		scanf("%d",&a[i]);
	}
	int cnt = 1;
	int ju = -1;	//1为增 2为减 
	int i = 1;
	for(i;i < n;i ++){
		if(ju == -1){
			if(a[i] > a[i-1]){
				ju = 1;
			}
			else if(a[i] < a[i-1]){
				ju = 2;
			}
			else{
				continue;
			}
		}
		else if(ju == 1 ){
			if(a[i] < a[i-1]){
				cnt++;
				ju = -1;
			}
		}
		else if(ju == 2){
			if(a[i] > a[i-1]){
				cnt++;
				ju = -1;
			}
		}
	}
	//if(i == n+1){
	//	cnt++;
	//}
	printf("%d",cnt);
	return 0;
}

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

int n,m;
long long ans;
pair <long long, long long> ar[100005];

bool cmp(pair<long long, long long> a, pair<long long, long long> b){
	return a.first < b.first;
}

int main(){
	scanf("%d %d", &n, &m);
	for(int i = 0; i < n; i++){
		scanf("%d %d", &ar[i].first, &ar[i].second)	;
	}
	sort(ar, ar+n, cmp);

	ans = 0;
	for(int i = 0; i < n; i++){
		if(m > ar[i].second){
			m -= ar[i].second;
			ans += ar[i].second*ar[i].first;
		}else{
			ans += m*ar[i].first;
			printf("%lld\n", ans);
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

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

		String[] ss0 = br.readLine().trim().split(" ", 0);
		int r = Integer.parseInt(ss0[0]);
		int g = Integer.parseInt(ss0[1]);
		int b = Integer.parseInt(ss0[2]);
		int i = 0;
		
		i = r*100 + g*10 + b;
		
		if(i % 4 == 0){
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}



	return;
	}



}


Measured memory_bytes: 25044
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        boolean[][] cards = new boolean[4][13];
        for(int i = 0; i < n; i++){
            String a = scanner.next();
            int b = scanner.nextInt();
            switch(a) {
                case "S": cards[0][b-1] = true; break;
                case "H": cards[1][b-1] = true; break;
                case "C": cards[2][b-1] = true; break;
                case "D": cards[3][b-1] = true; break;
            }
        }
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 13; k++) {
                if (j == 0 && cards[j][k]==false) {
                    System.out.println("S " + (k+1));
                } else if (j == 1 && cards[j][k]==false) {
                    System.out.println("H " + (k+1));
                } else if (j == 2 && cards[j][k]==false) {
                    System.out.println("C " + (k+1));
                } else if (j == 3 && cards[j][k]==false) {
                    System.out.println("D " + (k+1));
                }
            }
        }
    }
}



Measured memory_bytes: 26248
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const long long INF = 1e18+3;

inline int f(int x) {
	return x / 2;
}

int n, m;
vector <int> v;

vector <int> res;

int main()
{
	boost;
	cin >> n >> m;
	int fn = 0, on = 0, a;
	
	FOR(i, 1, m)
	{
		cin >> a;
		if (a % 2 == 1)
		{
			if (fn && on) OUT("Impossible");
			if (fn) on = a;
			else fn = a;
		}
		else v.pb(a);
	}
	
	if (!fn)
	{
		for (auto u : v) cout << u << ' ';
		cout << "\n";
		res.pb(1);
		for (auto u : v) res.pb(u);
		res[res.size() - 1]--;
		cout << (int)res.size() << "\n";
		for (auto u : res) cout << u << ' ';
	}
	else if (!on)
	{
		cout << fn << ' ';
		for (auto u : v) cout << u << ' ';
		cout << "\n";
		FOR(i, 1, f(fn) + 1) res.pb(2);
		for (auto u : v) res.pb(u);
		res[res.size() - 1]--;
		cout << (int)res.size() << "\n";
		for (auto u : res) cout << u << ' ';
	}
	else
	{
		cout << fn << ' ';
		for (auto u : v) cout << u << ' ';
		cout << on << "\n";
		FOR(i, 1, f(fn) + 1) res.pb(2);
		for (auto u : v) res.pb(u);
		FOR(i, 1, f(on)) res.pb(2);
		cout << (int)res.size() << "\n";
		for (auto u : res) cout << u << ' ';
	}
}


Measured memory_bytes: 640
def main():
    N = int(input())
    a_list = get_a_list()

    a_list.sort(reverse=True)

    sum_second_a = 0
    
    a_list = a_list[:2*N]
    for i in range(1, 2*N, 2):
        sum_second_a += a_list[i]

    print(sum_second_a)

def get_a_list():
    a_list = []
    strs = input().split()

    for a in strs:
        a_list.append(int(a))

    return a_list


if __name__ == '__main__':
    main()


Measured memory_bytes: 37084
n, x = map(int, input().split())
while n != 0 or x != 0:
    count = 0
    for i in range(1, n - 1):
        for j in range(i + 1, n):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    count += 1
    print(count)
    n, x = map(int, input().split())


Measured memory_bytes: 5592
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int cnt[30];
int main()
{
    memset(cnt,0,sizeof(cnt));
    scanf("%s",s);
    int len=strlen(s);
    for(int i=0;i<len;i++)
        cnt[s[i]-'a']++;
    int ans=0;
    for(int i=0;i<26;i++)
    {
        if(cnt[i]==0)
            {printf("%c",i+'a');break;}
        else ans++;
    }
    if(ans==26) puts("None");
    else printf("\n");
    return 0;
}



Measured memory_bytes: 384
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
char G[8][8];
bool p(int i, int j){return (0<=i&&i<8&&0<=j&&j<8)&&(G[i][j] == '1');}
main(){
    while( cin >> G[0][0] ){
	int si = 0, sj = 0;
	rep(i, 8) rep(j, 8) {
	    if (i+j == 0) continue;
	    cin >> G[i][j];
	    if(G[i][j] == '1') { si = i; sj = j;}
	}
	char ch = 'A';
	if ( p(si-3, sj) ) ch = 'B';
	else if ( p(si, sj-3) ) ch = 'C';
	else if ( p(si-2, sj+1)) ch = 'D';
	else if ( p(si-1, sj-2)) ch = 'E';
	else if ( p(si-2, sj-1)) ch = 'F';
	else if ( p(si, sj-1) && p(si-1, sj+1) ) ch = 'G';
	cout << ch << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll num;
  cin>>num;
  if(num==22) cout<<"Christmas Eve Eve Eve"<<endl;
  if(num==23) cout<<"Christmas Eve Eve"<<endl;
  if(num==24) cout<<"Christmas Eve"<<endl;
  if(num==25) cout<<"Christmas"<<endl;

}


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

int main() {
	int n, w;
	cin >> n >> w;
	vector<int> v(n);

	for(int i = 0; i < n; i++) {
		v[i] = i+1;
	}

	int a, b;
	for(int i = 0; i < w; i++) {
		scanf("%d,%d", &a, &b);
		swap(v[a-1], v[b-1]);
	}

	for(int i = 0; i < n; i++) {
		cout << v[i] << endl;
	}		
}

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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define float			double
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vc				vector<char>
#define vb				vector<bool>
#define vf				vector<float>
#define vs				vector<string>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define hashmap         unordered_map
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT64_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

template<class T>
void printV(vector<T> a) {for (auto v : a)cout << v << " ";}
template<class T>
void readV(vector<T>& a) {int n = a.size(); for (int i = 0 ; i < n ; i++)cin >> a[i];}
template<class T>
void printA(T* a , int n) {for (int i = 0; i < n  ; i++)cout << a[i] << " ";}
template<class T>
void readA(T* a , int n) {for (int i = 0 ; i < n ; i++)cin >> a[i];}
auto clk = clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
void run_time() {cout << endl<<"Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;}

void aryan_pandeya() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

class dsu{
private:
    int* parent;
    int* size;

    int root(int x){
        while(x!=parent[x]){
            parent[x] = parent[parent[x]];
            x = parent[x];
        }
        return x;
    }
public:
    int components;
    dsu(int n){
        parent = new int [n];
        size = new int [n];
        components = n ;
        for(int i = 0 ; i<n ; i++){
            parent[i] = i ;
            size[i] = 1;
        }
    }
    bool find(int x , int y){
        return root(x)==root(y);
    }
    void join(int x , int y){
        int i = root(x);
        int j = root(y);
        if(i==j){
            return ;
        }
        else{
            components--;
            if(size[i]<size[j]){
                parent[i] = j;
                size[j]+=size[i];
                size[i] = 0;
            }
            else{
                parent[j] = i ; 
                size[i]+=size[j];
                size[j] = 0;
            }
        }
    }
    int sz(int x){
        return size[x];
    }
};


int32_t main() {
	aryan_pandeya();
	FIO;
 
    int n,q;
    cin>>n>>q;

    dsu g(n);
    
    for(int i = 0 ; i<q ; i++){
        int t,x,y;
        cin>>t>>x>>y;

        if(t==1){
            cout<<g.find(x,y)<<'\n';
        }
        else{
            g.join(x,y);
        }
    }



	return 0;
}


Measured memory_bytes: 6516
import numpy as np
S = np.array(list(input()), dtype='int')

arr2 = np.zeros((len(S)), dtype='int')
arr2[::2] = 1
arr1 = np.ones((len(S)), dtype='int')
arr1[::2] = 0

ans = min(np.count_nonzero(S != arr1), np.count_nonzero(S != arr2))
print(ans)


Measured memory_bytes: 18856
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

struct Edge {
   ll from, to, cost;
   Edge(){}
   Edge(ll from, ll to, ll cost):from(from),to(to),cost(cost){}
};

vector<Edge> g;

bool bellman_ford (int s, int V, vector<ll> &dp) {
    bool neg_loop = false;
    for (int i = 0; i < V; ++i) {
        bool update = false;
        for (auto &&e:g) {
            if (dp[e.from]!=LINF && dp[e.to]>dp[e.from]+e.cost) {
                dp[e.to]=dp[e.from]+e.cost;
                update=true;
            }
        }
        if (!update) break;
        if (i==V-1) {
            neg_loop=true;
            break;
        }
    }
    return neg_loop;
}

int main(int argc, char const *argv[]) {
    int V,E,s; cin>>V>>E>>s;

    rep(i,E) {
        int a,b,c;cin>>a>>b>>c;
        g.push_back(Edge(a,b,c));
    }

    vector<ll> dp(V,LINF);
    dp[s]=0;
    if (bellman_ford(s,V,dp)) cout<<"NEGATIVE CYCLE"<<endl;
    else for (auto &&e: dp) {
        if (e!=LINF) cout<<e<<endl;
        else cout << "INF" << endl;
    }
    return 0;
}


Measured memory_bytes: 3180
from collections import deque


def main():
    N, M = map(int, input().split())
    adj = [[False] * N for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        adj[a][b] = True
        adj[b][a] = True
    retval = 0
    q = deque([(0, set([0]))])
    while len(q):
        cur, visited = q.popleft()
        if len(visited) == N:
            retval += 1
            continue
        for nxt in range(N):
            if nxt in visited:
                continue
            if adj[cur][nxt]:
                next_visited = set(visited)
                next_visited.add(nxt)
                q.append((nxt, next_visited))
    print(retval)


if __name__ == "__main__":
    main()


Measured memory_bytes: 6132
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>

using namespace std;

typedef long long ll;

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

    if (u == s)
        cout << a-1 << " " << b << endl;
    else    
        cout << a << " " << b-1 << endl;

    return 0;
}

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  vector<int> cost(n, 0);
  for (int i = 0; i < m; i++) {
    cost.at(a.at(i))++;
  }
  int left = 0;
  int right = 0;
  for (int i = 1; i < x; i++) {
    left += cost.at(i);
  }
  for (int i = x; i < n; i++) {
    right += cost.at(i);
  }
  cout << min(left, right) << endl;
  return 0;
}


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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const int INF = 1e9;
const int MAXN = 2e5 + 5;
const int MOD = 1e9 + 7;

int n, k, A[MAXN];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> k >> n;
	for(int i=1; i<=n; i++) cin >> A[i];
	int ans = k-(k-A[n]+A[1]);
	for(int i=1; i<n; i++) {
		ans = min(ans, k-A[i+1]+A[i]);
	}
	cout << ans;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
#define MAXE9 1000000000

int i,j,k,l;

int main(){
  int N;
  long A[100001];
  long B[100000];
  long long ans = 0;
  
  scanf("%d", &N);
  for(i=0;i<=N;i++) scanf("%ld", &A[i]);
  for(i=0;i<N;i++) scanf("%ld", &B[i]);
  
  for(i=0;i<N;i++){
      if(A[i] >= B[i]) ans += B[i];
      else if(A[i] < B[i]){
        B[i] -= A[i];
        ans += A[i];
        if(A[i+1] >= B[i]){
          A[i+1] -= B[i];
          ans += B[i];
        }else if(A[i+1] < B[i]){
          ans += A[i+1];
          A[i+1] = 0;
        }
      }
    }
  printf("%lld", ans);
}


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

int main(){
  
    int N,M;
    cin>>N>>M;
    bool ans=false;
    vector<int> A(M),B(M),C(N+1);
    for(int i=0;i<M;i++){
        cin>>A[i]>>B[i];
        if(A[i]==1) C[B[i]]++;
        if(B[i]==N) C[A[i]]++;
    }
    for(int i=0;i<N;i++){
        if(C[i+1]==2) ans=true;
    }
    if(ans) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 2560
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


N = d_in()
A_list = np.array(ds_in())
abs_A = np.abs(A_list)

ans = abs_A.sum()

if (A_list < 0).sum() % 2 == 0:
    print(ans)
else:
    print(ans - min(abs_A)*2)


Measured memory_bytes: 23324
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int n;
bool visited[200005];
vector<vector<int> > to(200005);
ll cnt[2];

void dfs(int v){
    if(visited[v]){  
        return;
    } 
    visited[v]=true;
    cnt[v/100000]++;
    for(int u:to[v]){
        dfs(u);
    }
}

int main(){
    cin >> n;
    rep(i,n){
        int x,y;
        cin >> x>> y;
        x--;y--;
        y+=100000;
        to[x].push_back(y);
        to[y].push_back(x);
    }
    ll ans=0;
    rep(i,200005){
        if(visited[i]==0){
            cnt[0]=0;cnt[1]=0;
            dfs(i);
            ans+=cnt[0]*cnt[1];
        }
    }
    ans-=n;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 58496
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    string s;
    cin >> s;

    string t = "";
    rep (i, s.size())
    {
        if (s[i] != 'x')
        {
            t += s[i];
        }
    }

    bool ok = true;
    rep (i, t.size() / 2)
    {
        if (t[i] != t[t.size() - i - 1])
        {
            ok = false;
        }
    }

    if (!ok)
    {
        cout << "-1\n";
        return 0;
    }

    int ans = 0;
    int l = 0;
    int r = s.size() - 1;
    while (l < r)
    {
        if (s[l] != s[r])
        {
            if (s[l] == 'x') ++l;
            else if (s[r] == 'x') --r;
            ++ans;
        }
        else
        {
            ++l;
            --r;
        }
    }

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



Measured memory_bytes: 592
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcount((unsigned int)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vvl m(M);
    rep(i, N){
        ll x; cin >> x;
        m[x%M].pb(x);
    }
    
    ll ans = m[0].size()/2;
    FOR(i, 1, M/2+1){
        auto p1 = m[i];
        auto p2 = m[M-i];
        if(p1.size() > p2.size()) swap(p1, p2);
        if(i == M/2 && M%2 == 0){
            ans += p2.size()/2;
        }
        else
        {
            ans += p1.size();
            sort(p2.begin(), p2.end());
            ll cnt = 0;
            ll l = 0;
            while(l < p2.size()){
                ll r = l;
                while(r < p2.size() && p2[r] == p2[l]) r++;
                ll c = r-l;
                cnt += c/2;
                l = r;
            }
            ans += min((ll)(p2.size()-p1.size())/2, cnt);
        }
    }
    
    cout << ans << endstr;
    return 0;
}


Measured memory_bytes: 5760
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_solve
{
    class Program
    {
        static void Main(string[] args)
        {
            string data = Console.ReadLine();
            ulong h = ulong.Parse(data);
            double ans = 0;
            ulong q = 0;

            while (h > 0)
            {
                if (h % 2 == 0)
                {
                    h /= 2;
                    
                }
                else
                {
                    h -= 1;
                    h /= 2;
                }
                q++;
                //ans += Math.Pow(2, q - 1);
                //Console.WriteLine(ans+" "+q);
            }
            ans = Math.Pow(2, q )-1;

            Console.WriteLine(ans);
            
            
        }
    }
}



Measured memory_bytes: 13140
# coding=utf-8
import math

def koch(p1, p2, n):
    if n == 0:
        return None
    p1_x = p1[0]
    p1_y = p1[1]
    p2_x = p2[0]
    p2_y = p2[1]

    s_x = (1/3) * (2*p1_x + p2_x)
    s_y = (1/3) * (2*p1_y + p2_y)
    t_x = (1/3) * (p1_x + 2*p2_x)
    t_y = (1/3) * (p1_y + 2*p2_y)

    u_x = s_x + (1/2)*(t_x-s_x) + (-math.sqrt(3)/2)*(t_y-s_y)
    u_y = s_y + (math.sqrt(3)/2)*(t_x-s_x) + (1/2)*(t_y-s_y)

    koch([p1_x, p1_y], [s_x, s_y], n-1)
    print("%.8f %.8f" %(s_x, s_y))
    koch([s_x, s_y], [u_x, u_y], n-1)
    print("%.8f %.8f" %(u_x, u_y))
    koch([u_x, u_y], [t_x, t_y], n-1)
    print("%.8f %.8f" %(t_x, t_y))
    koch([t_x, t_y], [p2_x, p2_y], n-1)


n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print("%.8f %.8f" %(p1[0], p1[1]))
koch(p1, p2, n)
print("%.8f %.8f" %(p2[0], p2[1]))

Measured memory_bytes: 7856
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

last = [0]*26
ans = 0
for d in range(D):
    max_s = int(input()) - 1
    last[max_s] = d+1
    ans += s[d][max_s]
    for i in range(26):
        ans -= (c[i]*(d+1 - last[i]))
    print(ans)

Measured memory_bytes: 9368
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//void p(vector<int> A){rep(i,A.size()){cout << A[i] << " ";}cout << "\n";}
int kaibun(int n){
    int a = n/10000,b = n/1000%10,c = n/100%10,d = n/10%10,e = n%10;
    //cout << a << b << c<<d<<e << "\n";
    if(a == e && b == d)return 1;
    else return 0;
}

int main(){
    int a,b,cnt = 0;
    cin >> a >> b;
    for(int i = a;i <= b;i++){
        if (kaibun(i))cnt++;
    }
    cout << cnt;
}

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

#define MOD 1000000007

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

	int n;
	cin >> n;
	set<string> s;
	for (int i = 0; i < n; ++i) {
		string x;
		cin >> x;
		s.insert(x);
	}
	cout << s.size();
}


Measured memory_bytes: 19248
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int a;
    cin >> a;
    if(a>=30)puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3528
#include <iostream>

inline int m_abs(const int &i){
    if(i < 0)return -i;
    return i;
}

int ans[2000];

int main(){
    int n, x, y;
    std::cin >> n >> x >> y;
    for (int i = 1; i < n+1; ++i) {
        for (int j = i+1; j < n+1; ++j) {
            int dist = std::min(j - i, 1 + m_abs(i-x) + m_abs(j-y));
            ++ans[dist];
        }
    }
    for (int i = 1; i < n; ++i) {
        std::cout << ans[i] << '\n';
    }
}


Measured memory_bytes: 256
n = int(input())

A = list(map(int, input().split()))

j = 0
inde = 0
while(A.count(0) != n):
    for i in range(n):
        if(A[i] == 0):
            if(inde == 1):
                j+=1
                inde = 0
            else:
                continue
        else:
            A[i]-=1
            inde =1
            if(i == n - 1):
                j+=1
        
    inde = 0
print(j)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    string S;
    int w;
    cin >> S >> w;
    string ans = "";
    for (int i = 0; i < S.size(); i += w) {
        ans += S[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;

int a, b;

int main(){
    cin >> a >> b;
    int x = a + b;

    cout << (int)((x + 2 - 1)/2) << endl;
}   

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int i;
    int a,b;
    int j;
    while(scanf("%d%d%d",&a,&b,&j)!=EOF)
    {
        if(j<1 || j>100)
            break;
        if(2*j>b-a+1)
        {
            for(i=a;i<=b;i++)
            {
                printf("%d\n",i);
            }
        }
        else
        {
            for(i=a;i<=a+j-1;i++)
            {
                printf("%d\n",i);
            }
            for(i=b-j+1;i<=b;i++)
            {
                printf("%d\n",i);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

int main() {
    int h, w;
    cin >> h >> w;
    int maze[h * w];
    rep(i, h) {
        string s;
        cin >> s;
        rep(j, w) {
            int hash = i * w + j;
            if (s[j] == '.') {
                maze[hash] = 1;
            }
            else {
                maze[hash] = 0;
            }
        }
    }

    WeightedGraph<int> G(h * w + 1);
    int p;
    if (maze[0] == 1) {
        p = 0;
    }
    else {
        p = 1;
    }
    rep(i, h) {
        rep(j, w) {
            int hash = i * w + j;
            int up = hash - w;
            int down = hash + w;
            int right = hash + 1;
            int left = hash - 1;
            if (i != h - 1) {
                if (maze[hash] == 1 && maze[down] == 0) {
                    G[hash].emplace_back(down, 1);
                }
                else{
                    G[hash].emplace_back(down, 0);
                }
            }
            if (j != w - 1) {
                if (maze[hash] == 1 && maze[right] == 0) {
                    G[hash].emplace_back(right, 1);
                }
                else{
                    G[hash].emplace_back(right, 0);
                }
            }
        }
    }
    cout << p + dijkstra(G, 0)[h * w - 1] << endl;
}


Measured memory_bytes: 896
n=int(input())
p=[list(map(int,input().split()))for i in range(n-1)]
for i in range(n):
    c=0
    d=p[i:]
    for j in range(n-i-1):
        if c<d[j][1]:
            c+=d[j][1]+d[j][0]-c
        else:
            c+=((c-1)//d[j][2]+1)*d[j][2]+d[j][0]-c
    else:
        print(c)

Measured memory_bytes: 3188
fn main() {
    let n: u64 = read();
    let ma = (n as f64).sqrt() as u64;

    let mut ret = u64::max_value();
    for i in 1..ma+1 {
        if n % i == 0 {
            let cnt = (i - 1) + (n / i - 1);
            if ret > cnt {
                ret = cnt;
            }
        }
    }

    println!("{}", ret);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}


Measured memory_bytes: 4352