akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	}
}



Measured memory_bytes: 26316
a, b = gets.chomp.split.map(&:to_i)
# a / b = d
# a % b = r
# a / b = f  (???????°???°?????°)
# to_f ???????????????????????¨????????¨????????´??°??§??????????????¨????????????????????´??°.0??¨?????£?????????????
  #??´??°/??´??°??§??????????°???°?????°?????????
# ??´??°.to_f ??§???????°???°?????°???????????§???????????§???a b ????????????????????????to_f????????????????????¨?????????
d = a / b
r = a % b
f = a.to_f / b.to_f
puts " #{d} #{r} #{sprintf("%.9f", f)} "
# ???????°???°?????\???????????°????¶??????????

Measured memory_bytes: 6132
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  long long N,A,B;
  cin>>N>>A>>B;
  long long L=A*(N-1)+B,U=A+(N-1)*B;
  cout<<max((long long)0,U-L+1)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char p[101000];
int s[101000],P[101000],n;
int main()
{
	cin>>n>>p;
	int i,j;
	for (i=0;p[i];i++)
	{
		if (p[i]=='o') P[i+1]=0;
		else P[i+1]=1;
	}
	P[n+1]=P[1];
	for (i=0;i<8;i++)
	{
		s[0]=i&1;
		s[1]=(i>>1)&1;
		s[2]=(i>>2)&1;
		for (j=2;j<=n+1;j++)
		{
			s[j+1]=s[j-2]^P[j];
		}
		if (s[0]^s[n]^s[1]^s[n+1]||s[1]^s[n+1]^s[2]^s[n+2]) continue;
		for (j=1;j<=n;j++)
		{
			cout<<("%c",(s[j]^s[j-1]?'W':'S'));
		}
		cout<<endl;
		return 0;
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    double N;cin >> N;
    double X = N/1.08;
    if((int)((int)X*1.08) == (int)N){
        cout << (int)X << endl;
    }
    else if((int)((int)(X+1)*1.08) == (int)N){
        cout << (int)X+1 << endl;
    }
    else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
#include <deque>
#include <cstdint>
using namespace std;


int main () {
  int s, w;
  cin >> s >>w;
  if (w >= s){
    cout << "unsafe";
  } else {
    cout << "safe";
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  ll n, k;
  cin >> n >> k;
  int count = 0;
  while (n >= 1) {
    n /= k;
    count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 200010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main() {
    ll N;
    cin >> N;
    ll a[MAX];
    ll i;
    Map mp;
    for(i=0; i<N; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    sort(a, a+N);
    
    ll ans=0;
    for(i=N-1; i>=0; i--) {
        if(mp[a[i]]==0) continue;
        mp[a[i]]--;
        ll t=1;
        while(t<=a[i]) t<<=1;
        
        t=t-a[i];
        if(binary_search(a, a+N, t) && mp[t]>0) {
            mp[t]--;
            ans++;
        }
    }
    
    pr(ans);
    
}


Measured memory_bytes: 14336
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [u64; n],
    }

    if a.iter().any(|&v| v == 0) {
        println!("0");
        return;
    }

    let mut ans = a[0];
    for i in 1..n {
        match ans.checked_mul(a[i as usize]) {
            Some(v) => {
                if v > 10u64.pow(18) {
                    println!("-1");
                    return;
                }

                ans = v;
            }
            None => {
                println!("-1");
                return;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4508
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();

        if(a%2 == 0 ){
            int b = (int)a/2;
        System.out.println((double)b/a);
        //System.out.println("a");
        }else{
            int b = (int)(a/2)+1;
            System.out.println((double)b/a);
        }
}
}

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

int  main()
{
	string s,t; cin >> s >> t;

	int cnt = 0;
	if (s != t)
	{
		rep(i, s.size())
		{
			if (s[i] != t[i])
			{
				s[i] = t[i];
				cnt++;
			}
			if (s == t)
			{
				cout << cnt << endl;
				return 0;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3912
def getlist():
	return list(map(int, input().split()))

con = 1000000007

#処理内容
def main():
	N, K = getlist()
	a = getlist()
	b = [0] * (N + 1)
	c = [0] * (N + 1)
	for i in range(1, N + 1):
		b[i] = b[i - 1] + a[i - 1]
		if a[i - 1] >= 0:
			c[i] = c[i - 1] + a[i - 1]
		else:
			c[i] = c[i - 1]

	#計算
	ans = 0
	for i in range(N - K + 1):
		val = max(0, b[i + K] - b[i]) + c[i] + (c[N] - c[i + K])
		ans = max(ans, val)
	print(ans)



if __name__ == '__main__':
	main()

Measured memory_bytes: 16456
# https://atcoder.jp/contests/abc047/tasks/abc047_b

w, h, n = map(int, input().split())
area = [[0] * w for _ in range(h)]
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        for i in range(h):
            for j in range(w):
                if j < x:
                    area[i][j] = 1

    if a == 2:
        for i in range(h):
            for j in range(w):
                if j >= x:
                    area[i][j] = 1

    if a == 3:
        for i in range(h):
            for j in range(w):
                if i < y:
                    area[i][j] = 1

    if a == 4:
        for i in range(h):
            for j in range(w):
                if i >= y:
                    area[i][j] = 1

ans = 0
for i in range(h):
    for j in range(w):
        if area[i][j] == 0:
            ans += 1

print(ans)

Measured memory_bytes: 43500
X = int(input())

while True:
    if X == 1 or X == 2:
        print(X)
        break
    
    cond = True
    for x in range(2, X//2+1):
        if X % x == 0:
            cond = False
            break
    if cond:
        print(X)
        break
    else:
        X += 1

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

#define MAX_V 1000
int V;
VI G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v) {
  G[u].PB(v);
  G[v].PB(u);
}

bool dfs(int v) {
  used[v] = true;
  REP(i, G[v].size()) {
    int u = G[v][i], w = match[u];
    if(w < 0 || !used[w] && dfs(w)) {
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching() {
  int res = 0;
  memset(match, -1, sizeof(match));
  REP(v, V) {
    if(match[v] < 0) {
      memset(used, 0, sizeof(used));
      if(dfs(v)) res++;
    }
  }
  return res;
}

signed main(void)
{
  int x, y, e;
  cin >> x >> y >> e;
  REP(i, e) {
    int a, b;
    cin >> a >> b;
    add_edge(a, x+b);
  }
  V = x + y;

  cout << bipartite_matching() << endl;

  return 0;
}

Measured memory_bytes: 3308
//package Contest090;

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String str ="";
           for(int i=0;i<3;i++)
           {
               String input = sc.next();
               str+=input.charAt(i);

           }
           out.println(str);
        out.flush();
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){

  long long a,b,n,r=114514191911451419;
  cin>>a>>b>>n;
  for(int i=1;i<=n;i++) r=min(r,abs(a-b*i));
  for(int i=1;i<=n;i++) if(b%i==0){
      long long tmp=b/i;
      for(int j=1;j<=n;j++) r=min(r,abs(a-tmp*j));
    }
  cout<<r<<endl;
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define REP(i,N) for (int i=0;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main(){
    int N;
    cin >>N;
    int out=0;
    out=N*N*N;
    cout <<out<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  char s[11],ans[11]={};
  scanf("%s",s);
  for(int i=0;i<strlen(s);i++){
    if(s[i]=='B') ans[strlen(ans)-1]='\0';
    else ans[strlen(ans)]=s[i];
  }
  printf("%s",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   long long l,r;
   cin>>l>>r;
   if(l==0ll)
   {
   	cout<<0;
   	return 0;
   }
   long long ans=1e16;
   if(r-l>=2018ll)
   {
   	cout<<0;
   	return 0;
   }
   for(long long i=l;i<=r-1;i++)
   {
   	for(ll j=i+1;j<=r;j++)
   	
   	ans=min(ans,(i*(j)+2019)%2019);
   }
   cout<<ans;

}






Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int[] a = new int[5];
            for (int i = 0; i < a.length; i++) {
                a[i] = in.nextInt();
            }
            int k = in.nextInt();
            for (int i = 0; i < a.length; i++) {
                for (int j = i + 1; j < a.length; j++) {
                    if (a[j] - a[i] > k) {
                        System.out.println(":(");
                        return;
                    }
                }
            }
            System.out.println("Yay!");
        }
    }
}


Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author author
 *
 */
public class Main {

  /**
   * @param args
   */
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());

    long[] h = new long[n];
    for (int i = 0; i < n; i++) {
      h[i] = Long.parseLong(sc.next());
    }

    long[] dp = new long[n];
    Arrays.fill(dp, 1000000);
    dp[0] = 0;
    dp[1] = Math.abs(h[0]-h[1]);
    
    for (int i = 2; i < h.length; i++) {
      long min1 = dp[i] = dp[i - 1] + Math.abs(h[i] - h[i - 1]);
      long min2 = dp[i] = dp[i - 2] + Math.abs(h[i] - h[i - 2]);
      dp[i] = Math.min(min1, min2);
      }
    System.out.println(dp[n - 1]);

    }
    
  }



Measured memory_bytes: 47600
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
 
int op(int a, int b ) {return max(a,b);}

int e(){return (int)-1e9;}
int main() {
  int am =300100;
  int n,k;
  cin >>n >>k ;
  vector<int>A(n);
  for (int i=0; i<n; i++)cin >> A[i];
  segtree<int, op,e>seg(am);
  
  for(int i=0; i<n;i++){
  
    int ai = A[i];
    int next = seg.prod(max(0,ai-k),min(am-1,ai+k+1))+1;
    seg.set(ai,max(next,1));
  
  }
  
  
cout << seg.prod(0,am) << endl;


}

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

int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0);
	int h, a, c = 0;
	cin >> h >> a;
	while(h > 0) {
		h -= a;
		c++;
	}
	cout << c << "\n";
	return 0;
}

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

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

int main() {
  int X; cin >> X;
  for(int i = 0; i <= 1e5+10; i++) {
    if(isPrime(i) && i >= X) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, K;

signed main() {
    cin >> N >> K;
    if(K == 1) eputs(0);
    N -= K;
    cout << N << "\n";
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
    int a,b;
    char oper;
    bool type;
    cin>>a>>oper>>b;
    if(oper=='+') type=true; else type=false;
    if(type) cout<<a+b<<endl; else cout<<a-b<<endl;
    return 0;
}

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

using namespace std;

int n;
int lis[110];
int cou = 0;
int d;
int main(){

    cin >> n;

    for(int i = 0;i <= n;i++){
        cin >> d;
        if(lis[d] == 0){
            cou++;
            lis[d] = 1;
        }  
    }
    
    cout << cou << endl;
    return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  int N, K, ans=0;
  cin >> N >> K;
  
  REP(i,N) {
    int h;
    cin >> h;
    if(h >= K) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline().rstrip()

def main():
    S=list(input())
    pre=0
    ans=0
    m=0
    p=0
    for a in S:
        if a =='<':
            p+=1
            if m != 0:
                ans-=min(pre,m)
                pre=m
                ans+=m*(m+1)//2
                m=0
        elif a=='>':
            m+=1
            if p!=0:
                pre=p
                ans+=p*(p+1)//2
                p=0
    if m != 0:
        ans-=min(pre,m)
        pre=m
        ans+=m*(m+1)//2
        m==0
    elif p!=0:
        pre=p
        ans+=p*(p+1)//2
        p==0
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 89692
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 *
 * @author yoovraj.shinde
 */
public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                String[] sa = br.readLine().split(" ");
                if (Integer.parseInt(sa[1]) >= Integer.parseInt(sa[0])) {
                    System.out.println("unsafe");
                } else {
                    System.out.println("safe");
                }

        }
}


Measured memory_bytes: 32424
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    X, Y = map(int, input().split())

    money = (0, 300000, 200000, 100000)
    ans = 0
    if X < 4:
        ans = money[X]
    if Y < 4:
        ans += money[Y]
    if X == Y == 1:
        ans += 400000
    print(ans)


main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main(){
  int n,m;
  while(cin >> n >> m && n && m){
    vector<int> node[501];
    bool fri[501];
    for(int i=0;i<=n;i++){
      fri[i] = false;
    }
    for(int i=0;i<m;i++){
      int a,b;
      cin >> a >> b;
      node[a].push_back(b);
      node[b].push_back(a);
    }
    for(int i=0;i<node[1].size();i++){
      int tmp = node[1][i];
      fri[tmp] = true;
      for(int j=0;j<node[tmp].size();j++){
	int ttmp = node[tmp][j];
	fri[ttmp] = true;
      }
    }
    int ans = 0;
    for(int i=2;i<=n;i++){
      if(fri[i]) ans++;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1364
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n) {  // 0-index
        cin >> c.at(i);
        rep(j, m) {  // 0-index
            cin >> a.at(i).at(j);
        }
    }

    int ans = MOD;
    rep(i, 1 << n) {  // パターン
        int total = 0;
        vector<int> learned(m, 0);
        rep(j, n) {  // ビットが立っているか
            if (i >> j & 1) {
                total += c.at(j);  // 金額計算
                rep(k, m) {        // アルゴリズム理解度計算
                    learned.at(k) += a.at(j).at(k);
                }
            }
        }
        bool isAllOk = true;
        rep(l, m) {
            if (learned.at(l) < x) {
                isAllOk = false;
            }
        }
        if (isAllOk) {
            ans = min(ans, total);
        }
    }

    if (ans == MOD) ans = -1;

    cout << ans << endl;

    return 0;
}


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

const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    int n;
    cin >> n;
    if(n < 1200) cout << "ABC" << endl;
    else if(n < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
a = [0]*n
res = [0]*n
ans = 10**6
for i in range(n):
    if s[i] == 'W':
        a[i] = 1
res[0] = a[0]
for i in range(n-1):
    res[i+1] = res[i] + a[i+1]
for i in range(n):
    x = res[i]-str(a[i]).count('1')
    y = n-i-1-(res[n-1]-res[i])
    ans = min(ans,x+y)
print(ans)

Measured memory_bytes: 47472
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

struct edge { int to; ll cost; };
using graph = vector<vector<edge>>;

// true -> 負の閉路を含む
bool bellman_ford(const graph &G, vector<ll> &dist, int s){
    dist[s] = 0;
    rep(i,0,G.size()){
        rep(v,0,G.size()){
            rep(k,0,G[v].size()){
                edge e = G[v][k];
                if(dist[v] != LLINF && dist[e.to] > dist[v] + e.cost){
                    dist[e.to] = dist[v] + e.cost;
                    if(i == G.size()-1 && e.to == G.size()-1) return true;
                }
            }
        }
    }
    return false;
}

int main(){
    int n; int m; cin >> n >> m;
    graph G(n);
    vector<ll> dist(n, LLINF);

    rep(i,0,m){
        int from, to;
        ll cost;
        cin >> from >> to >> cost;
        from--; to--; cost*=(-1);
        G[from].push_back({to, cost});
    }
    if(bellman_ford(G,dist,0)){
        cout<<"inf"<<endl;
    }else{
        cout<<dist[n-1]*(-1)<<endl;
    }

}

Measured memory_bytes: 384
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 100100
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    string s,t;cin>>s>>t;
    t.pop_back();
    if(s==t)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1)
    res[n] = 1;
  return res;
}

vector<ll> ind;

int f(int x) {
  int ans = 0;
  rep(i, ind.size()) {
    if (ind[i] >= x)
      ans++;
  }
  return ans;
}

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

  map<ll, ll> num_ind;
  repp(i, 2, N) {
    map<ll, ll> m = prime_factor(i);
    for (auto iter = m.begin(); iter != m.end(); iter++) {
      ll num = iter->fi;
      ll ind = iter->se;
      num_ind[num] += ind;
    }
  }

  for (auto iter = num_ind.begin(); iter != num_ind.end(); iter++) {
    ll index = iter->se;
    ind.pb(index + 1);
  }

  int M = ind.size();
  int ans = 0;

  ans += f(75);
  ans += f(15) * (f(5) - 1);
  ans += f(25) * (f(3) - 1);
  ans += f(5) * (f(5) - 1) * (f(3) - 2) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#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 n;
  cin >> n;
  vector<int> a(n);
   for (int i = 1; i*i < (n); ++i){
    a[i*i-1]+=1;
    int j = i*i-1+i;
    while(j<(n-1)){
      a[j]+=2;
      j+=i;
    }
  }
  cout << accumulate(a.begin(),a.end(),0) << endl;
  return 0;
}


Measured memory_bytes: 7140
#include<stdio.h>

int main(){
  int N, p, tot, max;
  
  scanf("%d", &N);
  for (int i = 0; i < N; i++){
    scanf("%d", &p);
    if(i == 0){
      max = p;
      tot = p/2;
    } else {
      if(max < p){
        tot += max/2;
        max = p;
        tot += max/2;
      } else {
        tot += p;
      }
    }
  }
  
  printf("%d", tot);
  
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>


using namespace std;
using vi=vector<int>;
using mii=map<int,int>;


int next_2beki(int x)
{
	int r;

	for(r=1;r<=x;r<<=1)
		;

	return r;
}


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi a(n);
		mii m;

		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
			m[a[i]]++;
		}
		sort(a.rbegin(), a.rend());

		int ans=0;
		for(int i=0;i<n;i++)
		{
			int r=next_2beki(a[i])-a[i];
			m[a[i]]--;
			if(m[a[i]]>=0 && m.find(r)!=m.end())
			{
				if(m[r]>0)
				{
					ans++;
					m[r]--;
				}
				if(m[r]<=0) m.erase(m.find(r));
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  set<string> se;
  while (n--) {
    string s;
    cin >> s;
    se.insert(s);
  }
  cout << size(se) << '\n';
}


Measured memory_bytes: 19284
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 1010
using namespace std;
int ans[MAXN][MAXN];
char w[10]={'.','<','>','^','v'};
int n,m;
int ablx,ably;
bool work(int a,int b,int flag){
    if(n%2==1)
        ablx=m/2;
    if(m%2==1)
        ably=n/2;
    if(flag==1){
        ablx--;
        ably--;
    }
    for(int i=1;i+1<=n;i+=2)
        for(int j=1;j+1<=m;j+=2){
            if(ans[i][j]||ans[i][j+1]||ans[i+1][j]||ans[i+1][j+1])
                continue;
            if(a>ablx){
                ans[i][j]=1;
                ans[i][j+1]=2;
                a--;
                if(a>0){
                    ans[i+1][j]=1;
                    ans[i+1][j+1]=2;
                    a--;
                }
            }
            else if(b>ably){
                ans[i][j]=3;
                ans[i+1][j]=4;
                b--;
                if(b>0){
                    ans[i][j+1]=3;
                    ans[i+1][j+1]=4;
                    b--;
                }
            }
        }
    if(n%2==1){
        for(int j=1;j+1<=m;j+=2)
            if(a>0&&ans[n][j]==0&&ans[n][j+1]==0){
                ans[n][j]=1;
                ans[n][j+1]=2;
                a--;
            }
    }
    if(m%2==1){
        for(int i=1;i+1<=n;i+=2)
            if(b>0&&ans[i][m]==0&&ans[i+1][m]==0){
                ans[i][m]=3;
                ans[i+1][m]=4;
                b--;
            }
    }
    return a||b;
}
void print(){
    PF("YES\n");
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++)
            PF("%c",w[ans[i][j]]);
        PF("\n");
    }
}
int main(){
    int a,b;
    SF("%d%d%d%d",&n,&m,&a,&b);
    if(work(a,b,0)==0){
        print();
    }
    else if(n%2==1&&m%2==1&&n>=3&&m>=3&&a>=2&&b>=2){
            memset(ans,0,sizeof ans);
            ans[n][m]=4;
            ans[n-1][m]=3;
            ans[n-2][m]=2;
            ans[n-2][m-1]=1;
            ans[n-2][m-2]=3;
            ans[n-1][m-2]=4;
            ans[n][m-2]=1;
            ans[n][m-1]=2;
            if(work(a-2,b-2,1)==0)
                print();
            else
                PF("NO");
        }
    else{
        PF("NO");
    }
}


Measured memory_bytes: 5120
/**
  * Created by ui on 2016/02/07.
  */
import java.util.Scanner

object PrintAFrame {


  def inputHW (s:Scanner)= {
    val h = s.nextInt
    val w = s.nextInt
    (h,w)
  }
  def printFrame(x:Int, y:Int): Unit = {
    var s = "#".padTo(x-1, '.')
    s += "#"
    println("".padTo(x,'#'))

    for (i <- 0 until y -2) println(s)
    println("".padTo(x,'#'))
    println
  }
  def run: Unit = {
    val sc: Scanner = new java.util.Scanner(System.in)
    var a = inputHW(sc)
    var h = a._1
    var w = a._2
    while (h != 0 || w != 0) {
      printFrame(w,h)
      a = inputHW(sc)
      h = a._1
      w = a._2
    }
  }
}
/**
  * Created by ui on 2016/02/04.
  */
object Main {
  def main(args: Array[String]): Unit = {
    PrintAFrame.run
  }
}

Measured memory_bytes: 45212
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <sstream>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define rrep(i, a) RREP(i, a, 0)
#define RREP(i, a, b) for(int i = a; i >= b; --i)
#define repll(i, a) REPLL(i, 0, a)
#define REPLL(i, a, b) for(ll i = a; i < b; ++i)
#define rrepll(i, a) RREPLL(i, a, 0)
#define RREPLL(i, a, b) for(ll i = a; i >= b; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<int, P> PP;
const double PI = 3.14159265358979323846;
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+17 + 10;

int q;

int main() {
	std::cin >> q;
	rep(i, q) {
		int n;
		std::cin >> n;
		int cnt = 0;
		while (true) {
			int max = 0;
			std::string str = std::to_string(n);
			if (str.size() == 1)break;
			REP(i, 1, str.size()) {
				max = std::max(max, std::atoi(str.substr(0, i).c_str()) * std::atoi(str.substr(i, str.size() - i).c_str()));
			}
			n = max;
			cnt++;
		}
		std::cout << cnt << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3268
from collections import Counter

N = int(input())
X = list(map(int, input().split()))
ctr = Counter(X)

ans = 0
for v in ctr.values():
    ans += v * (v - 1) // 2

for i in range(N):
    val = ctr[X[i]]
    print(ans - val * (val - 1) // 2 + (val - 1) * (val - 2) // 2)


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

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int ans = 0;
  for (int i=1; i<=n; i++){
    int d = i%10 + (i%100)/10 + (i%1000)/100 + (i%10000)/1000 + (i%100000)/10000;
    if (a<=d && d<=b) ans +=i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import copy

N,M=map(int,input().split())
mod=10**9+7

#x以下の素数の列挙   
import math
x=math.floor(math.sqrt(10**9))
L=math.floor(math.sqrt(x))#平方根を求める
Primelist=[i for i in range(x+1)]
Primelist[1]=0#素数でないものは0にする.
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0
Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]

def fact(M):#約数の列挙
    if M==1:
        return {1}
    
    DICT=dict()#素因数分解
    i=0
    while M!=1 and i<len(Primes):
        if M%Primes[i]==0:
            DICT[Primes[i]]=DICT.get(Primes[i],0)+1
            M=M//Primes[i]
        else:
            i+=1

    if M!=1:
        DICT[M]=1

    VALUES=list(DICT.values())
    KEYS=list(DICT.keys())

    LIST=[1]

    for i in range(len(DICT)):
        NOWLIST=copy.copy(LIST)
        for l in NOWLIST:
            for j in range(0,VALUES[i]+1):
                LIST.append(l*KEYS[i]**j)

    return set(LIST)

def Combi2(a,b):#aは大きいが、bは小さいとき
    if b>a:
        return 0
    ANS=1
    for i in range(min(b,a-b)):
        ANS=ANS*(a-i)%mod*pow(min(b,a-b)-i,mod-2,mod)%mod

    return ANS%mod



SET=fact(M)
factor=dict()

for j in SET:
    factor[j]=fact(j)

DP=dict()
defaultans=[0 for i in range(40)]
defaultans[1]=1
defaultans=tuple(defaultans)

def dp(m):
    ANS=[0 for i in range(40)]
    if m==1:
        return defaultans
    
    for j in factor[m]:
        #print(j,factor[m])

        if j==1:
            continue
        else:
            if DP.get(m//j,-1)!=-1:
                NEXT=DP[m//j]
            else:
                NEXT=dp(m//j)

            for k in range(39):
                ANS[k+1]=(ANS[k+1]+NEXT[k])%mod

            #print(m//j,ANS,NEXT)

        DP[m]=ANS
    return ANS
            
LIST=dp(M)
ANS=0
for i in range(40):
    if LIST[i]!=0:
        ANS=ANS+Combi2(N,i-1)*LIST[i]%mod

print(ANS%mod)


Measured memory_bytes: 10764
package main

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

type Store struct {
	yen   int
	drink int
}

type Stores []Store

func main() {
	var N, M int
	var money int64

	fmt.Scan(&N, &M)
	sc := wordScanner()

	store := make(Stores, N)

	for i := range store {
		store[i].yen, store[i].drink = getInt(sc), getInt(sc)
	}
	sort.Sort(store)

	for _, v := range store {
		if v.drink < M {
			money += int64(v.drink) * int64(v.yen)
			M -= v.drink
		} else {
			money += int64(M) * int64(v.yen)
			break
		}
	}
	fmt.Println(money)

}

func (s Stores) Len() int {
	return len(s)
}

func (s Stores) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s Stores) Less(i, j int) bool {
	return s[i].yen < s[j].yen
}

// 空白区切りで読み込む
func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

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


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

using namespace std ;

int ans = 1e9 ;

int vis[305][305][305] ;

void solve(int x , int y , int z , int steps)
{
	if(x > 300 || y > 300 || z > 300)
		return ;
	if(vis[x][y][z])
		return ;
	vis[x][y][z] = 1 ;
	if(x == y && y == z)
	{
		ans = min(ans,steps);
		return ;
	}
	solve(x+2 , y , z , steps+1) ;
	solve(x , y+2 , z , steps+1) ;
	solve(x , y , z+2 , steps+1) ;
	solve(x+1 , y+1 , z , steps+1) ;
	solve(x+1 , y , z+1 , steps+1) ;
	solve(x , y+1 , z+1 , steps+1) ;
	return ;
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int arr[3] ;
	cin>>arr[0]>>arr[1]>>arr[2] ;
	solve(arr[0] , arr[1] , arr[2] , 0) ;
	return cout<<ans<<"\n" , 0 ;
}


Measured memory_bytes: 110848
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pb                  push_back
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int k;cin>>k;
    fo0(i,k){
        cout<<"ACL";
    }

}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<fixed<<setprecision(3)<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
 
 
static const int NMAX = 2*1e3+5;
 
int n;
int v[NMAX];
 
int cb(int x)
{
    int logN=1,k=0;
    for(;logN<=n;logN<<=1);
 
    for(; logN ; logN >>=1)
    {
        if(logN + k <= n)
        {
            if(v[logN+k] < x)
                k+=logN;
        }
    }
    return k;
}
 
void Solve()
{
    int ct =0;
    for(int i = 1; i< n; ++i)
    {
        for(int j = i + 1; j<= n; ++j)
        {
            int x = cb(v[i]+v[j]);
            ct += (x - j);
        }
    }
    std::cout << ct;
}
 
void ReadInput()
{
    std::cin >> n;
    for(int i = 1;i<=n ; ++i)
        std::cin >> v[i];
    std::sort(v+1,v+n+1);
}
 
int main()
{
    ReadInput();
    Solve();
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N;
    cin >> N;
    string S, T;
    cin >> S >> T;

    REP(i,0,N) cout << S[i] << T[i];
    cout << endl;

    return 0;
}

/*



*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, m; cin >> n >> m;
    vector<int> k(m), p(m);
    vector<vector<int> > s(m);
    rep(i, m) {
        cin >> k[i];
        rep(j, k[i]) {
            int a; cin >> a;
            a--;
            s[i].push_back(a);
        }
    }
    rep(i, m) cin >> p[i];

    int ans = 0;
    rep(i, 1<<n) {
        int cnt = 0;
        rep(j, m) { //電球について
            int tmp = 0;
            rep(k, sz(s[j])) {
                if (i>>s[j][k] & 1) {
                    tmp++;
                }
            }
            if (tmp%2 == p[j]) cnt++;
            else break;
        }
        if (cnt == m) ans++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
//#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    if (x >= 30) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
}


Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int number = Integer.parseInt(br.readLine());

		String[] inputValueAry = br.readLine().split(" ");
		int[] array = new int[inputValueAry.length];
		for (int i = 0; i < inputValueAry.length; i ++) {
			array[i] = Integer.parseInt(inputValueAry[i]);
		}
		insertionSort(array, number);
	}

	public static void insertionSort(int[] array, int number) {

		printArray(array);
		for (int i = 1; i < number; i ++) {
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
			printArray(array);
		}
	}

	public static void printArray(int[] array) {
		for (int i = 0; i < array.length; i ++) {
			if (i != 0) {
				System.out.print(" ");
			}
			System.out.print(array[i]);
		}
		System.out.println("");
	}
}



Measured memory_bytes: 31728
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
using namespace std;
#define REP(m,n) for(int i=m;i<n;++i)
#define REPj(m,n) for(int j=m;j<n;++j)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
int main() {
	int n;
	cin >> n;
	if (n / 10 == 9 || n % 10 == 9) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

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

int main(){

  string s;
  cin >> s;
  ll ans = 0;
  int len = s.size();
  ll cnt = 0;

  rep(i, len){
    if(cnt == 0){//グーしか出せない
      if(s[i] == 'p') ans--;
      cnt++;
    }
    else{
      if(s[i] == 'g') ans++;
      cnt--;
    }
  }

  cout << ans <<endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    int ans=1e9;
    for(int i=0;i<=N;i++){
        int a=i,b=N-a;
        int c1=0,c2=0;
        while(a>0){
            c1+=a%6;
            a/=6;
        }
        while(b>0){
            c2+=b%9;
            b/=9;
        }
        ans=min(ans,c1+c2);
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//b[2*100000+10]={},dis[2*100000+10]={};
int N,C[25],V[25],num,ans=0;
int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> V[i];
  }
  for(int i=0;i<N;i++){
    cin >> C[i];
  }
  for(int i=0;i<N;i++){
    num=V[i]-C[i];
    ans+=max(0,num);
  }

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


Measured memory_bytes: 384