akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define fo(i,n)         for(i=0; i<n; i++)
#define fo1(i,n)        for(i=1; i<=n; i++)
#define Fo(i,k,n)       for(i=k; k<=n?i<=n:i>=n; k<=n?i++:i--)
#define all(x)          x.begin(), x.end()
#define rall(x)         x.rbegin(), x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x, 0, sizeof(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr = new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x){cout<<x;}
void __print(float x){cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base, int exp){ int res = 1; base %= mod; while(exp > 0){ if(exp & 1) res = (res * base) % mod; base = (base * base) % mod; exp = exp >> 1; } return res; }
int inv(int x){ return power(x, mod - 2) % mod; }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N = 1e6 + 6, M = N;
int i, j;

void solve(){
    
    string s,t; cin>>s>>t;
    int c=0;
    int n=s.size();
    fo(i,n) if(s[i]!=t[i]) c++;
    cout<<c;
    
    
    
}




int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3840
import Control.Monad
import Data.List

main :: IO ()
main = do
  [n, t] <- map read . words <$> getLine
  ct <- replicateM n ((\[a, b] -> (a, b)) . map (read :: String -> Int) . words <$> getLine)
  let xs = sort $ filter (\(_, b) -> b <= t) ct
  putStrLn $ if length xs <= 0 then "TLE" else show . fst . head $ xs







Measured memory_bytes: 1020
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;


public class Main {
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                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; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 
	 static int divisors(long x) {
		    long limit = x;
		    int numberOfDivisors = 0;

		    if (x == 1) return 1;

		    for (int i = 1; i < limit; ++i) {
		        if (x % i == 0) {
		            limit = x / i;
		            if (limit != i) {
		                numberOfDivisors++;
		            }
		            numberOfDivisors++;
		        }
		    }

		    return numberOfDivisors;
		} 
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		String g = s.next();
		Character a = g.charAt(2);
		Character b = g.charAt(3);
		Character c = g.charAt(4);
		Character d = g.charAt(5);
		if(a==b && c==d)System.out.println("Yes");
		else System.out.println("No");
	}
}

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

using namespace std;

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef vector<point> polygon;

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

double area2(point a, point b, point c) { return cross(b - a, c - a); }

double dot(point a, point b) { return real(conj(a) * b); }

int ccw(point a, point b, point c)
{
	b -= a; c -= a;
	if (cross(b, c) > 0) return +1; // counter clockwise
	if (cross(b, c) < 0) return -1; // clockwise
	if (dot(b, c) < 0) return +2; // c--a--b on line
	if (dot(b, b) < dot(c, c)) return -2; // a--b--c on line
	return 0;
}

namespace std
{
	bool operator<(point a, point b)
	{
		if (a.real() != b.real())
			return a.real() < b.real();
		return a.imag() < b.imag();
	}
}


polygon convex_hull(vector<point> &P)
{
	int n = P.size(), k = 0;
	vector<point> h(2 * n);
	sort(P.begin(), P.end());
	for (int i = 0; i < n; h[k++] = P[i++])
		while (k >= 2 && ccw(h[k - 2], h[k - 1], P[i]) <= 0) --k;
	for (int i = n - 2, t = k + 1; i >= 0; h[k++] = P[i--])
		while (k >= t && ccw(h[k - 2], h[k - 1], P[i]) <= 0) --k;
	return polygon(h.begin(), h.begin() + k - (k > 1));
}


double sqr(double v){
	return v * v;
}

double dist(point a, point b){
	return sqrt(sqr(a.real() - b.real()) + sqr(a.imag() - b.imag()));
}


#define NEXT(i) (((i) + 1) % n)

vector<pii> get_points (polygon &P)
{
	vector<pii> ans;
	int n = P.size();

	if (P.size() == 2)
		ans.push_back(make_pair(0, 1));

	if (P.size() < 3)
		return ans;

	int q0 = 0;

	while (abs(area2(P[n - 1], P[0], P[NEXT(q0)])) > 
		   abs(area2(P[n - 1], P[0], P[q0])))
		++q0;

	for (int q = q0, p = 0; q != 0 && p <= q0; ++p)
	{
		ans.push_back(make_pair(p, q));

		while (abs(area2(P[p], P[NEXT(p)], P[NEXT(q)])) > 
			   abs(area2(P[p], P[NEXT(p)], P[q])))
		{
			q = NEXT(q);

			if (p != q0 || q != 0)
				ans.push_back(make_pair(p, q));
			else
				return ans;
		}

		if (abs(area2(P[p], P[NEXT(p)], P[NEXT(q)])) == 
			    abs(area2(P[p], P[NEXT(p)], P[q])))
		{
			if (p != q0 || q != n - 1)
				ans.push_back(make_pair(p, NEXT(q)));
			else
				ans.push_back(make_pair(NEXT(p), q));
		}
	}

	return ans;
}

/*
	Gets the farthest pair of points of the given points.
	(maybe TLE using double)

	TESTED [POJ 2187]
*/
pair<point, point> farthest_pair (polygon &P)
{
	P = convex_hull(P);
	vector<pii> pairs = get_points(P);

	double best = 0;
	pair<point, point> ans;

	for (int i = 0; i < pairs.size(); ++i)
	{
		point p1 = P[pairs[i].first];
		point p2 = P[pairs[i].second];
		double dist = norm(p1- p2);

		if (dist > best)
		{
			best = dist;
			ans = make_pair(p1, p2);
		}
	}

	return ans;
}

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

	int n; cin >> n;
	vector<point> v(n);
	for (int i = 0; i < n; ++i){
		double x, y; cin >> x >> y;
		v[i] = point(x, y);
	}
	pair<point,point> fp = farthest_pair(v);
	double ans = dist(fp.first, fp.second);

	cout.precision(15);
	cout << fixed << ans << endl;

	return 0;
}

Measured memory_bytes: 4692
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
#include <utility>


using namespace std;


bool compare(pair<long long, long long> i1, pair<long long, long long> i2) 
{ 
    if ( i1.second == i2.second) return i1.first > i2.first;
    return (i1.second < i2.second); 
} 

int main(void) {
    long long n;
    cin >> n;
    vector< pair<long long, long long> > ab;
    for (long long i=0; i<n; i++) {
        long long tmp1,tmp2;
        cin >> tmp1 >> tmp2;
        ab.push_back( make_pair(tmp1,tmp2));
    }

    sort(ab.begin(), ab.end(), compare);
    long long max = 0;

    for (long long i=0; i<n; i++) {
        // cout << ab[i].first << " " << ab[i].second << endl;
        if ( max+ab[i].first > ab[i].second ) {
            cout << "No" << endl;
            return 0;
        }
        max += ab[i].first;
    }

    cout << "Yes" << endl;



}


Measured memory_bytes: 6384
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll xorn(ll n)
{
    if(n%4==0)return n;
    if(n%4==1)return 1;
    if(n%4==2)return n+1;
    return 0;
}
int A[1000001];
void solve()
{
    ll n,m,x,y;
    cin>>n>>m;
    x=xorn(n-1);
    y=xorn(m);
    x=x^y;
    cout<<x;
}

int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int N, aa, bb;

    scanf("%d", &N);

    aa = (int)(N/100);
    bb = (N - ((int)(N/100))* 100);\

    if(aa < 1 || 12 < aa) {
        if(bb < 1 || 12 < bb) printf("NA");
        else printf("YYMM");
    } else {
        if(bb < 1 || 12 < bb) printf("MMYY");
        else printf("AMBIGUOUS");
    }
    
    return 0;
}

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

#include <stdio.h>

using namespace std;

typedef long long ll;

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

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

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

    vector<int> v(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }

    sort(v.begin(), v.end());

    double prev = v[0];
    for (int i = 1; i < N; i++) {
        prev = (prev + v[i]) / 2;
    }

    printf("%3.6f\n", prev);
    
    return 0;
}


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

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

#define fr first
#define sc second
#define chmax(a,b) a=max(a,b)

int main(){
	int a,b;
	int d[12][12];
	scanf("%d%d",&a,&b);
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			scanf("%d",&d[i][j]);
		}
	}
	
	bool ok[12][12];
	memset(ok,0,sizeof ok);
	for(int s=0;s<=100;s++){
		for(int t=0;t<=100;t++){
			int u=0;
			for(int i=1;i<=a;i++){
				for(int j=1;j<=b;j++){
					chmax(u,d[i][j]-s*i-t*j);
				}
			}
			for(int i=1;i<=a;i++){
				for(int j=1;j<=b;j++){
					if(u==d[i][j]-s*i-t*j)ok[i][j]=true;
				}
			}
		}
	}
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			if(!ok[i][j]){
				puts("Impossible");
				return 0;
			}
		}
	}
	puts("Possible");
	printf("%d %d\n",202,200+101*101);
	for(int i=0;i<100;i++){
		printf("%d %d X\n",1+i,1+i+1);
		printf("%d %d Y\n",102+i+1,102+i);
	}
	for(int s=0;s<=100;s++){
		for(int t=0;t<=100;t++){
			int u=0;
			for(int i=1;i<=a;i++){
				for(int j=1;j<=b;j++){
					chmax(u,d[i][j]-s*i-t*j);
				}
			}
			for(int i=1;i<=a;i++){
				for(int j=1;j<=b;j++){
					if(u==d[i][j]-s*i-t*j)ok[i][j]=true;
				}
			}
			printf("%d %d %d\n",s+1,t+102,u);
		}
	}
	printf("%d %d\n",1,102);
}



Measured memory_bytes: 384
void main()
{
    long n, k;
    rdVals(n, k);

    long[] list = new long[n];
    foreach (i; 0 .. k)
    {
        long d = rdElem;
        long[] a = rdRow;
        foreach (x; a)
        {
            ++list[x-1];
        }
    }

    long result;
    foreach (l; list)
    {
        if (l) continue;
        ++result;
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 3036
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n, k;
  string s;
  cin >> n >> k >> s;

  int cnt = 0;
  rep(i,n-1) {
    if (s[i] == s[i+1]) cnt++; 
  }

  cout << min(n-1, cnt+2*k) << endl;

  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
  int N, tmp, i;
  long int knockNum;
  vector<int> A, B;
  // 入力 --------------------------
  cin >> N;
  for(i = 0; i < N+1; i++) {
    cin >> tmp;
    A.push_back(tmp);
  }
  for(i = 0; i < N; i++) {
    cin >> tmp;
    B.push_back(tmp);
  }
  // 倒した数のカウント --------------------
  knockNum = 0;
  for(i = 0; i < N; i++) {
    // A[i]を倒す
    if(B[i] > A[i]) {
      knockNum += A[i];
      B[i] -= A[i];
    } else {
      knockNum += B[i];
      continue;
    } 
    // A[i+1]を倒す
    if(B[i] > A[i+1]) {
      knockNum += A[i+1];
      A[i+1] = 0;
    } else {
      knockNum += B[i];
      A[i+1] -= B[i];
    }
  }
  cout << knockNum << endl;
  return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;

pair<int, int> p[N];

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	for (int i=0; i<n; i++)
	{
		cin >> p[i].first;
		p[i].second = i;
	}
	sort(p, p+n);
	int ans = 0;
	for (int i=0; i<n; i++)
		if (i % 2 != p[i].second % 2)
			ans++;
	cout << ans / 2 << "\n";

	return 0;
}

Measured memory_bytes: 1024
while True:
    n, k = map(int,input().split())
    if n == 0 and k == 0:
        break
    a = [int(input()) for _ in range(n)]
    s = sum(a[0:k])
    ss = [s]
    for i in range(k,n):
        s = s + a[i] - a[i-k]
        ss.append(s)
    print(max(ss))
        


Measured memory_bytes: 11704
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
 
using namespace std;
// for loop
#define F(i, L, R) for(int i = L; i < R; i++)
#define FE(i, L, R) for(int i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(int i = L; i > R; i--)
#define FRE(i, L, R) for(int i = L; i >= R; i--)
 
// data types
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft
 
// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}
 
// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)
 
// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323
 
int main() {
    long n;
    cin >> n;
    ll sum = 0;
    FE(i, 0, n){
        if(i % 5 == 0 || i % 3 == 0)continue;
        sum += i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
#!/usr/bin/env -S JULIA_VERSION=0.5.0 julia
# contest: abc155, problem: abc155_c, alphabet: C

function main()
  N = parse(Int, readline())
  dic = Dict{String, Int}()
  maxn = 0
  for i in 1:N
    s = strip(readline())
    n = get(dic, s, 0) + 1
    dic[s] = n
    maxn = max(maxn, n)
  end
  for s in sort([s for (s,n) in dic if n==maxn])
    println(s)
  end
end

if isempty(get(ENV, "ATCODER_LOCAL", ""))
  isempty(ARGS) && main()
end


Measured memory_bytes: 188496
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

int main() {
  kyun;
  dset(10);
  ind a;
  cin >> a;
  int aa = a;
  ind ans = ((aa+1)/2)/a;
  cout << ans;
  hinata;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define modulo 998244353
#define endl '\n'
#define pb push_back
using namespace std;
vector <int> adj[100001];
ll fxp(ll a, ll b)
{
    if(b == 0)return 1;
	if(b%2 == 0){
		ll c = fxp(a,b/2);
		return (c*c)%1000000007;
	}
	return (a*fxp(a,b-1))%1000000007;
}
int lcm(int c,int d)
{
    int a=c;
    int b=d;
    int ans;
    if(a>=b)
    {
        while(b!=0)
        { 
            int x=b;
            b=a%b;
            a=x;
        }
        ans = ( c*d)/a;
    }
    else
    {
        while(a!=0)
        {
            int x=a;
            a=b%a;
            b=x;
        }
        ans = ( c*d)/b;  
    }
    return ans;
}
int root_find()
{
    ll x;
    for(int i=1;i<100001;i++)
    {
        if(adj[i].size()==1)
        {
            x = i;
            break;
        }
    }
    return x;
}
void dfs(int s,int y)
{
    for(int i=0;i<adj[s].size();i++)
    {
        if(adj[s][i]==y)
        continue;
        dfs(adj[s][i],s);
    }
}
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
ll smallestDivisor(ll n) 
{ 
    // if divisible by 2 
    if (n % 2 == 0) 
        return n/2; 
  
    // iterate from 3 to sqrt(n) 
    for (int i = 3; i * i <= n; i += 2) { 
        if (n % i == 0) 
            return n/i; 
    } 
  
    return n; 
}  
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin>>a;
    ll sum=a + a*a + a*a*a;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 6040
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(int n,m,a;cin>>n>>m>>a,n|m|a;){
		a--;
		vector<pair<int,pii> > ps(m);
		rep(i,m){
			int h,p,q; cin>>h>>p>>q;
			ps[i]=mp(h,mp(p-1,q-1));
		}
		sort(all(ps));
		
		vi res(n);
		rep(i,n) res[i]=i;
		rep(i,m){
			pii p=ps[i].second;
			swap(res[p.first],res[p.second]);
		}
		cout<<res[a]+1<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

signed main() {
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    int l[N];
    int id[N];
    for (int i=0;i<N;i++)cin >> l[i];
    int min_cost = 9999999999;
    for (ll i=0;i<pow(4, N);i++){
        int kadomatsus[3] = {0};
        int cost = -30;
        ll rest = i;
        for(int j=0;j<N;j++){
            id[j] = rest % 4;
            rest = rest / 4;
            int index = id[j];
            if (index < 3){
                kadomatsus[index] += l[j];
                cost += 10;
            }
        }
        bool valid=true;
        for(int kd_len:kadomatsus)if(kd_len==0)valid=false;
        if(!valid)continue;
        cost += abs(kadomatsus[0] - A);
        cost += abs(kadomatsus[1] - B);
        cost += abs(kadomatsus[2] - C);
        min_cost = min(min_cost, cost);
    }
    cout << min_cost << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
vector<char> vec(9);
  rep(i,9) {
cin >>vec.at(i);
  }
  cout <<vec.at(0) << vec.at(4)<< vec.at(8) << endl;
}
  

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

int dp[MAX];
int n,q;
string s;

void make() {
	int i = 0;
	dp[0] = 0;
	while(1) {
		if (s[i]=='A'&&s[i+1]=='C') {
			dp[i+1] = dp[i] + 1;
		} else {
			dp[i+1] = dp[i];
		}
		if (i+1==n-1) {
			break;
		}
		i++;
	}

	// rep(i,n) {
	// 	cout << i << " " << dp[i] << endl;
	// }
}

int main(){
	cin >> n>>q>>s;
	make();
	rep(i,q) {
		int l,r;
		cin >> l>>r;
		cout << dp[r-1]-dp[l-1]<< endl;
	}
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define sz(s) (int)s.size()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

ll power(ll x,ll y){
	ll t=1;
	while(y>0){
		if(y%2) y-=1,t=t*x%mod;
		else y/=2,x=x*x%mod;
	}
return t;
}

ll a[N],v[N];

int main(){
	ll n,x,y,flag=0,sum=0,t;
	scanf("%lld",&n);
	REP(i,n){
		scanf("%lld",&a[i]);
		sum+=a[i];
	}
	x=(a[0]-a[n-1])%n;
	if (x<0) x+=n;
	REP(i,n-1){
		y=(a[i+1]-a[i])%n;
		if (y<0) y+=n;
		if (y!=x) {flag=1; break;}
	}
	t=(n*(n+1))/2;
	if (sum%t) flag=1;
	//printf("%d\n",flag);
	t=sum/t;
	sum=0;
	v[0]=(t-a[0]+a[n-1]);
	if (v[0]%n||v[0]<0) flag=1;
	v[0]/=n;
	sum+=v[0];
	REP(i,n-1){
		v[i+1]=(t-a[i+1]+a[i]);
		if (v[i+1]%n||v[i+1]<0) flag=1;
		v[i+1]/=n;
		sum+=v[i+1];
	}
	if (sum!=t) flag=1;
	if (flag) printf("NO\n");
	else printf("YES\n");
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;


int main()
{


    string s;
    map<string,ll>mp;

    mp["SUN"]=7;
    mp["MON"]=6;
    mp["TUE"]=5;
    mp["WED"]=4;
    mp["THU"]=3;
    mp["FRI"]=2;
    mp["SAT"]=1;

   cin>>s;

   cout<<mp[s]<<endl;




    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n;
  int l[10];
  int i;
  int tmp;
  int sum;
  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%d",&l[i]);
  }
  tmp = l[0];
  sum = tmp;
  for(i=1;i<n;i++){
    sum += l[i];
    if(tmp < l[i]){
      tmp = l[i];
    }
  }
  if(tmp < sum - tmp){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stack>

using namespace std;

int main(void){

  string s;
  stack <string> st;
  string::iterator it;
  
  while(getline(cin,s)){
    
    //cin>>s;
    it=s.end();
    it--;
    if(s.size()==1&&*it=='.')
      break;
  
    for(it=s.begin();it!=s.end();it++){

      if(*it=='('){
	st.push("(");
      }

      else if(*it=='['){
	st.push("[");
      }

      else if(*it==')'){
	if(st.empty())
	  st.push(")");
	
	if(st.top()=="(")
	  st.pop();
	else
	  st.push(")");
      }

      else if(*it==']'){
	if(st.empty())
	  st.push("]");
	
	if(st.top()=="[")
	  st.pop();
	else
	  st.push("]");
      }
    }

    if(st.empty())
      cout <<"yes"<<endl;

    else
      cout <<"no"<<endl;

    while(!st.empty()){
      st.pop();
    }
    
  }
  return 0;

}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=105;
//i_am_noob
int n;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	print0("Christmas");
	rep(25-n) print0("Eve");
	cout << '\n';
	return 0;
}


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

int main() {
  int X, N;
  cin >> X >> N;
  std::set<int> p_set;

  int p;
  for (int i = 0; i < N; i++) {
    cin >> p;
    p_set.insert(p);
  }

  int ans = 1000;
  for (int i = -100; i <= 200; i++) {
    if (p_set.count(i) > 0) {
      continue;  // 含まれる
    }
    if (abs(X - ans) > abs(X - i)) {
      ans = i;
    } else if (abs(X - ans) == abs(X - i)) {
      ans = min(ans, i);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	string S;
	cin >> S;
	if (S[2] == S[3] && S[4] == S[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



Measured memory_bytes: 256
S = input()
K = int(input())

ind = -1
for i in range(len(S)):
  if S[i] == '1':
    ind = i
  else:
    break

if ind == -1:
  print(S[0])
elif ind + 1 >= K:
  print(1)
else:
  print(S[ind+1])


Measured memory_bytes: 9180
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <stack>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;

ll digits(ll x) {
    ll ret = 0;
    ll y = x;
    while (y) {
        ret++;
        y /= 10;
    }
    return ret;
}

ll f(ll a, ll b) {
    return max(digits(a), digits(b));
}

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

    ll N;
    cin >> N;
    ll ans = INF;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i) {
            continue;
        }
        ans = min(ans, f(i, N / i));
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<ctime>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<deque>
#include<map>
#include<cstring>
#include<stack>
#include<cctype>
#include<cstdio>
#include<bitset>
#ifdef LOCAL
	#define enu(i,n) for(int i=0;i<n;i++)
	#define tri(x) x*(x+1)/2;
	#define sqrsum(x) x*(x+1)*(2*x+1)/6;
	#define sqrsum_range(a,b) sqrsum(b)-sqrsum(a-1);
#endif
#define FOR(i,a,b) for(int i=a,_b=b;i<_b;i++)
#define REP(i,a,b) FOR(i,a,b+1)
#define ll_max 9223372036854775807LL
#define ll_min -9223372036854775808LL
#define int_max 2147483647
#define int_min -2147483648
#define PI 3.141592653589793238462653383
#define eps 0.00000001
#define elif else if
using namespace std;
int main()
{
	double a,b,x;
	cin>>a>>b>>x;
	double vol_2=a*a*b/2.0;
	if(vol_2>=x)
	{
		double c=x*2.0/a/b;
		printf("%.8lf\n",atan(b/c)*180.0/PI);
	}
	else
	{
		double c=(vol_2*2.0-x)*2.0/a/a;
		printf("%.8lf\n",atan(c/a)*180.0/PI);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.Predicate;

public class Main {

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

    void run(){
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        boolean ok = false;
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                // i * j の全通りを試し、Nになるものがあればフラグを立てる
                if (i * j == N) ok = true;
            }
        }
        if(ok) System.out.println("Yes");
        else System.out.println("No");

    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}


//cout<<""<<endl;
int main(){
  int N;cin>>N;
  string s;
  map<string ,int > mp;
  rep(i,N){
    cin >>s;
    mp[s] ++;
    
  }
   int ma =1;
  for(auto i:mp){
    ma =max(i.second,ma);
    
  }
  for(auto i:mp){
    if(i.second==ma){
     cout<< i.first<<endl;
    }
  }
}





Measured memory_bytes: 25216
N=int(input())
A= list(map(int,input().split()))
B= list(map(int,input().split()))
C= list(map(int,input().split()))

satis=0
As=False
for i,a in enumerate(A):
  satis+=B[a-1]
  if As:
	  if a==(As+1):
	    satis+=C[a-2]
  As=a
  
print(satis)
  

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

const int MAX_N = 200020;

int dp[3][MAX_N];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  fill(dp[0], dp[3], -inf);
  cin >> dp[0][0];
  rep(i, n-1) {
    char op;
    int a;
    cin >> op >> a;
    if(op == '+') {
      // ...+a
      dp[0][i+1] = max(dp[0][i]+a, dp[1][i]+a);
      // ...-(...+a OR ...-(...-(...)+a
      dp[1][i+1] = max(dp[1][i]-a, dp[2][i]-a);
      // ...-(...-(...+a
      dp[2][i+1] = dp[2][i]+a;
      // ...-(...-(...-(... EQ ...-(...-(...))-(...
    } else {
      // ALWAYS ...-(a
      dp[0][i+1] = -inf;
      // ...-(a OR ...-(...)-(a OR ...-(...-(...))-(a
      dp[1][i+1] = max({dp[0][i]-a, dp[1][i]-a, dp[2][i]-a});
      // ...-(...-(a OR ...-(...-(...)-(a
      dp[2][i+1] = max(dp[1][i]+a, dp[2][i]+a);
    }
  }
  cout << max({dp[0][n-1], dp[1][n-1], dp[2][n-1]}) << endl;


  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

double p[200010];
double ans, tmp;
int k, n;

int main()
{
    read(n), read(k);
    for (int i = 1; i <= n; ++i)    std::cin >> p[i], p[i] = (p[i] + 1) / 2;
    for (int i = 1; i <= k; ++i)    ans += p[i];
    tmp = ans;
    for (int i = k + 1; i <= n; ++i)
    {
        tmp -= p[i - k];
        tmp += p[i];
        ans = std::max(ans, tmp);
    }
    printf("%.12lf\n", ans);
    return 0;
}

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

using namespace std;

int main()
{
  char s[3];
  cin>>s;
  char z=s[0];
  int count=1;
  for(int i = 1 ; i< 3;i++)
  if(z==s[i])count++;

  if(count==3)cout<<"No";
  else cout<<"Yes";
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;

const double PI = 3.141592653589793;


int main() {
	// fios;
	int r;
	cin >> r;
	cout << 2.0 * PI * (double)r << endl;

}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int x,y,k=1;
  cin>>x>>y;
  while(true){
    if(x*(long long int)pow(2,k)<=y){
      k++;
    }else{
      break;
    }
  }
  cout<<k<<endl;
  
  
}
///////////////////////////

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()

	ans := N * (N + 1) / 2

	fmt.Println(ans)
}


Measured memory_bytes: 640
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, atan, sqrt, tan, cos, pi
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353

s = S()
D = defaultdict(int)
for i in s:
    D[i]+=1

ans = len(s) * (len(s) - 1) // 2
for j in D.values():
    ans -= j * (j - 1) // 2

print(ans + 1)









Measured memory_bytes: 83616
package main

import (
	"fmt"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)

	minM := 114514
	m := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&m[i])
		x -= m[i]
		minM = min(minM, m[i])
	}

	fmt.Println(n + x/minM)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std ;
int main()
{
	string n;
	cin >> n ;
	for(int i=0;i<n.size();i++)
	if(n[i]=='1') n[i]='9';
	else n[i]='1';
	cout << n ;
	return 0;
}

Measured memory_bytes: 888
n=int(input())
a=list(map(int,input().split()))
r=0
b=0
g=0
ans=1
for i in range(n):
    num=0
    if r==a[i]:
        num+=1
    if g==a[i]:
        num+=1
    if b==a[i]:
        num+=1
    ans*=num

    if r==a[i]:
        r+=1
    elif g==a[i]:
        g+=1
    elif b==a[i]:
        b+=1
print(ans%1000000007)


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

int main() {
	for (int left; cin >> left;) {
		vector<int> scales;
		for (int right = 512; right; right /= 2) {
			if (left / right) {
				left -= right;
				scales.push_back(right);
			}
		}
		do {
			cout << scales.back();
			scales.pop_back();
			cout << (scales.empty() ? '\n' : ' ');
		} while (!scales.empty());
	}

	return 0;
}

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

int main(){
  int a, b, av;
  
  cin >> a >> b;
  
  av = (a + b) / 2;
  
  if(abs(a - av) == abs(b - av)){
    cout << av << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
  
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int n, x;

    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {
        x = i;

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

    return 0;
}


Measured memory_bytes: 2072
n,m = map(int,input().split())
h = list(map(int,input().split()))

edges = [[] for _ in range(n)]

for _ in range(m):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

ans = 0

for i,e in enumerate(edges):
    flag = True
    for j in e:
        if h[j] >= h[i]:
            flag = False
    if flag:
        ans += 1

print(ans)


Measured memory_bytes: 92632
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using static Prog;
using NX = System.Int64;

public class Solver
{
    List<int>[] Edge;
    int[][] cost;
    public void Solve()
    {
        int N = NextInt(), u = NextInt(), v = NextInt();
        Edge = Enumerable.Range(0, N + 1).Select(x => new List<int>()).ToArray();
        cost = Enumerable.Range(0, 2).Select(x => Enumerable.Range(0, N + 1).Select(y => -1).ToArray()).ToArray();
        for (int i = 0; i < N - 1; i++)
        {
            int A = NextInt(), B = NextInt();
            Edge[A].Add(B);
            Edge[B].Add(A);
        }
        dfs(u, u, 0, 0);
        dfs(v, v, 0, 1);
        int ans = 0;
        for (int i = 1; i <= N; i++)
        {
            int tak = cost[0][i], aok = cost[1][i];
            if (tak < aok) ans = Math.Max(ans, aok);
        }
        Console.WriteLine(ans - 1);
    }

    void dfs(int now, int bac, int c, int id)
    {
        cost[id][now] = c;
        foreach (var e in Edge[now])
        {
            if (e != bac)
            {
                dfs(e, now, c + 1, id);
            }
        }
    }
}

public class Prog
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Solver().Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 41736
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mx INT_MAX
#define mn INT_MIN
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define itr set<int> :: iterator
const int N = 1e5+10;

vector<ll> a;
ll dp[3001][3001][2];

ll solve(int i, int j, int flag){

  if(i>j)
    return 0;

  if(dp[i][j][flag]!= -1){
    return dp[i][j][flag];
  }
  
  if(flag == 1){
    dp[i][j][flag] = max(a[i]+solve(i+1, j, 0), a[j]+solve(i,j-1, 0));
  }else
    dp[i][j][flag] = min(solve(i+1, j, 1), solve(i, j-1, 1));

   return dp[i][j][flag];
}

int main(){

  // **** START HERE ****
       
   int n;
   cin>>n;

   a.clear();
   ll sum = 0;
   for(int i=0; i<n; i++){
    ll x;
    cin>>x;
    sum += x;
    a.pb(x);
   }
   
   memset(dp, -1, sizeof(dp));

   ll res = solve(0, n-1, 1);
   ll y = sum - res;
   cout<<res-y<<endl;

  // **** END HERE ****
    
    return 0;
}

Measured memory_bytes: 144556