akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>

int main(){
	//入力機構
	std::string s;
	std::cin>>s;
	//解答
	//sの全ての文字を見れば良い
	int ans=0;
	for(size_t i=0,size=s.size();i<size;i++){
		if(s[i]=='+'){
			ans++;
		} else if(s[i]=='-'){
			ans--;
		}
	}

	//結果出力
	std::cout<<ans<<std::endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<string.h>
#include<algorithm>
using namespace std;
int n,m;
string st[110];
int main()
{
	cin>>n>>m;
	for(int i=1; i<=n; i++)
		cin>>st[i];
	sort(st+1,st+1+n);
	for(int i=1; i<=n; i++)
		cout<<st[i];
	return 0;
}


Measured memory_bytes: 256
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from fractions import gcd
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (
    acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
    sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits


def inp():
    return(int(input()))


def inlist():
    return(list(map(int, input().split())))


def instr():
    s = input()
    return(list(s[:len(s)]))


def invr():
    return(map(int, input().split()))


count = dict()

n = inp()

for _ in range(n):
    a = inp()
    if a in count:
        count[a] += 1
    else:
        count[a] = 1

c = 0

for key in count:
    c += count[key] % 2
print(c)


Measured memory_bytes: 17136
import math
def main():
    n = int(input())
    a_li = list(map(int,input().split()))
    ans = 0
    for i in range(1,n):
        if(a_li[i] >= a_li[i-1]):
            continue
        ans += a_li[i-1] - a_li[i]
        a_li[i] = a_li[i-1]
    print(ans)
    
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 33016
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    int flag=0;
    cin>>N;
    int element;
    for(int i=0;i<N;i++){
        cin>>element;
        if(element%2==0){
            if(element%3==0 || element%5==0){
                
            }
            else{
                cout<<"DENIED";
                flag=1;
                break;
            }
        }
    }
    if(flag==0){
        cout<<"APPROVED";
    }


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main () {
	int N;
	scanf("%d", &N);
	if (N%10 == 7 || (N/10) %10 == 7 || N/100 == 7) {
		puts("Yes\n");
		
	}
	else {
		puts("No\n");
		
	}
	return 0;
}

Measured memory_bytes: 1664
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>

 
using namespace std;
 
#define INF 1000000000
#define EPS 1e-9
#define PI acos(-1)
 
typedef long long ll;

#define MAX_P 800
#define MAX_Q 800
#define MAX_A 12000
#define MAX_N 7

int p,q,a,n;
vector<int> ans_list;

//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd

//*********************************************************
// 最小公倍数（Least Common Multiple）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm


//solve(現在の分解数, 現在の分数の分子, 現在の分数の分母, 分母の積, 前の分母の値)
int solve(int num, int P, int Q, int seki, int pre){

  int ans = 0;
  if(num > n)
    return 0;
  if(seki > a)
    return 0;

  if(P*q == Q*p && P != 0 && Q != 0)
    return 1;

  if((double)p/q < (double)P/Q)
    return 0;

  for(int i = pre; i*seki <= a; i++){
    if(num == 0)
      ans += solve(1,1,i,i,i);
    else{
      ans += solve(num+1, P*i + Q, Q*i, seki*i, i);
    }
  }

  return ans;

}

int main(){

  while(true){
    cin >> p >> q >> a >> n;
    if(p == 0 && q == 0 && a == 0 && n == 0)
      break;
   
    ans_list.push_back(solve(0,0,0,1,1));

  }



  for(int i = 0; i < ans_list.size(); i++){
    cout << ans_list[i] << endl;
  }


  
  return 0;

}

Measured memory_bytes: 1228
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
const int L=-100000;
const int R=-999999;
const int MA=1100000;
bool t[MA];
int table[1100][1100];
bool used[1100][1100];
P ans[1100][1100];

const int INF=-1;
int n,start;
int ny,nx;

void eratosu(){

	t[0]=1;
	t[1]=1;

	for(int i=2;i<=MA;i++){
		if(t[i]==0){
			for(int j=i*2;j<=MA;j+=i)t[j]=1;
		}
	}
}
void make_table(int y,int x){
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int mo=0,ho=0,cnt=0,turn=0,turnnum=1;

for(int i=1;i<=n;i++){
	//cout<<y<<" "<<x<<endl;
	if(cnt==ho){
		turnnum++;
		ho=(turnnum)/2;	
		cnt=0;
		turn++;
		if(turn==4)turn=0;
	}
	//cout<<x-500<<" "<<y-500<<" "<<i<<endl;
	table[y][x]=i;
	if(i==start)ny=y,nx=x;
	x+=dx[turn];
	y+=dy[turn];
	cnt++;
}

}

int main(){
eratosu();

while(cin>>n>>start,n||start){
rep(i,1100)rep(j,1100)table[i][j]=ans[i][j].first=ans[i][j].second=INF;
rep(i,1100)rep(j,1100)used[i][j]=0;
int sy=500,sx=500;//ハジメの座標
make_table(sy,sx);


queue<P>bfs;
bfs.push(mp(ny,nx));
if(!t[table[ny][nx]]){
ans[ny][nx].first=1;
ans[ny][nx].second=table[ny][nx];
}
else ans[ny][nx].first=0;
int cnt=0;
while(!bfs.empty()){

	int y,x;
	P now;
	now=bfs.front();
	bfs.pop();
	y=now.first,x=now.second;
	if(used[y][x])continue;
	used[y][x]=1;
	//if(ans[y][x].first!=INF)continue;
	int ty=y+1,tx=x;
//cout<<y<<" "<<x<<endl;
	for(int i=-1;i<=1;i++){
		tx=x+i;
		int is=0;

		if(table[ty][tx]!=INF){
			if(!t[table[ty][tx]]){
				is=1;
				//ans[ty][tx].second=max(ans[y][x].second,table[ty][tx]);
				}
			else{
				//ans[ty][tx].seocnd=max(ans[y][x].secon
				is=0;
			}
			if(ans[ty][tx].first<ans[y][x].first+is){
				ans[ty][tx].first=ans[y][x].first+is;
				if(is)ans[ty][tx].second=table[ty][tx];
			}
			else if(ans[ty][tx].first==ans[y][x].first+is){
				ans[ty][tx].second=max(ans[ty][tx].second,ans[y][x].second);
			}
		
			////ans[ty][tx].first=max(ans[ty][tx].first,ans[y][x].first+is);
			//else ans[ty][tx]=max(ans[ty][tx],ans[y][x]);
			bfs.push(mp(ty,tx));
		}
	}
}

int ansa=0,ansb=0;
rep(i,1100){
	bool f=1;
	rep(j,1100){
		//if(ans[i][j].second!=INF){cout<<ans[i][j].second<<" ";f=0;}
		//if(ansa==ans[i][j]&&ansb<table[i][j])ansb=table[i][j];
		//if(ansa<ans[i][j])ansa=ans[i][j],ansb=table[i][j];
		if(ansa<ans[i][j].first)ansa=ans[i][j].first,ansb=ans[i][j].second;
		if(ansa==ans[i][j].first&&ans[i][j].second>ansb)ansb=ans[i][j].second;
	
	}	
	if(!f)cout<<endl;
}
cout<<ansa<<" "<<ansb<<endl;
}
	return 0;
}


Measured memory_bytes: 19624
#include <bits/stdc++.h>
using namespace std;
int main()
{
    using ll = long long;
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll bit = 1;
    k++;

    ll ans = 0;
    for(int i = 0; i < 40; i++)
    {
        if(bit & k)
        {
            ll tmpbit = bit;
            ll x = k & ~tmpbit;
            ll tmpans = 0;
            for(int j = i-1; j >= 0; j--)
            {
                tmpbit /= 2;
                ll ck = 0;
                for(int k = 0; k < n; k++)
                {
                    if(a[k] & tmpbit) ck++;
                }
                if(ck < n - ck) x |= tmpbit;
                else x &= ~tmpbit;
            }
            for(int k = 0; k < n; k++)
            {
                tmpans += a[k] ^ x;
            }
            ans = max(ans, tmpans);
        }
        bit *= 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll modpow(ll a, ll n){
  if(n==0)return 1;
  if(n%2==0){
    ll t=modpow(a,n/2);
    return t*t%MOD;
  }
  return a*modpow(a,n-1)%MOD;
}
ll modinv(ll a){
  return modpow(a,MOD-2);
}
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
 
    UnionFind(int n = 1) {
        init(n);
    }
 
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }
 
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
 
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
 
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  COMinit();
  
  ll a,b;
  cin >> a >> b;
  if((a+b)%2==1)cout<<"IMPOSSIBLE"<<endl;
  else cout <<(a+b)/2 << endl;
}


Measured memory_bytes: 12288
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	string s; cin >> s;
	int ans = 99;
	if(s=="SUN") ans = 7;
	if(s=="MON") ans = 6;
	if(s=="TUE") ans = 5;
	if(s=="WED") ans = 4;
	if(s=="THU") ans = 3;
	if(s=="FRI") ans = 2;
	if(s=="SAT") ans = 1;
	out(ans);
}




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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    string s,t;
    i32 n,m;
    cin >> n >> m;


    if(m >= n) cout <<  "unsafe"   << '\n';
    else cout << "safe" << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3652
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int MOD=1000000007;
int f(int n,int m){
	vi dp(n,1);
	rep(i,m){
		rep(j,n-1)(dp[j]+=dp[j+1])%=MOD;
		dp[n-1]=0;
		rep(j,n-1)(dp[n-1-j]+=dp[n-2-j])%=MOD;
	}
	int sum=0;
	rep(i,n)(sum+=dp[i])%=MOD;
	return sum;
}
signed main(){
	int n,m;
	cin>>n>>m;
	cout<<(MOD+f(n+1,m)-f(n,m))%MOD<<endl;
}















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

int N, K;
vector<int> d;
vector<vector<int>> A;

int main()
{
	cin >> N >> K;
	d.resize(K); 
	A.resize(K, vector<int>());
	for (int i = 0; i < K; i++)
	{
		cin >> d[i];
		A[i].resize(d[i]);
		for (int j = 0; j < d[i]; j++)
		{
			cin >> A[i][j];
		}
	}

	int ans = 0;
	for (int i = 1; i <= N; i++)
	{
		bool have = false; //haveは変数
		for (auto v : A)
		{
			for (auto p : v)
			{
				if (p == i)have = true;
			}
		}
		if (!have) ans++;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3616
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b = na()

if a >= 13:
	print(b)
elif a >= 6 and a <= 12:
	print(b // 2)
else:
	print(0)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll Mod=1e9+7;
int n,m,k,N;
ll ans,fac[900005],inv[900005],er[900005],san[900005],b,c;
ll quipow(ll x,ll m)
{
    ll res=1;
    while(m)
    {
        if(m&1) res=res*x%Mod;
        x=x*x%Mod;
        m>>=1;
    }
    return res;
}
ll C(int y,int u)
{
    if(y>u) return 0;
    return fac[u]*inv[y]%Mod*inv[u-y]%Mod;
}
int main()
{
    fac[0]=fac[1]=1;
    for(ll i=2;i<=900000;i++) fac[i]=fac[i-1]*i%Mod;
    inv[900000]=quipow(fac[900000],Mod-2);
    for(ll i=899999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%Mod;
    er[0]=1;
    for(ll i=1;i<=900000;i++) er[i]=er[i-1]*2%Mod;
    san[0]=1;
    for(ll i=1;i<=900000;i++) san[i]=san[i-1]*3%Mod;
    scanf("%d%d%d",&n,&m,&k);N=n+m+k;
    for(int i=n;i<=N;i++)
    {
        int la=i-n;
        ll now=C(n-1,i-1),gg=er[la];
        b=(b+(m+1==la?1:(m+1<la?(b+C(i-n-m-1,i-n-1)):0)))%Mod;
        c=(c+(k+1==la?1:(k+1<la?(c+C(i-n-k-1,i-n-1)):0)))%Mod;
        gg=(gg-b+Mod)%Mod;gg=(gg-c+Mod)%Mod;
        ans=(ans+now*gg%Mod*san[N-i]%Mod)%Mod;
    }
    printf("%lld",ans);
}

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

using namespace std;

void bubbleSort(vector<int> &a)
{
	int tmp;
	for (int i = 0; i < a.size() - 1; i++)
	{
		for (int j = 0; j < a.size() - 1 - i; j++)
		{
			if (a[j] < a[j + 1])
			{
				tmp = a[j + 1];
				a[j + 1] = a[j];
				a[j] = tmp;
			}
		}
	}
}

int main()
{
	int n;
	cin >> n;
	vector< vector<int> > a(n, vector<int>(3, 0));
	for (int i = 0; i < n; i++)
	{
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	for (int i = 0; i < n; i++)
	{
		bubbleSort(a[i]);
		if (pow(a[i][0], 2) == pow(a[i][1], 2) + pow(a[i][2], 2))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define lli long long int
#define ll double
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
#define mod 1000000007
using namespace std;
#define maxval 10003000

int main(){
   IOS;
lli t;t=1;//cin>>t;
while(t--){
lli a,b,h,m;cin>>a>>b>>h>>m;
lli c=h*60+m;
ll x=c*0.5;
ll y=m*6;

ll z=(x-y);
if(x<y) z=z+360.0;
z=(z*3.141592653589793238)/180.0;
ll v=(ll)a*(ll)a;
ll w=b*b;
c=2*a*b;
ll d=v+w-(c*cos(z));
cout<<setprecision(20)<<sqrt(d)<<"\n";



} 
    
    

    
return 0;    
}

Measured memory_bytes: 4204
// https://atcoder.jp/contests/abc157/tasks/abc157_d
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;

// root: -size of tree, others: parent id
struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n, -1) {}
    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    
    bool same(int x, int y) {
        return find(x) == find(y);
    }

    int size(int x) {
        return -d[find(x)];
    }
};

int deg[100005];
vector<int> to[100005];

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        deg[a]++;
        deg[b]++;
        uf.unite(a, b);
    }

    rep(i, 0, k) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    rep(i, 0, n) {
        int ans = uf.size(i) - 1 - deg[i];
        for(int u : to[i]) {
            if (uf.same(i, u)) ans--;
        }
        printf("%d%c", ans, i==n-1 ? '\n' : ' ');
    }
    
    return 0;
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

    if((b - a) % 2 == 0) {
        cout << (b - a) / 2 << endl;
        return 0;
    } else {
        // aが左に到着の後、1回。歩み寄る。
        lint c1 = (a - 1) + 1 + (b - a - 1) / 2;
        // bが右に到着の後、1回。歩み寄る
        lint c2 = (n - b) + 1 + (n - (a + n - b + 1)) / 2;
        cout << min(c1, c2) << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b , c , x , d = 0;
    cin >> a >> b >> c >> x;
    for( int i = 0 ; i <= a ; i++ ) {
        for( int j = 0 ; j <= b ; j++ ) {
            for( int k = 0 ; k <= c ; k++ ) {
                if( i * 500 + j * 100 + k * 50 == x ) d++;
            }
        }
    }
    cout << d;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;


int main(){
 
    while(true) {
        int n;
        cin>>n;
        if(n==0)break;
        
        bool hl=false;
        bool now[2]={false,false};
        
        int ans=0;
        
        REP(i,n){
            string inst;
            cin>>inst;
            if(inst=="lu")now[0]=true;
            if(inst=="ru")now[1]=true;
            if(inst=="ld")now[0]=false;
            if(inst=="rd")now[1]=false;
            if(now[0]==now[1])if(now[0]!=hl){
                hl=!hl;
                ans++;
            }
        }
        
        cout<<ans<<endl;
    
    }
    return 0;
}

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

int main(){
  string a,b,c;
  int d,e;
  cin >> a >> b;
  cin >> d >> e;
  cin >> c;
  if(a==c)d--;
  if(b==c)e--;
  cout << d << " " << e << endl;
}



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



int main() {
	int A, B, K;
	cin >> A >> B >> K;
	if(K <= (B - A + 1) / 2){
		for(int i = A; i < A + K; i++){
			cout << i << endl;
		}
		for(int i = B - K + 1; i <= B; i++){
			cout << i << endl;
		}
	}
	else{
		for(int i = A; i <= B; i++){
			cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
l = 1
for i in range(N):
    l *= a[i]
l -= 1
ans = 0
for i in range(N):
    ans += l%a[i]
print(ans)

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

using namespace std;

int main()
{
    vector<long long> dim(3);
    cin >> dim[0] >> dim[1] >> dim[2];

    if((dim[0] % 2 == 0) ||(dim[1] % 2 == 0) || (dim[2] % 2 == 0)){
        cout << "0" << endl;
        return 0;
    }

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

    cout << dim[0] * dim[1] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 10000000;

int main() {
    int A, B, M; cin >> A >> B >> M;
    vector<int> a(A), b(B), x(M), y(M), c(M);
    for (int i=0; i<A; i++) cin >> a[i];
    for (int i=0; i<B; i++) cin >> b[i];
    for (int i=0; i<M; i++) cin >> x[i] >> y[i] >> c[i];

    int a_min = MAX, b_min = MAX;
    for (int i=0; i<A; i++) a_min = min(a_min, a[i]);
    for (int i=0; i<B; i++) b_min = min(b_min, b[i]);

    int ans = a_min + b_min;
    for (int i=0; i<M; i++) {
        ans = min(ans, a[x[i]-1] + b[y[i]-1] - c[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2176
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int n,m,a[1001],b[1001],cou[1001]={0},num=0,ans=0;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<m;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(a[j]<=b[i]){
                cou[j]++;
                break;
            }
        }
    }
    for(int i=0;i<n;i++){
        ans=max(ans,cou[i]);
    }
    for(int i=0;i<n;i++){
        num++;
        if(ans==cou[i])break;
    }
    cout<<num<<endl;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, K, h, cnt;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; ++i) {
		cin >> h;
		if (h >= K)++cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  int d[3];
  rep(i,0,3){
    cin >> d[i];
  }
  swap(d[0], d[1]);
  swap(d[0], d[2]);
  printf("%d %d %d\n", d[0], d[1], d[2]);
  return 0;
}


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    ll A[N]; rep(i, N) cin >> A[i];
    sort(A, A+N, greater<ll>());
    ll ans = A[0];
    int came = 2;
    for(int i = 1; came < N; i++){
        rep(j, 2){
            if(came == N) break;
            ans += A[i];
            came++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

LL gcd(LL x, LL y){
	return y==0?x:gcd(y,x%y);
}

bool solve(LL A, LL B, LL C, LL D){
	if(A < B || D < B) return 0;
	if(B+1 <= C) return 1;
	if(A%B > C) return 0;
	LL g = gcd(B,D);
	LL e = A%g;
	LL f = (C-e)/g;
	LL p = (D/g)%(B/g);
	if(B/g <= f+1) return 1;
	return p == 0;
}

int main(){
	int T; cin >> T;
	repp(rep_T,0,T){
		LL A,B,C,D; cin >> A >> B >> C >> D;
		cout << (solve(A,B,C,D)?"Yes":"No") << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N, M, C;
    int B[20];
    int A[20][20];

    cin >> N >> M >> C;
    for(int i = 0; i < M; i++) {
        cin >> B[i];
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }

    int count = 0;
    for(int i = 0; i < N; i++) {
        int sum = 0;
        for(int j = 0; j < M; j++) {
            sum += A[i][j] * B[j];
        }
        if(-C < sum) count++;
    }

    cout << count << endl;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	
	string s; cin >>s;
	int n=sz(s);
	rep(i, n-2){
		if(s[i]==s[i+1] || s[i]==s[i+2]){
			cout << i+1 <<" "<< i+3<<"\n";
			return 0;
		}
	}
	if(s[n-1]==s[n-2]) cout << n-1 <<" " <<n <<"\n";
	else cout << "-1 -1\n";
	return 0;
}

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

//セルで考えてみる。
int W, H, N;
int x[110], y[110], a[110];
int field[110][110];

int main()
{
    cin >> W >> H >> N;

    for (int i = 0; i < N; i++)
    {
        cin >> x[i] >> y[i] >> a[i];
    }

    for (int i = 0; i < N; i++)
    {
        if (a[i] == 1)
        {
            for (int j = 0; j < x[i]; j++)
            {
                for (int k = 0; k < H; k++)
                {
                    field[j][k] = 1;
                }
            }
        }
        else if (a[i] == 2)
        {
            for (int j = x[i]; j < W; j++)
            {
                for (int k = 0; k < H; k++)
                {
                    field[j][k] = 1;
                }
            }
        }
        else if (a[i] == 3)
        {
            for (int j = 0; j < W; j++)
            {
                for (int k = 0; k < y[i]; k++)
                {
                    field[j][k] = 1;
                }
            }
        }
        else
        {
            for (int j = 0; j < W; j++)
            {
                for (int k = y[i]; k < H; k++)
                {
                    field[j][k] = 1;
                }
            }
        }
    }

    int cnt = 0;
    for (int i = 0; i < W; i++)
    {
        for (int j = 0; j < H; j++)
        {
            if(field[i][j] == 0) cnt++;
        }
    }
    cout << cnt << endl;    

    return 0;
}


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

int main(){
	int n,k,num,sum;
	cin>>n>>k;
	vector<int> l;
	for(int i=1;i<=n;i++){
		cin>>num;
		l.push_back(num);	
    }
	sort(l.rbegin(), l.rend());
	for(int j=0;j<k;j++){
    	sum+=l[j];
    }
	cout<<sum;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;


int main(){

    string s;
    cin>>s;
    string k="keyence";
    
    for(int i=0;i<s.size();i++){
        
        for(int j=i;j<s.size();j++){
            string s1=s.substr(0,i);
            string s2=s.substr(j,s.size()-j+1);
            string s3=s1+s2;
            if(s3==k){
                cout<<"YES"<<endl;
                return 0;
            }
            
            
        }
        
        
    }
    cout<<"NO"<<endl;
    return 0;
    
    
    
    
    
return 0;
}

Measured memory_bytes: 256
// ------- PBDS ------ //
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
// ------- PBDS ------ //

#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define testcase ll tt; cin>>tt; while(tt--)
#define pb push_back
#define nn cout<<"\n"
#define MOD 1000000007
#define pi 3.1415926535
#define endl "\n"
#define vll vector<ll>
#define MULTI int T; cin >> T; while(T--)
#define all(a)      (a).begin(),(a).end()
#define here cout<<"I'm here\n";
void vout(vector<ll> ans){
    for(auto ele:ans) cout<<ele<<" "; cout<<endl;
}
vector<ll> adj[200001];
bool vis[200001];

// ------- PBDS ------ //
typedef tree<
// change this for any data-type
string,
null_type,
// change this for any data-type
less<string>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

/*
    to get the position of an element in set , do
    s.order_of_key(ele);
    this returns the number of elements strictly lesser than ele in set s
    Let us assume we have a set s : {1, 5, 6, 17, 88}, then :
    s.order_of_key(6) : Count of elements strictly smaller than 6 is 2.
    s.order_of_key(25) : Count of elements strictly smaller than 25 is 4.

    to get the element at position k
    s.find_by_order(k);
    returns an iterator to the ele counting from 0
    Let us assume we have a set s : {1, 5, 6, 17, 88}, then :
    *(s.find_by_order(2)) : 3rd element in the set i.e. 6
    *(s.find_by_order(4)) : 5th element in the set i.e. 88
*/

// ------- PBDS ------ //

clock_t time_p=clock();
void purvansh11()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

//BINARY EXPONENTIATION  -- O(log2(b))
ll power(ll a, ll b) {
    /*
        for 3^11 :
        as 11 -> 1011, we mean 3^8 * 3^2 * 3^1
        so multiply for all ones in binary rep of b
    */

    ll ans = 1;
    ll num = a;
    while (b > 0) {
        if (b & 1) ans = ((ans % MOD) * (num % MOD)) % MOD;
        num = ((num % MOD) * (num % MOD)) % MOD;
        b /= 2;
    }
    return ans;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    SPEED;
    cout.precision(8);
    cout << fixed;
    string s;
    cin>>s;
    ll cnt=0;
    if(s=="SSS") cout<<0;
    if(s=="RRR") cout<<3;
    if(s=="RSR") cout<<1;
    if(s=="SRS") cout<<1;
    if(s=="RRS") cout<<2;
    if(s=="SSR") cout<<1;
    if(s=="RSS") cout<<1;
    if(s=="SRR") cout<<2;

    
    purvansh11();
    return 0;
}

Measured memory_bytes: 8456
N = int(input())
S = []
P = []
Num = []
for i in range(N):
  s, p = input().split()
  S.append(s)
  P.append(int(p))
  Num.append(i+1)
for i in range(N):
  for m in range(i):
    if S[m] > S[i] or (S[m] == S[i] and P[i] > P[m]):
      S[m], S[i] = S[i], S[m]
      P[m], P[i] = P[i], P[m]
      Num[m], Num[i] = Num[i], Num[m]
for i in range(N):
  print("{}".format(Num[i]))

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int A,B,C; cin >>A>>B>>C;
    
    int ans = min(B/A,C);

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
int n,m,ans[100005];
vector<int>g[100005];
#define INF 0x3f3f3f3f
struct mzls
{
	int a,b;
	bool operator < (const mzls &x) const
	{
		return x.a<a;
	}
}as;
priority_queue<mzls>que;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		g[x].push_back(y);
		g[y].push_back(x);
		ans[i]=INF;
	}
	ans[n]=INF;
	scanf("%d",&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&as.b,&as.a);
		que.push(as);
		ans[as.b]=as.a;
	}
	while(!que.empty())
	{
		as=que.top();
		que.pop();
		int u=as.b;
		for(int i=0;i<g[u].size();i++)
		{
			int v=g[u][i];
			if(ans[v]==INF)
			{
				ans[v]=ans[u]+1;
				as.b=v,as.a=ans[v];
				que.push(as);
			}
			if(!((ans[v]-ans[u])==1||(ans[v]-ans[u])==-1))
			{
				printf("No");
				return 0;
			}
		}
	}
	printf("Yes\n");
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
}

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

int main()
{
    int l, i = 0, buf[10000], cnt = 1;
    while (cin >> l) {
        buf[i++] = l;
    }
    for (int j = 0; j < i; j++) {
        int num = buf[j];
        if (num == 0)
            continue;
        cout << "Case " << cnt++ << ": " << num << endl;
    }
    return 0;
}



Measured memory_bytes: 3104
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;

int main() {
  int N, b, c;
  cin >> N >> b;
  for (int i = 1; i < N; i++) {
    cin >> c;
    if (c > b) c--;
    if (c < b) {
      cout << "No" << endl;
      return 0;
    }
    b = c;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3100
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
print(N*(N-1)//2)


Measured memory_bytes: 61976
#include <iostream>
using namespace std;
int main(){
  int R,G,B,N; cin >> R >> G >> B >> N;
  long long int ans=0;
  for(int r=0;r*R<=N;r++){
    for(int g=0;g*G<=(N-r*R);g++){
      int b=(N-r*R-g*G)/B;
      if((N-r*R-g*G-b*B)==0)
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
H, W = input().split(" ")
H = int(H)
W = int(W)
table = []
for i in range(H):
    table.append(list(input()))

i = 0
while i < H:
    if '#' not in table[i]:
        del table[i]
        H -= 1
    else:
        i = i + 1

table_t = [list(x) for x in zip(*table)]

i = 0
while i < W:
    if '#' not in table_t[i]:
        del table_t[i]
        W -= 1
    else:
        i = i + 1

table = [list(x) for x in zip(*table_t)]

for i in range(H):
    print("".join(table[i]))

Measured memory_bytes: 3316
import collections
N=int(input())
A=list(input().split())
a=collections.Counter(A)
A=[int(i) for i in A]
S=sum(A)
Q=int(input())
for i in range(Q):
    B,C=input().split()
    if B in a:
        b=a[B]
        S-=int(B)*b
        S+=int(C)*b
        del a[B]
        if C in a:
            a[C]+=b
        else:
            a[C]=b
    print(S)







    



    





    






        






    
















        


























            
    


    


    
    














    


    














Measured memory_bytes: 24968
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
 
#define cmp_all(X) (X).begin(), (X).end(), cmp
 
#define B begin()
#define E end()
#define sz size()
#define skip continue
 
#define ppi pair<pair<int, int>, int>
#define pii pair<int, int> 
#define pli pair<ll, int>
#define pcc pair<char, char>

#define F first
#define S second
 
using namespace std;
 
const int maxn = 1e7 + 17;
const int MAXN = maxn * 4;
const int darr = 1e3 + 17;
const ll INF = 1e17 + 5;
const int mod = 1e9 + 7;
 
void Need_For_Speed () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int a, b, c;
ll ab, bc, ac;

int main () {
	Need_For_Speed();
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0;
		return 0;
	}
	ab = a * 1ll * b;
	bc = b * 1ll * c;
	ac = a * 1ll * c;
	cout << min(ab, min(bc, ac));
	return 0;
} 

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

using namespace std;

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

typedef long long int lld;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(15);
    cout << fixed;

    string w[3] = {"Sunny", "Cloudy", "Rainy"};
    string s;

    cin >> s;

    for (int i = 0; i < 3; i++) {
        if (w[i] == s) {
            cout << w[(i + 1) % 3] << '\n';
            return 0;
        }
    }

    return 0;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, m;
    cin >> n >> m;
    ll a[n];
    std::vector<ll> v;
    //ll sum = 0;
    rep(i, n) {
        cin >> a[i];
        v.push_back(a[i]);
        //sum += a[i];
    }
    Sort_rev(v);
    ll all = accumulate(ALL(v), 0LL);
    ll ans = 0;
    rep(i, n) {
        if ( v[i]*4*m >= all ) {
            ans++;
        } else {
            break;
        }
    }
    if ( ans >= m ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

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

using namespace std;
int A,B,K;
int main(){
	cin >> A >> B >> K;
  for(int i=100;i>0;i--){
    if(A%i != 0 || B%i != 0) continue;
    K--;
    if(K==0){
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	
  	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
      	String input = sc.nextLine();
      	int count = Integer.valueOf(input);
      	boolean[] found = new boolean[101];
      	int total = 0 ;
        for( int i = 0; i<count ;i++) {
          int value = Integer.valueOf(sc.nextLine());
          if(found[value]==false) {
          	found[value] = true;
            total++;
          }
        }
      	System.out.println(total);
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n;
    rep(i,0,n-1){
        int a; cin>>a;
        if(a%2==0){
            if(a%3==0||a%5==0) ;
            else{
                cout<<"DENIED";
                return 0;
            }
        }
    }
    cout<<"APPROVED";
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
def merge(a,l,m,r)
  nl = m - l
  nr = r - m
  al = Array.new(nl+1)
  ar = Array.new(nr+1)
  for i in 0...nl
    al[i] = a[l+i]
  end
  for i in 0...nr
    ar[i] = a[m+i]
  end
  al[nl] = 1000000001
  ar[nr] = 1000000001
  i = 0
  j = 0
  cnt = 0
  for k in l...r
    if al[i] <= ar[j]
      a[k] = al[i]
      i += 1
    else
      a[k] = ar[j]
      j += 1
    end
    cnt += 1
  end
  cnt
end

def mergesort(a,l,r)
  cnt = 0
  if l+1 < r
    m = (l+r)/2
    cnt += mergesort(a,l,m)
    cnt += mergesort(a,m,r)
    cnt += merge(a,l,m,r)
  end
  cnt
end

n = gets.to_i
a = gets.split.map(&:to_i)
c = mergesort(a,0,n)
for i in 0...n
  print " " unless i == 0
  print a[i]
end
print "\n"
puts c

Measured memory_bytes: 194800
#include <iostream>

int main(){
    int a, b, c;
    int num=0;
    std::cin >> a >> b >> c;
    for (int i = a; i < b+1;i++)
        if(c%i == 0)
            num++;
            
    std::cout << num << std::endl;

    return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int solve3()
{
    long n;
    cin >> n;

    long min = n-1;
    for (long i = 1; i <= (long)ceil(sqrt(n)); ++i) {
        if (fmod(n, i) == 0) {
            long j = n / i;
            if (i+j-2 < min) {
                min = i+j-2;
            }
        }
    }
    
    cout << min << endl;
    return 0;
}

int main(int argc, const char * argv[]) {
    return solve3();
}


Measured memory_bytes: 256