akhauriyash/Code-Regression huggingface dataset:
from sys import stdin
input = stdin.readline

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Decimal(x):
  print("{0:.10f}".format(x))

class Pair:
  def __init__(self, x, y):
    self.first = x
    self.second = y

  def __repr__(self):
    return '{0} {1}'.format(self.first, self.second)

  def __lt__(self, pi):
    return self.first < pi.second

def POW(x, n):
  ret = 1
  while n:
    if n&1:
      ret *= x
    x *= x
    n >>= 1
  return ret

class EratosthenesSieve:
  def __init__(self, N=1):
    self.f = [0 for _ in range(N+1)]
    self.f[0] = self.f[1] = -1
    self.primes = []
    for i in range(2, N+1):
      if self.f[i]:
        continue
      self.primes.append(i)
      self.f[i] = i
      for j in range(i*i, N+1, i):
        if not self.f[j]:
          self.f[j] = i # jの最小の素因数

  def isPrime(self, x):
    return self.f[x] == x

  # 素因数分解
  def factorList(self, x):
    res = []
    while x != 1:
      res.append(self.f[x])
      x //= self.f[x]
    return res

  # 素因数分解(<素因数, 次数>)
  def factor(self, x):
    fl = self.factorList(x)
    if len(fl) == 0:
      return []

    ret = [Pair(fl[0], 0)]

    for p in fl:
      if ret[len(ret)-1].first == p:
        ret[len(ret)-1].second += 1
      else:
        ret.append(Pair(p, 1))

    return ret

si = EratosthenesSieve(51)

def comb(n, r):
  r = min(r, n-r)
  tmp = [0 for _ in range(51)]
  for i in range(n-r+1, n+1):
    f = si.factor(i)
    for pi in f:
      tmp[pi.first] += pi.second

  for i in range(2, r+1):
    f = si.factor(i)
    for pi in f:
      tmp[pi.first] -= pi.second

  ret = 1
  for i in range(51):
    ret *= POW(i, tmp[i])

  return ret

N, A, B = map(int, input().rstrip().split())
V = list(map(int, input().rstrip().split()))
V.sort()
V.reverse()

tot = 0
for i in range(A):
  tot += V[i]

avg = float(tot)/float(A)

l = 0
r = 0
for i in range(N):
  if V[i] == V[A-1]:
    l = i
    break

for i in range(N-1, -1, -1):
  if V[i] == V[A-1]:
    r = i
    break

a_num = r-l+1
aa_num = A-1-l+1

ans = 0
if V[0] == V[A-1]:
  for i in range(A, B+1):
    if i > a_num:
      break
    ans += comb(a_num, i)
else:
  ans += comb(a_num, aa_num)

Decimal(avg)
print(ans)






Measured memory_bytes: 40176
#include <iostream>

using namespace std;

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

    for(int i = 1; i*k <= b; i++) {
        if(a <= i*k && i*k <= b) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 998244353;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1}};

vector<ll> a[300];
ll H, W, S;
int main() {
	cin >> H >> W >> S;


	if (H % 2 == 0 || W % 2 == 0 || S % 2 == 0) {
		cout << 0 << endl;
	}

	else {

		ll ans = min(H*S, min(W*S, H*W));
		cout << ans << endl;
	}
	
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    
    map<int,int> ans;
    
    rep(i,n){
        int a;
        cin>>a;
        ans[a]++;
    }
    
    bool flag=true;
    for(auto inter=ans.begin();inter!=ans.end();inter++){
        if(inter->second>=2){
            flag=false;
            break;
        }
    }
    
    if(flag) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
    return 0;
}

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

vector<int> g[100000];//edge
int dist[100000],ans[100000];//dist[i]:(今回だと)0を根とした時のiから子孫への最長パスの長さ,ans[i]:iから最も遠い点への長さ

void dfs1(int idx,int par){
  for(int &to:g[idx]) {
    if(to==par)continue;
    dfs1(to,idx);
    dist[idx]=max(dist[idx],dist[to]+1);
  }
}

void dfs2(int idx,int d_par,int par){//idxを根としたケース,parは（今回だと）0が根の時のidxの親、d_parはparを端とするidxを含まない最長パスの長さ
  vector<pair<int,int>> d_child;//idxを根とした時の各子を伝っての最長パスの長さ
  d_child.emplace_back(0,-1);//番兵っぽいやつ
  for(int &to:g[idx]){
    if(to==par)d_child.emplace_back(d_par+1,to);
    else d_child.emplace_back(dist[to]+1,to);
  }
  sort(d_child.rbegin(),d_child.rend());
  ans[idx]=d_child[0].first;
  for(int &to:g[idx]) {
    if(to==par)continue;
    dfs2(to,d_child[d_child[0].second==to].first,idx);
  }
}

int main(){
  int N;
  cin>>N;
  for(int i=0;i<N-1;i++){
    int a,b;cin>>a>>b;a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs1(0,-1);//0を根とした根付き木に対してdist[i]が子孫への最長パスの長さ
  dfs2(0,0,-1);//ans[i]が求まる
  for(int i=0;i<N;i++)cout<<(N-1)*2-ans[i]<<endl;//最も遠い葉への道だけ一回しか通らない
}



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

int main()
{
  string A, B;
  cin >> A >> B;
  if(A.size() > B.size()) cout << "GREATER" << endl;
  else if(A.size() < B.size()) cout << "LESS" << endl;
  else{
    for(int i = 0; i < (int)A.size(); i++){
      if(A[i] > B[i]){
        cout << "GREATER" << endl;
        return 0;
      }else if(A[i] < B[i]){
        cout << "LESS" << endl;
        return 0;
      }
    }
    cout << "EQUAL" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>   using orderedSet =tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
//#define fisier 1
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
//BFS+DFS
#define boundary(i,j) (i>=0 && i<n && j>=0 && j<m)
int X[]={-1,1,0,0};
int Y[]={0,0,1,-1};

int main()
{
    int x,n;
    cin>>x>>n;
    if(n==0)
    {
        cout<<x<<endl;
        return 0;
    }
    vector<int>vis(200,0);
    for(int i=0; i<n; i++)
    {
        int x;
        cin>>x;
        vis[x]=1;
    }
    int ans=100000000;
    int save;
    for(int i=0; i<=101; i++)
    {
        if(!vis[i])
        {
            if(abs(i-x)<ans)
                ans=abs(i-x),save=i;
        }
    }
    cout<<save<<endl;

}



Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		int len = s.length();
		int len2 = len / 2;
		String s2;
		String s3;

		if (len % 2 == 0) {
			s2 = s.substring(0, len2);
			s3 = s.substring(len2 , len);
		} else {
			s2 = s.substring(0, len2);
			s3 = s.substring(len2 + 1, len);
		}

		int k = 0;
		int t=len2-1;

		for (int y = 0; y < len2;) {
			char ch1 = s2.charAt(y);
			char ch2 = s3.charAt(t);

			if (ch1 != ch2) {
				k++;
			}
			++y;
			--t;
		}
		System.out.println(k);
	}
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  rep(i,n) cin >> x[i] >> u[i];

  double BTC_yen = 380000.;

  double ans = 0.;
  rep(i,n){
    if(u[i] == "BTC") ans+=x[i]*BTC_yen;
    else ans+=x[i];
  }

  printf("%.5f\n",ans);
  
  return 0;
}


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

int main(){
  char b;
  cin >> b;
  if(b=='A'){
    cout << 'T' << endl;
  }
  if(b=='T'){
    cout << 'A' << endl;
  }
  if(b=='C'){
    cout << 'G' << endl;
  }
  if(b=='G'){
    cout << 'C' << endl;
  }
}

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

const int d = 365;
int main() {
  vector<int> c(26);
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  vector<vector<int>> s(d, vector<int>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }

  vector<int> t(26);
  for (int i = 0; i < 26; i++) {
    t[i] = i + 1;
  }

  for (int i = 0; i < d; i++) {
    cout << t[rand() % 26] << endl;
  }

  return 0;
}


Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int N;
	array<int,3> a;
	cin>>N>>a[0]>>a[1]>>a[2];

	if ((ll)a[0]+a[1]+a[2]>=3) {
		vector<char> res;
		rep(i,0,N) {
			string s;
			cin>>s;
			int x=s[0]-'A',y=s[1]-'A';
			if (a[x]>a[y]) swap(x, y);
			if (a[x]==0 && a[y]==0) {
				cout<<"No\n";
				return 0;
			}
			res.push_back((char)(x+'A'));
			a[x]++;
			a[y]--;
		}

		cout<<"Yes\n";
		rep(i,0,N) cout<<res[i]<<'\n';
		return 0;
	}

	using state=array<int,3>;
	vector<map<state,state>> prev(N+1);
	prev[0][a]={};

	rep(i,0,N) {
		string s;
		cin>>s;
		int x=s[0]-'A',y=s[1]-'A';
		for (auto &p:prev[i]) {
			auto t=p.first;
			if (t[y]>0) {
				auto nt=t;
				nt[x]++;
				nt[y]--;
				prev[i+1][nt]=t;
			}
			if (t[x]>0) {
				auto nt=t;
				nt[y]++;
				nt[x]--;
				prev[i+1][nt]=t;
			}
		}
	}

	if (prev[N].empty()) {
		cout<<"No\n";
		return 0;
	}

	cout<<"Yes\n";
	vector<char> res;
	state cur=prev[N].begin()->first;
	per(i,0,N) {
		// cout<<cur[0]<<" "<<cur[1]<<" "<<cur[2]<<endl;
		state from=prev[i+1][cur];
		rep(j,0,3) if (from[j]<cur[j]) res.push_back((char)(j+'A'));
		cur=from;
	}
	reverse(res.begin(),res.end());
	rep(i,0,N) cout<<res[i]<<'\n';
}


Measured memory_bytes: 16076
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define read(a) scanf("%d", &a)

#define N 1011

int n;
int a[N];

void chk(int l) {
	set <int> s;
	for (int i = l; i <= n; i++) {
		int c = 0;
		for (int j = l - 1; j >= 0; j--) {
			c = c * 10 + a[i - j];
		}
		s.insert(c);
	}
	int base = l == 1 ? 0 : int(pow(10, l - 1) + 0.5);
	int nxt = int(pow(10, l) + 0.5);
	for (int j = base; j < nxt; j++) {
		if (!s.count(j)) {
			printf("%d\n", j);
			exit(0);
		}
	}
}

int main() {
	read(n);
	for (int i = 1; i <= n; i++) read(a[i]);
	for (int i = 1; ; i++) {
		chk(i);
	}
}



Measured memory_bytes: 3416
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a[100005],yes[100005];
main(){
cin>>n;
for(int k=1;k<=n;k++)
    cin>>a[k];
for(int k=1;k<n;k++){
        if(a[k+1]<a[k]){
   if(a[k]-a[k+1]>=2){
    cout<<"No";
    return 0;
   }
   else{
    a[k]--;
    yes[k]=1;
    int i=k;
    while(a[i]<a[i-1]){
            if(a[i-1]-a[i]>=1){
        if(yes[i-1]==0){
            yes[i-1]=1;
        a[i-1]--;
        }
        else{
            cout<<"No";
            return 0;
        }
            }
            else{
                cout<<"No";
                return 0;
            }
            i--;
    }
   }
}
}

cout<<"Yes";
return 0;
}


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

using namespace std;

int main() {
    cout << fixed;
    cout << setprecision(10);

    while (true) {
        int n;
        cin >> n;

        if (n == 0)
            break;

        vector<int> score;
        int sum = 0;

        for (int i = 0; i < n; i++) {
            int s;
            cin >> s;

            score.push_back(s);
            sum += s;
        }

        double mean = (double) sum / n;

        double tmp = 0;
        for (auto s : score) {
            tmp += pow(s - mean, 2);
        }

        cout << sqrt(tmp / n) << endl;
    }
    return 0;
}

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

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> k(M),p(M);
    vector<vector<int> > s(M);
    for(int i=0; i<M; i++){
        cin>>k[i];
        s[i]=vector<int>(k[i]);
        for(int j=0; j<k[i]; j++) cin>>s[i][j];
    }
    for(int i=0; i<M; i++) cin>>p[i];
    int cnt=0;
    for(int i=0; i<pow(2,N); i++){
        vector<int> on(N);
        int flag = 1;
        for(int j=0; j<N; j++){
            on[j]=(i>>j)&1;
        }

        for(int j=0; j<M; j++){
            int onn=0;
            for(int l=0; l<k[j]; l++){
                onn+=on[s[j][l]-1];
            }
            if(onn%2!=p[j]) flag=0;
        }
        if(flag==1) cnt++;
    }
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 512
N,K,Q = map(int,input().split())
point = [K - Q] * N

for i in range(Q):
	A = int(input())
	point[A - 1] = point[A - 1] + 1

for i in range(N):
	if point[i] < 1:
		print('No')
	else:
		print('Yes')

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

using namespace std;
const int MAX = 200000;
int n, k;
int C[MAX];
int main(){
    cin >> n >> k;
    for(int i=0; i<n; ++i){
        int tmp;
        cin >> tmp;
        tmp--;
        C[tmp]++;
    } 
    sort(C, C+n, greater<int>());
    int res =0;
    for(int i=0; i<k; ++i)
        res += C[i];
    cout << n-res << endl;
    return 0;

}

Measured memory_bytes: 1024
input()
param_list = sorted([int(v) for v in input().split(" ")], reverse=True)
result = 0
duplicate_param = 0
count = 1
 
for v in param_list:
  if v == duplicate_param:
    if count == 1:
      result = v
      duplicate_param = 0
    else:
      result *= v
      print(result)
      break
    count += 1
  else:
    duplicate_param = v
 
if result == 0:
  print("0")

Measured memory_bytes: 59092
protocol InitFromString {
    init?(_ str: String)
}

extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

let nk: [Int] = input()
let n = nk[0]
let k = nk[1]

let mod = 1000_000_000 + 7

let result = (k...(n+1)).reduce(0, { res, i in
    let max = sum(a: n - i + 1, l: n, n: i)
    let min = sum(a: 0, l: i - 1, n: i)
    return (res + max - min + 1) % mod
})

print(result == 0 ? 1 : result % mod)

func sum(a: Int, l: Int, n: Int) -> Int {
    return n * (a + l) / 2
}


Measured memory_bytes: 7928
n = int(input())
a = list(map(int, input().split()))
Sum = 0
a.insert(0, 0)
a.append(0)
s = []
b = []
for i in range(len(a) - 1):
    b.append(abs(a[i] - a[i + 1]))
Sum_b = sum(b)
for i in range(len(b) - 1):
    ans = Sum_b - (b[i] + b[i + 1]) + abs(a[i] - a[i + 2])
    print(ans)


Measured memory_bytes: 14048
#include <stdio.h>

int main(void){
  int c[3][3] , min = 101;
  int ans = 0;
  
    for(int i = 0;i < 3;i ++){
    for(int j = 0;j < 3;j ++){
      scanf("%d",&c[i][j]);
      if(min > c[i][j]){
        min = c[i][j];
    }
    }
  }
  
  int a[3] = {101 ,101 ,101} , b[3] = {101 ,101 ,101};
  
  for(int j = 0;j < 3;j ++){
   for(int i = 0;i < 3;i ++){
    if(a[j] > c[j][i]){
      a[j] = c[j][i];
    }
  }
 }
     
  for(int i = 0;i < 3;i ++){
    for(int j = 0;j < 3;j ++){
      if(b[i] > c[j][i]){
        b[i] = c[j][i];
      }
    }
  }
  
  for(int i = 0;i < 3;i ++){
    for(int j = 0;j < 3;j ++){
      if(a[i] + b[j] - min != c[i][j]){
        ans ++;
      }
    }
  }
  
 if(ans == 0){
   printf("Yes\n");
 }
 else{
   printf("No\n");
 }
 return 0;
}


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

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

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

	long long int a,b,c,d;

	cin >> a >> b >> c >> d;

	long long int g = gcd(c,d);
	g = c/g;
	g*=d;

	long long int val1 = 0,val2 = 0;

	val1 = (b/d);
	val1 += (b/c);
	val1 -= (b/g);
	val1 = b - val1;

	val2 = ((a-1)/d);
	val2 += ((a-1)/c);
	val2 -= ((a-1)/g);
	val2 = (a-1) - val2;
	
	cout << val1 - val2 << '\n';

	return 0;
}


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

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

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

void code()
{
    ll n;
    cin>>n;
    ll sum=0;
    for(ll i=1;i<=n;i++)
    {
        if(i%3==0)continue;
        if(i%5==0)continue;

        sum+=i;
    }
    cout<<sum<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--)
    {
        code();
    }
}


Measured memory_bytes: 3640
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    cout<<"Yes";
    else
    {
        cout<<"No";
    }
    
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 7552
#include <iostream>
#include <cstring>
#include <utility>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main() {
    string s, t;
    cin >> s >> t;
    vector <vector <int>> lcs(3010, vector<int>(3010));
    int s_len = s.length();
    int t_len = t.length();
    for (int i = 1; i <= s_len; i++) {
      for (int j = 1; j <= t_len; j++) {
        if (s[i-1] == t[j-1]) {
          lcs[i][j] = lcs[i-1][j-1] + 1;
        } else {
          lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]);
        }
      }
    }
    string ans = "";
    int i = s_len;
    int j = t_len;
    while (lcs[i][j] > 0) {
        // if (lcs[i][j] == lcs[i-1][j-1] + 1) {
        if (s[i-1] == t[j-1]) {
          ans += s[i-1];
          i--;
          j--;
        } else if (lcs[i][j] == lcs[i-1][j]) {
          i--;
        } else {
          j--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  string a = "yes";
  int N = s.size();
  
  
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
    if(s.at(i)==s.at(j)){
    a = "no";
    }
  }
  }
  
  cout << a <<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

const string YES = "YES";
const string NO = "NO";

void solve(long long A, long long B, long long X){
    if (A <= X && X <= (A+B)) {
        cout << YES << endl;
    } else{
        cout << NO << endl;
    }
}

int main(){

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long X;
    scanf("%lld",&X);
    solve(A, B, X);
    return 0;
}



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



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

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

int main(){
 int n;
 cin >>n;
 int a[n], b[n], c[n-1];
 for(int i = 1; i <= n; i++){
     cin >>a[i];
 }
  for(int i = 1; i <= n; i++){
     cin >>b[i];
 }
  for(int i = 1; i < n; i++){
     cin >>c[i];
 }
 int ans = 0;
 for(int i = 1; i <= n; i++){
     ans += b[a[i]];
     if(i > 0 && a[i] == a[i-1] + 1){
         ans += c[a[i-1]];
     }
 }
 cout << ans <<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace Paiza
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC103_B();
        }

        static void ABC103_B()
        {
            var S = Console.ReadLine().ToList();
            var T = Console.ReadLine();
            var len = S.Count;
            while (len > 0)
            {
                if (string.Join("", S) == T)
                {
                    Console.WriteLine("Yes");
                    return;
                }
                S.Insert(0, S.Last());
                S.RemoveAt(S.Count - 1);
                len--;
            }
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll N; cin >> N;
  vector<P> a;
  REP(i,N) {
    ll b; cin >> b;
    a.push_back(make_pair(b,i+1));
  }
  sort(ALL(a));
  REP(i,N){
    cout << a[i].second << " \n"[i==N-1];
  }

} 

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int x; cin >> x;
  cout << 1 - x << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- ------- <3 \n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


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

int main(){
  int N ;
  cin >> N ;
  vector<int> D(110) ;
  for(int x ; x < N ; x++) {
    cin >> D[x] ;
  }
  sort(D.begin(),D.end()) ;
  reverse(D.begin(),D.end()) ;
  int count = 0 ;
 for(int i = 0 ; i<N ; i++){
   if(D[i]!=D[i+1]){
     count ++;
   }
 }
  
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
typedef long long ll;
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M){
    if(M == N) {
        cout << YES << endl;
    }else {
        cout << NO << endl;
    }
    
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


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

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 (b<a) { a=b; return 1; } return 0; }

using ll = long long;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int dist[25][25][25][25];
int longest[25][25];

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> field(H);
  for(int i = 0; i < H; i++) {
    cin >> field[i];
  }
  for(int i = 0; i < 25; i++) {
    for(int j = 0; j < 25; j++) {
      for(int k = 0; k < 25; k++) {
        for(int l = 0; l < 25; l++) {
          dist[i][j][k][l]=-1;
        }
      }
    }
  }
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(field[i][j]=='#') continue;
      dist[i][j][i][j] = 0;
      queue<pair<int,int>> q;
      pair<int,int>a=make_pair(i,j);
      q.push(a);
      while(!q.empty()) {
        pair<int,int>v=q.front();
        q.pop();
        for(int k = 0; k < 4;k++) {
          int nx = v.first + dx[k];
          int ny = v.second + dy[k];
          if(nx<0||nx>=H||ny<0||ny>=W) continue;
          if(field[nx][ny] == '#')continue;
          if(dist[i][j][nx][ny] ==-1){
            pair<int, int> b = make_pair(nx,ny);
            q.push(b);
            dist[i][j][nx][ny]=dist[i][j][v.first][v.second]+1;
          }
        }
      }
      for(int k=0; k< H; k++) {
        for(int l = 0; l < W; l++) {
          chmax(longest[i][j], dist[i][j][k][l]);
        }
      }
    }
  }
  int ans = 0;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      chmax(ans,longest[i][j]);
    }
  }
  cout << ans << endl;
}
        

Measured memory_bytes: 1792
n, m, q = gets.split.map(&:to_i)
trains = []
m.times { trains << gets.split.map(&:to_i) }
queries = []
q.times { queries << gets.split.map(&:to_i) }
memo = Array.new(n + 1) { Array.new(n + 1, 0) }

trains.each { |from, to| memo[from][to] += 1 }

1.upto(n) do |from|
  1.upto(n) do |to|
    memo[from][to] += memo[from][to - 1]
  end
end

1.upto(n) do |to|
  1.upto(n) do |from|
    memo[from][to] += memo[from - 1][to]
  end
end

queries.each do |from, to|
  puts memo[to][to] - memo[from - 1][to] - memo[to][from - 1] + memo[from - 1][from - 1]
end


Measured memory_bytes: 30200
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=200005,INF=2000000000;
int n,a[N],b[N],R_mn,R_mx,B_mn,B_mx;
typedef long long LL;

int getint()
{
	char ch;
	while(!isdigit(ch=getchar()));
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x;
}

void ck(int &x,int &y,int c)
{
	x=min(x,c);
	y=max(y,c);
}

LL solve1()
{
	R_mn=INF,R_mx=0;
	B_mn=INF,B_mx=0;
	rep(i,1,n) ck(R_mn,R_mx,min(a[i],b[i])),ck(B_mn,B_mx,max(a[i],b[i]));
	return (LL)(R_mx-R_mn)*(B_mx-B_mn);
}

LL solve2()
{
	B_mn=INF,B_mx=0;
	rep(i,1,n)
		B_mn=min(B_mn,max(a[i],b[i]));
	rep(i,1,n)
		if(min(a[i],b[i])>=B_mn) B_mx=max(B_mx,min(a[i],b[i]));
		else B_mx=max(B_mx,max(a[i],b[i]));
	return (LL)(R_mx-R_mn)*(B_mx-B_mn);
}

LL solve3()
{
	R_mn=INF,R_mx=0;
	B_mn=INF,B_mx=0;
	rep(i,1,n) R_mn=min(R_mn,min(a[i],b[i])),R_mx=max(R_mx,max(a[i],b[i]));
	rep(i,1,n)
	{
		if(a[i]==R_mn || a[i]==R_mx) ck(B_mn,B_mx,b[i]);
		else if(b[i]==R_mn || b[i]==R_mx) ck(B_mn,B_mx,a[i]);
	}
	rep(i,1,n)
	{
		if(B_mn<=a[i] && a[i]<=B_mx) continue;
		if(B_mn<=b[i] && b[i]<=B_mx) continue;
		if(min(abs(a[i]-B_mn),abs(a[i]-B_mx))<min(abs(b[i]-B_mn),abs(b[i]-B_mx)))
			ck(B_mn,B_mx,a[i]);
		else ck(B_mn,B_mx,b[i]);
	}
	return (LL)(R_mx-R_mn)*(B_mx-B_mn);
}

int main()
{
	n=getint();
	rep(i,1,n) a[i]=getint(),b[i]=getint();
	printf("%lld\n",min(min(solve1(),solve2()),solve3()));
	return 0;
}

Measured memory_bytes: 1664
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>
#include <iostream>
using namespace std;

vector<int> divs(int n){
  vector<int> ret;
  for(int i = 1; i * i <= n; i++){
    if(n % i == 0){
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return ret;
}

int main(){
  const int n = getInt();
  const int w = getInt();

  vector<int> cnt(n + 1);

  int ans = 0;
  for(int i = 1; i <= n; i++){
    const int low  = i - w;
    const int high = i;

    {
      ans++;
      const vector<int> d = divs(high);
      REP(j,d.size()){
        const int dd = d[j];
        if(++cnt[dd] == 2 && dd < low)
          ans++;
      }
    }

    if(low > 0){
      const vector<int> d = divs(low);
      REP(j,d.size()){
        const int dd = d[j];
        if(--cnt[d[j]] == 1 && dd != low)
          ans--;
      }
      if(cnt[low] <= 1) ans--;
    }

    // REP(j,n+1) printf("%d: %d\n", j, cnt[j]);

    if(i >= w)
      printf("%d%c", ans, i == n ? '\n' : ' ');
  }

  return 0;
}

Measured memory_bytes: 1528
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;
typedef pair<ll,P> Node;
ll N,M,S;
struct Edge{
    ll to,cost,time;
};
ll d[51][2501];
ll C[51],D[51];
vector<Edge> edgeList[51];
int main(){
    cin>>N>>M>>S;
    for(ll i=0;i<M;i++){
        ll u,v,a,b;
        cin>>u>>v>>a>>b;
        u--;v--;
        edgeList[u].push_back(Edge{v,a,b});
        edgeList[v].push_back(Edge{u,a,b});
    }
    for(ll i=0;i<N;i++){
        cin>>C[i]>>D[i];
    }
    for(ll i=0;i<N;i++){
        for(ll j=0;j<=50*N;j++){
            d[i][j]=INF;
        }
    }
    priority_queue<Node,vector<Node>,greater<Node>> pq;
    pq.push(Node(0,P(0,min(S,50*N))));
    d[0][min(S,50*N)]=0;
    while(!pq.empty()){
        ll now=pq.top().second.first;
        ll nowS=pq.top().second.second;
        ll nowTime=pq.top().first;
        pq.pop();
        if(nowTime>d[now][nowS])continue;
        for(auto e:edgeList[now]){
            if(nowS-e.cost<0)continue;
            ll newTime=nowTime+e.time;
            if(d[e.to][nowS-e.cost]>newTime){
                d[e.to][nowS-e.cost]=newTime;
                pq.push(Node(newTime,P(e.to,nowS-e.cost)));
            }
        }
        for(ll i=1;nowS+i*C[now]<=50*N;i++){
            ll newTime=nowTime+D[now]*i;
            ll newS=nowS+i*C[now];
            if(d[now][newS] > newTime){
                d[now][newS]=newTime;
                pq.push(Node(newTime,P(now,newS)));
            }
        }
    }
    for(ll i=1;i<N;i++){
        ll ans=INF;
        for(ll j=0;j<=50*N;j++){
            ans=min(ans,d[i][j]);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 53448
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
#include <bitset>
#include <queue>

using namespace std;

using ll = long long;

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

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

	string klass = x < 1200 ? "ABC" : "ARC";
	cout << klass << endl;
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  vector<int> A(101);
  int ans = 0;
  rep(i,100){
    if(a <= i && i <= b) ++A[i];
    if(c <= i && i <= d) ++A[i];
  }
  rep(i,100){
    if(A[i] == 2) ++ans;
  }
  cout << max(0,ans-1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;

const int maxn = 5e5 + 5;

int n, Q;
typedef long long LL;

LL D;

LL d[maxn];
int q[maxn];

LL suf[maxn];
LL pre[maxn];
//const LL INF = 1e18;


int main(){
    cin >> n >> D;
    LL now = D;
    for(int i = 1;i <= n;i++){
        scanf("%lld", &d[i]);
    }
    for(int i = 1;i <= n;i++){
        pre[i] = now;
        now = min(now, abs(now - d[i]));
    } 
    suf[n + 1] = 0;
    for(int i = n;i >= 1;i--){
        if(d[i] < 2 * (suf[i + 1] + 1)){
            suf[i] = suf[i + 1] + d[i];
        }else{
            suf[i] = suf[i + 1];
        }
    }
    cin >> Q;
    for(int i = 1;i <= Q;i++){
        scanf("%d", &q[i]);
        if(suf[q[i] + 1] >= pre[q[i]]){
            puts("NO");
        }else{
            puts("YES");
        }
    }
    return 0;
}


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

int main(){
	string s; cin >> s;
	bool alpha[26] = {0};
	bool jud = 1;
	for(int i = 0; i < s.size(); ++i){
		if(alpha[s[i] - 'a']){
			jud = 0;
			break;
		}
		alpha[s[i] - 'a'] = 1;
	}
	cout << ((jud) ? "yes\n" : "no\n");
	return 0;
}

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

#define int long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"


int pow(int a, int b)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a);
		b /= 2;
		a = (a * a);
	}
	return ans;
}

int32_t main()
{
	IOS;
	int n, k;
	cin >> n >> k;
	if (n == 1)
		cout << k << endl;
	else if (n == 2)
	{
		cout << k*(k - 1) << endl;
	}
	else
	{
		cout << k*pow(k - 1, n - 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>c(n);
    int a[n][m];
    for(int i=0;i<n;i++){
        cin >> c[i];
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    int ans = 1<<30;
    for(int bit=1;bit<=1<<12;bit++){
        vector<int>algo(m,0);
        int money = 0;
        for(int i=0;i<n;i++){
            if(bit & 1<<i){
                money += c[i];
                for(int j=0;j<m;j++){
                    algo[j] += a[i][j];
                }
            }
        }
        bool chk = true;
        for(int i=0;i<m;i++){
            if(algo[i] < x)chk=false;
        }
        if(chk)ans = min(ans,money);
        
    }
    if(ans == 1<<30)cout << -1<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 3636
def solve(string):
    h, w, *s = string.split()
    h, w = map(int, [h, w])
    hg = []
    hi = []
    vg = []
    vi = []

    for _s in s:
        gn = 0
        _hi = [0] * w
        _hg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _hi[i] = -1
                gn += 1
                _hg.append(c)
                c = 0
                continue
            _hi[i] = gn
            c += 1
        _hg.append(c)
        hg.append(_hg)
        hi.append(_hi)
    for _s in zip(*s):
        gn = 0
        _vi = [0] * h
        _vg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _vi[i] = -1
                gn += 1
                _vg.append(c)
                c = 0
                continue
            _vi[i] = gn
            c += 1
        _vg.append(c)
        vg.append(_vg)
        vi.append(_vi)

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, hg[i][hi[i][j]] + vg[j][vi[j][i]])
    return str(ans - 1)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 198128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;

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

const int kMaxN = 500;

int n;
int c[kMaxN], s[kMaxN], f[kMaxN];

int main() {
  cin >> n;
  REP(i, n-1) { cin >> c[i] >> s[i] >> f[i]; }

  REP(start, n) {
    int i = start;
    int t = 0;
    while (i != n-1) {
      if (t <= s[i]) {
        t = s[i]+c[i];
        ++i;
      } else if (t%f[i] == 0) {
        t += c[i];
        ++i;
      } else {
        t = t - t%f[i] + f[i] + c[i];
        ++i;
      }
    }
    cout << t << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        double N = scan.nextDouble();
        double d = scan.nextDouble();
        double x = scan.nextDouble();

        BigDecimal ans = new BigDecimal("0.0");
        while(N>0.5){
            BigDecimal adnum = BigDecimal.valueOf(d+x*(N-0.5));
            ans = ans.add(adnum);
//            ans.add(BigDecimal.valueOf( (d+x*(N-0.5)) ));
            d = (N+1.0)*d/N + (5.0*x)/(2.0*N);
            x = (1.0 + (2.0/N))*x;
            --N;
        }

        DecimalFormat format = new DecimalFormat("#.#");
        format.setMinimumFractionDigits(20);

        System.out.println(format.format(ans));
    }
}

Measured memory_bytes: 49556
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

int main(){
    ll n;
    cin>>n;
    ll ans=0;
    rep(i,1,n){
        if(i%3!=0&&i%5!=0){
            ans += i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll x,y;

int main(){
  ll ans=0;
  cin >> x >> y;
if (x==3)ans+=100000;
if (x==2)ans+=200000;
if (x==1)ans+=300000;
if (y==3)ans+=100000;
if (y==2)ans+=200000;
if (y==1)ans+=300000;
if ((x==1)&(y==1))ans+=400000;




  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
li = [int(stdin.readline().rstrip()) for _ in range(n)]
count = 0
point = 0
for i in li:
    if i == 0:
        point += count//2
        count = 0
    else:
        count += i
point += count//2
print(point)

Measured memory_bytes: 7088
#include<stdio.h>
int main()
{
    int a,b,c,d,e,s,g,h,f;
    scanf("%d%d%d",&a,&b,&c);
    s=abs(a-c);
    d=abs(b-c);
    f=abs(a-b);
    e=s+d;
    g=d+f;
    h=s+f;
    if(e<=g&&e<=h)
    printf("%d",e);
    else if(g<=e&&g<=h)
    printf("%d",g);
    else if(h<=e&&h<=g)
    printf("%d",h);

}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()

typedef long long ll;

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}

int n;
bool visited[55];
bool edge[50][50];

void dfs(int x){
    if(visited[x] == 1) return;
    visited[x] = 1;
    rep1(i,n){
        if(edge[i][x]) dfs(i);
    }
}

bool judge(int n){
    bool ans = 0;
    rep1(i,n) if(!visited[i]) ans = 1;
    
    return ans;
}

int main(){
    int m; cin >> n >> m;
    int a[m],b[m];
    rep(i,m){
        cin >> a[i] >> b[i];
        edge[a[i]][b[i]] = edge[b[i]][a[i]] = 1;
    }
    
    int cnt = 0;
    rep(i,m){
        edge[a[i]][b[i]] = edge[b[i]][a[i]] = 0;
        rep1(i,n) visited[i] = 0;
        
        dfs(n);
        cnt += judge(n);
        
        edge[a[i]][b[i]] = edge[b[i]][a[i]] = 1;
    }
    
    cout << cnt << endl;
}





Measured memory_bytes: 256
using System;

namespace _9x9
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ab = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            if(ab[0] > 9 || ab[1] > 9)
                Console.WriteLine("-1");
            else 
                Console.WriteLine(ab[0] * ab[1]);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	ll n,i,j;
    	cin>>n;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];
		}
		ll sum=0;
		for(i=0;i<n;i++)
		{
			sum=sum^a[i];
		}
		for(i=0;i<n;i++)
		{
			cout<<(sum^a[i])<<" ";
		}
    }

}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int R, G;
	cin >> R >> G;
	cout << G * 2 - R << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a, t, d, p;


int main () {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>t>>d>>p;
    a=t+d;
    if (a>=p) {
        cout<<p+d;
    } else {
        cout<<a+d+1;
    }

  
  
   return 0;
}

Measured memory_bytes: 3648
N = int(input())
A = []
x = 0
y = 0
sum = 0

for i in range(N):
    x, y = map(int, input().split())
    A.append([x, y])


A.sort(key=lambda x: x[1])


for i in range(N):
    sum = sum + A[i][0]
    if sum > A[i][1]:
        print('No')
        exit()

print('Yes')


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll d[200010], t[200010];

int main(){
    int n;
    cin >> n;
    rep(i, n) cin >> d[i];
    int m;
    cin >> m;
    rep(i, m) cin >> t[i];

    if (m > n) {
        cout << "NO" << endl;
        return 0;
    }
    multiset<ll> ms;
    rep(i, n) ms.insert(d[i]);

    rep(i, m){
        auto it = ms.find(t[i]);
        if (it != ms.end()) {
            ms.erase(it);
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){

  int k;
  string s;
  cin >> k >> s;
  if(s.size() > k)cout << s.substr(0,k) << "..." << endl;
  else cout << s << endl;
  
  




  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>

int main(void)
{
    char S[4];
    char A[4]={'A','A','A'};
    char B[4]={'B','B','B'};

    scanf("%s",S);

    if((strcmp(S,B)==0) || (strcmp(S,A)==0)){
        printf("No\n");
    } else {
        printf("Yes\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
	long long a = rng();
    return a;
}
struct str
{
    string s;
};
str v[100002];
int hmsfba, hmsfbx, hma;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n, ap = 0;
    cin >> n;
    for(int i = 1; i <= n; ++i)
    {
        cin >> v[i].s;
        for(int j = 0; j + 1 < v[i].s.size(); ++j)
            if(v[i].s[j] == 'A' && v[i].s[j+1] == 'B')
                ++ap;
        if(v[i].s.back() == 'A' && v[i].s[0] != 'B')
            hmsfbx++;
        if(v[i].s.back() == 'A' && v[i].s[0] == 'B')
            hmsfba++;
        if(v[i].s[0] == 'B' && v[i].s.back() != 'A')
            ++hma;
    }
    bool hasA = 0;
    while(1)
    {
        if(hasA)
        {
            if(hmsfba)
                --hmsfba, ++ap, hasA = 1;
            else
                if(hma)
                    --hma, ++ap, hasA = 0;
                else
                    break;
        }
        else
        {
            if(hmsfbx)
                --hmsfbx, hasA = 1;
            else
                if(hmsfba)
                    --hmsfba, hasA = 1;
                else
                    break;
        }
    }
    cout << ap;
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> bingo(3, vector<int>(3));
int bingocheck(){
    int w;
    //横チェック
    for(int i = 0; i < 3; i++){
        w = 0;
        for(int j = 0; j < 3; j++){
                w += bingo.at(i).at(j);
            }
        if(w == 0){
            return 1;
        }
    }
    //縦チェック
    for(int i = 0; i < 3; i++){
        w = 0;
        for(int j = 0; j < 3; j++){
                w += bingo.at(j).at(i);
            }
        if(w == 0){
            return 1;
        }
    }
    //斜めチェック
    w = 0;
    for(int i = 0; i < 3; i++){
        w += bingo.at(i).at(i);
    }
    if(w == 0){
        return 1;
    }

    w = 0;
    for(int i = 0; i < 3; i++){
    w += bingo.at(i).at(2-i);
    }
    if(w == 0){
        return 1;
    }

    return 0;
}

int main(){
    int n, temp, check;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> bingo.at(i).at(j);
        }
    }
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> temp;
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(bingo.at(i).at(j) == temp){
                    bingo.at(i).at(j) = 0;
                    break;
                }
            }
        }
    }

    if(bingocheck()){
        cout<< "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


}

Measured memory_bytes: 256