akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }
    int maxv = -1;
    for (auto x: mp) {
        maxv = max(x.second, maxv);
    }
    for(auto x: mp) {
        if (x.second == maxv) cout << x.first << endl;
    }
    return 0;
}

Measured memory_bytes: 25216
#include <stdio.h>
 
int main(){
 
  int x,i;
  for(i = 1 ;; i++){
 
    scanf("%d",&x);
 
      if(x != 0){
    printf("Case %d: %d\n",i,x);
      }
      else{
    break;
      }
  }
 
  
  return 0; 
}
 
 
 
 
  // i++ == i = i + 1 == i += 1
 
  /*
  //パターン１
  int i;
  for(i = 0 ; i < 1000; i++){
 
    printf("Hello World\n");
 
  }
   
  //パターン２
  i = 0;
  while(i < 1000){
    printf("Hello World\n");
    i++;
  }
 
  //パターン３
  i = 0;
  while(1){
 
    if(i == 1000){
      break;
    }
 
    printf("Hello World\n");
    i++;
 
  }
  */


Measured memory_bytes: 2044
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

const int dy[]={-1,0,1,0},dx[]={0,-1,0,1};
int p[1000*1000];
int root(int x){
	return x==p[x]?x:p[x]=root(p[x]);
}
void merge(int a,int b){
	a=root(a); b=root(b);
	if(a!=b)p[a]=b;
}
int h,w,g;
string in[1000];

int main(){
//	freopen ("testcase.lucky_dip", "r", stdin );

	cin>>w>>h;
	rep(i,h)cin>>in[i];
	rep(i,h*w){
		p[i]=i;
		if(in[i/w][i%w]=='t')g=i;
	}
	rep(i,h)rep(j,w)if(in[i][j]!='#'){
		rep(d,4){
			int y=i+dy[d],x=j+dx[d];
			if(0<=y&&y<h&&0<=x&&x<w&&in[y][x]!='#')
			merge(y*w+x,i*w+j);
		}
	}
	int n; cin>>n;
	if(root(g)==root(0)){
		cout<<0<<endl; return 0;
	}
	rep(i,n){
		int tx,ty; cin>>tx>>ty;
		in[ty][tx]='.';
		rep(d,4){
			int y=ty+dy[d],x=tx+dx[d];
			if(0<=y&&y<h&&0<=x&&x<w&&in[y][x]!='#')
			merge(y*w+x,ty*w+tx);
		}
		if(root(g)==root(0)){
			cout<<i+1<<endl; return 0;
		}
	}
	cout<<-1<<endl;
		
	return 0;
	
}

Measured memory_bytes: 5824
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long N = lread();
    long ans = N % 1000;

    writeln((1000 - ans) % 1000);
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int a,b;cin>>a>>b;
    cout<<max(a-2*b,0)<<endl;
}

Measured memory_bytes: 3596
from collections import defaultdict
def q3():
    n, m = [int(i) for i in input().split(" ")]
    height_list = [int(i) for i in input().split(" ")]
    heights = {}
    for index, height in enumerate(height_list):
        heights[index + 1] = height
    # print(heights)

    roads = defaultdict(lambda: set())
    for i in range(m):
        a, b = [int(i) for i in input().split(" ")]
        roads[a].add(b)
        roads[b].add(a)
    # print(roads)

    good = set()
    bad = set()
    for start, dests in roads.items():
        # print("------")
        # print(start, dests, good, bad)
        # not in bad?
        if start in bad:
            continue
        start_is_good = True
        for obs in dests:
            if heights[start] <= heights[obs]:
                start_is_good = False
                break
        if start_is_good:
            good.add(start)
            bad |= dests
        else:
            bad.add(start)

    for i in range(1, n+1):
        if i not in bad:
            good.add(i)
    
    # print(good)
    # print(bad)

    print(len(good))

q3()


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

using namespace std;

int main()
{
    long long int a, b, c;
    string res = "APPROVED";
    cin >> a;
    
    while(a--)
    {
        cin >> b;
        if(b % 2 == 0)
        {
            if(b % 3 != 0 && b % 5 != 0)
            {
                res = "DENIED";
            }
        }
    }
    
    cout << res << endl;
}

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

using namespace std;
using ll = long long int;

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    int sum=0;
    for(int i=0;i<N;i++) sum+=A[i];
    
    int count=0;
    for(int i=0;i<N;i++){
        if(A[i]>=(double)sum/(4*M)) count++;
    }
    
    if(count>=M) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}




Measured memory_bytes: 256
##### 解けた #####

import numpy as np

C=np.full((2,3),".",np.str)
C[0,:]=list(input())
C[1,:]=list(input())
Cr=np.rot90(C,k=2) # 180度回転させたもの

if (C==Cr).all(): # 180度回転させて一致するなら
    print("YES")
else: # 一致しないなら
    print("NO")

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

int main() {
  string s,t;
  cin >> s >> t;
  
  int count = 0;
  
  for(int i=0; i<3; i++) {
    if(s.at(i) == t.at(i))
      count ++;
  }
  
  cout << count << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll n;cin >> n;
	vector<ll> v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v));
	vector<P> out;

	ll l = 1;
	ll r = n - 2;
	while(l < n - 1 && v[l] <= 0){
		out.EB(v[n-1], v[l]);
		v[n-1] -= v[l];
		l++;
	}
	while(r > 0 && v[r] > 0){
		out.EB(v[0], v[r]);
		v[0] -= v[r];
		r--;
	}
	out.EB(v[n-1], v[0]);

	cout << out[n-2].FI - out[n-2].SE << endl;
	REP(i, out.size())cout << out[i].FI << " " << out[i].SE << endl;

	return 0;
}


Measured memory_bytes: 4336
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;
typedef long long int lli;

lli N, ans = 9999999999, ou1, ou2, ou, rN;

lli keta(lli in);

int main(){

  scanf("%lld", &N);
  rN = sqrt(N);

  for(int l = 1; l <= rN; l++){
    if((N % l) == 0){
      ou1=keta(l);
      ou2 = keta(N/l);
      ou = max(ou1, ou2);
      //printf("%lld %llld\n", ou1, ou2);
      if(ans > ou) ans = ou;
      if(ou1 == ou2){
        break;
      }else if(ou1 > ou2){
        break;
      }
    }
  }

  printf("%lld", ans);

  return 0;

}

lli keta(lli in){

  int l = 1;

  while(in >= 10){
    in /= 10;
    //printf("%lld\n", in);
    l++;
  }

  return l;

}


Measured memory_bytes: 128
N=int(input())

l=sorted(list(map(int,input().split())))
zero=l.count(0)
if zero==N:
   print("Yes")
   exit()
elif len(set(l)) == 2:
   s=l.count(l[-1])
   if zero==N//3 and s==N*2//3:
      print("Yes")
      exit()
elif len(set(l))==3:
   a,b,c=list(set(l))
   if a^b^c==0 and l.count(a)== l.count(b)==l.count(c):
      print("Yes")
      exit()
print("No")

Measured memory_bytes: 20888
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(1e5) +5;

int func( int ar[],int n)
{
    int br[n+1];
    int i;
    for(i=0;i<n;i++)
    {
        br[i]=i+1;
    }
    int cc=1;
    do{
        int fl=0;
        for(i=0;i<n;i++)
        {
            if(ar[i]!=br[i])fl=1;
        }
        if(!fl)break;
        cc++;
    }
    while(next_permutation(br,br+n));
    return cc;
}


int main()
{
    idfc;


    int n;
    cin>>n;
    int i;
    int ar[10];
    int br[10];
    for(i=0;i<n;i++)cin>>ar[i];
    for(i=0;i<n;i++)cin>>br[i];

    int a=func(ar,n);
    int b=func(br,n);
    cout<<abs(a-b);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    long count = 0;
    long cou = 1;
    cin >> N;
    vector<string> s(N+1);
    for(int i = 0; i < N; i++) {
        cin >> s.at(i);
        sort(s.at(i).begin(), s.at(i).end());
    }
    s.at(N) = "zzzzzzzzzzzzzz";

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

    for(int i = 0; i < N; i++) {
        if(s.at(i).compare(s.at(i+1)) == 0) {
            cou++;
        }else {
            if(cou != 1) {
                for(int j = 1; j < cou; j++) {
                    count += j;
                }
            }
            cou = 1;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 7296
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	for a%b != 0 {
		a, b = b, a%b
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	K := nextInt()

	g := make([][]int, K+1)
	for i := range g {
		g[i] = make([]int, K+1)
		for j := range g[i] {
			g[i][j] = gcd(i, j)
		}
	}

	ans := 0
	for i := 1; i <= K; i++ {
		for j := 1; j <= K; j++ {
			for k := 1; k <= K; k++ {
				ans += g[g[i][j]][k]
			}
		}
	}
	puts(ans)
}


Measured memory_bytes: 2176
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}

vector<int> sieve(int n)
{
    bool prime[n+1]={0};
    for(int i=2;i<=n/i;i++)
    {
        if(!prime[i])
        {
            for(int j=i*i;j<=n;j+=i)
            {
                prime[j]=1;
            }
        }
    }
    vector<int> p;
    for(int i=2;i<=n;i++)
        if(!prime[i])
            p.pb(i);
    return p;
}


int modpow(int a,int n)
{
	int ans=1;
	while(n)
	{
		if(n%2)
			ans=(ans*a)%mod;
		a=(a*a)%mod;
		n/=2;
	}
	return ans;
}

int inv(int a)
{
	return modpow(a,mod-2);
}

signed main()
{
	fio
	inp(n)
	inpa(a,n)
	vector<int> b=a;
	vector<int> p=sieve(1e6);
	int np=p.size();
	vector<int> count(np);
	fo(i,n)
	{
		for(int j=0;j<np && p[j]*p[j]<=a[i];j++)
		{
			if(a[i]%p[j]==0)
			{
				int ct=0;
				while(a[i]%p[j]==0)
				{
					a[i]/=p[j];
					ct++;
				}
				count[j]=max(count[j],ct);
			}
		}
		if(a[i]!=1)
		{
			int ind=lower_bound(all(p),a[i])-p.begin();
			count[ind]=max(count[ind],1ll);
		}
	}
	
	int lcm=1;
	fo(i,np)
	{
		lcm=(lcm*modpow(p[i],count[i]))%mod;
	}
	
	int ans=0;
	fo(i,n)
	{
		int tans=(lcm*inv(b[i]))%mod;
		ans=(ans+tans)%mod;
	}
	cout<<ans<<'\n';
	printclock;
}

Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1

int main() {
  int A;
  cin >>A;
  int B;
  B=A%100;
  A/=100;
  if(A>12||A==0)
  {if(B<13&&B>0)
  {cout << "YYMM"<<endl;
  return 0;}
  else
  {cout << "NA"<<endl;
  return 0;}}  
  else
  {if(B<13&&B>0)
  {cout << "AMBIGUOUS"<<endl;
  return 0;}
  else
  {cout << "MMYY"<<endl;
  return 0;}
  }
}


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(){
    string s;
    cin>>s;
    int ans=0;
    rep(i,s.size()-1)if(s[i]!=s[i+1])ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3732
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	int N, ans = 0;
	string S;
	cin >> N >> S;

	for (int i = 1; i < N; i++) {
		int cnt = 0;
		string front = S.substr(0, i),
			back = S.substr(i);

		for (auto c = 'a'; c <= 'z'; c++) {
			if (front.find_first_of(c) != string::npos && back.find_first_of(c) != string::npos) {
				cnt++;
			}
		}
		ans = max(ans, cnt);
	}

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


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



int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        //freopen("input.txt","r/w",stdin/stdout);
        float t;
        cin>>t;
        t*=2*3.14;
        cout<<t;
        return 0;
}


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

using namespace std;

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int h, w, k;
  int count = 0;
  cin >> h >> w >> k;
  
  char mat[h][w];
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> mat[i][j];  
    }
  }
  
  for(int x = 0; x < (1<<h); x++){
    for(int y = 0; y < (1<<w); y++){
      int black = 0;
      
      for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
          if((mat[i][j]=='#') && ((x>>i)&1) && ((y>>j)&1)) black++;
        }
      }
      
      if(black == k) count++;
    }
  }
  
  cout << count;
  
  return 0;
}

Measured memory_bytes: 3588
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
right = -float('inf')
ans = 0
for x,l in XL:
    s,t = x-l, x+l-1
    if s > right:
        right = t
        ans += 1
print(ans)

Measured memory_bytes: 21392
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// 数字を読み込む
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		// 条件で分岐
		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		} else {
			System.out.println("a == b");
		}
	}
}



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

int main() {
 int N;
  cin >>N;
  long long int A[N];
  for(int i=0;i<N;i++){
    cin >>A[i];
  }
  long long int M;
  long long int ans;
  M=(A[0])^(A[1]);
    for(int i=2;i<N;i++){
    M=M^(A[i]);
  }
  
    for(int i=0;i<N;i++){
    ans=M^A[i];
      cout << ans << endl;
  }
 return 0;
}


Measured memory_bytes: 5100
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <unordered_set>
#include <stack>

using namespace std;

int main() {
  string s;
  int count[26];
  for (int i = 0; i < 26; i++) { count[i] = 0; }
  cin >> s;

  for (char c : s) {
    int idx = (int)(c - 'a');
    count[idx]++;
  }

  bool flag = true;
  for (int i = 0; i < 26; i++) {
    if (count[i] % 2 != 0)
      flag = false;
  }
  cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,f=1,p=1000000007;
    cin>>n;
    for(long long i=1;i<=n;i++)
    {
        f*=i;
        f=f%p;
    }
    cout<<f<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
	int n;
	while (scanf("%d",&n)&&n!=0) {
		map<int, long long> sales;
		vector<int> log;
		long long prc, mnt;
		int num;
		for (int i=0; i<n; i++) {
			scanf("%d%lld%lld",&num,&prc,&mnt);
			if (!sales[num]) {
				log.push_back(num);
			}
			sales[num] += prc * mnt;
		}
		bool flag = true;
		for (int i=0; i<log.size(); i++) {
			if (sales[log[i]]>=1000000) {
				flag = false;
				printf("%d\n", log[i]);
			}
		}
		if (flag) printf("NA\n");
	}
}

Measured memory_bytes: 0
K,N= map(int,input().split())
A=list(map(int,input().split()))
ans=0
mx=0
for i in range(len(A)-1):
    ans+=abs(A[i]-A[i+1])
    mx = max(mx,abs(A[i]-A[i+1]))
ans+=K-A[len(A)-1]+A[0]
mx = max(mx,K-A[len(A)-1]+A[0])

print(ans-mx)

Measured memory_bytes: 26444
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    int ans = min({ A + B,B + C, C + A });
    write(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

const int mod = 1e9+7;
struct mint {
    ll x;
    mint (ll x = 0) : x((x%mod+mod)%mod) {}
    mint operator -() const {return mint(-x);}
    mint& operator +=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator -=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator *=(const mint a) {(x *= a.x) %= mod; return *this;}
    mint operator +(const mint a) const {return mint(*this) += a;}
    mint operator -(const mint a) const {return mint(*this) -= a;}
    mint operator *(const mint a) const {return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const {return pow(mod-2);}
    mint operator /=(const mint a) {return *this *= a.inv();}
    mint operator /(const mint a) {return mint(*this) /= a;}
};
istream& operator >>(istream &is, const mint &a) {return is >> a.x;}
ostream& operator <<(ostream &os, const mint &a) {return os << a.x;}

mint dp[100005][2];

int main() {
    string s; cin >> s;
    int n = s.size();
    dp[0][0] = 1;
    rep(i,n)rep(j,2)rep(l,2) {
        int x = s[i] - '0';
        int n_i = i+1, n_j = j;
        if (j == 0) {
            if (l > x) continue;
            if (l < x) n_j = 1;
        }
        if (l == 0) dp[n_i][n_j] += dp[i][j];
        if (l == 1) dp[n_i][n_j] += dp[i][j] * 2;
    }
    cout << dp[n][0] + dp[n][1] << endl;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N, i;
  cin >> N >> i;
  cout << (N - i + 1) << endl;

  return 0;
}


Measured memory_bytes: 256
import bisect
import collections
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint2d(rows): return [getints() for _ in range(rows)]
def getgrid(rows): return [input() for _ in range(rows)]
def array1d(n, value): return [value for _ in range(n)]
def array2d(n, m, value): return [array1d(m, value) for _ in range(n)]

min_val,max_val=getints()

def get_key(pos, is_small, is_large, found):
    return ((pos * 2 + is_small) * 2 + is_large) * 2 + found

mod = 10**9 + 7
cache = [-1] * get_key(64,1,1,1)

def solve(pos, is_small, is_large, found):
    if pos < 0:
        return 1
    key = get_key(pos,is_small,is_large,found)
    res = cache[key]
    if res >= 0:
        return res

    res = 0
    for x in [0,1]:
        for y in [0,1]:
            if x == 1 and y == 0: continue
            if not is_small and x == 0 and (min_val >> pos & 1) == 1:
                continue
            if not is_large and y == 1 and (max_val >> pos & 1) == 0:
                continue
            if not found and x != y:
                continue
            new_is_small = True if x > (min_val >> pos & 1) else is_small
            new_is_large = True if y < (max_val >> pos & 1) else is_large
            new_found    = True if x == y and x == 1 else found
            res += solve(pos-1, new_is_small, new_is_large, new_found)

    res = res % mod
    cache[key] = res
    return res

print(solve(63, False, False, False))

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

#define ll long long
#define sz(x) (int)x.size();

using namespace std;

int n,m,ans;
char grid[25][25];
int dist[25][25],used[25][25];

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

bool check(int i,int j){
	return i>=0 && i<n && j>=0 && j<m  && !used[i][j] && grid[i][j]=='.';
}

void bfs(int a,int b){
	queue<pair<int,int>>q;
	q.push({a,b});
	used[a][b]=1;
	dist[a][b]=0;
	while(!q.empty()){
		pair<int,int>v=q.front();
		q.pop();
		int x=v.first,y=v.second;
		for(int i=0;i<4;i++){
			int xx=x+dx[i],yy=y+dy[i];
			if(check(xx,yy)){
				used[xx][yy]=1;
				q.push({xx,yy});
				dist[xx][yy]=dist[x][y]+1;
				ans=max(ans,dist[xx][yy]);
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>grid[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(grid[i][j]=='.'){
				for(int k=0;k<25;k++){
					for(int t=0;t<25;t++){
						dist[k][t]=0;
						used[k][t]=0;
					}
				}
				bfs(i,j);
			}
		}
	}
	cout<<ans;
	
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
	long int a,b,c;

	scanf("%ld %ld %ld",&a,&b,&c);
	if(a+b-c+2*sqrtl(a*b)<0){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
double memo[501][501];
// N - カードの種類, M - 公開カードの種類
double solve(int N, int M){
  assert(N >= M);
  assert(M >= 0);
  double& res = memo[N][M];
  if(res != -1) return res;
  if(N == M) return 0;
  res = 0;
  int ALL = 2 * N - M;
  if(M > 0) res += (double)M / ALL * solve(N - 1, M - 1);
  res += (double)(ALL - M) * 1 / (ALL * (ALL - 1)) * solve(N - 1, M);
  res += (double)(ALL - M) * M / (ALL * (ALL - 1)) * (1.0 + solve(N - 1, M));
  if(N - M > 1) res += (double)(ALL - M) * (ALL - 1 - M - 1) / (ALL * (ALL - 1)) * (1.0 + solve(N, M + 2));
  return res;
}
int main(){
  int N;
  REP(i, 501)REP(j, 501) memo[i][j] = -1;
  while(cin >> N && N){
    printf("%.15lf\n", solve(N / 2, 0));
  }
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int res = 0;
    for(int i =0; i < N-2; i++){
        if(s.substr(i, 3)=="ABC") res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
while True:
    if A.count(0) == n - 1:
        print(max(A))
        exit()
    else:
        B = [ _  for _ in A if _ != 0  ]
        attack = min(B)
        sn = A.index(attack)
        
        for i in range(n):
            if A[i] == 0:
                pass
            else:
                if i != sn:
                    A[i] = A[i] % attack
                else:
                    pass


Measured memory_bytes: 14224
/*
Hanit Banga
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

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

const int N = 2e5 + 10, M = log2(N) + 10;
const ll inf = 1e15;

ll x[N];
int v[N], dp_lt[2 * N], dp_rt[2 * N], lt[N][M], rt[N][M], max_r[N];

int main()
{
	int n, val;
	cin >> n >> val;
	x[0] = -inf;
	x[n + 1] = inf;
	for (int i = 1; i <= n; ++i)
		cin >> x[i];

	int m = 0;
	for (int j = 0; val > 0; ++j, val /= 2, ++m)
		v[j] = val;

	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= m; ++j)
		{
			lt[i][j] = 1;
			if (x[i] - x[i - 1] <= v[j])
				lt[i][j] += lt[i - 1][j];
		}

		for (int j = 0; j <= m; ++j)
		{
			rt[n - i + 1][j] = 1;
			if (x[n - i + 2] - x[n - i + 1] <= v[j])
				rt[n - i + 1][j] += rt[n - i + 2][j];
		}
	}

	int subsets = (1 << m);
	for (int i = 1; i < subsets; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if (i & (1 << j))
			{
				int temp = dp_lt[i - (1 << j)];
				dp_lt[i] = max(dp_lt[i], temp + rt[temp + 1][j + 1]);
				
				temp = dp_rt[i - (1 << j)];
				dp_rt[i] = max(dp_rt[i], temp + lt[n - temp][j + 1]);
			}
		}
	}

	for (int i = 0; i < N; ++i)
		max_r[i] = -1;

	for (int i = 0; i < subsets; ++i)
		max_r[dp_lt[i]] = max(max_r[dp_lt[i]], dp_rt[subsets - 1 - i]);

	for (int i = n - 1; i >= 0; --i)
		max_r[i] = max(max_r[i], max_r[i + 1]);

	for (int i = 1; i <= n; ++i)
	{
		int l = lt[i][0], r = rt[i][0];
		l = i + 1 - l;
		r = r + i - 1;

		if (max_r[l - 1] >= n - r)
			cout << "Possible\n";
		else
			cout << "Impossible\n";
	}
}

Measured memory_bytes: 50816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a==b && b!=c) cout << "Yes" << endl;
  else if (b==c && c!=a) cout << "Yes" << endl;
  else if (c==a && a!=b) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#ABC126_C
N,K=map(int,input().split())
ans=0

def bichk(n,K):
    #nに2の何乗を書けたらKを超えるか＝nに何回２をかけたらKを超えるか
    a=0
    while 1:
        if n*(2**a)>=K:
            return(a)
            break
        a+=1
if N<K:
    for i in range(1,N+1):
        ans+=(1/N)*(0.5**bichk(i,K))
else:
    ans+=(N-K+1)/N
    for i in range(1,K):
        ans+=(1/N)*(0.5**bichk(i,K))
print(ans)

Measured memory_bytes: 3064
import Control.Monad

calc :: Int -> Int -> Int -> Int -> Int
calc n k x y =
    let z = n - k in
    if z > 0 then
        k * x + z * y
    else
        n * x

main :: IO ()
main = do
    [n,k,x,y] <- replicateM 4 readLn
    putStrLn $ show $ calc n k x y

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

using namespace std;

int main()
{
  int n;
  scanf("%d", &n);
  deque <int> de;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    if (i & 1)
      de.push_back(x);
    else
      de.push_front(x);
  }
  bool first = true;
  if (n & 1) {
    while (!de.empty()) {
      if (first)
        first = false;
      else
        printf(" ");
      printf("%d", de.front());
      de.pop_front();
    }
    printf("\n");
  } else {
    while (!de.empty()) {
      if (first)
        first = false;
      else
        printf(" ");
      printf("%d", de.back());
      de.pop_back();
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int f[100001][5];
int main()
{
	int i,n,a,b,c;
	scanf("%d",&n);
	scanf("%d%d%d",&f[1][1],&f[1][2],&f[1][3]);
	for(i=2;i<=n;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		f[i][1]=max(f[i-1][2],f[i-1][3])+a;
		f[i][2]=max(f[i-1][1],f[i-1][3])+b;
		f[i][3]=max(f[i-1][1],f[i-1][2])+c;
	}
	printf("%d",max(max(f[n][1],f[n][2]),f[n][3]));
	return 0;
}

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

typedef long long ll;
typedef long double ld;

ll s;

int main()
{
    cin >> s;
    ll r = sqrt(ld(s));
    while (r * r > s) r--;
    while (r * r < s) r++;
    ll dif = r * r - s;
    cout << 0 << " " << 0 << " " << r << " " << 1 << " " << dif << " " << r << endl;
    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 100000
#define INF 1 << 30

int n, dp[MAX + 1], a[MAX + 1], length = 0;

int main(){
  cin >> n;
  int val;
  dp[0] = -1;
  for ( int i = 0; i < n; i++){
    cin >> val;
    if ( dp[length] < val){
      dp[++length] = val;
    } else {
      int valMaxLength = lower_bound(dp, dp+length, val) - dp;
      dp[valMaxLength] = val;
    }
  }

  cout << length << endl;

  return 0;
}


Measured memory_bytes: 3412
// A - Connection and Disconnection
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

// ll f(const string &S, int K){
// 	string T; rp(i, 0, K) T += S;//T=S*K
// 	ll c = 0;
// 	char pre = '-';
// 	rp(i,0, T.size()){
// 		if(pre == T[i]){
// 			c++;
// 			pre = '-';
// 		}
// 		else pre = T[i];
// 	}
// 	return c;
// }

ll f(const string &S, int K){//文字列の操作回数を求める
	string T; rp(i, 0, K) T += S;//T=S*K
	ll c = 0;
	for(int i=1; i < T.size(); ++i) if(T[i-1] == T[i]) c++, i++;
	return c;
}

int main(){
  string S; int K; cin>>S>>K;

  int c = 0;
  if(K > 100){
    c = K - 100;
    if(c & 1) c++;
    K -= c;
  }

  ll s1 = f(S, K);
  ll d = f(S, K+2) - s1;
  ll ans = s1 + d * (c / 2);
  cout<< ans <<endl;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> M(H, vector<char>(W));
  vector<vector<int>> N(H, vector<int>(W,0));

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> M.at(i).at(j);
    }
  }

  for (int i = -1; i <= 1; i++) {
    for (int j = -1; j <= 1; j++) {
      for (int k = 0; k < H; k++) {
        for (int l = 0; l < W; l++) {
          if((k+i)>=0 && (k+i)<H){
            if((l+j)>=0 && (l+j)<W){
              if(M.at(k).at(l)=='.'){
                if(M.at(k+i).at(l+j)=='#') N.at(k).at(l)++;
              }else{
                N.at(k).at(l)=99;
              }
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if(N.at(i).at(j)==99) cout << "#";
      else cout << N.at(i).at(j);
    }
    cout << endl;
  }

}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String s;
        Scanner reader = new Scanner(System.in);
        s = reader.nextLine();

        String[] str;
        str = s.split(" ");
        BigInteger a = new BigInteger(str[0]);
        BigInteger b = new BigInteger(str[1]);

        BigInteger c = a.divide(b);

        System.out.println(c);
    }
}



Measured memory_bytes: 26728
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int n,m,nums[10];
int mch[10] = {-1,2,5,5,4,5,6,3,7,6};
int dp[70005],fr[70005];
int main()
{
    while (~scanf("%d %d", &n,&m)) {
        REP(i,1,m) scanf("%d", &nums[i]);
        sort(nums+1, nums+1+m);

        MSET(dp, -1);
        dp[0] = 0;
        REP(j,1,m) REP(i,1,n)  {
            int i0 = i - mch[nums[j]];
            if (i0>=0 && dp[i0]>=0) {
                if (dp[i0] + 1 >= dp[i]) {
                    dp[i] = dp[i0]+1;
                    fr[i] = nums[j];
                }
            }
        }

        vector<int> digs;
        while (n) {
            digs.push_back(fr[n]);
            n -= mch[fr[n]];
        }
        sort(digs.begin(), digs.end(), greater<int> ());
        for (int i: digs) printf("%d", i); puts("");
    }
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

vector<int> v(10);
int main() {
	rep(i,5)cin>>v[i];
	int k;
	string ans = "Yay!";
	cin>>k;
	rep(i,5)rep(j,5){
		if(abs(v[i]-v[j])>k)ans = ":(";
	}
	cout<<ans<<endl;
}

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

using namespace std;

int main(void)
{
    int n;
    scanf("%d",&n);
    int x=n%10;
    if(x==3) puts("bon");
    else if(x==0||x==1||x==6||x==8) puts("pon");
    else puts("hon");
    return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

#define Max 5100
#define Bl '#'
#define Wh '.'

char S[Max][Max];
int A, B, C, X, Y;

int main(int argc, const char * argv[]) {
    A = inputValue();
    B = inputValue();
    C = inputValue();
    X = inputValue();
    Y = inputValue();

    int Bless = max(Y-X, 0);
    int Aless = max(X-Y, 0);

    ll ans = A * X + B * Y;
    ans = min(ans, (ll)(2*C*X + B*Bless));
    ans = min(ans, (ll)(2*C*Y+A*Aless));

    output(ans);

    return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

constexpr int64_t MAX = 1000000000;
int32_t N,K;
int64_t S;

int main()
{
    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);

    in >> N >> K >> S;
    int64_t padding = MAX;
    if (S == MAX) {
        padding = 1;
    }
    int64_t i = 0;
    if (K != 0) { out << S; ++i; }
    for (; i < K; i++)
    {
        out << ' ' << S;
    }
    for (; i < N; i++)
    {
        out << ' ' << padding;
    }
    out << endl;


    return 0;
}
#endif


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

using namespace std;
using ll = long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  set<string> ss;
  ll n;
  string s;
  cin >> n;
  REP(i, n) {
    cin >> s;
    ss.insert(s);
  }
  cout << ss.size() << endl;

  return 0;
}

Measured memory_bytes: 19132
N, X, Y = map(int, input().split())

X -= 1
Y -= 1

ans = [0] * (N-1)

for i in range(N):
  for j in range(i+1, N):
    ans[min(j-i, abs(X-i)+1+abs(Y-j))-1] += 1

for x in ans: print(x)


Measured memory_bytes: 3444
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll a; string s;
    cin >> a;
    cin >> s;

    ll b = 0;
    REP(i, s.size()) {
        if (s[i] == '.') continue;
        b = b * 10 + (s[i] - '0');
    }

    ll ans = a * b / 100;

    print(ans);
    
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ull mod = 1e9+7;
constexpr int N = 13;
ull dp[100010][N];

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int n, i, j;
	cin >> n;
	int a[n];
	roop(i, n) {
		cin >> a[i];
	}
	int max = 1, second = 0;
	int maxIndex = 0, secondIndex = 1;
	roop(i, n) {
		if (max < a[i]) {
			second = max;
			max = a[i];
			secondIndex = maxIndex;
			maxIndex = i;
		} else if (second < a[i]) {
			second = a[i];
			secondIndex = i;
		}
	}
	roop(i, n) {
		if (maxIndex != i) {
			cout << max << endl;
		} else {
			cout << second << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#define MOD 1000000007
#define EPS 1e-10
using namespace std;

int main() {
   int a, b, c;
   cin >> a >> b >> c;
   if (a <= c && c <= b) 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)
using namespace std;
using ll=long long;
int main(){
    int n,a,b,c,d; string s;
    cin>>n>>a>>b>>c>>d>>s;
    s='.'+s;
    if(c<d){
        for(int i=a; i<=d-2; ++i){
            if(s[i]=='#'&&s[i+1]=='#'){
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
    }
    else{
        for(int i=a; i<=c-2; ++i){
            if(s[i]=='#'&&s[i+1]=='#'){
                cout<<"No"<<endl;
                return 0;
            }
        }
        bool ok=false;
        for(int i=b-1; i<=d-1; ++i){
            if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.')ok=true;
        }
        cout<<(ok==true?"Yes":"No")<<endl;
    }
}

Measured memory_bytes: 772
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 0

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;
#define MAX_N 1000

int N;
vector<vector<int>> orders(MAX_N+5, vector<int>(MAX_N-1+5));
int ids[MAX_N+5][MAX_N+5];
vector<pair<int,int>> pairs;

int toId(int i, int j)
{
	if(i==j) {
		return -1;
	}
	if(i<0 || i>=N) {
		return -1;
	}
	if(j<0 || j>=N) {
		return -1;
	}
	return ids[min(i,j)][max(i,j)];
}

pair<int,int> &toPair(int i)
{
	return pairs[i];
}

vector<int> edges[MAX_N*(MAX_N-1)/2+5];

bool visited[MAX_N*(MAX_N-1)/2+5];
int depths[MAX_N*(MAX_N-1)/2+5];

int dfs(int v) {
	DOUT << "=== begin : dfs("<<v<<"): depths["<<v<<"]="<<depths[v]<<" : visited="<<visited[v]<<" ===="<<endl;
	if(depths[v]>=0) {
		DOUT << "=== end(1) : dfs("<<v<<"): depths["<<v<<"]="<<depths[v]<<" : visited="<<visited[v]<<" ===="<<endl;
		return depths[v];
	}
	if(visited[v]) {
		DOUT << "=== end(2) : dfs("<<v<<"): depths["<<v<<"]="<<depths[v]<<" : visited="<<visited[v]<<" ===="<<endl;
		return -1;
	}

	visited[v] = true;
	// vector<int>::reverse_iterator rit = edges[v].rbegin();
	vector<int>::iterator it = edges[v].begin();
	int depth = 1;
	// for(;rit!=edges[v].rend();rit++) {
	// 	int d = dfs(*rit);
	int cd=0;
	for(;it!=edges[v].end();it++) {
		int d = dfs(*it);
		if(d<0) {
			DOUT << "=== end(3) : dfs("<<v<<"): depths["<<v<<"]="<<depths[v]<<" : visited="<<visited[v]<<" ===="<<endl;
			return -1;
		}
		cd = max(cd, d);
	}

	depths[v] = depth+cd;
	DOUT << "=== end(2) : dfs("<<v<<"): depths["<<v<<"]="<<depths[v]<<" : visited="<<visited[v]<<" ===="<<endl;
	return depths[v];
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);
	
	cin >> N;
	FOR(i,N){
	FOR(j,N-1) {
		cin >> orders[i][j];
		orders[i][j]--;
	}
	}
	int id=0;
	// pairs.push_back(make_pair(-1,-1));
	FOR(i,N) {
	FOR(j,i) {
		pairs.push_back(make_pair(min(i,j),max(i,j)));
		DOUT << "["<<min(i,j)<<"]["<<max(i,j)<<"]="<<id<<endl;
		ids[i][j] = id;
		ids[j][i] = id;
		depths[id] = -1;
		id++;
	}
	}
	int numnode= id;

	FOR(i,N) {
	FOR(j,N-1) {
		if(j==0) {
			continue;
		}
		int prevId = toId(i, orders[i][j-1]);
		int currId = toId(i, orders[i][j]);
		edges[currId].push_back(prevId);
		DOUT <<"edges["<<currId<<"].push_back("<<prevId<<")"<<endl;
	}
	}

	int depth = 0;
	FOR(id,numnode) {
		int d = dfs(id);
		if(d<0) {
			cout << -1 << endl;
			return 0;
		}
		depth = max(depth, d);
	}

	cout << depth << endl;

	return 0;
}




Measured memory_bytes: 41836