akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            Console.Write("ACL");
        }
        Console.WriteLine();
    }
}

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

#define MAX 100000
#define ll long long

ll arr[MAX+5];
int n, k;
ll dp[MAX+5];

void initialize()
{
    for(int i=0;i<=MAX+5;i++) dp[i] = -1;
}

ll frog(int pos)
{
    if(pos<=1) return 0;

    for(int i=2;i<=k and n;i++)
        if(pos==i)
            return abs(arr[i]- arr[1]);

    if(dp[pos]!=-1) return dp[pos];

    //ll p1 = frog(pos-1)+abs(arr[pos] - arr[pos-1]);
    //ll p2 = frog(pos-2)+abs(arr[pos] - arr[pos-2]);

    ll mn = LLONG_MAX;

    for(int i=1;i<=k and n;i++)
    {
        mn = min(mn, frog(pos-i)+abs(arr[pos] - arr[pos-i]));
    }

    dp[pos] = mn;

    return mn;
}

int main()
{
    initialize();
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>arr[i];

    ll cost = frog(n);

    cout<<cost<<endl;
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9 +7;
int n,D,H;
ll doe,sum;
ll f[1010101],s[1010101];
void init()
{
	doe=1;
	for (int i=1;i<=n;++i)
	{
		doe=doe*i%mod;
		sum=(sum+doe)%mod;
	}
}
ll sol(int x,int y)
{
	if (x==0) return s[y];
	else return (s[y]-s[x-1]+mod)%mod;
}
int main()
{
	scanf("%d%d%d",&n,&H,&D);
	init();
	f[0]=1; s[0]=1;
	for (int i=1;i<=H;++i)
	{
		int x=max(0,i-D);
		f[i]=sol(x,i-1)*sum%mod;
		if (i==H) f[i]=sol(x,i-1)*doe%mod;
		s[i]=s[i-1]+f[i]; s[i]%=mod;
	}
	printf("%lld\n",f[H]);
	return 0;
}

Measured memory_bytes: 16000
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>

int n, d;

int main() {
	scanf("%d %d", &n, &d); int ans = 0;
	for (int i = 1, x, y; i <= n; ++i) {
		scanf("%d %d", &x, &y);
		double dis = sqrt(1ll * x * x + 1ll * y * y);
		if (dis <= d) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  if(S.at(0) == S.at(1) && S.at(1) == S.at(2)){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


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

int main()
{
	stack<int> s;
	char a;
	int d=0;
	
	while((a=getchar())!=EOF){
		if(isdigit(a)){	
			d=a-'0';
			while((a=getchar())!=' '){
			//	cout<<d<<endl;
				d=d*10+a-'0';
			}
			s.push(d);
		}else{
			int b,c;
			b=s.top();
			s.pop();
			c=s.top();
			s.pop();
			if(a=='+') s.push(c+b);
			if(a=='-') s.push(c-b);
			if(a=='*') s.push(c*b);
			if(a=='/') s.push(c/b);
			getchar();
		}
	}
	
	cout<<s.top()<<endl;
	return 0;
}


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


long long n,m,mt;
map<int, int> cnt;
vector<long long> v;

void p(map<int, int>::iterator it, long long t){
    if(it == cnt.end()){
        //cout << t << endl;
        if(t >= n) v.push_back(t);
        return;
    }
    for(int i=0; i <= it->second; i++){
        //cout << it->first;
        long long tmp =  t * pow(it->first,i);
        //cout << tmp;
        p(next(it), tmp);
    }
    return;
}

bool isPrime(long long m){
    for(int i=2; i*i <= m; i++){
        if(m%i == 0) return false;
    }
    return m != 1;
}

int main()
{
    cin >> n >> m;
    mt = m;
    if(isPrime(m)){
        cout << 1 << endl;
        return 0;
    }
    
    for(int i=2; i<=m && m!=1; i++){
        while(m%i == 0){
            if(cnt.count(i) == 0) 
                cnt[i] = 1;
            else
                cnt[i]++;
            m = m/i;
        }
    }
    p(cnt.begin(), 1);
    sort(v.begin(), v.end());
    cout << mt/v[0] << endl;
  
    return 0;
}


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

ll n, a, b;


int main() {
    scanf("%lld %lld %lld", &n, &a, &b);
    ll up = (n-1)*b + a;
    ll down = (n-1)*a + b;
    if(a>b || n==1 && a!=b) printf("0\n");
    else printf("%lld\n", up-down+1);
}


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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int B;
	ll ans = 1LL;
	
	cin >> B;
	
	for(int i=1; i<=B; i++)
		ans = (ans * i) % mod;
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String a=scan.nextLine();
        if(a.equals("ABC")){
            System.out.println("ARC");
        }else{
            System.out.println("ABC");
        }
    }
}

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

int main(){
  	int a,b,c;
  	string s,t;
  	cin >> s >> t;
  	string ans;
  	if(s[0] == s[1] && s[0] != s[2] && s[2] == s[3]){
      	ans = "Yes";
    }else if(s[0] == s[2] && s[0] != s[1] && s[1] == s[3]){
    	ans = "Yes";
    }else if(s[0] == s[3] && s[0] != s[1] && s[1] == s[2]){
    	ans = "Yes";
    }else{
    	ans = "No";
    }
  	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 16MB stack
        Thread thread = new Thread(null, new Main(), "", 16 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    // int a = Integer.parseInt(scanner.nextLine());
    // int[] a = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    static void solve(Scanner scanner) {
        int a = Integer.parseInt(scanner.nextLine());
        scanner.nextLine();
        scanner.nextLine();
        scanner.nextLine();
        int e = Integer.parseInt(scanner.nextLine());
        int k = Integer.parseInt(scanner.nextLine());
        System.out.println(e - a <= k ? "Yay!" : ":(");

    }

}


Measured memory_bytes: 21972
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int n = fs.nextInt();
		double d = (double)fs.nextInt();
		
		
		int ans = 0;
		for(int i = 0; i < n; i++) {
			
			int x = fs.nextInt();
			int y = fs.nextInt();
			
			if(Math.sqrt((long)x*x + (long)y*y) <= d) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 55804
N, K = map(int, input().split())
a = []
for _ in range(N):
    a.append(int(input())-K)
    
su = 0
v = [(0, 0)]
for i in range(N):
    su += a[i]
    v.append((su, i+1))
v = sorted(v)

data = [0]*(N+3)

def sumation(i):
    s = 0
    while i > 0:
        s += data[i]
        i -= i & -i
    return s
    
def add(i, x):
    while i <= N+2:
        data[i] += x
        i += i & -i
ans = 0
for e, i in v:
    ans += sumation(i+1)
    add(i+1, 1)
    
print(ans)

Measured memory_bytes: 42308
#include<bits/stdc++.h>
using namespace std;int P[250][150],T[250],x[250][3],D,N,M,i,j,k;
main(){memset(P,-999999,sizeof(P));cin>>D>>N;
for(i=1;i<=D;i++){cin>>T[i];}
for(i=1;i<=N;i++){cin>>x[i][0]>>x[i][1]>>x[i][2];if(T[1]>=x[i][0] && T[1]<=x[i][1]){P[1][x[i][2]]=0;}}
for(i=2;i<=D;i++){for(j=1;j<=N;j++){if(T[i]>=x[j][0] && T[i]<=x[j][1]){
for(k=0;k<=100;k++){P[i][x[j][2]]=max(P[i][x[j][2]],P[i-1][k]+abs(x[j][2]-k));}}}}
for(i=0;i<=100;i++){M=max(M,P[D][i]);}cout<<M<<"\n";}

Measured memory_bytes: 1324
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int ans = 0;
    int l = 0,r = 0;
    int sum = 0,XOR = 0;
    while(r < N) {
        XOR ^= A[r];
        sum += A[r];
        if(XOR == sum) {
            ans += r-l+1;
        }
        else {
            while(XOR != sum) {
                sum-=A[l];
                XOR^=A[l];
                l++;
            }
            ans+=r-l+1;
        }
        r++;
    }
    cout << ans << endl;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

//参考ページ　http://wk1080id.hatenablog.com/entry/2018/08/17/234023
signed main()
{   
    gearup;
    ll n; cin >> n;
    vl a(n);
    rep(i,n)cin>>a[i];
    
    ll res = 0;
    rep(i,n)res ^= a[i];
    
    ll ans = 0;
    for(int i=30;i >= 0;i--){
        if(res & (1<<i)){
            rep(j,n){
                ll t = a[j] ^ (a[j]-1); //2^(t) - 1
                if(t+1 == (1<<(i+1))){ //t+1 = 2^(t)
                    res ^= t;
                    ans++;
                    break;
                }
            }
        }
    }
    if(res == 0)out(ans);
    else out(-1);
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define sz size
#define ll long long
const int N = 300000 + 10;
using namespace std;

int n,m;
vector<int> g[N];
int col[N];
int ca,cb;

namespace solver
{ 

  int dfs(int x,int c)
  {
	col[x]=c;
	if(col[x]) ca++; else cb++;
	for(int i=0; i<g[x].sz(); ++i)
	{
	  int y=g[x][i];
	  if(col[y]==-1) {if(!dfs(y,c^1)) return 0;} else if(col[y]==c) return 0;
	}
	return 1;
  }
  void solve()
  {
    scanf("%d%d",&n,&m);
	int x,y;
	for(int i=1; i<=n; ++i) col[i]=-1;
	for(int i=1; i<=m; ++i) 
	{
	  scanf("%d%d",&x,&y);
	  g[x].pb(y); g[y].pb(x);
	}
     
	int p=dfs(1,0);
	ll ans=0;
	if(!p)
	{
	  ans=1ll*n*(n-1)/2-m;
	}
	else
	{
	  ca=cb=0;
	  for(int i=1; i<=n; ++i) ca+=(bool)(col[i]), cb+=(bool)(!col[i]);
	  ans=1ll*ca*cb-m;
	}
	printf("%lld\n",ans);
  }
}

int main()
{
  solver::solve();
} 

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

using namespace std;

typedef long long ll;

const int mod = 1e9+7;
const int N = 1e2+10;
const int K = 1e5+10;

ll dp[N][K];
ll p[K];

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

	dp[0][k] = 1;
	for(int i = 0; i < n; i++) {
		int a;
		cin >> a;
		
		fill(p, p+K-5, 0);
		/*for(int j = 0; j <= k; j++) {
			p[j] = dp[i][j];
		}
		*/
		for(int j = k; j >= 0; j--) {
			p[max(j-a, 0)] += dp[i][j];
			p[j+1] -= dp[i][j];
			//p[max(j-a, 0)] %= mod;
		}

		ll cnt = 0;
		for(int f = 0; f <= k; f++) {
			cnt += p[f];
			cnt = (cnt+mod)%mod;
			p[f] = cnt;
		}

		for(int j = 0; j <= k; j++) {
			dp[i+1][j] = (p[j]);
		}
	}

	cout << dp[n][0];
}

Measured memory_bytes: 82436
#include<iostream>
#include<algorithm>
using namespace std;
typedef unsigned long long int ll;
int main(void) {
	ll a, b, c, d, x, result = 0; cin >> a >> b >> c >> d;
	ll C = c, D = d;
	if (d < c)swap(c, d);
	ll r = d % c;
	while (r != 0) {
		d = c;
		c = r;
		r = d % c;
	}
	x = C * D / c;
	a--;
	ll sum = b - a;
	result += sum - (b / C - a / C);//3
	result += sum - (b / D - a / D);//4
	result -= sum - (b / x - a / x);//5
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i

cnt = Array.new(n+1,0)
max = Math.sqrt(n).to_i
(1..max).each do |x|
    (1..max).each do |y|
        (1..max).each do |z|
            ans = x*x + y*y + z*z + x*y + y*z + z*x
            if ans <= n
                cnt[ans] += 1
            end
        end
    end
end

(1..n).each do |i|
    #puts "N=#{i}のとき"
    puts cnt[i]
end

Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  int H, n;
  cin >> H >> n;
  vector<int> dp(H + 1, INF); // dp[H]
  // dp[x] - minimum total cost to get value x
  dp[0] = 0;
  while(n--) {
    int value, cost;
    cin >> value >> cost;
    for(int i = 0; i <= H; i++) { // O(N*H)
      // dp[i] -> dp[i+value]
      int j = min(H, i + value);
      dp[j] = min(dp[j], dp[i] + cost);
    }
  }
  
  cout << dp[H] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int Y = scan.nextInt();
			
			int K = Y/10000;
			int goukei=0;
			
			for(int i =0;i<=K;i++) {
				goukei+=i;
				int g = Y-i*10000;
				int G = g/5000;
				for(int z = 0;z<=G;z++) {
					goukei+=z;
					int W= g-z*5000;
					if(i+z+W/1000==N) {
						System.out.print(i);
						System.out.print(" ");
						System.out.print(z);
						System.out.print(" ");
						System.out.println(W/1000);
						System.exit(0);
					}
					
				}
				
			}
			
			System.out.println("-1 -1 -1");
			
		}
		
		
	}
		

}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  // ll ans = 0;
  bool ok = (c >  + b) && a*b* 4 < (c - a- b) * (c - a- b);

  // cout << ans << endl;
  cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) xmax = x; return true;
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) xmin = x; return true;
    return false;
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    ll a, b, c; cin >> a >> b >> c;
    auto check = [](ll i, ll j, ll k) -> bool {
        return (i%2==0) && (j%2==0) && (k%2==0);
    };
    if (a < 2 || b < 2 || c < 2) { cout << 0 << endl; return; }
    if (a == b && b == c) { cout << -1 << endl; return; }
    int ret = 0;
    bool loop = true;
    while (loop) {
        loop = check(a,b,c);
        if(loop) { ret++; }
        ll tmpa = a;
        ll tmpb = b;
        ll tmpc = c;
        a = tmpb/2 + tmpc/2;
        b = tmpa/2 + tmpc/2;
        c = tmpa/2 + tmpb/2;
    }
    cout << ret << endl;
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n, max, min, tmp;
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		max = -1;
		min = 501;
		for(int i = 0, sum = 0; i < n; i++, sum = 0){
			for(int j =0; j < 5; j++){
				cin >> tmp;
				sum += tmp;
			}
			
			if(sum > max){
				max = sum;
			}
			if(sum < min){
				min = sum;
			}
		}
		
		cout << max << " " << min << endl;
	}

	return 0;
}

Measured memory_bytes: 0
package main

import (
	"fmt"
	"math"
)

var ans []int

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

	for i := range make([]struct{}, 4) {
		solve(i, x, y)
	}
	fmt.Println(min(ans))
}

func solve(i, x, y int) {
	t := 0

	if i%2 > 0 {
		x *= -1
		t++
	}
	if i/2 > 0 {
		y *= -1
		t++
	}
	if x <= y {
		t += y - x
		ans = append(ans, t)
	}
}

func min(a []int) int {
	result := math.MaxFloat64
	for _, v := range a {
		result = math.Min(result, float64(v))
	}
	return int(result)
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int,int> P;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;

    return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN=2005;

int N,K;
vector<int> adj[MAXN];
int dep[MAXN],fa[MAXN],cnt;

void dfs(int u,int f,int lim)
{
    for(int i=0;i<(int)adj[u].size();i++)
    {
        int v=adj[u][i];
        if(v!=f)
        {
            dep[v]=dep[u]+1;
            if(dep[v]>lim)
                cnt++;
            dfs(v,u,lim);
        }
    }
}

int main()
{
    scanf("%d%d",&N,&K);
    for(int i=1;i<N;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int ans=0x3F3F3F3F;
    if(K%2==0)
    {
        for(int i=1;i<=N;i++)
        {
            cnt=0;
            dep[i]=0;dfs(i,0,K/2);
            ans=min(ans,cnt);
        }
    }
    else
    {
        for(int i=1;i<=N;i++)
            for(int j=0;j<(int)adj[i].size();j++)
            {
                cnt=0;
                dep[i]=0;dfs(i,adj[i][j],K/2);
                dep[adj[i][j]]=0;dfs(adj[i][j],i,K/2);
                ans=min(ans,cnt);
            }
    }

    printf("%d\n",ans);

    return 0;
}//

Measured memory_bytes: 512
n = input()
v_list = sorted(list(map(int, input().split())), reverse=True)
result = 0
for i, v in enumerate(v_list):
    if i + 1 == len(v_list):
        result += v / (2**i)
    else:
        result += v / (2**(i+1))
print(result)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <stack>

typedef long long ll;

const double EPS = 1e-10;
const ll     INF = 1 << 30;

int main(int argc, char* argv[])
{
  ll n, k;
  std::cin >> n >> k;
  std::vector< ll > vec(1e5+7, 0);


  for (ll i = 0; i < n; i++) {
    ll a, b;
    std::cin >> a >> b;
    vec[a] += b;
  }

  ll count = 0;
  ll ans = 0;
  for (ll i = 1; i <= 1e5; i++) {
    count += vec[i];
    if (count >= k) {
      ans = i;
      break;
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  char c;
  cin >> c;
  cout << ++c << endl;
  return 0;
}


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

int main()
{  
  double a,b,x;
  cin >> a >> b >> x;
  double y=x/a;
  double ans;
  double pi=3.1415926535897932384626433832795;
  cout << fixed << setprecision(10);
  
  if(a*b/2>=y){//yが三角形
    double c=y*2/b;
    ans=atan(b/c);
  }else{//yが台形
    double c=y*2/a-b;
    ans=atan((b-c)/a);
  }
    
  cout << ans*180/pi << endl;
}

Measured memory_bytes: 256
import java.io.*;
// import java.math.*;
// import java.util.*;
// import java.util.Map.*;
// import java.util.stream.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        int a = Integer.parseInt (reader.readLine());
        System.out.println (
            String.format ("%.0f", a + Math.pow (a, 2) + Math.pow (a, 3)));
        return;
    }
}

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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int a,b;
	cin >> a >>b;
	set<int> c={4,6,9,11};
	set<int> d={1,3,5,7,8,10,12};
	
	if(a==b || c.count(a) && c.count(b) || d.count(a) && d.count(b)) puts("Yes");
	else puts("No");
	
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#define min(a,b) ((a) < (b) ? a : b)
#define max(a,b) ((a) > (b) ? a : b)
main()
{

    int a,b,c,a1,b1,c1;

    while(scanf("%d %d %d",&a,&b,&c)!=EOF){

    a1=min(min(a,b),c);
    c1=max(max(a,b),c);
    if(a1!=a && c1!=a ) b1=a;
    else if (a1!=b && c1!=b) b1=b;
    else b1=c;
        printf("%d %d %d\n",a1,b1,c1);
    }

    return 0;




}



Measured memory_bytes: 2040
#include <stdio.h>
 
int main(void){
  int i,j,n,taro_p=0,hana_p=0;
  char taro[101], hana[101];
 
  scanf("%d", &n);
 
  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);
 
    for(j=0;;j++){
      if(taro[j] > hana[j]){
        taro_p += 3;
        break;
      }else if(taro[j] < hana[j]){
        hana_p += 3;
        break;
      }else if(taro[j] + hana[j] == 0){
        hana_p++;
        taro_p++;
        break;
      }
    }
  }
 
  printf("%d %d\n", taro_p , hana_p);
  return 0;
}


Measured memory_bytes: 2060
#include <iostream>
using namespace std;
int main(){
  char str[100000] = {0};
  cin >> str;
  for(int i = 0; str[i] != 0; i++){
    if(i % 2 == 1 && str[i] == 'R'){
      cout << "No" << endl;
      return 0;
    }else if(i % 2 == 0 && str[i] == 'L'){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 384
import math

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

hour_degree = 30 * h + 0.5 * m
minute_degree = 6 * m

theta_degree = abs(hour_degree - minute_degree)
theta_rad = math.radians(theta_degree)

print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(theta_rad)))


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"     
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

const int mod=1e9+7;
const int N=21;

int cache[22][(1<<N)+5];
int n;
int a[22][22];

int dp(int pos,int mask)
{
     if(pos==n+1)
          return 1;
     int &ans=cache[pos][mask];     
     if(ans!=-1)
          return ans;
     ans=0;     
     for(int i=0;i<n;i++)
     {
          if(mask&(1<<i) && a[pos][i+1])
               ans=(ans+dp(pos+1,mask&(~(1<<i))))%mod;
     }
     return ans;
}

int32_t main()
{
     memset(cache,-1,sizeof cache);
     cin>>n;
     for(int i=1;i<=n;i++)
     {
          for(int j=1;j<=n;j++)
               cin>>a[i][j];
     }
     cout<<dp(1,(1<<n)-1);
}

Measured memory_bytes: 360704
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		ArrayList<Integer>[] list = new ArrayList[3*n+1];
		for(int i = 1; i <= 3*n; i++){
		    list[i] = new ArrayList<Integer>();
		}
		for(int i = 0; i < m; i++){
		    int from = sc.nextInt();
		    int to = sc.nextInt();
		    list[from].add(to + n);
		    list[from + n].add(to + 2*n);
		    list[from + 2*n].add(to);
		}
		int s = sc.nextInt();
		int t = sc.nextInt();

		// 計算
		int result = -1;
		ArrayDeque<Integer> ad = new ArrayDeque<Integer>();
		int[] visited = new int[3*n+1];
		Arrays.fill(visited, Integer.MAX_VALUE);
		ad.add(s);
		visited[s] = 0;
		while(!ad.isEmpty()){
		    Integer now = ad.poll();
		    for(Integer i : list[now]){
		        int before = visited[i];
		        visited[i] = min(visited[i], visited[now]+1);
		        if(before != visited[i]) ad.add(i);
		        if(i == t) break;
		    }
		}
		if(visited[t] != Integer.MAX_VALUE) result = visited[t]/3;

		// 出力
		System.out.println(result);

	}
}


Measured memory_bytes: 121120
N, M = input().split()
N = int(N)
M = int(M)
numbers = input().split()
numbers = [int(n) for n in numbers]
thresh = sum(numbers)/(4*M)
selected = list(filter(lambda x: x >= thresh, numbers))
if len(selected) >= M:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
n = int(input())
x = [int(i) for i in input().split()]

m = 100000000
ans = 0

for p in range(min(x), max(x)+1):
    ans = 0

    for i in range(len(x)):
        ans += (x[i] - p) ** 2

    if ans < m:
        m = ans


print(m)


Measured memory_bytes: 3060
<?php
$n = trim(fgets(STDIN));
        $s = trim(fgets(STDIN));

        $n  = $n % 26;
        $arr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
        $flipped = array_flip($arr);
        $ans = '';

        for ($i = 0; $i < strlen($s); $i++) {
            $ans .= $arr[($flipped[$s[$i]] + $n) % 26];
        }

        echo $ans;


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
void fastio(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(0);
	 cout.tie(0);
}
int main() {
	fastio();
	string s;
	ll n,a;
	cin>>n>>a;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		if(i==a-1)
		s[i]=tolower(s[i]);
	}
	cout<<s;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dd[1000005]={0};
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	int a[n];
	for(auto &x:a) cin >> x;
	int u=1000005;
	vector<int> least_prime(1000005, 0); 
  
    // We need to print 1 for 1. 
    least_prime[1] = 1; 
  
    for (int i = 2; i <= u; i++) 
    { 
        // least_prime[i] == 0 
        // means it i is prime 
        if (least_prime[i] == 0) 
        { 
            // marking the prime number 
            // as its own lpf 
            least_prime[i] = i; 
  
            // mark it as a divisor for all its 
            // multiples if not already marked 
            for (int j = 2*i; j <= u; j += i) 
                if (least_prime[j] == 0) 
                   least_prime[j] = i; 
        } 
    }
    int ok=1;
    int done[1000005]={0};

		for(auto x:a){
			vector<int> temp;
			while (x != 1) 
			{
				if(dd[least_prime[x]]==0){
					//cout << least_prime[x] << " ";
					temp.push_back((least_prime[x]));
				}
				dd[least_prime[x]]=1;
        x = x / least_prime[x];
			}
			for(auto &y:temp){
				done[y]++;
				dd[y]=0;
				if(done[y]>1) ok=0;
			}
			//cout << endl;
		}
		
    int gc=a[0];
    for(auto x:a){
			gc = gcd(gc, x);
    }

		//cout << gc << endl;
    if(gc>1) cout << "not coprime" << endl;
    else if(gc==1 && ok==1) cout << "pairwise coprime" << endl;
    else if(gc==1 && ok==0) cout << "setwise coprime" << endl;
}


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

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

    int ans = 0;
    for (int i = 0; i < 1000; i++) {
        string num = "";
        int x = i;
        for (int j = 0; j < 3; j++) {
            num = (char)('0' + x % 10) + num;
            x /= 10;
        }

        int k = 0;
        for (int j = 0; j < N; j++) {
            if (S[j] == num[k]) k++;
        }
        
        if (k == 3) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3672
#include<set>
#include<map>
#include<cmath>
#include<deque>
#include<stack>
#include<ctime>
#include<queue>
#include<vector>
#include<cstdio>
#include<ctime>
#include<cstring>
#include<climits>
#include<iostream>
#include<algorithm>
#define LL long long
#define ULL unsigned long long
using namespace std;
LL read(){
	LL f=1,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
#define MAXN 200000
#define INF 0x3f3f3f3f
LL a[MAXN+5],b[MAXN+5];
int pre[MAXN+5],nxt[MAXN+5];
priority_queue<pair<LL,int> > Q;
int main(){
	//freopen("hopeless.in","r",stdin);
	//freopen("hopeless.out","w",stdout);
	int n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	for(int i=1;i<=n;i++)
		b[i]=read(),Q.push(make_pair(b[i],i));
	for(int i=1;i<=n;i++)
		pre[i]=i-1,nxt[i]=i+1;
	pre[1]=n,nxt[n]=1;
	LL ans=0;
	while(!Q.empty()){
		int u=Q.top().second;Q.pop();
		if(a[u]==b[u]) continue;
		if(b[u]<b[pre[u]]+a[u]+b[nxt[u]]){
			puts("-1");
			return 0;
		}
		ans+=(b[u]-a[u])/(b[pre[u]]+b[nxt[u]]);
		b[u]=(b[u]-a[u])%(b[pre[u]]+b[nxt[u]])+a[u];
		Q.push(make_pair(b[u],u));
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
	int a[100];
	int i = 0;
	while (cin >> a[i]){
		if (a[i] == 0){
			int j = i;
			while (1){
				j--;
				if (a[j] != 0){
					cout << a[j] << endl;
					a[j] = 0;
					break;
				}
			}
		}
		i++;
	}
	
	return 0;
}


Measured memory_bytes: 3056
s = input()

hoge = {}
for i in range(len(s)):
    if s[i] in hoge:
        hoge[s[i]] += 1
    else:
        hoge[s[i]] = 1

if len(hoge) == 2:
    ok = True
    for v in hoge.values():
        if v != 2:
            ok = False
            break
    
    if ok:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;


signed main(){
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    vector<string> queries(Q);
    int reverseCnt = 0;
    rep(i,0,Q) {
        string line;
        while (line.empty()) getline(cin, line);
        queries[i] = line;
        istringstream ss(line);
        int type;
        ss >> type;
        if (type == 1) {
            reverseCnt++;
        }
    }
    string reversedHead, tail;
    if (reverseCnt % 2 == 1) {
        reverse(all(S));
    }
    rep(i,0,Q) {
        istringstream ss(queries[i]);
        int type, f;
        char c;
        ss >> type >> f >> c;
        if (type == 1) {
            reverseCnt--;
            continue;
        }
        if ((f + reverseCnt % 2) % 2 == 1) {
            reversedHead.push_back(c);
        } else {
            tail.push_back(c);
        }
    }
    reverse(all(reversedHead));
    cout << reversedHead << S << tail << endl;
    return 0;
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; ++i) cin >> d[i];

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
int ceil(int a,int b){
    return (a+b-1)/b;
}
int main(void){
    int n,a,b;
    cin>>n>>a>>b;
    int sum=0;
    rep(i,n+1){
        int copy1=i;
        int copy2=i;
        int msum=0;
        while(copy2>0){
            msum+=copy2%10;
            copy2=copy2/10;
        }
        if(msum>=a && msum<=b) sum+=copy1;
    }
    cout<<sum<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  int a;
  cin>>a;
  int sum=0;
  rep1(i,a){
    for(int j=0;j<=a;j+=i){
    sum+=j;
    }
  }
  cout<<sum;
}   

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.reflect.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        if ( x < a){
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}

Measured memory_bytes: 22868
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  long double r; cin >> r;
  long double pi = 3.1415926535;
  long double ans = 2*pi*r;
  cout << ans;

  

  return 0;
}

Measured memory_bytes: 3808
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var t=sc.S;
		long p=0;
		for(int i = 0;i<t.Length;i++) {
			p+=t[i]-'0';
			p%=9;
		}
		Console.WriteLine("{0}",p==0?"Yes":"No");
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 26552
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using lb = long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/*-------------ここまで---------------------------------------------*/
int main(){
    int k;
    cin >> k;
    if (k % 2 == 1) cout << (k / 2) * ((k / 2) + 1) << endl;
    else cout << k / 2 * k / 2 << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd); FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    cout << s.substr(0, s.size() - 8) << '\n';
}


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

int main(void){
	int x, i=1, n;
	cin >>n;
	while(i<=n){
		x=i;
		if(x%3==0){
			cout <<" " <<i;
			i++;
		}else if(x%10==3){
			cout <<" " <<i;
			i++;
		}else{
			while(x){
				x/=10;
				if(x%10==3){
					cout <<" " <<i;
					break;
				}
			}
			i++;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1168
package main

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

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInts() (int,int) {
  var n,m int
  var s []string = strings.Split(NextLine()," ")
  n,_ = strconv.Atoi(s[0])
  m,_ = strconv.Atoi(s[1])
  return n,m
}
func NextIntArray() []int {
  var s []string = strings.Split(NextLine()," ")
  var n int = len(s)
  var a []int = make([]int,n)
  for i:=0;i<n;i++ {
    a[i],_ = strconv.Atoi(s[i])
  }
  return a
}

func main() {
  var n,m int = NextInts()
  var a []int = NextIntArray()
  var s int = 0
  var k int64 = 0
  c := map[int]int64{}
  c[0]++
  for i:=0;i<n;i++ {
    s = (s+a[i])%m
    c[s]++
  }
  for _,v := range c {
    k += (v*(v-1))/2
  }
  fmt.Println(k)
}

Measured memory_bytes: 9728
A, B = map(int, input().split())

if B == 1:
    print("0")
if B != 1:
    if (B-1) % (A-1) ==0:
        print((B-1)//(A-1))
    if (B-1) % (A-1) != 0:
        print(-(-(B-1)//(A-1)))

Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
    int D;

    scanf("%d", &D);

    switch (D) {
        case 25:
            printf("Christmas\n");
            break;
        case 24:
            printf("Christmas Eve\n");
            break;
        case 23:
            printf("Christmas Eve Eve\n");
            break;
        case 22:
            printf("Christmas Eve Eve Eve\n");
            break;
        default:
            break;
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long N;
    cin >> N;
    if(N % 2 == 0) cout << fixed << setprecision(10) << (N/2.0)/N << endl;
    else cout << fixed << setprecision(10) << (N/2+1.0)/N << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {

    vector<int> fourth_powers;
    FOR(i, 1, 1000) {
        int fourth_power = i * (i + 1) * (i + 2) / 6;
        if(fourth_power >= 1e6) break;
        fourth_powers.push_back(fourth_power);
    }
    vector<int> dp(1000005, 1e9), dp_odd(1000005, 1e9);
    
    dp[0] = 0;
    dp_odd[0] = 0;
    dp[1] = 1;
    dp_odd[1] = 1;

    FOR(i, 0, 1e6 + 2) {
        for(int x: fourth_powers) {
            if(i + x > 1e6) continue;
            dp[i + x] = min(dp[i + x], dp[i] + 1);
            if(x % 2 == 1)
                dp_odd[i + x] = min(dp_odd[i+x], dp_odd[i] + 1);
        }
    }

    // FOR(i, 1, 20) cerr << dp[i] << " " << dp_odd[i] << endl;

    while(true) {
        int N;
        cin >> N;
        if(N == 0) break;
        cout << dp[N] << " " << dp_odd[N] << endl;
    }
    return 0;
}


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

using namespace std;

vector<int> g[222222];
int f(int s, int p, int &u) {
	int m = -1;
	u = s;
	for (auto i : g[s]) {
		if (i == p) continue;
		int v;
		int j = f(i, s, v);
		if (m < j) m = j, u = v;
	}
	return m + 1;
}
int main() {
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int u, v;
	f(1, 0, u);
	int c = f(u, 0, v);
	cout << (c % 3 == 1 ? "Second" : "First") << endl;
	return 0;
}


Measured memory_bytes: 27392