akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll bubblesort(vec &a,ll n){
  ll flag=1;
  ll swapcount=0;
  while(flag){
    flag=0;
    Pool(i,1,n-1){
      if(a[i]<a[i-1]){
        swapcount++;
        swap(a[i],a[i-1]);
        flag=1;
      }
    }
  }
  return swapcount;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec a(n);
  loop(i,n)cin>>a[i];
  ll ans=bubblesort(a,n);
  loop(i,n){
    cout<<a[i];
    if(i<n-1)cout<<" ";
  }
  putout("");
  putout(ans);
}


Measured memory_bytes: 3104
S = input()
N=len(S)
S1 = S[0:int((N-1)/2)]
S2 = S[int((N+3)/2)-1:N]
S_r = ''.join(list(reversed(S)))
S1_r = ''.join(list(reversed(S1)))
S2_r = ''.join(list(reversed(S2)))
if S==S_r and S1==S1_r and S2==S2_r:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

        try {
            int ncount = Integer.parseInt(reader.readLine()); // 一行目はテストケース数 Ｎ
            int cnt_AC = 0;
            int cnt_WA = 0;
            int cnt_TLE = 0;
            int cnt_RE = 0;
            String result;
            while (ncount != 0) {
                result = reader.readLine();
                ncount--;
                switch (result) {

                case "AC":
                    cnt_AC++;
                    break;

                case "WA":
                    cnt_WA++;
                    break;

                case "TLE":
                    cnt_TLE++;
                    break;

                case "RE":
                    cnt_RE++;
                }

            }
            reader.close();
            System.out.println("AC x " + cnt_AC);
            System.out.println("WA x " + cnt_WA);
            System.out.println("TLE x " + cnt_TLE);
            System.out.println("RE x " + cnt_RE);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

Measured memory_bytes: 42696
n = gets.to_i
a = gets.chomp.split(' ').map{|bit| (bit == '1') }
div_list = Array.new(n) { [0] }
div_list[0] = []
(2..(n/2)).each do |x|
  i = x*2 - 1
  while i < n
    div_list[i].push(x-1)
    i += x
  end
end
good_layout = []
(0...n).reverse_each do |i|
  if a[i]
  	div_list[i].each {|x| a[x] = !a[x] }
    good_layout.push(i+1)
  end
end
 
puts(good_layout.length)
puts(good_layout.join(' ')) if good_layout.length > 0

Measured memory_bytes: 58308
#include<bits/stdc++.h>
using namespace std;
const int N=500001;
int head[N],nxt[N<<1],vis[N<<1],val[N<<1],cnt,test[N<<1];
int d[N];
int n,m,tot[N],tt;
queue<int> q;
bool v[N],use[N];

void add(int x,int y,int z)
{
	vis[++cnt]=y;nxt[cnt]=head[x];head[x]=cnt;val[cnt]=z;
}

bool spfa(int x)
{
	 v[x]=1;
	 for(int i=head[x];i;i=nxt[i])
	 {
	 	 int y=vis[i];
	 	 if(d[y]<d[x]+val[i])
	 	 {
	 	 	d[y]=d[x]+val[i];
	 	 	if(v[y]) return 0;
	 	 	if(!spfa(y)) return 0;
	 	 }
	 }
	 v[x]=0;
	 return 1;
}

int main()
{
	memset(d,-0x3f,sizeof(d));
	memset(v,0,sizeof(v));
	scanf("%d%d",&n,&m);
	int a,b,c;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		add(a,b,c);
		add(b,a,-c); 
		add(n+1,i,0);
	}
    for(int i=m;i<=n;i++) add(n+1,i,0);
    d[n+1]=0;
    if(spfa(n+1)) printf("Yes");
    else printf("No");
	return 0;
}

Measured memory_bytes: 19328
H,W,A,B=gets.chomp.split(" ").map(&:to_i)

up_array = Array.new(A, 0).concat(Array.new(W-A, 1)).join("")
down_array = Array.new(A, 1).concat(Array.new(W-A, 0)).join("")
B.times { puts up_array }
(H-B).times { puts down_array }


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

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

    if(n % 2 == 0){//偶数
        long long cur = 5;
        long long ans = 0;
        while(2 * cur <= n){
            ans += n/(2 * cur);
            cur *= 5;
        }
        cout << ans << endl;
    } 
    else{//奇数
        cout << 0 << endl;
    }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
//プロトタイプ宣言
int gcd(int , int);
void often(void);
int get_digent(int);


int main(){
  often();
  int n;
  cin >> n;
  vi a(n);
  int num;
  rep(i,n){
    cin >> num;
    a[num - 1] = i+1;
  }
  rep(i,n) cout << a[i] << endl;
}








































//以下、ライブラリ

int gcd(auto a, auto b) {
  return b ? gcd(b, a%b) : a;
}  //ユークリッドの互除法

void often(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int get_digent(int x){
  string s;
  s = to_string(x);
  int digent = s.size();
  return digent;
} 

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String S = sc.next();
		String T = sc.next();
		sc.close();

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < N; i++) {
			sb.append(S.charAt(i));
			sb.append(T.charAt(i));
		}
		System.out.println(sb.toString());

	}

}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std ;
const int N = 1e4 + 10 ;
int dp[N] ;
int a[N] , b[N] ;
int main()
{
  for(int i = 0 ;i < N ; i ++)
   dp[i] = 0x3f3f3f3f ;
  dp[0] = 0 ;
  int h , n ;
  cin >> h >> n ;
  for(int i = 1; i <= n ;i ++)
   cin >> a[i] >> b[i] ;
  for(int i = 1; i <= n ;i ++)
     for(int j = a[i] ;j < N ;j ++)
      dp[j] = min(dp[j - a[i]] + b[i] , dp[j]) ;
  int ans = 0x3f3f3f3f ;
  for(int i = h ;i < N ;i ++)
   ans = min(ans , dp[i]) ;
  cout << ans << endl ;
  return 0 ;
}


Measured memory_bytes: 256
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
  char a,b;
  cin >> a >> b;
  if(a=='H' && b=='H')
    cout<<'H';
  else if(a=='D' && b=='D')
    cout<<'H';
  else if(a=='D' && b=='H')
    cout<<'D';
  else if(a=='H' && b=='D')
    cout<<'D';
  return 0;
}

Measured memory_bytes: 256
a=int(input())
Xin=input().split( )
X=[int(Xin[i]) for i in range(a)]
 
X.append(2020)
b=int(input())
Ain=input().split( )
A=[int(Ain[i]) for i in range(b)]
 
for t in range(b):
    j=A[t]-1
    if X[j]<X[j+1]-1:
        X[j]+=1
for i in range(a):
    print(X[i])


Measured memory_bytes: 5612
from math import cos, sqrt, pi


A, B, H, M = map(int, input().split())
ang_A = (H * 60 + M) / 360 * pi
ang_B = (H * 60 + M) / 30 * pi
ang_C = abs(ang_A - ang_B)
if ang_C > pi:
    ang_C = 2 * pi - ang_C
C = sqrt(A**2 + B**2 - 2*A*B*cos(ang_C))
print(C)

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

ans = "APPROVED"
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 !=0 and a[i]%5 !=0:
            ans = "DENIED"
            break
    else:
        continue
print(ans)

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        Scanner in;
        PrintWriter out;

        void solve1(int L, String sl, int R, String sr) {
            int M = (L + R) / 2;
            out.println(M);
            out.flush();
            String sm = in.next();
            if (sm.equals("Vacant")) {
                return;
            }
            if (sl.equals(sm) ^ (M - L - 1) % 2 == 1) {
                solve1(L, sl, M, sm);
            } else {
                solve1(M, sm, R, sr);
            }
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = in.nextInt();
            out.println(0);
            out.flush();
            String s0 = in.next();
            if (s0.equals("Vacant")) {
                return;
            }
            out.println(n / 2);
            out.flush();
            String s1 = in.next();
            if (s1.equals("Vacant")) {
                return;
            }
            int len01 = n / 2 - 1;
            if (s0.equals(s1) ^ len01 % 2 == 1) {
                solve1(0, s0, n / 2, s1);
            } else {
                solve1(n / 2, s1, n, s0);
            }
        }

    }
}



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

int main() {
    long long a, b;
    cin >> a >> b;
    if (a % 2 != b % 2) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << (a + b) / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int n,ans = 0;
	cin >> n;
	vi v(n),c(n);
	repz(i, n)cin >> v[i];
	repz(i, n)cin >> c[i];
	repz(i, n) {
		if (v[i] - c[i] > 0)ans += (v[i] - c[i]);
	}

	cout << ans << endl;

	system("pause");
	return 0;
}


Measured memory_bytes: 504
H, W, D = map(int,input().split())
data = [0] * (H * W + D + 1)
for i in range(H):
    A = list(map(int,input().split()))
    for j in range(W):
        data[A[j] + D] = [i, j]
Q = int(input())
S = [0] * (H * W + D + 1)
for i in range(H * W):
    if i >= D:
        S[i + D + 1] = S[i + 1] + abs(data[i + D + 1][0] - data[i + 1][0]) + abs(data[i + D + 1][1] - data[i + 1][1])
for i in range(Q):
    L, R = map(int,input().split())
    print(S[R + D] - S[L + D])

Measured memory_bytes: 17088
#include <bits/stdc++.h>
using namespace std;
    
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for (int i = 0; i < n; i++)
#define repn(i, a, b) for (int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mem(x) memset(x, 0, sizeof(x))
#define ritr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define pai pair < int, int> ;
#define pal pair < ll, ll> ;
#define vi vector <int> ;
#define vl vector < ll > ;
#define vpai vector < pii > ;

const int mod = 1e9+7;
const ll INF = 1e15;
const int sze = 3005;

void solve() {
    int n;
    cin>>n;
    ll dp[n+5][n+5];
    
    ll arr[n];
    mem(arr);
    rep(i,n) cin>>arr[i];
    ll pre[n];
    pre[0]=arr[0];
    repn(i,1,n-1) pre[i]=pre[i-1]+arr[i];

    memset(dp,0,sizeof(dp));
    rep(i,n) rep(j,n) dp[i][j]=INF;
    rep(i,n) dp[i][i]=0;

    //rep(i,n) cout<<pre[i]<<" ";

    for(int len=2;len<=n;len++){
        for(int i=0;i<=n-len;i++){
            int j=i+len-1;
            for(int k=i+1;k<=j;k++){
                ll x=0;
                if(i!=0)
                x=pre[i-1];
                dp[i][j]=min(dp[i][j],dp[i][k-1]+dp[k][j]+pre[j]-x);
                //cout<<"hello\n";
            }
        }
    }
    cout<<dp[0][n-1]<<endl;
}

int main() {
    IOS;

    int t = 1;
    //cin >> t;
    while (t--) {
       solve();
    }

  return 0;
}

Measured memory_bytes: 4884
#include <cstdio>

using namespace std;

const int mod = 1'000'000'007;

int add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}

int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}

int mul(int a, int b) {
  return (int)((long long)a * b % mod);
}

int pw(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}

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

int choose(int n, int k) {
  int res = 1;
  for (int i = n - k + 1; i <= n; ++i) {
    res = mul(res, i);
  }
  for (int i = 1; i <= k; ++i) {
    res = mul(res, inv(i));
  }
  return res;
}

int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  int ans = sub(pw(2, n), 1);
  ans = sub(ans, choose(n, a));
  ans = sub(ans, choose(n, b));
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
 
int main(){
  int N;
  int count = 0;
  int i,j;
  char tmp;
  
  scanf("%d",&N);
  char G[N+1];
  scanf("%s",G);
  
  i = 0;
  j = N-1;
  do{
    if(G[i] == 'W' && G[j] == 'R'){
      tmp = G[i];
      G[i] = G[j];
      G[j] = tmp;
      count++;
    }
    
    while(G[i] != 'W' && i<N) i++;
    while(G[j] != 'R' && j > 0) j--;
  }while(i<j);
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 1872
#include<stdio.h>
int main(void)
{
	int n,p[11],i,j,ba,cnt,temp;
	char y[101];
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(i=1;i<=n;i++){
			p[i]=0;
		}
		scanf("%s",y);
		ba=0;
		cnt=0;
		for(i=0;i<100;i++){
			cnt++;
			if(cnt>n){
				cnt=1;
			}
			if(y[i]=='M'){
					p[cnt]++;
			}
			if(y[i]=='S'){
					ba+=p[cnt]+1;
					p[cnt]=0;
			}
			if(y[i]=='L'){
					p[cnt]+=ba+1;
					ba=0;
			}
		}
		for(i=1;i<n;i++){
			for(j=i+1;j<=n;j++){
				if(p[i]>p[j]){
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
				}
			}
		}
		for(i=1;i<=n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",ba);
	}
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end()) 
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  double t, x;
  cin >> t >> x;

  cout << t / x << endl;

  return 0;
}


Measured memory_bytes: 256
def sharing_cookies(A: int, B: int)->bool:
    return A % 3 == 0 or B % 3 == 0 or (A+B) % 3 == 0


if __name__ == "__main__":
    A, B = map(int, input().split())
    yes = sharing_cookies(A, B)
    print('Possible' if yes else 'Impossible')


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

int main() {
    int n;
    scanf("%d", &n);
    double ans = 0;
    rep(i,n) {
        int c;
        scanf("%d", &c);
        ans += (double)1/c;
    }
    printf("%.6f\n", 1/ans);
}

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

using namespace std;


// Bismilahir Rahmanir Rahim


typedef unsigned int ui;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef short int si;
typedef unsigned short int usi;
typedef pair <int, int> pii;


#define CASE false
#define TEST false
#define BUFFER true
#define TIME false
#define DEBUG true
#define SET_GEN false
#define _ << " " <<
#define __ << "\n"
#define ff first
#define ss second
#define RANGE(a, b) (rand() % (b-a+1) + a)


const double pi = acos(-1.);
const double eps = 1e-7;
const int high = 2e9;
const int inf = 2147483647;
const int _inf = -2147483648;
const lli INF = 1e18;
const int mod = 1e9+7;


void delay(int sec); // DEBUG

const int maxn = 1e5 + 1;
int n;
int height[maxn];
int cost[maxn];

int dp(int pos)
{
	if (pos == n) return 0;
	if (cost[pos] != -1) return cost[pos];
	int ans1 = inf, ans2 = inf;
	
	if ((pos+1) <= n) ans1 = dp(pos+1) + abs(height[pos]-height[pos+1]);
	if ((pos+2) <= n) ans2 = dp(pos+2) + abs(height[pos]-height[pos+2]);
	
	return cost[pos] = min(ans1, ans2);
}

void solution(void)
{	
	cin >> n;
	
	memset(cost, -1, sizeof(cost));
	
	for(int i = 1; i <= n; ++i) 
		cin >> height[i];
	
	
	cout << dp(1);
	

    return ;
}

int main(int argc, char *arv[])
{
    #if BUFFER
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #endif

    #if SET_GEN
    srand((unsigned int) time(0));
    #endif

    int t = 1;

    #if CASE
    int cnt = 1;
    #endif

    #if TEST
    cin >> t;
    #endif

    #if TIME
    clock_t start_time, end_time;
    double time_elapsed;
    #endif


    while(t--) {

        #if TIME
        start_time = clock();
        #endif

        #if CASE
        cout << "Case " << cnt++ << ": ";
        #endif

        solution();

        #if TIME
        end_time = clock();

        time_elapsed = (double) (end_time - start_time) / CLOCKS_PER_SEC;

        cout << "\nRuntime: " << fixed << setprecision(7) << time_elapsed << "\n";
        #endif
    }


    return 0;
}

void delay(int sec)
{
    int mili_sec = 1000 * sec;

    clock_t start_time = clock();

    while (clock() < start_time + mili_sec);

    return ;
}


Measured memory_bytes: 9100
import sys
sen=[]
for line in sys.stdin:
    sen.append(line)
Sen=''.join(sen)

a=[]
b=[]
c=[]
d=[]
e=[]
f=[]
g=[]
h=[]
i=[]
j=[]
k=[]
l=[]
m=[]
n=[]
o=[]
p=[]
q=[]
r=[]
s=[]
t=[]
u=[]
v=[]
x=[]
y=[]
z=[]
w=[]
count={'a':a,'b':b,'c':c,'d':d,'e':e,'f':f,'g':g,'h':h,'i':i,'j':j,'k':k,'l':l,'m':m,'n':n,'o':o,'p':p,'q':q,'r':r,'s':s,'t':t,'u':u,'v':v,'w':w,'x':x,'y':y,'z':z}
for i in range(len(Sen)):
    if Sen[i].isalpha():
        count[Sen[i].lower()].append('#')
for char in sorted(count.keys()):
    print('%s : %d'%(char,len(count[char])))

Measured memory_bytes: 6412
using System;
using System.Linq;

namespace AtCoderTutorial
{
    public class Otoshidama
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToList();
            var N = input[0];
            var Y = input[1];

            // 10000x + 5000y + 1000z = Y
            // x + y + z = N

            int xv = -1;
            int yv = -1;
            int zv = -1;

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

                    if ((10000 * i + 5000 * j + 1000 * z) == Y)
                    {
                        xv = i;
                        yv = j;
                        zv = z;
                    }
                }
            }

            Console.WriteLine($"{xv} {yv} {zv}");
        }
    }
}

Measured memory_bytes: 28152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,pair<int,int>> P;
int main(){
  int N;
  cin>>N;
  vector<P> A(N);
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    A[i] = {a+b,{a,b}};
  }
  sort(A.begin(),A.end(),greater<P>());
  ll ans = 0;
  for(int i=0;i<N;i++){
    if(i%2) ans -= A[i].second.second;
    else ans += A[i].second.first;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define inf 1000000000
#define add(x,y,z) addedge(x,y,z),addedge(y,x,0)
#define T n+m+1
#define N 500
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int n,m,vis[N],cur[N],head[N],dis[N],tot=1;
struct Edge{int v,w,f,next;Edge(int _v=0,int _w=0,int _n=0):v(_v),w(_w),next(_n){}}edge[1000000];
inline void addedge(int x,int y,int z){edge[++tot]=Edge(y,z,head[x]);head[x]=tot;}
queue<int> q;
inline int bfs()
{	q.push(0); memset(vis,0,sizeof(vis)); memcpy(cur,head,sizeof(cur)); vis[0]=1;
	while(!q.empty())
	{	int x=q.front(); q.pop();
		for(rint i=head[x];i;i=edge[i].next)
		if(!vis[to]&&edge[i].w>edge[i].f)
		{	if(to==0) debug(x),debug(vis[to]);
			dis[to]=dis[x]+1,vis[to]=1,q.push(to);
		}
	}
	return vis[T];
}
int dfs(int x,int res)
{	if(x==T||!res) return res;
	int flow=0,f;
	for(rint &i=cur[x];i;i=edge[i].next)
	if(dis[to]==dis[x]+1&&(f=dfs(to,min(res,edge[i].w-edge[i].f))))
	{	edge[i].f+=f; edge[i^1].f-=f; flow+=f; res-=f;
		if(!res) break;
	}
	return flow;
}
int dinic(){int ans=0;while(bfs())ans+=dfs(0,inf);return ans;}
char c[N][N];
int main()
{	cin>>n>>m;
	for(rint i=1;i<=n;i++) scanf("%s",c[i]+1);
	for(rint i=1;i<=n;i++)
	for(rint j=1;j<=m;j++)
	if(c[i][j]=='S') add(0,i,inf),add(0,n+j,inf);
	else if(c[i][j]=='T') add(i,T,inf),add(n+j,T,inf);
	else if(c[i][j]=='o') add(i,n+j,1),add(n+j,i,1);
	int ans=dinic();
	if(ans>=1e9) printf("-1"); else printf("%d",ans);
	return 0;
}


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

using namespace std;

typedef long long ll;
#define printWithPrecision(x) cout << fixed << setprecision(10) << x << endl;
double dp[3001][3001];

double solve(vector<double>& v, ll i, ll x) {
	if (x == 0) return 1;
	if (i == 0) return 0;
	if (dp[i][x] > -0.9) return dp[i][x];
	return dp[i][x] = (v[i] * solve(v, i - 1, x - 1)) + (((double)1 - v[i]) * solve(v, i - 1, x));
}

void fast() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

}

int main() {
	fast();
	ll n;
	cin >> n;
	memset(dp, -1, sizeof dp);

	vector<double> v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	printWithPrecision(solve(v, n, (n + 1) / 2ll));
	return 0;
}



Measured memory_bytes: 74412
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int k=0; k<n; k++) {
        int a[10];
        for(int i=0; i<10; i++) cin >> a[i];
        int b=-1, c=-1;
        bool f = 0;
        for(int i=0; i<10; i++) {
            if(b<a[i]) {
                b = a[i];
            } else if(c<a[i]) {
                c = a[i];
            } else {
                f = 1;
                break;
            }
        }
        printf("%s\n", f ? "NO" : "YES");
    }

    return 0;
}

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

using namespace std;
using ll = long long;

struct Edge { int to, cost; };

int tree_diameter(const vector<vector<Edge>>& g) {
	int V = g.size();
	vector<int> d(V, -1);

	function< void(int) > bfs = [&](int s) {
		d.assign(V, -1);
		d[s] = 0;
		deque<int> que;
		que.push_back(s);
		while (!que.empty()) {
			int t = que.front();
			que.pop_front();
			for (auto e : g[t]) {
				if (d[e.to] < 0) {
					d[e.to] = d[t] + e.cost;
					que.push_back(e.to);
				}
			}
		}
	};

	bfs(0);
	bfs(max_element(d.begin(), d.end()) - d.begin());
	return *max_element(d.begin(), d.end());
}

int main() {
	int N;
	cin >> N;
	vector<vector<Edge>> g(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		g[a].push_back({b, 1});
		g[b].push_back({a, 1});
	}

	cout << (tree_diameter(g) % 3 == 1 ? "Second" : "First") << endl;

	return 0;
}


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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

Int lcm(Int x, Int y){
	return x * y / gcd(x, y);
}

bool sosuu(int x){
	bool b = 1;
	if(x == 1) b = 0;
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0) {
			b = 0;
			break;
		}
	}
	return b;
}

int n, a[101];

int main(){
	cin >> n;
	int c[201] = {0};
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = -100; i <= 100; i++){
		for(int j = 0; j < n; j++){
			c[i + 100] += (a[j]-i)*(a[j]-i);
		}
	}
	sort(c, c + 201);
	cout << c[0] << endl;
	
	return 0;
}

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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if (a > k) cout << k << endl;
  else if (a + b >= k) cout << a << endl;
  else cout << 2 * a - k + b << endl;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c){
    stack<int> S;
    S.push(r);
    color[r] = c;
    while(!S.empty()){
        int u = S.top();
        S.pop();
        for(int i = 0; i < G[u].size(); i++){
            int v = G[u][i];
            if(color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id = 1;
    for(int i = 0; i < n; i++) color[i] = NIL;
    for(int u = 0; u < n; u++){
        if(color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int s, t, m, q;
    
    cin >> n >> m;
    
    for(int i = 0; i < m; i++){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    
    assignColor();
    
    cin >> q;
    
    for(int i = 0; i < q; i++){
        cin >> s >> t;
        if(color[s] == color[t]){
            cout << "yes" << endl;
        }
        else{
            cout << "no" << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 8992
#ifndef LOCAL
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/


void ans(int x) {
	cout << x << "\n";
	exit(0);
}


int n;
int cc[100];
int en[100];

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		++cc[x];
	}
	if (cc[0])
		ans(0);
	for (int i = 0; i <= 12; ++i)
		if (cc[i] >= 3)
			ans(0);
	en[0] = 1;
	for (int i = 1; i <= 12; ++i) {
		if (cc[i] == 2) {
			en[i] = 2, en[24 - i] = 2;
			cc[i] = 0;
		}
	}
	int aans = 0;
	for (int i = 0; i < (1 << 12); ++i) {
		for (int j = 1; j <= 12; ++j) {
			if (cc[j] == 1) {
				if ((i >> (j - 1)) & 1)
					en[j] = 1;
				else
					en[24 - j] = 1;
			}
		}

		int cur = 100;
		for (int i = 0; i < 24; ++i)
			for (int j = i + 1; j < 24; ++j) {
				if (en[i] && en[j]) {
					cur = min(cur, min(j - i, 24 - (j - i)));
				}
			}
		aans = max(aans, cur);

		for (int j = 1; j <= 12; ++j) {
			if (cc[j] == 1) {
				if ((i >> (j - 1)) & 1)
					en[j] = 0;
				else
					en[24 - j] = 0;
			}
		}
	}
	ans(aans);
	return 0;
}




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

const int MOD = 1000000007;

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

  int n;
  cin >> n;

  vector<int> d(1001, 0);

  // 2*3*4*....*nまで
  for (int i = 2; i <= n; i++) {
    int num = i;
    for (int j = 2; j <= n; j++) {
      while (num % j == 0) {
        num /= j;
        d.at(j)++;
      }

      if (num == 1) break;
    }
  }

  ll ans = 1;
  for (int i = 0; i < 1001; i++) {
    if (d.at(i) > 0) {
      ans = ans * (d.at(i) + 1) % MOD;
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 


struct UnionFindTree{
  vector<int> par,rank,size;
  UnionFindTree(int N){
    par = rank = vector<int>(N,0);
    size = vector<int>(N,1);
    for(int i = 0; i < N; i++) par[i] = i;
  }
  int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y)  return ;
    if(rank[x] < rank[y]){
      par[x] = y;
    }else{
      par[y] = x;
      if(rank[x] == rank[y]) ++rank[x];
    }
    size[x] = size[y] = size[x] + size[y];
  }
  bool same(int x,int y){
    return find(x) == find(y);
  }
  int union_size(int x){
    return size[find(x)];
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M; cin >> N >> M ;
  UnionFindTree uft(N+M);
  vector<bool> is_used(M,false);
  rep(i,N){
    int K; cin >> K ;
    rep(j,K){
      int L; cin >> L ;
      L--;
      is_used[L] = true;
      uft.unite(i,L+N);
    }
  }
  int cnt = 0;
  rep(i,M) if(is_used[i]) cnt++;
  cout << (uft.union_size(0)==(N+cnt) ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int popc(string s) {
	int ret = 0;
	for (auto c : s) { ret += (c == '1'); }
	return ret;
}

int f(int n) {
	if (n == 0) { return 0; }

	string s = "";
	int t = n;
	while (t > 0) {
		s += (t % 2 ? '1' : '0');
		t /= 2;
	}
	reverse(s.begin(), s.end());
	return 1 + f(n % popc(s));
}

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

	int cnt = popc(X);

	vector<vector<int>> memo(N + 1, vector<int>(2, 0));
	int b0 = 1, b1 = 1;
	for (int i = N - 1; i >= 0; --i) {
		memo[i][0] = b0 % (cnt + 1);
		(b0 *= 2) %= (cnt + 1);
		if (cnt > 1) {
			memo[i][1] = b1 % (cnt - 1);
			(b1 *= 2) %= (cnt - 1);
		}
	}

	int sum0 = 0, sum1 = 0;
	for (int i = 0; i < N; ++i) {
		if (X[i] == '1') {
			(sum0 += memo[i][0]) %= (cnt + 1);
			if (cnt > 1) { (sum1 += memo[i][1]) %= (cnt - 1); }
		}
	}

	for (int i = 0; i < N; ++i) {
		if (cnt == 1 && X[i] == '1') {
			cout << 0 << endl;
			continue;
		}

		if (X[i] == '0') {
			int sum = (sum0 + memo[i][0]) % (cnt + 1);
			cout << 1 + f(sum) << endl;
		} else {
			int sum = (sum1 - memo[i][1] + (cnt - 1)) % (cnt - 1);
			cout << 1 + f(sum) << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 14272
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    string s;
    cin>>s;
    vector<string> t = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for(int i=0;i<7;i++){
        if(t[i]==s){
            cout<<7-i<<endl;
        }
    }

    
}

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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
///////////////////////////////////////////////
/*（๑•﹏•๑｀) */

int main() {
	int N,M; cin >> N >> M;
	vector<int> S[M];

	REP(i,M){
	    int K; cin >> K;
	    REP(j,K){
	        int s; cin >> s;
	        S[i].PB(s);
	    }
	}

	vector<int> p(M);
	int ans = 0;

	REP(i,M){
	    cin >> p[i];
	}


	for (int b = 0; b < (1<<N); b++){
		vector<int> count(M);
		bool chk = true;

		REP(i,N){ //bit loop
			REP(l,M){ // 1 ~ M
				REP(q,S[l].size()){
					if (b & (1<<i)){ //i-th digit(bitにi-thのフラグが立っているかどうか)
						if (i+1 == S[l][q]) count[l]++;
					}
				}
			}
		}

		REP(i,M){
			if (count[i] % 2 != p[i]) chk = false;
		}

		if (chk) ans++;
	}

	cout << ans << "\n";
}


Measured memory_bytes: 256
a, b, m = map(int, input().split())
frid = list(map(int, input().split()))
mic = list(map(int, input().split()))

ans = min(frid) + min(mic)

for _ in range(m):
    x, y, c = map(int, input().split())
    disc = frid[x-1] + mic[y-1] - c

    if disc < ans:
        ans = disc
print(ans)


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

int main(){

    long long int N,A,B,C,D,E;
    cin>>N>>A>>B>>C>>D>>E;
    long long int ans;
    if(N%min({A,B,C,D,E})==0) ans=N/min({A,B,C,D,E})+4;
    else ans=N/min({A,B,C,D,E})+5;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N = int(input())
S = ""
if N == 0:
    print(0)
    exit(0)
    
while N != 0:
    r = N%(-2)
    N = N//(-2)
    if r < 0:
        r += 2
        N += 1
    S += str(r)
print(S[::-1])

Measured memory_bytes: 3060
<?php

// 入力
fscanf(STDIN, "%s", $a);
fscanf(STDIN, "%s", $c);

$arr_a = str_split($a);
$arr_c = str_split($c);

$change_cnt = 0;
foreach($arr_a as $idx => $a_val){
  if($a_val != $arr_c[$idx]){
    $change_cnt++;
  }
}

echo $change_cnt;


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

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

const Int MOD = 1e6;
const Int MAX = 1024;
Int n;
Int dp[5][4][2][MAX];
string ss[MAX];

Int check(Int v,string s){
  for(Int i=0;i<8;i++){
    if((s[i]!='x')&&((s[i]-'0')!=(v&1))) return 0;
    v>>=1;
  }
  return 1;
}

Int rf[5][4],mc[5][4],ms[5][4];
Int match(Int a,Int b,Int l){
  return (a>>(8-l))==(b>>(8-l));
}

Int dfs(Int len,Int i,Int y,Int p){
  if(p==n) return (len==1&&i==0&&y==1);
  Int &res=dp[len][i][y][p];
  if(~res) return res;
  res=0;

  for(Int bit=0;bit<256;bit++){
    if(!check(bit,ss[p])) continue;
    if(!match(bit,rf[len][i],mc[len][i])) continue;
    if(i+1==len){
      if(y){
        for(Int nxt=1;nxt<=4;nxt++){
          Int ni=0;
          Int ny=(nxt==1);
          Int np=p+1;
          res+=dfs(nxt,ni,ny,np);
          res%=MOD;
        }
      }
    }else{
      Int ni=i+1;
      Int ny=y||(ms[len][i]&bit);
      Int np=p+1;
      res+=dfs(len,ni,ny,np);
      res%=MOD;
    }
  }
  return res;
}

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

  rf[1][0]=0b00000000;

  rf[2][0]=0b11000000;
  rf[2][1]=0b10000000;

  rf[3][0]=0b11100000;
  rf[3][1]=0b10000000;
  rf[3][2]=0b10000000;

  rf[4][0]=0b11110000;
  rf[4][1]=0b10000000;
  rf[4][2]=0b10000000;
  rf[4][3]=0b10000000;

  mc[1][0]=1;

  mc[2][0]=3;
  mc[2][1]=2;

  mc[3][0]=4;
  mc[3][1]=2;
  mc[3][2]=2;

  mc[4][0]=5;
  mc[4][1]=2;
  mc[4][2]=2;
  mc[4][3]=2;

  ms[1][0]=0b00000000;

  ms[2][0]=0b00011110;
  ms[2][1]=0b00000000;

  ms[3][0]=0b00001111;
  ms[3][1]=0b00100000;
  ms[3][2]=0b00000000;

  ms[4][0]=0b00000111;
  ms[4][1]=0b00110000;
  ms[4][2]=0b00000000;
  ms[4][3]=0b00000000;

  while(cin>>n,n){
    memset(dp,-1,sizeof(dp));
    for(Int i=0;i<n;i++){
      cin>>ss[i];
      reverse(ss[i].begin(),ss[i].end());
    }
    Int ans=0;
    for(Int len=1;len<=4;len++){
      ans+=dfs(len,0,(len==1),0);
      ans%=MOD;
    }
    cout<<ans<<endl;
  }
  return 0;
}



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

int main()
{
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    for (int i = 0; i < n; i++)
    {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3616
n = int(input())
list_a = list(map(int, input().split()))
list_memo = []
for i in range(0,n):
    if i == 0:
        list_memo.append(list_a[i])
    else:
        list_memo.append(list_a[i]-list_a[i-1])
list_memo.append(-list_a[n-1])
ans_pre = 0
for i in range(0,n+1):
    ans_pre += abs(list_memo[i])
for i in range(0,n):
    ans = ans_pre - abs(list_memo[i]) - abs(list_memo[i+1]) + abs(list_memo[i] + list_memo[i+1])
    print(ans)


Measured memory_bytes: 14176
import math

X,Y = map(int,input().split())
sw = 0

kaa = math.ceil(Y/2)

for i in range(0,kaa+1):
    t_asi = i*2
    k_asi = Y- t_asi
    
    if (i+k_asi/4 == X):
        print('Yes')
        sw += 1
        break


if (sw == 0):
    print('No')

    

Measured memory_bytes: 9132
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}


int main(){
    string s;
    cin >> s;
    ll ans=0;
    for (int bit = 0; bit < (1<<(s.size()-1));bit++){
        ll count=s[0]-'0';
        for (ll i=1;i<s.size();i++){
            if (bit & (1<<(i-1))){
                count=count*10+(s[i]-'0');
            }else{
                ans+=count;
                count=s[i]-'0';
            }
        }
        ans+=count;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    weather = input()
    if weather == 'RRR':
        return 3
    elif weather == 'SRR':
        return 2
    elif weather == 'RSR':
        return 1
    elif weather == 'RRS':
        return 2
    elif weather == 'SSS':
        return 0
    else:
        return 1


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 9100
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    dp=[0]*(k+1)
    for i in range(k):
        if dp[i]: continue
        for j in range(n):
            if i+A[j]<=k: dp[i+A[j]]=1
    print("First" if dp[k] else "Second")
resolve()

Measured memory_bytes: 40432
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;


string s,t;
ll Q;
ll rui_s[100100],rui_t[100100];
int main(){
  cin >> s >> t;
  cin >> Q;
  ll l = s.size();
  rep(i,l){
    if(s[i] == 'A') rui_s[i+1]++;
    else rui_s[i+1] += 2;
    rui_s[i+1] += rui_s[i];
    cerr << rui_s[i] << endl;
  }
  cerr << rui_s[l] << endl;
  rep(i,t.size()){
    if(t[i] == 'A') rui_t[i+1]++;
    else rui_t[i+1] += 2;
    rui_t[i+1] += rui_t[i];
    cerr << rui_t[i] << endl;
  }
  cerr << rui_t[t.size()] << endl;
  rep(i,Q){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    a--;c--;
    ll tmpa = rui_s[b] - rui_s[a];
    ll tmpb = rui_t[d] - rui_t[c];
    cerr << tmpa << " " << tmpb << endl;
    if(tmpa % 3 == tmpb%3){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>

using namespace std;

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

int main() {

	int N;
	cin >> N;

	vector<int> A(N);
	cin >> A;

	int count = 0;
	bool isOdd = false;

	for (const auto& i : A)
	{
		if (i % 2 == 1) isOdd = true;
	}

	while (!isOdd)
	{
		for (auto& i : A)
		{
			i /= 2;
		}

		count++;

		for (const auto& i : A)
		{
			if (i % 2 == 1) isOdd = true;
		}
	}

	cout << count << endl;

	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if((b-1)%(a-1) != 0) cout << (b-1)/(a-1)+1;
    else cout << (b-1)/(a-1);
}


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

class data{
public:
  int number;
  double time;
  bool operator < (const data &s)const{
    return time<s.time;
  }
};

int main(){
  data input[3][8];
  data ans[8];
  data in[18];
  for(int i=0;i<3;i++){
    for(int j=0;j<8;j++){
      cin >> input[i][j].number >> input[i][j].time;
    }
  }

  for(int i=0;i<3;i++){
    sort(input[i], input[i]+8);
  }

  ans[0]=input[0][0];
  ans[1]=input[0][1];
  ans[2]=input[1][0];
  ans[3]=input[1][1];
  ans[4]=input[2][0];
  ans[5]=input[2][1];
  int k=0;
  for(int i=0;i<3;i++){
    for(int j=2;j<8;j++){
      in[k]=input[i][j];
      k++;
    }
  }

  sort(in, in+18);

  ans[6]=in[0];
  ans[7]=in[1];

  for(int i=0;i<8;i++){
    printf("%d %.2f\n", ans[i].number, ans[i].time);
  }

  return 0;
}

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

#define int long long
#define fs first
#define sc second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define len(v) ((int)v.size())
#define vc vector
#define pr pair
#define endl "\n"
#define endd "\n"; return 0;
#define all(v) v.begin(), v.end()

using namespace std;

const int MAXN = 1e5;
const int INF = 1e18;
const int MOD = 1e9 + 7;

vc<pr<int, int>> g[MAXN];

int n;

pr<int, int> maxx[MAXN];

void dfs(int v1, int summ){
    if (summ >= INF){
        maxx[v1].sc = n + 1;
    }
    for (auto v : g[v1]){
        if (maxx[v.fs].sc > n){
        }
        else{
            if (maxx[v.fs].sc == n || summ == INF){
                maxx[v.fs].fs = INF;
                maxx[v.fs].sc++;
                dfs(v.fs, INF);
            }
            else{
                if (maxx[v.fs].fs < summ + v.sc){
                    maxx[v.fs].fs = summ + v.sc;
                    maxx[v.fs].sc++;
                    dfs(v.fs, maxx[v.fs].fs);
                }
            }
        }
    }
}

main() {
    ios_base::sync_with_stdio(0);
    int m;
    cin >> n >> m;
    for (int i = 0; i < m; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        g[a].pb(mp(b, c));
    }
    for (int i = 0; i < n; i++){
        maxx[i] = mp(-INF, 0);
    }
    n += 2;
    dfs(0, 0);
    n -= 2;
    if (maxx[n - 1].fs == INF){
        cout << "inf";
    }
    else{
        cout << maxx[n - 1].fs;
    }
}


Measured memory_bytes: 49664