akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

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

#define MAX_S 12
#define MAX_N 1000000

// トライ木っぽいもの
struct t_Node {
	bool end;
	int child[ 4 ];
};

int Index( char );
void Insert( const char* );
bool Find( const char* );

t_Node nodes[ MAX_N ];  // 0で初期化されるハズ
int next_id = 1;

int main() {
	char ch[ MAX_S + 1 ];
	int n;  scanf( "%d", &n );
	while( n-- ) {
		scanf( "%s", ch );
		if( ch[ 0 ] == 'i' ) {  // insert
			scanf( "%s", ch );
			Insert( ch );
		} else {  // find
			scanf( "%s", ch );
			if( Find( ch ) ) printf( "yes\n" );
			else printf( "no\n" );
		}
	}
	return 0;
}

int Index( char ch ) {
	switch( ch ) {
	case 'A' : return 0;
	case 'C' : return 1;
	case 'G' : return 2;
	case 'T' : return 3;
	};
	return -1;
}

void Insert( const char* word ) {
	int s = 0;
	for( int i = 0; word[ i ] != '\0'; ++i ) {
		int index = Index( word[ i ] );
		int next_s = nodes[ s ].child[ index ];
		if( !next_s ) {
			nodes[ s ].child[ index ] = next_id;
			s = next_id++;
		} else s = next_s;
	}
	nodes[ s ].end = true;
	return ;
}

bool Find( const char* word ) {
	int s = 0;
	for( int i = 0; word[ i ] != '\0'; ++i ) {
		int index = Index( word[ i ] );
		int next_s = nodes[ s ].child[ index ];
		if( !next_s ) return false;
		else s = next_s;
	}
	return nodes[ s ].end;
}

Measured memory_bytes: 9196
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto xkd = readln.split.to!(long[]);
    auto X = xkd[0];
    auto K = xkd[1];
    auto D = xkd[2];
    X = abs(X);
    if (X/D >= K) {
        writeln(X - K*D);
        return;
    }
    auto k = K - X/D;
    if (k%2 == 0) {
        writeln(X - D*(X/D));
    } else {
        writeln(abs(X - D*(X/D+1)));
    }
}

Measured memory_bytes: 2764
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
# print(a)
# print(b)
# print(c)
n = int(input())
d = [int(input()) for i in range(n)]
# print(d)

if (a[0]in d) and (a[1]in d) and(a[2]in d):
    print("Yes")
    exit()
if (b[0]in d)and(b[1]in d)and(b[2]in d):
    print("Yes")
    exit()
if (c[0]in d)and(c[1]in d)and(c[2]in d):
    print("Yes")
    exit()
if (a[2]in d)and(b[1]in d)and(c[0]in d):
    print("Yes")
    exit()
if (a[0]in d)and(b[1]in d)and(c[2]in d):
    print("Yes")
    exit()
if (a[0]in d)and(b[0]in d)and(c[0]in d):
    print("Yes")
    exit()
if (a[2]in d)and(b[2]in d)and(c[2]in d):
    print("Yes")
    exit()
else:
    print("No")


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<int> A(3, 0);
    for(int i=0;i<3;i++){
        cin>>A[i];
    }
    sort(A.begin(),A.end());
    int K; cin>>K;
    for(int i=0;i<K;i++) {
        A[2]=A[2]*2;
    }
    cout<<A[0]+A[1]+A[2];
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 300007
#define ar array
#define mod 1000000007
#define ld long double
#define pb push_back
#define ar array
#define fi first
#define se second
typedef long long int ll;
using namespace std;
int main(void){
	fast;
	int a,b,c,k,c1=0,c2=0;
	cin>>a>>b>>c>>k;
	while(b<=a){
		b*=2;
		c1++;
	}
	while(c<=b){
		c*=2;
		c2++;
	}
	if(c1+c2>k)
	cout<<"No";
	else
	cout<<"Yes";
}


Measured memory_bytes: 3612
print+(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)[<>-1]


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0

for i in range(n):
    left = min(a[i], b[i])
    ans += left
    a[i] -= left
    b[i] -= left

    right = min(a[i+1], b[i])
    ans += right
    a[i+1] -= right
    b[i] -= right

print(ans)


Measured memory_bytes: 19116
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
  int a,b;
  cin >> a >> b;
  
  if(a <= 0 && b >= 0)
    cout << "Zero" << endl;
  else if(a < 0 && b < 0){
    if(abs(b - a) % 2 == 0)
      cout << "Negative" << endl;
    else
      cout << "Positive" << endl;
  }
  else
    cout << "Positive" << endl;
  
  return 0;
}

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

int main(){
  double l,a,b,c,ans,d;
  int m;
  a=0.333333333333;
  b=0.111111111111;
  c=0.037037037037;
  cin >> l;
  "l=double(m/3);";
  l=l/3;
  m=m%3;
  d=double(m);
  ans=l*l*l;
  printf("%.8f", ans);
}

Measured memory_bytes: 256
#include<stdio.h>

int digits(int long long n)
{
  int count=0;
  while(n>0)
  {
    n=n/10;
    count++;
  }
  return count;
}   

int main()
{
  long long n;
  long long a,b;
  int ans;
  int f;
  
  scanf("%lld",&n);
  
  ans=digits(n);
  
  for(a=2;a*a<=n;a++)
  {
    if(n%a==0)
    {
      b=n/a;
    
     if(digits(a)>=digits(b))
     {
      f=digits(a);
     }
     else
     {
      f=digits(b);
     } 
    
     if(f<ans)
     {
      ans=f;
     }
    }
  }
  
  printf("%d\n",ans);
  
  return 0;
}
  

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
int a[100],b[100],n,f[100],c[100];
int lowbit(int x){
	return x&(-x);
}
void add(int pos){
	while(pos<=n){
		c[pos]+=1;
		pos+=lowbit(pos);
	}
}
int pre(int x){
	int sum=0;
	while(x){
		sum+=c[x];
		x-=lowbit(x);
	}
	return sum;
}
void init(){
	f[0]=1;
	for(int i=1;i<=30;++i){
		f[i]=f[i-1]*i;
	}
}
int cantor_exp(int *p){
	int sum=0;
	for(int i=n;i>=1;--i){
		int a=pre(p[i]-1);
		sum+=a*f[n-i];
		add(p[i]);
	}
	return sum;
}
int main()
{
	ios;
	cin>>n;
	init();
	for(int i=1;i<=n;++i) cin>>a[i];
	for(int i=1;i<=n;++i) cin>>b[i];
	int s1,s2;
	s1=cantor_exp(a);
	memset(c,0,sizeof c);
	s2=cantor_exp(b);
	cout<<abs(s1-s2)<<'\n';
}

Measured memory_bytes: 3660
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

ans=0
tmp = -10
for i in a:
	ans+=b[i-1]
	if tmp+1 == i-1:
		ans+=c[i-2]
	tmp = i-1

print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	int i,j,n,x,l;
	char a[100001],b[100001],c[100001],m;
	while(true){
	cin>>n;
	if(n==0){
	break;
	}
	for(i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	cin>>x;
	for(j=0;j<x;j++){
		cin>>c[j];
	}
	for(l=0;l<x;l++){
		for(int k=0;k<n;++k){
			if(c[l]==a[k]){
				c[l]=b[k];
				break;
			}
		}
	}
	for(int k=0;k<x;++k){
		cout<<c[k];
	}
	cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3204
#include <string.h>
#include <stdio.h>
 
int main(){
  static int data[1<<20];
  int i,in=0,t;
  char blood[5];
  int a=0, b=0, o=0, ab=0;
 
  memset(data,-1,sizeof(data));
  while(scanf("%d,%s",&t, blood)!=EOF){
    if(blood[0]=='A'&&blood[1]=='B') data[t] = 3;
    else if(blood[0]=='A') data[t] = 0;
    else if(blood[0]=='B') data[t] = 1;
    else if(blood[0]=='O') data[t] = 2;
    if(in < t) in= t;
    blood[0]=0; blood[1]=0;
  }
  for(i=0; i<=in; i++){
    if(data[i]==0) a++;
    if(data[i]==1) b++;
    if(data[i]==2) o++;
    if(data[i]==3) ab++;
  }
 
  printf("%d\n%d\n%d\n%d\n",a,b,ab,o);
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int N; ll K;
    cin >> N >> K;

    vector<int> A(N);
    rep(i, N) cin >> A[i], A[i]--;

    vector<bool> used(N);
    vector<int> v;
    v.emplace_back(0);

    int cur = 0, start = -1;
    used[cur] = true;
    while (1) {
        int to = A[cur];
        if (used[to]) {
            start = to;
            break;
        }
        cur = to;
        used[cur] = true;
        v.emplace_back(cur);
    }

    bool flg = false;
    vector<int> v2;
    rep(i, v.size()) {
        if (v[i] == start) flg = true;
        if (flg) v2.emplace_back(v[i]);
    }

    if (K < v.size()) {
        cout << v[K]+1 << endl;
        return 0;
    }

    int cnt = 0;
    rep(i, v.size()) {
        if (v[i] == start) {
            cnt = i;
            break;
        }
    }

    K -= cnt;
    int M = v2.size();
    cout << v2[K % M]+1 << endl;
}

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

int H,W;
int c[55][55];
vector<vector<int > > s(55,vector<int>(55));
bool seen[55][55];
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
void dfs(int y,int x,int a){
  if(x<0||W<=x||y<0||H<=y||c[y][x]==0){return;}
  if(seen[y][x]){return;}
  seen[y][x]=true;s[y][x]=a;
  for(int i=0;i<8;i++){
    dfs(y+dy[i],x+dx[i],a);
  }
}

int main() {
 while(cin>>W>>H){
  if(W==0&&H==0){return 0;}
 // vector<vector<int > > s(55,vector<int>(55));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      s[i][j]=0;
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>c[i][j];
    }
  }
  for(int i=0;i<55;i++){
    for(int j=0;j<55;j++){
      seen[i][j]=false;
    }
  }
  int a=1;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(c[i][j]){dfs(i,j,a);a++;}
    }
  }
  set<int>k;k.insert(0);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]){k.insert(s[i][j]);}
    }
  }
  cout<<k.size()-1<<endl;
 }
  return 0;
}


Measured memory_bytes: 3276
# include "stdio.h"

int main(){
    long long int a,b,x,c1=0;
    scanf("%lld %lld %lld",&a,&b,&x);
    if(a%x)printf("%lld\n",b/x-a/x);
    else   printf("%lld\n",b/x-a/x+1);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
typedef long double ld;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
 
#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 105
ld l;

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

    cin >> l;
    cout << fixed << setprecision(8) << (l/3)*(l/3)*(l/3);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int p[100005];
main() {
    int i,x,ans;
    scanf("%d",&n);
    for(i=1;i<=n;i++) scanf("%d",&x), p[x]++, p[x+1]++, p[x+2]++;
    ans = 0;
    for(i=0;i<=100002;i++) ans = max(ans,p[i]);
    printf("%d",ans);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define DBG(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const ll p = 1e9+7;
const ll INF = 1LL << 60;

int main(){
  int c[10]={};
  for(int i=0;i<4;i++){
    int a;
    cin>>a;
    c[a]++;
  }
  if(c[1]&&c[9]&&c[7]&&c[4])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int arr[n];
    double sum = 0;
    for(int i = 0 ; i<n ; i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    int ipos = round(sum/n);
    int points = 0;
    for(int i = 0 ; i<n ; i++){
        points+= (arr[i] - ipos) * (arr[i]-ipos);
    }
    cout<<points;
}

Measured memory_bytes: 384
// 1_1_D
#include <stdio.h>
#include <limits.h>

long max(long, long);
long min(long, long);

int main(){
    long n, price, minv = LONG_MAX, maxv = LONG_MIN;
    int i;
    scanf("%ld", &n);

    for(i = 0; i < n; i++){
        scanf("%ld", &price);
        maxv = max(maxv, price - minv);
        minv = min(minv, price);
    }

    printf("%ld\n", maxv);
    return 0;
}

long max(long a, long b){
    return a > b ? a : b;
}

long min(long a, long b){
    return a < b ? a : b;
}

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

int main() {

	int n, m; cin >> n >> m;
	vector<int> num(m, 0);
	for (int i = 0; i < n; i++) {
		int k; cin >> k;
		for (int j = 0; j < k; j++) {
			int a; cin >> a;
			num[a - 1]++;
		}
	}

	int ans = 0;
	for (int i = 0; i < m; i++) {
		if (num[i] == n) ans++;
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
	int N,M,X,Y;
	cin>>N>>M>>X>>Y;
	vector<int> x(N),y(M);
	int i;
	for (i=0;i<N;i++){
		cin>>x[i];
	}
	for (i=0;i<M;i++){
		cin>>y[i];
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	int Z;
	bool bFind=false;
	for (Z=X+1;Z<=Y;Z++){
		if (Z>x[N-1] && Z<=y[0]){
			cout<<"No War"<<endl;
			return 0;
		}
	}
	cout<<"War"<<endl; 
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

template<typename T>T gcd(T a, T b) {
    T c;
    if (a < b) {
        a += b;
        b = a - b;
        a -= b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main() {
    int N, X;
    cin >> N >> X;

    int ans;
    cin >> ans;
    ans = abs(ans - X);
    for (int i = 0; i < N - 1; i++) {
        int x;
        cin >> x;
        ans = gcd<int>(ans, abs(x - X));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    n = int(input())
    S = li_input()
    q = int(input())
    T = li_input()

    ans = 0

    for t in T:
        if t in S:
            ans += 1

    print(ans)


main()



Measured memory_bytes: 6340
def lower_bound(a, x):
  l = -1
  r = len(a)
  while r - l > 1:
    h = (l + r) // 2
    if a[h] < x:
      r = h
    else:
      l = h
  return l
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
res = 0
for i in range(n):
  for j in range(i+1, n):
    lb = lower_bound(l[j+1:], l[i]-l[j]+1)
    res += lb + 1
print(res)

Measured memory_bytes: 51080
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (lli i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define print(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define pii pair<int,int> 
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int mod = 998244353, x = 864197532, N = 100000;

int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector <int> input(n);
	map <int, int> m1;
	lli ans = 0;
	fop (i,0,n) {
		cin >> input[i];
		ans += m1[i - input[i]];
		m1[input[i] + i]++;
	}
	cout << ans << endl;
	/*
	i < j:
		j - i = a_j + a_i;
		j - a_j = i + a_i;
		*/
}

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

int main(){
  string s;
  string Heisei="2019/04/30";
  bool ht=true;
  cin>>s;
  for(int i=0;i<=6;i++){
    if(s[i]>Heisei[i]){
      ht=false;
    }
  }
  if(ht){
    cout<<"Heisei"<<endl;
  }else{
    cout<<"TBD"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {
    // 初期の借金
    private static final BigDecimal DEBT_FIRST = new BigDecimal("100000");

    // 1週間当たりの利率
    private static final BigDecimal INTEREST_PERCENTAGE_PER_WEEK = new BigDecimal(
            "1.05");

    public static void main(String[] args) {
        try {
            // input
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    System.in));

            int weeksAfter = Integer.valueOf(br.readLine());
            BigDecimal debtAfter = DEBT_FIRST;
            for (int i = 1; i <= weeksAfter; i++) {
                // 利息をかけて1000円単位で切り上げる
                debtAfter = debtAfter.multiply(INTEREST_PERCENTAGE_PER_WEEK)
                        .setScale(-3, RoundingMode.UP);
            }

            System.out.println(debtAfter.toPlainString());
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(0);
        }

    }

}

Measured memory_bytes: 16940
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	cin >> s;
	
	bool ans = true;
	
	int n = s.size();
	
	for(int i = 0; i < (n-1)/2; i++){
		if(s.at(i) != s.at(n-i-1)) ans = false;
	}
	
	if(ans) for(int i = 0; i < (n-1)/2 /2; i++){
		if(s.at(i) != s.at((n-1)/2-i-1)){
			ans = false;
		}
	}
	
	if(ans) for(int i = (n+3)/2-1; i < n; i++){
		if(s.at(i) != s.at(n-i-1)) ans = false;
	}

	if(ans) cout << "Yes";
	else cout << "No";
	cout << endl;
	
	return 0;
	
	
}

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

int main() {
  int n;
  cin >> n;
  int a = n / 10;
  int b = n % 10;
  if (a == 9 || b == 9) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#import<atcoder/all>
int n,m;main(){auto&c=std::cin>>n>>m;std::vector<int>a(n),b(m);for(int&a:a)c>>a;for(int&b:b)c>>b;for(int i:atcoder::convolution(a,b))std::cout<<i<<' ';}

Measured memory_bytes: 19056
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vvi a(n,vi(n));
    rep(i,n)rep(j,n)cin>>a[i][j];
    vi dp(1<<n);
    dp[0]=1;
    Rep(i,1,1<<n){
        int c=__builtin_popcount(i);
        rep(j,n){
            if((i>>j)&1&&a[c-1][j]){
                dp[i]+=dp[i^(1<<j)];
                dp[i]%=mod;
            }
        }
    }
    cout<<dp[(1<<n)-1]<<endl;
}

Measured memory_bytes: 16640
#include <stdio.h>

int main(){
    char a[5];
    char b[5];
    scanf( "%s", &a);
    scanf( "%s", &b);

    bool ok = a[0] == b[2] && a[1] == b[1] && a[2] == b[0];

    if(ok)
        printf( "YES\n");
    else
        printf( "NO\n");


    return 0;

}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<queue>
#include<math.h>
#include<ctime>
#include<deque>
#include<set>
#include<string.h>
#include<algorithm>
#include<map>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ls rt<<1
#define rs rt<<1|1
#define mmm(a,b) memset(a,b,sizeof(a))
#define sc(x) scanf("%d",&x)
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e17;
const double pi = acos(-1.0);
const int maxn = 1e5+5;
int kase;
ll n,m,p,k,cnt;
ll a[maxn],d[maxn];
vector<int>g[maxn];
ll dfs(int u,int fa){
    int res=1;
    ll tmp;
    ll ans=0;
    for(int v:g[u]){
        if(v!=fa){
            tmp=dfs(v,u);
            res+=tmp;
            ans=max(ans,tmp);
        }
    }
    a[u]=max(ans,n-res);
    return res;
}
int bfs(int u,int fa){
    for(int v:g[u])
        if(v!=fa)
            return bfs(v,u);
    return u;
}
void run(){
    cin>>n;
    cout<<(n^1)<<'\n';
}
int main(){
#ifdef haosao
freopen("main.h", "r", stdin);
//freopen("out.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
//    cin>>kase;
//    while(kase--)
        run();
    return 0;
}


Measured memory_bytes: 5516
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    ll a, b;
    cin >> a >> b;
    ll gcd = __gcd(a, b);
    ll ans = a / gcd * b;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
int a[10000000];
signed main()
{
	int k,n;
	cin>>k>>n>>a[0];
	int best=10021021;
	for (int i=1;i<n;i++){
		cin>>a[i];
		best=min(best , k-(a[i]-a[i-1]));
	}
	best=min(best , a[n-1]-a[0]);
	cout<<best; 
	re 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void)
{
	int i,money;
	char S[4];

	scanf("%s", S);

	money = 700;

	for (i = 0; i < 3; i++)
	{
		if (S[i] == 'o')
			money += 100;
	}

	printf("%d\n", money);

	return 0;
}

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

using namespace std;

int main()
{
    double n,k;
    double s,m=0,b;
    cin>>n>>k;
    for(int j=1; j<=n; j++)
    {
        s=1;
        b=j;
        for(int i=1;; i++)
        {

            if(b>=k)
                break;
            b=b*2;
            s=s*(0.5);
        }
        m=m+s/n;
    }
    printf("%.10lf",m);
    return 0;
}

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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           P;
typedef vector<P>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;
typedef vector<ll>              vl;





int main (){
    int n;
    ll c,k;
    cin >> n >> c >> k;
    vl t(n+1);
    REPS(i,n){
        cin >> t.at(i);
    }
    
    sort(t.begin(),t.end());//0は0にくる

    bool first = true;
    ll start;
    ll ans = 0;
    ll count = 0;//count 人数 ans はバス数
    REPS(i,n){
        if(first){//最初乗るところでcount start first初期化 バスans増やす 人のせる。
            start = t.at(i);
            first = false;
            ans++;
            count = 1;
        }

        if(count == c){//出発
            first = true;
            continue;
        }
        else if(i+1 <= n &&  start + k < t.at(i+1)){
            first = true;
            continue;
        }else if(!first) count++;

    }


    cout << ans << endl;






    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = -1;
#ifndef LOCAL
#define cerr if(0)cout
#endif

int32_t main() 
{
	IAMSPEED
	int n; cin >> n;
	vector<int> v;
	FOR(i,1,n) {
		int x; cin >> x;
		v.pb(x);
	}
	sort(all(v));
	int ans = 0;
	for(int i=0;i<n;++i){
		for(int j=i+1;j<n;++j){
			//find the number of valid largest numbers
			auto it1=lower_bound(all(v),v[i]+v[j]);
			auto it2=v.begin()+j+1;
			ans+=it1-it2;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef unsigned long long LL;
int main(){
	int n;
	scanf("%d",&n);
	int l[300005],r[300005];
	MEM(l);MEM(r);
	char c[300005];
	scanf("%s",c+1);
	for(int i=1;c[i]!=0;i++){
		l[i]=l[i-1];
		if(c[i]=='W')
		l[i]++;
	}
	for(int i=n;i>=1;i--){
		r[i]=r[i+1];
		if(c[i]=='E')
		r[i]++;
	}
	int ans=1e9;
	for(int i=1;i<=n;i++){
		ans=min(ans,l[i-1]+r[i+1]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 2944
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(r,e){function t(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,a=r[Symbol.iterator]();!(n=(i=a.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var e=r.split("\n"),n=t(e[0].split(" ").map(function(r){return Number(r)}),2),o=n[0],u=n[1],i=[],a=0;a<o;a++){var f=e[a+1].split(" ").map(function(r){return Number(r)});i.push(f)}for(var l=[],c=0;c<=o;c++){var p=new Array(u+1).fill(0);l.push(p)}for(var s=0;s<o;s++)for(var d=0;d<=u;d++){var v=l[s][d],y=0,b=i[s];d>=b[0]&&(y=l[s][d-b[0]]+b[1]);var m=Math.max(v,y);l[s+1][d]=m}var x=l[o][u];console.log(x)}},function(r,e){r.exports=require("fs")}]);

Measured memory_bytes: 187008
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


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;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;

int dp[55][55][2510];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, A; cin >> n >> A;
	VE x(n); rep(i, n)cin >> x[i];
	int X = A;
	rep(i, n)chmax(X, x[i]);
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			for (int k = 0; k <= n * X; k++) {
				if (i == 0 && j == 0 && k == 0)dp[i][j][k] = 1;
				else if (i >= 1 && k < x[i - 1]) {
					dp[i][j][k] = dp[i - 1][j][k];
				}
				else if (i >= 1 && j >= 1 && k >= x[i - 1]) {
					dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]];
				}
				else dp[i][j][k] = 0;
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += dp[n][i][i*A];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 55424
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i*i<=x;i++){
        if(x%i==0)return false;
    }
    return true;
}

int main(){
    int n;
    cin>>n;
    int count=0;
        rep(i,3,55555+1){
           if(isPrime(i) && i%5==1){
               if(count)cout<<" ";
               cout<<i;
               count++;
               if(count==n)return 0;
           }
        }
    
    cout<<endl;
    return 0;
}


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


int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x3, y3, x4, y4;
	x3 = x2 - (y2 - y1);
	y3 = y2 + (x2 - x1);
	x4 = x1 - (y2 - y1);
	y4 = y1 + (x2 - x1);
 
	printf("%d %d %d %d\n", x3, y3, x4, y4);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 2e5 + 10;

int main(){
//  freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int n, x, t;
  cin >> n >> x >> t;
  cout << ((n - 1) / x + 1) * t;
return 0;
}


Measured memory_bytes: 3636
(A, B, M) = [int(k) for k in input().split(' ')]
a = [int(k) for k in input().split(' ')]
b = [int(k) for k in input().split(' ')]
coupons = []
for i in range(M):
  coupons.append([int(k) for k in input().split(' ')])

price = min(a) + min(b)
for c in coupons:
  pr = a[c[0]- 1] + b[c[1]- 1] - c[2]
  if pr < price:
    price = pr

print(price)

Measured memory_bytes: 32224
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
    long X, Y;
    cin >> X >> Y;
    
    // a[0]が正の場合
    long a = X;
    long count = 1;
    while (a*2<=Y){
   	    a = a*2;
   	    ++count;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
N = int(input())
A_array = [int(i) for i in input().split()]
B_array = [int(i) for i in input().split()]
C_array = [int(i) for i in input().split()]

counter = 0
for i, e in enumerate(B_array):
    counter += e

for i in range(N-1):
    menu_i = A_array[i]
    menu_iplus1 = A_array[i+1]
    if menu_iplus1 == menu_i + 1:
        counter += C_array[menu_i-1]

print(counter)

Measured memory_bytes: 38496
#include <iostream>
#include <set>


int main() {
    int x, n, p, ans, dist = (int) 101;
    std::set< int > st;

    std::cin >> x >> n;
    for (int i=0; i<n; ++i) {
        std::cin >> p;
        st.insert(p);
    }

    ans = x;
    for (int i=0; i<102; ++i) {
        if (st.find(i) != st.end()) continue;
        if (std::abs(i - x) < dist) {
            ans = i;
            dist = std::abs(i-x);
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3636
package main

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

const inf = 1 << 60

func solve() {
	n, maxW := getInt(), getInt()
	ws, vs := make([]int, n), make([]int, n)
	for i := range ws {
		ws[i] = getInt()
		vs[i] = getInt()
	}

	dp := make([][]int, n+1)
	for i := range dp {
		dp[i] = make([]int, n*1000+1)
		for j := range dp[i] {
			dp[i][j] = inf
		}
	}
	dp[0][0] = 0

	for i := 1; i <= n; i++ {
		for v := range dp[i] {
			if v-vs[i-1] >= 0 {
				dp[i][v] = min(dp[i][v], dp[i-1][v-vs[i-1]]+ws[i-1])
			}
			dp[i][v] = min(dp[i][v], dp[i-1][v])
		}
	}

	ans := -1
	for i := range dp[n] {
		if dp[n][i] <= maxW {
			ans = i
		}
	}
	fmt.Fprintln(wr, ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

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

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


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

struct st {
	int id, s, g;
};
int main() {
	int w, q;
	while (cin >> w >> q, w || q) {
		deque<st>que;
		rep(i, q) {
			char c; cin >> c;
			if (c == 'w') {
				int d; cin >> d;
				for (auto itr = que.begin(); itr != que.end(); itr++) {
					if ((*itr).id == d) {
						que.erase(itr); break;
					}
				}
				continue;
			}
			int d, k; cin >> d >> k;
			int t;
			if (que.empty()) {
				if (k <= w) {
					cout << "0" << endl;
					que.push_back({ d, 0, k });
				}
				else cout << "impossible" << endl;
				continue;
			}
			else if (k <= (*que.begin()).s) {
				cout << "0" << endl;
				que.push_front({ d,0,k });
				continue;
			}
			else {
				rep(j, (int)que.size() - 1) {
					if (que[j].g + k <= que[j + 1].s) {
						cout << que[j].g << endl;
						que.insert(que.begin() + j + 1, { d,que[j].g,que[j].g + k });
						goto g;
					}
				}
			}
			if ((t = (*que.rbegin()).g) + k <= w) {
				cout << t << endl;
				que.push_back({ d,t,t + k, });
				continue;
			}
			cout << "impossible" << endl;
		g:;
		}
		cout << "END" << endl;
	}
}

Measured memory_bytes: 3044
import java.io.*;
import java.util.StringTokenizer;

public class Main {
  private static PrintWriter out;

  public static void main(String[] args) {
    Main main = new Main();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> out.close()));
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    out = new PrintWriter(new BufferedOutputStream(System.out));

    double T = sc.nextDouble();
    double X = sc.nextDouble();

    double ans = T / X;
    out.println(ans);

    out.close();
  }

  /*          
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


Measured memory_bytes: 29012
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
using ll = long long;

int main() {
	string s1, s2;
	cin >> s1 >> s2;
	
	ll len = s1.length();
	ll ans = 0;
	
	for(ll i = 0; i < len; i++){
		if(s1.at(i) != s2.at(i)){
			++ans;
		}
	}
	
	cout << ans << endl;
	
}


Measured memory_bytes: 3848
// think twice code once
// Start:
// End  :
#include <bits/stdc++.h>
using namespace std;

#define rep(i, x, y) for(int i = (x), _ = (y); i <= _; ++ i)
#define per(i, x, y) for(int i = (x), _ = (y); i >= _; -- i)
#define dprintf(...) fprintf(stderr, __VA_ARGS__)
#define disp(x) cout << #x << " = " << x << "; "

typedef long long LL;

template <class T> bool chkmin(T& a, T b) { return a > b ? a = b, true : false; }
template <class T> bool chkmax(T& a, T b) { return a < b ? a = b, true : false; }

template <class T> void read(T& a) {
	char c = getchar(); T f = 1; a = 0;
	for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) a = a * 10 + c - '0';
	a *= f;
}

template <class T> void write(T a) {
	static int stk[60]; 
	int tp = 0;
	if(a < 0) putchar('-'), a = -a;
	do {
		stk[++ tp] = a % 10;
		a /= 10;
	}while(a);
	
	while(tp) putchar(stk[tp--] + '0');
}

const int maxN = 1e5 + 5;

LL a[maxN];
char b[maxN];
int N;
LL cnt = 0;

int main() {
#ifdef Leeson
	freopen("tmp.in", "r", stdin);
	freopen("tmp.out", "w", stdout);
#endif

	cin >> N;
	read(a[1]);
	LL ans = a[1];
	LL sum = a[1];
	rep(i, 2, N) {
		char& c = b[i] = getchar();
		while(c != '-' && c != '+') c = getchar();

		read(a[i]);
		if(c == '-')
			cnt += a[i], ans -= a[i];
		else 
			ans += a[i];
		sum += a[i];
	}

	LL sora = 0;
	per(i, N, 2) {
		sora += a[i];
		if(b[i] == '-') {
			cnt -= a[i];
//			disp(sum), disp(sora), disp(cnt), puts("");
			chkmax(ans, sum - 2 * sora - cnt * 2);
			sora = 0;
		} 
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof(a))
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
typedef long long ll;
const ll maxn=1e4+200;
const int inf=0x3f3f3f3f;
const double EPS=1e-10;
//typedef pair<int,int> PA;
double add(double a,double b){//考虑误差的加法运算
    if(abs(a+b)<EPS*(abs(a)+abs(b))) return  0;
    return a+b;
}
class Point{
public:

    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){
    }
    Point operator+ (Point p){
        return Point(add(x,p.x),add(y,p.y));
    }
    Point operator -(Point p){
        return Point(add(x,-p.x),add(y,-p.y));
    }
    Point operator *(double d){
        return Point(x*d,y*d);
    }
    double dot(Point p){//外积 p1.p2  outside
        return add(x*p.x,y*p.y);
    }
    double det(Point p){//内积 p1*p2    inner
        return add(x*p.y,-y*p.x);
    }
    double len(){
        return sqrt(add(x*x,y*y));
    }
};
Point operator *(double d,Point p){
    return Point(p.x*d,p.y*d);
}
Point Projection(Point p1,Point p2,Point p){//p 在线段p1,p2上的投影坐标
    double d1=1.0/(p2-p1).len();
    Point ans=(p-p1).dot((p2-p1))*(p2-p1)*d1*d1;
    return ans+p1;
}
Point Reflection(Point p1,Point p2,Point p){//p 关于线段p1 p2的 反射坐标
    return 2.0*Projection(p1,p2,p)-p;
}
typedef Point P;
int main(){
    P p1,p2;
    scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
    int q;
    scanf("%d",&q);
    while(q--){
        P p;
        scanf("%lf%lf",&p.x,&p.y);
        P ans=Reflection(p1,p2,p);
        printf("%.10f %.10f\n",ans.x,ans.y);
    }
    return 0;
}



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

int main() {
  vector<int> N(3);
  cin >> N.at(0) >> N.at(1) >> N.at(2);
  sort(N.begin(), N.end());
  if (N.at(0) == 5 && N.at(1) == 5 && N.at(2) == 7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() (n, m, k int, as, bs []int) {
	n, m, k = scanInt(sc), scanInt(sc), scanInt(sc)
	as, bs = nextIntSlice(sc, n), nextIntSlice(sc, m)
	return
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextIntSlice(sc *bufio.Scanner, n int) (a []int) {

	a = make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
	}
	return a
}

func nextIdx(sumA []int, k, start int) int {
	idx := start
	for ; idx >= 0; idx-- {
		if sumA[idx] <= k {
			break
		}
	}
	return idx
}

func resolve(n, m, k int, as, bs []int) int {
	sumA := make([]int, len(as)+1)
	for i := 1; i <= len(as); i++ {
		sumA[i] = sumA[i-1] + as[i-1]
	}
	idx := nextIdx(sumA, k, len(sumA)-1)
	max := idx
	for j := 1; j <= len(bs); j++ {
		k -= bs[j-1]
		if k < 0 {
			break
		}
		idx = nextIdx(sumA, k, idx)
		if max < j+idx {
			max = j + idx
		}
	}
	return max
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a


using ll = long long;

int main() {
    IN(string, s);
    REP(i, s.length()){
        cout << "x";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = N%10
if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:
  print("hon")
if a == 0 or a == 1 or a == 6 or a == 8:
  print("pon")
if a == 3:
  print("bon")


Measured memory_bytes: 9168
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  int D, N; cin >> D >> N;
  int base = (int)pow(100, D);
  if (N == 100) {
    cout << base * (N + 1) << endl;
  } else {
    cout << base * N << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

ll calc(ll A, ll B, ll i) {
  ll L = (i * A) / B;
  ll R = A * (i / B);
  return L - R;
}

int main() {
  ll A, B, N;
  cin >> A >> B >> N;

  ll i = N;
  if (N >= B) {
    i = B - 1;
  }
  ll L = (i * A) / B;
  ll R = A * (i / B);
  cout << calc(A, B, i) << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<queue>
using namespace std;
long sumb;
int Q;
main()
{
	cin>>Q;
	priority_queue<long>L;
	priority_queue<long,vector<long>,greater<long> >R;
	long sumL=0,sumR=0;
	for(;Q--;)
	{
		int id;cin>>id;
		if(id==1)
		{
			long a,b;cin>>a>>b;
			sumb+=b;
			if(!R.empty()&&R.top()<=a)R.push(a),sumR+=a;
			else L.push(a),sumL+=a;
			int dim=(L.size()+R.size())%2;
			while(R.size()+dim<L.size())
			{
				long now=L.top();
				sumL-=now;
				sumR+=now;
				R.push(now);
				L.pop();
			}
			while(R.size()+dim>L.size())
			{
				long now=R.top();
				sumR-=now;
				sumL+=now;
				L.push(now);
				R.pop();
			}
		}
		else
		{
			long now=L.top();
			cout<<now<<" "<<sumb+(sumR-now*(long)R.size())+(now*(long)L.size()-sumL)<<endl;
		}
	}
}


Measured memory_bytes: 3828