akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[]str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		long D = long.Parse(str[1]);
		int ans = 0;
		for(var i=0;i<N;i++){
			string[]str2 = Console.ReadLine().Split();
			long a1 = long.Parse(str2[0]);
			long a2 = long.Parse(str2[1]);
			if(a1*a1+a2*a2<=D*D){
				ans++;
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 21876
#!usr/bin/env python3

import sys


def generate_buidlings_with_residents(building, floor, room):
    buildings = {
        key: [[0 for col in range(room)] for row in range(floor)]
        for key in range(1, building+1)
    }

    n = int(sys.stdin.readline())
    for i in range(n):
        lst = [int(num) for num in sys.stdin.readline().split()]
        buildings[lst[0]][lst[1]-1][lst[2]-1] += lst[3]

    return buildings


def print_buildings():
    separator = '####################'
    buildings_with_residents = generate_buidlings_with_residents(4, 3, 10)

    for idx, (key, value) in enumerate(buildings_with_residents.items()):
        for floor in value:
            print(' %s %s %s %s %s %s %s %s %s %s' % tuple(floor))
        if key < len(buildings_with_residents):
            print(separator)


def main():
    print_buildings()


if __name__ == '__main__':
    main()

Measured memory_bytes: 7720
n,m =map(int, input().split())
A = list(map(int, input().split()))

total = sum(A)
border = total / (4*m)
count = 0

for i in range(n):
    if A[i] >= border:
        count += 1

ans = "Yes"
if count < m:
    ans = "No"

print(ans)

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

signed main() {
    int n;
    while (cin >> n) {
        vector<int> a(n);
        rep(i, n) cin >> a[i];
        int ans = 0;
        int X = 0, S = 0;
        int r = 0;
        rep(l, n) {
            if (l == r) X ^= a[r], S += a[r], ++r;
            while (r < n && X == S) {
                X ^= a[r], S += a[r], ++r;
            }
            if (X != S) --r, X ^= a[r], S -= a[r];
            ans += r - l;
            X ^= a[l], S -= a[l];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N;
	cin>>N;
	int c=0;
	rep(i,N){
		int a;
		cin>>a;
		if(a%2==1) c++;
	}
	if(c%2==0) puts("YES");
	else puts("NO");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define Mid ((l+r)>>1)
#define lson rt<<1,l,Mid
#define rson rt<<1|1,Mid+1,r
int sum[100005 << 2];

void build(int rt, int l, int r)
{
	if (l == r)sum[rt] = 0;
	else {
		build(lson);
		build(rson);
		sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
	}
}

void updata(int rt, int l, int r, int pos, int num)
{
	if (l == r && r == pos)sum[rt] += num;
	else{
		if (pos <= Mid)updata(lson, pos, num);
		else updata(rson, pos, num);
		sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
	}
}

int query(int rt, int l, int r, int L, int R){
	if (l >= L && r <= R)return sum[rt];
	else{
		int tmp = 0;
		if (L <= Mid)tmp += query(lson, L, R);
		if (R > Mid)tmp += query(rson, L, R);
		return tmp;
	}
}

int main(){
	int n, q, ch, x, y;
    scanf("%d %d", &n, &q);
    build(1,1,n);
	while (q--){
	    scanf("%d%d%d", &ch, &x, &y);
	    if (ch)printf("%d\n", query(1, 1, n, x, y));
	    else updata(1, 1, n, x, y);
	}
	return 0;
}


Measured memory_bytes: 4200
//Factors of Factorial
//AC-2286
//1000!=4023872600770937735
#include<iostream>
#include<map>
using namespace std;
map<int,int>a;
int main()
{
	int n;
	long long ans=1;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		a[i]=i+1;
	}
	for(int i=2;i<=n;i++)
	{
		int cnt=0;
		for(int j=0;j<n;j++)
		{
			while(a[j]%i==0)
			{
				a[j]/=i;
				cnt++;
			}
		}
		ans=(ans*(cnt+1))%1000000007;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000001;

int main() {
  int h, w, n;
  cin >> h >> w;
  cin >> n;
  int c[h * w];
  int num;
  int idx = 0;
  int color = 1;

  for (int i = 0; i < n; i++) {
    cin >> num;
    for (int j = 0; j < num; j++) {
      c[idx + j] = color;
    }
    idx += num;
    color++;
  }

  // for (int i = 0; i < h * w; i++) {
  //   cerr << c[i] << " ";
  // }
  // cerr << endl;

  for (int i = 0; i < h; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < w; j++) {  //そのまま
        cout << c[i * w + j] << " ";
      }
    } else {
      for (int j = w - 1; j >= 0; j--) {  //逆にする
        cout << c[i * w + j] << " ";
      }
    }
    cout << endl;
  }

  return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    
    string text;
    cin>>text;
    
    if(text == "ABC")
        cout<<"ARC";
    else if(text == "ARC")
        cout<<"ABC";
   return 0;
}

Measured memory_bytes: 3564
package main

import (
	"fmt"
)

func main() {


	var N int

	fmt.Scan(&N)

	a:= SliceInt(N)


	for i:=0;i<N;i++{

		fmt.Scan(&a[i])
	}

	temp :=0

	cnt :=0

	index :=0

	for{

		temp =  a[index] 
		cnt++

		if temp ==2{

			fmt.Println(cnt)
			return
		}

		index = temp-1
		
		if cnt >= N+1{

			fmt.Println(-1)
			return
		}
	}
}

//SliceInt 引数サイズのSliceを返す
func SliceInt(a int) []int {

	IntSample := make([]int, a)

	return IntSample

}

Measured memory_bytes: 5504
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(),a=sc.nextInt(),b=sc.nextInt();
		int max = Math.min(a, b);
		int min=0;
		if(n<a+b) {
			min = a+b-n;
		}
		System.out.println(max + " " +min);
	}
	public static int floor(int n) {
		return (int)Math.floor((n*n + 4.0)/8.0);
	}

}


Measured memory_bytes: 23508
import sys
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
 
N = II()
A = LI()
 
from collections import Counter
S = Counter(A)
result = sum(list(map(lambda x: int(x*(x-1)/2), S.values())))
 
for a in A:
 n = S[a]
 print(result-n+1)

Measured memory_bytes: 25456
a,b,c,d=map(int,input().split())

ans=[0]*101
for i in range(a,b):
    ans[i]+=1
for i in range(c,d):
    ans[i]+=1
    
kai=0
for i in range(101):
    if ans[i]==2:
        kai+=1
print(kai)

Measured memory_bytes: 3060
#include <stdio.h>

int gcd(int,int);

int main()
{
    int x,y,d;
    scanf("%d%d",&x,&y);
    d = gcd(x,y);
    printf("%d\n",d);
    

    return 0;
}

int gcd(int x,int y)
{
    int a;
    if( x<y ){
        a = x;
        x = y;
        y = a;
    }
    a = x%y;
    while( a!=0 ){
        x = y;
        y = a;
        a = x%y;
    }

    return y;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3f
#define LL long long
#define FOR(i,j,k) for(LL (i) = j;(i) <= (k);i++)
using namespace std;
const LL MaN=1e5+10;
LL N,X,M,Ans;
LL Loc[MaN],Pre[MaN];
signed main() {
    cin>>N>>X>>M;
    Ans+=X;
    Pre[1]=X; 
    Loc[X]=1;
    LL Sta=INF;
    FOR(i,2,N) {
        X=X*X%M;
        Pre[i]=Pre[i-1]+X;
        Ans+=X;
        if(Loc[X]) { 
			LL Len=i-Loc[X]; 
			Ans+=(N-i)/Len*(Pre[i]-Pre[Loc[X]]); 
			Sta = N - ( N - i ) % Len+1; 
			break; 
		}
        else Loc[X]=i;
    }
    FOR(i,Sta,N) {
        X = X * X % M;
        Ans += X;
    }
    cout << Ans << endl;
    return 0;
}

Measured memory_bytes: 4684
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef long double ld;
const ld pi = 4*atan((ld)1);
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll nax = 0;

ll l, r, d;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin >> l >> r >> d;
	ll ret1 = l / d;
	if(l % d != 0){
		ret1++;
	}
	ll ret2 = r / d;
	cout << ret2 - ret1 + 1 << '\n';
	
}



Measured memory_bytes: 3636
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll rui[ohara], tatek[100], tatea[100], dp[100][5];

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

  cnt = 2;
  rui[0] = 1;
  rrep(i, 1, 46) {
    rui[i] = cnt;
    cnt *= 2;
  }

  cin >> n >> k;
  ll st = 0;
  rep(i, n) {
    cin >> a[i];
    tmp = a[i];
    while (1) {
      rrrep(i, 45, 0) {
        if (rui[i] <= tmp) {
          tmp -= rui[i];
          tatea[i + 1]++;
          st = max(st, i + 1);
        }
      }
      if (tmp == 0) break;
    }
  }
  tmp = k;
  while (1) {
    rrrep(i, 45, 0) {
      if (rui[i] <= tmp) {
        tmp -= rui[i];
        tatek[i + 1]++;
        st = max(st, i + 1);
      }
    }
    if (tmp == 0) break;
  }

  rep(i, 80) rep(j, 4) dp[i][j] = -1;
  dp[0][0] = 1;

  rrep(i, 0, 46) {
    if (st - i <= 0) break;
    if (tatek[st - i] == 1) {
      dp[i][1] = tatea[st - i] * rui[st - i - 1];
      if (i >= 1) dp[i][1] += dp[i - 1][0];
    }
    if (dp[i - 1][1] != -1 && i >= 1) {
      ll cost = max(tatea[st - i], n - tatea[st - i]) * rui[st - i - 1];
      if (i >= 1) cost += dp[i - 1][1];
      dp[i][1] = max(cost, dp[i][1]);
    }
    dp[i][0] = dp[i - 1][0] +
               (tatek[st - i] == 1 ? (n - tatea[st - i]) : tatea[st - i]) *
                   rui[st - i - 1];
    ans = max(dp[i][0], dp[i][1]);
    //cout << dp[i][0] << " " << dp[i][1] << " " << i << "\n";
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 4352
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = INT()
print(N**2-A)

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

int main(){
	int a, b;
  	cin >> a >> b;
  	int c = 1;
    while(c <= b){
      c = c * 10;
    }
  	a = a * c + b;
  	
  	int  d = sqrt(a) ;
  	if(a == d*d){
    	cout << "Yes" << endl;
    }
  	else{
    	cout << "No" << endl;
    }
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


int main(){
  string S; cin >> S;

  vector <int> cnt;
  for (int i = 1; i < S.length(); i++){
    if (S[i] != S[i - 1]){
      cnt.push_back(i);
    }
  }

  int ans = S.length();
  for (int i = 0; i < cnt.size(); i++){
    int L = S.length();
    int now = max(cnt[i], L - cnt[i]);
    ans = min(now, ans);
  }
  cout << ans << endl;

  

  return 0;
}


Measured memory_bytes: 768
// created by mtnshh
 
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"--------------------------"<<endl; 
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e18;
#define PI 3.14159265
 
const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s,t;
    cin>>s>>t;
    ll n = s.length();
    ll ans=0;
    rep(i,0,n){
    	if(s[i]!=t[i])	ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define sort(a) sort((a).begin(),(a).end())
#define rev(a) reverse((a).begin(),(a).end())
using db = double;
using namespace std;
typedef long long ll;

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



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import heapq as hq
n, m = map(int, input().split())

jobs = [[] for _ in range(m+1)]

for _ in range(n):
    a, b = map(int, input().split())
    if a > m:
        continue
    hq.heappush(jobs[a], -b)

pay = 0
work_cand = []
for i in range(m + 1):
    add_jobs = jobs[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            hq.heappush(work_cand, j)

    if len(work_cand) == 0:
        continue

    pay -= hq.heappop(work_cand)

print(pay)


Measured memory_bytes: 17604
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); 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; }

#define MOD 1000000007

ll modpow(ll n, ll times) {
	ll ans = 1;
	if(times == 1) return n;
	if(times % 2 == 0) {
		ll t = modpow(n, times/2);
		t *= t;
		t %= MOD;
		return t;
	}
	else  {
		ll t = modpow(n,(times-1)/2);
		t *= t;
		t %= MOD;
		t *= n;
		t %= MOD;
		return t;
	}
}


int main() {
	ll x,y;
	cin >> x >> y;
	ll ans;
	ll t,s;
	if((x+y) % 3 != 0) {
		ans = 0; 
	}
	else if(x > y*2 || x*2 < y) {
		ans = 0;
	}
	else {
		t = abs(x-y);
		s = (x+y)/3;
		//sC(s-t)/2
		ans = 1;
		for(int i=s; i>=1; i--) {
			ans *= i;
			ans %= MOD;
			//cout << ans << endl;
		}
		ll temp=1;
		for(int i=(s-t)/2; i>=1; i--) {
			temp *= i;
			temp %= MOD;
			//cout << temp << endl;
		}
		for(int i=(s-(s-t)/2); i>=1; i--) {
			temp *= i;
			temp %= MOD;
			//cout << temp << endl;
		}
		
		ll temp2 = modpow(temp,MOD-2);
		ans *= temp2;
		ans %= MOD;
	}
	cout << ans << endl;
	

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> &a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
template<class T>void prArr(T a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

string s;
int dfs(int idx, int cnt){
  if(idx == (int)s.size()) return cnt == 4;
  if(cnt > 4) return 0;
  
  int res = 0;
  string val;
  int len = 0;
  for(int i=idx;i<(int)s.size();i++){
    if(len++ > 5) break; 
    val += s[i];
    if(val == "0") {res += dfs(i+1, cnt+1); break;}
    if(1 <= stoi(val) && stoi(val) <= 255) res += dfs(i+1, cnt + 1);
  }
  return res;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin>>s;

  int ans = dfs(0, 0);
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
 int n; 
 string s,t;
 cin >> n >> s >> t;
 for(int i=0; i<n; i++){
   cout << s.at(i) << t.at(i);
 }
 cout << endl;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int tc; cin>>tc; while(tc--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n, t;
    string s;
    cin>> n;

    vector < std::tuple < string, int, int > > v;

    for(int i=0; i<n; i++)
    {
        cin>> s>> t;
        v.push_back(std::tuple<string,int,int>(s, 100- t, i+1));
    }

    sort (v.begin(), v.end());

    for ( const auto& i : v )
        cout << get<2>(i) << '\n';
    


    return 0;
}




Measured memory_bytes: 3568
#include<stdio.h>

int main(void) {
	unsigned int lunch = 0, din = 0, mid = 0;
	unsigned int al, ad, am;
	unsigned int hh, mm, min, tmp;
	unsigned int n, i, j;
	while(scanf("%u", &n) && n>0) {
		lunch = din = mid = 0;
		al = ad = am = 0;
		for(i = 0; i < n; i++) {
			scanf("%u:%u %u", &hh, &mm, &min);
			if(hh >= 11 && hh <= 14) al++;
			else if(hh >= 18 && hh <= 20) ad++;
			else if(hh >= 21 || hh <= 1) am++;
			tmp = (mm > min) ? min + 60 - mm : min - mm;
			if(tmp > 8) continue;
			if(hh >= 11 && hh <= 14) lunch++;
			else if(hh >= 18 && hh <= 20) din++;
			else if(hh >= 21 || hh <= 1) mid++;
		}
		printf("lunch ");
		if(al == 0) puts("no guest");
		else printf("%u\n", lunch * 100 / al);
		printf("dinner ");
		if(ad == 0) puts("no guest");
		else printf("%u\n", din * 100 / ad);
		printf("midnight ");
		if(am == 0) puts("no guest");
		else printf("%u\n", mid * 100 / am);
	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);

  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  sort(d.begin(),d.end());
  int cnt=1;
  for (int i = 0; i < N-1; i++) {
    if(d.at(i)==d.at(i+1)) continue;
    cnt++;
  }
  cout << cnt << endl;
}


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

#define INF 999999999

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

int lcm(int x, int y) {
	return x*y / gcd(x, y);
}
vector<pair<int, int> > mt;
vector<vector<int> > in_list;
vector<int> inside; //x番目のマトリョーシカに入る最大のマトリョーシカの数

int solve(int x) {
	if (inside[x] != -1)return inside[x];
	if (in_list[x].empty()) {
		inside[x] = 0;
		return inside[x];
	}
	int m = -1;
	for (int i = 0; i < in_list[x].size(); i++) {
		m = max(m, solve(in_list[x][i]));
	}
	inside[x] = m + 1;
	return inside[x];
}


int main() {
	while (1) {
		mt.clear();
		int n, m;
		cin >> n;
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			int h, r;
			cin >> h >> r;
			mt.push_back({ h,r });
		}
		cin >> m;
		for (int i = 0; i < m; i++) {
			int h, r;
			cin >> h >> r;
			mt.push_back({ h,r });
		}
		in_list = vector<vector<int> >(m + n, vector<int>());
		inside = vector<int>(m + n, -1);
		for (int i = 0; i < m + n; i++) {
			for (int j = 0; j < m + n; j++) {
				if (mt[i].first > mt[j].first && mt[i].second > mt[j].second) {
					in_list[i].push_back(j);
				}
			}
		}
		for (int i = 0; i < m + n; i++)solve(i);
		cout << *max_element(inside.begin(), inside.end()) + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }

int main() {
    ll n, y;
    cin >> n >> y;
    for (ll i=0; i<(n+1); i++){
        for (ll j=0; j<(n+1); j++){
            ll k = n - i - j;
            if (k<0) continue;
            ll sum = 10000*i + 5000*j + 1000*k;
            if (sum == y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

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

typedef long long ll;

int main() {
	ll n;
	ll a[200005];
	
	scanf("%lld", &n);
	for (ll i = 0; i < n; i++) {
		ll buf;
		scanf("%lld", &buf);
		a[i + 1] = buf; // 1 -- n
	}
	
	ll ans = 0;
	a[0] = a[1];
	for (ll i = 1; i <= n; i++) {
		if (a[i] < a[i - 1]) {
			ll step = a[i - 1] - a[i];
			ans += step; // 前の人に追いつく
			a[i] += step;
		}
	}
	printf("%lld", ans);
	
	
	return 0;
	}


Measured memory_bytes: 3292
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N, cnt = 0; cin >>N;
  bool f = true;
  REP(i, N){
    char c;
    int n;
    cin >>c >>n;
    if(c == '(') cnt += n;
    else cnt -= n;
    if(cnt < 0) f = false;
  }
  cout <<(f && cnt == 0 ? "YES" : "NO") <<endl;

  
  return 0;
}

Measured memory_bytes: 1160
N = int(input())

if N == 1:
  print(0)
  exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def p_num(m):
  ret = 0
  for j in range(1,10**12):
    ret += j
    if ret <= m < ret+(j+1):
      ans = j
      break
  return ans

p = factorization(N)

cnt = 0
for k in range(len(p)):
  cnt += p_num(p[k][1])
print(cnt)

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;
    cout << (N - 2) * 180 << endl;
    return 0;
}



Measured memory_bytes: 3632
import java.util.Scanner;

/**
 * Knight
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int X = sc.nextInt();
            int Y = sc.nextInt();

            if ((X + Y) % 3 != 0) {
                System.out.println(0);
                return;
            }

            int k = (X + Y) / 3;
            int i = 2 * k - X;
            int j = 2 * k - Y;

            if (i < 0 || j < 0) {
                System.out.println(0);
                return;
            }

            long ans = combination(k, i, 1000000007);

            System.out.println(ans);
        }
    }

    public static long combination(int N, int K, long MOD) {
        long factN = 1, factK = 1, factM = 1;
        for (int i = 1; i <= N; i++) {
            factN = factN * i % MOD;

            if (i == K) {
                factK = factN;
            }
            if (i == N - K) {
                factM = factN;
            }
        }

        long comb = factN;
        long m = MOD - 2;
        while (m > 0) {
            if (m % 2 == 1) {
                comb = comb * factK % MOD;
                comb = comb * factM % MOD;
                m--;
            }

            factK = factK * factK % MOD;
            factM = factM * factM % MOD;
            m = m / 2;
        }

        return comb;
    }

}


Measured memory_bytes: 23252
#include <stdio.h>

void swap(int *a, int *b)
{
  int tmp;

  tmp = *a;
  *a = *b;
  *b = tmp;
}

int main()
{
  int i;
  int w, n;
  int a, b;
  int lots[31];

  for (i = 0; i < sizeof(lots)/sizeof(int); i++) {
    lots[i] = i;
  }

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

  for (i = 0; i < n; i++) {
    scanf("%d,%d", &a, &b);
    swap(&lots[a], &lots[b]);
  }

  for (i = 1; i <=w; i++) {
    printf("%d\n", lots[i]);
  }

  return 0;
}



Measured memory_bytes: 2100
import numpy as np
from time import time
from random import randint, random
from math import exp
from copy import copy

def transition(state, param_span):
    index = randint(0, len(state)-1)
    new_state = copy(state)
    new_state[index] = randint(param_span[0], param_span[1])
    return new_state

def score_func(state):
    last = np.zeros(N)
    score = 0
    for i in range(D):
        t = state[i]
        score += S[i, t-1] - (C*(i+1-last)).sum()
        last[t-1] = i+1
    return int(score)

D = int(input())
C = np.array(list(map(int, input().split())))
N = 26
S = np.zeros([D, N])

last = np.zeros(26)
T = []

for i in range(D):
    if i == 0:
        score = S[i, :]
    else:
        score = S[i, :] + temp
    argmax = score.argmax()
    t = argmax+1
    last[t-1] = i+1
    T.append(t)
    temp = (i+1-last)*np.array(C)

def climbing(init_state, transition, score_func, param_span, time_limit=1.5, maximize=True):
    start = time()
    state = copy(init_state)
    while True:
        if time() - start > time_limit: break
        prev_score = score_func(state)
        new_state = transition(state, param_span)
        new_score = score_func(new_state)
        
        if new_score > prev_score:
            state = new_state
            
    return state

new_T = climbing(T, transition, score_func, [1, N], time_limit=1.8)

for i in range(D):
  print(new_T[i])

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  vector<ll> a(n);
  for (ll i = 0; i < k; ++i) {
    ll d;
    cin >> d;

    for (ll i = 0; i < d; ++i) {
      ll ai;
      cin >> ai;
      ai--;
      a[ai]++;
    }
  }

  ll ans = 0;
  each(i, a) {
    if (i == 0) ++ans;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(long long N) {
  map<int, int> divides;
  for (int n = 2; n <= N; n++) {
    int tmpn = n;
    for (int i = 2; i <= n; i++) {
      int cnt = 0;
      while (tmpn % i == 0 && tmpn != 1) {
        cnt++;
        tmpn /= i;
      }
      divides[i] += cnt;
    }
  }

  vi over75;
  vi over25;
  vi over15;
  vi over5;
  vi over3;
  for (auto div : divides) {
    if (div.second >= 74) {
      over75.pb(div.first);
    }
    if (div.second >= 24) {
      over25.pb(div.first);
    }
    if (div.second >= 14) {
      over15.pb(div.first);
    }
    if (div.second >= 4) {
      over5.pb(div.first);
    }
    if (div.second >= 2) {
      over3.pb(div.first);
    }
  }

  int ans = over75.size();
  for (auto i : over25) {
    for (auto j : over3) {
      if (i != j) {
        ans++;
      }
    }
  }
  for (auto i : over15) {
    for (auto j : over5) {
      if (i != j) {
        ans++;
      }
    }
  }
  for (auto i : over3) {
    for (auto j : over5) {
      for (auto k : over5) {
        if (i != j && i != k && j < k) {
          ans++;
        }
      }
    }
  }

  print(ans);
}

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

ll dp[3010]={};

const ll MAX = 200010;//設定して

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;//＊１
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int h,w,n;cin>>h>>w>>n;
  COMinit();
  V<PL> v(n);
  rep(i,0,n){
    cin>>v[i].fs>>v[i].sc;
    v[i].fs--;
    v[i].sc--;
  }
  v.eb(h-1,w-1);

  sort(all(v));

  rep(i,0,n+1){
    ll res=COM(v[i].fs+v[i].sc,v[i].fs);

    rep(j,0,i){
      res+=mod-((dp[j]*COM(v[i].fs+v[i].sc-v[j].fs-v[j].sc,v[i].fs-v[j].fs))%mod);
      res%=mod;
    }
    dp[i]=res;
  }

  cout<<dp[n]<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 5120
S = list(input())
N = len(S)

#one = S.count("1")
#zero = S.count("0")

odd = S[::2]
cnt1 = odd.count("1")

even = S[1::2]
cnt2 = even.count("0")

sum1 = N - cnt1 - cnt2
sum2 = cnt1 + cnt2
print(min(sum1,sum2))

Measured memory_bytes: 4652
import copy
y,x = list(map(int, input().split()))
Z = [list(map(int, input().split())) for _ in range(y)]

way = 1
a, b = 0, 0
ans = []
count = 0
while a < y and b < x:
    now = Z[a][b]
    a_copy= copy.deepcopy(a)
    b_copy = copy.deepcopy(b)

    if (way == 1 and a < y-1) or (way == -1 and a > 0):
        a += way
    else:
        b += 1
        way = way*(-1)
    if not (a < y and b < x):
        break
    if now % 2 == 1:
        Z[a][b] += 1
        ans.append([a_copy, b_copy, a, b])
        count += 1

print(count)
for i in ans:
    k = [j+1 for j in i]
    print(" ".join(list(map(str, k))))

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

int main() {
  int k;
  cin >> k;
  int x = 7%k;
  for (int i = 1; i <= k; ++i){
  	if(x == 0) {
      cout << i << endl;
      return 0;
    }
    x = (x*10+7)%k;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		for(int i=0; i<n; i++){
			double x1 = stdIn.nextDouble();
			double y1 = stdIn.nextDouble();
			double x2 = stdIn.nextDouble();	
			double y2 = stdIn.nextDouble();
			double x3 = stdIn.nextDouble();	
			double y3 = stdIn.nextDouble();
			double x4 = stdIn.nextDouble();	
			double y4 = stdIn.nextDouble();
			
			double det = (x2-x1)*(y4-y3)-(x4-x3)*(y2-y1);
			
			if(det==0)
				System.out.println("YES");
			else
				System.out.println("NO");			
		}
		

	}

}

Measured memory_bytes: 12000
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
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;}


/*
連結成分はUnionFind
クラスカル法による最小全域木

まず道路について最小全域木を作成、UnionFindした後改めて
各連結成分内で鉄道最小全域木を作成
*/
const int MAX_V = 2 * 1e5; 

int par[MAX_V], par2[MAX_V];
int rk[MAX_V];

void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rk[i] = 1;
    }
}
int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return find(par[x]);
    }
}
int find2(int x) {
    if (par2[x] == x) {
        return x;
    } else {
        return find2(par2[x]);
    }
}
void unite(int x, int y){
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rk[x] < rk[y]) {
        par[x] = y;
        rk[y] += rk[x];
    } else {
        par[y] = x;
        rk[x] += rk[y];
    }
}
bool same(int x, int y) {
    return find(x) == find(y);
}
struct edge {
    int u, v, cost;
    edge() {}
    edge(int uu, int vv, int cc) : u(uu), v(vv), cost(cc) {}
};
bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

edge es[MAX_V];
int V, E;

int kruskal() {
    sort(es, es + E, comp);
    init(V);
    int res = 0;
    for (int i = 0; i < E; i++) {
        edge e = es[i];
        if (!same(e.u, e.v)) {
            unite(e.u,e.v);
            res += e.cost;
        }
    }
    return res;
}

map<pair<int, int>, int> mp;

int main() {
    int N; cin >> N; V = N;
    int K, L; cin >> K >> L;
    E = K;
    for (int i = 0; i < K; i++) {
        int p, q; cin >> p >> q;
        es[i] = edge(p-1,q-1,0);
    }    
    kruskal();
    for (int i = 0; i < V; i++) par2[i] = par[i];
    E = L;
    for (int i = 0; i < L; i++) {
        int r, s; cin >> r >> s;
        es[i] = edge(r-1,s-1,0);
    }
    kruskal();
    for (int i = 0; i < N; i++) mp[make_pair(find(i),find2(i))]++;
    for (int i = 0; i < N; i++) {
        cout << mp[make_pair(find(i),find2(i))] << " ";
    } cout << endl;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    a--;
    b--;
    c--;
    d--;
    bool ans = true;
    int stone = 0, block = 0;
    int ma = 0;
    if (c < d)
    {
        for (int i = a; i < d; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
            {
                ans = false;
                break;
            }
        }
    }
    else
    {
        for (int i = 0; i < c; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
            {
                ans = false;
                break;
            }
        }
        bool re = false;
        for (int i = b; i <= d; i++)
        {
            if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')
            {
                re = true;
                break;
            }
        }
        if (!re)
            ans = false;
    }
    cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
char a[10],b[10];
int ans;
int main()
{
	gets(a);
	gets(b);
	for(int i=0;i<3;i++)
		if(a[i]==b[i])
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;

class Union_Find {
private:
	vi p, r;
	int find(int x) {
		if (p[x] == x) return x;
		else return p[x] = find(p[x]);
	}
public:
	Union_Find(int N) {
		p.resize(N);
		r.resize(N);
		Loop(i, N) {
			p[i] = i;
			r[i] = 0;
		}
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (r[x] < r[y]) p[x] = y;
		else {
			p[y] = x;
			if (r[x] == r[y]) r[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};


int main() {
	int n, q; cin >> n >> q;
	Union_Find uf(n);
	Loop(i, q) {
		int com, x, y; cin >> com >> x >> y;
		if (com == 0) {
			uf.unite(x, y);
		}
		else {
			cout << uf.same(x, y) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>

using namespace std;

int main() {
	int a;
	cin >> a;
	int b[a];
	int c[a];
	int ans = 0;
	for (int i = 0;i < a;i++) {
		cin >> b[i];
		c[i] = b[i];
	}
	for (int i = 0;i < a - 1;i++) {
		if (b[i] == i + 1) {
			ans++;
			b[i + 1] = b[i];
		}
	}
	if (b[a - 1]== a) {ans++;}
	cout << ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
#define pb push_back
#define eb emplace_back
const  int MAX=1000000;

int main()
{
   ll t;

   t=1;

   while(t--)
   {
     ll n,k;

     cin>>n;


     ll ara[n+1];

     ll sum=0;
         map<ll,ll>m;

     for(ll i=1;i<=n;i++)
     {
         cin>>ara[i];

         sum+=ara[i];
         m[ara[i]]++;
     }


   //  cout<<sum<<endl;

     ll q;

     cin>>q;





     while(q--)
     {

         ll a,b;

         cin>>a>>b;

        ll pre=m[a]*a;
        ll add=m[a]*b;

          m[b]+=m[a];
           m[a]=0;

        sum+=add-pre;

        cout<<sum<<endl;



     }






   }

    }











Measured memory_bytes: 10320
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

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

ll divll(ll x, ll y){
    x %= mod;
    return (x * powll(y,mod-2)) % mod;
}

int main() {
    ll x, y;
    cin >> x >> y;
    ll s = x + y;
    if (s % 3){
        cout << 0 << endl;
        return 0;
    }
    s /= 3;
    if (x < s || y < s){
        cout << 0 << endl;
        return 0;
    }
    x -= s;
    y -= s;

    ll a = 1, b = 1;
    FOR(p,1,x){
        a = (a * (x + y + 1 - p)) % mod;
        b = (b * p) % mod;
    }
    ll ans = divll(a, b);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>
#include <sstream>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

int main()
{
  //std::cin.tie(nullptr);
  //std::ios::sync_with_stdio(false);

  //std::istringstream iss("2 3 1  1 1  1 2  2 2  1 2");
  //std::cin.rdbuf(iss.rdbuf());

  const ll MAX_N = 500;
  ll N, M, Q;
  std::cin >> N >> M >> Q;

  std::vector< ll > vl(M+1, 0LL);
  std::vector< ll > vr(M+1, 0LL);
  std::vector< std::vector<ll> > vvx(MAX_N+1, std::vector<ll>(MAX_N+1, 0LL));
  for (ll i = 0; i < M; i++) {
    std::cin >> vl[i] >> vr[i];
    vl[i]--; vr[i]--;
    vvx[vl[i]][vr[i]]++;
  }

  std::vector< std::vector<ll> > vvc(MAX_N+1, std::vector<ll>(MAX_N+1, 0LL));
  for (ll l = 0; l < N; l++) {
    vvc[l][0] += vvx[l][0];
    for (ll r = 1; r < N; r++) {
      vvc[l][r] = vvc[l][r-1] + vvx[l][r];
    }
  }

  for (ll i = 0; i < Q; i++) {
    ll p, q;
    std::cin >> p >> q;
    p--; q--;
    ll sum = 0LL;
    for (ll l = p; l <= q; l++) {
      ll bottom = (p == 0) ? 0 : vvc[l][p-1];
      sum += vvc[l][q] - bottom;
      //print(l, sum);
    }
    print(sum);
    //print("----");
  }

  return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=1<<18,INF=1<<30;

int main(){
    
    int N,M;cin>>N>>M;
    vector<int> X(N),cnt(M);
    map<int,int> MA;
    for(int i=0;i<N;i++){
        cin>>X[i];
        cnt[X[i]%M]++;
        MA[X[i]]++;
    }
    int ans=0;
    for(int i=0;i<M;i++){
        if(i==0){
            ans+=cnt[i]/2;
            cnt[i]%=2;
        }else if(i+i==M){
            ans+=cnt[i]/2;
            cnt[i]%=2;
        }else{
            int a=min(cnt[i],cnt[M-i]);
            ans+=a;
            cnt[i]-=a;cnt[M-i]-=a;
            
            for(int j=i;j<=100000;j+=M){
                if(MA[j]>=2){
                    ans+=min(cnt[i],MA[j])/2;
                    cnt[i]-=min(cnt[i],MA[j])/2*2;
                }
            }
            
        }
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 5760