akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

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


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

int main() {
	int d, n;
	cin >> d >> n;
	int ans = 1;
	while (d > 0) {
		ans *= 100;
		d--;
	}
  if(n==100) n++;
	ans *= n;
	cout << ans << endl;
}


Measured memory_bytes: 256
n = gets.to_i
list = []
(0...n).each { |n|
  op = gets.split(' ')
  case op[0]
  when /^insert$/; list.unshift op[1].to_i
  when /^delete$/
    idx = list.find_index(op[1].to_i)
    list.delete_at(idx) if idx != nil
  when /^deleteFirst$/; list.shift
  when /^deleteLast$/; list.pop
  else puts "Error : not match"
  end
}
puts list.join(' ')

Measured memory_bytes: 23348
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> A(N);
    map<ll,ll> B;
    for(auto& in:A){
        cin >> in;
        B[in]++;
    }
    ll res = 0;
    ll T = 0, Y = 0;
    for(auto it = B.rbegin();it != B.rend();it++){
        if(T == 0){
            if(it->second >= 4){
                T = it->first;
                Y = it->first;
                break;
            }
            else if(it->second >=2){
                T = it->first;
            }
        }else{
            if(it->second >=2){
                Y = it->first;
                break;
            }
        }
    }
    res = T*Y;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 7296
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut even = 0;
    let mut four = 0;
    for _ in 0..n {
        let x: usize = read();
        if x % 2 != 0 {
            continue;
        } else if x % 4 != 0 {
            even += 1;
        } else {
            four += 1;
        }
    }
    if n / 2 > four + even / 2 {
        println!("No");
    } else {
        println!("Yes");
    }
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	while(cin>>n>>m,n,m){
		int num[101]={},ans=0;
		for(int i=0,x,y;i<n;i++){
			cin>>x;
			for(;x>0;x--){
				cin>>y;
				num[y]++;
			}
		}
		m--;
		for(int i=1;i<101;i++){
			if(num[i]>m){
				ans=i;
				m=num[i];
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1160
n,x=map(int,input().split())
a,p=[1],[1]
for i in range(n):
	a.append(a[i]*2+3)
	p.append(p[i]*2+1)
def f(n,x):
	if n==0:
		if x<=0:
			return 0
		else:
			return 1
	elif x<=1+a[n-1]:
		return f(n-1,x-1)
	else:
		return p[n-1]+1+f(n-1,x-2-a[n-1])
print(f(n,x))

Measured memory_bytes: 3064
import java.util.stream.*;
class Main {
  public static void main(String[] args) {
    IntStream.rangeClosed(1, 9)
      .forEach(i -> {
        IntStream.rangeClosed(1, 9)
          .forEach(j -> {
            System.out.println(i + "x" + j + "=" + (i * j));
          });
      });
  }
}

Measured memory_bytes: 30316
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    if(k == 1){
        cout << 0 << endl;
    }else{
        cout << (n - k) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var r = p[0];
		var g = p[1];
		var b = p[2];
		var n = p[3];
		long k = 0;
		for(int i = 0; i < (n/r+1); i++)
		{
			for(int j = 0; j < (n/g+1); j++)
			{
				int cnt = i * r + j * g;
				
				if((n-cnt) >= 0 && (n-cnt) % b == 0)
					k++;
			}
		}
		Console.WriteLine(k);
	}
	
	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 int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

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)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=200005,M=400005,oo=1e9;
struct edge{
	int di,nextt,ed;
}e[M];
int son[N],nedge,cur[N],deep[N];
inline void aedge(int a,int b,int c){
	e[++nedge].nextt=son[a];
	son[a]=nedge;
	e[nedge].ed=b;
	e[nedge].di=c;
}
inline void ins(int a,int b,int c){
	aedge(a,b,c); aedge(b,a,0);
}
inline bool bfs(int s,int t){
	for(int i=0;i<N;i++)deep[i]=oo;
    for(int i=0;i<N;i++)cur[i]=son[i];
    deep[s]=0;
    queue<int> q;
    q.push(s);
    while(!q.empty()){
        int now=q.front();q.pop();
        for(int tmp=son[now];tmp;tmp=e[tmp].nextt)
            if(deep[e[tmp].ed]>=oo&&e[tmp].di){deep[e[tmp].ed]=deep[now]+1,q.push(e[tmp].ed);}
    }
    return deep[t]<oo;
}
int dfs(int now,int t,int limit){
    if(!limit||now==t) return limit;
    int flow=0,f;
    for(int tmp=cur[now];tmp;tmp=e[tmp].nextt){
        cur[now]=tmp;
        if(deep[e[tmp].ed]==deep[now]+1&&(f=dfs(e[tmp].ed,t,min(limit,e[tmp].di)))){
            flow+=f; limit-=f; e[tmp].di-=f; e[((tmp-1)^1)+1].di+=f; if(!limit)break;
        }
    }
    return flow;
}
int dinic(int s,int t){
    int ans=0;
    while(bfs(s,t))ans+=dfs(s,t,oo);
    return ans;
}
const int NN=100005;
int n,p[NN],q[NN];
struct dsu{
	int fa[NN];
	void init(){
		For(i,1,n)fa[i]=i;
	}
	inline int gf(int x){return fa[x]==x?x:fa[x]=gf(fa[x]);}
	void mer(int x,int y){
		x=gf(x); y=gf(y); fa[x]=y;
	}
}P,Q;
int main(){
	n=read();
	P.init(); Q.init();
	For(i,1,n){p[i]=read()+1; P.mer(i,p[i]);}
	For(i,1,n){q[i]=read()+1; Q.mer(i,q[i]);}
	int s=2*n+1,t=s+1,ans=n;
	For(i,1,n)if(p[i]==q[i]){
		if(p[i]!=i){
			ins(P.gf(i),Q.gf(i)+n,1);
			ins(Q.gf(i)+n,P.gf(i),1);
		}else ans--;
	}else {
		if(p[i]==i){
			ins(s,Q.gf(i)+n,1);
		}else if(q[i]==i){
			ins(P.gf(i),t,1);
		}else{
			ins(P.gf(i),Q.gf(i)+n,1);
		}
	}
	// cout<<ans<<" "<<p[1]<<" "<<q[1]<<endl;
	cout<<ans-dinic(s,t)<<endl;
}
/*
5
4 1 3 2 0 
2 4 1 3 0 
*/

Measured memory_bytes: 13568
from math import *

a, b, h, m = list(map(int, input().split()))

theta_h = 2 * pi * ((h*60 + m) /(12*60))
theta_m = 2 * pi * (m/60)

theta = abs(theta_h-theta_m)

c_sq = a**2 + b**2 - 2*a*b*cos(theta) 
c = sqrt(c_sq)

print(c)

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class ATwoIntegers {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    ll x, y;
	    in >> x >> y;
	    if(x % y == 0) out << -1 << endl;
	    else out << x << endl;
	}
};


int main() {
	ATwoIntegers 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;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector<long long> vll;
typedef vector<pair<int,int> > vii;
#define ll long long
#define pb push_back
#define mp  make_pair
#define ff first
#define ss second
#define pq priority_queue
#define sf(x) scanf("%d",&x)
int inf = (1e9) + 7;



int main(){
	int n;
	cin >> n;
	int cnt = 0;
	int even = 0;
	int odd = 0;
	int aux;
	for (int i = 0; i < n; ++i)
	{
		sf(aux);
		if(!(aux%4))
			cnt++;
		else if(aux%2)odd++;
		else even++;
	}
	int f = 0;
	if(even == 0 and cnt >= odd-1)
		f = 1;
	else if(cnt >= odd)
		f = 1;

	if(f)
		printf("Yes\n");
	else
		printf("No\n");
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int H, A; cin >> H >> A;
  int result = (H+A-1)/A;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int n, k, x, ans;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int> > >pq;
map<int, int>mp;
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    while(n--){
        cin >> x;
        mp[x]++;
    }
    for(auto i : mp){
        pq.push({i.second,i.first});
    }
    while(pq.size() > k){
        ans += pq.top().first;
        pq.pop();
    }
    cout << ans;
    return 0;
}


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

typedef long long ll;
using namespace std;


int main(){
    ll p, k, d;
    cin >> p >> k >> d;
    ll abs_p = abs(p);

    if(abs_p / d >= k){
        cout << abs_p - k * d << endl;
        return 0;
    }

    ll new_p = abs_p - (abs_p / d) * d;
    ll new_k = k - abs_p / d;
    if(new_p <= abs(new_p - d)){
        if(new_k % 2 == 0){
            cout << new_p << endl;
        } else {
            cout << abs(new_p - d) << endl;
        }
    } else {
        if((new_k - 1) % 2 == 0){
            cout << abs(new_p - d) << endl;
        } else {
            cout << new_p << endl;
        }
    }
}

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

int main(){
	int n;
	cin >> n;
	vector<int> b;
	int p = 1;
	rep(i,n) {
		int a;
		cin >> a;
		if (p == 1) b.push_back(a);
		else b.insert(b.begin(), a);
		p *= -1;
	}

	if ( p == 1) rep(i, n) cout << b[i] << endl;
	else rep(i, n) cout << b[n-1-i] << endl;

return 0;
}

Measured memory_bytes: 4316
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
int N,x;
ll a[110];
cin>>N>>x;
REP(i,N) cin>>a[i];
sort(a,a+N);
ll sum=0;
ll cnt=0;
REP(i,N){
    sum+=a[i];
    cnt++;
    if(sum==x){
        break;
    }
    if(sum>x) {
        cnt--;
        break; 
    }
}
if(cnt==N && sum<x){
    cout<<cnt-1<<endl;
}
else{
cout<<cnt<<endl;
}

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	input := scanner.Text()
	inputList := strings.Split(input, " ")
	n, _ := strconv.Atoi(inputList[0])
	scanner.Scan()
	s := scanner.Text()

	half := n / 2
	if n%2 == 0 {
		if reflect.DeepEqual(s[:half], s[half:]) {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		fmt.Println("No")
	}
}


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

int main(){
    int n,m,x,a[200];
    cin>>n>>m>>x;
    
    int left = 0,right = 0;
    for(int i = 0;i < m;i++){
        cin>>a[i];
        if(a[i] < x) left++;
        else right++;
    }
    cout << min(left,right) << endl;
    return 0;
}

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

public class Main
{
    static class Reader {
		BufferedReader br;
		StringTokenizer st;
 
		public Reader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
 
	}
    static class Ele implements Comparable<Ele> 
    {  
        public int x,y;  
        Ele(int x,int y) 
        {  
            this.x=x;this.y=y; 
        }  
        public int compareTo(Ele ob) {  
        if(ob.x!=x)return x-ob.x;
        return this.y-ob.y;  
        }   
    }
    int a[][];int b[][];
    
    long gcd(long a,long b)
    {
        long min=Math.min(a,b);
        long max=Math.max(a,b);
        while (max%min!=0)
        {
            a=max%min;
            max=min;min=a;
        }
        return min;
    }
	public static void main(String[] args) throws IOException 
	{
		Reader sc=new Reader();//Solution G=new Solution();
		PrintWriter o = new PrintWriter(System.out);
		int t=1;
		//int t=sc.nextInt();
		
		int n,m,y0,x0,y1,x1,x2,y2,s0,s2;int a[],b[],in[],in1[];
		long k,l;boolean b1[],b2;String s1[],ss,s;
		//long l;long a[]; 
		ArrayList<ArrayList<Integer>> ll=new ArrayList<>();
		ArrayList<Integer> a1=new ArrayList<>();
		ArrayList<Integer> a2=new ArrayList<>();
		ArrayList<Integer> a3=new ArrayList<>();
		ArrayDeque<Integer> deq=new ArrayDeque<>();
		TreeSet<Integer> h0=new TreeSet<>();
		TreeSet<Integer> h1=new TreeSet<>();
		HashMap<Integer,Integer> h=new HashMap<>();
		try{
		while (t-->0)
		{
		    k=sc.nextLong();l=sc.nextLong()*sc.nextLong();
		    if(k>l)o.println("No");
		    else o.println("Yes");
		    //o.println();
		    //o.println(s);
		    //o.println();
		    //o.println();
		    //o.println(h);
		    //o.println(x2);
		    //o.println();
		    h0.clear();ll.clear();a1.clear();a2.clear();h1.clear();
		}
		}
		catch (Throwable e)
		{
		    e.printStackTrace();
		}
		//o.println("HI");
		
        o.flush();
        o.close();
	}
} 

Measured memory_bytes: 32932
#include<iostream>
#include<vector>
#include <cstdlib>
#include <numeric>
#include <cmath>

using namespace std;

int main(){
  long long int a, b, r, x, tmp;
 

  cin>>a>>b;
  x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
  /* 最小公倍数を出力 */
  cout<<x/b;

  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int x;
  cin >> x;
  ll ans = 3;
  rep (i, x) {
    ans *= 2;
    ans += 1;
  }
  ans -= 1;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

import sys
import math
from collections import Counter
import itertools
import fractions
#import numpy as np
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
a,b=MI()
print(a*b)

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

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int cnta[26]={0};
	int cntb[26]={0};
	for(int i =0;i<s.size();i++)
	{
		cnta[s[i]-'a']++;
		cntb[t[i]-'a']++;
	}
	for(int i=0;i<s.size();i++)
	{
		if(cnta[s[i]-'a']!=cntb[t[i]-'a'])
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

int main(){
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  
  if (s == u) cout << a - 1 << " " << b;
  else cout << a << " " << b - 1;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n, i = 1, x;
  scanf("%d", &n);

  while(i <= n){
    x = i;
    if(x%3 == 0)
      printf(" %d", i);
    else{
      while(x){
        if(x%10 == 3){
          printf(" %d", i);
          break;
        }
        x /= 10;
      }
    }
    i++;
  }
  
  printf("\n");
  return 0;
}



Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
int n,t[102],m,p[104],x[103],ans,ans2;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){cin>>t[i];ans+=t[i];}
	cin>>m;
	for(int i=0;i<m;i++)cin>>p[i]>>x[i];
	for(int i=0;i<m;i++){int y=p[i]-1;ans2=ans+x[i]-t[y];cout<<ans2<<endl;}
	
	
}

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

typedef long long LL;
#define rep(i ,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define all(v) (v).begin(),(v).end()

typedef vector<int> vi;


int main(){
	int n;
	while (cin >> n){
		if (n == 0) break;
		vi score;
		int s;
		rep(i, n){
			cin >> s;
			score.push_back(s);
		}
		sort(all(score));
		int ans = 0;
		for (int i = 1; i < n - 1; i++){
			ans += score[i];
		}
		cout << ans / (n - 2) << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;

int sum1[50][100010],sum2[100010];

int main(void){
    int n,C;
    cin>>n>>C;
    for(int i=0;i<n;i++){
        int s,t,c;
        cin>>s>>t>>c;
        c--;
        sum1[c][s]++;
        sum1[c][t+1]--;
    }
    for(int i=0;i<C;i++){
        for(int j=1;j<=100000;j++){
            sum1[i][j]+=sum1[i][j-1];
        }
    }
    for(int i=0;i<C;i++){
        for(int j=0;j<=100000;j++)sum1[i][j]=min(sum1[i][j],1);
    }
    for(int i=0;i<C;i++){
        for(int j=0;j<=100000;j++){
            sum2[j]+=sum1[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<=100000;i++)ans=max(ans,sum2[i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N,K;cin>>N>>K;
    vector<ll> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    
    ll left=0,right=1LL<<60;
    
    while(right-left>1){
        ll mid=(left+right)/2;
        ll sum=0;
        for(int i=0;i<N;i++){
            sum+=(A[i]+mid-1)/mid-1;
            if(sum>K) break;
        }
        if(sum>K) left=mid;
        else right=mid;
    }
    
    cout<<right<<endl;
}


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

int main()
{
    int n,q;
    cin>>n;
    vector<int>a(n);
    REP(i,n)cin>>a[i];
    cin>>q;
    REP(i,q)
    {
        int k;
        cin>>k;
        if(binary_search(a.begin(),a.end(),k)) cout<<1<<endl;
        else cout<<0<<endl;
    }
}



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

struct data{
  int a,b,c;
};

int main(){
  int d,n;
  while(cin >> d >> n){
    int t[200],dp[200][200],ans=0;
    data v[200];
    for(int i=0;i<d;i++) cin >> t[i];
    for(int i=0;i<n;i++) cin >> v[i].a >> v[i].b >> v[i].c;

    fill(dp[0],dp[200],0);
    for(int i=1;i<d;i++){
      for(int j=0;j<n;j++){
        if(v[j].a > t[i-1] || v[j].b < t[i-1]) continue;
        for(int k=0;k<n;k++){
          if(v[k].a > t[i] || v[k].b < t[i]) continue;
          dp[i][k] = max(dp[i][k], dp[i-1][j] + abs(v[j].c-v[k].c));
        }
      }
    }
    for(int i=0;i<n;i++) ans = max(ans,dp[d-1][i]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1320
while 1:
 a=b=0;n=int(input())
 if n==0:break
 for i in[0]*n:
  s,t=map(int,input().split())
  if s>t:a+=s+t
  elif s<t:b+=s+t
  else:a+=s;b+=t
 print(a,b)


Measured memory_bytes: 5728
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,m;
    cin>>n>>m;
    ll ans=1900*m+100*(n-m);
    cout<<ans*(ll)pow(2,m)<<endl;
    return 0;
}

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

int main(){
  int A,B,C,X,cnt=0;cin>>A>>B>>C>>X;
  for(int i=0;i<=A;i++){
    for(int j=0;j<=B;j++){
      for(int k=0;k<=C;k++){
        if(i*500+j*100+k*50==X){
          cnt++;
        }
      }
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
DBG = !true
n,k = gets.split.map{|x| x.to_i}
h = []
for i in 0...n
  h << gets.to_i
end

mindist = 1000000001
h.sort!
print h if DBG
for i in 0..(n-k)
  d = h[i+k-1] - h[i]
  mindist = d if d < mindist
end
print mindist


Measured memory_bytes: 4016
n, t = map(int, raw_input().split())
a = map(int, raw_input().split())
min_a = a[0]
max_a = a[0]
max_diff = []
for i in range(1, len(a)):
  if a[i] >= max_a:
    max_a = a[i]
    max_diff.append(max_a-min_a)
  elif a[i] <= min_a:
    min_a = a[i]
    max_a = a[i]

max_d = max(max_diff)
print(len([d for d in max_diff if d == max_d]))


Measured memory_bytes: 12112
package main

import "fmt"

func main() {
	var a, b, sum, prv int
	fmt.Scan(&a, &b)
	for i := 1; i <= 999; i++ {
		prv = sum
		sum += i
		if sum-prv == b-a {
			break
		}
	}
	fmt.Println(prv - a)
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long N;
	//cin >> N;

	string s;
	cin >> s;

	//int A[5]
	//sort(A, A + 5);
	N = s.length();

	if (s[N - 1] == 's')
	{
		cout << s << "es" << endl;
	}
	else
	{
		cout << s << "s" << endl;
	}

}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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


int N;
const int MAX_N = 100005;
int dp[MAX_N][3];
int a[MAX_N][3];

void solve() {
    cin >> N;
    rep(i, N)rep(j, 3) cin >> a[i][j];

    memset(dp, 0, sizeof(dp));

    rep(i, N){
        rep(j, 3){
            dp[i+1][j] = max(dp[i][(j+1)%3], dp[i][(j+2)%3]) + a[i][j];
        }
    }

    int res=0;
    rep(i, 3) res = max(res, dp[N][i]);

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 6656
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include<type_traits>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;
constexpr long long LONGINF = 1005000000000000000;



/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/



/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/



int main() {
	int n; cin >> n;
	string s;
	map<string, ll> mp;

	ll ans = 0;

	for (int i = 0; i < n; i++) {
		cin >> s;
		sort(s.begin(), s.end());
		mp[s] += 1;
		if (mp[s] > 1) {
			ans += mp[s] - 1;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11136
a,b,c,d = map(int, input().split())

MOD = 998244353

dp = [[0]*3005 for i in range(3005)]
dp[c][d] = 1
for i in range(d,0,-1):
    dp[c][i-1] = dp[c][i]*c%MOD
for i in range(c-1,-1,-1):
    x = 0
    for j in range(d,-1,-1):
        dp[i][j] = (j*dp[i+1][j]+x) % MOD
        x += dp[i+1][j]
        x *= i
        x %= MOD


print(dp[a][b])




Measured memory_bytes: 136876
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int sLen = s.length();
		char[] ca = s.toCharArray();

		ArrayList<Character> a = new ArrayList<>();

		for (char c : ca) {
			if (!a.contains(c))
				a.add(c);
		}

		if (a.size() == sLen) {
			System.out.println("yes");
		} else {
			System.out.println("no");
		}
	}

}


Measured memory_bytes: 22484
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    N, M = map(int, input().split())

    mid1 = set()
    mid2 = set()
    for _ in range(M):
        a, b = map(int, input().split())
        if a == 1:
            mid1.add(b)
        elif b == N:
            mid2.add(a)

    result = bool(mid1 & mid2)
    print("POSSIBLE" if result else "IMPOSSIBLE")

if __name__ == "__main__": main()


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

using namespace std;

int main(){
	
	int n,m;
	cin >> n >> m;
	
	int v[n], sum = 0;
	
	for(int i=0; i<n; i++) cin >> v[i];
	
	for(int i=0; i<n; i++) sum+=v[i];
	
	int d = ceil(sum/(4.0*m));
	
	bool flag = true;
	
	sort(v, v+n);
	reverse(v, v+n);

	for(int i=0; i<m; i++){
		if(v[i] < d){flag = false; break;}
	}
	
	if(flag) cout << "Yes" << endl; 
	else cout << "No" << endl; 
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define plint pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ll r;
    cin >> r;
    cout << setprecision(15) << 2*M_PI*r << endl;
    return 0;
}


Measured memory_bytes: 3784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class D
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		var S = GetString();

		long nx = 0;
		long nxy = 0;
		for(int i = 0; i < N - 2; i++)
		{
			for(int j = i + 1; j < N - 1; j++)
			{
				int k = 2 * j - i;
				if(k >= N)
					break;

				nx++;
				if(S[i] == S[j] || S[i] == S[k] || S[j] == S[k])
					nxy++;
			}
		}

		long F = N * (N - 1) * (N - 2) / 6;

		long r = S.Count(x => x == 'R');
		long g = S.Count(x => x == 'G');
		long b = S.Count(x => x == 'B');
		long ny = F - r * g * b;
		WriteLine(F - nx - ny + nxy);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

int main(){
    double a, b, x; cin >> a >> b >> x;
    double y;
    double ans;

    if((2*x) >= (a*a*b)){
        y = (a*a*a)/(2*(a*a*b-x));
        ans = atan(y);
        cout << fixed << setprecision(10) << (((M_PI/2)-ans)*180)/3.14159265359 << endl;
    }

    else{
        y = (a*b*b)/(2*x);
        ans = atan(y);
        cout << fixed << setprecision(10) << (ans*180)/3.14159265359 << endl;
    }
  
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

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

template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'

const int MXN = 1e5 + 5;
//const ll MOD = 998244353;
const ll MOD = 1000000007;
//const ll INF = 1000000007;


int n;
double x[10005], y[10005], dist;

double cdist(double x1, double y1, double x2, double y2){
	double d2 = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
	return d2;
}


int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	//ifstream cin("/Users/konwoo/input.txt");
	//ofstream cout("/Users/konwoo/output.txt");

	cin >> n;
	double xsm = 0, ysm = 0;
	F0R(i,n){
		cin >> x[i] >> y[i];
		xsm += x[i], ysm += y[i];
	}
	xsm /= n, ysm /= n;
	double cx = xsm, cy = ysm, p = 0.1;
	F0R(j, 50000){
		double md = 0.0;
		F0R(i,n) md = max(md, cdist(cx, cy, x[i], y[i]));
		double mx = 0.0, my = 0.0;
		F0R(i,n){
			if (cdist(cx, cy, x[i], y[i]) == md){
				mx = x[i];
				my = y[i];
			}
		}
		cx += (mx - cx) *p;
		cy += (my - cy) * p;
		p *= 0.999;
	}
	double mxdist = 0.0;
	F0R(i,n) mxdist = max(mxdist, cdist(cx, cy, x[i], y[i]));
	cout << setprecision(12) << sqrt(mxdist) << newl;
	






















	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define int long long 
const int N=2e5+5;
int h;
vector<int>v;
unordered_map <int, int> mp;
int dp(int h){
	if(h==1){
		return 1;
	}
	if(mp[h]){
		return mp[h];
	}
	else{
		mp[h]= 1+2*dp(h/2);
		return mp[h];
	}
}
int32_t main(){
	IOS;
	
	//code

	cin>>h;
	int ans=dp(h);
	cout<<ans<<endl;
	//code
	
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+20;
//题意:n块box排成一个环(n<=1e5),box有若干个stone(ai<=1e9),操作op:从第i个box开始,j=1~n,在(i+j)个box中拿j个石头,使用操作时box的石头必须>=拿走的石头
//问能否存在有限个操作使得所有box的石头变为0
//先看必要条件:每次操作使得总的stone减少n(n+1)/2,stone的总数必须为n(n+1)/2的倍数
//假设有解:操作次数k=n(n+1)/2,设di=a(i+1)-a(i) 每次操作会使得di减小1 i为开头->di增大n-1,k次操作后di为0
//则 di-(k-x)+(n-1)x=0 x为di做特殊操作的次数  化简得 k-di=nx 即k-di>=0&&为n的倍数 算出每个i的x即能求出操作序列..
//segma(xi)=segma((k-di)/n)必须=k 因为sum of di=0 所有总是segma(xi)总是为k. 

ll a[N],d[N]; 
int main()
{
	ll n;
	while(cin>>n)
	{
		ll sum=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%I64d",&a[i]);
			sum+=a[i];	
		}
		for(int i=1;i<=n;i++)
		{
			if(i==n)
			d[i]=a[1]-a[n];
			else
			d[i]=a[i+1]-a[i];
		}
		bool flag=true;
		ll t=n*(n+1)/2;
		ll k=sum/t;
		if(sum%t)
		{
			puts("NO");
			continue;
		}
		for(int i=1;i<=n;i++)
		{
			if((k-d[i]<0)||(k-d[i])%n)
			flag=false;
		}
		if(flag)
		puts("YES");
		else
		puts("NO");
	}
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bitset>
#include <ctime>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 1e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int a[maxN], b[maxN];

int main(){
	time_t START = clock();
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, cnt = 0; scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", a + i);
		b[i] = a[i];
	}
	sort(b, b + n);
	for (int i = 0; i < n; i++){
		a[i] = lower_bound(b, b + n, a[i]) - b;
		cnt += (i % 2 ^ a[i] % 2);
	}
	printf("%d\n", cnt / 2);
	time_t FINISH = clock();
	cerr << "Execution time: " << (ld)(FINISH - START) / CLOCKS_PER_SEC * 1000.0 << " milliseconds.\n";
	return 0;
}
 



Measured memory_bytes: 1024
<?php
  	fscanf(STDIN, "%d %d", $n, $l);
	$apples = array();
	$minAbs = $l + $n - 1;
	for ($i=1;$i<=$n;$i++) {
    	$apples[$i] = $l + $i - 1; 
      	if (abs($apples[$i]) < $minAbs) {
          	$minAbs = abs($apples[$i]);	
        }
    }
	echo array_sum($apples) - $minAbs;

Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main()
{
    int n,x,t,ans;
	cin>>n>>x>>t;
	if(n%x==0)
	   ans=t*(n/x);
	else
	   ans=t*(n/x+1);
	cout<<ans<<"\n";	
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    string S; cin >> S;
    unordered_set<char> steps_odd = {'R', 'U', 'D'};
    unordered_set<char> steps_even = {'L', 'U', 'D'};
    range(i, 0, S.size()) {
        char c = S.at(i);
        if ((i + 1) % 2) {
            if (steps_odd.count(c) == 0) {
            cout << "No" << "\n";
            return 0;
            }
        }
        else {
            if (steps_even.count(c) == 0) {
                cout << "No" << "\n";
                return 0;
            }
        }
    }
    cout << "Yes" << "\n";
    return 0;
}

Measured memory_bytes: 256