akhauriyash/Code-Regression huggingface dataset:
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

//約数列挙。vectorが返り値。O(sqrt(n))
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//

int main() {
    int ans = 0;
    long long int tmp;
    
    long long int n;
    cin >> n;
    
    vector<long int> sbst;
    sbst = divisor(n-1);
    ans += sbst.size() - 1;
    //REP1(i, sbst.size()-1) cout << sbst[i] << " ";

    vector<long int> dvs;
    dvs = divisor(n);
    //REP1(i, dvs.size()-1) cout << dvs[i] << " ";
    REP(i, dvs.size()){
        if(dvs[i] == 1) continue;
        //else if(dvs[i] * dvs[i] > n) break;
        tmp = n;
        while (1)
        {
            if(tmp % dvs[i] == 0) tmp /= dvs[i];
            else tmp %= dvs[i];
            if(tmp < dvs[i]){
                if (tmp == 1){
                    ans++;
                    //cout << dvs[i] << " " ;
                }
                break;
            }   
        }
    }
    //ans++; //n itself
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<iostream>

int main()
{
	int A;
	int B;
	int C;
	std::cin >> A;
	std::cin >> B;
	std::cin >> C;
	if (A + B >=C) {
		std::cout << "Yes"<<std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
	return 0;
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

	ll n, k; cin >> n >> k;
	ll cnt = 0;
	if (!k) cnt = n * n;
	else {
		for (int b = k + 1; b <= n; b++) {
			ll div = n / b;
			ll rem = n % b;
			cnt += div * max(0LL, b - k) + max(0LL, rem - k + 1);
		}
	}
	cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 3544
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
#define INF 0x3fffffff
#define maxn 10001
int n, m;//頂點個數  邊的個數
struct edge {
	int u, v;
	double w;
}e[50001];
struct node {
	int x, y;
}list[maxn];
bool cmp(edge a, edge b) { return a.w > b.w; }
int tree[maxn];
int findroot(int a) {
	if (tree[a] == -1)return a;
	else {
		int tmp = findroot(tree[a]);
		tree[a] = tmp;//路徑壓縮
		return tmp;
	}
}
double compute(node a, node b) {
	return sqrt((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y));
}
bool hebing(int a, int b) {
	a = findroot(a);
	b = findroot(b);
	if (a != b) {
		tree[a] = b;
		return true;
	}
	return false;
}
void init(int x) {
	for (int i = 1; i <= x; i++) {
		tree[i] = -1;
	}
}
int main() {
	while (scanf("%d%d", &n, &m) != EOF) {
		init(n);
		double all = 0;
		for (int i = 1; i <= n; i++) {
			scanf("%d%d", &list[i].x, &list[i].y);
		}
		for (int i = 1; i <= m; i++) {
			int a, b;
			scanf("%d%d", &a, &b);
			e[i].u = a; e[i].v = b;
			e[i].w = compute(list[a], list[b]);
			all += e[i].w;
		}
		sort(e + 1, e + 1 + m, cmp);
		double ans = 0;
		for (int i = 1; i <= m; i++) {
			if (hebing(e[i].u, e[i].v)) {
				ans += e[i].w;
			}
		}
		ans = all - ans;
		printf("%.3f\n", ans);
	}
	return 0;
}


Measured memory_bytes: 3808
#include<stdio.h>
int main(void)
{
    int n,i,t,max,min;
    int a[100],c;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    max=min=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]>max)
            max=a[i];
        if(a[i]<min)
            min=a[i];
    }
    c=max-min;
    printf("%d\n",c);
    return 0;
}


Measured memory_bytes: 128
import copy
# input
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
  
# main / output
top = max(a)
if a.count(top) != 1:
  for i in range(n):
    print(top)
else:
  topind = a.index(top)

  tmp = copy.deepcopy(a)
  tmp[topind] = 0
  sub = max(tmp)
  
  for i in range(n):
    if i == topind:
      print(sub)
    else:
      print(top)
      

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

using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> K(n, 0);
  vector<int> memo(m,0);
  for(int i=0; i<n; i++)
  {
    cin >> K[i];
    for(int j=0; j<K[i]; j++)
    {
      int a;
      cin >> a;
      memo[a-1]++;
    }
  }
  int count = 0;
  for(int i=0; i<m; i++)
  {
    if(memo[i] == n)
    {
      count++;
    }
  }
  cout << count << endl;
  
  return 0;
}


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

int main(){

string a,b;
cin>>a;
  b="YAKI";
  for(int i=0;i<4;i++){
if(a[i]==b[i]){
  if(i==3){
  cout<<"Yes"<<endl;
  }
}
    else{
    cout<<"No"<<endl;
    break;
    }
  }
 

}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
  int asum=0,bsum=0;
  for(int i=0;i<4;i++){
    int a;
    cin>>a;
    asum+=a;
  }
  for(int i=0;i<4;i++){
    int b;
    cin>>b;
    bsum+=b;
  }
  if(asum>bsum)
    cout<<asum<<endl;
  else
    cout<<bsum<<endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  if(N == 3 || N % 10 == 3){
	cout << "bon" << endl;
  }else if(N == 0 || N % 10 == 0 || N == 1 || N % 10 ==1 || N == 6 || N % 10 == 6 || N == 8 || N % 10 == 8){
	cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
  char S[101], copy[101];
  int number=0, count=0;
  int i;

  scanf("%s",S);

  while(S[number]!='\0'){
    copy[number] = S[number];
    number++;
  }

  for(i=0;i<number/2;i++){
    if(S[i]!=copy[number-i-1])count++;
  }
  printf("%d\n",count);


  return 0;
}



Measured memory_bytes: 128
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int x = Integer.parseInt(S[0]);
    int y = Integer.parseInt(S[1]);
    int ans = 0;
    if(x >= 0 && y >= 0 && x < y){
      ans = y - x;
    }else if(x >= 0 && y > 0 && x > y){
      ans = x - y + 2;
    }else if(x >= 0 && y == 0 && x > y){
      ans = x - y + 1;
    }else if((x >= 0 && y < 0) || (y > 0 && x < 0)){
      ans = Math.abs(Math.max(x, y) + Math.min(x, y)) + 1;
    }else if(y == 0 && x < 0){
      ans = Math.abs(Math.max(x, y) + Math.min(x, y));
    }else if(x < y){
      ans = y - x;
    }else{
      ans = Math.abs(Math.min(x, y)) - Math.abs(Math.max(x, y)) + 2;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
#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>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  string n; cin >> n;
  int last = n.size() - 1;
  string ans = "hon";
  if (n[last] == '3') ans = "bon";
  else if (n[last] == '0' || n[last] == '1' || n[last] == '6' || n[last] == '8') ans = "pon";

  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second

using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	int a,b;
	cin >> a >> b;
	cout << a*b << endl;
	return 0;
}

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

using namespace std;
int main(void){
    int h, w, n;
    cin >> h >> w >> n;
    
    int divisor = max(h,w);
    int ans = (n + divisor - 1) / divisor;
    cout << ans << endl;
    
}


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

int main(){
	int n, p;
	string str;
	
	cin >> n; cin.get();
	while(n--){
		getline(cin, str);
		
		while(p = str.find("Hoshino"), p != string::npos){
			str.replace(p, 7, "Hoshina");
		}
		
		cout << str << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1208
/**
 * C - Traveling Plan
 * https://atcoder.jp/contests/abc092/tasks/arc093_a
 **/
#include<iostream>
#include<vector>

using namespace std;

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

    int cost = 0;
    for(int i=0; i<N+1; i++) {
        if(i==N) {
            cost += abs(A[i]);
        } else {
            cost += abs(A[i+1]-A[i]);
        }
    }
    for(int i=1; i<N+1; i++) {
        if(i==N) {
            cout << cost-(abs(A[i]-A[i-1])+abs(A[i]))+abs(A[i-1]) << endl;
        } else {
            cout << cost-(abs(A[i]-A[i-1])+abs(A[i+1]-A[i]))+abs(A[i+1]-A[i-1]) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1664
import java.util.*;

public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int n = Integer.parseInt(sc.next());
      int k = Integer.parseInt(sc.next());

      String s = sc.next();
      int lng = s.length();
      char[] c = new char[lng];
      for(int i=0;i<lng;i++){
        c[i] = s.charAt(i);
      }

      int[] kore = new int[n];
      int[] or01 = new int[n];
      int cnt = 0;
      for(int i=0;i<n-1;i++){
        if(c[i]==c[i+1]){
          kore[cnt]++;
        }
        else{
          if(c[i]=='0'){
            or01[cnt] = 0;
          }
          else{
            or01[cnt] = 1;
          }
          cnt++;
        }
      }
      for(int i=0;i<=cnt;i++){
        kore[i]++;
      }

//////main////////////////////////////////////
int range = 2*k+1;
int ans = 0;
int max = 0;
for(int i=-range+1;i<=lng-range;i++){

if(i<0){
//////////////////////////////////
for(int j=0;j<range+i;j++){
  max += kore[j];
}
//////////////////////////////////
}
else if(0<=i && i<=lng-range){
//////////////////////////////////
  if(or01[i]==1){
    for(int j=i;j<i+range;j++){
      max += kore[j];
    }
  }
//////////////////////////////////
}
/*
else if(lng-range<i){
//////////////////////////////////
for(int j=i;j<lng;j++){
  max += kore[j];
}
//////////////////////////////////
}
*/
  ans = Math.max(ans,max);
  max = 0;
}

System.out.println(ans);
//////////////////////////////////////////////

      /*for(int kores : kore){
        System.out.println(kores);
      }*/

    }
}


Measured memory_bytes: 26256
#include <stdio.h>

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

	int counter = 0;
	int odd = 0, even = 0;
	if (a & 1) odd++;
	else even++;
	if (b & 1) odd++;
	else even++;
	if (c & 1) odd++;
	else even++;
	//三つの数字を奇数か偶数にそろえる
	if (odd == 2 && even == 1) {
		if (a & 1) a += 1;
		if (b & 1) b += 1;
		if (c & 1) c += 1;
		counter++;
	}
	else if (odd == 1 && even == 2) {
		if ((a % 2)==0) a += 1;
		if ((b % 2)==0) b += 1;
		if ((c % 2)==0) c += 1;
		counter++;
	}

	//一番大きいものに合わせる
	int max = 0;
	if (max < a) max = a;
	if (max < b) max = b;
	if (max < c) max = c;
	for (; a < max; a += 2) {
		counter++;
	}
	for (; b < max; b += 2) {
		counter++;
	}
	for (; c < max; c += 2) {
		counter++;
	}
	printf("%d\n", counter);
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int a, b;
	scanf("%d", &a);
	scanf("%d", &b);
	if(a >= 1 && a <= 100 && b >= 1 && b <= 100 )
		printf("%d %d\n", a*b, a * 2 + b * 2);

	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)1e5 + 123;
const int mod = (int)1e9 + 7;

vector < int > q;

void out(ll x, int len) {
    q.clear();
    for (int it = 0; it < len; it++) {
        q.pb(x % 2);
        x /= 2;
    }
    reverse(q.begin(), q.end());
    for (auto i : q)
        cout << i;
    cout << endl;
}

bool in(ll x, int id) {
    return (x & (1LL << id)) > 0;
}

int maxBit(ll x) {
    for (int i = 60; i >= 0; i--)
        if (in(x, i))
            return i;
    return -1;
}

ll solve(ll l, ll r) {
    vector < int > id;
    for (int i = 0; i <= 60; i++) {
        ll now = (1LL << i);
        if (now >= l && now <= r)
            id.pb(i);
    }
    if (id.empty()) {
        int bit = maxBit(l);
        assert(bit >= 0);
        return solve(l - (1LL << bit), r - (1LL << bit));
    }
    
    ll res = 0;
    for (int i = 0; i < sz(id); i++) {
        ll now = (1LL << id[i]);
        ll prev = (i == 0 ? l : (1LL << id[i - 1]));
        res += now - prev;
    }
    
    for (int i = sz(id) - 2; i >= 0; i--) {
        res += (1LL << id[i]);
    }
    
    ll a = 0, b = r - (1LL << id.back()), c = l, d = (1LL << id[0]) - 1;
    
    if (maxBit(b) >= id[0] - 1)
        res += (1LL << id[0]);
    else {
        if (c > d)
            res += (1LL << (maxBit(b) + 1));
        else {
            b = (1LL << (maxBit(b) + 1)) - 1;
            if (b >= c)
                res += d + 1;
            else {
                res += b - a + 1, res += d - c + 1;
            }
        }
    }
    
    return res;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
//    for (int i = 1; i <= 34; i++)
//        out(i, 6);
//    cout << endl;
    ll l, r;
    cin >> l >> r;
    cout << solve(l, r);
    return 0;
}


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

int main(){
  int a,b;
  scanf("%2d%2d", &a, &b);
  bool am, bm;
  am = 0<a && a<=12;
  bm = 0<b && b<=12;

  if(am && bm){
    cout<<"AMBIGUOUS"<<endl;
  }else if(am && !bm){
    cout<<"MMYY"<<endl;
  }else if(!am && bm){
    cout<<"YYMM"<<endl;
  }else if(!am && !bm){
    cout<<"NA"<<endl;
  }
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <complex>
#define LL long long
using namespace std;
const int M = 1e6 + 5, INF = 0x3f3f3f3f, mod = 313;
const double PI = acos(-1);
int A[M];
int main() {
    int n,m;
    while(scanf("%d%d",&n,&m)!=EOF){
        int g=0;
        for(int j=1;j<=n;j++){
            scanf("%d",&A[j]);
            g=__gcd(A[j],g);
        }
        int ok=0;
        for(int j=1;j<=n;j++){
            if(A[j]>=m&&(A[j]-m)%g==0){
                ok=1;
            }
        }
        if(ok) printf("POSSIBLE\n");
        else printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }

    int res = 0;
    for (auto&& p : mp) res++;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 19204
n=int(input())
l=list(map(int,input().split()))
if l.count(0)!=0:
  print(0)
else:
  num=1
  for i in l:
    if num>10**18:
      break
    else:
      num*=i
  if num>10**18:
    print(-1)
  else:
    print(num)

Measured memory_bytes: 21528
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,a) REP(i,0,a)
using namespace std;

const int mod = 1000000007;
int N, T;
int D[100001];

int main(){
    cin >> N >> T;
    rep(i,N) cin >> D[i];
    sort(D, D+N);
    long long ans = 1;
    rep(i,N) ans = ans * (lower_bound(D,D+i,D[i]+1) - lower_bound(D,D+i,D[i]-T) + 1) % mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1560
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int k = sc.nextInt();
			System.out.println(n - k + 1);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 21588
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

a,b,c = inputSL()

print(c,a,b)

Measured memory_bytes: 64748
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  string b;
  cin>>b;
  int c=0,d=0;
  rep(i,a){
    if(b[i]=='R')
      c++;
    else
      d++;
  }
  YesNo(c>d);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long arr[n];
    for(int i = 0; i < n; i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(int i = 0; i < n-1; i++)
    {
        if(arr[i] == arr[i+1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 5128
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define all(vec) vec.begin(),vec.end()
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

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


void virus(){
          string s;
          cin>>s;
          if(s.back() != 's') cout<<s<<"s";
          else cout<<s<<"es";
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t = 1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
           //cerr << "\n Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

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

int main(){
  int A, B, C, D, L, R;
  
  cin >> A >> B >> C >> D;
  
  L=A+B;
  R=C+D;
  
  if(L>R)
    cout << "Left" << endl;
  else if(L==R)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
}

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

/////////////////////////////////////////////////////
// 素因数分解 pair<指数, 乗数>
vector<pair<ll, ll>> prime_factorize(ll N) {
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

void solve(long long N, long long P) {
    vector<pair<ll, ll>> pair = prime_factorize(P);
    ll ans = 1;
    rep(i, pair.size()) {
        if (pair[i].second >= N) ans *= (pow(pair[i].first, (pair[i].second / N)));
    }
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long P;
    scanf("%lld", &P);
    solve(N, P);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] probs = new double[n];
        for (int i = 0; i < n; i++) {
            probs[i] = sc.nextDouble();
        }

        double[][] dp = new double[n + 1][n + 1];
        dp[0][0] = 1.0;

        for (int i = 1; i <= n; i++) {
            double p_head = probs[i - 1];
            for (int j = 0; j <= n; j++) {
                double p_enough_heads = dp[i - 1][j];
                double p_need_head = (j > 0) ? dp[i - 1][j - 1] : 0;
                dp[i][j] = p_enough_heads * (1.0 - p_head) + p_need_head * p_head;
            }
        }

        double result = 0.0;
        for (int i = n / 2 + 1; i <= n; i++) {
            result += dp[n][i];
        }

        System.out.println(result);

    }
}

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

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

	if (a == b && b == c) cout << "1" << endl;
	else if (a == b || a == c || b == c) cout << "2" << endl;
	else cout << "3" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int pow(int x, int n){
	return n ? x * pow(x, n - 1) : 1;
}

int main(){
	int n, m; scanf("%d %d", &n, &m);
	printf("%d\n", (100 * (n - m) + 1900 * m) * pow(2, m));
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int N,K;
	cin >> N >> K;
	vector<int> h(100001);
	for (int i = 0; i < N; i++) {
		cin >> h.at(i);
	}
	vector<long long int> rec(100001, 100000000000);
	rec[0] = 0;
	rec[1] = abs(h[1] - h[0]);
	for (int i = 0; i < N; i++){
		for (int j = 1; j <= K;j++) {
			rec[i + j]= min(rec[i + j], rec[i] + abs(h[i + j] - h[i])); 
		}
	}

	cout << rec[N - 1] << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll= long long;
using ld= long double;
using vi= vector<int>;
using vl= vector<ll>;
using vd= vector<ld>;
using vs= vector<string>;
using vb= vector<bool>;
using vvi= vector<vector<int>>;
using vvl= vector<vector<ll>>;
using vvd= vector<vector<ld>>;
using vvs= vector<vector<string>>;
using vvb= vector<vector<bool>>;
using pll= pair<ll, ll>;
constexpr ll mod= 1e9 + 7;
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for(ll(i)= 0; (i) < (n); (i)++)
#define REPS(i, n) for(ll(i)= 1; (i) <= (n); (i)++)
#define RREP(i, n) for(ll(i)= (n - 1); (i) >= 0; (i)--)
#define RREPS(i, n) for(ll(i)= (n); (i) > 0; (i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define YES(n) ((n) ? "YES" : "NO")
#define Yes(n) ((n) ? "Yes" : "No")
#define yes(n) ((n) ? "yes" : "no")

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

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    int N;
    cin >> N;
    vector<pair<int, int>> A(N);
    vector<pair<int, int>> B(N);
    REP(i, N) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        A[i]= mp(x, y);
        B[i]= mp(x, y);
    }
    dsu uf(N);
    vi E(N);
    REP(i, N) { E[A[i].se]= i; }
    sort(ALL(B), greater<>());
    set<int> ys;
    REP(i, N) {
        int yy= B[i].se;
        auto it= ys.upper_bound(B[i].se);
        for(auto itr= it; itr != ys.end();) {
            uf.merge(E[*itr], E[B[i].se]);
            chmax(yy,*itr);
            itr= ys.erase(itr);
            chmax(yy,*itr);
        }
        ys.insert(ys.end(), yy);
    }
    REP(i, N) cout << uf.size(i) << "\n";
}

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

int lowest_number(int n) {
    return n % 10;
}
int highest_number(int n) {
    int temp = n;
    while (temp >= 10) temp /= 10;
    return temp;
}

int main() {
    int n;
    cin >> n;
    vector<set<int>> m(100);
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        int lowest = lowest_number(i);
        int highest = highest_number(i);
        ll temp = 0;
        if (lowest != 0) {
            temp += m[lowest*10 + highest].size();
            m[highest*10 + lowest].insert(i);
            temp += m[lowest*10 + highest].size();
        }
//        cout << lowest << ' ' << highest << ' ' << temp << endl;
        ans += temp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 12060
#include <iostream>
#include <string>
using namespace std;
int main() {
	int a, b, ans=0;
	cin >> a >> b;
	char k[50][50];
	for (int i = 0; i < a; i++) {
		for (int m = 0; m < b; m++) {
			cin >> k[i][m];
		}
	}
	for (int i = 0; i < a; i++) {
		for (int m = 0; m < b; m++) {
			if (k[i][m] == '#'&&k[i][m + 1] != '#'&&k[i][m - 1] != '#'&&k[i + 1][m] != '#'&&k[i - 1][m] != '#') ans += 1;
		}
	}
	if (ans == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

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

Measured memory_bytes: 8832
n=int(input())
a=[]
xy=[]
for i in range(n):
  t_a=int(input())
  a.append(t_a)
  xy.append([list(map(int,input().split())) for i in range(t_a)])

ans=0
for i in range(2**n):
  list=[[] for j in range(n)]
  honest=[]
  for k in range(n):
    if (i>>k)&1:
      honest.append(k)
      for x,y in xy[k]:
        x-=1
        list[x].append(y)

  check=1
  for m in range(n):
    t_l=list[m]
    if t_l:
      if 0 in t_l and 1 in t_l:
        check=0
      elif 1 in t_l and m not in honest:
        check=0
      elif 0 in t_l and m in honest:
        check=0

  if check==1:
    ans=max(ans,len(honest))

print(ans)

Measured memory_bytes: 3064
b = [int(_) for _ in input().split()]
if len(b) == 3:
    if 1 <= b[0] <= 100 and 1 <= b[1] <= 100 and 1 <= b[2] <= 100:
        b.sort()
        print(b[2]-b[0])
    else:
        print('hoge!')
else:
    print('hoge!')

Measured memory_bytes: 3060
require 'set'

Move = [ [1, 3], [0, 2, 4], [1, 5],
         [0, 4, 6], [1, 3, 5, 7], [2, 4, 8],
         [3, 7], [4, 6, 8], [5, 7] ]

R = [0, 0, 0, 1, 1, 1, 2, 2, 2]
C = [0, 1, 2, 0, 1, 2, 0, 1, 2]

Factorials = (1...9).each_with_object([1]){ |i, arr| arr << arr[-1] * i }.reverse

def min_heapify(x = 1)
  l = 2*x
  r = 2*x+1
  if l <= $n && $heap[l][0] < $heap[x][0]
    minimum = l
  else
    minimum = x
  end
  if r <= $n && $heap[r][0] < $heap[minimum][0]
    minimum = r
  end
  if minimum != x
    $heap[x], $heap[minimum] = $heap[minimum], $heap[x]
    min_heapify(minimum)
  end
end

def extract
  key = $heap[1]
  $heap[1] = $heap[$n]
  $n -= 1
  min_heapify
  key
end

def insert(key)
  $n += 1
  $heap[$n] = key
  i = $n
  while i > 1 && $heap[i/2][0] > $heap[i][0]
    $heap[i], $heap[i/2] = $heap[i/2], $heap[i]
    i /= 2
  end
end

def create_hash(brd)
  b = brd.dup
  9.times do |i|
    (i+1...9).each do |j|
      b[j] -= 1 if b[i] < b[j]
    end
  end
  9.times.reduce(0){ |sum, i| sum += b[i] * Factorials[i] }
end

def dehash(key)
  brd = 9.times.map { |i| d, key = key.divmod(Factorials[i]); d }
  8.downto(0) do |i|
    (i+1...9).each do |j|
      brd[j] += 1 if brd[j] >= brd[i]
    end
  end
  brd
end

def judge(brd, c)
  ret = c
  9.times do |i|
    if brd[i] > 0
      [R, C].each do |a|
        ret += (a[i] - a[brd[i] - 1]).abs
      end
    end
  end
  ret
end

Goal = create_hash([1,2,3,4,5,6,7,8,0])

brd = 3.times.map{ gets.split.map(&:to_i) }.flatten
$heap = []
$n = 0
insert [judge(brd, 0), k = create_hash(brd), 0]
set = Set.new([])
set.add(k)
while $n > 0
  val, key, cnt = extract
  if val == cnt
    p cnt
    break
  end
  b = dehash(key)
  n = b.index(0)
  Move[n].each do |m|
    b[n], b[m] = b[m], b[n]
    k = create_hash(b)
    unless set.include?(k)
      set.add(k)
      insert [judge(b, cnt+1), k, cnt + 1]
    end
    b[n], b[m] = b[m], b[n]
  end
end

Measured memory_bytes: 10044
import collections

class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.rank = [0] * n

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

N, M = map(int, input().split())
tree = UnionFind(N)

for i in range(M):
    A, B = map(int, input().split())
    tree.unite(A-1, B-1)

roots = [tree.find(p) for p in tree.parent]
count = collections.Counter(roots).most_common(1)[0][1]
print(count)


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

#define boost ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

using namespace std;
using LL = long long;

constexpr int MAXN = 2e5 + 5;

template <typename T>
inline void read(T &x) {
    int f = 1;
    x = 0;
    char ch = getchar();
    while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

LL n, h[MAXN], val[MAXN], ans;
map<int, LL> cnt;

int main() {
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    boost;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> h[i], val[i] = h[i] + i;
    for (int i = n; i >= 1; i--) {
        ans += cnt[val[i]];
        if (i - h[i] <= 0) continue;
        cnt[i - h[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20480
l = input().split()
a = int(l[0])
b = int(l[1])
k = int(l[2])
ans = set()
for i in range(k):
    n = a + i
    if n <= b and not n in ans:
        ans.add(n)
    n = b - i
    if n >= a and not n in ans:
        ans.add(n)
ans = sorted(list(ans))
ans = [str(a) for a in ans]
for a in ans:
    print(a)

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

void b_chocolate(void) {
	int n, d, x;
	int* a;
	cin >> n >> d >> x;
	a = (int*)calloc(n, sizeof(int));
	if (a == NULL) {
		return;
	}

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

	int sum = 0;
	for (int i = 0; i < n; i++) {
		int day = 0;
		int ofs = 0;
		while (true) {
			day = (ofs)*a[i] + 1;
			if (day > d)break;
			sum++;
			ofs++;
		}
	}

	cout << sum + x << endl;
}

int main()
{
	b_chocolate();
    return 0;
}

Measured memory_bytes: 3616
import collections

s=list(input())
N=len(s)

if s.count(s[0])==len(s):
    print(0)
    exit()

s_set=set(s)


if len(s_set)==N:
    print((N+1)//2)
    exit()

ans=N
for r in s_set:
    mx=1
    c=0

    for i in range(N):
        if s[i]!=r :
            c+=1
        else:
            mx=max(c,mx)
            c=0
    mx=max(c,mx)
    ans=min(ans,mx)
print(ans)

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

using namespace std;
using ll = long long;


int main()
{
	int n , x; cin >> n >> x;
	vector<int> a(n); for(int i = 0; i < n; i++)cin >> a[i]; sort(a.begin(), a.end());

	ll sum = accumulate(a.begin(), a.end(), 0LL);
	if(sum == x) {
		cout << n << endl;
		return 0;
	}else if(sum < x) {
		cout << n - 1 << endl;
		return 0;
	}

	int cnt = 0;
	for(auto i : a) {
		if(i <= x) {
			cnt++;
			x -= i;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
import math

eps = 10 ** -8

line = input()
x1, y1, x2, y2 = list(map(int, line.split()))
line = input()
q = int(line)
pts = []
for _ in range(0, q):
    line = input()
    x, y = list(map(int, line.split()))
    pts += [[x, y]]

def solve():
    l1 = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
    for x, y in pts:
        l2 = math.sqrt((x - x1)**2 + (y - y1)**2)
        dx = (x2 - x1) / l1
        dy = (y2 - y1) / l1
        ip = (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1)
        sine = (x - x1) * (y2 - y1) - (y - y1) * (x2 - x1)
        if sine < 0.0:
            print("COUNTER_CLOCKWISE")
        elif sine > 0.0:
            print("CLOCKWISE")
        elif abs(ip - l1 * l2) < eps:
            if l1 < l2:
                print("ONLINE_FRONT")
            else:
                print("ON_SEGMENT")
        elif ip + l1 * l2 < eps:
            print("ONLINE_BACK")
solve()



Measured memory_bytes: 5984
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()

bool isReverse;

int main(){
  isReverse = false;
  string S;
  int Q;
  cin>>S>>Q;
  deque<char> T;
  for(int i=0; i<S.size(); i++){
    T.push_back(S[i]);
  }

  for(int k=0; k<Q; k++){
    int t;cin>>t;
    if(t==1){
      if(isReverse)isReverse = false;
      else isReverse = true;
    }else if(t==2){
      int f;
      char c;
      cin>>f>>c;
      if(isReverse){
        if(f==1)f=2;
        else f=1;
      }
      if(f==1){
        T.push_front(c);
      }else if(f==2){
        T.push_back(c);
      }
    }
  }
  if(isReverse){
    for(auto itr=T.rbegin(); itr<T.rend(); itr++){
      cout<<*itr;
    }
    cout<<endl;
  }else{
    for(auto itr=T.begin(); itr<T.end(); itr++){
      cout<<*itr;
    }
    cout<<endl;
  }
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}


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

/**
 * 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 N = in.nextInt();
			out.println(800 * N - N / 15 * 200);
		}
	}

	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 char nextChar() {
			return next().charAt(0);
		}

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

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

	}
}


Measured memory_bytes: 22100
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T& v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll h,w,d; in(h), in(w), in(d);
  int n=h*w;
  vector<int> X(h*w+1),Y(h*w+1);
  loop(y,1,h+1) loop(x,1,w+1) {
    int a; in(a);
    X[a] = x;
    Y[a] = y;
  }
  ll q;in(q);
  vector<ll> dp(n+1, 0);
  for (int i=n; i>=1; i--) {
    if (i+d > n) continue;
    dp[i] = dp[i+d] + abs(X[i] - X[i+d]) + abs(Y[i] - Y[i+d]);
  }
  
  loop(i,0,q) {
    ll l, r; in(l),in(r);
    print(dp[l]-dp[r]);
  }
  return 0;
}


Measured memory_bytes: 4556
using static System.Console;

namespace AtCorder
{
	public class Program
	{
		public static void Main()
		{
			var n = int.Parse(ReadLine());
			var max = n;
			if(max%2 == 0)
			{
				max--;
			}

			int answer = 0;
			for(int i = 1; i<=n; i+=2)
			{
				int count = 0;
				for(int j = 1; j<=n; j++)
				{
					if(i % j == 0)
					{
						count++;
					}
				}
				if(count == 8)
				{
					answer++;
				}
			}
			WriteLine(answer);
		}
	}
}


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

#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define rep(i, n) for (lli i = 0;i < (lli)(n);i++)
#define rep2(i, s, n) for (lli i = s; i < (lli)(n);i++)

lli dp[200000][2];

lli nCr(lli n, lli r)
{
       if(n<r) return 0;
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r];
       return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main() {
  lli ans=0;
  lli N;
  cin >>N;
  vector<lli> cumsum(N);
  rep (i, N)
  {
    cin >> cumsum[i];
    
    if(i==0){
    continue;}
  cumsum[i] += cumsum[i-1];
  }
  sort(ALL(cumsum));
  
  if(N==1&&cumsum[0]==0){
    cout<<1<<endl;
    return 0;
  }
  lli judge=1000000001;
  lli keep =1;
  
  rep2(i, 1 , N)
  {
    if(cumsum[i]==cumsum[i-1]){
      keep++;
      
      if(i==N-1)
      {
      if(cumsum[i]==0)
      {
      ans+=nCr(keep,2)+keep;
      }
        else
          ans+=nCr(keep,2);
      }
    }
    else {
            if(cumsum[i-1]==0)
      {
      ans+=nCr(keep,2)+keep;
              keep=1;
      }
        else{
          ans+=nCr(keep,2);
          keep=1;
        }
      }
    //cout << keep <<endl;
    }
cout << ans << endl;
}



Measured memory_bytes: 14336
#include <iostream>
using namespace std;
int main() { 
  int x;  while(1) {  
    cin >> x;  
    if(x==0) break;  
    for(int i=0; i<9; i++) {  
      int a;  
      cin >> a;  
      x-=a; 
    } 
    cout << x << endl;
  } 
  return 0;
}


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

using namespace std;

typedef long long LL;

const int N = 100010;

int n, res, h;
int a[N];

int main()
{
    cin >> n >> h;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++)
        if(a[i] >= h)
            res++;
    cout << res << endl;
    return 0;
}


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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

int n;
int c[510],s[510],f[510];

int main(){
  scanf("%d",&n);
  REP(i,n-1){
    scanf("%d %d %d",&c[i],&s[i],&f[i]);
  }
  REP(i,n-1){
    int t=s[i]+c[i];
    FOR(j,i+1,n-1){
      if(t<s[j]) t = s[j];
      else if(t % f[j]) t += f[j] - t % f[j];
      t += c[j];
    }
    printf("%d\n",t);
  }
  printf("0\n");
}


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

int main(){
	int A,B,C,D,E;
	cin >>A >>B >>C >>D;
	E = A+B-C-D;
	if(E>0)
		cout << "Left" << endl;
	else if(E==0)
		cout << "Balanced" << endl;
	else
		cout << "Right" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;const int N=131072+10;typedef long long ll;
int siz[N];int ans[N];int n;int a;int b;
inline void cons(int a,int b,int msk,int* op,int len)
{
	if(len==2){op[0]=a,op[1]=b;return;}int nxl=len>>1;
	int lb=a^b;lb=lb&(-lb);msk^=lb;
	int c=msk&(-msk);c=c&(-c);c^=a&msk;
	cons(a&msk,c,msk,op,nxl);cons(c,b&msk,msk,op+nxl,nxl);
	for(int i=0;i<nxl;i++)op[i]|=a&lb;
	for(int i=0;i<nxl;i++)op[i+nxl]|=b&lb;
}
int main()
{
	for(int i=1;i<N;i++)siz[i]=siz[i>>1]+(i&1);
	scanf("%d%d%d",&n,&a,&b);
	if((siz[a]&1)==(siz[b]&1)){printf("NO\n");return 0;}
	printf("YES\n");cons(a,b,(1<<n)-1,ans,1<<n);
	for(int i=0;i<(1<<n);i++)printf("%d ",ans[i]);printf("\n");return 0;
}

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

int main(){
	int m,n,a;
  	cin >>m >>n;
  	vector<int> vec(m);
  	for (int i=0 ;i<2*n; i++){
    cin >> a;
    for (int j=0 ;j<m; j++ ){
    if (a == j+1) vec.at(j)++;}
    }
  for (int j=0; j<m; j++)
  cout << vec.at(j) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int maxn = 1e2 + 5;
using namespace std;

int a[30];
char b[maxn];
bool flag;

int main(){
	scanf("%s", b + 1);
	int len = strlen(b + 1);
	for(int i = 1; i <= len; i++){
		a[b[i] - 'a' + 1]++;
	}
	for(int i = 1 ; i <= 26; i++){
		if(a[i] % 2) flag = 1; 
	}
	if(flag) printf("No\n");
	else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256