akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iterator>
using namespace std;

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007
#define LL long long

int n,m;

int i,j;
LL l;

vector<LL> d;
vector<LL> t;

int main(){
  cin>>n;
  REP(i,n){
    cin >> l;
    d.push_back(l);
  }
  cin>>m;
  REP(i,m){
    cin>>l;
    t.push_back(l);
  }
  sort(d.begin(),d.end());
  sort(t.begin(),t.end());
  vector<LL>::iterator it;
  int dis;
  while(!t.empty()){
    l=t.back();
    t.pop_back();
    it = lower_bound(d.begin(),d.end(),l);
    dis = distance(d.begin(),it);
    if(d[dis]==l)
      d.erase(d.begin()+dis);
    else{
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}


Measured memory_bytes: 4848
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>

using namespace std;

#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 ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {};
	Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
	int n;
	bool directed;
	vector<vector<Edge<T>>> edges;
public:

	Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {};
	Graph() {};

	void add(int to, T cost) {
		emplace_back(to, cost);
	}

	int size() {
		return n;
	}
};


int main() {

	double L;

	cin >> L;

	cout << fixed << setprecision(15) << (L / 3) * (L / 3) * (L / 3) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PA;
typedef priority_queue<int, vector<int>, greater<int> > PQG;
#define REP(i, a, n) for(ll i = (ll) a;i < (ll) n;i++)
#define fi first
#define se second
#define pb push_back
#define INF 1000000009
#define MOD 1000000007
#define MAXN 16
#define MAXC 100000000000014
#define MAXV 1000000009

int a, b, c, k;
priority_queue<int> que;

int main()
{
    cin >> a >> b >> c >> k;
    que.push(a);
    que.push(b);
    que.push(c);
    int m = que.top();
    que.pop();
    REP(i, 0, k){
        m *= 2;
    }
    m += que.top();
    que.pop();
    m += que.top();
    que.pop();
    cout << m << endl;

    return 0;
}













Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
	int W, H;
	int x, y, r;

	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
	W = W - r, H = H - r;
	if (r <= x && x <= W && r <= y && y <= H){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define M 1000000007
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define f first
#define s second
#define b begin
#define e end
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define itfr(it,x) for(it=x.begin();it!=x.end();it++)
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int main()
{
    flash;
    //sieve();
    ll T=1,n,m,q,k,i,j;
    // cin>>T;
    while(T--)
    {
        string s,t;
        cin>>s>>t;
        int fl=1;
        FOR(i,0,s.size())
            if(s[i]!=t[i])
                fl=0;
        if(t.length()!=(s.length()+1))
            fl=0;
        if(fl)
            yes;
        else
            no;
    }
}

Measured memory_bytes: 3592
import sys
input = sys.stdin.readline
from collections import defaultdict
import bisect

INF = 10 ** 12

N,a,b = map(int,input().split())
X_to_Y = defaultdict(lambda: [-INF,INF])
Y_to_X = defaultdict(lambda: [-INF,INF])
for i in range(1,N+1):
    x,y = map(int,input().split())
    x,y = x+y,x-y
    X_to_Y[x].append(y)
    Y_to_X[y].append(x)
    if i == a:
        sx,sy = x,y
    elif i == b:
        tx,ty = x,y

R = max(abs(sx-tx), abs(sy-ty))

for key, arr in X_to_Y.items():
    arr.sort()
    L = len(arr)
    move_right = list(range(1,L)) + [None]
    X_to_Y[key] = [arr,move_right]
    
for key, arr in Y_to_X.items():
    arr.sort()
    L = len(arr)
    move_right = list(range(1,L)) + [None]
    Y_to_X[key] = [arr,move_right]

equiv_class = set([(sx,sy), (tx,ty)])

answer = 0
task = [(sx,sy), (tx,ty)]

while task:
    x,y = task.pop()
    # 既出の元も含めて辺の個数を数える
    # 未出の元を同値に追加
    # x,y両方満たすものは、x側にだけ入れる
    for x1 in [x-R,x+R]:
        if not (x1 in X_to_Y):
            continue
        arr, move_right = X_to_Y[x1]
        left = bisect.bisect_left(arr, y-R)
        right = bisect.bisect_right(arr, y+R)
        # [left, right) が辺で結べるターゲット
        answer += right - left # 辺の個数
        i = left
        while i < right:
            y1 = arr[i]
            if (x1,y1) not in equiv_class:
                equiv_class.add((x1,y1))
                task.append((x1,y1))
            # なるべく、既に居ない元は見ないで済ませるように
            next_i = move_right[i]
            if next_i >= right:
                break
            move_right[i] = right
            i = next_i
    for y1 in [y-R,y+R]:
        if not y1 in Y_to_X:
            continue
        arr, move_right = Y_to_X[y1]
        left = bisect.bisect_left(arr, x-R+1)
        right = bisect.bisect_right(arr, x+R-1)
        # [left, right) が辺で結べるターゲット
        answer += right - left # 辺の個数
        i = left
        while i < right:
            x1 = arr[i]
            if (x1,y1) not in equiv_class:
                equiv_class.add((x1,y1))
                task.append((x1,y1))
            # なるべく、既に居ない元は見ないで済ませるように
            next_i = move_right[i]
            if next_i >= right:
                break
            move_right[i] = right
            i = next_i

answer //= 2 # 両方向から辺を見た
print(answer)

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

int main(){

	long long n;
	cin >> n;

	long long ans = 0;
	ans = n/11;
	ans = ans << 1;

	n = n%11;

	if(n > 6){

		ans = ans + 2;
	}
	else if(n > 0){

		ans = ans + 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int data[10];
  for(int i=0;i<10;i++){
    cin >>data[i];}
  sort(data,data+10);
  for(int i=9;i>6;i--){
    cout <<data[i]<<endl;}
  return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include <stdlib.h>
#include<string>
using namespace std;

int main()
{
  int n, count = 0;
  cin >> n;
  int a[n];

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

  for(int i = 0; i < n; i++)
  {
    if(a[i] % 2 == 0) 
    {
      a[i] /= 2;
    }
    else
    {
      cout << count << endl;
      exit(0);
    }

    if(i == n-1)
    {
      count++;
      i = 0;
    }
  }
}

Measured memory_bytes: 256
N=int(input())
A=[0]+list(map(int,input().split()))+[0]
r=[]
for i in range(1,N+2):
    r.append(abs(A[i-1]-A[i]))
s=sum(r)
for i in range(1,N+1):
    print(s+abs(A[i-1]-A[i+1])-(r[i-1]+r[i]))

Measured memory_bytes: 14048
n, m, x = map(int, input().split())
a = list(map(int, input().split()))

bk = 0
fr = 0

for i in range(m):
    if a[i] < x:
        bk += 1
    elif (x < a[i]) and (a[i] < n):
        fr += 1
print(min(bk, fr))

Measured memory_bytes: 3060
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;
int a=0, b=0, c=0, x=0;

int main()
{
    cin>>a>>b;
    c = a*b;
    x = c%2;
    if(x==0){
        cout<<"Even"<<endl;
    }else{
        cout<<"Odd"<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, M, K;

int main(void)
{
	cin >> N >> M >> K;
	
	bool ans = false;
	for(int i = 0; i <= N; i++){
		for(int j = 0; j <= M; j++){
			if(i * j + (N - i) * (M - j) == K){
				ans = true;
				goto end;
			}
		}
	}
	end:
	if(ans) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        a();
    }

    private static void a() {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int x;
        if (a > b) {
            x = a * 2 -1;
        }else if(a < b){
            x = b * 2 -1;
        }else {
            x = a*2;
        }
        p(x);
    }

    private static void p(Object x) {
        System.out.println(x.toString());
    }
}


Measured memory_bytes: 21460
package main

import (
	"fmt"
)

func main() {

	var S string
	fmt.Scanf("%s", &S)
	var T string
	fmt.Scanf("%s", &T)

	min := len(S)
	for i := 0; i <= (len(S) - len(T)); i++ {
		exT := S[i : i+len(T)]
		count := 0

		for j := 0; j < len(T); j++ {
			if T[j] != exT[j] {
				count += 1
			}
		}

		if count < min {
			min = count
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 1844
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


map<ll, ll> prime_factor(ll a) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= a; i++) {
		while (a % i == 0 && a != 0) {
			ret[i]++;
			a /= i;
		}
	}
	if (a != 1) {
		ret[a]++;
	}
	return ret;
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	ll n; scanf("%lld", &n);
	if (n == 1) {
		puts("1");
		return 0;
	}
	map<ll, ll> mp = prime_factor(n);
	ll res = 1;
	ll tmp = n;
	for (auto p : mp) {
		res *= (p.first - 1);
		tmp /= p.first;
	}
	res *= tmp;
	cout << res << endl;
	return 0;
}



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

#include <boost/pending/disjoint_sets.hpp>
#include <boost/property_map/property_map.hpp>

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

template <typename T1, typename T2>
bool pair_second_lt(const pair<T1, T2> &p1, const pair<T1, T2> &p2) {
  return p1.second < p2.second;
}

int solve(vector<int> &A, vector<int> &B, int N) {
  map<int, int> rank;
  map<int, int> parent;

boost:
  boost::disjoint_sets<boost::associative_property_map<map<int, int>>,
                       boost::associative_property_map<map<int, int>>>
      dset(boost::make_assoc_property_map(rank),
           boost::make_assoc_property_map(parent));

  for (size_t i = 0; i < N; i++) {
    dset.make_set(i);
  }

  for (size_t i = 0; i < A.size(); i++) {
    dset.union_set(A[i] - 1, B[i] - 1);
  }

  map<int, int> count;
  for (size_t i = 0; i < N; i++) {
    count[dset.find_set(i)]++;
  }

  auto max_pair = max_element(ALL(count), pair_second_lt<int, int>);
  return max_pair->second;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N, M;
  cin >> N >> M;

  std::vector<int> A(M, 0), B(M, 0);
  for (size_t i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
  }

  // main procedure
  int ans = solve(A, B, N);

  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 31580
#include<iostream>

using namespace std;

long long f(long long a)
{
	long long r = 0;
	if(a%2 == 0)
	{
		r = a^((a/2)%2);
	}
	else
	{
		r = ((a+1)/2)%2;
	}

	return r;
}

int main()
{
	long long A,B;
	long long ans;

	cin >> A >> B;



	cout << (f(A-1)^f(B)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#define ll long long
#define add push_back

using namespace std; 

int main() {

    ios::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);

    int T;  T = 1; //cin >> t;
    while(T--){
        string s; cin >> s;
        ll answ = 0;
        for(int i = 0; i < s.length(); i++){
            char ch = s[i];
            ll num = ch - '0';
            answ += num;
        }
        if(answ % 9 == 0)
            cout << "Yes" << endl;
        else 
            cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3716
#include"bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a = n%10;
    if (a == 2 || a==4 || a==5|| a==7 || a==9) {
        cout<<"hon\n";
    }
    else if(a==3) {
        cout<<"bon\n";
    }
    else if(a ==0 || a==1|| a==6 || a==8) {
        cout<<"pon\n";
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{
    double n, k;
    cin >> n >> k;
    double ans = 0;
    for(int i = 1; i <= n; i++)
    {
        int j = i;
        int count = 0;
        while(j < k)
        {
            j *= 2;
            count++;
        }
        ans += 1.0 / n * pow(0.5, count);
    }
    printf("%.12lf\n", ans);
}


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

public class Main {
  private static long divCeil(long a, long b) {
    if (a % b == 0) {
      return a / b;
    } else {
      return a / b + 1;
    }
  }
  
  private static String solve(long[] a) {
    long min = 2;
    long max = 2;
    
    for (int i = a.length - 1; i >= 0; i--) {
      if (max < a[i]) {
        return "-1";
      }
      min = divCeil(min, a[i]) * a[i];
      max = (max / a[i] + 1) * a[i] - 1;
      if (max < min) {
        return "-1";
      }
//      System.err.printf("%d %d\n", min, max);
    }
    return String.format("%d %d", min, max);
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int k = reader.nextInt();
    long[] a = reader.nextLongArray(k);
    out.println(solve(a));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public int[] nextIntArray(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLongArray(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
}

class Algorithm {
  private static void swap(Object[] list, int a, int b) {
    Object tmp = list[a];
    list[a] = list[b];
    list[b] = tmp;
  }
  
  public static <T extends Comparable<? super T>> boolean nextPermutation(T[] ts) {
    int rightMostAscendingOrderIndex = ts.length - 2;
    while (rightMostAscendingOrderIndex >= 0 &&
        ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostAscendingOrderIndex + 1]) >= 0) {
      rightMostAscendingOrderIndex--;
    }
    if (rightMostAscendingOrderIndex < 0) {
      return false;
    }
    
    int rightMostGreatorIndex = ts.length - 1;
    while (ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostGreatorIndex]) >= 0) {
      rightMostGreatorIndex--;
    }
    
    swap(ts, rightMostAscendingOrderIndex, rightMostGreatorIndex);
    for (int i = 0; i < (ts.length - rightMostAscendingOrderIndex - 1) / 2; i++) {
      swap(ts, rightMostAscendingOrderIndex + 1 + i, ts.length - 1 - i);
    }
    return true;
  }
}



Measured memory_bytes: 40128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
int n,m,sum=0;
int t[200],p[200],x[200];
signed main(){
    cin>>n;
    rep(i,n){
        cin>>t[i];
        sum+=t[i];
    }
    cin>>m;
    rep(i,m){
        cin>>p[i]>>x[i];
        int def=t[p[i]-1]-x[i];
        cout<<sum-def<<endl;
    }
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<char> D(K);
  for (int i = 0; i < K; i++) cin >> D[i];
  int ans;
  for (ans = N;; ans++) {
    string n = to_string(ans);
    bool flag = true;
    for (int j = 0; j < n.size(); j++)
      for (int k = 0; k < K; k++) if (n[j] == D[k]) flag = false;
    if (flag) break;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    #define ft first
    #define sd second
     
    using namespace std;
     
    typedef unsigned long long ull;
    typedef pair<int, int> pii;
     
    const int MAXH = 800 + 3;
     
    ull operator ""_D (ull x) { return 4; }
     
     
     
     
     
     
     
    int h, w, k, dis[MAXH][MAXH], ans = INT_MAX;
    pii st, d[] = {{1, 0}, {-1, 0}, {0, -1}, {0, 1}};
    string s[MAXH];
    queue<pii> q;
    bitset<MAXH> mark[MAXH];
     
    inline bool in(pii x) { return x.ft < h && x.sd < w && ~x.ft && ~x.sd; }
     
    void bfs(pii v) {
        dis[v.ft][v.sd] = 0;
        mark[v.ft][v.sd] = true;
        q.push(v);
        while (!q.empty()) {
            pii x = q.front();
            q.pop();
            for (int i = 0; i < 0_D; i++)
                if (in({x.ft + d[i].ft, x.sd + d[i].sd}) && s[x.ft + d[i].ft][x.sd + d[i].sd] != '#' && !mark[x.ft + d[i].ft][x.sd + d[i].sd]) {
                    q.push({x.ft + d[i].ft, x.sd + d[i].sd});
                    mark[x.ft + d[i].ft][x.sd + d[i].sd] = true;
                    dis[x.ft + d[i].ft][x.sd + d[i].sd] = dis[x.ft][x.sd] + 1;
                }
        }
    }
     
    int main() {
        cin >> h >> w >> k;
        for (int i = 0; i < h; i++) {
            cin >> s[i];
            for (int j = 0; j < w; j++)
                if (s[i][j] == 'S')
                    st = {i, j};
        }
        memset(dis, 63, sizeof dis);
        bfs(st);
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++)
                if (dis[i][j] <= k)
                    ans = min({ans, (i + k - 1) / k + 1, (h - i - 1 + k - 1) / k + 1, (j + k - 1) / k + 1, (w - j - 1 + k - 1) / k + 1});
        cout << ans;
        return 0;
    }

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

int main() {
  int ball;//ボールの個数
  int B;//ロボットBの初期位置
  cin >> ball >> B;
  int Move;
  for (int i = 0;i < ball;i++) {
    int BallPosi;
    cin >> BallPosi;
    if (B - BallPosi <= BallPosi) {
      Move += (B - BallPosi) * 2;
    } else {
      Move += BallPosi * 2;
    }
  }
  cout << Move << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int R = in.nextInt();
        	String str = "ABC";
        	if(2800 <= R) {
        		str = "AGC";
        	}else if(1200 <= R) {
        		str = "ARC";
        	}
        	out.println(str);
        }
    }

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

    }
}



Measured memory_bytes: 21588
from collections import Counter
n = int(input())
v = tuple(map(int, input().split()))
c1 = Counter(v[::2])
c2 = Counter(v[1::2])
if len(set(v)) == 1:
    print(n // 2)
else:
    c1m = c1.most_common(2)
    c2m = c2.most_common(2)
    if c1m[0][0] == c2m[0][0]:
        print(min(n - c1m[0][1] - c2m[1][1], n - c1m[1][1] - c2m[0][1]))
    else:
        print(n - c1m[0][1] - c2m[0][1])


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

int main(){
  int N,A,B;
  cin>>N>>A>>B;
  if(N*A<=B) cout<<N*A<<endl;
  else cout<<B<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 3010

ll dp[SIZE][SIZE];

int main(){
  int n;
  string s;

  cin >> n >> s;

  for(int i=0;i<n;i++){
    dp[0][i] = 1;
  }

  for(int i=0;i<n-1;i++){
    ll sum = 0;

    if (s[i] == '<') {
      for(int j=0;j<n-i-1;j++){
        sum = (sum + dp[i][j]) % mod;
        dp[i+1][j] = (dp[i+1][j] + sum) % mod;
      }
    } else {
      for(int j=n-i-2;j>=0;j--){
        sum = (sum + dp[i][j+1]) % mod;
        dp[i+1][j] = (dp[i+1][j] + sum) % mod;
      }
    }
  }

  ll ans = 0;

  for(int i=0;i<n;i++){
    ans += dp[n-1][i];
  }

  cout << ans % mod << endl;

  return 0;
}


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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

ll sum[200000];

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

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

  for(int i = 1; i <= n; i++){
    sum[i] = sum[i-1] + a[i-1];
  }

  ll ans = linf;
  for(int i = 1; i < n; i++){
    ll x = sum[i];
    ll y = sum[n] - sum[i];
    ans = min(ans, abs(x-y));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
ll dp[2][100000 + 100];
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  REP(i, N) cin >> w[i] >> v[i];
  ll *prev = dp[0], *next = dp[1];
  REP(i, N) {
    REP(j, W + 1) {
      // chmax(next[j], prev[j]);
      if (j + w[i] < W + 10) chmax(next[j + w[i]], prev[j] + v[i]);
      chmax(next[j], prev[j]);
    }
    swap(prev, next);
  }
  cout << prev[W] << endl;
  int t = 10;
}

Measured memory_bytes: 5160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
string s;
ll a, b, answer, wait;
int main(){
  ios_base::sync_with_stdio(0);cin.tie(0);
  cin >> n;
  for (ll i = 0; i < n; i++){
    cin >> s;
    if (s[0] == 'B' && s[s.length()-1] == 'A'){
      wait += 1;
    }else if (s[s.length()-1] == 'A'){
      a += 1;
    }else if (s[0] == 'B'){
      b += 1;
    }
    for(ll j = 0; j < s.length(); j++){
      if (s[j] == 'A' && s[j+1] == 'B'){
        answer += 1;
      }
    }
  }
  // if (a > b){
  //   swap(a, b);
  // }
  // if (wait >= a){
  //   answer = a * 3;
  //   b-=a;
  //   if ((wait-a)>= b){
  //     answer += b;
  //     wait -= a;
  //     wait -= b;
  //     answer += wait-1;
  //   }else {

  //   }
  // }
  if (wait > 0){
  answer += wait-1;
  if (a > 0){
    answer += 1;
    a -= 1;
  }
  if (b > 0){
    answer += 1;
    b -=1;
  }
  }
    if (a > b){
    swap(a, b);
  }
  cout << answer+a;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
c = [list(map(int,input().split())) for i in range(10)]
import queue

def dist(i):
    res = c[i][1]
    que = queue.Queue()
    path = []
    for j in range(10):
        if j != i and j != 1:
            path.append(j)
    for j in range(10):
        if j != 1 and j != i and c[i][j] < res:
            jpath = path.copy()
            jpath.pop(jpath.index(j))
            que.put((j,c[i][j],jpath))
    while que.qsize():
        j,cost,path = que.get()
        if cost + c[j][1] < res:
            res = cost + c[j][1]
        for k in path:
            if k != 1 and cost+c[j][k] < res:
                kpath = path.copy()
                kpath.pop(kpath.index(k))
                que.put((k,cost+c[j][k],kpath))
    return res

cost = []
for i in range(10):
    cost.append(dist(i))

ans = 0
for i in range(H):
    A = list(map(int,input().split()))
    for j in range(W):
        if A[j] != -1:
            ans += cost[A[j]]
print(ans)

Measured memory_bytes: 3952
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main(){
    ll h, w, n;
    cin >> h >> w >> n;
    vector<pair<ll, ll>> p(n);
    vector<ll> l(h, 1);
    rep(i, n)cin >> p[i].first >> p[i].second;
    sort(all(p));
    REP(i, h-1){
        l[i] = l[i-1];
        if(!binary_search(all(p), make_pair((ll)i+1, l[i]+1)))l[i]++;
    }
    ll ans = h;
    rep(i, n){
        if(p[i].second <= l[p[i].first-1]){
            chmin(ans, p[i].first-1);
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
    int n, a, b;
    string str;

    cin >> n >> a >> b;
    cin >> str;

    int a_sum = 0, b_sum = 0;
    for(int i = 0; i < n; i++){
        if(str[i] == 'a'){
            a_sum++;
        }else if(str[i] == 'b'){
            b_sum++;
        }

        if(str[i] == 'a'){
            if(b <= b_sum){
                b_sum = b;
            }
            if(a + b >= a_sum+b_sum){
                cout << "Yes" << endl;
            }else {
                cout << "No" << endl;
            }
        }else if(str[i] == 'b'){
            if(a + b >= a_sum+b_sum && b >= b_sum) {
                cout << "Yes" << endl;
            }else {
                cout << "No" << endl;
            }
        }else {
            cout << "No" << endl;
        }
    }
     
    return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#include<iostream>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n<1200)cout<<"ABC"<<endl;
	else if(n<2800&&n>=1200)cout<<"ARC"<<endl;
	else
	cout<<"AGC"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n, a[105], ans = 0, renzoku = 1;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 2; i <= n; i++) {
        if (a[i - 1] == a[i]) renzoku++;
        else {
            ans += (renzoku / 2);
            renzoku = 1;
        }
    }
  	ans += (renzoku / 2);
    cout << ans << endl;
    return 0;
}



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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
//cout<<"Yes"<<endl;
//cout<<"No"<<endl;
int main(){
  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    vector<ll> h;
    for(int i=0;i<n;++i){
        ll val;
        cin>>val;
        h.push_back(val);
    }
    vector<bool> ans(n+1 , true);
    for(int i=0;i<m;++i){
        int a,b;
        cin>>a>>b;
        if(h[a-1]>h[b-1]){
            ans[b] = false;
        }
        else if(h[a-1]<h[b-1]){
            ans[a] = false;
        }
        else if(h[a-1]==h[b-1]){
            ans[a] = false;
            ans[b] = false;
        }
    }
    int ann = 0;
    for(int i=1;i<=n;++i){
        if(ans[i])
            ++ann;
    }
    cout<<ann<<'\n';
}

Measured memory_bytes: 4248
#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define Key_Value ch[ch[root][1]][0]
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
const int INF=0x3f3f3f3f;
const int P=1000000007;
const double PI=acos(-1.0);
template<typename T>
inline T read(T&x){
    x=0;int _f=0;char ch=getchar();
    while(ch<'0'||ch>'9')_f|=(ch=='-'),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x=_f?-x:x;
}
/*int n;
int a[maxn],b[maxn],c[maxn];
vector<int>vec;
ll ma[maxn*3],mc[maxn*3];
int main(){
    read(n);
    for (int i=1;i<=n;i++) read(a[i]),vec.push_back(a[i]);
    for (int i=1;i<=n;i++) read(b[i]),vec.push_back(b[i]);
    for (int i=1;i<=n;i++) read(c[i]),vec.push_back(c[i]);
    sort(vec.begin(),vec.end());
    vec.erase(unique(vec.begin(),vec.end()),vec.end());
    for (int i=1;i<=n;i++){
        int pos=lower_bound(vec.begin(),vec.end(),a[i])-vec.begin();
        pos++;
        ma[pos]++;
    }
    for (int i=1;i<=n;i++){
        int pos=lower_bound(vec.begin(),vec.end(),c[i])-vec.begin();
        pos++;
        mc[pos]++;
    }
    for (int i=1;i<=3e5;i++) ma[i]+=ma[i-1],mc[i]+=mc[i-1];
    ll ans=0;
    for (int i=1;i<=n;i++){
        int pos=lower_bound(vec.begin(),vec.end(),b[i])-vec.begin();
        pos++;
        ans+=ma[pos-1]*(mc[300000]-mc[pos]);
    }
    cout<<ans<<endl;
    return 0;
}*/
string a,b;
int main(){
    cin>>a>>b;
    if (a[0]==b[2] && a[1]==b[1] && a[2]==b[0]) puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch LunlunNumber | diff LunlunNumber.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address LunlunNumber.cpp && ./a.out

/*
 
 4/4/2020
 
 5:22-6:04
 
 */

int K;

void solve() {
  priority_queue<LL> Q;
  FOR(i,1,10) Q.emplace(-i);
  set<LL> viz;
  vector<LL> res;
  while(SZ(res)<K) {
    LL n=Q.top(); Q.pop();
    n=-n;
    if(viz.count(n)) continue;
    res.push_back(n);
    viz.emplace(n);
    int dd=n%10LL;
    LL base=10LL*n;
    
    auto add=[&](int d) {
      if(d>=0&&d<=9) {
        LL a=base+d;
        if(!viz.count(a))Q.emplace(-a);
      }
    };
    add(dd-1),add(dd),add(dd+1);
  }
//  dumpc(res);
//  vector<LL> ans=res;
//  if(SZ(res)>=100) dumpC(res.end()-100,res.end());
//  sort(ALL(ans));
//  assert(ans==res);
  cout<<res[K-1]<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>K;
  solve();
  
  return 0;
}


Measured memory_bytes: 7268
#include"bits/stdc++.h"
using namespace std;
long long n,c;
long long f[100001];
long long v[101],w[101];
int main()
{
	scanf("%lld%lld",&n,&c);
	for(int i=1;i<=n;i++)
		scanf("%lld%lld",&w[i],&v[i]);
	for(int i=1;i<=n;i++)
		for(int j=c;j>=w[i];j--)
			f[j]=max(f[j],f[j-w[i]]+v[i]);
	printf("%lld",f[c]);
}

Measured memory_bytes: 1152
value = input()
n = len(value) - 1

for i in range(n ** 2):
    sign = ["+"] * n
    for j in range(n):
        if(i >> j & 1):
            sign[n-1-j] = "-"
    formula = ""
    for x,y in zip(value,sign+[""]):
        formula += x + y 
    if eval(formula) == 7:
        print(formula + "=7")
        break

Measured memory_bytes: 3060
import sys
n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
if a[-1] < k:
    print('IMPOSSIBLE')
    sys.exit(0)

seta = set(a)
if k in seta:
    print('POSSIBLE')
    sys.exit(0)
change = True
lena = 0
while lena != len(seta):
    change = False
    sorteda = sorted(seta)
    mini = sorteda[0] if sorteda[0] != 0 else sorteda[1]
    for i in range(1, len(sorteda)):
        seta.add(sorteda[i] % mini)
    lena = len(seta)

mini = sorted(seta)[1]
a.reverse()

for i in a:
    if (k - i) % mini == 0:
        print('POSSIBLE')
        sys.exit(0)
print('IMPOSSIBLE')

Measured memory_bytes: 14480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int main()
{
	string s,t;
	cin>>s>>t;
	
	string ans;
	ans.pb((char) ('z'+20));
	for(int i=0;i+t.length()<=s.length();i++){
		string tmp;
		bool flag=1;
		REP(j,s.length()){
			if(i<=j&&j<i+t.length()){
				if(s[j]==t[j-i]||s[j]=='?') tmp.pb(t[j-i]);
				else{
					flag=0;
				}
			}
			else{
				if(s[j]!='?')tmp.pb(s[j]);
				else tmp.pb('a');
			}
		}
		if(flag) ans=min(ans,tmp);
	}
	if(islower(ans[0]))cout<<ans;
	else cout<<"UNRESTORABLE";
	return 0;
}












Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int n,k;
    int i,a;
    while(scanf("%d",&n)!=EOF)
    {
        scanf("%d",&k);
        int sum=0;
        for (i=0;i<n;i++)
        {
            scanf("%d",&a);
            if (a<k-a)
                sum+=a;
            else
                sum+=k-a;
        }
        printf("%d\n",sum*2);
    }
    return 0;
}

Measured memory_bytes: 128
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int mod = 1e9+7;
const int N = 2e5+5;

int fac[N];

int fast_pw(int x, int y) {
	int ret = 1;
	for(;y;y>>=1) {
		if(y&1) ret=(ret*x)%mod;	
		x=(x*x)%mod;
	}
	return ret;
}

int comb(int n, int k) {
	int ans = fac[n];
	int a1 = fast_pw(fac[k], mod-2);
	int a2 = fast_pw(fac[n-k], mod-2);
	ans = (ans*a1)%mod;
	ans = (ans*a2)%mod;
	return ans;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	fac[0] = 1;
	for(int i=1;i<N;i++) fac[i]=(fac[i-1]*i)%mod;
	int n, k;
	cin >> n >> k;
	int ans = 1;
	k=min(k, n-1);
	for(int i=1;i<=k;i++) {
		ans += comb(n, i)*comb(n-1, n-i-1);
		ans %= mod;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 1792
while True:
    h,w = map(int,input().split())
    if h==0 and w==0:
        break
    for i in range(h):
        for j in range(w-1):
            if i==0 or i==h-1 or j==0:
                print('#',end='')
            else:
                print('.',end='')
        print('#')
    print()



Measured memory_bytes: 7004
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


# 数列の中に1は含まれてはいないが、gcd=1となるような場合を数え抜けている。
# これらを追加で数え上げるのは難しそうなので、この方針ではダメなのかもしれない。
def solve(N: int, K: int):
    # sm = 0
    # for n in range(1, K + 1):
    #     if int(K / n) > int(K / (n + 1)):
    #         sm += (int(K / n) + int(K / (n + 1)) + 1) * (int(K / n) - (int(K / (n + 1)))) / 2 * ((modpow(n, N) - modpow(n - 1, N)) % MOD)
    #         print("{0} - {1}".format(K / n, K / (n + 1)))
    #         print(((modpow(n, N) - modpow(n - 1, N)) % MOD))
    #         sm %= MOD

    # print(int(sm))
    # return
    sm = 0
    dic = dict()
    for i in range(K, 0, -1):
        n = modpow(int(K / i), N)
        n2 = n
        j = 2
        while i * j <= K:
            n2 -= dic.get(i * j)
            n2 %= MOD
            j += 1
        dic[i] = n2
        sm += i * n2
        sm %= MOD

    print(sm)


def modpow(a, n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % MOD
        a = a * a % MOD
        n = n >> 1
    return res


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()

Measured memory_bytes: 78296
n,k,c=map(int,input().split())
s=input()
l=len(s)
cand=[]
for i in range(l):
  if s[i]=='o':
    cand.append(i)
if len(cand)==k:
  for val in cand:
    print(val+1)
else:
  cnt1=[0]*n
  cnt2=[0]*n
  prev=0
  cnt=0
  for i in range(l):
    if s[i]=='o' and i>=prev:
      cnt+=1
      cnt1[i]=cnt
      prev=i+(c+1)
    else:
      cnt1[i]=cnt
  prev=l-1
  cnt=0
  for i in range(l-1,-1,-1):
    if s[i]=='o' and i<=prev:
      cnt+=1
      cnt2[i]=cnt
      prev=i-(c+1)
    else:
      cnt2[i]=cnt
  ans=[]
  for i in range(len(cand)):
    if i==0:
      if cnt2[cand[i]+1]<k:
        ans.append(cand[i]+1)
    elif i==len(cand)-1:
      if cnt1[cand[i]-1]<k:
        ans.append(cand[i]+1)
    else:
      if cnt1[cand[i]-1]+cnt2[cand[i]+1]<k:
        ans.append(cand[i]+1)
  for val in ans:
    print(val)

Measured memory_bytes: 27248
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    string s;
    cin >> s;
    vector<string> you = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    int i = 0;
    while(you[i] != s) i++;
    int ans = (7-i) % 7;
    if(ans == 0)
        ans = 7;
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
 
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  
  int a,b;
  vector<int> vec_sort(n);
  for(int i=0;i<n;i++){
    vec_sort.at(i) = vec.at(i);
  }
  
  sort(vec_sort.begin(),vec_sort.end());
 
  a = vec_sort.at(n/2-1);
  b = vec_sort.at(n/2);

  for(int i=0;i<n;i++){
    if(vec.at(i) < b){
      cout << b << endl;
    }
    else {cout << a << endl;}
  }
}
  

Measured memory_bytes: 3712
n = int(input())
a = [0]*n
a = input().split()
n0 = a.count('0')
sum = int(a[0])
if n0 == 0:
  for k in range(len(a)-1):
    sum =sum*int(a[k+1])
    if sum >1000000000000000000:
      print(-1)
      break
  if sum <=1000000000000000000:
    print(sum)
else:
  print(0)

Measured memory_bytes: 20100
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
using namespace std;

typedef vector <long long> vi;
typedef pair <long long, long long> pii;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define FOR(i, a, b) for (long long i = a; i < b; ++i)
#define FORR(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define int long long
#define inf LLONG_MAX
#define endl "\n"
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){ for (X a : v) x << a << ' '; return x;} 
template <typename X, typename Y> ostream& operator << (ostream& x, const vector< pair<X, Y> >& v) {for (pair <X, Y> it : v) x << it.first << ' ' << it.second << endl; return x;} 
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (pair <T, S> it : v) os << it.first << " => " << it.second << endl; return os; }

double pi = 3.14159265358979323846264338327950288419716939937510582097494459230;
int modulo = 1e9 + 7;

int fpow(int a, int n)
{
    int ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s; cin >> s;
    char arr[4];
    FOR(i,0,4) arr[i] = s[i];
    sort(arr, arr+4);
    if (arr[0] == arr[1] and arr[2] == arr[3] and arr[1] != arr[2])
    {
        cout << "Yes";
        return 0;
    }
    cout << "No";
    return 0;
}

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

LL f(LL h)
{
    if(h==1)
    {
        return 1;
    }
    else
    {
        return 2*f(h/2)+1;
    }
    
}

int main()
{
    LL n,i,j,k,t,temp;
    LL height;
    cin>>height;
    LL ans=f(height);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args : Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.next()
    val b = sc.next()
    println(problem56a(a, b))
}

fun problem56a(a: String, b: String): String {
    return if (a == "H") {
        if (b == "H") {
            "H"
        } else {
            "D"
        }
    } else {
        if (b == "H") {
            "D"
        } else {
            "H"
        }
    }
}

Measured memory_bytes: 31388