akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

bool dpx[8001][16001];
bool dpy[8001][16001];
vector<int> dxs;
vector<int> dys;

#define X 16003
#define Y 16003

int main()
{
    string s;
    int x, y;
    int mode = 0;

    cin >> s >> x >> y;

    int d = 0;

    for (int i = 0; i < s.length();i++)
    {
        if (s[i] == 'T' || i == s.length() - 1)
        {
            if (s[i] == 'F')
            {
                d++;
            }

            if (mode == 0)
            {
                dxs.push_back(d);
                mode = 1;
            }
            else
            {
                dys.push_back(d);
                mode = 0;
            }
            d = 0;
        }
        else
        {
            d++;
        }
    }

    if(dxs.size() == 0)
    {
        dxs.push_back(0);
    }
    if (dys.size() == 0)
    {
        dys.push_back(0);
    }

    dpx[0][dxs[0] + 8000] = true;

    for (int i = 1; i < dxs.size();i++)
    {
        int d = dxs[i];
        for (int j = 0; j < X; j++)
        {
            bool f1 = false;
            bool f2 = false;
            if(j - d >= 0)
            {
                f1 = dpx[i - 1][j - d];
            }
            if(j + d < X)
            {
                f2 = dpx[i - 1][j + d];
            }
            dpx[i][j] = f1 || f2;
        }
    }

    dpy[0][dys[0] + 8000] = true;
    dpy[0][-dys[0] + 8000] = true;

    for (int i = 1; i < dys.size(); i++)
    {
        int d = dys[i];
        for (int j = 0; j < Y; j++)
        {
            bool f1 = false;
            bool f2 = false;
            if (j - d >= 0)
            {
                f1 = dpy[i - 1][j - d];
            }
            if (j + d < Y)
            {
                f2 = dpy[i - 1][j + d];
            }
            dpy[i][j] = f1 || f2;
        }
    }

    if (dpx[dxs.size() - 1][x + 8000] == true && dpy[dys.size() - 1][y + 8000] == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 127232
#include<stdio.h>
int F[44];
void fib(){
  int i,a,b,c;
  F[0]=1;
  F[1]=1;
  for(i=2;i<=44;i++){
   F[i]=F[i-2]+F[i-1];
  }

}
int main(){
  int o;
  fib();
  
  scanf("%d",&o);
  printf("%d\n",F[o]);
    return 0;
}



Measured memory_bytes: 2132
#include<iostream>
using namespace std;
int main()
{
    string nam;
    cin>>nam;
    if(nam=="SUN"){
    cout<<"7"<<endl;
    }else if(nam=="MON"){
    cout<<"6"<<endl;
    }else if(nam=="TUE"){
    cout<<"5"<<endl;
    }else if(nam=="WED"){
    cout<<"4"<<endl;
    }else if(nam=="THU"){
    cout<<"3"<<endl;
    }else if(nam=="FRI"){
    cout<<"2"<<endl;
    }else if(nam=="SAT"){
    cout<<"1"<<endl;
    }
    return 0;


}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<set>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
#define P pair<int,int>
#define F first
#define S second
 
using namespace std;

int main(){
  char s;
  cin >> s;
  if((s == 'a')||(s == 'i')||(s == 'u')||(s == 'e')||(s == 'o')) cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll MOD = 1000000007;
ll INF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
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;}     //最小公倍数

void yes(){ cout << "YES" << endl;}
void no(){ cout << "NO" << endl;}

//-----------------------------------------

ll power_mod(ll x, ll y, ll m){
  ll res = 1;
  if(y>0){
    res = power_mod(x,y/2,m);
    if(y%2==0) res = (res*res)%m;
    else res = (((res*res)%m)*x)%m;
  }
  return res;
}


long long nCk(int n, int k){
    long long res = 1 ;
    for(int i=0;i<k;i++){
        res *= (n-i) ;
        res %= MOD ;
    }
    long long tmp = 1 ;
    for(int i=0;i<k;i++){
        tmp *= (i+1) ;
        tmp %=MOD ;
    }
    tmp = power_mod(tmp,MOD-2,MOD) ;
    res *= tmp ;
    res %= MOD ;
    return res ;
}
//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);


   ll n, a, b;
   cin >> n >> a >> b;

   ll ans = power_mod(2,n,MOD) - 1;
   ans -= nCk(n,a);
   ans -= nCk(n,b);
   ans += MOD * MOD;
   cout << (ans % MOD) <<endl;




  return 0;
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll a, b, c; cin >> a >> b >> c;
    ll d = c - a - b;
    if (d > 0 && d* d > 4 * a * b){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int n;
long long lu[100];
int main()
{
	cin>>n;
	lu[0]=2;
	lu[1]=1;
	for(int i=2;i<=n;i++)  lu[i]=lu[i-1]+lu[i-2];
	cout<<lu[n];
	return 0;
}

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

using namespace std;


void solve() {
    int n; cin >> n;
    vector<vector<int>> g(n+1);
    for (int i = 1; i < n; i++) {
        int x, y;
        cin >> x >> y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }
    vector<int> d(n+1, -1);
    int md = 0;
    int mu = 1;
    function<void (int)> dfs = [&](int u){
        for (int v: g[u]) {
            if (!~d[v]) {
                d[v] = d[u] + 1;
                if (d[v] > md) {
                    md = d[v];
                    mu = v;
                }
                dfs(v);
            }
        }
    };
    d[1] = 0; dfs(1);
    fill(d.begin(), d.end(), -1);
    d[mu] = 0; dfs(mu);
    if (md%3 == 1) {
        cout << "Second";
    } else {
        cout << "First";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 24448
N, M = map(int, input().split(" "))
list_ = []
for i in range(N):
  a, b = map(int, input().split(" "))
  list_.append([a, b])
  
list_.sort()  
total = 0
while M > 0:
  if M >= list_[0][1]:
    M -= list_[0][1]
    total += list_[0][0] * list_[0][1]
    del list_[0]
  else:
    total += list_[0][0] * M
    M = 0
print(total)
  


Measured memory_bytes: 20048
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
const int MAX_N=100010;


int main(){
  ll x,y;
  cin>>x>>y;
  ll res=1LL;
  x*=2LL;
  while(1){
    if(x<=y){x*=2LL;res++;}
    else break;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
count = 0
n = int(input())
list1 = list(map(int, input().split()))
for i in range(n):
    m = i
    for j in range(i, n):
        if list1[j] < list1[m]:
            m = j
    if m != i:
        list1[i], list1[m] = list1[m], list1[i]
        count += 1
print(*list1)
print(count)


Measured memory_bytes: 5608
def split_train(train)
  result = []
  (train.size - 1).times do |n|
    result << [train[0..n], train[n+1..-1]]
  end
  result
end

def train_patten(trains)
  result = []
  trains.each do |train|
    result << train.join
    result << train[1] + train[0]
    result << train[0].reverse + train[1]
    result << train[1].reverse + train[0]
    result << train[1] + train[0].reverse
    result << train[0] + train[1].reverse
    result << train.map(&:reverse).join
    result << train[1].reverse + train[0].reverse
  end
  result
end

gets;$<.each do |line|
  t = split_train(line.chomp)
  patten = train_patten(t).uniq
  puts patten.size
end

Measured memory_bytes: 6276
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char> > a(H, vector<char>(W));
  vector<vector<char> > ans(H + 2, vector<char>(W + 2,'#'));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i < H + 1; i++) {
    for (int j = 1; j < W + 1; j++) {
      ans[i][j] = a[i - 1][j - 1];
    }
  }
  for (int i = 0; i < H + 2; i++) {
    for (int j = 0; j < W + 2; j++) {
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, A, B;
  cin >> N >> A >> B;
  vector<vector<int>> vec(N,vector<int>(3));
  for(int i=0; i<N; i++){
    for(int j=0; j<3; j++){
      cin >> vec.at(i).at(j);
    }
  }
  
  int dp[N][N*10+1][N*10+1]; //i番目までにaがx(g)、bがy(g)できる最小コスト
  
  int INF = 100000000;
  for(int i=0; i<N; i++){
    for(int j=0; j<N*10+1; j++){
      for(int k=0; k<N*10+1; k++){
        dp[i][j][k] = INF;
      }
    }
  }
  
  for(int i=0; i<N; i++){
    int a = vec.at(i).at(0);
    int b = vec.at(i).at(1);
    int c = vec.at(i).at(2);
    if(i == 0){
      dp[0][a][b] = c;
    }
    else{
      dp[i][a][b] = min(dp[i][a][b],c);
      for(int j=0; j<N*10+1; j++){
        for(int k=0; k<N*10+1; k++){
          if(dp[i-1][j][k] != INF){
            dp[i][j+a][k+b] = min(dp[i][j+a][k+b], dp[i-1][j][k] + c);
            dp[i][j][k] = min(dp[i][j][k], dp[i-1][j][k]);
          }
        }
      }
    }
  }
  
  int ans = INF;
  
  for(int j=0; j<N*10+1; j++){
    for(int k=0; k<N*10+1; k++){
      if(dp[N-1][j][k] != INF && (A*k == B*j)){
        ans = min(ans,dp[N-1][j][k]);
      }
    }
  }
  
  
  if(ans == INF){
    cout << -1 << endl;
  }
  else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 25344
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  bool OK=false;
  
  ll resx,resy,resz;
  
  lin(N);
  rep2(x,1,3500+1){
    rep2(y,1,3500+1){
      
      if((4*x*y-N*(x+y))!=0 && N*x*y%(4*x*y-N*(x+y))==0){
        ll z=N*x*y/(4*x*y-N*(x+y));
        if(z>=1 && z<=3500){
          resx=x;resy=y;resz=z;
        }
      }
    }
  }cout<<resx<<" "<<resy<<" "<<resz;
}

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

struct Point {
    double x, y;
};

void koch(int n, Point a, Point b) {
    if (n == 0) return;
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;
    
    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
    
    koch(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n -1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}

int main() {
    Point a, b;
    int n;
    
    scanf("%d", &n);
    
    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;
    
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);
    
    return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> value(3);
  for(int i=0; i<3; i++)
    cin >> value.at(i);
  int five=0,seven=0;
  for(int i=0; i<3; i++){
    if(value.at(i)==7)
      seven++;
    else if(value.at(i)==5)
      five++;
  }
  if(five==2 && seven==1)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;
}

    

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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), vis(n, 0);
    for(auto &x : a){
        cin >> x;
    }
    for(int i = 0; i + 1 < n; i++){
        if(a[i] > a[i + 1]){
            a[i] -= 1;
            vis[i] = 1;
        }
    }
    for(int i = n - 2; i >= 0; i--){
        if(a[i] > a[i + 1] && vis[i] == 0){
            a[i] -= 1;
            vis[i] = 1;
        }   
    }
    bool ok = true;
    for(int i = 0; i + 1 < n; i++){
        ok &= (a[i] <= a[i + 1]);
    }
    cout << ((ok) ? "Yes" : "No");
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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



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

using namespace std;
int a,b;

int main(){
  cin >> a;
  if(a==1) cout << "Hello World" << endl;
  else{
    cin >> a >> b;
    cout << a+b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)
skaibun = 1

for i in range(N):
    if S[i] != S[N - 1 - i]:
        skaibun = 0

for i in range(int((N - 1) / 2)):
    if S[i] != S[int((N - 1)/2 )- 1 - i]:
        skaibun = 0

for i in range(int((N - 1) / 2)):
    if S[int((N + 3) / 2) - 1 + i] != S[N - 1 - i]:
        skaibun = 0

if skaibun == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int charLimit;
        String str, tmp;

        charLimit = scan.nextInt();
        tmp = scan.nextLine();
        str = scan.nextLine();

        if(str.length() <= charLimit) {
            System.out.println(str);
        } else {
            System.out.println(str.substring(0, charLimit) + "...");
        }

        scan.close();
        return;
    }
}

Measured memory_bytes: 38504
#include<iostream>

using namespace std;

typedef long long ll;

ll data[103];
ll C[51][51];
ll dp[51][2501];
ll pow(ll a,ll b){
	ll re=1;
	for(int i=0;i<b;i++){
		re*=a;
	}
	return re;
}
int main(){
	C[0][0]=1;
	for(int i=1;i<51;i++){
		for(int j=0;j<51;j++){
			C[i][j]=C[i-1][j];
			if(j)C[i][j]+=C[i-1][j-1];
		}
	}
	int N,A;
	cin>>N>>A;
	dp[0][0]=1;
	for(int i=0;i<N;i++){
		int x;
		cin>>x;
		data[x]++;
		for(int j=2501-x;j>=0;j--){
			for(int k=50;k>=1;k--){
				dp[k][j+x]+=dp[k-1][j];
			}
		}
	}
	ll ans=0;
	for(int i=1;i<2501;i++){
		for(int j=1;j<51;j++){
			if(i==A*j){
				ans+=dp[j][i];
			}
		}
	}
	cout<<ans<<endl;
}


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

typedef long long ll;
typedef vector<ll> v1;
typedef vector<vector<ll>> graph;

const ll INF = 1ll << 50;

ll x;

int main(){
    cin >> x;
    ll r = x%100;
    ll y = 0;
    y += r/5;
    r %= 5;
    y += r/4;
    r %= 4;
    y += r/3;
    r %= 3;
    y += r/2;
    r %= 2;
    y += r/1;
    r %= 1;
    if((x-x%100)/100 >= y){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define itn int
#define fi first
#define se second
#define be begin()
#define en end()
#define reverse
const int mod=1000000007;
const int INFi=2147483647;
const long long INFl=9223372036854775807LL;
template<typename T> T abs(T a,T b){
  return max(a,b)-min(a,b);
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,ans=0;
  string s;
  map<string,int> d={};
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    d[s]++;
    if(d[s]==1) ans++;
  }
  cout<<ans<<"\n";
}

Measured memory_bytes: 19136
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
#define pb(a) push_back(a);
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 

signed main(){
  ll n;
    cin>>n;
  auto A=div(n);
  ll a=A.sz;
  ll ans=INF;
  FOR(i,0,a){
    chmin(ans,A[i]+n/A[i]);
  }
  cout<<ans-2<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	int n, k, t = 0, c = 0, b = 0, tt = 0, cc = 0, bb = 0;
	int p[100];

	memset(p, 0, sizeof(p));

	cin >> n >> k;

	for (int i = 0; i < k; i++) {
		int a, b;

		cin >> a >> b;
		p[a - 1] = b;
	}

	if (p[0] == 1)
		t = 1;
	else if (p[0] == 2)
		c = 1;
	else if (p[0] == 3)
		b = 1;
	else {
		t = 1;
		c = 1;
		b = 1;
	}

	for (int i = 1; i < n; i++) {
		int ty = t, cy = c, by = b, tp = tt, cp = cc, bp = bb;
		t = 0;
		c = 0;
		b = 0;
		tt = 0;
		cc = 0;
		bb = 0;

		if (p[i] == 1 || p[i] == 0) {
			t = (cy + by + cp + bp) % 10000;
			tt = ty;
		}

		if (p[i] == 2 || p[i] == 0) {
			c = (by + ty + bp + tp) % 10000;
			cc = cy;
		}

		if (p[i] == 3 || p[i] == 0) {
			b = (ty + cy + tp + cp) % 10000;
			bb = by;
		}
	}

	cout << (t + c + b + tt + cc + bb) % 10000 << endl;

	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
    long long n, ans = 0;
    cin >> n;
    for(long long i = 2; i*i <= n;i++){
        if(n%i == 0){
            int cnt = 0, nxt = 1;
            while(n%i == 0){
                n /= i;
                cnt++;
                if(cnt >= nxt){
                    ans++;
                    nxt++;
                    cnt = 0;
                }
            }

        }
    }
    if(n > 1) ans++;
    cout << ans << endl;
}


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

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

void solve(long long N, long long M){
    cout << (((N - M) > 0) ? "No" : "Yes") << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int MAX = 2000001;
const int VMAX = 10000;

int main(int argc, char const *argv[])
{
	unsigned short *A, *B;

	int C[VMAX+1];
	int n;
	cin>>n;
	A = new unsigned short[n+1];
	B = new unsigned short[n+1];
	for (int i = 0; i < VMAX; ++i)
		{
			C[i] = 0;
		}
	for (int i = 0; i < n; ++i)
	{
		scanf("%hu",&A[i+1]);
		C[A[i+1]]++;
	}
	for (int i = 1; i <= VMAX; ++i)
	{
		C[i] = C[i-1] + C[i];
	}
	for (int j = n; j >= 1; --j)
	{
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	for (int i = 1; i <= n; ++i)
	{	
		if(i-1) cout<<" ";
		cout<<B[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 11000
#include <cstdio>
#include <queue>

const int N = 200000;

struct Info
{
    int one, zero;
};

bool operator < (const Info& a, const Info& b)
{
    return 1LL * a.one * b.zero > 1LL * a.zero * b.one;
}

int n, p[N], par[N];
Info info[N];

int find(int u)
{
    if (par[u] != u) {
        par[u] = find(par[u]);
    }
    return par[u];
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("F.in", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 1; i < n; ++ i) {
        scanf("%d", p + i);
        p[i] --;
    }
    for (int i = 0, a; i < n; ++ i) {
        scanf("%d", &a);
        info[i] = a == 1 ? Info { 1, 0 } : Info { 0, 1 };
        par[i] = i;
    }
    std::priority_queue<std::pair<Info, int>> q;
    for (int i = 1; i < n; ++ i) {
        q.emplace(info[i], i);
    }
    long long result = 0;
    while (!q.empty()) {
        int u = q.top().second;
        q.pop();
        if (find(u) != u) {
            continue;
        }
        par[u] = p[u];
        int pu = find(u);
        result += 1LL * info[pu].one * info[u].zero;
        info[pu].one += info[u].one;
        info[pu].zero += info[u].zero;
        if (pu != 0) {
            q.emplace(info[pu], pu);
        }
    }
    printf("%lld\n", result);
}


Measured memory_bytes: 8052
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

int main()
{
    int n, a;

    cin >> n >> a;

    cout << (n % 500 <= a ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
    {
        char a[100010]={'\0'};
        cin>>a;
        int m=0,n=0;
        for(int i=0;i<strlen(a);i++)
        	{
        		if(a[i]=='1')
        			m++;
        		if(a[i]=='0')
        			n++;
			}
		cout<<2*min(m,n);
		return 0;
    }

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

using namespace std;

#define int long long

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

signed main()
{
    const int mod = 1e9 + 7;
    int x, y;

    cin >> x >> y;

    int a = (-x + 2 * y);
    int b = (-y + 2 * x);

    if ((x + y) % 3 != 0 || a < 0 || b < 0)
    {
        cout << 0 << endl;
        return 0;
    }

    a /= 3;
    b /= 3;

    int c = 1;
    for(int i = 1; i <= a; ++i)
    {
        c = c * (a + b - i + 1) % mod * modinv(i, mod) % mod;
    }

    cout << c << endl;

    return 0;
}

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

vector<ll> a(55),p(55);

ll f(ll n,ll x){
    if(n<=0) return (x<=0)?0:1;
    if(x<=a[n-1]+1) return f(n-1,x-1);
    if(x==2+a[n-1]) return p[n-1]+1;
    if(x<=2+2*a[n-1]) return p[n-1]+1+f(n-1,x-2-a[n-1]);
    if(x==3+2*a[n-1]) return 2*p[n-1]+1;

}

int main(){
    int n;
    ll x;
    cin>>n>>x;
    a[0]=1;
    p[0]=1;
    for(int i=0;i<n;i++){
        a[i+1]=2*a[i]+3;
        p[i+1]=2*p[i]+1;
    }
    cout<<f(n,x)<<endl;
}

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

using namespace std;


int solve(int N, vector<int> A){
    vector<int> ans(N, 0);
    for(auto a:A){
        ans[a-1]++;
    }
    for(auto a:ans){
        cout << a << "\n";
    }
    return 0;
}

// class input{
//     public:
//     input(int _A, int _B, int _C, int _X, int _ans){
//         A = _A;
//         B = _B;
//         C = _C;
//         X = _X;
//         ans = _ans;
//     }
//     int A;
//     int B;
//     int C;
//     int X;
//     int ans;
// };

// int solve(input key){
//     return solve(key.A, key.B, key.C, key.X);
// }

int main(){
    int N;
    vector<int> A;
    bool use_stdin = true;
    // use_stdin = false;
    if(use_stdin){    
        cin >> N;
        for (size_t i = 0; i < N-1; i++)
        {
            int buf;
            cin >> buf;
            A.push_back(buf);
        }
        
        solve(N, A);
    }else{
        // input keys[] = {
        //     {30,40,50,6000,213},
        //     {5,1,0,150,0},
        //     {2,2,2,100,2}
        // };
        // for(auto key:keys){
        //     assert(solve(key)==key.ans);
        // }
    }
    return 0;
}

Measured memory_bytes: 5632
N, K = map(int,input().split())
S = input()

#圧縮（正の数が直立，負の数が逆立ち）
people = []
tmp = 0
for s in S:
    if s == "0":#直立
        if tmp >= 0:
            tmp += 1
        else:
            people.append(tmp)
            tmp = 1
    else:#逆立ち
        if tmp <= 0:
            tmp -= 1
        else:
            people.append(tmp)
            tmp = -1
people.append(tmp)

#print(people)

rev = 0#反転回数
ans = 0
#初めの範囲で
for i,num in enumerate(people):
    if num < 0:#元から逆立ちの時
        ans += -num
    else:
        rev += 1
        ans += num
    if rev == K:#それ以上反転できないので，右隣の逆立ち(居れば)の分だけ足して終わる
        try:
            ans += -people[i+1]
            break
        except IndexError:#最後に足した逆立ち群がそもそも右端だったら
            break

#print("initial ans",ans)

#SlidingWindow 右端と左端
right = (i+1)+1
left = 0

tmp = ans
#SlidingWindow
while True:
    #左端の更新
    if people[left] < 0:
        tmp -= abs(people[left])
        try:
            tmp -= abs(people[left+1])
            left += 2
        except IndexError:#len(people)==1のときだけ
            break
    else:
        tmp -= abs(people[left])
        left += 1
    
    #右端の更新
    try:
        tmp += abs(people[right])
        right += 1
    except IndexError:
        break
    
    try:
        tmp += abs(people[right])
        right += 1
    except IndexError:
        break
    ans = max(tmp, ans)

ans = max(tmp, ans)
print(ans)

Measured memory_bytes: 10052
#include<iostream>
using namespace std;
int a,b;
int t[1000];
void init(){
  for(int i=0;i<1000;i++)t[i]=0;
}
bool check(){
  if(t[1]%2==0)return false;
  if(t[2]%2==0)return false;
  for(int i=3;i<1000;i++){
    if(t[i]%2==1)return false;
  }
  return true;
}
int main(){
  while(cin>>a>>b){
    init();
    t[a]++;t[b]++;
    while(cin>>a>>b){
      if(a==0&&b==0)break;
      t[a]++;t[b]++;
    }
    if(check())cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
n, x = map(int, input().split())
A = [int(i) for i in input().split()]

cnt = 0
if A[0] > x:
    cnt += A[0] - x
    A[0] = x

for i in range(n - 1):
    if A[i] + A[i + 1] > x:
        cnt += (A[i] + A[i + 1]) - x
        A[i + 1] -= (A[i] + A[i + 1]) - x

print(cnt)

Measured memory_bytes: 14132
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    mp[in]++;
  }
  int ans = 0;
  for (auto i : mp) {
    if (i.first > i.second){ 
      ans += i.second;
    }  else {
      ans += i.second - i.first;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4736
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const ll LINF = (ll)1 << 60;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int d,l,count=0,now=0;
  cin>>l>>d;
  while(l>=d+now){
    count++;
    now+=d;
  }
  count+=(l-now);
  cout<<count<<'\n';
  return(0);
}


Measured memory_bytes: 3212
while True:
  a, op, b = input().split()   
  a = int(a)                   
  b = int(b) 
  
  if op == "?":
    break

  if op == "+":
      print("%d"%(a+b))
  elif op == "-":
      print("%d"%(a-b))
  elif op == "*":
      print("%d"%(a*b))
  elif op == "/":
      print("%d"%(a/b))
  else:
      break


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#include <numeric>
#include <iostream>
#include <limits>
int gcd(int n1, int n2){
    if(n2>n1){
        n2 = n1+n2;
        n1 = n2 -n1;
        n2 =n2 - n1;
    }
    int r = n1%n2;
    while(r!=0){
        n1 = n2;
        n2 = r;
        r = n1%n2;
    }
    return n2;
}
int main() {
    int n;
    std::cin >> n;
    std::vector<int> a;
    std::vector<int> gcdsl(n, 0);
    std::vector<int> gcdsr(n, 0);
    std::vector<int> gcdans(n, 0);
    for (int i = 0; i < n; i++) {
        int t;
        std::cin >> t;
        a.push_back(t);
    }
    gcdsr[n - 1] = a[n - 1];
    gcdsl[0] = a[0];
    gcdsl[1] = gcd(a[0], a[1]);
    for (int i = 2; i < n - 1; i++) {
        gcdsl[i] = gcd(gcdsl[i - 1], a[i]);
    }


    gcdsr[n-2] = gcd(a[n-1], a[n-2]);
    for (int i = n - 3; i > 0; i--) {
        gcdsr[i] = gcd(a[i], gcdsr[i + 1]);
    }

    int ans = std::max(gcdsr[1], gcdsl[n - 2]);
    for (int i = 1; i < n - 1; i++) {
        int gg = gcd(gcdsl[i - 1], gcdsr[i + 1]);
        if (gg > ans) {
            ans = gg;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 2044
<?php
  fscanf(STDIN,"%s", $line);
  $s = str_split($line);
  $n = count($s);
  $ans = ($s[0] == 'A' && ctype_lower($s[$n-1]));
  $cnt = 0;
  for ($i=1; $i<$n-1; $i++) {
    if (ctype_lower($s[$i])) continue;
    elseif ($i>=2 && $s[$i] == 'C') $cnt++;
    else $ans = false;
  }
  if ($cnt != 1) $ans = false;

  echo ($ans? "AC" : "WA") . "\n";
?>

Measured memory_bytes: 4604
import java.util.Scanner;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(true){
            int n =sc.nextInt();
            int k =sc.nextInt();
            int s =sc.nextInt();
            
            if(n+k+s==0)break;
            int ans=0;
            for (int i = 0; i < 1<<n; i++) {
                if(Integer.bitCount(i)!=k)continue;
                int j = i;
                int cnt=1;
                int sum=0;
                while(j>0){
                    if(j%2==1){
                        sum+=cnt;
                    }
                    cnt++;
                    j>>=1;
                }
                if(s==sum)ans++;
            }
            System.out.println(ans);
        }
    }

}

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

int a[100],b[100],c[100];

int main(){
        a[1] = 1,a[3] = 1,a[5] = 1,a[7] = 1,a[8] = 1,a[10] = 1,a[12] = 1;
        b[4] = 1,b[6] = 1,b[9] = 1,b[11] = 1;
        c[2] = 1;
        int x,y;
        cin >> x >> y;
        if(a[x] == 1 && a[y] == 1) cout << "Yes";    
        else if(b[x] == 1 && b[y] == 1) cout << "Yes";
        else if(c[x] == 1 && c[y] == 1) cout << "Yes";
        else cout << "No";
}


Measured memory_bytes: 256
using System;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int n=s[0],k=s[1];
		s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		bool[] h=new bool[10];
		for(int j=0;j<k;j++){h[s[j]]=true;}
		int i;
		for(i=n;;i++){
			string t=i.ToString();
			for(int j=0;j<t.Length;j++){
				if(h[t[j]-'0']){goto f1;}
			}
			goto f2;
			f1:;
		}
		f2:
		Console.WriteLine("{0}",i);
	}
}

Measured memory_bytes: 13140
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <vector>

using namespace std;

bool check(const vector<int> &v, int hf)
{
    // 0 dp初期値
    // 要素数分(1 indexed)
    // 要素を -1 で初期化
    vector<int> dp(hf + 1, -1);

    dp[0] = 0;

    for (int i = 0; i < (signed)v.size(); i++)
    {
        for (int j = 0; j <= hf; j++)
        {
            // 最大で「1」 「0」→「1」 「1」→「1」
            if (0 <= dp[j]) dp[j] = 1;
            // 組合せで構築できない「-1」
            else if (j < v[i] || dp[j - v[i]] <= 0) dp[j] = -1;
            // 組合せで構築できる「0」
            else dp[j] = 0;
        }
    }

    return 0 <= dp[hf];
}

int main()
{
    const char *Yes = "Yes";
    const char *No = "No";

    char s[8001];
    if (scanf("%s", s) < 1) return 0;

    int x, y;
    if (scanf("%d%d", &x, &y) < 2) return 0;

    // 要素数 2 (x と y)
    array<vector<int>, 2> ar;

    int xy = 0, cnt = 0;

    for (int i = 0; i < (signed)strlen(s); i++)
    {
        if (s[i] == 'F')
        {
            cnt++;
        }
        else
        {
            ar[xy].push_back(cnt);
            cnt = 0;
            xy ^= 1;    // ビット排他的論理和 反転(0 ⇔ 1)
        }
    }

    // 最後が T でない場合の考慮
    ar[xy].push_back(cnt); 

    // x の先頭を参照
    // 最初だけ 右確定 目標地点を左にずらす
    x -= ar[0][0];

    // x の先頭を削除
    ar[0].erase(ar[0].begin());

    // 正負を意識する必要はない
    // 先に左にずらしている為
    x = abs(x);
    // y は 0 始点の為
    y = abs(y);

    // x 合計
    int xs = accumulate(ar[0].begin(), ar[0].end(), 0);
    // y 合計
    int ys = accumulate(ar[1].begin(), ar[1].end(), 0);

    // 不足
    if (xs < x || ys < y) return !printf("%s\n", No);

    // 全力 Just
    if (xs == x && ys == y) return !printf("%s\n", Yes);

    // 奇数 行って帰れず
    if ((xs - x) % 2 || (ys - y) % 2) return !printf("%s\n", No);

    // 行き過ぎ 確定
    // ソート 昇順
    sort(ar[0].begin(), ar[0].end());   // x
    sort(ar[1].begin(), ar[1].end());   // y

    if (check(ar[0], (xs - x) / 2) && check(ar[1], (ys - y) / 2))
    {
        // 行き過ぎた距離の半分を
        // 組合せで構築できる
        return !printf("%s\n", Yes);
    }
    else
    {
        // 行き過ぎた距離の半分を
        // 組合せで構築できない
        return !printf("%s\n", No);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
};
#define imie(x) " [" << #x ": " << (x) << "] "

double SQ(double a) { return a * a; }

struct P {
	int x, y, r;
	void read(bool hasR) {
		scanf("%d%d", &x, &y);
		if(hasR) scanf("%d", &r);
		else r = 0;
	}
	double dist(P b) {
		return max(0., sqrt(SQ(x - b.x) + SQ(y - b.y)) - r - b.r);
	}
};

const int nax = 1005;
P t[nax];
double d[nax];
const double INF = 1e18 + 5;
bool vis[nax];

int main() {
	t[0].read(false);
	t[nax-1].read(false);
	int n;
	scanf("%d", &n);
	t[n+1] = t[nax-1];
	for(int i = 1; i <= n; ++i) t[i].read(true);
	// from 0 to n+1
	for(int i = 1; i <= n + 1; ++i) d[i] = INF;
	for(int rep = 0; rep < n + 2; ++rep) {
		int best = -1;
		for(int i = 0; i <= n + 1; ++i) if(!vis[i])
			if(best == -1 || d[i] < d[best])
				best = i;
		assert(best != -1);
		vis[best] = true;
		for(int i = 0; i <= n + 1; ++i)
			d[i] = min(d[i], d[best] + t[i].dist(t[best]));
	}
	printf("%.10lf\n", d[n+1]);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end() 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<string> vs;
int dp[2][1500000];
int main(){
    string S;
    cin>>S;
    dp[0][0]=S[0]-'0';
    dp[1][0]=11-(S[0]-'0');
    for(int i=1;i<S.length();i++){
        dp[0][i]=min(dp[0][i-1],dp[1][i-1])+(S[i]-'0');
        dp[1][i]=min(dp[0][i-1]+11-(S[i]-'0'),dp[1][i-1]+9-(S[i]-'0'));
    }
    cout<<min(dp[0][S.size()-1],dp[1][S.size()-1])<<endl;
    return 0;

    return 0;
}


Measured memory_bytes: 11524
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	int N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

bool calc() {
  int N;
  cin >> N;

  vector<int> hs(N);
  F0R(i, N) {
    cin >> hs[i];
  }

  vector<bool> ps(N, false);
  F0R(i, N - 1) {
    if (hs[i] > hs[i + 1]) {
      if (hs[i] - 1 > hs[i + 1]) return false;

      int j = i;
      while (j >= 0 && hs[j] > hs[j + 1]) {
        if (ps[j]) return false;
        ps[j] = true;
        hs[j]--;
        j--;
      }
      
    }
  }

  return true;
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cout << (calc() ? "Yes" : "No");
}
#endif


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>val(n);
    for(int i=0;i<n;i++){
        cin>>val[i];
    }
    int m=0;
    for(int i=1;i<n;i++){
        if(val[i]<val[i-1]){
            val[i-1]--;
            m=max(m,val[i-1]);
        }
        if(m-val[i]>0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}



Measured memory_bytes: 640
def ExtGCD(a, b):
    if b == 0:
        return a, 1, 0
    else:
        d, x, y = ExtGCD(b, a % b)
        x -= (a // b) * y
        return d, y, x
def ModInv(a, mod):
    return ExtGCD(a, mod)[1] % mod
def ModComb(n, k, mod):
    if n < k or n < 0 or k < 0:
        return 0
    elif n == 0 or k == 0:
        return 1
    q, a = 1, 1
    for i in range(n-k+1, n+1):
        q = (q * i) % mod
    for i in range(2, k+1):
        a = (a * i) % mod
    return int(q * ModInv(a, mod) % mod)
def ModPow(a,n,mod):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) % mod
        if bi[i]=="1":
            res=(res*a) % mod
    return res
def main():
    n,a,b=map(int,input().split())
    mod=10**9+7
    print((ModPow(2,n,mod) - (ModComb(n,a,mod) + ModComb(n,b,mod))-1)%mod)
main()

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

const int MOD = (int)1e9+7;

int main(){
  int H,W;
  cin >> H >> W;
  vector<string> A(H);
  for(int i=0;i<H;i++)  cin >> A.at(i);

  vector<vector<bool>> flag(H,vector<bool>(W,false));
  int y=0,x=0;
  for(;;){
    flag.at(y).at(x)=true;
    if(x+1<W && A.at(y).at(x+1)=='#') x++;
    else if(y+1<H && A.at(y+1).at(x)=='#')  y++;
    else break;
  }

  bool ans=true;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(A.at(i).at(j)=='#' && !flag.at(i).at(j)) ans=false;
    }
  }
  if(ans) cout << "Possible" << endl;
  else  cout << "Impossible" << endl;

  return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  intll n;
  cin >> n;
  if(n%11 == 0) 
    cout << n/11 *2 << endl;
  else if(n%11 >=7)
   cout << n/11*2 +2 << endl;
  else
    cout << n/11*2+1 << endl;


}


Measured memory_bytes: 256
S = input()
lS, ans = len(S), [0] * len(S)

for i in range(lS):
    if S[i:i + 2] == 'RL':
        r = i
    if S[i] == 'L':
        ans[r + ((i - r) % 2)] += 1
    if S[(lS - i - 2):(lS - i)] == 'RL':
        l = (lS - i - 1)
    if S[(lS - i - 1)] == 'R':
        ans[l - (((lS - i - 1) - l) % 2)] += 1

print(' '.join(map(str, ans)))


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

int main(){
    int n; cin >> n;
    int ans;
    if(n == 0 || n == 1){
        ans = 1;
    }else{
        int n_1 = 1;
        int n_2 = 1;
        for(int i = 2; i <= n; i++){
            ans = n_1 + n_2;
            n_2 = n_1;
            n_1 = ans;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3128