akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b,c; cin>>a>>b>>c;
    vector<ll> v={a,b,c};
    sort(all(v));
    cout << v[2]*10+v[1]+v[0]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int sum[5010][5010];

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    vector<int> vx, vy;
    int x[n], y[n];
    rep(i, n){
        scanf("%d%d", &x[i], &y[i]);
        vx.push_back(x[i]);
        vy.push_back(y[i]);
    }
    sort(vx.begin(), vx.end());
    vx.erase(unique(vx.begin(), vx.end()), vx.end());
    sort(vy.begin(), vy.end());
    vy.erase(unique(vy.begin(), vy.end()), vy.end());
    rep(i, n){
        int ix = lower_bound(vx.begin(), vx.end(), x[i]) - vx.begin();
        int iy = lower_bound(vy.begin(), vy.end(), y[i]) - vy.begin();
        ++sum[ix+1][iy+1];
    }
    rep(i, vx.size()+5)rep(j, vy.size()+5) sum[i][j+1] += sum[i][j];
    rep(j, vy.size()+5)rep(i, vx.size()+5) sum[i+1][j] += sum[i][j];

    rep(_, m){
        int p, q, r, s;
        scanf("%d%d%d%d", &p, &q, &r, &s);
        int l = lower_bound(vx.begin(), vx.end(), p) - vx.begin();
        int u = lower_bound(vy.begin(), vy.end(), q) - vy.begin();
        int rr = upper_bound(vx.begin(), vx.end(), r) - vx.begin();
        int d = upper_bound(vy.begin(), vy.end(), s) - vy.begin();
        printf("%d\n", sum[rr][d] - sum[rr][u] - sum[l][d] + sum[l][u]);
    }
}


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

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	static final int N=(int)5005;
    public static void main(String[] args) {  
        InputStream sys=System.in;
        InputReader in=new InputReader(sys);
        PrintWriter out=new PrintWriter(System.out);
        int A=in.nextInt(),B=in.nextInt();
        int C=in.nextInt(),D=in.nextInt();
        int ans=0;
        if(C>=B||A>=D) ans=0;
        else {
        	if(B>C&&C>A) ans+=B-C;
        	if(D>A&&A>C) ans+=D-A;
        }
        if(A<=C&&D<=B) ans=D-C;
        if(C<=A&&B<=D) ans=B-A;
        out.println(ans);
        out.flush();
    }
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
        
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

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

string S;
int n0, n1;

int main() {
    cin >> S;
    rep(i, S.size()) {
        if (S[i] == '0') n0++;
        else n1++;
    }
    cout << min(n0, n1) * 2 << endl;
    return 0;
}

Measured memory_bytes: 512
N,M=map(int,input().split())
A=list(map(int,input().split()))
weight=[0,2,5,5,4,5,6,3,7,6]
dp=[-1]*(N+1)
dp[0]=0
for i in range(N+1):
    for a in A:
        if i+weight[a]<N+1:
            dp[i+weight[a]]=max(dp[i+weight[a]],dp[i]*10+a)
print(dp[N])


Measured memory_bytes: 50908
tile_num_array = gets.split("").map(&:to_i)
count = 0
tile_num_array.pop

tile_num_array.each_with_index{|num, index|
  target_bit = 0
  if index % 2 == 0
    target_bit = 0
  else
    target_bit = 1
  end

  if target_bit != num
    count += 1
  end
}

if (tile_num_array.length - count) > count
  answer = count
else
  answer = tile_num_array.length - count
end

puts answer


Measured memory_bytes: 8956
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif

using namespace std;


int main(){
    string divide[4] = {"dream", "dreamer", "erase", "eraser"};

    string S;
    cin >> S;

    queue<int> BFS;
    bool flag = false;
    BFS.push(0);
    while(!BFS.empty()){ // キューが空になるまで続ける
        int t = BFS.front();
        BFS.pop();
        if(t == S.size()){ // 最後まで切れたら成功
            flag = true;
            break;
        }
        for(string s : divide){
            if(S.substr(t, s.size()) == s){ // 切れたらとりあえず切ったことにしてみる
                BFS.push(t + s.size());
            }
        }
    }
    
    
    cout << (flag ? "YES" : "NO") << endl;
    //cout << ans << endl;

}


Measured memory_bytes: 512
import java.util.*;public class Main{Scanner s=new Scanner(System.in);void run(){char n='A';for(;s.hasNextLine();){String c=s.nextLine();if(c.charAt(0)==n)n=c.charAt(2);else if(c.charAt(2)==n)n=c.charAt(0);}System.out.println(n);}public static void main(String[] a){Main m=new Main();m.run();}}

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

int main()
{
   double sum=0.0;
   int n;
   cin>>n;
   int x[n],y[n];
   for(int i=0;i<n;i++)
   {
       cin>>x[i]>>y[i];
   }

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(i!=j){
                sum+=sqrt(pow((x[i]-x[j]),2)+pow((y[i]-y[j]),2)); 
            }
        }
    }

    printf("%.8f\n", double(sum/n));

  return 0;
}

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

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  int K;
  cin>>K;
  cout<<A+B+C-max(A,max(B,C))+max(A,max(B,C))*pow(2,K);
  
  return 0;
  
  

}

Measured memory_bytes: 256
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	n = readline() |> parseInt
	s = readline() |> chomp
	if length(s)>n
		println(s[1:n],"...")
	else
		println(s)
	end
end

main()

Measured memory_bytes: 158460
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
 int k,s,m;
 scanf("%d %d",&k,&s);
 m=0;
 for(int i=k;i>=0;i--)
 {
     for(int j=k;j>=0;j--)
     {
         if((s-i-j<=k)&&(s-i-j)>=0)
            m++;
     }
 }
 printf("%d\n",m);
}


Measured memory_bytes: 256
"use strict";

require("fs");

!function () {
  "use strict";

  !function () {
    !function (input) {
      var S = input.split("\n")[0];
      if (/11|22|33|44|55|66|77|88|99|00/.test(S)) console.log("Bad");else console.log("Good");
    }(require("fs").readFileSync("/dev/stdin", "utf8"));
  }();
}();


Measured memory_bytes: 22964
from collections import deque

h, w = map(int, input().split())
a = ['#' * (w + 2)] * 2
a[1: 1] = ('#' + input() +  '#' for _ in range(h))
r = 0
for i in range(1, h + 1):
  for j in range(1, w + 1):
    if a[i][j] == '.':
      b = list(map(list, a))
      q = deque()
      b[i][j] = 0
      q.append((i, j))
      while(q):
        i, j = q.popleft()
        r = max(r, b[i][j])
        d = 0
        for i1 in range(i - 1, i + 2):
          for j1 in range(j - d, j + 2, 2):                
            if b[i1][j1] == '.':
              b[i1][j1] = b[i][j] + 1
              q.append((i1, j1))
          d ^= 1
print(r)


Measured memory_bytes: 3316
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
                string s = Console.ReadLine();
                int n = int.Parse(s);
                string[] t = Console.ReadLine().Split();
                int[] a = new int[n];
                for (int i = 0; i < n; i++)
                {
                    a[i] = int.Parse(t[i]);
                }
                int max = int.MinValue;
                int min = int.MaxValue;
                long average = 0;
                for(int i = 0; i < n;i++)
                {
                    if(max < a[i])
                    {
                        max = a[i];
                    }
                    if (min > a[i])
                    {
                        min = a[i];
                    }
                    average += a[i];
                }
                Console.WriteLine(min + " " + max + " " + average);
       
        }
    }
}

Measured memory_bytes: 9980
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i+1;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main() {
  int A[3];
  cin >> A[0]>> A[1] >> A[2];
  sort(A,A+3);
  bool flag = false;
  if(A[0]==A[1]&&A[0]!=A[2]){
      flag = true;
  }else if(A[2]==A[1]&&A[0]!=A[2]){
      flag = true;
  }
  if(flag){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }




}


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

using namespace std;

vector<pair<long long,long long>> pfac(long long gcd) {
    vector<pair<long long,long long>> res;
    for (long long i = 2; i * i <= gcd; i++) {
        if (gcd % i != 0) continue;
        int num = 0;
        while (gcd % i == 0) {
            gcd /= i;
            num++;
        }
        res.emplace_back(make_pair(num, i));
    }
    if (gcd != 1) res.emplace_back(make_pair(gcd, 1));
    return res;
}

int main() {
    long long a,b;
    cin >> a >> b;
    auto x = pfac(__gcd(a,b));
    cout << x.size() + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
#複数行の入力を高速化
#a=[0]*N
#for i in range(N):
#  a[i]=int(input())
import sys
a=[int(i) for i in sys.stdin]

count=0

#loopの定義→同じインデックスを使用したらloop判定
#in の処理を爆速で実行するためにsetを使用する
#loop=[]
loop=set()

tmp=1
while True:  
  tmp=a[tmp-1]
  count+=1
  if tmp==2:
    print(count)
    exit()
  if tmp-1 in loop:
    print(-1)
    exit()
  #loop.append(tmp-1)
  loop.add(tmp-1)

Measured memory_bytes: 15984
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int answer = 0;
        for (int i = 0; i < n; i++) {
            int l = scanner.nextInt();
            int r = scanner.nextInt();
            answer += r - l + 1;
        }
        System.out.println(answer);
        scanner.close();
    }

}


Measured memory_bytes: 25320
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int len = n.length()-2;
        char a = n.charAt(0);
        char b = n.charAt(len+1);
      
      	System.out.print(a);
        System.out.print(len);
        System.out.print(b);

    }
}

Measured memory_bytes: 21716
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))

a = sorted(a)
f = sorted(f,reverse = True)

hq = []

def is_ok(checking):
    cost = 0
    for i in range(n):
        cost += max(0,math.ceil((a[i]*f[i]-checking)/f[i]))
    if cost <= k:
        return True
    else:
        return False

def meguru_bisect(ng, ok):
    while (abs(ok-ng)>1):
        mid = (ok+ng)//2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

ok = meguru_bisect(-1, 1e+12+1) 
print(int(ok))
# 初期値の範囲は取りえる値-1～+1とする←範囲内はok,ngどちらもあり得るため

Measured memory_bytes: 105388
/*input
1
*/

#include <iostream>
#include <vector>
#include <map>

using namespace std;

vector<int> prime = {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, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
map<int, int> prime_count;

void count_divisor(int N)
{
	for(auto p:prime){
		long v = N;
		long d = 0;
		while(v % p == 0){
			v /= p;
			d++;
		}
		if(d != 0){
			prime_count[p]+=d;
		}
	}

	return;
}

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

	if(N==1){
		cout << 1 << endl;
		return 0;
	}

	for(int i=2;i<=N;i++){
		count_divisor(i);
	}

	long diviser = 1;
	for(auto p:prime_count){
		// cout << p.first << " " << p.second << endl;
		diviser *= (p.second + 1);
		diviser %= 1000000007;
	}

	cout << diviser << endl;

	return 0;
}


Measured memory_bytes: 256
A,B,C,D = [int(x) for x in input().split()]
if A % D == 0 :
  takahashi = A // D
else:
  takahashi = A // D + 1
if C % B == 0 :
  aoki = C // B
else:
  aoki = C // B + 1
if takahashi >= aoki:
  print('Yes')
else:
  print('No')

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

int main() {
  int N,S=0;
  cin >> N ;
  
  for(int i = 0; i<N; i++){
    int P,r,l;
    cin >> r >> l;
    P = l - r + 1;
    S += P;
  }
  cout << S << endl;

}

Measured memory_bytes: 3572
#include "bits/stdc++.h"
using namespace std;

int main(){
	int n;
	while(cin>>n){
		cout<<"3C";
		int a=n%39;
		if(a==0)a=39;
		if(a<10)cout<<0;
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 2972
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, X;cin >> N >> X;
	bool ok = true;
	ll max = 1e10 + 7;
	VLL x(N+1);
	for (int i = 0;i < N;i++) cin >> x[i];
	x[N] = X;
	sort(all(x));
	max = x[1]-x[0];
	for (int i = 2;i < N+1;i++) {
		max=gcd(max,(x[i]-x[i-1]));
	}
	cout << max << endl;
}

Measured memory_bytes: 1024
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad
import Data.Ord

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    s <- getLine
    putStrLn $ if s == "ABC" then "ARC" else "ABC"


Measured memory_bytes: 3696
#include <random>

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    stack<char> S;
    for (auto c : s) {

        if (c == 'T' && S.size() && S.top() == 'S') {
            S.pop();
        } else {
            S.push(c);
        }
    }
    cout << S.size() << endl;
}

Measured memory_bytes: 644
N, M = map(int, input().split())
C = list(map(int, input().split()))
C = [0] + C

MAX = 10_001
dp = [MAX for i in range(N+1)]
dp[0] = 0

for i in range(1, M+1):
  for j in range(C[i], N+1):
    dp[j] = min(dp[j], dp[j-C[i]]+1)

print(dp[N])



Measured memory_bytes: 7572
# ABC 142 D - Disjoint Set of Common Divisors
# https://atcoder.jp/contests/abc142/tasks/abc142_d

require 'prime'

a, b = gets.chomp.split(/ /).map(&:to_i)
gcd_prime_division = Prime.prime_division(a.gcd(b))
puts gcd_prime_division.size + 1


Measured memory_bytes: 1916
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

bool f(ll a, ll n, ll k){
    ll sum = 0;
    for (int i = 0; i < n && sum <= k && a; ++i) {
        sum += a;
        a /= 2;
    }
    return sum <= k;
}

int main() {
    ll n, k;
    cin >> n >> k;
    ll ok = 0, ng = k+1;
    while(ng-ok > 1){
        ll mid = ok + (ng-ok)/2;
        if(f(mid, n, k)) ok = mid;
        else ng = mid;
    }
    cout << ok << "\n";
    return 0;
}


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

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    int ans = n;
    if(m==1){
        cout << 0 << endl;
        return 0;
    }
    for(int i=0;i<1000;i++){
        if(ans>=m){
            cout << i+1 << endl;
            return 0;
        }
        ans += n-1;
    }
}


Measured memory_bytes: 256
using System;

class Program {
    static void Main(string[] args) {

        int N = int.Parse(Console.ReadLine());
        String S = Console.ReadLine();

        int result = 0;
        char prev =' ';

        for(int a = 0; a < S.Length; a++) {
            if (S[a] != prev) {
                prev = S[a];
                result++;
            }
        }
        
        Console.WriteLine(result);
    }
}



Measured memory_bytes: 13120
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

s1 = input()
s2 = input()
if s1[::-1] == s2:
	print('YES')
else:
	print('NO')


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

int main(){
	int a,b,c;
	int arr[10];
	memset(arr,0,sizeof(arr));
	cin>>a>>b>>c;
	arr[a]++;
	arr[b]++;
	arr[c]++;
	if(arr[5] == 2 and arr[7] == 1){
		puts("YES");
	}
	else{
		puts("NO");
	}
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    string a = s.substr(0, 1);
    string b = s.substr(1, 1);
    string c = s.substr(2, 1);
    string d = s.substr(3, 1);
    if(a==b){
      cout << "Bad" << endl;
    }else if(b==c){
      cout << "Bad" << endl;
    }else if(c==d){
      cout << "Bad" << endl;
    }else{
      cout << "Good" << endl;
    }
}






Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
//#include <bits/stdc++.h> 

using namespace std;
typedef  pair<long int,long int> P;

int main(){
    long int H,W,M;
    cin>>H>>W>>M;
    long int h[M],w[M];
    set<P> s;
    vector<long int> x(H),y(W);
    for (long int i=0;i<M;i++){
        cin>>h[i]>>w[i];
        h[i]--;
        w[i]--;
        x[h[i]]++;
        y[w[i]]++;
        s.insert(P(h[i],w[i]));
    }
    long int maxh=0,maxw=0;
    for (long int i=1;i<H;i++){
        if (x[i]>x[maxh]) maxh=i;
    }
    for (long int i=1;i<W;i++){
        if (y[i]>y[maxw]) maxw=i;
    }
    vector<long int> xmax,ymax;
    long int nx=0,ny=0;
    for (long int i=0;i<H;i++){
        if (x[i]==x[maxh]){
            xmax.push_back(i);
            nx++;
        }
    }
    for (long int i=0;i<W;i++){
        if (y[i]==y[maxw]){
            ymax.push_back(i);
            ny++;
        }
    }
    bool flag=false;
    for (int i=0;i<nx;i++){
        for (int j=0;j<ny;j++){
            auto ite=s.find(P(xmax[i],ymax[j]));
            if (ite==s.end()){
                flag=true;
                break;
            }
        }
    }
    if (flag) cout<<x[maxh]+y[maxw]<<endl;
    else cout<<x[maxh]+y[maxw]-1<<endl;

    return 0;
}

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

namespace ABC116
{
    class C
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] h = Console.ReadLine().Split().Select(int.Parse).ToArray();

            long count = 0;
            for (int i = 0; i < N - 1; i++)
            {
                if (h[i + 1] < h[i]) count += h[i] - h[i + 1];
            }

            count += h[N - 1];

            Console.WriteLine(count);
        }
    }
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(abs(c - a) <= d) {
        cout << "Yes" << endl;
        return 0;
    } else {
        if(abs(b-a) <= d && abs(c-b) <=d) {
            cout << "Yes" <<endl;
            return 0;
        }
    }
    cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[5];
    for(int i=0;i<5;i++)
     cin>>a[i];
    int ind=0;
    for(int i=0;i<5;i++)
    {
        if(a[i]==0)
         ind=i+1;
    }
    cout<<ind<<endl;
    return 0;
}

Measured memory_bytes: 3616
from collections import deque
from collections import defaultdict
N, M = map(int, input().split())
d = [0]*N
G = defaultdict(list)
for i in range(N-1+M):
    s, t = map(int, input().split())
    d[t-1] += 1
    G[s-1].append(t-1)
q = deque([])
for i in range(N):
    if d[i] == 0:
        q.append(i)
rank = [0]*N
ans = [0]*N
while q:
    s = q.popleft()
    for t in G[s]:
        d[t] -= 1
        if d[t] == 0:
            rank[t] = rank[s]+1
            q.append(t)
for i in range(N):
    for x in G[i]:
        if rank[x] - rank[i] == 1:
            ans[x] = i+1
for x in ans:
    print(x)

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr int INF = 1001001001;
//constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;



int main() {
    int N; cin >> N;
    vector<pii> X(N);
    rep(i, N) {
        int a; cin >> a;
        X[i] = mp(a, i + 1);
    }

    sort(all(X));
    rep(i,N){
        cout << X[i].S << " ";
    }
    cout << endl;

}

Measured memory_bytes: 1664
#include <iostream>
#include <stack>

using namespace std;

struct set { int next, sum, depth; };

int n, s, cnt;

void dfs(int next, int sum, int depth) {
    stack<set> S;
    set tmp;
    tmp.next = next; tmp.sum = sum; tmp.depth = depth;
    S.push(tmp);
    while (!S.empty()) {
        set u = S.top();

        if (u.depth == n && u.sum == s) {
            cnt++;
        }
        if (u.next == 10 && u.depth == 0 && u.sum == 0) break;

        if (u.next < 10 && u.depth < n) {
            tmp.next = u.next + 1;
            tmp.sum = u.sum;
            tmp.depth = u.depth;
            S.push(tmp);
 
            tmp.next = u.next + 1;
            tmp.sum = u.sum + u.next;
            tmp.depth = u.depth + 1;
            S.push(tmp);
        }
        else if (u.next == 10) {
            int tmp = u.depth;
            while (S.top().depth == tmp) {
                S.pop();
            }
        }
        else {
            S.pop();
        }
    }
}

int main() {
    while (cin >> n >> s) {
        if (n == 0 && s == 0) break;
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3012
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

string s;
LL cnt,ans;

int main()
{
	cin>>s;
	rep(i,s.size())
	{
		if(s[i]=='B') cnt++;
		if(s[i]=='W') ans+=cnt;
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  bool c = true;
  if(a[0] > 0) c = false;
  for(int i = 1; i < n; i++) if(a[i] - a[i-1] > 1) c = false;
  for(int i = 1; i < n; i++) 
    if(a[i] == a[i-1] + 1) ans++;
  	else ans += a[i];
  if(c) cout << ans << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> row;
typedef vector<row> matrix;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	//file();
	fast();
	int a, b; cin >> a >> b;
	a *= b;
	if (a & 1) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
p = [int(x) for x in input().split()]
count = 0
for i in range(n-2):
    a,b,c = p[i],p[i+1],p[i+2]
    if (a > b and b > c) or (a < b and b < c):
        count += 1
print(count)

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

int main() {
    int N; cin >> N;
    vec A(N);
    rep(i, N) cin >> A[i];

    double d;

    rep(i, N) {
        d += (double)1/A[i];
    }
    
    d = (double)1/d;

    printf("%.7f\n", d);

}

Measured memory_bytes: 256
using System;
using System.Numerics;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        int[] A = new int[N];
        int[] B = new int[N];
        int[] C = new int[N];

        string[] lineA = Console.ReadLine().Split();
        string[] lineB = Console.ReadLine().Split();
        string[] lineC = Console.ReadLine().Split();

        for (int i = 0; i < N; i++)
        {
            A[i] = int.Parse(lineA[i]);
            B[i] = int.Parse(lineB[i]);
            C[i] = int.Parse(lineC[i]);
        }

        // First, sort them all
        Array.Sort(A);
        Array.Sort(B);
        Array.Sort(C);

        BigInteger answer = 0;

        // Now we'll loop over the ones in B
        for (int i = 0; i < N; i++)
        {
            // We need the number of As _less_ than B[i] then the number of Cs _greater_ than B[i]
            int high = N - 1;
            int low = -1;
            while (high > low)
            {
                int mid = (low + high + 1) / 2;
                if (A[mid] < B[i]) low = mid;
                else high = mid - 1;
            }
            int Acount = low + 1;
            //Console.Error.WriteLine("Number of A less than {0}: {1}", B[i], Acount);

            high = N;
            low = 0;
            while (high > low)
            {
                int mid = (low + high) / 2;
                if (C[mid] > B[i]) high = mid;
                else low = mid + 1;
            }
            int Ccount = N - high;
            //Console.Error.WriteLine("Number of Cs greater than {0}: {1}", B[i], Ccount);

            answer += (BigInteger)Acount * (BigInteger)Ccount;
        }

        Console.WriteLine(answer);
        Console.ReadLine();
    }
}



Measured memory_bytes: 42588
#include <cstdio>

int main(){
    int n; scanf("%d", &n);
    int res = 0;
    for (int i = 1; i <= n; i++){
        int x; scanf("%d", &x);
        if ((i&1) && (x&1)) res++;
    }
    printf("%d\n", res);

    return 0;
}


Measured memory_bytes: 1724
#include <algorithm>
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
const long long INF = 1LL << 60;

template <class T> inline void chmax(T &a, T b) { a < b ? a = b : a; };
template <class T> inline void chmin(T &a, T b) { a > b ? a = b : a; };

int main() {
    int n;
    cin >> n;
    ll dp[100100];
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    rep(i, n) dp[i] = INF;
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    REP(i, 1, n) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int H,W;
    cin >> H >> W;
    map<int,int>Mp;
    multiset<int>st;
    for(int i = 0; i < W; i++) {
        Mp[i] = i;
        st.insert(0);
    }
    for(int i = 0; i < H; i++) {
        int A,B;
        cin >> A >> B;
        A--;B--;
        auto it = Mp.lower_bound(A);
        int mx = -1;
        while (it != Mp.end() && it->first <= B+1) {
            st.erase(st.find(it->first-it->second));
            mx = max(mx,it->second);
            Mp.erase(it++);
        }
        if(B+1 != W && mx != -1) {
            Mp[B+1] = mx;
            st.insert(B+1-Mp[B+1]);
        }
        if(st.size() == 0) {
            cout << -1 << endl;
        }
        else {
            cout << *st.begin()+i+1 << endl;
        }
    }
}

Measured memory_bytes: 25468
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <map>
#include <algorithm>
#include <math.h>
#include <iostream>     // std::cout, std::fixed
#include <iomanip>
#include<queue>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <iostream>
#include <sstream>
typedef long long ll;
using namespace std;




int main () {
    ios_base::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s[0]==s[1] && s[1]==s[2])
    {
        cout<<"Yes";
        return 0;
    }
    if(s[1]==s[2] && s[2]==s[3])
    {
        cout<<"Yes";
        return 0;
    }
     cout<<"No";
    return 0;
}


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

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int enter[1005], mask[1005][1440], dirty[1005];
int score[1005];

void flush() {
	//fprintf(stderr, "Flush\n");

	rep(i, 0, 1005) {
		if (enter[i]) {
			rep(j, enter[i], 1440) mask[i][j] = 1;
			enter[i] = 0;
		}
	}

	/*rep(i, 0, 1005) {
		if (dirty[i]) {
			fprintf(stderr, "Info %d: ", i);
			bool ison = false;
			int starttime = 0;
			int diff = 0;
			rep(j, 0, 1440) {
				if (mask[i][j] && (j == 0 || !mask[i][j - 1])) fprintf(stderr, "%02d:%02d-", j / 60, j % 60), ison = true, starttime = j;
				if (j != 0 && (!mask[i][j] && mask[i][j - 1])) {
					int thistime = 0;
					for (int t = starttime; t < j; t++) if (mask[0][t]) thistime++;
					diff = max(diff, thistime);
					fprintf(stderr, "%02d:%02d(%d) ", j / 60, j % 60, thistime), ison = false;
				}
			}
			if (ison) {
				int thistime = 0;
				for (int t = starttime; t < 2400; t++) if (mask[0][t]) thistime++;
				diff = max(diff, thistime);
				fprintf(stderr, "%02d:%02d(%d) ", 24, 0, thistime), ison = false;
			}
			score[i] += diff;
			fprintf(stderr, "\n");
		}
	}*/

	rep(i, 1, 1005) {
		if (dirty[i]) {
			int diff = 0;
			rep(j, 0, 1440) if (mask[0][j] && mask[i][j])
				diff++;
			score[i] += diff;
			//fprintf(stderr, "Guy %d: +=%d\n", i, diff);
		}
	}

	// clean
	rep(i, 0, 1005) {
		if (dirty[i]) {
			dirty[i] = 0;
			fill(mask[i], mask[i] + 1440, 0);
			enter[i] = 0;
		}
	}
}

int main() {
	cin.sync_with_stdio(false); cin.tie(0);
	cin.exceptions(cin.failbit);

	for (;;) {
		int n; scanf("%d", &n); if (!n) break;

		int month, day, hour, minute, id, prevmonth, prevday; char action;
		rep(i, 0, n) {
			scanf("%d/%d %d:%d %c %d\n", &month, &day, &hour, &minute, &action, &id);

			if (i > 0 && (month != prevmonth || day != prevday)) {
				flush();
			}

			//fprintf(stderr, "%d/%d %02d:%02d %c %d\n", month, day, hour, minute, action, id);

			if (action == 'I') {
				enter[id] = hour * 60 + minute;
				dirty[id] = 1;
			} else if (action == 'O') {
				for (int j = enter[id]; j < hour * 60 + minute; j++)
					mask[id][j] = 1;
				enter[id] = 0;
				dirty[id] = 1;
			}

			prevmonth = month, prevday = day;
		}
		flush();

		int mxs = 0;
		for (int i = 1; i < 1005; i++) mxs = max(mxs, score[i]);
		printf("%d\n", mxs);

		fill(score, score + 1005, 0);
		//fprintf(stderr, "----------------------------------------------------------\n");
	}
}



Measured memory_bytes: 6032
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
string S;
void solve() {
    vector<int> cnt(2);
    cin >> S;
    for (int i = 0; i < S.length(); i++) {
        if (S.substr(i, 1) == "0") {
            cnt[0]++;
        } else {
            cnt[1]++;
        }
    }
    cout << 2 * min(cnt[0], cnt[1]) << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
const int INF = 1e9;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;

#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define rt return
#define ENDL cout<<endl
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int H,W;cin >> H >> W;
    int N;cin >> N;
    vector<int> vec;
    for(int a = 0;a < N;a++){
        int b;cin >> b;
        vec.push_back(b);
    }
    LL i = 0;
    vector<vector<int>> ans(H, vector<int>(W));
    for(int a = 0;a < H;a++){
        if(a %2 == 0){
            for(int b = 0;b < W;b++){
                ans.at(a).at(b) = i;
                vec.at(i)--;
                if(!vec.at(i))i++;
            }
        }else{
            for(int b = W-1;b >= 0;b--){
                ans.at(a).at(b) = i;
                vec.at(i)--;
                if(!vec.at(i))i++;
            }
        }
    }
    for(int a = 0;a < H;a++){
        for(int b = 0;b < W;b++){
            cout<<ans.at(a).at(b)+1<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int INF=-2000000000;
int main() {
  int h,n;
  cin >> h >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int sum=0;
  rep(i,n) sum+=a[i];
  if(sum>=h) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  for(long long i=1;i<=a;i++){
    long long x=i;
    if((x*b)%a==0){cout<<x*b<<endl;
   break;
                  }
   
                        
  }
  
}


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

    typedef long long int ll;

    #define MOD (ll)(1e9+7)
    #define endl "\n"
    #define pb push_back
    #define TEST_CASES  ll t;cin >> t;while(t--)
    #define forn(i,n) for (int i = 0; i < n; ++i)
    #define f first
    #define s second
    #define all(x) x.begin(), x.end()
    
    ll powD(ll x,ll y){
      ll res = 1;
      while(y > 0){
        if(y & 1)
          res = (res*x)%MOD;
        x = (x*x)%MOD;
        y = y>>1;
      }
      return res;
    }
  

    int main()
    {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL); 
     
          string s,t;
          cin>>s>>t;
          int n = s.size();
          if(t.substr(0,n) == s)
            cout<<"Yes"<<endl;
          else
            cout<<"No"<<endl;
      
    }
    //read the question correctly (ll vs int)


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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        int a;
        scanf("%d",&a);
        while(a%2!=1)
        {
            sum++;
            a/=2;
        }
    }
    printf("%lld",sum);
    return 0;
}

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

int main() {
    //
    long long num, c, k;
    long long cntBus = 0;

    cin >> num >> c >> k;

    vector<long long> vec(num);
    for (int i = 0; i < num; i++) { cin >> vec.at(i); }

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

    long long cnt = 0, genkaiTi;
    for (int i = 0; i < num;) {
        cntBus++;
        cnt = 0;
        genkaiTi = vec.at(i) + k;

        while (i < num && vec.at(i) <= genkaiTi && cnt < c) {
            i++;
            cnt++;
        }
    }

    cout << cntBus;
}

Measured memory_bytes: 4036
#include<iostream>
#include<queue>
#include<vector>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

const int INF = 1001001001;

int main(){
	int n, m; cin >> n >> m;
	int c[n];rep(i,n)c[i]=INF;

	int s, tmp;
	rep(i,m){
		cin >> s;
		cin >> tmp;
		if(c[s-1] != INF && c[s-1] != tmp){
			cout << -1 << endl;
			return 0;
		}
		c[s-1] = tmp;
	}

	if(c[0] == INF){
		if(n == 1){
			c[0] = 0;
		}else{
		c[0] = 1;
		}
	}
	
	rep(i,n)if(c[i] == INF && i != 0)c[i] = 0;

	if(c[0] == 0 && n != 1){
		cout << -1 << endl;
		return 0;
	}
	rep(i,n)cout << c[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#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;

    set<int> a;
    rep(i,n){
        int ai;
        cin >> ai;
        a.insert(ai);
    }
    cout << (a.size() == n ? "YES" : "NO") << endl;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s=sc.next();
		//String t= sc.next();
		int n = sc.nextInt();
		//int m = sc.nextInt();
		//int k = sc.nextInt();
		long count=0;
		long count1=0;
		int[] array = new int[3];
		/*array[0]=n-m;
		array[1]=n*m;
		array[2]=n+m;*/
		Arrays.sort(array);

		/*for(int i=0;i<3;i++) {
			if(s.substring(i,i+1).equals(t.substring(i,i+1))) {
				count++;
			}
		}*/

		/*if(count>2||count1>=2) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}*/

		System.out.println(n*n*n);
	}
}




Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

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

	int n;
	string s;
	cin >> n >> s;
	int open = 0;
	int close = 0;
	rep(i, n) {
		if (s[i] == '(') {
			++open;
		}
		else {
			if (open > 0) {
				--open;
			}
			else {
				++close;
			}
		}
	}

	rep(i, close) {
		cout << '(';
	}
	cout << s;
	rep(i, open) {
		cout << ')';
	}

	cout << "\n";

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<math.h>
# define M_PI 3.14159265358979323846
using namespace std;
int main()
{
    int n,m,i,s,a[100000];
    cin>>n>>m;
    i=0;
    s=0;
    while(m--)
    {
        cin>>a[i];
        s=s+a[i];
        i++;
    }
    if(s>n)
        cout<<"-1"<<endl;
    else
        cout<<n-s<<endl;



    return 0;
}


Measured memory_bytes: 3644
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long T[] = new long[N];

		for (int i=0; i<N; i++){
			T[i] = sc.nextLong();
		}

		long tmp;

		tmp = T[0];
		for (int i=1; i<N; i++){
			tmp = lcm(tmp, T[i]);
		}
		System.out.println(tmp);
	}

	public static final long gcd(final long a, final long b){
		return (b == 0) ? a : gcd(b, a % b);
	}

	public static final long lcm(final long a, final long b){
		long gcd = gcd(a,b);
		return (a / gcd) * b ;
	}
}



Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
const int maxn=110;
int n;
int main(){
    scanf("%d",&n);
    if(n<1200){
        printf("ABC");return 0;
    }
    if(n<2800){
        printf("ARC");return 0;
    }
    printf("AGC");return 0;
    return 0;
}

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

int main(void){
    int N,M; cin >> N >> M;
    int ans[M];
    for(int i=0; i<M; i++) ans[i]=0;

    for(int i=0; i<N; i++){
        int k; cin >> k;
        for(int j=0; j<k; j++){
            int a; cin >> a;
            ans[a-1]++;
        }
    }

    int cnt=0;
    for(int i=0; i<M; i++){
        if(ans[i]==N) cnt++;
    }

    cout << cnt << endl;
}

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

int main(){
    int x, y, z, len;
    int i;
	cin >>x>>y>>z;
	len =y-x+1;
	if((z<<1)>=len){
		for(i=x;i<=y;i++) cout<<i<<endl;
	}
	else{
		for(i=x;i<=x+z-1;i++) cout<<i<<endl;
		for(i=y-z+1;i<=y;i++) cout<<i<<endl;
	}
	return 0;
} 


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

int N;
int A[210];

int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];

	int res = 0;

	while(true){
		bool exist_odd = false;
		for(int i=0; i<N; i++){
			if(A[i]%2 != 0) exist_odd = true;
		}

		if(exist_odd) break;

		for(int i = 0; i < N; i++){
			A[i] /= 2;
		}
		res++;
	}

	cout << res << endl;
}

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

using namespace std;

int main(void)
{
	int h,w,n;
	cin >> h >> w >> n;

	vector<int> map;

	for(int i=1;i<=n;i++)
	{
		int a;
		cin >> a;
		for(int j=1;j<=a;j++)
			map.push_back(i);
	}

	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cout << map[(i-1)*w+(i%2==1 ? j:w-j+1)-1] << " ";
			//if(j!=w)
			//	cout << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 384