akhauriyash/Code-Regression huggingface dataset:
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=998244353; /*1000000007;*/

ll mod_pow(ll a,ll x){
    if(a==0){return 0;}
    ll ret=1;
    while(x>0){
        if(x&1){ret*=a; ret%=MOD;}
        a*=a; a%=MOD;
        x>>=1;
    }
    return ret;
}



int main(){
    ll n,m;
    cin>>n>>m;
    map<pll,ll> M;
    ll num=0;
    for(int i=0;i<m;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--; b--;
        if(abs(a-b)>2){
            if(M.count({a,b})){
                if(M[{a,b}]!=c){cout<<0<<endl; return 0;}
            }
            else{
                num++;
                M[{a,b}]=c;
                M[{b,a}]=c;
            }
        }
        else{
            M[{a,b}]=c;
        }
    }
    vector<vector<ll>> dp(n,vector<ll>(1<<4,0));
    vector<pll> A={{0,0},{0,1},{1,0},{1,1}};
    for(int i=0;i<(1LL<<4);i++){
        bool j=true;
        for(int t=0;t<4;t++){
            if(M.count(A[t]) && (i>>t&1)!=M[A[t]]){j=false; break;}
        }
        ll count=0;
        for(int t=0;t<4;t++){
            if(i>>t&1){count++;}
        }
        if(j && count%2==0){dp[0][i]=1;}
    }
    for(int i=1;i+1<n;i++){
        for(int t=0;t<1<<4;t++){
            bool j=true;
            ll P=0;
            for(int h=0;h<4;h++){
                if(t>>h&1){P++;}
                if(M.count({i+A[h].F,i+A[h].S}) && (t>>h&1)!=M[{i+A[h].F,i+A[h].S}]){j=false; break;}
            }
            if(j==false || P&1){continue;}
            for(int h=0;h<1<<4;h++){
                if((t&1)!=(h>>3&1)){continue;}
                ll count=0;
                for(int k=0;k<3;k++){count+=(h>>k&1);}
                for(int k=0;k<4;k++){count+=(t>>k&1);}
                if(M.count({i-1,i+1}) || M.count({i+1,i-1})){
                    if(M.count({i-1,i+1}) && M.count({i+1,i-1})){
                        count+=M[{i-1,i+1}];
                        count+=M[{i+1,i-1}];
                        if(count%2==0){
                            dp[i][t]+=dp[i-1][h];
                        }
                    }
                    else{
                        dp[i][t]+=dp[i-1][h];
                    }
                }
                else{
                    dp[i][t]+=dp[i-1][h]*2;
                }
            }
            dp[i][t]%=MOD;
        }
    }
    ll X=n*n-n;
    X/=2;
    X-=2*(n-2);
    X-=1;
    ll ans=mod_pow(2,X-num);
    ll count=0;
    for(int i=0;i<1LL<<4;i++){
        count+=dp[n-2][i];
    }
    count%=MOD;
    cout<<ans*count%MOD<<endl;
    
    
    return 0;
}


Measured memory_bytes: 22912
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

N=one_int()
T=many_int()

M=one_int()

for i in range(M):
    P,X=two_int()
    temp = T[P-1]
    T[P-1] =X
    print(sum(T))
    T[P-1] = temp

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

def prime_factorize(N):
    #素因数分解
    from collections import defaultdict
    factorize = defaultdict(int)
    while N%2 == 0:
        factorize[2]+=1
        N //= 2
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        while N%i == 0:
            factorize[i] += 1
            N //= i
    if N!=1:factorize[N]=1
    return factorize

n_primes = prime_factorize(n)
ret = 0

for k,v in n_primes.items():
    cnt = 1
    while cnt <= v:
        ret+=1
        v -= cnt
        cnt+=1

print(ret)

Measured memory_bytes: 9460
n = int(input())
a = sorted(list(map(int, input().split())))

ans = 0
dp = [0] * (a[-1] + 1)

for i in range(n):
    tmp = a[i]
    while tmp <= a[-1]:
        dp[tmp] += 1
        tmp += a[i]

for i in a:
    if dp[i] == 1:
        ans += 1

print(ans)


Measured memory_bytes: 32240
N=int(input())
A=[int(i) for i in input().split()]
S=""
for i in range(N-1):
    S=S+str(A[i])+" "
S=S+str(A[N-1])
print(S)
for i in range(1,N):
    v=A[i]
    j=i-1
    while(j>=0 and A[j]>v):
        A[j+1]=A[j]
        j-=1
    A[j+1]=v
    S=""
    for i in range(N-1):
        S=S+str(A[i])+" "
    S=S+str(A[N-1])
    print(S)


Measured memory_bytes: 5604
#include "stdio.h"                                                  
int main(void){
int x;
int y;
do{
scanf("%d %d",&x,&y);
if(x>y){
printf("%d %d\n",y,x);
}else if(x!=0 || y!=0){
printf("%d %d\n",x,y);
}
}while(x!=0 || y!=0);
return 0;
}

Measured memory_bytes: 600
import java.math.BigInteger;
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int K = Integer.parseInt(in.readLine());
        String[] s = in.readLine().split(" ");
        int A = Integer.parseInt(s[0]);
        int B = Integer.parseInt(s[1]);
        if(A % K == 0) {
            System.out.println("OK");
        } else {
            int mod = A % K;
            int num = A + (K - mod);
            if(num <= B && num >= A) {
                System.out.println("OK");
            } else {
                System.out.println("NG");
            }
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  string s;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> s;
    mp[s]++;
  }
  int m;
  cin >> m;
  string t;
  for (int i = 0; i < m; i++) {
    cin >> t;
    mp[t]--;
  }
  int ans = 0;
  for (auto p : mp) {
    auto key = p.second;
    ans = max(ans, key);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

    int N; cin >> N;
    ll ans = 0;
    for(int i=1;i< N+1;i++) {
        ll lo = i;
        ll hi = (N / i) * i;
        ll cnt = hi / i - lo / i + 1;
        ans += (cnt * (lo + hi)) / 2;
    }
    cout << ans ;

	return 0;
}


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

int main(){
  ll X; cin >> X;
  
  int k;
  while(k*(k+1)/2 < X){
      k++;
  }
  
  ll ans = 0;
  ll now = 0,next = 1;
  ll count = 0;
  while(count != X){
      if(next == k*(k+1)/2 - X) next++;
      //cout << now << ' ' << next << endl;
      ans += next - now;
      now = next;
      next = now + 1;
      count += now;
  }
  cout << ans << endl;
}



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

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int a, b, c;
    cin >> a >> b >> c;

    int ans = min(b / a, c);

    Cout(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
 int a,b;
 string s1,s2;
 cin>>a>>s1>>s2;
 for(int i=0;i<a;i++)
 {
     cout<<s1[i]<<s2[i];
 }
return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a;
    int b;
    int c;
    
    cin >> a >> b >> c;
    
    if ((a < b) && (b < c))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
       int a,b;cin>>a>>b;
       int mx = max({a*b,a+b,a-b});
       cout<<mx;
    }
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;


int main(){
   int N; cin >> N;
   int ans=0;
   while(N>0){
       if ((N%10)==2){
           ans++;
       }
       N /= 10;
   }
   cout << ans << endl;
}

Measured memory_bytes: 3528
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int list[] = new int[N];
            
        for (int i = 0; i < N; i++){
            int value = sc.nextInt();
            list[i] = value;
        }
        
        Arrays.sort(list);
        
        for (int i = 0; i < N; i++){
            if (i != N-1 && list[i] == list[i+1]){
                System.out.println("NO");
                return;
            } 
        }
        
        System.out.println("YES");
    }
}


Measured memory_bytes: 65344
macro_rules! read {
    () => {{
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf
    }};
    ( Vec<$t:ty> ) => {
        read!()
            .trim()
            .split_whitespace()
            .map(|x| x.parse::<$t>().unwrap())
            .collect::<Vec<_>>()
    };
    ( $( $t:ty ),* ) => {{
        let buf = read!();
        let mut iter = buf.split_whitespace().collect::<Vec<_>>().into_iter();
        ( $( iter.next().unwrap().parse::<$t>().unwrap() ),* )
    }};
}

fn main() {
    let (n, m) = read!(usize, usize);
    let mut neighbor = vec![vec![]; n + 1];
    for _ in 0..m {
        let (a, b) = read!(usize, usize);
        neighbor[a].push(b);
        neighbor[b].push(a);
    }
    let mut ans = vec![0; n + 1];
    ans[1] = 1;
    let mut que = std::collections::VecDeque::new();
    que.push_back(1);
    while let Some(now) = que.pop_front() {
        for next in neighbor[now]
            .iter()
            .filter(|x| ans[**x] == 0)
            .collect::<Vec<_>>()
        {
            ans[*next] = now;
            que.push_back(*next);
        }
    }
    println!(
        "Yes\n{}",
        ans[2..]
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join("\n")
    )
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/03/03  Problem: 020_agc_b / Link: https://agc020.contest.atcoder.jp/tasks/agc020_b?lang=en  ----- */
/* ------問題------

スケートリンクで、一人の大人の司会と N 人の子供がゲームを行います。 ゲームは K ラウンドからなり、ラウンド i では司会が次のように言います。
Ai 人組を作って！
すると、まだ脱落していない子供たちは Ai 人からなるグループをできるだけ多く組みます。 一人につき一つのグループにしか入れません。 グループに入れなかった子供たちは脱落し、その他は次のラウンドに進みます。 ラウンドで誰も脱落しないこともありえます。
最後まで、つまりラウンド K のあとまで残ったのは 2 人で、彼らが勝者となりました。
あなたは A1, A2, ..., AK の値を聞き、N の値は知りませんが、推定してみたくなりました。
ゲームの開始前にいた子供たちの人数として考えられる最小の値と、最大の値を求めてください。もしくは、考えられる N の値は存在しないと判定してください。

-----問題ここまで----- */
/* -----解説等-----

逆から実際の値の範囲を復元していく。
下限は次の条件を満たさないといけないので(a[i]での下限)
上限は条件を満たしていれば少し多くても大丈夫なので(上限 + (a[i]-1))

----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VI a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	reverse(ALL(a));
	ans = 1;
	if (a.front() != 2)ans = 0;

	LL L = 2, R = 2;

	FOR(i, 0, N) {
		LL x = (L + a[i] - 1) / a[i] * a[i];
		if (x < L || R < x)ans = 0;
		L = x;
		R = (R / a[i])* a[i] + (a[i] - 1); // 上げる
	}
	if (!ans) {
		cout << -1 << endl;
	}
	else {
		cout << L << " " << R << "\n";
	}
	return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0

def div2(n):
    count=0
    while n%2==0:
        n=n//2
        count+=1
    return count
        

n=int(input())
a=list(map(int,input().split()))
for ai in a:
    count+=div2(ai)
print(count)


Measured memory_bytes: 42348
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<iostream>
#include<algorithm>//next_permutation
#include<complex>
using namespace std;
int main() {
	long long int N, K;
	cin >> N >> K;
	if (N > K) {
		long long int answer, answer2;
		answer = N % K;
		answer2 = abs(answer - K);
		cout << min(answer, answer2) << endl;
		return 0;
	}
	else {
		long long int answer, answer2;
		answer = N;
		answer2 = abs(N - K);
		cout << min(answer, answer2) << endl;
		return 0;
	}
}

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

using namespace std;

int main(){
  int num[3];
  int max, min;
  int max_v, min_v;

  cin >> num[0] >> num[1] >> num[2];

  sort(num, num+3);

  cout << (num[2] * 10 + num[1] + num[0]);
  return 0;
}


Measured memory_bytes: 256
def to_key(s)
  s.gsub!('A', '1')
  s.gsub!('C', '2')
  s.gsub!('G', '3')
  s.gsub!('T', '4')
  s.to_i
end
def hash(key, i)
  (h1(key) + i * h2(key)) % 1046527
end
def h1(key)
  key % 1046527
end
def h2(key)
  1 + (key % (1046527 - 1))
end

class Dict
  def initialize
    @arr = []
  end
  def insert(s)
    key = to_key(s)
    i = 0
    loop do
      h = hash(key, i)
      if @arr[h] == s
        return
      elsif @arr[h].nil?
        @arr[h] = s
        return
      end
      i = i + 1
    end
  end
  def find(s)
    key = to_key(s)
    i = 0
    loop do
      h = hash(key, i)
      if @arr[h] == s
        return true
      elsif @arr[h].nil?
        return false
      end
      i = i + 1
    end
    false
  end
end

n = STDIN.gets.to_i

dict = Dict.new
n.times.each {
  ss = STDIN.gets.split(' ')
  if ss[0] == 'insert' then
    dict.insert(ss[1])
  else
    if dict.find(ss[1]) then
      puts 'yes'
    else
      puts 'no'
    end
  end
}

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

int main() {
  string s;
  string sfront, sback;
  char c;
  int q, t, f;
  bool reverseflag = false;
  
  cin >> s;
  cin >> q;
  
  for (int i = 0; i < q; i++) {
    cin >> t;
    if (t == 1) {
      reverseflag = !reverseflag;
    }
    if (t == 2) {
      cin >> f >> c;
      if ((f == 1 && !reverseflag) || (f == 2 && reverseflag)) {
        sfront.push_back(c);
      }
      else {
        sback.push_back(c);
      }
    }
  }
  
  reverse(sfront.begin(), sfront.end());
  s = sfront + s + sback;
  if (reverseflag) {
    reverse(s.begin(), s.end());
  }
  
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 1348
#include<iostream>
#include<vector>
#include<map>
#define ll long long
using namespace std;
ll int sum(int i,int j,ll int *arr)
{
    ll int sum2=0;
    for(int p=i-1;p<j;p++)
        sum2+=arr[p];
    return sum2;
}
int main()
{
    int n;
    cin>>n;
    ll int *arr=new ll int[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll int **dp=new ll int*[n+1];
    for(int i=0;i<=n;i++)
    {
        dp[i]=new ll int[n+1]();
        for(int j=1;j<=n;j++)
            dp[i][j]=LLONG_MAX;
    }
    for(int len=1;len<=n;len++)
    {
        for(int i=1;i<=n-len+1;i++)
        {
            int j=i+len-1;
            if(i==j)
            {
                dp[i][j]=0;
            }
            else
            {
                for(int k=i;k<j;k++)
                {
                    dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+sum(i,j,arr));
                }
            }
      
        }
    
    }
    cout<<dp[1][n];
}


Measured memory_bytes: 4392
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    VL a(n);
    ll ans = 0;
    REP(i,n){
        scanf("%lld", &a[i]);
    }
    REP(i,n){
        if (i>0 && a[i-1] == 1 && a[i] > 0){
            ans++;
            a[i]--;
        }
        ans += a[i]/2;
        a[i] %= 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    bitset<11> ar[11],x,ar2;

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,m,i,j,k,a,b;
            cin>>n>>m;
            for(i=0;i<m;++i)
            {
                cin>>k;
                while(k--)
                {
                    cin>>a;
                    --a;
                    ar[a][i]=1;
                }
            }
            for(i=0;i<m;++i)
            {
                cin>>a;
                if(a==1)
                    ar2[i]=1;
            }

            int ans=0;
            for(i=0;i<(1<<n);++i)
            {
                int ar3[m];
                x.reset();
                for(j=0;j<n;++j)
                {
                    if((i&(1<<j)))
                        x=x^ar[j];
                }
                if(x==ar2)
                    ++ans;
            }
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i;

    int n;
    scanf("%d",&n);

    char* str = (char *)malloc(sizeof(char) * n);
    int* cdnW = (int *)malloc(sizeof(int) * n);
    int* cdnE = (int *)malloc(sizeof(int) * n);
	if (str == NULL || cdnW == NULL || cdnE == NULL) exit(0);
    scanf("%s",str);

	for (i = 0;i < n;i++) {
	    cdnW[i] = 0;
	    cdnE[i] = 0;
	}

    //
    /*
    for (j = 0;j < n;j++) {
        printf("%c,",str[j]);
    }	
	printf("\n");
	*/
    
	// 本番
	int westWeight = 0;
    for (i = 0;i < n;i++) {
        cdnW[i] = westWeight;
        if(str[i] == 'W'){
            westWeight++;
        }
        /*
        for (j = 0;j < n;j++) {
            printf("%d,",cdnW[j] + cdnE[j]);
        }
    	printf("\n");
        */
	}

    int cdnMin = 999999;
	int eastWeight = 0;
    for (i = n-1;i >= 0;i--) {
        cdnE[i] = eastWeight;
        if(str[i] == 'E'){
            eastWeight++;
        }
        /*
        for (j = 0;j < n;j++) {
            printf("%d,",cdnW[j] + cdnE[j]);
        }
    	printf("\n");
        */
        if(cdnMin > cdnW[i] + cdnE[i]){
            cdnMin = cdnW[i] + cdnE[i];
        }
    }

    // 最小値計算
    /*
	for (i = 0;i < n;i++) {
        if(cdnMin > cdnW[i] + cdnE[i]){
            cdnMin = cdnW[i] + cdnE[i];
        }
	}
	*/

    // 確認
    /*
    for (j = 0;j < n;j++) {
        printf("%d,",cdn[j]);
    }
	printf("\n");
	*/
	
    printf("%d\n",cdnMin);

    // 解放
	free(str);
	free(cdnE);
	free(cdnW);
}


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

#define pb push_back
#define ll long long int
#define f(i,g,n) for(int i=g;i<=n;i++)

ll A[200003]={0},B[200003]={0};
bool C[200003]={0};

void dfs(vector<ll> V[],int i,ll curr)
{
	C[i] = true;
	A[i] = curr+B[i];
	curr = A[i];
	for(auto x:V[i])
	{
		if(C[x] == false)
			dfs(V,x,curr);
	}
}

int main()
{
	ios::sync_with_stdio(false);
  
	ll n,q;
	cin>>n>>q;
	vector<ll> V[n+1];
	f(i,0,n-2)
	{
		ll a,b;
		cin>>a>>b;
		V[a].pb(b);
		V[b].pb(a);
	}
	while(q--)
	{
		ll p,x;
		cin>>p>>x;
		B[p] += x;
	}
	dfs(V,1,(ll)0);
	f(i,1,n)
		cout<<A[i]<<" ";
	cout<<"\n";

	return 0;
}

Measured memory_bytes: 25856
import java.math.BigDecimal;
import java.util.Scanner;

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

		var result = BigDecimal.valueOf(a).multiply(new BigDecimal(b));
		System.out.println(result.longValue());
	}
}

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

int main()
{
	int n;
	bool c[4][13]={false};
	cin >> n ;

	for(int i=0;i<n;++i){
		int j;
		char k;
		cin >> k >> j;
	
		switch(k){
		case 'S':c[0][j-1] = true;break;
		case 'H':c[1][j-1] = true;break;
		case 'C':c[2][j-1] = true;break;
		case 'D':c[3][j-1] = true;break;
		}
	}

	for(int i=0;i<4;++i){
		for(int j=0;j<13;++j){
			if(c[i][j] == false){
				switch(i){
				case 0:cout << 'S' << ' ';break;
				case 1:cout << 'H' << ' ';break;
				case 2:cout << 'C' << ' ';break;
				case 3:cout << 'D' << ' ';break;
				}
				cout << j+1 << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3
def bfs(s):
    if len(s) == n:
        print(s)
        return 
    ord_num = 97#aから順番に回す
    while True:
        #aから順番に埋めていく。sにないものがきたらそこまで再帰して終了
        char = chr(ord_num)
        if char in s:
            bfs(s+char)
        else:
            bfs(s+char)
            break#ここで終了
        ord_num += 1
if __name__ == "__main__":
    n = int(input())
    s = ""
    bfs(s)


Measured memory_bytes: 56792
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;


int main(){
  while(1){
    int N,M;
    long ans=0;
    cin >> N >> M;
    pair<int,int> X[N];
    if(N==0&&M==0) break;
    for(int i=0;i<N;++i) cin >> X[i].second >> X[i].first;
    sort(X,X+N);
    reverse(X,X+N);
    for(int i=0;i<N&&M>0;++i){
      for(;X[i].second>0&&M>0;--M){
	X[i].second--;
      }
    }
    
    for(int i=0;i<N;++i){
      ans+=X[i].first*X[i].second;
    }
    cout<<ans<<endl;;
  }
}

Measured memory_bytes: 1240
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			
			for(int i=0; i<n; i++) {
				int y = sc.nextInt();
				int m = sc.nextInt();
				int d = sc.nextInt();
				int days = 0;
				
				for(int j=y+1; j<1000; j++) {
					if(j%3 == 0) {
						days += 200;
					}else {
						days += 5*19 + 5*20;
					}
				}
				for(int j=m+1; j<=10; j++) {
					if(y%3 == 0) {
						days += 20;
					}else {
						if(j == 1 ||j == 3 ||j == 5 ||j == 7 ||j == 9) {
							days += 20;
						}else {
							days += 19;
						}
					}
				}
				/*
				if(m == 1 ||m == 3 ||m == 5 ||m == 7 ||m == 9) {
					days += 20;
				}else if(m == 2 ||m == 4 ||m == 6 ||m == 8 ) {
					days += 19;
				}
				*/
				
				if(y%3 == 0) {
						days += 20 - d;
				}else {
					if(m == 1 ||m == 3 ||m == 5 ||m == 7 ||m == 9) {
						days += 20 - d;
					}else {
						days += 19 - d;
					}
				}
			
			System.out.println(days+1);
			
			
			}
			
				
		}
	}
}


Measured memory_bytes: 26440
#include <bits/stdc++.h>
using namespace std; 
int a[1000001],b[1000001];
int main(){
    int n,m,i;
    scanf("%d%d",&n,&m);
    for(i=1;i<=m;i++){
        int st,ed;
        scanf("%d%d",&st,&ed);
        if(st == 1) a[ed] = 1;
        if(ed == n) b[st] = 1;
    }
    for(i=1;i<=m;i++)
        if(a[i]&&b[i]){
            printf("POSSIBLE\n");
			return 0;
        }
    printf("IMPOSSIBLE\n");
    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define log(i,n) log(n)/log(i);
using namespace std;
typedef long long ll;


int main()
{
	ll n;
	cin >> n;
	cout << n * (n + 1) / 2 - n<< endl;//2.0で割ってはいけない。指定が整数値なので狂ってしまう。
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d", &W,&H,&x,&y,&r);
	
	if (0<=x-r && x+r<=W && 0<=y-r && y+r<=H){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2108
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			double val = in.nextDouble();
			if (val < 0) {
				break;
			}
			String ans;
			if (val >= 256) {
				ans = "NA";
			} else {
				int seisu = (int) val;
				int syosu = (int) ((val - seisu) * 16);
				if ((val - seisu) * 16 - syosu != 0) {
					ans = "NA";
				} else {
					String seisuB = Integer.toBinaryString(seisu);
					while (seisuB.length() < 8) {
						seisuB = "0" + seisuB;
					}
					String syosuB = Integer.toBinaryString(syosu);
					while (syosuB.length() < 4) {
						syosuB = "0" + syosuB;
					}
					ans = seisuB + "." + syosuB;
				}
			}
			System.out.println(ans);
		}

	}
}

Measured memory_bytes: 27984
#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(){
    ll N;
    cin>>N;

    int n;
    vector<char> s;
    if(N<27){
        n=N%27;
        cout<<char('a'+n-1);  
        return 0;
    }else{
        n=N%26;
        if(n==0) n=26;
        s.push_back(char('a'+n-1));
        N=(N-1)/26;

        while(N>0){
            int n=N%26;
            if(n==0) n=26;
            s.push_back(char('a'+n-1));
            N=(N-1)/26;
            if(N==0) break;
        }
    }

    rep(i, s.size()) cout<<s[s.size()-i-1];

    // ll num=26;
    // int keta=1;
    // while(num<=N){
    //     keta++;
    //     num=num*27;
    // }
    // ll wa=num/27;

    // while(keta>0){
    //     int num;
    //     if(keta!=1){
    //         num=N/wa;
    //         cout<<char('a'+num-1);
    //     }else{
    //         num=N%27;
    //         cout<<char('a'+num-1);
    //     }
    //     N=N%wa;
    //     wa/=27;
    //     keta--;
    // }
    // cout<<endl;
    return 0;
}

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


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

int kaijo(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

int main() {
    int n; cin >> n;
    int x[n],y[n]; rep(i,n) cin >> x[i] >> y[i];

    vector<int> order(n); 
    rep(i,n) order[i]=i;
    double dist=0;
    do{
        rep(i,n-1){
            dist+=sqrt(pow(x[order[i+1]]-x[order[i]],2)+pow(y[order[i+1]]-y[order[i]],2));
        }
    }while(next_permutation(all(order)));

    cout <<  fixed << setprecision(10) <<  dist/(double)kaijo(n) << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

def cnt(v):
    count_map = {}
    for i in v:
        count_map[i] = count_map.get(i, 0) + 1
    if len(count_map) == 1:
        count_map[-1] = 0
    return sorted(count_map.items(), key=lambda x: x[1], reverse=True)

maxv = list(map(cnt, [a[::2], a[1::2]]))

def check(v1, v2):
    return (n + 1) // 2 - v1 + n // 2 - v2

if maxv[0][0][0] == maxv[1][0][0]:
    result = min(
        check(maxv[0][1][1], maxv[1][0][1]),
        check(maxv[0][0][1], maxv[1][1][1]),
    )
else:
    result = check(maxv[0][0][1], maxv[1][0][1])
print(result)


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a == 5 && b == 5 && c == 7) {
    cout << "YES" << endl;
  }
  else if (a == 5 && b == 7 && c == 5) {
    cout << "YES" << endl;
  }
  else if (a ==7 && b == 5 && c == 5) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

# N = 頂点の数(= 数字の数)
# M = 辺の数(= aの行数)

N, M = map(int, input().split())
graph = [ [0 for _ in range(N)] for _ in range(N) ]
visited = [False] * N

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1

#print(graph)

# u は 0-index
def dfs(u):
    visited[u] = True
    if False in visited:
        pass
    else:
        return 1

    count = 0
    for i in range(N):
        if graph[u][i] == False: continue
        if visited[i]: continue

        visited[i] = True
        count += dfs(i)
        visited[i] = False

    return count

count = dfs(0)
print(count)

Measured memory_bytes: 3064
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[100];
int main(){
  int i;
  int res = 0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(i=(1);i<(N);i++){
    if(A[i]==A[i-1]){
      res++;
      A[i] = -1;
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191123-1

// --- original code ---
// int N, A[100];
// {
//   int res = 0;
//   rd(N,A(N));
//   rep(i,1,N) if(A[i]==A[i-1]) res++, A[i] = -1;
//   wt(res);
// }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count1 = 0;
		while (count1 < s.length() && s.charAt(count1)=='1')
			count1++;
		long k = sc.nextLong();
		if (k<=count1) System.out.println(1);
		else System.out.println(s.charAt(count1));
	}
}


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

int main() {
	int p, q, r;
	cin >> p >> q >> r;
	int a, b, c;
	a = p + q;
	b = p + r;
	c = q + r;
	int ans;
	ans = min(a, b);
	ans = min(ans, c);
	printf("%d ", ans);
	return 0;
}


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

#define int long long

const int N = 26;
int mark[N];
string s;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s;
	for (char c : s) {
		if (c >= 'A' && c <= 'Z')
			c += -'A' + 'a';
		mark[c - 'a']++;
	}
	
	for (int i = 0; i < N; i++)
		if (mark[i] && mark[i] != 2)
			return cout << "No", 0;
	cout << "Yes";
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, t;
    cin>>n>>t;
    vl ts(n);
    cin>>ts;

    ll ans = 0;
    rep(i, n - 1) {
        ans += min(ts[i + 1] - ts[i], t);
    }
    ans += t;
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
/*;

THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define r(i, s, l) for (int i = s; i < l; i++)
#define mod 1000000007
//#define int long long
#define INT_BITS 32
#define ld long double
#define pp pair<int,int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

signed main()
{


    ld x,y;
    cin>>x>>y;

    ld ans = x*y;
    ld decimal = fmod(ans,1);
    cout<<long(ans-decimal);
	return 0;
}


Measured memory_bytes: 3812
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    long x = readln.chomp.to!long;
    long sum(long n) { // 隨ｬ0鬆・°繧臥ｬｬn-1鬆・∪縺ｧ縺ｮ蜥・//
        return (n / 2) * 11L + 6 * (n % 2);
    }
    long lb = 0, ub = cast(long)(1e15 + 1);
    while (lb + 1 < ub) {
        long mid = (lb + ub) / 2;
        if (sum(mid) < x) {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    writeln(ub);
}


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

int main(){
    long long n, k;
    cin >> n >> k;

    map<long long, long long> T;

    for(long long i = 0; i < n; i++){
        long long a, b;
        cin >> a >> b;
        if(T.find(a) == T.end()) T[a] = b;
        else T[a] += b;
    }

    long long cnt = 0;
    map<long long, long long>::iterator it;
    for(it = T.begin(); it != T.end(); it++){
        if(cnt < k and k <= cnt + it->second){
            printf("%lld\n", it->first);
            return 0;
        }
        cnt += it->second;
    }
}

Measured memory_bytes: 7664
#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 S[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int K;
    cin >> K;
    cout << S[K-1] << endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    var max = 0
    var cur = 0
    s.forEach {
        if(it == 'I') {
            cur++
            max = Math.max(max, cur)
        } else {
            cur--
        }
    }
    max

})


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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++) cin >> a[i];
  int count = 0;
  int check = 1;
  int bef = a[0];
  for (int i=1; i<N; i++){
    if (a[i] == bef){
      check++;
    } else {
      count += check/2;
      check = 1;
    }
    bef = a[i];
  }
  count += check/2;
  cout << count << endl;
}


Measured memory_bytes: 256
import math
n,a,b=map(int,input().split())
m=10**9+7
ans=pow(2,n,m)

# X=for i in range
s=1
ss=1
for i in range(a):
    s*=(n-i)
    if(s>m):s=s%m
    ss*=(a-i)
    if(ss>m):ss=ss%m
X=s
Y=ss
Y=pow(Y,m-2,m)
ans-=X*Y%m
s= 1
ss=1
for i in range(b):
    s*=(n-i)
    if(s>m):s=s%m
    ss*=(b-i)
    if(ss>m):ss=ss%m
X=s
Y=ss
Y=pow(Y,m-2,m)
ans-=X*Y%m

print(ans%m-1)

Measured memory_bytes: 3188
from itertools import permutations

n = int(input())
li = [list(map(int,input().split())) for _ in range(n)]
chess = [["." for i in range(8)]for j in range(8)]

for i in range(8):
    chess[i][i] = "Q"

point = 0

# 行のchessの並べ方を探索
for patern in permutations(chess):
    for y,x in li:
        if patern[y][x] != "Q":
            break
    else:
        # 斜めにもQが一つしかないかを判定
        ld = [0]*15 # i+jの合計を記録（左下斜め方向）
        rd = [0]*15 # 7-i+jの合計を記録（右下斜め方向）
        for i in range(8):
            for j in range(8):
                if patern[i][j] == "Q":
                    ld[i+j] += 1
                    rd[i+(7-j)] += 1
        for k in range(15):
            # 斜め方向には１つしかQがあってはならない
            if rd[k] > 1 or ld[k] > 1:
                break
        else:
            for l in patern:
                print("".join(l))


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

int isSubstring(string s1, string s2)
{
    int M = s1.length();
    int N = s2.length();

    for (int i = 0; i <= N - M; i++) {
        int j;

        for (j = 0; j < M; j++)
            if (s2[i + j] != s1[j])
                break;

        if (j == M)
            return i;
    }

    return -1;
}
int main()
{

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

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t=1;
//  cin >> t;
  while (t--) {
        string s1,s2;
    int mn=INT_MAX,curr=0;
    cin>>s1>>s2;
    for(int i=0;i<=s1.length()-s2.length();i++){
        curr=0;
        for(int j=i;j<i+s2.length();j++){
            if(s2[j-i]!=s1[j])
                curr++;
        }
        mn=min(mn,curr);
    }
    cout<<mn<<endl;
    }
}






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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

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


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

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

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main(){
    int N;
    cin>>N;
    int p=0,q =INF;
    vector<int> v(N);
    rep(i,N) {
        cin>>v[i];
        chmax(p,v[i]);
        chmin(q,v[i]);
    }
    bool can = true;
    if(p-q>1) can = false;
    else if(p==q){
        rep(i,N){
            if(v[i]!=N-1) can = false;
        }
        if(!can) {
            if(N>=p*2) can = true;
        }
    }
    else{
        int n = 0;
        rep(i,N) if(v[i]==q) n++;
        if(n>q||N-n<(p-n)*2) can = false;
    }
    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
const int N=105;
char s[N];
int main() {
	scanf("%s",s);
	int l=strlen(s),ans=0;
	for(int i=0;i<l/2;i++) {
		if(s[i]!=s[l-i-1]) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

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

public class Main {
  private static String solve(String s) {
    int lose = 0;
    for (char c : s.toCharArray()) {
      if (c == 'x') {
        lose++;
      }
    }
    return (15 - lose >= 8 ? "YES" : "NO");
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    String s = reader.next();
    out.println(solve(s));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public int[] nextIntArray(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLongArray(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
}

class Algorithm {
  private static void swap(Object[] list, int a, int b) {
    Object tmp = list[a];
    list[a] = list[b];
    list[b] = tmp;
  }
  
  public static <T extends Comparable<? super T>> boolean nextPermutation(T[] ts) {
    int rightMostAscendingOrderIndex = ts.length - 2;
    while (rightMostAscendingOrderIndex >= 0 &&
        ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostAscendingOrderIndex + 1]) >= 0) {
      rightMostAscendingOrderIndex--;
    }
    if (rightMostAscendingOrderIndex < 0) {
      return false;
    }
    
    int rightMostGreatorIndex = ts.length - 1;
    while (ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostGreatorIndex]) >= 0) {
      rightMostGreatorIndex--;
    }
    
    swap(ts, rightMostAscendingOrderIndex, rightMostGreatorIndex);
    for (int i = 0; i < (ts.length - rightMostAscendingOrderIndex - 1) / 2; i++) {
      swap(ts, rightMostAscendingOrderIndex + 1 + i, ts.length - 1 - i);
    }
    return true;
  }
}



Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  int n;
  multiset<int> s;

  cin >> n;
  rep(i, n)
  {
    int x;
    cin >> x;
    auto tmp = s.lower_bound(x);
    if (tmp != s.begin())
    {
      s.erase(--tmp);
    }
    s.insert(x);
  }

  cout << s.size() << endl;
  return 0;
}


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

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

    if ((a * b) % 2 == 0)
    {
        cout << "Even" << endl;
    } else
    {
        cout << "Odd" << endl;
    }
    
    
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	if (a > b){
		a = b;
	}
	if (c > d){
		c = d;
	}
	printf("%d",a + c);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
using namespace std;
#pragma warning(disable : 4996)


long long gcd(long long a, long long b) {
	if (a < b)swap(a, b);
	while (b > 0) {
		long long c = b;
		b = a % b;
		a = c;
	}
	return a;
}


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long a, b;
	cin >> a >> b;
	cout << a * b / gcd(a, b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using ull = unsigned long long int;
using P = pair<ll, ll>;
using P3 = pair<double,P>;
using PP = pair<P ,P>;
constexpr ll MOD = ll(1e9+7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main(){
    ll N, K, S;
    cin >> N >> K >> S;
    vector<ll> ans(N);
    if(S < ll(1e9)){
        for(int i=0;i<K;i++){
            ans[i] = S;
        }
        for(int i=K;i<N;i++){
            ans[i] = S+1;
        }
    }else{
        for(int i=0;i<K;i++){
            ans[i] = S;
        }
        for(int i=K;i<N;i++){
            ans[i] = S-1;
        }
    }
    for(int i=0;i<N;i++){
        cout << ans[i] << " \n"[i==N-1];
    }
    return 0;
}

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

using namespace std;

using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ans += a[i] / 2;
    if (a[i] & 1) {
      a[i] = 1;
    }
    if (a[i] >= 2) {
      a[i] = 2;
    }
  }
  bool f = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == 1) {
      if (f) {
        ans++;
        f = 0;
      } else {
        f = 1;
      }
    } else if (a[i] == 0) {
      f = 0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024