akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#define N 2
using namespace std;

int main() {
  typedef long long ll;
  ll X, Y;
  scanf("%lld %lld",&X,&Y);
  vector<ll> A;
  for (ll i=X; i<=Y; i*=N) {
    A.push_back(i);
  }
  printf("%d\n",A.size());
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int x1, x2;
    
    scanf("%d%d", &x1, &x2);
    
    if (x1 > x2){
        printf("%d\n", x1 - x2);
    }
    else {
        printf("%d\n", x2 - x1);
    }
    return (0);
}



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

int main(){
    int arr[3];
    cin>>arr[0]>>arr[1]>>arr[2];
    sort(arr,arr+3);
    if((arr[0]+arr[1])==arr[2]){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	ll k;
	cin>>n>>k;
	ll a[200020];
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	sort(a, a+n);
	ll l=-1e18, r=1e18;
	l--; r++;
	while(r-l>1){
		ll m=(l+r)/2;
		ll cnt=0;
		for(int i=0; i<n; i++){
			if(a[i]==0){
				if(0<=m) cnt+=n-i-1;
			}else if(a[i]>0){
				ll x;
				if(m<0) x=-((-m+a[i]-1)/a[i]);
				else x=m/a[i];
				int j=upper_bound(a, a+n, x)-a;
				cnt+=max(j-i-1, 0);
			}else{
				ll x;
				if(m<0) x=((-m-a[i]-1)/(-a[i]));
				else x=-(m/(-a[i]));
				int j=lower_bound(a, a+n, x)-a;
				cnt+=min(n-i-1, n-j);
			}
		}
		if(cnt>=k) r=m;
		else l=m;
	}
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	class S implements Comparable<S> {
		int t;
		int c;
		int time2;

		S(int t, int c) {
			this.t = t;
			this.c = c;
		}

		public int compareTo(S tar) {
			return t - tar.t;
		}
	}

	void run() {
		for (;;) {
			int n = sc.nextInt();

			if (n == 0) {
				break;
			}

			S[] s = new S[n];

			for (int i = 0; i < n; i++) {
				int t = sc.nextInt();
				int c = sc.nextInt();
				s[i] = new S(t, c);
			}

			Arrays.sort(s);

			int time = 0;
			// forward
			LinkedList<S> fw = new LinkedList<S>();
			// backward
			LinkedList<S> bw = new LinkedList<S>();

			for (int i = 0; i < n; i++) {
				fw.add(s[i]);
			}

			int time2[] = new int[n];
			int ans = 0;
			for (;;) {
				if (fw.isEmpty() && bw.isEmpty()) {
					break;
				}

				if (!fw.isEmpty()) {
					// waiting to back
					LinkedList<S> wfb = new LinkedList<S>();

					while (!fw.isEmpty()&& fw.getFirst().time2 >= fw.getFirst().t) {
						S g = fw.pollFirst();
						g.time2 = 0;
						wfb.addLast(g);
					}

					Collections.sort(wfb);
					bw.addAll(wfb);
				}
				if (!bw.isEmpty()) {
					// waiting to forward
					LinkedList<S> wbf = new LinkedList<S>();

					while (!bw.isEmpty() && bw.getFirst().time2 >= bw.getFirst().t) {
						S g = bw.pollFirst();
						g.time2 = 0;
						g.c--;
						if (g.c != 0) {
							wbf.addLast(g);
						}
					}

					Collections.sort(wbf);
					fw.addAll(wbf);
				}
				for (S a : fw) {
					a.time2++;
				}
				for (S a : bw) {
					a.time2++;
				}
				ans++;
			}
			System.out.println(ans-1);
		}
	}

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

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

template<typename integer>
integer __lcm(integer a, integer b) {
  return (a * b) / __gcd(a, b);
}

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<int>> c;
  vector<vector<int>> A;

  c.resize(10);
  rep (i, 10) c[i].resize(10);
  rep (i, 10) rep (j, 10) cin >> c[i][j];

  A.resize(H);
  rep (i, H) A[i].resize(W);
  rep (i, H) rep (j, W) cin >> A[i][j];

  rep (k, 10) {
    rep (i, 10) {
      rep (j, 10) {
        if (i == j) continue;
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }

  int start_node;
  long long ans = 0;

  rep (i, H) {
    rep (j, W) {
      start_node = A[i][j];
      if (start_node == -1) continue;
      ans += c[start_node][1];
    }
  }

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



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

using P = pair<int, int>;
int h, w;
int d[4] = {1, 0, -1, 0};
vector<string> s, red, blue;

bool isvalid(P now) {
  return now.first >= 0 && now.first < h && now.second >= 0 && now.second < w;
}

int main() {
  cin >> h >> w;
  s.resize(h);
  for (auto &t : s) cin >> t;
  red = blue = s;
  // red
  {
    for (int i = 0; i < h; ++i) {
      if (i & 1)
        red[i][0] = '#';
      else
        for (int j = 0; j < w - 1; ++j) red[i][j] = '#';
    }
  }
  // blue
  {
    for (int i = 0; i < h; ++i) {
      if (i & 1)
        for (int j = 1; j < w; ++j) blue[i][j] = '#';
      else
        blue[i][w - 1] = '#';
    }
  }
  for (auto &t : red) cout << t << endl;
  cout << endl;
  for (auto &t : blue) cout << t << endl;
  // check
  {
    for (int i = 0; i < h; ++i)
      for (int j = 0; j < w; ++j) {
        bool ch = 1;
        if (s[i][j] == '#')
          ch = ch && blue[i][j] == red[i][j] && red[i][j] == '#';
        else
          ch = ch && (blue[i][j] == '.' || red[i][j] == '.');
        assert(ch);
      }
  }
  return 0;
}


Measured memory_bytes: 4664
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = float("INF")
b = [float("INF")]*N
for k in range(N):
    temp_ans = k*x
    for i in range(N):
        t = a[i-k]
        if t < b[i]:
            b[i] = t
        temp_ans += b[i]
    ans = min(ans,temp_ans)
print(ans)


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

int main(){
  ll X;
  cin >> X;
  int year = 0;
  ll money = 100;
  while(money < X){
    money = money * 1.01;
    year++;
  }
  cout << year << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#define REP(i, a, n) for(int i = a; i < n; i++)
using namespace std;


int n, s;
int north, east, south, west, top, bottom, temp;
string dir;

int main(void) {
  while(1) {
    cin >> n;
    if(n == 0) break;

    s = 1;
    top = 1; south = 2; east = 3; west = 4; north = 5; bottom = 6;

    REP(i, 0, n) {
      cin >> dir;
      if(dir == "North") { temp = bottom; bottom = north; north = top; top = south; south = temp; }
      if(dir == "East")  { temp = bottom; bottom = east; east = top; top = west; west = temp; }
      if(dir == "South") { temp = bottom; bottom = south; south = top; top = north; north = temp; }
      if(dir == "West")  { temp = bottom; bottom = west; west = top; top = east; east = temp; }
      if(dir == "Right") { temp = north; north = west; west = south; south = east; east = temp; }
      if(dir == "Left")  { temp = north; north = east; east = south; south = west; west = temp; }
      s += top;
    }

    cout << s << endl;
  }

  return 0;
}

Measured memory_bytes: 1208
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	vector<int> d(M); rep(i, 0, M) { cin >> d[i]; }
	vector<int>dp(N + 1,INF);
	dp[0] = 0;
	rep(i, 0, M)rep(j, d[i], N + 1)
		chmin(dp[j], dp[j - d[i]] + 1);
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 3244
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        x: usize,
    }
    let mut money = 100;
    let mut ans = 0;

    loop {
        money += money / 100;
        ans += 1;
        if x <= money {
            break;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2204
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  // ll INF = INT_MAX;
  // ll mod = 1000000007;
  // lld PI = 3.141592653;
 
// const int N = 2e5 + 5;

vector<int> a;
int n,k;
int search(int l, int r){
  if (r==l) return l;
  int mid = (l+r)/2;
  
  int need = 0;
  for (int i = 0;i<n;i++){
    if (a[i]<=mid) continue;
     need += (a[i]-1)/mid;
  }
  // cout<<"--\n";
  // cout<<l<<" "<<r<<endl;
  // cout<<mid<<endl;
  // cout<<need<<endl;
  // cout<<"--\n";
  if (need<=k){
   return search(l, mid);
  }else{
    return search(mid+1, r);
  }

} 

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      // ifstream cin("input.txt");


     cin>>n>>k;
     a = vector<int>(n);
     for (int i =0;i<n;i++) cin>>a[i];
      // sort(a.rbegin(), a.rend());
      cout<< search(1, 1000000004)<<"\n";
    
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<int> (a)((n))
using namespace std;
signed main(){
	int n,ans=0;
	cin >> n;
	while(n != 0){
		int a = n%10;
		ans += a;
		n/=10;
	}
	if(ans == 1){
		ans = 10;
	}
	cout << ans << endl;
 
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; 
    cin >> n;

    vector<vector<int>> M(n, vector<int>(n));
    vector<pair<int,int>> pos(n * n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            M[i][j] = i * n + (j + 1);
            --M[i][j];
            pos[M[i][j]] = make_pair(i, j);
        }
    }

    vector<int> X{-1, 1, 0, 0};
    vector<int> Y{0, 0, -1, 1};
    int N = n * n;
    vector<vector<int>> graph(N + 1);
    for (int i = 0; i < N; ++i) {
        int x = pos[i].first, y = pos[i].second;
        // if (x == 0 || y == 0) {
        //     graph[N].push_back(i);
        //     graph[i].push_back(N);
        // }
        for (int j = 0; j < X.size(); ++j) {
            int nx = x + X[j], ny = y + Y[j];
            if (nx >= 0 && nx < n && ny >= 0 && ny < n) {
                graph[i].push_back(M[nx][ny]);
            }
        }
    }

    const int INF = 1 << 20;
    vector<int> dis(N + 1, INF);
    // dis[N] = 0;
    for (int i = 0; i < N; ++i) {
        int x = pos[i].first, y = pos[i].second;
        dis[i] = min(min(x, n - 1 - x), min(y, n - 1 - y));
    }

    vector<bool> inQueue(N, false);
    vector<bool> chged(N + 123, false);
    vector<int> W(N, 1);
    long long res = 0;
    for (int i = 0; i < N; ++i) {
        int s;
        cin >> s;
        --s;
        res += dis[s];

        W[s] = 0;
        queue<int> que;
        que.push(s);
        inQueue[s] = true;
        while (!que.empty()) {
            int u = que.front();
            que.pop();
            inQueue[u] = false;
            for (auto v : graph[u]) {
                if (dis[v] > dis[u] + W[u]) {
                    dis[v] = dis[u] + W[u];
                    if (!inQueue[v]) {
                        que.push(v);
                        inQueue[v] = true;
                    }
                }
            }
        }
    }

    cout << res << '\n';


    return 0;
}

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

#define debug(x) (cerr << #x << " = " << x << endl;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c)

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}


int main()
{
  ios::sync_with_stdio(0);
  int n,m;
  cin >> n >> m;
  int sum = 0;
  for(int i = 1; i <= m ; i++)
  {
    int a;
    cin >> a;
    sum += a;
  }
  cout << (n - sum >= 0 ? n - sum : -1) << endl;
  return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

constexpr ll MOD = 998244353;
int N, S;
int A[3100];
ll dp[3100][3100];

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

  std::cin >> N >> S;

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

  ll res = 0;

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

      for(int j=0;j+A[i]<=S;++j){
          dp[i+1][j+A[i]] = (dp[i+1][j+A[i]] + dp[i][j]) % MOD;
      }

      dp[i+1][A[i]] = (dp[i+1][A[i]] + i + 1) % MOD;

      // for(int j=0;j<=S;++j){
      //     std::cout << dp[i+1][j] << " ";
      // }
      // std::cout << std::endl;

      ll x = dp[i+1][S] - dp[i][S];
      if(x < 0){
          x += MOD;
      }

      res = (res + x * (N - i) % MOD) % MOD;
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 73984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    WordGraph root = new WordGraph();
		
		try {
			int lim = Integer.parseInt(in.readLine());
			
			for (int i = 0; i < lim; i++) {
				String[] param = in.readLine().split(" ");
				
				if (param[0].equals("insert")) {
					root.add(param[1]);
				} else {
					if (root.search(param[1]) == true) System.out.println("yes");
					else System.out.println("no");
				}
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

class WordGraph {
	private static final int A = 0;
	private static final int C = 1;
	private static final int G = 2;
	private static final int T = 3;
	
	private boolean set;
	private WordGraph[] wg = null;
	
	public WordGraph() {
		set = false;
		wg = new WordGraph[4];
	}
	
	public void add(String param) {
		if (param.length() == 0) {
			set = true;
			return;
		}
		char c = param.charAt(0);
		
		switch (c) {
		case 'A':
			if (wg[A] == null) wg[A] = new WordGraph();
			wg[A].add(param.substring(1));
			break;
		case 'C':
			if (wg[C] == null) wg[C] = new WordGraph();
			wg[C].add(param.substring(1));
			break;
		case 'G':
			if (wg[G] == null) wg[G] = new WordGraph();
			wg[G].add(param.substring(1));
			break;
		case 'T':
			if (wg[T] == null) wg[T] = new WordGraph();
			wg[T].add(param.substring(1));
			break;
		}
	}
	
	public boolean search(String param) {
		if (param.length() == 0) return set;
		char c = param.charAt(0);
		
		switch (c) {
		case 'A':
			if (wg[A] == null) return false;
			return wg[A].search(param.substring(1));
		case 'C':
			if (wg[C] == null)  return false;
			return wg[C].search(param.substring(1));
		case 'G':
			if (wg[G] == null)  return false;
			return wg[G].search(param.substring(1));
		case 'T':
			if (wg[T] == null)  return false;
			return wg[T].search(param.substring(1));
		}
		
		return false;
	}
}

Measured memory_bytes: 284760
//after reading the solution
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int n, s;
int ret[505][505];

int main()
{
	scanf("%d", &n);
	if(n == 1) {
		printf("1\n1\n");
		return 0;
	}
	s = (n + 1) / 2;
	s = s + s % 2;
	rep(i, s) rep(j, s) ret[i][j] = (i + j) % s + (i % 2) * s;
	rep(i, s) rep(j, s) if(ret[i][j] >= n) ret[i][j] -= s;
	printf("%d\n", s);
	rep(i, s) {
		rep(j, s) printf("%d ", ret[i][j] + 1);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2176
import sys
S=sys.stdin.readlines()
N,M=map(int,S[0].split())
G=[]
a,b,c=0,0,0
for i in range(M):
  a,b,c=map(int,S[i+1].split())
  G.append((a-1,b-1,-c))
INF=10**15
D=[INF]*N
D[0]=0
e=0
for i in range(N-1):
  for j in range(M):
    e=G[j]
    if D[e[0]]!=INF and D[e[1]]>D[e[0]]+e[2]:
      D[e[1]]=D[e[0]]+e[2]
X=D[N-1]
for j in range(M):
  e=G[j]
  if D[e[0]]!=INF and D[e[1]]>D[e[0]]+e[2]:
    D[e[1]]=D[e[0]]+e[2]
if X==D[N-1]:
  print(-X)
else:
  print('inf')

Measured memory_bytes: 74224
from collections import Counter
from itertools import combinations

N = int(input())
cheack = list('MARCH')
S = []
for _ in range(N):
    s = input()
    if s[0] in cheack:
        S.append(s[0])

C = Counter(S)
ans = 0
keys = C.keys()
if len(C.values()) >= 3:
    for comb in combinations(keys, 3):
        tmp = 1
        for i in comb:
            tmp *= C[i]
        ans += tmp
else:
    ans = 0
print(ans)

Measured memory_bytes: 4224
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
n, m, k = map(int, input().split())
uf = UnionFind(n)
E = [[] for i in range(n)]
num_E = [0]*n
E_d = [[] for i in range(n)]

import sys
input = sys.stdin.readline

for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  uf.union(a, b)
  num_E[a] += 1
  num_E[b] += 1

for i in range(k):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  E_d[a] = E_d[a] + [b]
  E_d[b] = E_d[b] + [a]

num_men = [0]*n
for i in range(n):
  num_men[i] = uf.size(i) - 1
  for dn in E_d[i]:
    if uf.same(i, dn):
      num_men[i] -= 1
  num_men[i] -= num_E[i]
      
print(*num_men)
  

Measured memory_bytes: 121008
# AOJ0003 Is it a Right Triangle?
# right triangle: 直角三角形

lines = ARGF.gets.to_i
lines.times do
  a, b, c = ARGF.gets.split(" ").map {|x| x.to_i}.sort
  puts (c * c == a * a + b * b) ? "YES" : "NO"
end

Measured memory_bytes: 6108
#include<iostream>

using namespace std;

int main()
{
  int n,sum=0;
  cin>>n;
  int a[n];
  for(auto i=0 ; i<n ; i++)
    scanf("%d",&a[i]);
  for(auto i=0 ; i<n ;i++)
    for(auto j=0 ; j<n ; j++)
    {
      if(i==j)
        continue;
      sum = sum + a[i]*a[j];
    }

  cout<<sum/2;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>

//#include <map>

using namespace std;

int main()
{
	vector<string> vStr;

	while (1)
	{	
		string st;
		getline(cin, st);
		if (st == string("0 0"))break;
		vStr.push_back(st);
	}

	for (int i = 0; i < vStr.size(); i++)
	{
		vector<int> tv;

		while (vStr.at(i).find(' ') != -1)
		{
			tv.push_back(stoi(vStr.at(i).substr(0, vStr.at(i).find(' '))));
			vStr.at(i).erase(0, vStr.at(i).find(' ') + 1);
		}
		tv.push_back(stoi(vStr.at(i)));
		vStr.at(i) = "";
		
		sort(tv.begin(), tv.end());

		for (int j = 0;; j++)
		{
			char ch[20];
			sprintf(ch, "%d", tv.at(j));
			vStr.at(i) += ch;
			if (j == tv.size() - 1)break;
			vStr.at(i) += " ";
		}
	}

	for (int i = 0; i < vStr.size(); i++)
	{
		cout << vStr.at(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 3336
#include<iostream>
#include<vector>
#include<set>

int main(void){
    std::vector<std::vector<int>> a(3);
    std::set<int> b;
    for(int i = 0; i < 3; i++){
	a[i].resize(3);
	for(int j = 0; j < 3; j++){
	    std::cin >> a[i][j];
	}
    }
    int n;
    std::cin >> n;
    for(int i = 0; i < n; i++){
	int tmp;
	std::cin >> tmp;
	b.insert(tmp);
    }

    bool flag;
    for(int i = 0; i < 3; i++){
	flag = 1;
	for(int j = 0; j < 3; j++){
	    if(b.find(a[i][j]) == b.end()){
		flag = 0;
		break;
	    }
	}
	if(flag == 1){
	    std::cout << "Yes" << std::endl;
	    return 0;
	}
    }

    for(int i = 0; i < 3; i++){
	flag = 1;
	for(int j = 0; j < 3; j++){
	    if(b.find(a[j][i]) == b.end()){
		flag = 0;
		break;
	    }
	}
	if(flag == 1){
	    std::cout << "Yes" << std::endl;
	    return 0;
	}
    }

    for(int i = 0; i < 3; i++){
	flag = 1;
	if(b.find(a[i][i]) == b.end()){
	    flag = 0;
	    break;
	}
    }
    if(flag == 1){
	std::cout << "Yes" << std::endl;
	return 0;
    }

    for(int i = 0; i < 3; i++){
	flag = 1;
	if(b.find(a[i][2-i]) == b.end()){
	    flag = 0;
	    break;
	}
    }
    if(flag == 1){
	std::cout << "Yes" << std::endl;
	return 0;
    }

    std::cout << "No" << std::endl;
    return 0;
}



Measured memory_bytes: 3612
n,k = map(int,input().split())
p = 0
q = 0
if n - k >= 0:
    p = (n - k + 1)/n
    j = 0
    for i in range(1,k):
        while k - i*(2)**j >0:
            j += 1
        q += (1/n)*(1/2)**j
        j = 0
else:
    j = 0
    for i in range(1,n+1):
        while k - i*(2)**j >0:
            j += 1
        q += (1/n)*(1/2)**j
        j = 0
print(p+q)



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

const long long INF = 1LL<<60;

int main(){
    int n,k;
    cin >> n >> k;
    int h[n];
    for(int i=0;i<n;i++)
        cin >> h[i];

    long long dp[n];
    long long m;
    dp[0] = 0;
    for(int i=1;i<n;i++){
        m=INF;
        for(int j=1;j<=k;j++){
            if(i-j>=0)
                m = min(m,dp[i-j]+abs(h[i]-h[i-j]));
        }
        dp[i] = m;
    }

    cout << dp[n-1];

    return 0;
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll unsigned long long
#define fl long double
#define pb push_back
#define mk make_pair
#define endl "\n"
#define ff first
#define ss second
#define mt make_tuple
#define np next_permutation
#define mod 998244353
#define pi 3.141592653589793238
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}

int main()
{
    fastio;
    ll i,j,k,n,m,t;
    cin>>n;
    ll a[n];
    ll flg=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            flg=1;
        }
    }
    sort(a,a+n);
    ll ans=1;
    fl an=1;
    if(flg==1)
    {
        cout<<0<<endl;
        return 0;
    }
    for(i=0;i<n;i++)
    {
        ans=ans*a[i];
        an=an*a[i];
        if(an>1e18)
        {
            cout<<-1<<endl;
            return 0;
        }
        if(ans>1e18)
        {
            cout<<-1<<endl;
            return 0;
        }
    }

    if(ans>1e18)
    {
        cout<<-1<<endl;
        return 0;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4424
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		List<Integer> list = new ArrayList<Integer>();
		for(int i = 3; i <= n; i++) {
			if(i % 3 == 0) {
				list.add(i);
			}else {
				String num = Integer.toString(i);
				for(int j = 0; j < num.length(); j++) {
					char c = num.charAt(j);
					if(c == '3') {
						list.add(i);
						break;
					}
				}
			}
		}
		for(int i = 0; i < list.size(); i++) {
			System.out.print(" " + list.get(i));
		}
		System.out.println();
	}
}


Measured memory_bytes: 29496
#include "bits/stdc++.h"
using namespace std;

int main() {
	static long long N, A[100000], COUNT = 0, ANSX[100000] = {}, ANSY[100000] = {}, ANSZ[100000] = {};
	vector<long long> VX, VY;
	cin >> N;
	VX.push_back(0);
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) {
		if (VX[COUNT] < A[i]) {
			COUNT++;
			VX.push_back(A[i]);
			VY.push_back(i);
		}
	}
	for (int i = 0; i < N; i++) {
		long long P = lower_bound(VX.begin(), VX.end(), A[i]) - VX.begin() - 1;
		ANSX[P] += A[i] - VX[P];
		ANSY[P]++;
	}
	for (int i = COUNT - 1; i > 0; i--) {
		ANSX[i - 1] += ANSY[i] * (VX[i] - VX[i - 1]);
		ANSY[i - 1] += ANSY[i];
	}
	for (int i = 0; i < COUNT; i++) {
		ANSZ[VY[i]] = ANSX[i];
	}
	for (int i = 0; i < N; i++) {
		cout << ANSZ[i] << endl;
	}
}

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

#define STRING(str) #str

template <typename T >
void print_vec_1d(vector<T> x, string name) {
	cout << name << endl;
	cout << "[ ";
	for (int i=0;i<x.size();i++) {
		cout << x[i];
		if (i != x.size()-1) cout << ", ";
		else cout << " ]" << endl;
	}
}

const long long mod = 1e9+7;

long long modpow(long long a, long long x) {
    long long tmp = x;
    long long val = a;
    long long ret = 1LL;
    while (tmp>0) {
        if (tmp%2 == 1) ret = ret*val%mod;
        val = val*val%mod;
        tmp /= 2;
    }
    return ret;
}


int main() {
	int N;
	cin >> N;
	cout << (modpow(10, N)+modpow(8, N)+mod-modpow(9, N)+mod-modpow(9, N))%mod << endl;
}

Measured memory_bytes: 3620
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#define rep(i,n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
	int N, K;
	cin >> N >> K;
	
	double prob = 0.0;
	
	rep(i, N){
		int score = i+1;
		double chance = 1.0/(double)N;
		while(score < K){
			chance *= 0.5;
			score *= 2;
		}
		prob += chance;
	}
	
	printf("%.10f\n", prob);
	
}

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

dp=[0 for _ in range(n)]

dp[1]=abs(h[1]-h[0])

for i in range(2,n):
  dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])  

Measured memory_bytes: 13980
import java.util.*;
 
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=1; i<n; i++){
			a[i] = sc.nextInt();
		}
		int[] ans = new int[n+1];
		for(int i: a){
			ans[i]++; 
		}
		for(int i=1; i<ans.length; i++){
			System.out.println(ans[i]);
		}

	}
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

#define All(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   string s;cin >> s;
   for(int i=0;i<s.size()-1;i++){
      if(s[i] == 'A' && s[i+1] == 'C'){
         cout << "Yes";
         return 0;
      }
   }
   cout << "No";
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	ll int k,n;
	cin>>k>>n;
	ll a[n];
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	ll l=0;
	ll r=0;
	ll ans=0;
	while((l+1)%n!=r){
		int i=(l+1)%n;
		int j=(r-1+n)%n;
		if(abs(a[i]-a[l])<abs((r==0?k:0)-a[j]+a[r])){
			ans+=abs(a[i]-a[l]);
			l=i;
		}
		else{
			ans+=abs((r==0?k:0)-a[j]+a[r]);
			r=j;
		}
	}
	cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>  
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;
const ll longINF=3e18;
const double eps=1e-8;
const double dinf=190.0;
const double pi=acos(-1);
const int INF=2e9+1;

ll n,a[200005],s[200005],res=longINF;
        
int main() 
{        
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        cin>>n>>a[0];
        s[0]=a[0];
        for (int i=1;i<n;i++) {
                cin>>a[i];
                s[i]=s[i-1]+a[i];
        }
        for (int i=0;i<n-1;i++) 
                res=min(res,abs(s[i]-(s[n-1]-s[i])));
        cout<<res;
        return 0;
}

Measured memory_bytes: 3328
arr = Array.new
while line = $stdin.gets
arr << line.chomp.split(" ").map(&:to_i)
end

ans=Array.new(arr[0][0])
ans.fill(0)
arr.delete_at(0)
arr.length.times{|k|
if k%2!=0
    arr[k].each{|item|
        ans[item-1]+=1
    }
end
}
wa =0
ans.each{|k|
    if k==0 then
        wa+=1
    end
}
puts wa

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

int main()
{
    string a, b, c;
    cin>>a>>b>>c;
    if((a == "" && b == "" && c == "") || (a[a.size()-1] == b[0] && b[b.size() - 1] == c[0])) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val shades = Array.fill(n){
    readLine.trim.split(' ').map(_.toDouble) match {
      case Array(x, y) ⇒
        Coordinate(x / 999900 * 1000000, y / 999900 * 1000000)
      case _ ⇒ ???
    }
  }
  val (upper, lower) = shades.indices.map(i ⇒ Edge(shades(i), shades((i + 1) % n))).partition(c ⇒ c.from.x > c.to.x) match {
    case (u, l) ⇒ (u.sortBy(_.from.x).toArray, l.sortBy(_.to.x).toArray)
  }
  for (_ ← 0 until readInt()) {
    readLine.trim.split(' ').map(_.toDouble) match {
      case Array(x, y) ⇒
        val u = upper.lowerBound{edge ⇒ edge.from.x >= x}
        val l = lower.lowerBound{edge ⇒ edge.to.x >= x}
        println(
          if (u != upper.length && l != lower.length) {
            val up = upper(u)
            val lo = lower(l)
            if (up.isLeftSide(Coordinate(x, y)) && lo.isLeftSide(Coordinate(x, y))) 1 else 0
          }else 0
        )
      case _ ⇒ ???
    }
  }
  implicit class Wrap[T](val array: Array[T]) extends AnyVal {
    @inline def lowerBound(@inline predicate: T ⇒ Boolean): Int = {
      var left = 0
      var right = array.length
      while (left < right) {
        val mid = (left + right) / 2
        if (predicate(array(mid))) right = mid
        else left = mid + 1
      }
      right
    }
  }

}
case class Coordinate(x: Double, y: Double) {
  def -(that: Coordinate): Vector = Vector(x - that.x, y - that.y)
}
case class Edge(from: Coordinate, to: Coordinate) {
  private[this] val vec = to - from
  def isLeftSide(position: Coordinate): Boolean = {
    vec.cross(position - from) >= 0
  }
  def isRightSide(position: Coordinate): Boolean = {
    vec.cross(position - from) <= 0
  }
}
case class Vector(x: Double, y: Double) {
  def dot(that: Vector): Double = x * that.x + y *that.y
  def cross(that: Vector): Double = x * that.y - y * that.x
}


Measured memory_bytes: 174932
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		while(true){
			int n = si();
			if(n==0) break;
			Team[] tm = new Team[n];
			for (int i = 0; i < n; i++) {
				String s = scan.next();
				int wp = 0,lp = 0;
				for (int j = 0; j < n-1; j++) {
					int tmp = si();
					if(tmp==0) wp++;
					if(tmp==1) lp++;
				}
				tm[i] = new Team(s,wp,lp,i);
			}
			Arrays.sort(tm);
			for (int i = 0; i < n; i++) {
				out.println(tm[i].name);
			}
		}
		out.flush();
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
}

class Team implements Comparable<Object> {
	String name;
	int wp,lp,no;
	Team(String p,int q, int r,int s){
		name = p; wp = q;lp = r;no = s;
	}

	public int compareTo(Object o){
		if(this.wp!=((Team)o).wp) return -( this.wp-((Team)o).wp );
		else if(this.lp!=((Team)o).lp) return this.lp-((Team)o).lp;
		else return this.no - ((Team)o).no;
	}
}

Measured memory_bytes: 18992
n=list(input())
k=len(n)-1
x=0
for i in range(2**k):
    v=[""]*k
    for j in range(k):
        if ((i >> j) & 1):
            v[j]="+"
    ans=""
    for a,b in zip(n,v+[""]):
        ans+=(a+b)
    x+=eval(ans)
print(x)

Measured memory_bytes: 3060
<?php
fscanf(STDIN, "%n", $n);
While ($line = fgets(STDIN) ) {
    $stdin[] = trim($line);
}
$s_rsort=$stdin;
rsort($s_rsort);

if($s_rsort[0]==$s_rsort[1]){
  foreach($stdin as $v){
    echo $s_rsort[0],PHP_EOL;
  }
}else{
  foreach($stdin as $v){
    if($v==$s_rsort[0]){
      echo $s_rsort[1],PHP_EOL;
    }else{
      echo $s_rsort[0],PHP_EOL;
    }
  }
}

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

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

    string ans = "No";
    if (str[2] == str[3]) {
        if (str[4] == str[5]) {
            ans = "Yes";
        }
    }

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
int main() {
	long long n, t, a[200010];
	cin >> n >> t;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long ans = 0;
	long long f = 0;
	for (int i = 0; i < n; i++) {
		ans += t;
		if (f > a[i]) {
			ans -= f - a[i];
		}
		f = a[i] + t;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <set>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N, Q;
	cin >> N >> Q;
	vector<int> S(N), T(N), X(N);
	for (int i = 0; i < N; ++i) {
		cin >> S[i] >> T[i] >> X[i];
	}
	vector<int> D(Q);
	for (int i = 0; i < Q; ++i) {
		cin >> D[i];
	}
	vector<int> perm(N);
	for (int i = 0; i < N; ++i) {
		perm[i] = i;
	}
	sort(perm.begin(), perm.end(), [&](int i, int j) { return X[i] < X[j]; });
	vector<int> cp = D;
	for (int i = 0; i < N; ++i) {
		cp.push_back(S[i] - X[i]);
		cp.push_back(T[i] - X[i]);
	}
	sort(cp.begin(), cp.end());
	cp.erase(unique(cp.begin(), cp.end()), cp.end());
	set<int> s;
	for (int i = 0; i < cp.size(); ++i) {
		s.insert(i);
	}
	vector<int> val(cp.size(), -1);
	for (int i : perm) {
		int pl = lower_bound(cp.begin(), cp.end(), S[i] - X[i]) - cp.begin();
		int pr = lower_bound(cp.begin(), cp.end(), T[i] - X[i]) - cp.begin();
		set<int>::iterator it = s.lower_bound(pl);
		while (it != s.end() && *it < pr) {
			val[*it] = X[i];
			it = s.erase(it);
		}
	}
	for (int i = 0; i < Q; ++i) {
		int ptr = lower_bound(cp.begin(), cp.end(), D[i]) - cp.begin();
		cout << val[ptr] << '\n';
	}
	return 0;
}

Measured memory_bytes: 39648
#pragma GCC optimize(3)
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N=1e3+5;
const double eps=1e-10;
const int inf=1000000000;
vector<int>g[N],ans,res;
int pre[N],vis[N];
void bfs(int s)
{
    res.clear();
    memset(vis,0,sizeof vis);
    memset(pre,0,sizeof pre);
    queue<int>que;
    que.push(s);
    int f=0;
    while(!que.empty()){
        int now=que.front();//cout<<now<<endl;
        que.pop();
        for(int t:g[now]){
            if(vis[t])continue;
            pre[t]=now;
            que.push(t);
            vis[t]=1;
        }
        if(vis[s]){
            f=1;
            break;
        }
    }
    if(!f)return ;
    int t=s;
    res.push_back(s);
    while(pre[t]!=s){
        t=pre[t];
        res.push_back(t);
    }return ;
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n+1;i++)ans.push_back(1);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].push_back(v);
    }
    for(int i=1;i<=n;i++){
        bfs(i);//cout<<res.size()<<endl;
        if(res.size()&&res.size()<ans.size())
            ans=res;
    }
    if(ans.size()==n+1)printf("-1\n");
    else{
        sort(ans.begin(),ans.end());
        cout<<ans.size()<<endl;
        for(int t:ans){
            cout<<t<<endl;
        }
    }
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	if(n == 25){
		cout << "Christmas\n";
	}else if(n == 24){
		cout << "Christmas Eve\n";
	}else if(n == 23){
		cout << "Christmas Eve Eve\n";
	}else{
		cout << "Christmas Eve Eve Eve\n";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);

    		double a=(double)sc.nextInt();
    		double b=(double)sc.nextInt();

    		double d=a/b;
    		double r=a%b;
    		double f=a/b;

    		System.out.print((int)d);
    		System.out.print(" "+(int)r+" ");
    		System.out.println(String.format("%.5f",f));

    		}
    		}
    		


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

int main() { /* ここに書く */
  
  int N ;
  cin >> N ;
  
  if( N==4 || N==6 || N==9 || N==10 || N==14 || N==21 || N==22 || N==25 || N==26 ){
    cout << "2" << endl;}
  
  else if( N==8 || N==12 || N==18 || N==20 || N==27 ){
    cout << "5" << endl;}
  
  else if( N==16 ){
    cout << "14" <<endl;}
  
  else if( N==24 ){
    cout << "15" << endl;}
  
  else if( N==32 ){
    cout << "51" << endl;}
  
  else if( N==28 || N==30 ){
    cout << "4" << endl;}
  
  else{
    cout << "1" <<endl;}
  
  
}

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

int main()
{
int i;
int N;
int M;
int L;
int R;
int iMin;
int iMax;

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

	cin >> N;
	cin >> M;

	cin >> iMin;
	cin >> iMax;

	for( i = 1; i < M; i++ )
	{
		cin >> L;
		cin >> R;

		if( iMin < L ) iMin = L;
		if( iMax > R ) iMax = R;

		if( iMax < iMin )
		{
			cout << 0 << endl;

			return 0;
		}
	}

	cout << iMax - iMin + 1 << endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
const ll MAX_10p5 = 100000;
const ll MAX_10p9 = 1000000000;
const ll MAX_10p18 = 1000000000000000000;
struct edge {
	ll to, cost;
	bool operator<(const edge& right) const {
		return cost == right.cost ? to < right.to : cost < right.cost;
	}
};

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

ll N, sum[2];
ll costs[2][MAX_10p5 + 10];
bool visited[2][MAX_10p5 + 10];
vector<edge> nodes[MAX_10p5 + 10];

void dfs(ll color, ll node, ll cost) {
	if (visited[color][node]) return;
	visited[color][node] = true;
	costs[color][node] = cost;
	repi(i, 0, nodes[node].size()) dfs(color, nodes[node][i].to, cost + 1);
	return;
}

int main() {
	rd(N);
	repi(i, 1, N) {
		ll a, b;
		cin >> a >> b;
		edge ea, eb;
		ea.to = b, eb.to = a;
		nodes[a].push_back(ea);
		nodes[b].push_back(eb);
	}
	dfs(0, 1, 1);
	dfs(1, N, 1);
	repi(i, 1, N + 1) {
		if (costs[0][i] <= costs[1][i]) sum[0]++;
		else sum[1]++;
	}
	if (sum[0] > sum[1]) wrln("Fennec");
	else wrln("Snuke");
	return 0;
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  int ans1=a/b;
  int ans2=a%b;
  double ans3=1.0000*a/b;
  cout<<fixed<<setprecision(5);
  cout<<ans1<<" "<<ans2<<" "<<ans3<<endl;
  return 0;
}



Measured memory_bytes: 3260
def main():
	A, B = map(int, input().split())
	ans = 0
	for i in range(A, B+1):
		copy_i = str(i)
		add = 1
		for j in range(len(copy_i)//2):
			if copy_i[j] != copy_i[-j-1]:
				add = 0
				break
		ans += add
	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 39536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> c;
    ll tmp = M;
    c.push_back(1);
    c.push_back(M);
    for (ll i = 2; i*i <= M; i++) {
        if(tmp % i == 0){
            c.push_back(i);
            c.push_back(M / i);
        }
    }
    sort(ALL(c), greater<ll> ());

    ll L = c.size();
    for (ll i = 0; i < L; i++) {
        if(N * c[i] <= M){
            printf("%lld\n", c[i]);
            return 0;
        }
    }


}

Measured memory_bytes: 3704
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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;}
/*----------------------------------------------------------------*/
// const int MOD = 998244353;
const int MOD = 1000000007;


/*----------------------------------------------------------------*/
signed main(){
	
	int n,k;
	cin >> n >> k;

	int ans = 0;
	for(int i = k;i <= n+1;i++){
		int mini = i*(0+i-1)/2;
		int maxi = i*(n+1-i+n)/2;
		ans += maxi-mini+1;
		ans %= MOD;
		// cerr << i << " " << mini << " " << maxi << endl;
	}
	cout << ans << endl;

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_b
// rm -r -f test;oj dl https://abc163.contest.atcoder.jp/tasks/abc163_d

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

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class FEngines {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,x,y;
        in>>n;
        using P=pair<int,int>;
        using dP=pair<long double,P>;
        long double pi=atan2(0,-1),pi1=pi-0.01,pi2=pi+0.01;
        vector<dP> r;
        fr(i,n){
            in>>x>>y;
            if(x==0&&y==0) continue;
            r.emplace_back(atan2(y,x),P(x,y));
        }
        sort(r.begin(),r.end());
        n=r.size();
        fr(i,n){
            r.emplace_back(r[i].first+2*pi,r[i].second);
        }
        ll ans=0;
        Fr(i,2*n){
            fr(j,i){
                if(i-j>n) continue;
                ll sx=0,sy=0;
                for(int k=j;k<i;++k) sx+=r[k].second.first,sy+=r[k].second.second;
                ans=max(ans,sx*sx+sy*sy);
            }
        }
        out<<setprecision(20)<<sqrtl((long double)ans)<<endl;
    }
};

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


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

// #define NDEBUG
#include<assert.h>
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll cur;
  cin >> n;
  set<ll> st;
  map<ll, int> mp;
  rep(i, n) {
    cin >> cur;
    st.insert(cur);
    mp[cur]++;
  }
  vector<ll> a;
  for(ll i : st) {
    a.push_back(i);
  }
  ll res = 0;
  for(int i = 0; i < a.size(); ++i) {
    for(int j = i + 1; j < a.size(); ++j) {
      for(int k = j + 1; k < a.size(); ++k) {
        if(a[i] + a[j] > a[k]) res += mp[a[i]] * mp[a[j]] * mp[a[k]];
        else break;
      }      
    }
  }
  cout << res << endl;
  return 0;
}

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

int main()
{
  string s,t,ans="Yes";
  cin>>s>>t;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]!=t[i])
    {
      ans="No";
      break;
    }

  }
  cout<<ans<<"\n";
}


Measured memory_bytes: 3624