akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 3005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll a, b;
  cin >> a >> b;

  ll g = __gcd(a, b);

  ll res = 0;
  for (ll i = 2; i * i <= g; i++) {
    if (g % i == 0) {
      res++;
      while (g % i == 0)
        g /= i;
    }
  }
  if (g >= 2)
    res++;

  cout << res + 1 << en;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

vector<bool> sieve(int x){//range...[0,x]
    vector<bool> flags(x+1,true);
    flags[0]=false,flags[1]=false;
    for(int i=2;i*i<=x;i++){
        if(!flags[i])continue;
        for(int mult = i*i;mult<x;mult+=i)flags[mult]=false;
    }
    return flags;
}

int main(){
    vector<bool> isPrime=sieve(300000);
    int n;
    while(cin >> n,n){
        int res = 0;
        for(int i=n+1;i<=2*n;i++){
            if(isPrime[i]==true)res++;
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int S,W;
    cin >>S>>W;
    if(W>=S){cout << "unsafe" << endl;}
    else{cout << "safe" << endl;}

    return 0;
}

Measured memory_bytes: 3660
///Coder ---->>>> Kael (Joan Marcos Rivera)
///Team ACM : CyberSpace ____ IPVCE FEDERICO ENGELS
///KingOfString
///Copyright

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;

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

#define pb push_back
#define mp make_pair
#define s second
#define f first
#define maxn 3010
#define mod 1000000007
#define less(n) order_of_key(n)
#define en_pos(n) find_by_order(n) /// --- >> iterador --- >> empieza en 0

ll dp[maxn][maxn],a[maxn],t[maxn];
ll suma(int a,int b){
    return (t[b]-t[a-1]);
}
main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;cin >> n;

    for(int i=1;i<=n;i++)
        cin >> a[i] , dp[i][i] = a[i]  , t[i] = t[i-1] + a[i];

    for(int p=2;p<=n;p++){
        for(int i=1;i<=n;i++){
            int j = i + p - 1;
            if(j > n)break;
            dp[i][j] = max(suma(i,j-1) + a[j] - dp[i][j-1] , suma(i+1,j) + a[i] - dp[i+1][j]);
        }
    }

    cout << (2*dp[1][n])-suma(1,n);
}
/*
5 5
5 1
5 4
4 3
5 2
3 2
10
3 4
2 2
5 4
5 3
3 5
5 1
5 3
3 4
2 3
3 4*/


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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  vector<int> v(3*n);
  for(int i = 0; i < 3*n; ++i) {
    cin >> v[i];
  }
  SORTR(v);
  int ans = 0;
  for(int i = 1; i < 2*n; i+=2) {
    ans += v[i];
  }
  cout << ans;

  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 2560
#include <assert.h>
#include <chrono>
#include <cstdio>
#include <iostream>
#include <limits.h>
#include <mutex>
#include <thread>
#include <vector>

long long evalmod(long long a, long long b){
  long long maxval = std::max(a, b);
  long long minval = std::min(a, b);
  if (minval==0){
    return maxval;
  }
  long long tmpval = maxval%minval;
  return evalmod(minval, tmpval);
}

int main(){
  int N;
  long long M;
  scanf("%d",&N);
  scanf("%lld",&M);
  std::vector<long long > a(N);
  for (int i=0; i<N; i++){
    scanf("%lld",&a[i]);
  }
  long long mod, mod_common = a[0];
  long long val = a[0];
  for (int i=0; i<N; i++){
    mod = evalmod(a[i],val);
    mod_common = evalmod(mod_common, a[i]);
    val = (val*a[i])/mod;
    if (val>2*M){
      printf("0\n");
      return 0;
    }
  }
  for (int i=0; i<N; i++){
    if ((a[i]/mod_common)%2==0){
      printf("0\n");
      return 0;
    }
  }
  long long ans = (M+val*0.5)/val;
  //std::cout<<eval
  //printf("%lld\n",mod);
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 1024
abx = list(map(int, input().split(' ')))
a, b, x = abx[0], abx[1], abx[2]
to_a = 0
to_b = 0

if b >= 0:
    to_b = (b // x) + 1
else:
    to_b = 0

if a - 1 >= 0:
    to_a = ((a - 1) // x) + 1
else:
    to_a = 0

res = to_b - to_a
print(res)

Measured memory_bytes: 3188
// はい
package main

import (
	"fmt"
	"strings"
)

func main() {
	var Sx, Sy, Tx, Ty int
	fmt.Scan(&Sx, &Sy, &Tx, &Ty)
	ans := ""
	ans += strings.Repeat("R", Tx-Sx) + strings.Repeat("U", Ty-Sy)
	ans += strings.Repeat("L", Tx-Sx) + strings.Repeat("D", Ty-Sy) + "D"
	ans += strings.Repeat("R", Tx-Sx+1) + strings.Repeat("U", Ty-Sy+1) + "LU"
	ans += strings.Repeat("L", Tx-Sx+1) + strings.Repeat("D", Ty-Sy+1) + "R"
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	int vis[6] = {0};
	long long ans = 1;
	int i, n;
	char s[100005][15];
	scanf("%d", &n);
	for(i = 1; i <= n ;i++)
	{
		scanf("%s", s[i]);
	}
	for(i = 1; i <= n ; i++)
	{
		if(s[i][0] == 'M')
		{
			vis[1]++;
		}
		if(s[i][0] == 'A')
		{
			vis[2]++;
		}
		if(s[i][0] == 'R')
		{
			vis[3]++;
		}
		if(s[i][0] == 'C')
		{
			vis[4]++;
		}
		if(s[i][0] == 'H')
		{
			vis[5]++;
		}
	}
	int count = 0;
	for(i = 1; i <= 5 ; i++)
	{
		if(vis[i] != 0)
		{
			count++;
		}
	}
	long long wori = 1;
	if(count < 3)
	{
		printf("0\n");
	}
	else
	{
		if(count == 3)
		{
			for(i = 1; i <= 5 ; i++)
			{
				if(vis[i] != 0)
				{
					ans = ans * vis[i];
				}
			}
		}
		if(count == 4 || count == 5)
		{
			ans = 0;
			wori = wori * vis[1] * vis[2] * vis[3];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[1] * vis[2] * vis[4];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[1] * vis[2] * vis[5];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[1] * vis[3] * vis[4];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[1] * vis[3] * vis[5];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[1] * vis[4] * vis[5];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[2] * vis[3] * vis[4];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[2] * vis[3] * vis[5];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[2] * vis[4] * vis[5];
			ans = ans + wori;
			wori = 1;
			wori = wori * vis[3] * vis[4] * vis[5];
			ans = ans + wori;
			wori = 1;
		}
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Rectangle rectangle = null;
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			rectangle = new Rectangle(a, b);
		}
		System.out.println(rectangle.getArea() + " " + rectangle.getEdgeLength());
	}

	static class Rectangle {
		private final int a;
		private final int b;

		Rectangle(int a, int b) {
			this.a = a;
			this.b = b;
		}

		/**
		 * ????????¢?????¢????????????
		 *
		 * @return ??¢???
		 */
		public int getArea() {
			return (a * b);
		}

		/**
		 * ????????¢?????¨?????????????????????
		 *
		 * @return ??¨????????????
		 */
		public int getEdgeLength() {
			return (a * 2 + b * 2);
		}

	}

}

Measured memory_bytes: 26132
n = int(input())
a = list(map(int, input().split()))
num_map = dict()
for i in range(n):
    if a[i] not in num_map:
        num_map[a[i]] = 1
    else:
        num_map[a[i]] += 1

res = 0
for key, value in num_map.items():
    if key <= value:
        res += value - key
    else:
        res += value

print(res)


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    int temp=h*60+m;
    long double pi=3.141592653589793238;
    long double angle1=temp/2.0;
    long double angle2=temp*6;
    long double angle=abs(angle1-angle2);
    angle=(pi/180.00)*angle;
    long double j=cos(angle);
    long double c=a*a+b*b-2*a*b*j;
    c=sqrt(c);
    cout<<setprecision(12)<<c<<"\n";

}


Measured memory_bytes: 4128
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>
#include <stdio.h>
#include <cstdio>
using namespace std;
int p[100001],s[100001],t[100001],cost[100001];
int root(int a) {
	if (p[a] == a) return a;
	return (p[a] = root(p[a]));
}
void unite(int a,int b){
	p[root(a)] = root(b);
}
bool same(int a ,int b){
	if (root(a) == root(b)) return 1;
	else return 0;
}
bool rcheck(int a){
	if (root(a) == a) return 1;
	else return 0;
}
pair <int,int> path[100001];
int main() {
	int n,coun = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		p[i] = i;
		for (int j = 0;j<n;j++) {
			s[n*i+j] = i; t[n*i+j]=j; 
			cin >> cost[n*i+j];
		}
	}
	for (int i = 0;i < n*n;i++) {
		path[i].first = cost[i];
		path[i].second = i;
	}
	sort(path,path+n*n);
	for (int i = 0; i < n*n;i++) {
		if (path[i].first >= 0) {
			if(same(s[path[i].second],t[path[i].second]) == 0) {
				unite(s[path[i].second],t[path[i].second]);
				coun += path[i].first;
			}
		}
	}
	cout << coun << endl;
}

Measured memory_bytes: 2068
def f(n,p):
    while n%2==0:
        n//=2
        p+=1
        return f(n,p)
    return p
n=int(input())
s=list(map(int,input().split()))
ans=0
for i in s:
    p=0
    ans+=f(i,p)
print(ans)    

Measured memory_bytes: 4148
// ALDS1_13_B.cpp
// Heuristic Search - 8 Puzzle

#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
const int N = 3;
const int N2 = 9;
vector<int> in(N2);
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
const char dir[4] = {'u', 'l', 'd', 'r'};
struct Puzzle
{
    int f[N2];
    int space;
    string path;

    bool operator < (const Puzzle &p) const {
        for (int i = 0; i < N2; i++) {
            if (f[i] == p.f[i]) continue;
            return f[i] > p.f[i];
        }
        return false;
    }
};

bool isTarget(Puzzle p)
{
    for (int i = 0; i < N2; i++) {
        if (p.f[i] != i + 1)
            return false;
    }
    return true;
}

string bfs(Puzzle p)
{
    map<Puzzle, bool> mp;
    queue<Puzzle> mq;
    Puzzle u, v;
    mp[p] = true;
    mq.push(p);
    while(!mq.empty()) {
        u = mq.front();
        mq.pop();
        if (isTarget(u)) return u.path;
        int sx = u.space / N;
        int sy = u.space % N;

        for (int r = 0; r < 4; r++) {
            int tx = sx + dx[r];
            int ty = sy + dy[r];
            if (tx < 0 || ty < 0 || tx >= N || ty >= N)
                continue;
            v = u;
            swap(v.f[tx * N + ty], v.f[sx * N + sy]);
            v.space = tx * N + ty;

            if (!mp[v]) {
                mp[v] = true;
                v.path += dir[r];
                mq.push(v);
            }
        }
    }
    return "unsolveable";
}

int main()
{
    Puzzle in;
    for (int i = 0; i < N2; i++) {
        cin >> in.f[i];
        if (in.f[i] == 0) {
            in.space = i;
            in.f[i] = N2;
        }
    }
    string ans = bfs(in);
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 30588
#include<stdio.h>
#include<string.h>
main(){

  char c[100000];
  int len,i,joi,ioi;

  while(scanf("%s",c) != EOF){
    len = strlen(c);
    joi=ioi=0;

    for(i=0;i<len-2;i++){

      if(c[i] == 'J' && c[i+1] == 'O' && c[i+2] == 'I'){
	joi++;
      }

      if(c[i] == 'I' && c[i+1] == 'O' && c[i+2] == 'I'){
	ioi++;
      }

    }

    printf("%d\n%d\n",joi,ioi);

  }

  return 0;
}

Measured memory_bytes: 556
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		if(a.matches("^((dreamer)|(eraser)|(dream)|(erase))+$")){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 37512
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-06-27 20:55:08 +0900
# LastModified: 2020-06-27 21:00:24 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    a = int(input())
    print(a+a**2+a**3)


if __name__ == "__main__":
    main()


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


cost = 0
for i in range(x,m+1):
  if i in al:
    cost += 1

cost2 = 0
for i in range(x,0,-1):
  if i in al:
    cost2 += 1
    
print(min(cost, cost2))


Measured memory_bytes: 9152
#include<iostream>
#include<cstring>
#include<cmath>
#include<climits>
#include<algorithm>

using namespace std;
#define lli long long int

int main()
{
    lli n,k,i,h[100005],dp[100005],mn,j;
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    h[0]=0;
    dp[0]=0;
    for(i=1;i<=n;i++)
    {
        if(i==1)
            dp[i]=0;
        else
        {
            mn=LLONG_MAX;
            for(j=1;j<=k && j<i;j++)
            {
                mn=min(mn,dp[i-j]+abs(h[i]-h[i-j]));
            }
            dp[i]=mn;
        }
    }
    // for(i=1;i<=n;i++)   cout<<dp[i]<<" ";
    // cout<<"\n";
    cout<<dp[n]<<"\n";
    return 0;
}

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

int const N=1e5+5, M=1e9+7, OO = 0x3f3f3f3f;

int n;
int arr[N];

int mem[N];
int solve(int i)
{
    if(i==n-1)
        return 0;
    if(mem[i]!=-1)
        return mem[i];
    int op1=solve(i+1)+abs(arr[i]-arr[i+1]);
    int op2=(i<=n-3) ? solve(i+2)+abs(arr[i]-arr[i+2]) : OO;
    return mem[i]=min(op1,op2);
}


int main()
{
//    freopen("input.txt","rt",stdin);
//    freopen("output.txt","wt",stdout);
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",arr+i);
    memset(mem, -1, sizeof mem);
    printf("%d\n",solve(0));

    return 0;
}


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

ll mod = 1000000007;


int main() {
ll n,m; cin >> n>>m;
if (abs(n-m)>=2) {
    cout << 0 << endl;
    return 0;
}
ll ans1=1,ans2=1;
for(int i =1;i<=n;++i){
        ans1 = ans1 *i;
        ans1%=mod;
    }
    for(int i =1;i<=m;++i){
        ans2 = ans2 *i;
        ans2%=mod;
    }
if(n==m){
   cout << (ans1*ans2*2)%mod << endl;
    }
else cout << ans1*ans2%mod << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;


int main(){
  int h, w;
  int n;
  cin >> h >> w >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int x = 0, y = 0;
  bool rev = false;
  vector<vector<int>> ans(h, vector<int>(w));
  rep(i, n){
    int cur = a[i];
    while(cur > 0){
      ans[x][y] = i + 1;
      cur--;
      if(rev){
        if(x - 1 < 0){
          y++;
          rev = !rev;
        } else {
          x--;
        }
      } else {
        if(x + 1 >= h){
          y++;
          rev = !rev;
        } else {
          x++;
        }
      }
    }
  }
  
  rep(i, h){
    rep(j, w){
      cout << ans[i][j] << ' ';
    }
    cout << endl;
  }
}


Measured memory_bytes: 384
_,*a = map(int, open(0).read().split())
a.sort()
m = -~a[-1]
c = [0]*m
for i in a:
    c[i] += 1
    if c[i] > 1:
        continue
    for j in range(i * 2, m, i):
        c[j] = 2
print(sum(c[i]==1for i in a))

Measured memory_bytes: 33344
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n,m,t[20000];

int main(){
	while(cin>>n>>m){
		if(!(n+m))return 0;
		for(int i=0;i<n+m;i++)cin>>t[i];
		sort(t,t+n+m);
		int dif=0;
		for(int i=0;i<n+m;i++){
			if(!i)dif=t[i];
			else dif=max(dif,t[i]-t[i-1]);
		}
		cout<<dif<<endl;
	}
}

Measured memory_bytes: 0
import sys

def wantA(m):

    ind = len(Pl)
    ret = 0

    for i in Mi:

        while ind > 0 and Pl[ind-1] * i > m:
            ind -= 1

        ret += ind

    return ret

def wantB(m):

    ans = 0
    ret = 0

    ind = len(Pl)

    for i in Pl:

        while ind > 0 and Pl[ind-1] * i > m:
            ind -= 1

        ret += ind

        if i ** 2 <= m:
            ret -= 1

    ans += ret // 2

    ret = 0

    ind = len(Mi)

    for i in Mi:

        while ind > 0 and Mi[ind-1] * i > m:
            ind -= 1

        ret += ind

        if i ** 2 <= m:
            ret -= 1

    ans += ret // 2

    return ans
   


N,K = map(int,input().split())

A = list(map(int,input().split()))

Mi = []
znum = 0
Pl = []

for i in A:

    if i < 0:
        Mi.append(-1 * i)
    elif i == 0:
        znum += 1
    else:
        Pl.append(i)

Mi.sort()
Pl.sort()

if len(Mi) * len(Pl) >= K:

    #小さい方からMi*Pl-K+1番目を求める
    K = len(Mi) * len(Pl) - K + 1

    l = Mi[0] * Pl[0] - 1
    r = Mi[-1] * Pl[-1]

    while r - l != 1:

        m = (r + l) // 2

        num = wantA(m)

        if num >= K:
            r = m
        else:
            l = m

    print (-1 * r)
    sys.exit()


K -= len(Mi) * len(Pl)

K -= znum * (len(Pl) + len(Mi) ) + znum * (znum-1) // 2

if K <= 0:
    print (0)
    sys.exit()



#小さい方からK番目を求める

l = 0
r = 10 ** 18 + 1

while r - l != 1:

    m = (r + l) // 2

    num = wantB(m)

    #print (m,num)

    if num >= K:
        r = m
    else:
        l = m

print (r)



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

lint a, b, k;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define fi first
#define se second
#define vec vector<ll>
#define mat vector<vector<ll> >
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
//gcd
ll gcd(ll a,ll b){
    if(min(a,b)==0)return max(a,b);
    if(max(a,b)%min(a,b)==0)return min(a,b);
    return gcd(min(a,b),max(a,b)%min(a,b));
}
signed main(){
    ll x;cin>>x;
    ll s=gcd(x,360);
    cout<<360/s<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
 
int FindNumber(int x){
    int sum = 0;
    int n = x;
    while(n > 0){
        sum += n % 10;
        n /= 10; 
    }

    return sum;
}

int main(){
    int num;
    int S;
    cin >> num;
    int N = num;

    S = FindNumber(N);
    if(num % S == 0) cout << "Yes";
    else cout << "No";

 return 0;
}

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

using namespace std;

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

int main() {
	int n;
	ll mod = 1e9 + 7;
	ll ans = 1;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		ans *= i;
		ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i=0; i<N; i++){
        cin >> S.at(i);
    }
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    int sz;
    sz = S.size();
    cout << sz << endl;
}

Measured memory_bytes: 9580
arr = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]
for _ in range(int(input())):
    a,b,c,d = map(int,input().split())
    arr[a-1][b-1][c-1] += d
for j1 in range(4):
    for j2 in range(3):
        u = arr[j1][j2]
        print("",u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9])
    if j1 == 3:
        break
    print("####################")



Measured memory_bytes: 5628
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	cout << static_cast<char>(s1[0] - ('a' - 'A')) << static_cast<char>(s2[0] - ('a' - 'A')) << static_cast<char>(s3[0] - ('a' - 'A'));

	return 0;
}


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

int main() {
  int N, M, L;
  cin >> N; 
  L = N;
  int sum = 0;
 
  
  while(L >=10){
    M = L % 10;
    sum += M;
    L = (L - M) / 10;
  }
  int fx = sum + L;
  if (N % fx == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
path = [[], [], [], []]
for i in range(3):
    a, b = list(map(int, input().split()))
    path[a-1].append(b-1)
    path[b-1].append(a-1)
    
re = 'YES'
for i in range(4):
    if len(path[i]) == 0 or len(path[i]) == 3:
        re = 'NO'
        break
        
print(re)

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

int main(){

    int n;
    cin>> n;

    int ans;

    for(int i=1;i<=9;i++){
        ans=111*i;
        if(ans>=n){
            cout << ans << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=1005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
ll a[MAXN][MAXN],prime[MAXN];
bool check(int x)
{
	for (int i=2;1ll*i*i<=x;i++)
		if (x%i==0) return 0;
	return 1;
}
ll gcd(ll x,ll y) { return y==0?x:gcd(y,x%y); }
int main()
{
	int n=read(),num=0;
	if (n==2) { printf("4 7\n23 10\n"); return 0; }
	for (int i=2;i<=100000;i++)
		if (check(i))
		{
			prime[++num]=i;
			if (num==n<<1) break;
		}
	for (int i=0;i<=n+1;i++)
		for (int j=0;j<=n+1;j++) a[i][j]=1;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
		{
			if ((i&1)^(j&1)) continue;
			a[i][j]=prime[(i+j)>>1]*prime[n+((i-j+n+1)>>1)];
		}
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			if ((i&1)^(j&1)) a[i][j]=max(a[i-1][j]*a[i+1][j],a[i][j-1]*a[i][j+1])+1;
	if ((n+1)&1)
	{
		a[n][1]=a[n-1][1]*a[n][2]/gcd(a[n-1][1],a[n][2])+1;
		a[1][n]=a[2][n]*a[1][n-1]/gcd(a[2][n],a[1][n-1])+1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=n;j++) printf("%lld ",a[i][j]);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 7168
a = list()
for i in range(3):
    a.append(list(map(int, input().split())))
cnt0=cnt1=0
for i in range(2):
    for j in range(2):
        if a[0][0]==a[i+1][j]:
            cnt0+=1
        if a[0][1]==a[i+1][j]:
            cnt1+=1
if cnt0>=2 or cnt1>=2:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

using namespace std;

#define PI			3.14159265
#define OO			1e9
#define SS       	second
#define FF       	first
#define Trace(n)  	cout<< #n <<" = "<< n << endl; 
#define ll			long long
#define endl		"\n"
#define EPS		    1e-9
//#define MOD         1e9 + 7	    
int dx[] = { 0, 0, -1, 1, 1, 1, -1, -1 };
int dy[] = { -1, 1, 0, 0, 1, -1, 1, -1 };

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

int main()
{
	fast();
	int n;
	cin >> n;
	int ans = 0;
	int d;
	for (int i = 1; i <= n; i++)
	{
		d = 1 + log10(i);
		if (d & 1)
			ans++;
	}
	cout << ans;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	static int w,h,n;
	static int sx,sy;
	static int l[6];
	static P path[6][42];
	scanf("%d%d%d",&w,&h,&n);
	scanf("%d%d",&sx,&sy);
	rep(i,n){
		scanf("%d",&l[i]);
		rep(j,l[i]){
			scanf("%d%d",&path[i][j].fr,&path[i][j].sc);
		}
	}
	
	static bool bomb[22][22];
	rep(i,22)rep(j,22)bomb[i][j] = true;
	rep1(i,w)rep1(j,h)bomb[i][j] = false;
	rep(i,n)bomb[path[i][l[i]-1].fr][path[i][l[i]-1].sc] = true;
	
	static int d[22][22][22][22];
	rep(i,22)rep(j,22)rep(k,22)rep(m,22){
		d[i][j][k][m] = INF;
		if(i == k && j == m)d[i][j][k][m] = 0;
	}
	//cout << "DEBUG" << endl;
	rep(x,22)rep(y,22){
		if(bomb[x][y])continue;
		bool used[22][22];
		queue<P> que;
		rep(i,22)rep(j,22)used[i][j] = false;
		que.push(P(x,y));
		while(!que.empty()){
			P p = que.front(); que.pop();
			if(!used[p.fr][p.sc]){
				rep(i,8){
					int nx = p.fr + dir_8[i][0];
					int ny = p.sc + dir_8[i][1];
					if(bomb[nx][ny])continue;
					if(d[x][y][nx][ny] > d[x][y][p.fr][p.sc] + 1){
						d[x][y][nx][ny] = d[x][y][p.fr][p.sc] + 1;
						que.push(P(nx,ny));
					}
				}
				used[p.fr][p.sc] = true;
			}
		}
	}
	/*cout << "DEBUG" << endl;
	rep1(i,w)rep1(j,h){
		if(bomb[i][j])continue;
		rep(k,8){
			int x = i+dir_8[k][0];
			int y = j+dir_8[k][1];
			if(!bomb[x][y]){
				d[i][j][x][y] = 1;
			}
		}
	}
	cout << "DEBUG" << endl;
	rep(k1,22){
		rep(k2,22)rep(i1,22)rep(i2,22)rep(j1,22)rep(j2,22){
			d[i1][i2][j1][j2] = min ( d[i1][i2][j1][j2] , d[i1][i2][k1][k2] + d[k1][k2][j1][j2] );
		}
		cout << k1 << endl;
	}*/
	//cout << "DEBUG" << endl;
	
	bool ver[6][42][1<<5];
	rep(i,6)rep(j,32)rep(k,(1<<5))ver[i][j][k] = false;
	rep(i,n)rep(j,l[i]-1){
		if(d[sx][sy][path[i][j].fr][path[i][j].sc] <= j)ver[i][j][1<<i] = true;
	}
	int L = 0; rep(i,n)L = max ( L , l[i] );
	rep(j,L)rep(i,n){
		if(j >= l[i]-1)continue;
		rep(s,(1<<5)){
			if(ver[i][j][s])ver[i][j+1][s] = true;
		}
		rep(k,n){
			int t = 0;
			while(t < l[k] && d[path[i][j].fr][path[i][j].sc][path[k][t].fr][path[k][t].sc] > t-j)t ++;
			if(t >= l[k])continue;
			rep(s,(1<<5)){
				if(ver[i][j][s])ver[k][t][s|(1<<k)] = true;
			}
		}
		if(ver[i][j][(1<<n)-1]){
			cout << j << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

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

int main() {
	int n;
	while ( cin >> n ) {
		vector< pair<int,int> > edges;
		
		if ( n&1 ) {
			for (int i = 1; i < n; ++i) edges.push_back( make_pair( i, n ) );
			n-- ;
			
			for (int i = 1; i <= n/2; ++i) {
				for (int j = i+1; j <= n/2; ++j) {
					edges.push_back( make_pair( i, j ) );
					edges.push_back( make_pair( i, n-j+1 ) );
					edges.push_back( make_pair( n-i+1, j ) );
					edges.push_back( make_pair( n-i+1, n-j+1 ) );
				}
			}
		}
		else {
			for (int i = 1; i <= n/2; ++i) {
				for (int j = i+1; j <= n/2; ++j) {
					edges.push_back( make_pair( i, j ) );
					edges.push_back( make_pair( i, n-j+1 ) );
					edges.push_back( make_pair( n-i+1, j ) );
					edges.push_back( make_pair( n-i+1, n-j+1 ) );
				}
			}
		}
		
		cout << edges.size() << '\n';
		
		for (auto x : edges) cout << x.first << ' ' << x.second << '\n';
		
//		int sum[ n+5 ]; memset( sum, 0, sizeof (sum) );
//		
//		for (auto x : edges) {
//			sum[x.first] += x.second;
//			sum[x.second] += x.first;
//		}
//		
//		cout << "::SUM::\n"; for (int i = 1; i <= n; ++i) cout << sum[i] << ' '; cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 384
#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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  int a[n];
  ll b[n]; rep(i, n) b[i] = 0;
  
  rep(i, n) {
    int x; cin >> x;
    a[i] = x;
    ++b[x-1];
  }

  ll sum = 0;
  rep(i, n) {
    sum += ((b[i]*(b[i]-1))/2);
  }
  
  rep(i, n) {
    ll x = (b[a[i]-1] * (b[a[i]-1] - 1)) / 2;
    ll di = ((b[a[i]-1] - 1) * (b[a[i]-1] - 2)) / 2;
    cout << (sum - (x - di)) << endl;
  }
}


Measured memory_bytes: 4992
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

vector<int> A;
map<int,int> S, ori;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int N, s, cnt=0;
	mt19937 mt(47693187249819LL);
	cin>>N;
	uniform_int_distribution<int> uid(0,N-1);
	A.resize(N);
	for(int i=0;i<N;i++) cin>>A[i], S[A[i]]++;
	S[A[s=uid(mt)]]--; ori=S;
	for(int i=1;i<N;i++) if(A[0] && A[i] && S.count(A[i]^A[s]) || ((A[s]==0 || A[i]==0) && S[A[s]^A[i]]>1)) {
		int p=A[i], c=A[i]^A[s];
		bool valid=true;
		S[p]--; S[c]--;
		if(++cnt>100) break;
		for(int j=3;j<N;j++) {
			tie(p,c)=make_pair(c,p^c);
			if(S[c]--==0) {
				valid=false;
				break;
			}
		}
		if(valid) {
			cout<<"Yes\n";
			return 0;
		}
		S=ori;
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 7808
import math
import itertools
#n = int(input())
#n, d = list(input().split())
#n, l = list(map(int, input().split()))
N = int(input())
#A = list(map(int, input().split()))
S = []
count = [0]*N
for i in range(N):
    S.append(input())

S.sort()

point = 0
for i in range(N-1):
    if S[i]==S[i+1]:
       point+=1
       if i==N-2:
           point+=1
           count[i]=point
    else:
        point+=1
        count[i]=point
        point = 0
        if i==N-2:
            count[i+1]=1

m = max(count)

#print("SSSSSSSSSSSSS")
for i in range(N):
    if m==count[i]:
        print(S[i])

#print(S)
#print(count)

    





Measured memory_bytes: 20440
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " "
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll H,W;
    cin >> H >> W;
    ll x,y;
    cin >> x >> y;
    if(x * 2 == H && y * 2 == W){
        cout << H / 2 * W << " " << "1\n";
    }
    else{
        if(H % 2 == 1 && W % 2 == 1){
            cout << H * W / 2 << ".5 0\n";
        }
        else{
            cout << H * W / 2 << " 0\n";
        }
    }
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b)
		puts("Zero");
	else if (0 < a || (a < 0 && (min(b, -1) - a + 1) % 2 == 0))
		puts("Positive");
	else 
		puts("Negative");
	return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, m, k) = (v[0] as usize, v[1] as usize, v[2]);
    let a = read_vec::<i64>();
    let b = read_vec::<i64>();

    let mut cur_weight = 0;
    let mut cur_count = 0;
    let mut books = VecDeque::new();

    for i in 0..n {
        if cur_weight + a[i] > k {
            break;
        }
        books.push_back(a[i]);
        cur_weight += a[i];
        cur_count += 1;
    }

    let mut cur_pointer = 0;
    for i in 0..m {
        if cur_weight + b[i] > k {
            break;
        }
        cur_weight += b[i];
        cur_count += 1;
        cur_pointer += 1;
    }
    let mut ans = cur_count;

    while let Some(x) = books.pop_back() {
        cur_weight -= x;
        cur_count -= 1;

        while cur_pointer < m && cur_weight + b[cur_pointer] <= k {
            cur_weight += b[cur_pointer];
            cur_pointer += 1;
            cur_count += 1;
        }
        ans = max(cur_count, ans);
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

public class Main {

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

		Scanner scan = new Scanner(System.in);

		int N_year;
		int A, B;

		N_year = scan.nextInt();

		if (N_year == 1) {
			System.out.println("Hello World");


		} else {

			A = scan.nextInt();

			B = scan.nextInt();

			System.out.println(A + B);

		}

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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

#define REP(i,n) for(long long i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(long long i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

vector<int> sosu(100005, 1), sum(100002, 0);
int Q;
vector<int> l, r;

void solve(int a, int b){
  cout << sum[b] - sum[a-1] << endl;
}

int main(){
  cin >> Q;
  l.resize(Q), r.resize(Q);
  REP(i, Q){
    cin >> l[i] >> r[i];
  }

  FOR(i, 2, 1e5+3){
    if(sosu[i] == 0){
      continue;
    }
    else{
      for(int j=2; i*j <=1e5+2; j++){
        // if(sosu[i*j]== 0){
        //   break;
        // }
        sosu[i*j]=0;
      }
    }
  }
  for(int i = 3; i < 1e5+2; i+=2){
    if(sosu[i] && sosu[(i+1)/2]){
      sum[i]++;
    }
    sum[i]+= sum[i-1];
    sum[i+1]=sum[i];
  }

  REP(i, Q){
    solve(l[i], r[i]);
  }
  return 0;
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   int gcd(int a,int b){return b?gcd(b,a%b):a;};

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


ll k, n;
vector<ll> factorize(ll n){
  //nの素因数の配列を返す
  vector<ll> P = {};
  ll i = 2;
  while (i * i <= n){
    if (n % i == 0){
      P.pb(i);
      n /= i;
    }
    else {i++;}
  }
  P.pb(n);
  return P;
}

int main(){
  cin >> k >> n;
  vector<ll> P = factorize(n);
  set<ll> S(P.begin(), P.end());
  ll ans = 1;
  for (auto i = S.begin(); i != S.end(); i++){
    ll cnt = upper_bound(P.begin(), P.end(), *i) - lower_bound(P.begin(), P.end(), *i);
    ans *= pow(*i, cnt / k);
  }
  cout << ans << endl;

}


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


int geshu(int n,int x)
{

    int y=n;
    int cnt=0;
    while(y<=x-1)
    {
        y=y*2;
        cnt++;
    }

    return cnt;
}
int main()
{
    double re=0;
    int n,k;
    scanf("%d%d",&n,&k);
    long long temp=0;
    long long fenmu=1;
    long long fenzi=1;
    for(int i=1;i<=n;i++)
    {
        int cnt=geshu(i,k);
       // printf("cnt=%d\n",cnt);
         temp=pow(2,cnt);
        if(fenmu==1)
            fenmu=temp;
        else if(fenmu%temp==0)
        {
            fenzi+=fenmu/temp;
        }
    }
   // printf("fenzi=%lld fenmu=%lld\n",fenzi,fenmu);
    double x=(double)fenzi/(fenmu*1.0);
    x=x/n;
     printf("%.9f\n",x);
    return 0;
}


Measured memory_bytes: 256
#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 double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  string a;
  cin>>a;
  vector<int> b(26,0);
  rep(i,a.size()){
  b[a[i]-97]++;
  }
  sort(all(b));
  reverse(all(b));
  if((a.size()-1)/3+1<b[0]){
    cout<<"NO"<<endl;
  }
  else
    cout<<"YES"<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int &x : a)
    scanf("%d", &x);
  int m = *max_element(a.begin(), a.end());
  int cnt = 0, m2 = 0;
  for (int x : a) {
    if (x == m) cnt++;
    else m2 = max(m2, x);
  }
  for (int x : a) {
    printf("%d\n", (cnt >= 2 || x != m) ? m : m2);
  }
  return 0;
}



Measured memory_bytes: 2432
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <set>
typedef long long int ll;
typedef double ld;
using namespace std;

class BCommonRaccoonVsMonster {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int h,t,s=0;
	    in>>h>>t;
	    for(int i=0;i<t;i++)
        {
	        int a;
	        in>>a;
	        s+=a;
        }

	    if(s>=h)
	        out<<"Yes"<<endl;
        else
            out<<"No"<<endl;

	}
};


int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    BCommonRaccoonVsMonster solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	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 MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

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

Measured memory_bytes: 3628
public class Main {

	public static void main(String[] args) {
		java.util.Scanner in = new java.util.Scanner(System.in);
		int n = in.nextInt(); //トッピングの種類数
		int mny1 = in.nextInt(); //生地の値段
		int mny2 = in.nextInt(); //トッピングの値段
		int kal = in.nextInt(); //生地のカロリー
		int[] top = new int[n];
		for (int i=0; i<n; i++) {
			top[i] = in.nextInt(); //トッピングのカロリー
		}
		java.util.Arrays.sort(top);
		int kalsum = kal; //カロリーの合計
		int cnt = 0;
		for (int i=n-1; i>=0; i--) {
			int sum1 = kalsum / (mny1+mny2*cnt); // 現在のカロリー/money
			int sum2 = (kalsum + top[i]) / (mny1+mny2*(cnt+1)); // 次のカロリー/money
			if (sum1 > sum2) break;
			kalsum += top[i];
			cnt++;
		}
		System.out.println(kalsum/(mny1+mny2*cnt));
	}
}

Measured memory_bytes: 18112
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N; cin >> N;
    vector<int> v(9, 0);

    for (int i=0; i<N; i++) {
        int a; cin >> a; if (a >= 3200) a = 3200;
        v[a/400]++;
    }

    int min = 0;
    for (int i=0; i<8; i++) min += (v[i] > 0) ? 1 : 0;
    int max = min + v[8];
    if (min == 0) min = 1;

    cout << min << " " << max << endl;

    return 0;
}

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

using namespace std;

typedef complex<double> P;
typedef vector<P> Polygon;

double cross(P a,P b){
  return (conj(a)*b).imag();
}

//line,line
P intersection(P a1,P a2,P b1,P b2){
  P a=a2-a1;
  P b=b2-b1;
  return a1+a*cross(b,b1-a1)/cross(b,a);
}

//a->b keep leftside points
Polygon cut(P a,P b,const Polygon &p){
  int n=p.size();
  vector<double> c(n);
  for(int i=0;i<n;i++){
    c[i]=cross(b-a,p[i]-a);
  }
  Polygon r;
  for(int i=0;i<n;i++){
    if(c[i]>=0){
      r.push_back(p[i]);
    }
    if(c[i]*c[(i+1)%n]<0){
      r.push_back(intersection(a,b,p[i],p[(i+1)%n]));
    }
  }
  return r;
}

double area(const Polygon &p){
  double a=0;
  for(int i=0;i<p.size();i++){
    a+=cross(p[(i+1)%p.size()],p[i]);
  }
  return fabs(a)/2;
}

int main(){
  for(int N,M;cin>>N>>M,N;){
    Polygon p;
    for(int i=0;i<N;i++){
      int x,y;
      cin>>x>>y;
      p.emplace_back(x,y);
    }
    vector<P> c;
    for(int i=0;i<M;i++){
      int x,y;
      cin>>x>>y;
      c.emplace_back(x,y);
    }
    for(int i=0;i<M;i++){
      Polygon cp=p;
      for(int j=0;j<M;j++){
	if(i==j)continue;
	P m=(c[i]+c[j])/2.;
	P d=(c[j]-c[i])*P(0,1)+m;
	cp=cut(m,d,cp);
      }
      cout.precision(9);
      cout<<fixed<<area(cp)<<endl;
    }
  }
}

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

vector<int> d;

int main(void){
    int N;
    cin >> N;
    d = vector<int>(N);
    for(int i=0;i<N;i++){
        cin >> d[i];
    }
    int ans = 0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384