akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int cnt = 0;
  vector<char> s(4);

  for (int i = 0; i < 3; i++) {
    cin >> s.at(i);
  }

  for (int i = 0; i < 3; i++) {
    if (s.at(i) == 'a') {
      cnt++;
      break;
    }
  }
  for (int i = 0; i < 3; i++) {
    if (s.at(i) == 'b') {
      cnt++;
      break;
    }
  }
  for (int i = 0; i < 3; i++) {
    if (s.at(i) == 'c') {
      cnt++;
      break;
    }
  }

  if (cnt == 3) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 256
import Data.Array (Array, listArray, bounds, accum, elems)
import System.IO (isEOF)

type Point = (Int,Int)
type Paper = Array Point Int

main = main' initPaper
    where
    main' paper = do
        quit <- isEOF
        if quit then do
            print (length $ filter (==0) $ elems paper)
            print (maximum $ elems paper)
        else do
            line <- getLine
            let
                [x,y,inkSize] = map read $ split ',' line
            main' (dropInk paper (x,y) inkSize)

split :: Char -> String -> [String]
split ch s = case rest of
    "" -> [word]
    _:rest' -> word : split ch rest'
    where
    (word,rest) = break (==ch) s

(<+>) :: Point -> (Int,Int) -> Point
(x,y) <+> (dx,dy) = (x+dx,y+dy)

initPaper :: Paper
initPaper = listArray ((0,0),(9,9)) [0,0..]

inBounds :: Paper -> Point -> Bool
inBounds paper (x,y) = x>=minX && x<=maxX && y>=minY && y<=maxY
    where
    ((minX,minY),(maxX,maxY)) = bounds paper

dropInk :: Paper -> Point -> Int -> Paper
dropInk paper point inkSize = accum (+) paper (zip inkPoints [1,1..])
    where
    inkPoints = filter (inBounds paper) $ map (point <+>) inkShifts
    inkShifts = case inkSize of
        1 -> [(0,0),(1,0),(-1,0),(0,1),(0,-1)] 
        2 -> [(0,0),(1,0),(-1,0),(0,1),(0,-1),(1,1),(1,-1),(-1,1),(-1,-1)]
        3 -> [(0,0),(1,0),(-1,0),(0,1),(0,-1),(1,1),(1,-1),(-1,1),(-1,-1),
                (2,0),(-2,0),(0,2),(0,-2)]

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

int main()
{
	int s, i=1;
	bool flag = false;
	vector<int>a;
	cin>>s;
	a.push_back(s);
	while(1)
	{
		if(s%2==0)s=s/2;
		else s=3*s+1;
		for(int j = 0;j<i;++j){
			if(s==a[j]){
				flag=true;
				break;
			}
		}
		i++;
		if(flag)break;
		else a.push_back(s);
	}
	cout << i << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=1005;
int n,m,mp[maxn][maxn],f[maxn][maxn],df[maxn][maxn];
char s[maxn];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

inline void gmin(int &a,int b){ if(a > b) a=b; return ; }

inline void gmax(int &a,int b){ if(a < b) a=b; return ; }

int main(){
	#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	#endif
	n=rd(); m=rd();
	go(i,n+1,1){
		scanf("%s",s+1);
		go(j,m+1,1) mp[i][j]=(s[j] == '#');
	}
	int ans=-1;
	
	memset(f,0x3f,sizeof(f));
	go(i,n+1,1)
		go(j,m+1,1){
			if(i-1) gmin(f[i][j],f[i-1][j]+1);
			if(j-1) gmin(f[i][j],f[i][j-1]+1);
			if(mp[i][j] == 1) f[i][j]=0;
		}
	
	for(rg int i=n;i>=1;i--)
		go(j,m+1,1){
			if(i+1 <= n) gmin(f[i][j],f[i+1][j]+1);
			if(j-1) gmin(f[i][j],f[i][j-1]+1);
			if(mp[i][j] == 1) f[i][j]=0;
		}
	
	go(i,n+1,1)
		for(rg int j=m;j>=1;j--){
			if(i-1) gmin(f[i][j],f[i-1][j]+1);
			if(j+1 <= m) gmin(f[i][j],f[i][j+1]+1);
			if(mp[i][j] == 1) f[i][j]=0;
		}

	for(rg int i=n;i>=1;i--)
		for(rg int j=m;j>=1;j--){
			if(i+1 <= n) gmin(f[i][j],f[i+1][j]+1);
			if(j+1 <= m) gmin(f[i][j],f[i][j+1]+1);
			if(mp[i][j] == 1) f[i][j]=0;
		}
	
	go(i,n+1,1)
		go(j,m+1,1) gmax(ans,f[i][j]);
	
	printf("%d",ans);
	return 0;
}//Faze


Measured memory_bytes: 9984
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    string goodOdds = "RUD";
    string goodEvens = "LUD";
    bool isGood = true;
    for (int j = 0; j < s.length(); j++) {
        int i = j + 1;
        if (i % 2 == 0 && goodEvens.find(s[j]) == -1) {
            isGood = false;
        }
        if (i % 2 == 1 && goodOdds.find(s[j]) == -1) {
            isGood = false;
        }
    }
    if (isGood) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

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


def is_palindrome(s):
    # 回文判定
    length = len(s)
    for i in range((length + 1) // 2):
        if s[i] != s[length - 1 - i]:
            return False
    return True


cnt = 0
for i in range(a, b + 1):
    if is_palindrome(str(i)):
        cnt += 1
print(cnt)


Measured memory_bytes: 2940
from bisect import bisect_left
n = int(input())
listtop = sorted(list(map(int, input().split())))
listmiddle = sorted(list(map(int, input().split())))
listbottom = sorted(list(map(int, input().split())))
sum = 0

# 最初0があるので注意
# 0~N個目に乗せられるパーツの合計（累積和）
listmiddlesum = [0]
for i in range(n):
    # ride:n個目に乗せられるlisttopのパーツの数
    ride = bisect_left(listtop, listmiddle[i])
    listmiddlesum.append(listmiddlesum[i] + ride)
for i in range(n):
    ridesum = bisect_left(listmiddle, listbottom[i])
    sum += listmiddlesum[ridesum]
print(sum)

Measured memory_bytes: 110436
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N+2);
  A.at(0) = A.at(N+1) = 0;
  for(int i = 1; i <= N; i++){
    cin >> A.at(i);
  }
  int money = 0;
  for (int i = 1; i <= N+1; i++){
    money += abs(A.at(i) - A.at(i-1));
  }
  vector<int> ans(N);
  for (int i = 1; i <= N; i++){
    if((A.at(i-1) <= A.at(i) && A.at(i) <= A.at(i+1)) && (A.at(i-1) >= A.at(i) && A.at(i) >= A.at(i+1))){
      ans.at(i-1) = money;
    } else {
      ans.at(i-1) = money - abs(A.at(i)-A.at(i-1)) - abs(A.at(i)-A.at(i+1)) +abs(A.at(i+1)-A.at(i-1));
    }
  }
  for (int i = 0; i < N; i++){
    cout << ans.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>

int main(){
int a,b;

scanf("%d %d",&a,&b);
if(a < b){
	printf("a < b\n");
}else if(a > b){
	printf("a > b\n");
}else if(a == b){
	printf("a == b\n");
}
return 0;
}


Measured memory_bytes: 2088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var k = Console.ReadLine().ToInt();
		long a = (long)p[0];
		long b = (long)p[1];
		long c = (long)p[2];
		
		if(a >= b)
		{
			int i = 1;
			for(i = 0;  b <= a; i++)
			{
				b *= 2;
			}
			
			if(k - i < 0)
			{
				Console.WriteLine("No");
				return;
			}
			k -= i;
		}
		
		if(b >= c)
		{
			int i = 0;
			for(i = 0; c <= b; i++)
			{
				c *= 2;
			}
			
			if(k - i < 0)
			{
				Console.WriteLine("No");
				return;
			}
		}
		
		Console.WriteLine("Yes");
		
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  double n, k;
  cin >> n >> k;
  int ans = ceil((n - 1) / (k - 1));

  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple

// #define N 311111
#define A 1111111
#define BLOCK 555 // ~sqrt(N)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

const ll INF = 1e18 +5;
const int nax = 100005;
const long M = 1000000007;

ll dp[405][405];
// int in_degree[nax];
// vector<int> edges[nax];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	// cout<<fixed;
	// cout<<setprecision(10);
	int t;
	// cin>>t;
	t = 1;
	while(t--){
		int n;
		cin>>n;
		ll arr[n];
		ll pre[n+1];
		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		pre[0] = arr[0];
		for(int i=1;i<n;i++){
			pre[i] = pre[i-1] + arr[i];
		}
		// for(int i=0;i<n;i++){
		// 	cout<<pre[i]<<" ";
		// }
		for(int i=0;i<=n;i++){
			for(int j=i;j<=n;j++){
				dp[i][j]= INF;
			}
			// cout<<endl;
		}
		// cout<<endl;
		for(int L=n-1;L>=0;L--){
			for(int R = 0; R<=n-1;R++){
				for(int K=0;K<n-1;K++){
					if(L==R){
						dp[L][R] = arr[L];
						// cout<<L<<" "<<K<<" "<<R<<" "<<dp[L][K]<<" "<<dp[K+1][R]<<" "<<dp[L][R]<<endl;
					}
					else if(R-L==1){
						dp[L][R] = arr[L] + arr[R] ;
						// cout<<L<<" "<<K<<" "<<R<<" "<<dp[L][K]<<" "<<dp[K+1][R]<<" "<<dp[L][R]<<endl;
					}
					else if(L==K){
						ll tmp = pre[R];
						if(L>0){
							tmp -= pre[L-1];
						}
						// cout<<tmp<<endl;
						dp[L][R] = min(dp[L][R], tmp + dp[K+1][R]);						
					}
					else if(K+1==R){
						ll tmp = pre[R];
						if(L>0){
							tmp -= pre[L-1];
						}
						// cout<<tmp<<endl;
						dp[L][R] = min(dp[L][R], tmp + dp[L][K]);
					}
					else if(L<K && K<R){
						ll tmp = pre[R];
						if(L>0){
							tmp -= pre[L-1];
						}
						// cout<<tmp<<endl;
						dp[L][R] = min(dp[L][R], tmp + dp[L][K] + dp[K+1][R]);
						// cout<<L<<" "<<K<<" "<<R<<" "<<dp[L][K]<<" "<<dp[K+1][R]<<" "<<dp[L][R]<<endl;
					}
				}
			}
		}
		// for(int i=0;i<n;i++){
		// 	for(int j=0;j<n;j++){
		// 		cout<<dp[i][j]<<" ";
		// 	}
		// 	cout<<endl;
		// }
		cout<<dp[0][n-1]<<endl;
	}
}

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

int mDist(pair<int, int> p1, pair<int, int> p2) {
	return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}

int main() {
	int h,w,d; cin>>h>>w>>d;
	vector<vector<int>> a(h,vector<int>(w));
	vector<pair<int,int>> numToCoord(h*w + 2);
	vector<int> dist(h*w+1);

	for (int i=0; i<h; i++) {
		for (int j=0; j<w; j++) {
			cin>>a[i][j];
			numToCoord[a[i][j]] = {i,j};
		}
	}

	for (int l=1+d; l<h*w+1; l++) {
		dist[l] = mDist(numToCoord[l], numToCoord[l-d]);
		dist[l] += dist[l-d];
	}

	int q; cin>>q;
	for (int i=0; i<q; i++) {
		int l, r; cin>>l>>r;
		cout << dist[r] - dist[l] << endl;
	}

	return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
  int a;
  char s[20];
  scanf("%d", &a);
  scanf("%s", s);

  if(a>=3200){
    cout << s << endl;
  }else{
    cout << "red" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
n, k, c = map(int,input().split())
s = list(input())

i, cnt = 0, 0
l = []
while cnt < k:
    if s[i] == 'o':
        l.append(i+1)
        cnt += 1
        i += c
    i += 1

i, cnt = n-1, 0
r = []
while cnt < k:
    if s[i] == 'o':
        r.append(i+1)
        cnt += 1
        i -= c
    i -= 1

r.sort()
for i in range(len(r)):
    if l[i] == r[i]:
        print(r[i])

Measured memory_bytes: 109476
N, M, C = map(int, input().split())
B_array = list(map(int, input().split()))
ans = 0
for _ in range(N):
	A_array = list(map(int, input().split()))
	sum = C
	for i in range(M):
		sum += B_array[i] * A_array[i]
	if sum > 0:
		ans += 1
print(ans)

Measured memory_bytes: 38384
N =gets.to_i

data = N.times.map{ gets.strip.split.map(&:to_i) }

=begin

仮の中心をi,jとして，i,jを動かして全部一致するかチェック
そもそも全部一致するってどういうことか実験
すべてのi,jでトップをheightとして
h = [height - (x - i).abs - (y - j) .abs,0].max #0と比較
が成り立つ

=end

(0..100).each {|i|
  (0..100).each{|j|
    k = data.index{|a,b,val| val != 0}
    height = data[k][2] + (data[k][0] - i).abs + (data[k][1] - j).abs
    if data.all? { |x,y,h|
      h == [height - (x - i).abs - (y - j).abs,0].max
    }
    puts "#{i}\s#{j}\s#{height}"
    exit 0
    end
  }
}

Measured memory_bytes: 3964
object Main extends App {
  var num = readInt
    var get = readLine
  var r = 0
  var b = 0
  for(i <- 0  to num-1) {
    if(get.charAt(i)=='R')
    r+=1
    else
    b+=1
  }
  if(r>b)
      println("Yes")
  else
  println("No")
    }

Measured memory_bytes: 27324
N = int(input())
out = ["AC","WA","TLE","RE"]
output = [0]*4

for _ in range(N):
    S = input()
    if S == out[0]:
        output[0] += 1
    elif S == out[1]:
        output[1] += 1
    elif S == out[2]:
        output[2] += 1
    else:
        output[3] += 1

for i in range(4):
    print(out[i],"x",output[i])

Measured memory_bytes: 69960
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    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 COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

///////////////////////////////////////////////////////////

int n, a[110000], ans;
queue<P> que;
signed main(){
  cin>>n;rep(i,n)cin>>a[i];
  sort(a, a+n);
    repd(i,1,n-1){
      if(a[i] >= 0){
        que.push(P(a[0], a[i]));
        a[0] -= a[i];
      }else{
        que.push(P(a[n-1], a[i]));
        a[n-1] -= a[i];
      }
    }
    que.push(P(a[n-1], a[0]));
    a[n-1] -= a[0];
    ans = a[n-1];
  cout << ans << endl;
  while(!que.empty()){
    cout << que.front().first << " " << que.front().second << endl;
    que.pop();
  }
}



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

using namespace std;

int main(){
    long long int n;

    cin>>n;
    vector<int >v;
    stack<long long int> h;
    stack<long long int>temp;
    int count =0;
    for(int i=0;i<n;i++){
        long long int in;
        cin>>in;
        if(h.empty()){
            h.push(in);
        }
        else{
            if(in<=h.top()){
                h.push(in);
                count =count +1;
            }
            else{
                v.push_back(count);
                count =0;
                h.push(in);
            }
        }
    }
    v.push_back(count);
    cout << *max_element(v.begin(),v.end())<<endl;
}
    



Measured memory_bytes: 1528
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

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

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    double sum = 0.0;
    rep(i, N){
        double a; cin >> a;
        sum += 1.0/a;
    }
    cout << fixed << setprecision(20) << 1.0/sum << endstr;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll inf = 10e17;
const ld eps = 10e-9;

ll solve(void);
ll gcd(ll x, ll y);

int main(void)
{
	while (solve())
	{
	}
	return 0;
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}

ll n;

ll solve(void)
{
	cin >> n;

	cout << (n-1) * n / 2 << endl;

	return 0;
}



Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        quit()
    count = 0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                total = i + j + k
                if total == x:
                    count += 1
    print(count)


Measured memory_bytes: 5592
N = int(input())

d  = []
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        ans = "same"
    else:
        ans = "different"
    d.append(ans)
flag = "No"
for i in range(N-2):
    if d[i] == "same" and d[i+1] == "same" and d[i+2] == "same":
        flag = "Yes"
print(flag)

Measured memory_bytes: 9128
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>
#include <queue>

typedef long long ll;

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int ans = -1;
    for(int i = 1; i <= 10000; i++){
        if(i * 8 / 100 == a && i * 10 / 100 == b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from sys import stdin
def main():
    readline=stdin.readline
    N,X,Y=map(int,readline().split())
    X-=1
    Y-=1
    k=[0]*N
    for a in range(N-1):
        for b in range(a+1,N):
            if a<=X and Y<=b:
                k[X-a+b-Y+1]+=1
            else:
                c=min(b-a,abs(X-a)+1+abs(Y-b))
                k[c]+=1

    for i in range(1,N):
        print(k[i])

if __name__=="__main__":
    main()

Measured memory_bytes: 45148
#include <iostream>
#include <string>
int main() {
    std::string n;
    std::cin >> n;
    int a = 0, b = 0;
    for (std::size_t i = 0; i < n.length(); ++i) {
        if (i == 0)
            a += n[i] - '1';
        else
            a += 9;
        b += n[i] - '0';
    }
    std::cout << std::max(a, b) << '\n';
}

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

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int L, R, d;
	cin >> L >> R >> d;
	int ans=0;
	for(int i=L; i<=R; i++){
		if(i%d==0) ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int MAX = 110000;
    bool isComposite[MAX];
    for (int i = 2; i < MAX; i++) {
        isComposite[i] = false;
    }

    for (int i = 2; i < MAX; i++) {
        if (!isComposite[i]) {
            if (i >= n) {
                cout << i;
                break;
            }
            for (int j = 2 * i; j < MAX; j += i) {
                isComposite[j] = true;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 384
// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)>
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"
#define ret return
#define F first
#define S second
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define all(v) (v).begin(),(v).end()

/*##################################################################################*/


/*bool prime[100000] ;
vector < int > pr;
void calculateprime()
{
    prime[0] = prime[1] = true;
    for(int i = 2 ; i <= 100000 ; i++)
    {
        if(prime[i] == false)
        {
            pr.pb(i);
            for(ll j = i*i ; j <= 100000 ; j += i )
            {
                prime[j] = true;
            }
        }
    }
}
*/


void customrun(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

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

ll powerwithmod(ll x, unsigned ll y, ll p)
{
    ll res = 1;

    x = x % p;

    if (x == 0) return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


bool comp(const pair < ll , ll >  &a, const pair < ll , ll > &b ){
    if(a.F == b.F) return a.S < b.S;
    return a.F > b.F;
}

void solve();

int main() {
    clock_t begin = clock();

    fast();
    customrun();
    ll t = 1;
    //cin>>t;
    //calculateprime();
    mfor(i,1,t+1,1)
    {
        //cout<<"Case #"<<i<<": \n";
        solve();
    }
    clock_t end = clock();
    double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
    //cout<<"\ntime spent is "<<time_spent;
    return 0;
}


void solve(){
    ll n , res = 1e18;
    in(n);

    for(ll i = 1 ; i*i <= n ; i++){
        if(n % i == 0){
            res = min(res,i+(n/i)-2);
        }
    }

    if(res > n){
        out(res-1);
    }
    else{
        out(res);
    }
}


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

int main(){
  //変数の宣言と初期化
  int N,K;
  //代入1
  cin >> N >> K;
  int d[K];
  int A[K][N];
  int People[N];
  int n = 0;
  for(int i = 0; i < N; i++){
    People[i] = 0;
  }
  //代入2
  for(int i = 0; i < K; i++){
    cin >> d[i];
	for(int j = 0; j < d[i]; j++){
      cin >> A[i][j];
    }
  }
  for(int i = 0; i < K; i++){
    for(int j = 0; j < d[i]; j++){
      for(int k = 0; k < N; k++){
      	if(A[i][j] == k+1){
          People[k]++;
      	}
      }
    }
  }
  for(int i = 0; i < N; i++){
    if(People[i] == 0){
      n++;
    }
  }
  cout << n << endl;
  
}

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

int main() {

    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n){
        cin >> s[i];
    }

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

    int mx = 0;
    for(auto v : mp){
        mx = max(mx, v.second);
    }

    for(auto v : mp){
        if(v.second == mx){
            cout << v.first << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 26752
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ii pair<int, int>
#define iill pair <ii, ll>
#define ill pair<int, ll>
#define MAXN 
#define EPS 1e-9
#define MAXLOG 
#define MOD 
#define prt(a) printf("%d\n", a)
#define prt2(a, b) printf("%d %d\n", a, b)
#define prt3(a, b, c) printf("%d %d %d\n", a, b, c)
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d %d", &a, &b)
#define sc3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define readArr(arr, n) for (int i=0; i<n; i++) scanf("%d", &arr[i]);
#define EPS 1e-9
#define ll long long
using namespace std;


int main() {
	map <string, ll> words;

	int n;
	cin >> n;

	string word;
	ll res = 0;

	for (int i=0; i<n; i++) {
		cin >> word;
		sort(word.begin(), word.end());
		res += words[word];
		words[word]++;
	}

	printf("%lld\n", res);
	return 0;
}





Measured memory_bytes: 11136
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))


n,m = inpl()
s = list(input())
t = list(input())
if n < m:
    n,m = m,n
    s,t = t,s
ggg = n*m//fractions.gcd(n,m)
tn = ggg//n
tm = ggg//m
i = 0
while i*tm < n and i*tn < m:
    if s[i*tm] != t[i*tn]:
        print(-1)
        break
    i += 1
else:
    print(ggg)





Measured memory_bytes: 76908
N = int(input())

t = [0] * (N + 1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            n = x * x + y * y + z * z + x * y + y * z + z * x
            if n > N:
                break
            t[n] += 1

print(*t[1:], sep='\n')


Measured memory_bytes: 9484
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int main (void) {
long long int A,B;
scanf("%lld %lld",&A,&B);
long long int min =1;
long long int max1 = 0;
if (A>B)  {min=B;
            max1=A;}
else if (A<B) {min=A;max1=B;}

long long int max =1;

for (long long int i=1;i<=min;i++){
    if ((A%i==0) && (B%i==0)) {max=i;}
}
printf("%lld",max1*min/max);

return EXIT_SUCCESS;
}


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

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int[] n = new int[3];
        for (int i = 0; i < 3; i++) {
            n[i] = sc.nextInt();
        }
        Arrays.sort(n);
        int cost = 0;
        for (int i = 1; i < 3; i++) {
            cost += n[i] - n[i - 1];
        }
        System.out.println(cost);
    }
}


Measured memory_bytes: 23124
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int a, b;
	cin >> a >> b;
	cout << (a - 1) + (b >= a) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DAlterAltar {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      string s; cin >> s;

      // WRWWRWRR
      // RRWWRWRW
      // RRRWRWWW
      // RRRRWWWW

      vector<int> rcnt(n+1);
      for(int i=0; i<n; i++) {
        rcnt[i+1] = rcnt[i];
        if (s[i] == 'R') {
          rcnt[i+1]++;
        }
      }

      int rsum = rcnt[n];
      cout << rsum - rcnt[rsum] << endl;
    }
};

signed main() {
  DAlterAltar solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int a[310][310];
int s[100100];
// C[i] := 数 i がどこにあるか(h,w)を記録する
pair<int,int> C[100100];

int main(){
  int H, W, D; cin >> H >> W >> D;
  rep(h,H) rep(w,W) {
    cin >> a[h][w];
    a[h][w]--;
    C[a[h][w]] = make_pair(h,w);
  }

  // s[i+k*D] - s[i] で 「i から始まる k 個の和」を求められるように定義した
  for(int i = 0; i+D < H*W; i++) {
    int h = C[i].first, w = C[i].second;
    int nh = C[i+D].first, nw = C[i+D].second;
    int dh = abs(h-nh);
    int dw = abs(w-nw);
    s[i+D] = s[i] + dh + dw;
  }

  // rep(i,H*W){
  //   if(i < H*W-1) printf("%d ", s[i]);
  //   else printf("%d\n", s[i]);
  // }

  int q; cin >> q;
  while(q--){
    int l, r; cin >> l >> r;
    l--; r--;
    cout << s[r]-s[l] << endl;
  }
}


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

using namespace std;

typedef long long llint;

int main() {
  llint n, k;
  cin >> n >> k;
  vector<llint> a(n), sum(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];

  llint x = 0;
  for (int i = 50; 0 <= i; i--) {
    llint y = x ^ (1LL << i);
    int cnt = 0;
    for (int l = 0; l <= n; l++) {
      for (int r = l + 1; r <= n; r++) {
        llint d = sum[r] - sum[l];
        if ((d & y) == y) cnt++;
      }
    }
    if (k <= cnt) x = y;
  }
  cout << x << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N],n,L;
int main(){
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<n;i++){
		if(a[i]+a[i+1]>=L){
			puts("Possible");
			for(int j=1;j<i;j++)printf("%d\n",j);
			for(int j=n-1;j>i;j--)printf("%d\n",j);
			printf("%d\n",i);
			return 0;
		}
	}
	puts("Impossible");
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n,m;cin>>n>>m;
    vector<pair<int ,int>>A(n);
    rep(i,n){
        cin>>A[i].first>>A[i].second;}
    
    sort(A.begin(),A.end());
    int sum=0;
    rep(i,n){
        if(m>A[i].second){
            m-=A[i].second;
            sum+=A[i].first*A[i].second;
        }
        else
        {sum+=A[i].first*m;
            cout<<sum;
            break;
        }
    }
}



Measured memory_bytes: 1792
#include<stdio.h>

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

	for (i=1;i<=b;i++) {
		if (a*i % b == c) {
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll mod = 1e9+7;
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int n;cin>>n;
        int ans=0;
        vector<int> v;
        vector<int> p(n);
        vector<int> q(n); 
        rep(i,n)v.pb(i+1);
        rep(i,n)cin>>p[i];
        rep(i,n)cin>>q[i];
        int a,b;
        int x=1;
        do{
            int f=0;
            rep(i,n){
                if(p[i]!=v[i]){
                    f=1;break;
                }
            }
            if(!f)a=x;
            f=0;
            rep(i,n){
                if(q[i]!=v[i]){
                    f=1;break;
                }
            }
            if(!f)b=x;
            x++;
        }
        while(next_permutation(all(v)));
        cout<<abs(a-b);
    }
    return 0;   
}

Measured memory_bytes: 256
s = gets.chomp
n = s.length
0.upto(n/2-1) do |i|
  if s[i] != s[n-1-i]
    puts "No"
    exit
  end
end

sub_s1 = s[0..(n-1)/2-1]
n1 = sub_s1.length
0.upto(n1-1) do |i|
  if sub_s1[i] != sub_s1[n1-1-i]
    puts "No"
    exit
  end
end

sub_s2 = s[(n+3)/2-1..-1]
n2 = sub_s2.length
0.upto(n2-1) do |i|
  if sub_s2[i] != sub_s2[n2-1-i]
    puts "No"
    exit
  end
end

puts "Yes"


Measured memory_bytes: 14292
INF=1000000000000000 # 1e15
MAX=50*50 # 2500

n,m,s=map(int,input().split())
u,v,a,b,c,d=[0]*m,[0]*m,[0]*m,[0]*m,[0]*n,[0]*n
for i in range(m):
  u[i],v[i],a[i],b[i]=map(int,input().split())
  u[i] -= 1
  v[i] -= 1
for i in range(n):
  c[i],d[i]=map(int,input().split())

dp=[[INF] * (MAX + 1) for _ in range(n)]
#dp[i][j]=k <=> 最短k分後に街iに所持銀貨j枚で行ける
dp[0][min(MAX, s)] = 0
updated = True
while updated:
  updated = False
  for i in range(n):
    for j in range(MAX + 1):
      dest = min(MAX, j + c[i])
      if dp[i][j] + d[i] < dp[i][dest]:
        updated = True
        dp[i][dest] = dp[i][j] + d[i]
  for i in range(m):
    for j in range(a[i], MAX+1):
      # u[i] -> v[i]
      if dp[u[i]][j] + b[i] < dp[v[i]][j - a[i]]:
        updated = True
        dp[v[i]][j - a[i]] = dp[u[i]][j] + b[i]
      # v[i] -> u[i]
      if dp[v[i]][j] + b[i] < dp[u[i]][j - a[i]]:
        updated = True
        dp[u[i]][j - a[i]] = dp[v[i]][j] + b[i]
for i in range(1, n):
  print(min(dp[i]))


Measured memory_bytes: 69812
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAX=300030;
int N,cnt[MAX],ans=MAX;
char S[MAX];
main(){
    scanf(" %d %s",&N,S);
    for(int i=1;i<=N;i++,cnt[i]=cnt[i-1]) if(S[i-1]=='W') cnt[i]++;
    for(int i=0;i<N;i++) ans=min(ans,cnt[i]+(N-i-1)-(cnt[N]-cnt[i+1]));
    printf("%d\n",ans);
}


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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll N, K;
VL A;

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

int main() {
    cin >> N >> K;
    int g = 0;
    ll M = 0;
    REP(i, N) {
        LCIN(A);
        g = gcd(g, A);
        M = max(M, A);
    }
    cout << ((K % g) || (K > M) ? "IMPOSSIBLE" : "POSSIBLE") << "\n";
}


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

int main() {
	int a, b;
	cin >> a >> b;
	
	int sum = a + b;
	int sub = a - b;
	int mul = a * b; 
	
	cout << max({sum, sub, mul}) << endl;
}

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

int main() {
    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int res =0;
    for (int a = 0; a <= A; ++a) {
        for (int b = 0; b <= B; ++b) {
           for (int c = 0; c <= C; ++c) {
                int total = 500*a + 100*b + 50*c; 
                if (total == X) ++res; 
           }
       }
   }
  cout << res << endl;
}



Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;


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

	string s;
	cin >> s;
	N = s.size();
	for (int i = 0; i < N; i++) {
		if (i & 1)M += s[i] == '0';
		else M += s[i] == '1';
	}
	for (int i = 0; i < N; i++) {
		if (i & 1)K += s[i] == '1';
		else K += s[i] == '0';
	}
	cout << min(M, K) << endl;
	return 0;
}

Measured memory_bytes: 512
n=int(input())
s,t=(map(str,input().split()))
ans=""
for i in range(n):
  ans+=s[i]         
  ans+=t[i]
print(ans)
'''
ans=[]
ans.append(s[i])
ans.append(t[i])
ANS="".join(ans)
print(ANS)
でもよい.　　"XXXXX".join(ans)→各リストの要素を
XXXXXを加えながら一つの文字列に圧縮する。
.join(ans)にすると各要素をただただ一つの文字列にできる！！！！！！
# ans=""　無要素文字列のときは+で文字列を足せる
# ans=[]  無要素リストのときは.append()でリストの要素を足せる！'''

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

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

    int ans = 1e9;
    rep (i, (int)s.size() - 2) {
        string tmp = "";
        tmp += s[i];
        tmp += s[i + 1];
        tmp += s[i + 2];
        ans = min(ans, abs(753 - stoi(tmp.c_str())));
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,m = map(int, input().split())
x = list(map(int, input().split()))

x.sort()
dis = [0] * (m)
for i in range(1, m):
    dis[i] = abs(x[i] - x[i - 1])
dis.sort()

ans = 0
for i in range(1, m - n + 1):
    ans += dis[i]
print(ans)


Measured memory_bytes: 20640
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
void solve()
{
	ll a[5];
	ll ans=0;
	for(ll i=0;i<5;++i)
	{
		cin>>a[i];
		if(a[i]==0)
		{
			ans=i+1;
			break;
		}
	}
	cout<<ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
        solve();
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl
#define pb push_back

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[2];
bool r,ra,rb,rc[200010];
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc,vd,ve,vaa,vbb;



int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        aa[a-1]=i+1;  
    }
    for(int i=0;i<n;i++){
        C aa[i]<<" ";
    }
    CE;

    //C b E;

}

Measured memory_bytes: 2816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}

			var N = inputArray[0];

			var positionArray = retreiveLongArray();
			var inputCount2 = N;

			// 不正な入力は処理しない
			if (positionArray.Length != inputCount2) {
				Console.WriteLine("invalid input");
				return;
			}

			//数学的に考えると、P = Sum(Xi)/N のとき体力最小になる(微分)
			var minPosition = positionArray.Sum()/(double)N;

			//minPositionの切り上げか切り下げが答えになる
			var avePositionDown = Math.Truncate(minPosition);
			var avePositionUp= Math.Ceiling(minPosition);


			//切りさげの時の距離を求める
			var TairyokuDown = positionArray.Select(a => Math.Pow(a - avePositionDown,2)).Sum();

			//切りあげの時の距離を求める
			var TairyokuUp = positionArray.Select(a => Math.Pow(a - avePositionUp,2)).Sum();

			//小さいほうが答えとなる


			var ans =(int) Math.Min(TairyokuDown, TairyokuUp);
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 13396
n,k = map(int,raw_input().split())

arr = map(int,raw_input().split())
if k > max(arr):
	print "IMPOSSIBLE"
	quit()

def gcd(a,b):
	if b == 0 :
		return a
	else :
		return gcd(b,a%b)

g = arr[0]

for i in range(1,n):
	g = gcd(g,arr[i])

if k%g == 0 :
	print "POSSIBLE"

else :
	print "IMPOSSIBLE"


Measured memory_bytes: 11296
#include<bits/stdc++.h>
#define int long long

using namespace std;

struct rest
{
    int no, score;
    string name;
};

bool cmp(rest a, rest b)
{
    if (a.name < b.name)
        return true;
    else if (a.name > b.name)
        return false;
    else
        if (a.score > b.score)
            return true;
        else
            return false;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    rest p[100];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i].name >> p[i].score, p[i].no = i + 1;
    sort(p, p + n, cmp);

    for (int i = 0; i < n; i++)
        cout << p[i].no << '\n';

    return 0;
}


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

unsigned int A[200000];

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

	long long ans = 0;
	int enpos = 0;
	unsigned long wk = 0;
	for (int stpos = 0; stpos < N; stpos++) {
		for (; enpos < N; enpos++) {
			if ((wk & A[enpos]) != 0) {
				// ここまで
				wk = wk & (~A[stpos]);
				break;
			} else {
				wk = wk | A[enpos];
			}
		}
		ans += (enpos - stpos);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define RI(x) x = rit()
#define RII(a,b) a = rit(), b = rit()
#define RIII(a,b,c) a = rit(), b = rit(), c = rit()
#define REP(I, N) for(int I=0;I<int(N);I++)
#define REPP(I, N) for(int I=1;I<=int(N);I++)
inline int rit(){
    int f=0,key=1;
    char ch;
    do{
        ch = getchar();
        if(ch=='-') key=-1;;
    }while(ch<'0'||ch>'9');
    do{
        f = f*10+ch-'0';
        ch = getchar();
    }while(ch>='0'&&ch<='9');
    return f*key;
}
using namespace std;
int main(void){
    string st;
    cin>>st;
    REP(i,19){
        if(st[i]==',') cout << " ";
        else           cout << st[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
n, x, y = map(int, input().split())
d = y - x - 1
result = [0] * (n - 1)
for i in range(n):
    for j in range(i + 1, n):
        if j <= (x - 1) and i >= (y - 1):
            result[(j - i) - 1] += 1
        else:
            result[min((j - i) - 1, abs(i - (x - 1)) + abs(j - (y - 1)))] += 1

for el in result:
    print(el)

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

int main() {
    int H, W;
    cin >> H >> W;
    string s[H];
    for(int i=0; i<H; i++) cin >> s[i];

    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            if(s[i][j]=='.') {
                //爆弾の数を数える
                int cnt=0;
                if(i!=0 && j!=0 && s[i-1][j-1]=='#') cnt++;
                if(i!=0 && j!=W-1 && s[i-1][j+1]=='#') cnt++;
                if(i!=H-1 && j!=0 && s[i+1][j-1]=='#') cnt++;
                if(i!=H-1 && j!=W-1 && s[i+1][j+1]=='#') cnt++;
                if(i!=0 && s[i-1][j]=='#') cnt++;
                if(j!=0 && s[i][j-1]=='#') cnt++;
                if(i!=H-1 && s[i+1][j]=='#') cnt++;
                if(j!=W-1 && s[i][j+1]=='#') cnt++;
                cout << cnt;
            } else {
                cout << '#';
            }
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256