akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    int wrong = 0;
    rep(i, n) {
        cin >> p[i];
        if (p[i] != i+1) wrong++;
    }
    if (wrong == 0 or wrong == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n;
    cin >> n;
    vector<ll> vll(n);
    REP(i, n)
    cin >> vll[i];
    REP(i,n){
        if(vll[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    ll ans=vll[0];
    FOR(i,1,n){
        if(ans>1000000000000000000/vll[i]){
            cout<<-1<<endl;
            return 0;
        }
        ans*=vll[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4052
#include<iostream>

using namespace std;

int main(){
  string s;
  int n,num0=0,num1=0,i;
  cin >> s;
  n = s.length();
  for(i=0;i<n;i++){
    if(s[i]=='0')num0++;
    if(s[i]=='1')num1++;
  }
  cout << min(num0,num1)*2 <<endl;
}


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

int main(){
   ll a,b,c,k,sum=0;
   cin>>a>>b>>c>>k;
   if(k<=a){
        cout<<k<<endl;
   }
   else{
        sum+=a;
        k-=a;
        if(k<=b){
            cout<<sum<<endl;
        }
        else{
            k-=b;
            cout<<sum-min(k,c)<<endl;
        }

   }

}


Measured memory_bytes: 3588
def z(z_dic, v: int):
    if v in z_dic:
        return z_dic[v]
    z = 0
    if v == 2:
        z = 1
    elif v > 2:
        z = int(v*(v-1)/2)
    z_dic.setdefault(v, z)
    return z


def main():
    n = int(input())

    ar = [0] * (n+1)
    ls = []

    for x in map(int, input().split()):
        ls.append(x)
        ar[x] += 1

    zls = []
    zls2 = []

    z_dic = {}

    for i in range(1, n+1):
        v = ar[i]
        zls.append(z(z_dic, v))
        zls2.append(z(z_dic, v-1))
    ss = sum(zls)

    for i in range(1, n+1):
        aa = ls[i-1]
        print(ss - zls[aa-1] + zls2[aa-1])


main()


Measured memory_bytes: 27676
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e;
    scanf("%d %d",&a,&b);
    c=a+b;
    d=a-b;
    e=a*b;
    printf("%d",max(c,max(d,e)));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
 
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	int i,j,h[100002],dp[100002];
	for(i=1;i<=n;i++)
		scanf("%d",&h[i]);

	dp[1]=0;
	for(i=2;i<=n;i++){
		dp[i]=1000000000;
		for(j=i-1;j>=1 && j>=i-k;j--){
			dp[i]=min(dp[j]+abs(h[j]-h[i]),dp[i]);
		}
	}

	printf("%d\n",dp[n] );
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const i64 D = 5000;
i64 n, a;
vector<i64> x;
i64 s[2][10000];
int main() {
  cin >> n >> a;
  read_n(x, n);
  s[1][D] = 1;
  for (i64 i = 0; i < n; ++i) {
    x[i] -= a;
    for (i64 j = 100; j <= 9900; ++j) {
      s[i & 1][j] = s[i & 1 ^ 1][j] + s[i & 1 ^ 1][j - x[i]];
    }
  }
  cout << s[(n - 1) & 1][D] - 1 << '\n';
  return 0;
}


Measured memory_bytes: 384
x1,x2,x3,x4,x5 = map(int,input().split())
if x1 == 0:
    print(1)
if x2 == 0:
    print(2)
if x3 == 0:
    print(3)
if x4 == 0:
    print(4)
if x5 == 0:
    print(5)

Measured memory_bytes: 8992
#include <iostream>
using namespace std;
int main(){
                int students[40]={1};
                for( int i=0 ; i<30 ; i++ )
                        students[i]=1;
                for( int i=0 ; i<28 ; i++ ){
                        int tmp;
                        cin >> tmp;
                        students[tmp-1]=0;
                }
                for( int i=0 ; i<30 ; i++ ){
                        if(students[i]!=0)
                                cout << i+1 << endl;
                }
                return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
vector<pair<int,int>> to[100005];
int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(n);
    rep(i, m)
    {
        int a,b;
        cin >> a >> b;
        a--;b--;
        v[a]++;
        v[b]++;
    }
    int sum = 0;
    rep(i, n)
    {
        (sum += v[i]) %= 2;
        if (sum % 2 != 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 3072
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]

access = []
for i in 1..N do
  access[i-1] = []
end
for i in 1..N-1 do
  from = lines[i][0]
  to = lines[i][1]
  access[from-1].push(to)
  access[to-1].push(from)
end

c = lines[N].sort.reverse

visited = []
for i in 1..N do
  visited[i-1] = false
end

target = [1]
ans = []
num = 0
while target != [] do
  i = target.pop
  visited[i-1] = true
  ans[i-1] = c[num]
  num += 1
  access[i-1].each do |j|
    if visited[j-1] == false then
      target.push(j)
    end
  end
end
  
num_ans = 0
for i in 1..N-1 do
  num_ans += c[i]
end
  
puts num_ans
for i in 1..N do
  print ans[i-1]
  if i != N then
    print " "
  end
end

Measured memory_bytes: 4344
O = raw_input()
E = raw_input()
out = O+E
out =  list(out)
for count in range(0,len(out)/2):
	out[2*count] = O[count]
	out[2*count+1] = E[count]
if len(O) > len(E):
	out[2*count+2] = O[count+1]
out = ''.join(out)
print out

Measured memory_bytes: 2568
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let s = Array.init n @@ fun _ -> read_line ()

module SSet = Set.Make(struct type t = string let compare = compare end)

let () = Printf.printf "%d\n"
  @@ SSet.cardinal
  @@ Array.fold_left (fun set s -> SSet.add s set ) SSet.empty s

Measured memory_bytes: 30948
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int a = sc.nextInt();
        
        int b = sc.nextInt();
        
        int c = sc.nextInt();
        
        int x = sc.nextInt();
        
        int counter = 0;
        
        for(int i = 0; i<= a; i++) {
            for(int j = 0; j<= b; j++) {
                for(int k = 0; k <=c; k++) {
                    
                    if(500*i + 100*j + 50*k == x)
                        counter++;
                }
            }
        }
        System.out.println(counter);
    }
}

Measured memory_bytes: 22736
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int ans = 0;
    while (N > 0) {
        ++ans;
        N /= K;
    }
    cout << ans << endl;
    return 0;
}

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

int dfs(int64_t num, int& N){
  if(num>N) return 0;

  int count = 0;
  bool check3 = false, check5 = false, check7 = false;
  string s = to_string(num);
  for(int i=0; i<s.size(); i++){
    char check =s.at(i);
    if(check == '3') check3 = true;
    else if(check == '5') check5 = true;
    else if(check == '7') check7 = true;
  }
  if(check3&&check5&&check7) count = 1;
  

  vector<int> kazu{7,5,3};
  for(int i : kazu){
    count += dfs(num * 10 + i, N);
  }

  //count += dfs(num * 10 + 3, N);
  return count;
}


int main() {

  int N;
  cin >> N;

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


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b;
  int d,r;
  double f;
  scanf("%d%d", &a, &b);

  d = a / b;
  r = a % b;
  f = (double)a / b;

  printf("%d %d %.5f", d, r, f);
  
  return 0;
}

Measured memory_bytes: 640
//This code is solely the property of StarnyC
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define ld long double
#define hell 1000000007
#define hellx 998244353
#define pb push_back
#define mp make_pair
#define reset(a,b) memset(a,b,sizeof(a))
#define Go_Baby_Go  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);
#define deb(x)     cout << (#x) << " is " << (x) << endl;
#define F  first
#define S  second
#define pii pair<ll,ll>
#define all(c) (c).begin(),(c).end()

bool secsort(const pii &a,const pii &b){
    return a<b;}

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

ll binexp(ll x,ll n,ll m){
   if(!n)return 1;
else if(n&1)return (x%m)*binexp((x%m)*(x%m),n/2,m)%m;
else if(!(n&1))return binexp((x%m)*(x%m),n/2,m)%m; 
return 0;}

int val[105];
int weight[105];
int dp[105][100005];


int fun(int i,int w)
{
  if(i<0)return 0;
  if(w<0)return 0;

  if(dp[i][w]!=-1)return dp[i][w];
  if(w-weight[i]<0)return  dp[i][w]=fun(i-1,w);

  return dp[i][w]=max(fun(i-1,w),fun(i-1,w-weight[i])+val[i]);
}

int32_t solve(ll _,ll _t)
{   
   int n,W;
   cin>>n>>W;

   for (int i=0;i<n;++i){
    cin>>weight[i]>>val[i];
   }

   reset(dp,-1);
    cout<<fun(n-1,W)<<endl;

   // // for(int i=0;i<n;i++)
   // // { for(int j=0;j<20;j++)
   // //    cout<<dp[i][j]<<" ";

   //    cout<<endl;}

 








return 0;
}


int32_t main()
{
 Go_Baby_Go
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" ;


ll _=1;
//cin>>_;
ll _t=_;
while(_--)
solve(_,_t);

}


Measured memory_bytes: 82304
N = int(input())
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません

flag = "APPROVED"
for n in A:
  if n % 2 == 0 and n%3 != 0 and n%5 != 0:
    flag = "DENIED"
    
print(flag)

Measured memory_bytes: 2940
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int number = sc.nextInt();

        boolean flag = true;

        while(number != 0){
            if((number % 10) == 7){
                flag = false;
            }
            number = number/10;
        }

        if(flag==true)System.out.println("No");
        if(flag==false)System.out.println("Yes");
    }
}

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

int gcd(int x, int y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > miti(n, vector<int>(0));
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        miti[a].emplace_back(b);
        miti[b].emplace_back(a);
    }

    queue<int> room;
    vector<int> ans(n, -2);
    room.push(0);
    while (!room.empty()) {
        int oya = room.front(); room.pop();
        for (int i : miti[oya]) {
            if (ans[i] != -2) continue;

            ans[i] = oya;
            room.push(i);
        }
    }
    cout << "Yes" << endl;
    rep(i, n) {
        if (i == 0) continue;
        cout << ans[i] + 1 << endl;
    }
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 10016
package main

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


func solveFromFile() int{
    var nu int
    scanner := bufio.NewScanner(os.Stdin)
    file, err := os.Open(os.Args[1])
    if err != nil {
      log.Fatalf("failed opening file: %s", err)
    }
    scanner = bufio.NewScanner(file)
    scanner.Scan()
    tempstr := scanner.Text()
	  n, err2 := strconv.Atoi("123")
    nu = n
    nu = nu +321
    if err2 != nil {
      log.Fatalf("failed opening file: %s", err2)
      
    }

    defer file.Close()
    scanner.Scan()
    return solution(tempstr, scanner.Text())
}

//========== Implement Algorithm =======================
func solution(num1 string, num2 string) int{
  if num1 == string(num2[:len(num2)-1]){
    return 1
  }
  return 0
}

func main() {

//================== Variables used ====================
  var num1,num2 string 
  var ret int
//======================================================

  if len(os.Args) >=2{
//============== Get return value from File ============
    ret = solveFromFile()


  }else{
//============== Get return value from STDIN ===========
    fmt.Scanln(&num1)
    fmt.Scanln(&num2)
    ret = solution(num1,num2)
  }

//================== OUTPUT ============================
  if ret==1 {
    fmt.Println("Yes")
  }else{
    fmt.Println("No")
  }
  
}

Measured memory_bytes: 1884
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	cin >> N;
	VLL X(N);
	for (int n = 0; n < N; n++)cin >> X[n];
	LL L;
	int Q;
	cin >> L >> Q;
	VVI front;
	front.resize(N, VI(20));
	for (int n = 0; n < N; n++) {
		//[x_n,x_s] <= L < [x_n,x_e]
		int s = n, e = N;
		while (e - s > 1) {
			int m = (e + s) / 2;
			if (X[m] - X[n] <= L)s = m;
			else e = m;
		}
		front[n][0] = s;
	}
	for (int c = 1; c < 20; c++) {
		for (int n = 0; n < N; n++) {
			int prev = front[n][c - 1];
			if (prev == N)front[n][c] = N;
			else front[n][c] = front[prev][c - 1];
		}
	}
	VVI back;
	back.resize(N, VI(20));
	for (int n = 0; n < N; n++) {
		//[x_s,x_n] < L <= [x_e,x_n]
		int s = -1, e = n;
		while (e - s > 1) {
			int m = (e + s) / 2;
			if (X[n] - X[m] > L)s = m;
			else e = m;
		}
		back[n][0] = e;
	}
	for (int c = 1; c < 20; c++) {
		for (int n = 0; n < N; n++) {
			int prev = back[n][c - 1];
			if (prev == -1)back[n][c] = -1;
			else back[n][c] = back[prev][c - 1];
		}
	}
	for (int q = 0; q < Q; q++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (a < b) {
			//s日到達 < b <= e日到達
			int s = 0, e = (1 << 20);
			while (e - s > 1) {
				int m = (e + s) / 2;
				int n = a;
				for (int c = 0; c < 20; c++) {
					if ((m & (1 << c)) != 0) {
						n = front[n][c];
					}
				}
				if (n < b)s = m;
				else e = m;
			}
			cout << e << "\n";
		}
		else {
			//s日到達 > b >= e日到達
			int s = 0, e = (1 << 20);
			while (e - s > 1) {
				int m = (e + s) / 2;
				int n = a;
				for (int c = 0; c < 20; c++) {
					if ((m & (1 << c)) != 0) {
						n = back[n][c];
					}
				}
				if (n > b)s = m;
				else e = m;
			}
			cout << e << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 27172
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    
    fff(i,n)
    cout << s[i] << t[i];
    
	return 0;
    
}

Measured memory_bytes: 8832
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))

ans = 0
for a in A:
    if  a % 2 == 0:
        while a % 2 == 0:
            ans += 1
            a //= 2

print(ans)


Measured memory_bytes: 41456
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B;
  cin>>A>>B;
  if(A<=5){
  	cout<<0<<endl;
  }else if(A<=12){
  	cout<<B/2<<endl;
  }else{
  	cout<<B<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#define pi 3.14159265358979323846264338327950

long long count(long long N) {
	if (N == 1) return 1;
	return count(N / 2) * 2 + 1;
}

int main() {
	long long H; std::cin >> H;
	std::cout << count(H) << std::endl;

	return 0;
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		StringBuilder sb = new StringBuilder();

		String[] set = br.readLine().split(" ");

		for(int i = N-1; i >= 0; i--){
			if (i != 0) {
				sb.append(set[i]).append(" ");
			} else {
				sb.append(set[i]);
			}
		}

		System.out.println(sb);

	}

}

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

int main() {
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  int ans = 1e9;
  rep(i,0,26){
    bool df = true;
    int dc = 0,cc = 0,tmp = 0;
    rep(j,0,s.size()){
      if(s[j] == 'a'+i){
        if(df) df = false;
        else{
          cc = max(cc,tmp);
          tmp = 0;
        }
        continue;
      }
      if(df) dc++;
      else tmp++;
    }
    if(df) continue;
    cc = max(cc,tmp);
    int ta = max(cc,dc);
    //cout << cc << " " << dc << " " << ta << endl;
    ans = min(ans,ta);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0) {
        c -= b;
        if(c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0) {
            cout << "No" << endl;
            return 0;
        }

    }
    return 0;
}

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

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else {
    return n * POW(n, m - 1);
  }
}

int main() {
  ll n, p, i, ans = 1, tmp = 0;
  cin >> n >> p;
  map<ll, ll> mp;
  i = 2;
  tmp = p;
  while (i * i <= p) {
    while (p % i == 0) {
      p /= i;
      ++mp[i];
    }
    ++i;
  }
  ++mp[p];
  for (auto p : mp) {
    if (p.second >= n) {

      ans *= POW(p.first, (p.second) / n);
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
from itertools import combinations

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = self.size[y]
        else:
            if x != y:
                self.size[x] += self.size[y]
                self.size[y] = self.size[x] 
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

def combi(root_list):
    return sum([a*b for a, b in combinations(root_list, 2)])
    
if __name__ == '__main__':
    N, M = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(M)]
    
    AB = AB[::-1]
    
    
    inconvinience = []
    inconvinience.append(N*(N-1)//2)
    
    tree = UnionFind(N)
    for a, b in AB:
        delta = 0
        if not tree.same_check(a, b):
            delta = tree.size[tree.find(a)]*tree.size[tree.find(b)]
        tree.union(a, b)
        inconvinience.append(inconvinience[-1] - delta)
    
    inconvinience.pop()
    
    for i in inconvinience[::-1]:
        print(i)

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

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    ll res = a/(b+c);
    if(b == 0)
    {
        cout << "0";
        return 0;
    }
    if(c == 0)
    {
        cout << a << endl;
        return 0;
    }
    res *= b;
    ll rem = a % (b+c);
    if(rem >= b)
    {
        res += b;
    }
    else
    {
        res += rem;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
tol = [0] * n
tor = [0] * n

def futurepos(i):
    if s[i] == 'R':
        t = tol[i]
        lpos = i + t
        if t%2 == 0:
            return lpos
        else:
            return lpos-1
    else:
        t = tor[i]
        rpos = i - t
        if t%2 == 0:
            return rpos
        else:
            return rpos+1


def main():
    for i in range(n):
        if s[i] == 'R':
            tor[i] = 0
        else:
            tor[i] = tor[i-1] + 1
        j = n-1-i
        if s[j] == 'L':
            tol[j] = 0
        else:
            tol[j] = tol[j+1] + 1

    pos = [0] * n
    for i in range(n):
        k = futurepos(i)
        pos[k] += 1
    print(*pos, sep=' ')

main()

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


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


def main():
    N = int(input())
    Ss = [input().strip() for _ in range(N)]

    print(len(set(Ss)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 98176
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define NFOR(i,a,b) for(ll i = (ll)(a); i >= (ll)(b); --i)
#define rep(i, a) for (ll i = 0; i < a; i++)
#define endl "\n"
#define fi first
#define se second
#define MOD 1000000007
#define inf 1e12
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

void solve() {
	string s;
	cin>>s;
	ll l = s.size();
	ll ans = LLONG_MAX;
	rep(i, l-2){
			string ss = s.substr(i, 3);
			ans=min(ans,abs(stol(ss)-753LL));
		}
	cout<<ans<<endl;
}

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


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

int dp[100005];
vector<vector<int>> g;
int rec(int k){
    if(dp[k]!=-1)return dp[k];
    int res=0;
    for(auto v:g[k]){
        res=max(res,rec(v)+1);
    }
    return dp[k]=res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    g.assign(n,vector<int>());
    rep(i,m){
        int x,y;cin>>x>>y;
        --x;--y;
        g[x].push_back(y);
    }
    for(int i=0;i<n;i++)dp[i]=-1;
    int res=0;
    for(int i=0;i<n;i++){
        res=max(res,rec(i));
    }
    cout<<res<<endl;
    return 0;
}


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


 int main (){
	int n;
	int ary[100];
	cin >> n;
		for(int i=0;i<=n-1;++i){
		cin >> ary[i];
		}
		for(int k=n-1;k>=0;--k){
			if(k!=0){
				cout<<ary[k]<<" ";
			}
			else{
				cout << ary[k];
			}
		}
		cout <<endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int L, R;
    cin >> L >> R;
    int D; cin >> D;
    int ans = 0;
    FOR(i,L,R+1) if (i % D == 0) ans++;
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		string[] l1  = Input();
		int a = int.Parse(l1[0]);
		int b = int.Parse(l1[1]);
		for(int i = b-a+1; i <a+b; i++)
		{
			Console.Write(i + " ");
		}
	}

	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 13140
n, m = map(int, input().split())
lst = [[0, 0] for _ in range(n)]

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1]    [1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    if lst[i][0] == 1:
        wrong += lst[i][1]
print(correct, wrong)

Measured memory_bytes: 53720
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string s;
    cin >> s;
    for (int i=0;i<s.size();++i){
        if (i == 0 || i % 2 == 0) cout << s[i];
    }
}


Measured memory_bytes: 512
object Main extends App {
  import scala.io.StdIn.readLine

  val input = readLine().split(" ").map(_.toInt)
  val x1 = input(0)
  val y1 = input(1)
  val x2 = input(2)
  val y2 = input(3)

  val tmpX = y2 - y1
  //val tmpY = x2 - x1
  val x3 = x2 - tmpX
  val y3 = y2 + (x2 - x1)
  val x4 = x1 - tmpX
  val y4 = y1 + (x2 - x1)

  print(x3 + " " + y3 + " " + x4 + " " + y4)
}

Measured memory_bytes: 27324
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string N;
int main(){
    cin >> N;
    pr((N[0]==N[2])? yes : no);
}

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

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	std::string str;
	int q = 0;

#if INPUT_FROM_FILE
	ifs >> str >> q;
#else
	std::cin >> str >> q;
#endif

	for(int i = 0; i < q; i++){
		std::string op;
		int a = 0;
		int b = 0;
		int l = 0;

#if INPUT_FROM_FILE
		ifs >> op >> a >> b; 
#else
		std::cin >> op >> a >> b;
#endif
		l = b - a + 1;

		if(op == "print"){
			std::cout << str.substr(a, l) << std::endl;	
		}
		else if(op == "reverse"){
			std::string tmp = str.substr(a, l);
			for(int j = 0; j < l; j++){
				str.at(a + j) = tmp.at(l - j - 1);
			} 
		}
		else{
			std::string r;

#if INPUT_FROM_FILE
			ifs >> r; 
#else
			std::cin >> r;
#endif
			for(int j = 0; j < l; j++){
				str.at(a + j) = r.at(j); 
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3148
var
    n,x,y,t: Longint;
    x0,y0,t0: Longint;
    offset: Longint;
    offset_xy: Longint;
    even, even_T: Boolean;
    flag: Boolean;
begin
    flag:=true;
    x0:=0;
    y0:=0;
    t0:=0;
    even:=true;
    readln(n);
    while n>0 do
    begin
       readln(t,x,y);
       if not flag then
       begin
           dec(n);
           continue;
       end;
       if (x=x0)and(y=y0) then
       begin
           flag:=false;
           dec(n);
           continue;
       end;
       offset:=t-t0;
       if offset mod 2 = 0 then 
       begin
           even_T:=true;
       end
       else 
       begin
           even_T:=false;
       end;
       offset_xy:=abs(x-x0)+abs(y-y0);
       if offset_xy>offset then
       begin
            flag:=false;
            dec(n);
            continue;
       end;
       if (offset_xy mod 2 = 0)=(even xor even_T)  then
       begin
            flag:=false;
            dec(n);
            continue;
       end;
       x0:=x;
       y0:=y;
       t0:=t;
       dec(n);
    end;
    
    if flag then 
    begin
        writeln('Yes');
    end
    else 
    begin
        writeln('No');
    end;
end.

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int a[28];
	int b[2];
	int s=0;
	int t=0;
	int i=0;
	int j=0;
	for(i=0;i<28;i++){
		cin>>a[i];
	}
	for(i=1;i<31;i++){
		for(j=0;j<28;j++){
			if(i==a[j]){
				t=1;
			}
		}
		if(t!=1){
			b[s]=i;
			s=s+1;
		}
		t=0;
	}
	cout<<b[0]<<endl;
	cout<<b[1]<<endl;
}

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

int main()
{
  int m;
  while (cin >> m) {
    if (m == 0)
      break;

    vector<pair<int, int> > fs(m);
    for (int i = 0; i < m; ++i)
      cin >> fs[i].first >> fs[i].second;

    vector<pair<int, int> > diff;
    for (int i = 1; i < m; ++i)
      diff.push_back(make_pair(fs[i].first-fs[0].first, fs[i].second-fs[0].second));

    int n;
    cin >> n;
    vector<pair<int, int> > s(n);
    for (int i = 0; i < n; ++i)
      cin >> s[i].first >> s[i].second;
    sort(s.begin(), s.end());

    for (int i = 0; i < n; ++i) {
      bool found = true;
      for (int j = 0; j < diff.size(); ++j) {
	if (!binary_search(s.begin(), s.end(), make_pair(s[i].first+diff[j].first, s[i].second+diff[j].second))) {
	  found = false;
	}
      }

      if (found) {
	cout << s[i].first - fs[0].first << " " << s[i].second - fs[0].second << endl;
	break;
      }
    }

  }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
int main()
{
	long long H,W;
	cin>>H>>W;
	if(H==1||W==1)
	{
		cout<<"1"<<endl;
	}
	else if(H*W%2==0)
	{
		cout<<H*W/2<<endl;
	}
	else
	{
		cout<<(H*W+1)/2<<endl;
	}
	return 0;
}

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

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

const int MAX_N = 1010;
const int INF = (1 << 28);

int a[MAX_N];

int main() {
    int n, m;
    cin >> n >> m;

    int group = lcm(n, m) / m;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int ans = 0;
    for (int id = 0; id < group; id++) {
        int start = (id * m) % n,
            min_w = INF,
            max_w = -INF;
        for (int b_i = 0; b_i < m; b_i++) {
            int ball = (start + b_i) % n;

            min_w = min(min_w, a[ball]);
            max_w = max(max_w, a[ball]);
        }
        ans += max_w - min_w;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3096
from collections import deque, defaultdict

n,m = list(map(int, input().split()))
d=defaultdict(list)

for _ in range(m):
    a,b = list(map(int, input().split()))
    d[a].append(b)
    d[b].append(a)
    
q=deque()
q.append(1)
ans={}
while q:
    node=q.popleft()
    for i in d[node]:
        #訪問済み
        if i in ans:
            continue
        q.append(i)
        ans[i]=node
print('Yes')
for k in sorted(ans):
    if k==1:
        continue
    print(ans[k])

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    bool ans = true;
    vector<int> h(n);
    rep(i, n) {
      cin >> h[i];
    }
    FOR(i, 1, n) {
      if (h[i] > h[i - 1]) {
        h[i] -= 1;
      }
      if (h[i] < h[i - 1]) {
        ans = false;
        break;
      }
    }
    if (ans) {
      cout << "Yes" << '\n';
    } else {
      cout << "No" << '\n';
    }

    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

#define null -1

int Pre[105], In[105], cur;

vector<int> post;

void restruct( int n, int left, int right){

    if( left >= right ) return;

    int root = Pre[cur++];

    int mid;

    for( int j = 0; j < n; j++ ){

        if( In[j] == root ){

            mid = j;

            break;

        }

    }

    restruct( n, left, mid );

    restruct( n, mid + 1, right);

    post.push_back( root );

}

void solve( int n ){

    cur = 0;

    restruct( n, 0, n );

    for( int i = 0; i < n; i++ ){

        if(i) printf(" ");

        printf("%d", post[i] );

    }

    printf("\n");

}



int main(){

    int n, i;

    scanf("%d", &n);

    for( i = 0; i < n; i++){

        scanf("%d", &Pre[i]);

    }

    for( i = 0; i < n; i++){

        scanf("%d", &In[i]);

    }

    solve( n );

    return 0;

}



Measured memory_bytes: 2752
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int tN;
  int sum;

  cin >> N;
  tN=N;
  
  while(N>0)
  { 
  	sum+=N%10;
    N=N/10;
  }
  
  
  if (tN%sum==0)
  {
  	cout <<"Yes" << endl;  
  }
  else
  {
    cout <<"No" << endl;  
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int X, N;
    cin >> X >> N;
    int ans = 1;
    vector<int> vec(N);
    rep(i, N) cin >> vec[i];
    sort(ALL(vec));
    int idx = 0;
    int tmp = 10000;
    if (N == 0) {
        cout << X << endl;
        return 0;
    }
    rep(i, 300) {
        if (i == vec[idx]) {
            ++idx;
            continue;
        }
        if (abs(X - i) < tmp) {
            ans = i;
            tmp = abs(X - i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
import math

n = int(input())
d = []
for i in range(n):
    x, y = map(int, input().split())
    d.append([x, y])

sum = 0
num = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        sum += math.sqrt((d[i][0] - d[j][0]) ** 2 + (d[i][1] - d[j][1]) ** 2)
        num += 1

print(sum / num * (n - 1))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
bool Contains(int x, int y, P<int> RU, P<int> LD) { //　マス目(x,y)を含んだかどうか判定
	bool flag = true;
	if (x < 0) {
		if (LD.first > x) flag = false;
	}
	else {
		if (RU.first < x) flag = false;
	}
	if (y < 0) {
		if (LD.second > y) flag = false;
	}
	else {
		if (RU.second < y) flag = false;
	}
	return flag;
}
int main() {
	int x, y;
	cin >> x >> y;
	ll fib[200]; // フィボナッチ数列を作る
	fib[1] = fib[2] = 1;
	int nxt = 3;
	while (fib[nxt - 2] + fib[nxt - 1] < upper) {
		fib[nxt] = fib[nxt - 2] + fib[nxt - 1];
		nxt++;
	}
	P<int> RU = { 0,0 }; // 右上と左下だけで大丈夫
	P<int> LD = { 0,0 }; // x,y
	if (x == 0 && y == 0) {
		cout << 1 << endl;
		return 0;
	}
	rep1(i, 1010101) {
		if (i % 4 == 1) { // 右
			RU.first += fib[i + 1];
		}
		if (i % 4 == 2) { // 上
			RU.second += fib[i + 1];
		}
		if (i % 4 == 3) { // 左
			LD.first -= fib[i + 1];
		}
		if (i % 4 == 0) { // 下
			LD.second -= fib[i + 1];
		}
		if (Contains(x, y, RU, LD)) {
			int ans = (i + 1) % 3;
			if (ans == 0) ans += 3;
			cout << ans << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3100
n = gets.to_i
flag = false
1.step(3500) do |a|
  1.step(3500) do |b|
    if 4*a*b - n*b - n*a > 0 && n*a*b % (4*a*b - n*b - n*a) == 0
      c = n*a*b / (4*a*b - n*b - n*a)
      puts "#{a} #{b} #{c}"
      flag = true
    end
    break if flag
  end
  break if flag
end


Measured memory_bytes: 1788
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 15;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

multiset <ll> Sx1;
multiset <ll> Sx2;
ll off1, off2;

ll in[100050][2];
int main() {
	int N, i;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%lld %lld", &in[i][0], &in[i][1]);

	ll ans = 0;
	Sx1.insert(0);
	Sx2.insert(0);
	for (i = 2; i <= N; i++) {
		ll v1 = in[i - 1][0] - in[i][1];
		ll v2 = in[i - 1][1] - in[i][0];

		off1 += v1;
		off2 += v2;
		ans -= (v2 - v1) * (i - 1);

		auto it = Sx2.begin();
		if (*it + off2 <= 0) {
			Sx2.insert(-off2);
			Sx2.insert(-off2);
		}
		else {
			Sx1.insert(-off1);
			Sx1.insert(-off1);
		}

		while (Sx2.size() > Sx1.size()) {
			auto it2 = Sx2.begin();
			ll v = *it2 + off2 - off1;
			Sx2.erase(it2);
			Sx1.insert(v);
		}
		while (Sx1.size() > Sx2.size()) {
			auto it1 = Sx1.end();
			it1--;
			ll v = *it1 + off1 - off2;
			Sx1.erase(it1);
			Sx2.insert(v);
		}
	}
	ll v = *(Sx2.begin()) + off2;
	for (auto it : Sx1) ans += v - (it + off1);
	for (auto it : Sx2) ans += (it + off2) - v;
	ans /= 2;
	return !printf("%lld\n", ans);	
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){
  
  string S;
  
  cin>>S;
  
  int ct=0;
  
  char pc=S[0];
  
  reps(i,1,S.length()){
    if(S[i]=='B'){
      if(pc!=S[i]){
        pc='B';
        ct++;
      }
    }
    else{
      if(pc!=S[i]){
        pc='W';
        ct++;
      }
    }
  }
  
  cout << ct <<"\n";
  
  
}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll Mod=924844033;
int n,k,tot;
ll f[4010][4010][2];
bool used[2010][2],en[4010];
void upd(ll &x,ll v)
{
	x=(x+v)%Mod;
}
int main()
{
	cin>>n>>k;
	en[0]=true;
	for (int i=1;i<=n;i++)
	{
		for (int j=0;j<2;j++)
		{
			if (used[i][j])
			{
				continue;
			}
			for (int x=i,y=j;x<=n;x+=k,y^=1)
			{
				used[x][y]=true;
				tot++;
			}
			en[tot]=true;
		}
	}
	f[0][0][0]=1;
	for (int i=1;i<=2*n;i++)
	{
		for (int j=0;j<=n;j++)
		{
			f[i][j][0]=(f[i-1][j][0]+f[i-1][j][1])%Mod;
			if (!en[i-1])
			{
				f[i][j+1][1]=f[i-1][j][0];
			}
		}
	}
	ll ans=0,p=1;
	for (int i=n;i>=0;i--)
	{
		p=p*(n-i)%Mod;
		if (n==i)
		{
			p=1;
		}
		ll now=p;
		if (i&1)
		{
			now=(Mod-now)%Mod;
		}
		upd(ans,now*(f[2*n][i][0]+f[2*n][i][1]));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 249600