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

#include <vector>
#include <iostream>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define linf 9223372036854770000

using namespace std;

typedef long long ll;

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
    std::priority_queue<
      int,
      std::vector<int>,
      decltype(compare) // 比較関数オブジェクトを指定
    > que(comp);
*/
template <typename T> void debug(T arr);
template <typename T> void debug (T arr, int dim);



int main(void){
    ll n;
    cin >> n;
    vector<ll> arr(100);
    arr[0] = 2;
    arr[1] = 1;
    for (int i = 2; i < 87; ++i){
        arr[i] = arr[i-1]+arr[i-2];
    }
    cout << arr[n] << endl;
};


template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
};

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
};


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
	if i < N - 2:
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[N - 1])


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

int main() {
	ll a, v, b, w, t;
	cin >> a >> v;
	cin >> b >> w;
	cin >> t;
	if (a > b)swap(a, b);
	if (b + t * w <= a + t * v)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    string s;
    cin >> s;
    int ans = 700;
    rep(i,s.size()){
        if(s[i] == 'o'){
            ans += 100;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  string s; cin >> s;
  if(s[2]==s[3]&&s[4]==s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){
  int points[100005][2], xs[100005], ys[100005], n, w, h;
  long long int sums = 0;
  scanf("%d%d%d", &w, &h, &n);
  for(int i = 0;i < n;i++){
    scanf("%d%d", xs + i, ys + i);
    points[i][0] = xs[i];
    points[i][1] = ys[i];
  }
  sort(xs, xs + n);
  sort(ys, ys + n);
  long long int ans = -1;
  int ansx, ansy;
  int up = min( (n / 2) + 2, n - 1);
  int down = max(0, (n / 2) - 2);


  for(int i = down;i <= up;i++){
    for(int j = down;j <= up;j++){
      long long int  res = 0, far = 0, d;
      for(int k = 0;k < n;k++){
	d = abs(points[k][0] - xs[i]) + abs(points[k][1] - ys[j]);
	far = max(far, d);
	res += d * 2;
      }
      if(ans == -1 || ans > res - far){
	ans = res - far;
	ansx = xs[i];
	ansy = ys[j];
      }
    }
  }
  printf("%lld\n", ans);
  printf("%d %d\n", ansx, ansy);
  return 0;
}

Measured memory_bytes: 2604
#include<stdio.h>
int main (void){
    char str[21];
    int a,i;
    scanf("%s",str);
    for(i=0;i<21;i++){
        if(str[i]=='\0'){
                a=i;
                break;
        }
    }
    for(i=a-1;i>=0;i--){
        printf("%c",str[i]);
        if(i==0){
            printf("\n");
        }
    }
return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < n; ++i)
using namespace std;
const int INF = 2147483647;
using ll = long long;
// cout << typeid('変数').name() << endl;

bool which(char c){
    bool wh=0;
    if(c=='1') wh=1;
    return wh;
}

int main() {
    int n;
    cin >> n;
    vector<tuple<string,int,int>> res;
    for (int i=0;i<n;i++){
        string input_s;
        int input_i;
        cin >> input_s >> input_i;
        res.push_back(make_tuple(input_s,-input_i,i));
    }
    sort(res.begin(),res.end());
    for (int i=0;i<n;++i){
        cout << get<2>(res.at(i))+1 << endl;
    }

    return 0;
}



Measured memory_bytes: 256
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

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

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  ll ans = 0ll;
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    if (i % 3 != 0 && i % 5 != 0) ans += i;
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int n,q;
int main(){
//	freopen("a.txt","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
//	sort(a,a+n);
	cin>>q;
	int res=0,number;
	for(int i=0;i<q;i++){
		cin>>number;
		if(*lower_bound(a,a+n,number)==number)res++;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3440
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b=(b);i<_b;++i)

using namespace std;
const int maxn=100001;
string A,B;
int suma1[maxn],suma2[maxn], sumb1[maxn],sumb2[maxn],n,m;
void enter()
{
    cin>>A>>B;
    n=int (A.size());
    m=int(B.size());
    _for(i,0,n)
    {
        suma1[i+1]+=suma1[i];
        sumb1[i+1]+=sumb1[i];
        if (A[i]=='A')
            suma1[i+1]++;
        else sumb1[i+1]++;
    }
    _for(i,0,m){
        suma2[i+1]+=suma2[i];
        sumb2[i+1]+=sumb2[i];
        if (B[i]=='A')
            suma2[i+1]++;
        else sumb2[i+1]++;
    }
}
void solve()
{
    int q,a,b,c,d;
    cin>>q;
    _for(i,0,q)
    {
        cin>>a>>b>>c>>d;
        int ta1=suma1[b] - suma1[a-1],tb1=sumb1[b] - sumb1[a-1];
        int ta2=suma2[d] - suma2[c-1], tb2=sumb2[d] - sumb2[c-1];
        if ((ta1 + tb1*2)%3==(ta2+tb2*2)%3) cout<<"YES\n";
        else cout<<"NO\n";
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie();
    cout.tie();
    enter();
    solve();
}


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

int main() {
  int n,suma = 0,sumb = 0,ans = 0;
  cin >> n;
  vector<int>A(n);
  vector<int>B(n);
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    suma += a;
    A.at(i) = suma;
  }
  for(int i = 0;i < n;i++){
    int b;
    cin >> b;
    sumb += b;
    B.at(i) = sumb;
  }
  for(int i = 0;i < n;i++){
    int sum;
    if(i == 0) sum = A.at(i)+B.at(n-1);
    else sum = A.at(i)+B.at(n-1)-B.at(i-1);
    if(ans < sum) ans = sum;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import fractions
A,B,C,D = map(int, input().split())
c_d = C * D // fractions.gcd(C, D)
Cd = B // C - (A - 1) // C
Dd = B // D - (A - 1) // D
C_D = max(B // c_d - (A - 1) // c_d,0)
print((B + 1 - A) - (Cd + Dd - C_D))


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

using namespace std;

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

#define pb push_back
#define mp make_pair

int n, k;
vector<int> a;
int ans = 0;

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        int t;
        cin >> t;
        if(t < k) a.pb(t);
    }
    n = a.size();
    sort(a.begin(), a.end());
    for(int i = 0; i < n; i++){
        int sum = 0;
        bool ok = true;
        int lo = 0;
        for(int j = 0; j < n; j++){
            if(i == j) continue;
            sum += a[j];
            while(sum > k - 1){
                if(i != lo) sum -= a[lo];
                lo++;
            }
            if(sum >= k - a[i] && sum <= k - 1) ok = false;
        }
        if(ok) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import bisect
from collections import deque

N = int(input())
A = [int(input()) for _ in range(N)]

L = deque()
L.append(A[0])
for i in range(1, N):
    if A[i] <= L[0]:
        L.appendleft(A[i])
    elif A[i] > L[-1]:
        L[-1] = A[i]
    else:
        idx = bisect.bisect_left(L, A[i])
        L[idx-1] = A[i]
        
print(len(L))

Measured memory_bytes: 53720
N = int(input())
S = input()
first_black = 0
count = 0
for i in range (N):
    if first_black == 0 and S[i]=='#':
        first_black = 1
    if first_black == 1 and S[i]== '.':
        count +=1
        
first_white = 0
white_count = 0
for i in range (N):
    if first_white == 0 and S[N-i-1]=='.':
        first_white = 1
    if first_white == 1 and S[N-i-1]== '#':
        white_count +=1

white_black = 10**6

black_count_left = 0
white_count_right = S.count('.')
ans = black_count_left + white_count_right

for i in range (N):
    if S[i] == '#':
        black_count_left+=1
    elif S[i] == '.':
        white_count_right-=1
    if ans >= black_count_left+white_count_right:
        ans = black_count_left+white_count_right
        
print(min(count,white_count, ans))

Measured memory_bytes: 3628
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=100005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

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

    ll n,m;
    cin >> n >> m;
    ll sum=0;
    rep(i,0,m) {
    	ll x;
    	cin >> x;
    	sum+=x;
    }
    if(n<sum) cout << -1 << endl;
    else cout << n-sum << endl;
}

Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 200000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
int a[N];
int main() {
    int n;
    scanf("%d",&n);

    int num4=0,num2=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]%4==0)
            num4++;
        else if(a[i]%2==0)
            num2++;
    }
    int numOdd=n-num4-num2;
    if(numOdd>num4+1)
       printf("No\n");
    else if(num4+1==numOdd&&num2!=0)
        printf("No\n");
    else
        printf("Yes\n");

    return 0;
}


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

int main() {
  int N,M,i,a,b;
  cin >> N >> M;
  vector<int> R(N,0);
  for(i=0;i<M;i++){
    cin >> a >> b;
    R.at(a-1)++;
    R.at(b-1)++;
  }
  for(i=0;i<N;i++){
    cout << R.at(i) << endl;
  }
}

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  di <- getl toInt
  unless (di == 0) $ do
    [dh,dm] <- getl $ wrds toInt
    ai <- getl toInt
    [ah,am] <- getl $ wrds toInt
    print $ solve di (dh * 100 + dm) ai (ah * 100 + am)
    main

solve :: Int -> Int -> Int -> Int -> Int
solve di dt ai at
  | f dtbl (di,ai) <= 40 && ((at >= 1730 && at <= 1930) || (dt >= 1730 && dt <= 1930)) = g (f ttbl (di,ai))
                                                                                                                   | otherwise = f ttbl (di,ai)
  where
    g x = let y = x `div` 50 in if even y then y `div` 2 * 50 else y `div` 2 * 50 + 50
    f t x = maybe 0 id $ lookup x t
    ttbl = [((1,2),300),((1,3),500),((1,4),600),((1,5),700),((1,6),1350),((1,7),1650),
                        ((2,3),350),((2,4),450),((2,5),600),((2,6),1150),((2,7),1500),
                                    ((3,4),250),((3,5),400),((3,6),1000),((3,7),1350),
                                                ((4,5),250),((4,6),850), ((4,7),1300),
                                                            ((5,6),600), ((5,7),1150),
                                                                         ((6,7),500)]
    dtbl = [((1,2),6),((1,3),13),((1,4),18),((1,5),23),((1,6),43),((1,7),58),
                      ((2,3),7), ((2,4),12),((2,5),17),((2,6),37),((2,7),52),
                                 ((3,4),5), ((3,5),10),((3,6),30),((3,7),45),
                                            ((4,5),5), ((4,6),25),((4,7),40),
                                                       ((5,6),20),((5,7),35),
                                                                  ((6,7),15)]

toInt :: String -> Int
toInt s = read s

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4204
#include <iostream>
#include <algorithm>
#include <sstream>
//#include <fstream>

using namespace std;

int stoi (string str )
{
	stringstream ss (str );
	int res;
	ss >> res;

	return res;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.diff2", "r", stdin );
	int n;

	cin >> n;

	for (int i = 0; i < n; ++i ) {
		string str = "";
		cin >> str;
		sort (str.begin(), str.end() );
		string mins = str;
		sort (str.begin(), str.end(), greater<int>() );
		string maxs = str;
		int min = stoi (mins );
		int max = stoi (maxs );
		int res = max - min;

		cout << res << endl;
	} // end loop

		
	return 0;
}

Measured memory_bytes: 0
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
N,K=map(int,input().split())
mod=10**9+7
ans=0
k=N-K
for i in range(K):
  ans=cmb(N-K+1,i+1,mod)*cmb(K-1,i,mod)
  print(ans%mod)

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

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, input;
	cin >> n;
	std::vector<int> h(n, 0);
	
	for(int i=0; i<n; i++){
	    cin >> h[i];
	}
	
	std::vector<int> c(n, 0);
	c[0] = 0;
	c[1] = abs(h[1]-h[0]);
// 	cout << c[1];
	for(int i=2; i<n; i++){
	    c[i] = min(
	        c[i-2]+abs(h[i]-h[i-2]),
	        c[i-1]+abs(h[i]-h[i-1])
	        );
	}
// 	for(int x: c){
// 	    cout << x << " ";
// 	}
	cout << c[n-1];
	return 0;
}

Measured memory_bytes: 1024
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let x1: i64 = iter.next().unwrap().parse().unwrap();
    let y1: i64 = iter.next().unwrap().parse().unwrap();
    let x2: i64 = iter.next().unwrap().parse().unwrap();
    let y2: i64 = iter.next().unwrap().parse().unwrap();
    let delta_x = x2 - x1;
    let delta_y = y2 - y1;
    let x3 = x2 - delta_y;
    let y3 = y2 + delta_x;
    let x4 = x3 - delta_x;
    let y4 = y3 - delta_y;
    println!("{} {} {} {}", x3, y3, x4, y4);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <algorithm>

#define lli long long int

using namespace std;

int main() {
	lli n, a[100010], sum = 0, minus = 0, zero = 0;
	scanf("%lld", &n);
	for (lli i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		if (a[i] == 0)
			zero++;
		else if (a[i] < 0) {
			minus++;
			a[i] = -a[i];
		}
		sum += a[i];
	}
	sort(a, a + n);
	if ((minus & 1) && (zero < 1))
		printf("%lld\n", sum - a[0] - a[0]);
	else
		printf("%lld\n", sum);
	return 0;
}

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

const int mxN = 3010, mod = 1e9 + 7, mxF = 2e5 + 5;
int H, W, N;
vector<pair<int, int>> p;
ll dp[mxN], fact[mxF], inv[mxF];

ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y = y >> 1;
	}
	return res;
}

ll inverse(ll x) {
	return power(x, mod - 2);
}

void pre_process() {
	fact[0] = inv[0] = 1;
	for (int i = 1; i < mxF; i++) {
		fact[i] = fact[i - 1] * i % mod;
		inv[i] = inverse(fact[i]);
	}
}

bool comp(const pair<int, int>& a, const pair<int, int>& b) {
	return (a.first + a.second < b.first + b.second);
}

ll comb(ll n, ll r) {
	ll ret = 0;
	if (n >= 0 && r >= 0 && n >= r) {
		ret = fact[n] * inv[n - r] % mod * inv[r] % mod;
	}
	return ret;
}

ll func(ll x, ll y) {
	return comb(x + y, x);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	pre_process();
	cin >> H >> W >> N;
	p.push_back(make_pair(1, 1));
	for (int i = 0; i < N; i++) {
		int r, c;
		cin >> r >> c;
		p.push_back(make_pair(r, c));
	}
	p.push_back(make_pair(H, W));
	sort(p.begin(), p.end(), comp);
	N += 2;
	dp[0] = 1;
	for (int i = 1; i < N; i++) {
		dp[i] = func(p[i].first - 1, p[i].second - 1);
		for (int j = 1; j < i; j++) {
			if (p[i].first >= p[j].first && p[i].second >= p[j].second) {
				dp[i] = (dp[i] - func(p[i].first - p[j].first, p[i].second - p[j].second) * dp[j]) % mod;
			}
		}
	}
	dp[N - 1] = (dp[N - 1] + mod) % mod;
	cout << dp[N - 1];
	
	return 0;
}


Measured memory_bytes: 6856
#include<bits/stdc++.h>
                #define ll long long
                #define f   first
                #define s   second
                #define pb          push_back
                #define mod        1000000007
                #define mod1       1000000009
                #define hell        998244353
                #define inf         1000000000000000000LL
                #define pi          3.14159265358979323
                //#define N           100005 
                const int N=200005;
                using namespace std;
                ll n,k,sum,q,res,m,val,ans;
                ll x,y;
                ll xx[]={1,0,-1,0};
                ll yy[]={0,1,0,-1};
                ll cnt[1000005];  
                void solve()    
                {   
                    string s;
                    cin>>s;
                    char a='Z';
                    n=s.size();
                    ll cnt[26]={0};
                    for(int i=0;i<n;i++)
                    {
                        cnt[s[i]-'a']++;
                    } 
                    for(int i=0;i<26;i++) if(cnt[i]==0) {a=char(i+'a');break;}
                    if(a=='Z') cout<<"None";
                else cout<<a;



                }   
                int main()
                {   ios_base::sync_with_stdio(false);
                    cin.tie(0);cout.tie(0);
                    ll t=1; 
                   //cin>>t;
                     for(ll i=1;i<=t;i++)
                        solve();
                }            

Measured memory_bytes: 3760
def main():
    aa=[]
    for _ in range(3):
        aa.append(list(map(int,input().split())))
    n=int(input())
    bb=[]
    for _ in range(n):
        bb.append(int(input()))
    for i in range(3):
        if all(a in bb for a in aa[i]):
            print('Yes')
            return
        if all(a[i] in bb for a in aa):
            print('Yes')
            return
    if all(aa[i][i] in bb for i in range(3)):
        print('Yes')
        return
    if all(aa[2-i][i] in bb for i in range(3)):
        print('Yes')
        return
    print('No')

main()

Measured memory_bytes: 3064
#include<iostream>
#define ll long long
using namespace std;

ll a[1000001];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll n,k,q;
	cin >> n >> k >> q;
	for(int i=0; i<n; i++){
		a[i]=i;
	}
	ll freq[n]={0};
	for(int i=0; i<q; i++){
		ll ans;
		cin >> ans;
		freq[ans-1]++;
	}
	for(int i=0; i<n; i++){
		if(k-q+freq[i]>0) cout << "Yes";
		else cout << "No";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 5180
s=input()
S=[s[i] for i in range(len(s))]
A={'A','C','G','T'}
B=[S[i] in A for i in range(len(S))]
max_length=0
for i in range(len(B)):
  if B[i]==1:
    count_length=1
    count=i
    while (count+1)<len(B) and B[count+1]==1:
      count_length=1+count_length
      count=1+count
      max_length=max(max_length,count_length)
    max_length=max(max_length,1)
      
print(max_length)

Measured memory_bytes: 9032
#include <bits/stdc++.h> 
 
using namespace std; 
 
int main() { 
  int n; cin >> n; 
  if (n % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  string s; cin >> s; 
  string a = s.substr(0, n/2); 
  string b = s.substr(n/2, n/2);
  if (a == b) { cout << "Yes" << endl; } 
  else  { cout << "No" << endl; } 
 
  return 0; 
} 

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
  int A[3];
  scanf("%d %d %d", &A[0], &A[1], &A[2]);
  sort(A, A+3);
  printf("%d\n", A[2]*10+A[1]+A[0]);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main(void){
  string s;
  cin >> s;
  
  if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3])
    cout << "Yes" << endl;
  else if(s[0] == s[2] && s[1] != s[2] && s[1] == s[3])
    cout << "Yes" << endl;
  else if(s[0] == s[3] && s[1] != s[3] && s[1] == s[2])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

          

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

int main() {
    string S;
    cin >> S;
    int N = 13;
    // dp[k] → 13で割った余りがKのパターン数
    vector<long> dp(N);
    dp[0] = 1;

    // 後ろから解くアルゴリズム
    long mod = 1000000007;
    int mul = 1;
    for (int i = S.length() - 1; i >= 0; i--) {
        // 次の状態
        vector<long> nextDP(N);
        char c = S[i];
        if (c == '?') {
            for (int k = 0; k < 10; k++) {
                for (int j = 0; j < N; j++) {
                    nextDP[(k * mul + j) % N] += dp[j];
                    nextDP[(k * mul + j) % N] %= mod;
                }
            }
        } else {
            int k = (int) (S[i] - '0');
                for (int j = 0; j < N; j++) {
                    nextDP[(k * mul + j) % N] += dp[j];
                    nextDP[(k * mul + j) % N] %= mod;
                }
        }

        mul *= 10;
        mul %= N;
        dp = nextDP;
    }

    cout << dp[5] << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   int n;
   cin>>n;
   vector<ll> a(n);
   rep(i, n) cin>>a[i];

   ll c=0, t=0;
   rep(i, n){
      if(c>a[i]) t+=c-a[i];
      c=max(c, a[i]);
   }

   cout<<t<<endl;
   return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  int b[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[i]=INT_MAX;
  }
  b[0]=0;
  b[1]=abs(a[0]-a[1]);
  for(int i=2;i<n;i++){
    b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i-2]-a[i]));
  }
  cout<<b[n-1];
  
}

Measured memory_bytes: 1024
import sys
def input(): return sys.stdin.readline().rstrip()
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

import math
def is_prime(n):
    if n==1:return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
    
def main():
    a,b=map(int,input().split())
    a_s,b_s=set(make_divisors(a)),set(make_divisors(b))
    c_s=a_s&b_s
    ans=[]
    c=list(c_s)
    c.sort()
    ans=1
    for cc in c:
        if is_prime(cc):
            ans+=1
    print(ans)


if __name__=='__main__':
    main()

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

int main(){
    int ans = 0;

    int n; cin >> n;
    map<string,int> b;
    rep(i,n){
        string tmp; cin >> tmp;
        b[tmp]++;
    }

    int m; cin >> m;
    map<string, int> r;
    rep(i,m){
        string tmp; cin >> tmp;
        r[tmp]++;
    }

    for(auto a:b){
        ans = max(ans, a.second - r[a.first]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        long sum = 0;
        for (int i=0; i<Math.pow(2,S.length()-1); i++) {
            int k = 0;
            String b = zeroP(Integer.toBinaryString(i), S.length()-1);
            for (int j=0; j<S.length()-1; j++) {
                if ("1".equals(b.substring(j, j+1))) {
                        sum += Integer.parseInt(S.substring(k, j+1));
                    k = j+1;
                }
            }
            sum += Long.parseLong(S.substring(k, S.length()));
        }
        System.out.println(sum);
    }
    public static String zeroP(String S, int a) {
        while (S.length()<a) {
            S = "0" + S;
        }
        return S;
    }
}

Measured memory_bytes: 23764
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") 
#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define PI 3.1415926535897932384626 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd; 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++)
#define Dep(i,a,b) for (int i = (b)-1; i >= a; i--)
#define dep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for(auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // Random No.
 
const int MOD = 1000000007;
const char nl = '\n';

void sol() {
    int x ,k;
    cin >> x >> k ;
    vi v;
    rep(i, x){
        int t; cin >> t; 
        v.pb(t);
        }
    sort(all(v));
    int sum =0;
    rep(i, k){
        sum += v[i];
    }

    cout << sum << endl;

}               

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

    #ifndef ONLINE_JUDGE
    	freopen("inputB.txt", "r", stdin);
	  #endif    
	
    int T=1;
    while(T--) {            
        sol();                
    }
	
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <map>

using namespace std;

int N;
int prob[100001];
int M;
pair <int,int> drink[101];

int main () {

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

  cin >> M;

  for(int i = 0; i < M; i++) {
    int p,x;
    cin >> p >> x;
    p--;
    drink[i] = (pair<int,int> (p,x));
  }

  for(int i = 0; i < M; i++) {
    int ans = 0;
    for(int j = 0; j < N; j++) {
      if(drink[i].first == j) ans += drink[i].second;
      else ans += prob[j];
    }
    cout << ans <<endl;
  }
    
  return 0;
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

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

//    	File file = new File("src/in.txt");

        //コード
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);

    	int N = sc.nextInt();
    	int K = sc.nextInt();
    	int[] p = new int[N];
    	for(int i=0;i<N;i++) {
    		p[i] = sc.nextInt();
    	}
    	Arrays.sort(p);
    	int ans = 0;
    	for(int i=0;i<K;i++) {
    		ans += p[i];
    	}
    	System.out.println(ans);

    }
}

Measured memory_bytes: 30088
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

int main()
{    
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    REP(i,0,n) cin>>arr[i];

    ll l = 1,u = 1e9;
    ll ans = 1e9;
    while(l <= u){
        ll mid = (l + u)/2;
        ll ct = 0;
        REP(i,0,n){
            ct += (arr[i] + mid - 1)/mid - 1;
        }
        if(ct <= k){
            ans = min(ans,mid);
            u = mid - 1;
        }
        else {
            l = mid + 1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5152
#include<iostream>
using namespace std;
int main()
{
    int a,b,x;
    cin>>a>>b>>x;
    if(a>x)
        cout<<"NO"<<endl;
    else if(a+b<x)
        cout<<"NO"<<endl;
    else{
        for(int i=a;i<=x;i++){
            a++;
            b--;
            if(b<=0)
                break;
        }
        cout<<"YES"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#define ld long double
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<ld> v(N);
    for(int i=0; i<N; ++i) cin >> v[i];
    sort(v.begin(), v.end(), greater<ld>());
    ld ans=0, now=1.0;
    for(int i=0; i<N; ++i){
        if(i+1<N) now /= 2.0;
        ans += v[i]*now;
    }
    cout << setprecision(15) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
 
 
using namespace std;
 
#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;
 
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
const ll INF = 1e18;
const int mod = 1e9+9;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}
 
//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1
 
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}

int main(){

	#ifdef LOCAL_TEST
    freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
    #else
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #endif
    ll n;
    cin>>n;
    double sum = 0;
    for(int i=1;i<=n;i++){
    	ll t;
    	cin>>t;
    	sum += (1.0/t);
    }

    sum = (1.0/sum);

    printf("%0.10f\n",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()



int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++)
      cin >> a.at(i).at(j);
  }
  
  ll n;
  cin >> n;
  vector<int> b(n);  
  rep(i, 0, n)
    cin >> b.at(i);
  
  bool ans = false;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < n; k++) {
        if(a.at(i).at(j) == b.at(k))
          a.at(i).at(j) = 0;
      }
    }
    if(    !(a.at(0).at(0) or a.at(0).at(1) or a.at(0).at(2))
        or !(a.at(1).at(0) or a.at(1).at(1) or a.at(1).at(2))
        or !(a.at(2).at(0) or a.at(2).at(1) or a.at(2).at(2))   
        or !(a.at(0).at(0) or a.at(1).at(0) or a.at(2).at(0))
        or !(a.at(0).at(1) or a.at(1).at(1) or a.at(2).at(1))
        or !(a.at(0).at(2) or a.at(1).at(2) or a.at(2).at(2))
        or !(a.at(0).at(0) or a.at(1).at(1) or a.at(2).at(2))
        or !(a.at(0).at(2) or a.at(1).at(1) or a.at(2).at(0))){
          
      ans = true;
      break;
    }
  }
                
  
  cout << (ans ?"Yes" :"No") << "\n";

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef complex<double> P;

struct C {
  P p;
  int r, c;
};
int n;
vector<C> vc;
signed char memo[1<<24];
int solve(int S) {
  if (memo[S] != -1) return memo[S];
//cout << bitset<24>(S) << endl;
  int T = 0;
  REP(i,n) {
    if (S>>i&1) continue;
    bool f = 1;
    REP(j,i) {
      if (S>>j&1) continue;
      if (abs(vc[i].p-vc[j].p) < vc[i].r+vc[j].r) {
        f = 0;
        break;
      }
    }
    if (f) T |= 1<<i;
  }
  int res = 0;
  // FOR(it, hoge)
  //   cout << *it << " ";
  // cout << endl;
  REP(i,n) {
    if (!(T>>i&1)) continue;
    REP(j,i) {
      if (!(T>>j&1)) continue;
      if (vc[i].c==vc[j].c)
        res = max(res, solve(S|(1<<i)|(1<<j)) + 2);
    }
  }
  return memo[S] = res;
}

int main() {
  while(cin>>n,n) {
    vc.clear();
    REP(i,n) {
      int x,y,r,cc;
      cin >> x>>y>>r>>cc;
      vc.push_back((C){P(x,y),r,cc});
    }
    memset(memo,-1,sizeof(memo));
    cout << solve(0) << endl;
  }
}

Measured memory_bytes: 16000
#include<iostream>
using namespace std;
typedef long int li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0

int main(){
  int a,b; cin >>a >>b;
  printf("64 64\n");
  char grid[64][64];
  rep(i,64) rep(j,64)
    grid[i][j]=(j<32)?'#':'.';

  rep(i,32)rep(j,16){
    if(--a>0) grid[2*i][2*j]='.';
  }
  rep(i,32)rep(j,16){
    if(--b>0) grid[2*i+1][2*j+33]='#';
  }
  
  rep(i,64){
    rep(j,64) printf("%c",grid[i][j]);
    printf("\n");
  }
}

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

int main(){
	int a,b,i,j,N,M;
	vector <int> c,d;
	cin >> N >> M;
	for(i=0;i<M;i++){
		cin >> a >> b;
		if(a == 1){
			c.push_back(b);
		}else{
			c.push_back(N+1);
		}
		
		if(b == N){
			d.push_back(a);
		}else{
			d.push_back(0);
		}
	}
	sort(c.begin(),c.end());
	sort(d.begin(),d.end());
	i = 0;
	j = 0;
	while(i!=M && j!=M){
		if(c[i] < d[j]){
			i += 1;
		}else if(c[i] > d[j]){
			j += 1;
		}else{
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	
	cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 2036
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main()
{
  int n; cin >> n;
  int card[2 * n + 1]; FOR(i, 0, 2 * n + 1) card[i] = i;
  int m; cin >> m;
  FOR(i, 0, m) {
    int k; cin >> k;
    int tmp[2 * n + 1];
    if(k == 0) {
      FOR(j, 1, n + 1) {
        tmp[2 * (j - 1) + 1] = card[j];
        tmp[2 * (j - 1) + 2] = card[j + n];
      }
    } else {
      FOR(j, k + 1, 2 * n + 1) tmp[j - k] = card[j];
      FOR(j, 1, k + 1) tmp[j + 2 * n - k] = card[j];
    }
    FOR(i,1,2*n+1) card[i] = tmp[i];
  }
  FOR(i, 1, 2 * n + 1) cout << card[i] << endl;
  return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
    char s[100];
    scanf("%s",s);
    int a[100]={0};
    int n=strlen(s);
    for(int i=0;i<n;i++)
    {
        a[i]=s[i]-'0';
    }
    int num=1000;
    for(int i=2;i<n;i++)
    {
        num=min(num,abs(a[i]+a[i-1]*10+a[i-2]*100-753));
    }
    printf("%d\n",num);
    return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include<stack>
#include<queue>
#include <cassert>
using namespace std;

 
int main(){
    string s, t;
    cin >> s >> t;
    bool flag=true;
    for(int i=0; i<s.size(); i++){
        if(s[i] != t[i]){
            flag = false;
            break;
        }        
    }
    if(flag) cout << "Yes" << endl;
    else  cout << "No" << endl;
}

Measured memory_bytes: 3616
#include <stdio.h>

int isPrime(int);

int main(){
    int n,x,i;
    int count = 0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x);
        if(isPrime(x))count++;
    }
    printf("%d\n",count);
    return 0;
}
int isPrime(int x){
    int i;
    if(x < 2) return 0;
    else if(x == 2) return 1;
    if(x % 2 == 0)return 0;
    for(i=3;i*i  <= x;i+=2){
        if(x % i == 0) return 0;
    }
    return 1;
}



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


int main(){
  int n, d;
  cin >> n >> d;
  
  int ans = 0;
  ans = n / (2*d+1);
  if(n % (2*d+1) != 0) ans++;
  cout << ans << endl;
}

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

ll mod=1e9+7;

int main() {
    string s;
    cin >> s;
    int n=s.size();
    int z=0,o=0;
    for (int i=0;i<n;i++) {
        if (s[i]=='0') z++;
        else o++;
    }
    cout << 2*min(z,o) << endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
}


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

int main() {
  int a;
  int b;
  int c;	//aとbの積
  int d;	//aとbの積+1
  cin >> a;
  cin >> b;
  c = (a * b) / 2;
  d = (a * b + 1) / 2;
  if (c == d) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}
  

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

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i != -1; i = edge[i].next)
#define v edge[i].to

using namespace std;

typedef long long LL;

const int N = 210;
const int inf = 1e9 + 7;

struct Edge{ int to, next; LL f;}edge[N * N * 2];
int head[N], num = -1;
void add_edge(int a, int b, LL f)
{
    edge[++ num].to = b, edge[num].f = f;
    edge[num].next = head[a], head[a] = num;
    edge[++ num].to = a, edge[num].f = 0;
    edge[num].next = head[b], head[b] = num;
}

int q[N], S, T;
LL dis[N];
bool bfs()
{
    memset(dis, -1, sizeof(dis));
    int he = 0, ta = 0;
    q[++ ta] = S, dis[S] = 0;
    while (he != ta){
    	int x = q[++ he];
        RepG(i, x) if (edge[i].f && dis[v] == -1) {
            dis[v] = dis[x] + 1, q[++ ta] = v;
            if (v == T) return true;
        }
    }
    return false;
}
LL dfs(int x, LL fl)
{
    if (x == T) return fl;
    LL ret = 0, tmp;
    RepG(i, x)
        if (fl && edge[i].f && dis[v] == dis[x] + 1 && (tmp = dfs(v, min(fl, edge[i].f))))
            ret += tmp, fl -= tmp, edge[i ^ 1].f += tmp, edge[i].f -= tmp;
    if (!ret) dis[x] = -1;
    return ret;
}

char s[N][N];

int main()
{
	int h, w;
	scanf("%d%d", &h, &w);
	Rep(i, h) scanf("%s", s[i] + 1);
	int sx, sy, tx, ty;
	memset(head, -1, sizeof(head));
	Rep(i, h) Rep(j, w) {
		if (s[i][j] == 'S') sx = i, sy = j;
		else if (s[i][j] == 'T') tx = i, ty = j;
		else if (s[i][j] == 'o') add_edge(i, h + j, 1), add_edge(h + j, i, 1);
	}
	
	if (sx == tx || sy == ty) printf("-1\n");
	else {
		S = h + w + 1, T = S + 1;
		add_edge(S, sx, inf); add_edge(S, sy + h, inf);
		add_edge(tx, T, inf); add_edge(ty + h, T, inf);
		//printf("*");
		int ans = 0, tmp;
		while (bfs()) while(tmp = dfs(S, inf)) ans += tmp;
		printf("%d\n", ans);
	}
	
	return 0;
}


Measured memory_bytes: 896
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
max_a = max(a)
max_sc = b[-2]
max_cnt = a.count(max_a)
for i in range(n):

    if max_a > a[i]:
        print(max_a)
    else:
        if max_cnt > 1:
            print(max_a)
        else:
            print(max_sc)


Measured memory_bytes: 14112