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

class Main
{
	public static void main( String[] args )
	{
		Main m = new Main();
		m.B();
	}

	void B()
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), t = in.nextInt(), inf = Integer.MAX_VALUE;
		int cost = inf;
		for(int i = 0; i < n; i++)
		{
			int ci = in.nextInt(), ti = in.nextInt();
			if(ti <= t)
			{
				cost = Math.min(cost, ci);
			}
		}
		if(cost == inf) System.out.println("TLE");
		else System.out.printf("%d\n", cost);
	}

	void A()
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		if(n == 1) System.out.println("Hello World");
		if(n == 2)
		{
			int a = in.nextInt(), b = in.nextInt();
			System.out.println(a + b);
		}
	}

	// int numWays(int k)
	// {
	// 	if(k < 3) return 1;
		
	// }


	// static int B(String str)
	// {
	// 	int cur = Integer.valueOf(str);
	// 	for(int i = 111; i <= 999; i += 111)
	// 		if(cur <= i) return i;
	// 	return cur;	// should not execute this line
	// }

	// static String update(String str)
	// {
	// 	char[] ch = str.toCharArray();
	// 	for(int i = 0; i < 3; i++)
	// 	{
	// 		if(ch[i] == '1') ch[i] = '9';
	// 		else ch[i] = '1';
	// 	}
	// 	return String.valueOf(ch);
	// }

}

Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>

using namespace std;


int main() {

	vector<char> c;

	char t;

	while (cin >> t) {
		for (char x : c) {
			if (x == t) {
				cout << "no" << endl;
				return 0;
			}
		}
		c.push_back(t);
	}
	
	cout << "yes" << endl;
	
	return 0;
}


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

    String contest;
    if( rate < 1200 ){
      contest = "ABC";
    }else if(rate <  2800){
      contest = "ARC";
    }else {
      contest = "AGC";
    }

    System.out.println(contest);
  }
}


Measured memory_bytes: 22868
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int h, w;

int solve(bool used[20][20], char s[21][21], int x, int y){
  int res = 0;
  if(s[y][x] == '#'){
    return 0;
  }else{
    res++;
  }

  REP(i,4){
    int next_x = x + dx[i], next_y = y + dy[i];
    if(next_x >= 0 && next_x < w && next_y >= 0 && next_y < h){
      if(!used[next_y][next_x]){
        used[next_y][next_x] = true;
        res += solve(used, s, next_x, next_y);
      }
    } 
  }
  return res;
}

int main(){

  while(true){
    scanf("%d %d", &w, &h);
    if(h == 0 && w == 0){
      break;
    }

    char s[21][21];
    REP(i,h){
      scanf("%s", s[i]);
    }

    bool found = false;
    REP(i,h){
      REP(j,w){
        if(s[i][j] == '@'){
          bool used[20][20] = {};
          used[i][j] = true;
          int ans = solve(used, s, j, i);
          printf("%d\n", ans);
          break;
          found = true;
        }
      }
      if(found) break;
    }
  }
  return 0;
}




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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(a) a.begin(), a.end()
#define ll long long
#define mod 1000000007

using namespace std;

int main()
{
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int sum = 0;
  rep(i, n) {
    if (i < k) {
      sum += x;
    } else {
      sum += y;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
s = input()

answer = True
for i in range(len(s)):
    if i == a:
        if s[i] != '-':
            answer = False
            break
    else:
        if s[i] == '-':
            answer = False
            break
        if int(s[i]) < 0 or int(s[i]) > 9:
            answer = False
            break

if answer:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
N, K = map(int, input().split())
R = N - K
mod = 10 ** 9 + 7


def makeTableMod(N, mod=10 ** 9 + 7):
    fac = [1 for i in range(N)]
    finv = [1 for i in range(N)]
    inv = [1 for i in range(N)]
    for i in range(2, N):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod
    return fac, finv


fac, finv = makeTableMod(2001, mod)


def binomialCoefficient(N, r, mod=10 ** 9 + 7):
    if N < r:
        return 0
    else:
        return fac[N] * (finv[r] * finv[N - r] % mod) % mod


def solve(i):
    # (N-K+1, i) * (K-1, i-1)を計算すれば良い
    ans = binomialCoefficient(N-K+1, i) * binomialCoefficient(K-1, i-1) % mod
    return ans


for i in range(K):
    if i == 0:
        print((R+1) % mod)
    else:
        ans = solve(i+1)
        print(ans % mod)

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long

static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const ll INF = 1e18;

int main() {

    int n; cin >> n;
    while(1){
        if(n % 111 == 0)break;
        n++;
    }
    cout << n << endl;
    


}

/*
みんな、くるくるぱーにな〜れ
　∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a[5];
	int k;
	for(int i = 0; i < 5; i++)
		scanf("%d", a + i);
	scanf("%d", &k);
	int chk = 0;
	for(int i = 0; i < 5; i++){
		for(int j = i + 1; j < 5; j++){
			if(a[j] - a[i] > k)chk = 1;
		}
	}
	if(chk)printf(":(\n");
	else printf("Yay!\n");
	return 0;
}


Measured memory_bytes: 128
n = int(input())
w = list(map(int, input().split()))

ref = sum(w)

for i in range(1, n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    diff = abs(s1 - s2)
    if diff <=  ref:
        ref = diff

print(ref)

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

using namespace std;

int main() {
  bool b[26] = {};
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    b[s[i] - 'a'] =true;
  }
  for (int i = 0; i < 26; i++) {
    if (!b[i]) {
      cout << (char)('a' + i) << '\n';
      return 0;
    }
  }
  cout << "None\n";
  return 0;
}


Measured memory_bytes: 512
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<bitset>
#include<cstdlib>
#include<set>
#include<unordered_map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define low(x) (x&(-x))
#define IL inline
#define reg register
#define LL long long
#define N 500010
#define MOD 998244353
#define MO 1000000007
#define INF 0x3f3f3f3f
using namespace std;

LL T,n,m,i,j,k,x,y,z,d;
LL a[N],b[N];
char c[N];

IL LL Abs(LL x){return (x<0)?-x:x;}
IL void Swap(LL &a,LL &b){a^=b^=a^=b;}
IL LL Min(LL a,LL b){return (a<b)?a:b;}
IL LL Max(LL a,LL b){return (a>b)?a:b;}

IL LL Mi(LL x,LL y){
	LL p=x,t=1,Res=1;
	for (;t<=y;(t&y)?Res=(Res*p)%MOD:0,p=(p*p)%MOD,t<<=1);
	return Res;
}

IL LL read(){
	LL p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	x=read();	k=read();	d=read();
	x=Abs(x);
	y=x/d;
	if (y>=k){
		cout<<x-(k*d)<<endl;
		return 0;
	}
	k-=y;
	z=Abs(x-(y*d)-d);
	if (k&1){
		cout<<Abs(z)<<endl;
	}	else cout<<Abs(x-y*d)<<endl;
	return 0;
}

Measured memory_bytes: 3636
N,K = map(int,input().split())
S = input()
L = []
cur = S[0]
cnt = 0
if S[len(S)-1] == '1':
  S += '0'
else:
  S += '1'
for i in range(len(S)):
  if S[i] == cur:
    cnt += 1
  else:
    L.append(cnt)
    cnt = 1
    cur = S[i]
ruiseki = [L[0]]
for i in range(len(L)-1):
  ruiseki.append(ruiseki[i]+L[i+1])
ruiseki.insert(0,0)
if len(ruiseki) == 2:
  print(len(S)-1)
else:
  if S[0] == '1' and S[len(S)-2] == '1':
    if (len(L)-1)/2 > K:
      ans = 0
      for i in range(len(ruiseki)-2*K-1):
        if i%2 == 0:
          if ans <= ruiseki[i+2*K+1]-ruiseki[i]:
            ans = ruiseki[i+2*K+1]-ruiseki[i]
      print(ans)
    else:
      print(len(S)-1)
  elif S[0] == '1' and S[len(S)-2] == '0':
    if len(L)/2 > K:
      ans = 0
      for i in range(len(ruiseki)-2*K-2):
        if i%2 == 0:
          if ans <= ruiseki[i+2*K+1]-ruiseki[i]:
            ans = ruiseki[i+2*K+1]-ruiseki[i]
      print(max(ans,ruiseki[len(ruiseki)-1]-ruiseki[len(ruiseki)-1-2*K]))
    else:
      print(len(S)-1)
  elif S[0] == '0' and S[len(S)-2] == '1':
    if len(L)/2 > K:
      ans = 0
      for i in range(1,len(ruiseki)-2*K):
        if i%2 != 0:
          if ans <= ruiseki[i+2*K+1]-ruiseki[i]:
            ans = ruiseki[i+2*K+1]-ruiseki[i]
      print(max(ans,ruiseki[2*K]-ruiseki[0]))
    else:
      print(len(S)-1)
  else:
    ans = 0
    if (len(L)+1)/2 > K:
      for i in range(len(ruiseki)-2*K-3):
        if i%2 != 0:
          if ans <= ruiseki[i+2*K+1]-ruiseki[i]:
            ans = ruiseki[i+2*K+1]-ruiseki[i]
      print(max(ans,ruiseki[2*K]-ruiseki[0],ruiseki[len(ruiseki)-1]-ruiseki[len(ruiseki)-1-2*K]))
    else:
      print(len(S)-1)

Measured memory_bytes: 8052
// https://kmjp.hatenablog.jp/entry/2020/04/12/1030
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

ll dp[202020][2][3];

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    
    // dp[i][x][y] := i: i要素目までの選び方を考えた時、x: i要素目を選ばなかったかどうか、y: これまで連続で選ばなかった箇所の数
    rep(i, n + 1) {
        rep(x, 2) {
            rep(y, 3) {
                dp[i][x][y] = -1 * LINF;
            }
        }
    }

    dp[0][1][0] = 0;

    rep(i, n) {
        ll x;
        cin >> x;
        rep(j, 2) {
            rep(k, 3) {
                // not take
                if (k + j < 3) dp[i + 1][1][k + j] = max(dp[i + 1][1][k + j], dp[i][j][k]);
                // take
                if (j == 1) dp[i + 1][0][k] = max(dp[i + 1][0][k], dp[i][j][k] + x);
            }
        }
    }

    if (n % 2 == 0) cout << max(dp[n][1][0], dp[n][0][1]) << endl;
    else cout << max(dp[n][0][2], dp[n][1][1]) << endl;


    return 0;
}

Measured memory_bytes: 13036
import sys
s = list(input())
t = list(input())
s.sort()
t.sort()
for x, y in zip(s, t[::-1]):
    if x > y:
        print('No')
        sys.exit()
    elif x == y:
        continue
    else:
        print('Yes')
        sys.exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

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

int main() {
  int N, K;
  cin >> N >> K;
  double ans = 0;
  for (int i = 1; i <= N; i++) {
    int n = i;
    int c = 0;
    while (n < K)
      n *= 2, c++;
    ans += double(1e19) / (1 << c);
  }
  ans /= double(1e19);
  printf("%.12f\n", ans / N);
}

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

int main(){
  int n,kekka = 0;
  cin>> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++){
    cin >> a.at(i);
  }
  for(int i = 0;i < n;i++){
    while(a.at(i) % 2 == 0){
      a.at(i) /= 2;
      kekka++;
    }
  }
  cout << kekka << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
 
    vl w(n);
    ll sum = 0;
    rep(i, n) {
        cin >> w[i];
        sum += w[i];
    }
 
    ll s1, s2, ans = INF; 
    rep(i, n) {
        s1 = 0;
        rep(j, i+1) {
            s1 += w[j];
        }
        s2 = sum - s1;
        chmin(ans, abs(s1-s2));
    }
 
    out(ans);
    re0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())

h = [int(s) for s in input().split()]


gr = [[] for _ in range(n)]

for i in range(m):
    ar = [int(s) for s in input().split()]
    gr[ar[0]-1].append(ar[1])
    gr[ar[1]-1].append(ar[0])
    
#print(h)
#print(gr)
ans = n

for i in range(n):
    ar = gr[i]
    mx = h[i]
    for j in ar:
        if(h[j-1] >= mx):
            ans -= 1
            break

print(ans)
        

Measured memory_bytes: 29392
#include <bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
    int n, m;
    cin >> n >> m;
    scc_graph g(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        g.add_edge(a, b);
    }
    auto vs = g.scc();
    cout << vs.size() << endl;
    rep(i, vs.size()) {
        cout << vs[i].size();
        rep(j, vs[i].size()) cout << ' ' << vs[i][j];
        cout << endl;
    }
}


Measured memory_bytes: 40108
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn petrs_belief(p: &[f64], q: &[f64], x: f64) -> f64 {
    let mut sum = 0.0;
    for i in 0 .. 6 {
        let t1 = p[i] * x;
        let t2 = q[i] * (1.0 - x);
        sum += if t1 > t2 { t1 } else { t2 };
    }
    sum
}

fn solve() {
    let p: Vec<f64> = (0 .. 6).map(|_| get::<f64>() / 100.0).collect();
    let q: Vec<f64> = (0 .. 6).map(|_| get::<f64>() / 100.0).collect();
    let mut lo = 0.0;
    let mut hi = 1.0;
    for _ in 0 .. 50 {
        let mid1 = (lo * 2.0 + hi) / 3.0;
        let mid2 = (lo + 2.0 * hi) / 3.0;
        let f1 = petrs_belief(&p, &q, mid1);
        let f2 = petrs_belief(&p, &q, mid2);
        if f1 < f2 {
            hi = mid2;
        } else {
            lo = mid1;
        }
    }
    println!("{}", petrs_belief(&p, &q, lo));
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int r;
    cin >> r;
    double ans = 2 * M_PI * r;
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 3724
S = input()
N = len(S)

l = []
k = 1
for i in range(N-1):
  if S[i] == S[i+1]:
    k += 1
  else:
    l.append(k)
    k = 1
l.append(k)

ans = [0] * N
k = 0
if S[1] == "L":
  s = 1 + l[1]
  if l[1] % 2 == 0:
    ans[0] = (s + 1) // 2
  else:
    ans[0] = s // 2
for i in range(1, N-1):
  s = l[k] + l[k+1]
  if S[i-1] == "R" and S[i] == "L":
    if (l[k] < l[k+1] and l[k+1] % 2 == 1) or (l[k] > l[k+1] and l[k] % 2 == 0):
      ans[i] = (s + 1) // 2
    else:
      ans[i] = s // 2
    k = min(k+2, len(l)-2)
  elif S[i] == "R" and S[i+1] == "L":
    if (l[k] > l[k+1] and l[k] % 2 == 1) or (l[k+1] > l[k] and l[k+1] % 2 == 0):
      ans[i] = (s + 1) // 2
    else:
      ans[i] = s // 2
  else:
    ans[i] = 0
if S[-2] == "R":
  s = l[-2] + 1
  if l[-2] % 2 == 0:
    ans[N-1] = (s + 1) // 2
  else:
    ans[N-1] = s // 2

print(" ".join(map(str, ans)))

Measured memory_bytes: 11380
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader s = new FastReader();
        double l = s.nextDouble();
        System.out.printf("%.6f",(l*l*l)/27);
    }

    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

}

Measured memory_bytes: 21204
#include<stdio.h>
#include<string.h>

int checkRightAngle(a,b,c){
	if(a*a == b*b + c*c ||
	   b*b == a*a + c*c ||
	   c*c == a*a + b*b){
			return 1;
	}

	return 0;
}

int main(){
	int n,i,a,b,c;

	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d %d %d",&a ,&b ,&c);
		if(checkRightAngle(a,b,c)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

	return 0;
}

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

static std::vector<int> sosuu = {
	2,  3,	5,	7,	11,	13,	17,	19,	23,	29,	31,	37,	41,	43,	47,	53,	59,	61,	67,	71,
	73,	79, 83, 89, 97 };

void getSosuuCounts(const int n, std::vector<int> *const counts) {
	if (n == 1) {
		return;
	}
	for (int i = 0; i < static_cast<int>(sosuu.size()); ++i) {
		int n2 = n;
		while (true) {
			if (n2 % sosuu[i] == 0) {
				++counts->at(i);
				n2 /= sosuu[i];
			}
			else {
				break;
			}
		}
	}
	getSosuuCounts(n - 1, counts);
}

int getLargerCount(const std::vector<int> &counts, const int thr) {
	int result = 0;
	for (const auto &count : counts) {
		if (count >= thr) {
			++result;
		}
	}
	return result;
}

int kaijou(const int n) {
	int result = 1;
	for (int i = 2; i <= n; ++i) {
		result *= i;
	}
	return result;
}

int nCk(const int n, const int k) {
	if (n <= 0) {
		return 0;
	}
	return kaijou(n) / kaijou(k) / kaijou(n - k);
}

int get75num(const int n) {
	std::vector<int> counts(static_cast<int>(sosuu.size()), 0);
	getSosuuCounts(n, &counts);

	const int larger_than_4_count = getLargerCount(counts, 4);
	const int larger_than_2_count = getLargerCount(counts, 2);
	const int num1 = nCk(larger_than_4_count, 2) * (larger_than_2_count - 2);

	const int larger_than_14_count = getLargerCount(counts, 14);
	const int num2 = larger_than_14_count * (larger_than_4_count - 1);

	const int larger_than_24_count = getLargerCount(counts, 24);
	const int num3 = larger_than_24_count * (larger_than_2_count - 1);

	const int larger_than_74_count = getLargerCount(counts, 74);
	const int num4 = larger_than_74_count;

	return num1 + num2 + num3 + num4;
}

int main() {
	int n;
	std::cin >> n;
	std::cout << get75num(n) << std::endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
ans = 0
l = sorted(l)

for a in range(n-2):
    for b in range(a, n-1):
        for c in range(b, n):
            if l[a] != l[b] != l[c]:
                if abs(l[b] - l[c]) < l[a] < l[b] + l[c]:
                    ans += 1

print(ans)


Measured memory_bytes: 9184
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	cnt := 0
	for i := 0; i < 1000; i++ {
		pin := fmt.Sprintf("%03d", i)
		p1 := pin[0:1]
		p2 := pin[1:2]
		p3 := pin[2:3]

		i1 := strings.Index(s, p1)
		if i1 < 0 {
			continue
		}

		i2 := strings.Index(s[i1+1:], p2)
		if i2 < 0 {
			continue
		}

		i3 := strings.Index(s[i1+1+i2+1:], p3)
		if i3 < 0 {
			continue
		}
		cnt++
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 896
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n; cin >> n; bool af = false; bool nf = false;
  
  ll a = n % 100; n /= 100;
  
  if(1 <= a and a <= 12) af = true;
  if(1 <= n and n <= 12) nf = true;
  
  if(af and nf) cout << "AMBIGUOUS" << endl;
  else if(af) cout << "YYMM" << endl;
  else if(nf) cout << "MMYY" << endl;
  else cout << "NA" << endl;
  
  
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define test(t) int t;cin>>t;while(t--)
#define lli long long int
#define pb push_back
#define MAX 1000000007
#define mod 1000000007
#include <string>
const lli infl=0x3f3f3f3f3f3f3f3fLL;

int main()
{  ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
  //test(t)
   {
       lli a,b,c,n,d,x,q,k=0,y,r,i,j,l,sum=0;
      string s;
      cin>>a>>b;
      if(b>=a)
        cout<<"unsafe";
      else
        cout<<"safe";
    cout<<endl;
   }




}


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

int main(void) {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  int ma = *max_element(L.begin(), L.end());
  if (accumulate(L.begin(), L.end(), 0) - ma > ma) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

vector<int> A[30],B[30];

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  int n;cin>>n;

  for(int i=0;i<n;i++){
    int x;cin>>x;
    for(int j=0;j<x;j++){
      int t1,t2;cin>>t1>>t2;
      t1--;
      A[i].push_back(t1);B[i].push_back(t2);
    }
  }
  int ans=0;
  for(int i=0;i<(1<<n);i++) {
    bool ok=true;
    for(int j=0;j<n;j++){
      if(! ( i&(1<<j) ) ) continue;

      for(int k=0;k<A[j].size();k++){
        int x = A[j][k];int y = B[j][k];
        if(y==0 && i & (1<<x)) ok = false;
        if(y==1 && !(i & (1<<x))) ok = false;
      }
    }
    if(ok)ans = max(ans, __builtin_popcount(i));
  }
  cout<<ans<<endl;
  
  return 0;
}


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

int main(){
    int k ;
    cin >> k ;
    string s ;
    cin >> s ;
    if(s.size() <= k )cout << s << endl;
    else{
        rep(i,k) cout << s[i] ;
        cout << "..."<< endl;
    }
}

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

int main(){
    int N;
    cin >> N;
    double x[N]={};
    string u[N]={};

    for(int i=0;i<N;i++){
        cin >> x[i] >> u[i];
    }

    double a=0;

    for(int j=0;j<N;j++){
        if(u[j]=="JPY"){
            a=a+x[j];
        }else{
            a=a+380000*x[j];
        }
    }

    cout << a << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func calc(A int64) int64 {
	if A == 0 {
		return 0
	}

	A++
	ans := int64(0)
	for i := 0; i < 50; i++ {
		loop := int64(1) << uint(i+1)
		cnt := (A / loop) * (loop / 2)
		if add := (A % loop) - (loop / 2); add > 0 {
			cnt += add
		}
		ans += (1 << uint(i)) * (cnt % 2)
	}
	return ans
}

func main() {
	A, B := int64(0), int64(0)
	_, _ = fmt.Scan(&A, &B)
	fmt.Println(calc(B) ^ calc(A - 1))
}


Measured memory_bytes: 512
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll n;
vll a;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    a.resize(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    vll left(n + 1, 0), right(n + 1, 0);
    for (ll i = 0; i < n; i++) left[i + 1] = gcd(left[i], a[i]);
    for (ll i = n - 1; i >= 0; i--) right[i] = gcd(right[i + 1], a[i]);
    ll ans = 0;
    for (ll i = 0; i < n; i++) chmax(ans, gcd(left[i], right[i + 1]));

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    long long X, Y;
    cin >> X >> Y;
    int ans = 0;
    for (long long now = X; now <= Y; now *= 2) {
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	int N; cin >> N;
	vector<int> H(N);
	vector<int> ans(N, 0);
	int ANS = 0;
	rep(i, N) {
		cin >> H[i];
		if (i == 0)continue;
		ans[i] += (H[i - 1] >= H[i] ? ans[i - 1] + 1: 0);
		ANS = max(ANS, ans[i]);
	}

	cout << ANS << endl;

	return 0;
}


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

typedef long long ll;

int main() {
  int N, M;

  while (cin >> N >> M) {
    vector<ll> P(M);
    vector<ll> change(N, 0);

    for (int i = 0; i < M; i++) {
      cin >> P[i];
      P[i]--;

      if (i == 0) continue;

      int lft = min(P[i - 1], P[i]);
      int rht = max(P[i - 1], P[i]);

      change[lft]++;
      change[rht]--;
    }

    vector<ll> A(N), B(N), C(N);

    for (int i = 0; i < N - 1; i++) {
      cin >> A[i] >> B[i] >> C[i];
    }

    ll curCnt = 0;
    ll ans = 0;

    for (int i = 0; i < N - 1; i++) {
      curCnt += change[i];

      ll ticket = A[i] * curCnt;
      ll ic = C[i] + B[i] * curCnt;

      ans += min(ticket, ic);
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 4964
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pii pair<int,int>
#define vvi vector<vector<int>>
#define vi vector<int>
#define f first 
#define s second 
using namespace std;
const int N=5e6+10;
const int mod=1e9+7;
int arr[N],iarr[N];
int logi(int n){int p=0;while(n/2){n=n/2;p++;}return p;}
int poww(int x,int y){int pro=1;while(y){if(y&1)pro=((pro%mod)*(x%mod)%mod);y=y>>1;x=((x%mod)*(x%mod)%mod);}return pro;}
int poww2(int x,int y){int pro=1;while(y){if(y&1)pro=pro*x;y=y>>1;x=x*x;}return pro;}
double poww1(double x,int y){double pro=1.000000000;while(y){if(y&1)pro=((pro)*(x));y=y>>1;x=((x)*(x));}return pro;}
map<int,int> mp1,mp2;
set<int> st;
int arr1[1000001],arr2[1000001];
/*

*/
void solve()
{
	int x;
	cin>>x;
	if(x>=30) cout<<"Yes";
	else cout<<"No";
}

int32_t main()																																	
{
	fast;
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
 
 
void swap (int *x, int *y) {
  int temp;    
 
  temp = *x;
  *x = *y;
  *y = temp;
}
 
int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }
 
  if(b==0){
    return a;
  }
 
  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }
 
  return b;
}
 
/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
 
 
int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}
 
int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}
 
int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}
 
void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }
 
  return;
}
 
void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }
 
  return;
}
 

int main(void){
  char s[20];
  scanf("%s",s);
  for(int i=0;i<19;i++){
    if(s[i]==','){
      printf(" ");
    }else{
      printf("%c",s[i]);
    }
  }
  
  return 0;
}

Measured memory_bytes: 1632
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define inl(a) cin >> a
#define prl(a) cout << a << " "
#define outl(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<int,pair<int,int> > >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define N 100005
int dp[N];
int main()
{
    int n,i,j,k;
    in2(n,k);
    vi v(n);
    read(v,i,n);
    fill(dp+1,dp+n,M);
    lp(i,0,n)
    {
        lp(j,1,k+1)
        {
            if(i+j<n)
                dp[i+j]=min(dp[i+j],dp[i]+abs(v[i]-v[i+j]));
            else
                break;
        }
    }
    out(dp[n-1]);

}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#define MAX_VERTEXES 100
#define NIL -1
#define ZERO 0
#define INFTY 2001//>2000
using namespace std;

//think easy make easy


int n;//num of vertexes(頂点)
int matrix_graph[MAX_VERTEXES+1+1][MAX_VERTEXES+1+1];//1オリジン
bool vertix_set[MAX_VERTEXES+1+1];
int mincst = 0;

void findMinEdge(){//次に加える辺を決定する関数
	int minval_tmp = INFTY;
	int next_vertex;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(vertix_set[i] == true && vertix_set[j] == false){
				if(matrix_graph[i][j] < minval_tmp && matrix_graph[i][j] != NIL){
					next_vertex = j;
					minval_tmp = matrix_graph[i][j];
				}
			}
		}
	}

	mincst += minval_tmp;
	vertix_set[next_vertex] = true;
}

int main(){
	scanf("%d",&n);


	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			matrix_graph[i][j] = ZERO;
		}
	}

	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			scanf("%d",&matrix_graph[i][j]);
		}
	}

	/*確認用
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(j<n) printf("%d ",matrix_graph[i][j]);
			else printf("%d\n",matrix_graph[i][j]);
		}
	}
	*/

	int minval_tmp = INFTY;
	int next_vertex1;
	int next_vertex2;

	for(int i=1;i<=n;i++){
		vertix_set[i] = false;
	}

	for(int i=1;i<=n;i++){//しつこい
		for(int j=1;j<=n;j++){
			if(matrix_graph[i][j] < minval_tmp && matrix_graph[i][j] != NIL){
				minval_tmp = matrix_graph[i][j];
				next_vertex1 = i;
				next_vertex2 = j;
			}
		}
	}
	vertix_set[next_vertex1] = true;
	vertix_set[next_vertex2] = true;
	mincst += minval_tmp;

	

	for(int i=1;i<n-1;i++){
		findMinEdge();
	}
	cout <<mincst <<endl;

	return 0;
}

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

int main(){
  long long int n, k, q;
  cin >> n >> k >> q;
  long long int p[n];
  for(int i = 0; i < n; i++){
    p[i] = 0;
  }
  long long int a;
  if(k > q) {
    for(int i = 0; i < n; ++i) {
      cout << "Yes" << endl;
    }
  } else {
    for(int i = 0; i < q; ++i) {
      cin >> a;
      p[a-1]++;
    }
    long long int tmp = k - q;
    for(int i = 0; i < n; ++i) {
      p[i] += tmp;
      if(p[i] > 0) cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
const int MOD=1000000007;//1e9+7
//const int MOD=998244353;
const int INTMAX=2147483647;//2e9
const ll LLMAX=9223372036854775807;//9e17


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    cin>>N;
    vector<unsigned long long> A(N);
    for(ll i=0;i<N;i++)cin>>A[i];
    
    for(ll i=0;i<N;i++){
        if(A[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    
    unsigned long long ans=1;
    for(ll i=0;i<N;i++){
        if(A[i]>pow(10,18)||A[i]>(ll)pow(10,18)/ans||A[i]*ans>(ll)pow(10,18)){
            cout<<-1<<endl;
            return 0;
        }
        ans*=A[i];
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3992
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	final long m = (long) 1e9 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		for (int i = 0; i < N; ++i) {
			System.out.print(s[i]);
			System.out.print(t[i]);
		}
		System.out.println();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

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

  int p_count=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='p') p_count++;
  }

  int rel=s.size()/2;
  cout<<rel-p_count<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
	int N;
	ll ans=0;
	cin >> N;
	vector<int> B(N-1);
	REP(i, N) cin >> B[i];
	ans+=B[0];
	for(int i=1;i<N-1;i++){
		ans+=min(B[i-1], B[i]);
	}
	ans+=B[N-2];
	cout << ans << endl;
}


Measured memory_bytes: 256
n,q=map(int,input().split())
s=list(input())
a=[0]*n

for i in range(1,n):
  if s[i-1]=='A' and s[i]=='C':
    a[i]=a[i-1]+1
  else:
    a[i]=a[i-1]
    
for i in range(q):
  sita,ue=map(int,input().split())
  if sita==1:
    print(a[ue-1])
  elif s[sita-2]=='A' and s[sita-1]=='C':
    print(a[ue-1]-a[sita-2]-1)
  else:
    print(a[ue-1]-a[sita-2])


Measured memory_bytes: 6876
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;

// セグメント木をソラで書きたいあなたに
// http://tsutaj.hatenablog.com/entry/2017/03/29/204841

struct SegmentTree {
  private:
    int n;
    vector<ll> node;

  public:
    SegmentTree(vector<ll> v) {
        int sz = v.size();
        n = 1;
        while(n < sz) {
            n *= 2;
        }
        node.resize(2 * n - 1, 0);
        //最下段に値をいれる
        for(int i = 0; i < sz; i++) {
            node[i + n - 1] = v[i];
        }
        // 下の段から順番に値を入れる
        for(int i = n - 2; i >= 0; i--) {
            //最小値を管理する
            node[i] = node[2 * i + 1] + node[2 * i + 2];
        }
    }
    //もとの配列で場所xの値をvalにupdateする
    void update(int x, ll val) {
        {
            //最下段のノードにアクセスする
            x += (n - 1);
            node[x] = val;
            while(x > 0) {
                x = (x - 1) / 2;
                node[x] = node[2 * x + 1] + node[2 * x + 2];
            }
        }
    }
    //もとの配列で場所xの値をval追加する
    void add(int x, ll val) {
        {
            //最下段のノードにアクセスする
            x += (n - 1);
            node[x] += val;
            while(x > 0) {
                x = (x - 1) / 2;
                node[x] = node[2 * x + 1] + node[2 * x + 2];
            }
        }
    }

    // 対象区間 : 各ノードがカバーしている区間
    // 要求区間 [a, b) 中の要素の最小値を答える
    // k := 自分がいるノードのインデックス
    // 対象区間は [l, r) にあたる
    ll getsum(int a, int b, int k = 0, int l = 0, int r = -1) {
        //最初に呼び出された時の対象区間は[0, n)
        if(r < 0) {
            r = n;
        }
        if(r <= a || b <= l) {
            //[l.r) \cap [a, b)_= \emptyset
            //要求区間が対象区間と交わらない->適当に返す
            return 0;
        }
        if(a <= l and r <= b) {
            //要求区間が対象区間を完全にconver
            //[l, r) \subset [a, b)
            return node[k];
        }
        //
        //左側の子がvl
        //右側の子がvr
        //新しい対象区間は，現在の対象
        ll vl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
        return vl + vr;
    }
};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=ja
// 0indexedか確認する
int main() {
    int N, Q;
    cin >> N >> Q;
    SegmentTree seg(vector<ll>(N, 0LL));
    string ans;
    for(int i = 0; i < Q; i++) {
        int c, x, y;
        cin >> c >> x >> y;
        if(c == 0)
            seg.add(x - 1, (ll)y);
        else {
            ans += to_string(seg.getsum(x - 1, y)) + "\n";
        }
    }
    cout << ans.substr(0, ans.size() - 1) << endl;
    return 0;
}



Measured memory_bytes: 5972
import sys
from itertools import accumulate

n, m, q = map(int, input().split())
ipt = sys.stdin.readlines()
rails = [[0] * n for _ in range(n)]
for l, r in (map(int, line.split()) for line in ipt[:m]):
    rails[l - 1][r - 1] += 1
rails = [list(reversed(list(accumulate(reversed(s))))) for s in zip(*(accumulate(s) for s in rails))]
print('\n'.join(str(rails[q - 1][p - 1]) for p, q in (map(int, line.split()) for line in ipt[m:])))


Measured memory_bytes: 37064
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
    int a,b;
    cin>>a >> b;
    if(a > b)
    {
        cout<<"a > b"<<endl;
    }
    else if(a < b)
    {
        cout<<"a < b"<<endl;
    }
    else
    {
        cout<<"a == b"<<endl;
    }
    return 0;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int color[10] ;

int main() {
  int n, a ;
  scanf("%d", &n) ;

  for(int i = 0 ;i<n ;i++){
    scanf("%d", &a) ;
    if(a>=1 && a<=399)color[0]++ ;
    else if(a>=400 && a<=799) color[1]++ ;
    else if(a>=800 && a<=1199)color[2]++ ;
    else if(a >= 1200 && a<=1599)color[3]++ ;
    else if(a>= 1600 && a<=1999)color[4]++ ;
    else if(a>= 2000 && a<=2399)color[5]++ ;
    else if(a >= 2400 && a<=2799)color[6]++ ;
    else if(a>= 2800 && a<=3199)color[7]++ ;
    else if(a>=3200)color[8]++ ;
  }

  int min_color = 0, max_color = 0 ;

  for(int i = 0 ;i<8 ;i++)
    if(color[i])min_color++ ;

  max_color = min_color+color[8] ;

  cout << max(min_color,1) << ' ' << max_color << endl ;

	
  return 0 ;
}



Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    H = [int(i) for i in readline().split()]
    INF = int(1e9)
    #dp[i]:= 足場iまでの最小コスト
    dp = [INF for _ in range(N)]
    dp[0] = 0
    def f1(i):
        if i-1 < 0:
            return INF
        return dp[i-1]+abs(H[i]-H[i-1])

    def f2(i):
        if i-2 < 0:
            return INF
        return dp[i-2]+abs(H[i]-H[i-2])

    for i in range(N):
        dp[i] = min(dp[i], f1(i))
        dp[i] = min(dp[i], f2(i))

    print(dp[N-1])
if __name__ == '__main__':
    main()


Measured memory_bytes: 11564