akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>

#define R register

int main()
{
	R int n, a, b; scanf("%d%d%d", &n, &a, &b);
	if (n == 1) return !printf("%d\n", a == b);
	R long long ans = 1ll * (n - 2) * b - 1ll * (n - 2) * a + 1;
	printf("%lld\n", ans < 0 ? 0 : ans);
	return 0;
}

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


int main() {
  int n,n1,n2,n3;
  
  cin >> n;
  
  n2 = n/10;
  n3 = n2/10;
  
  bool flag = false;
  
  vector<int> junjo = {n%10,n2%10,n3%10};
  
  for(int i =0; i<junjo.size(); i++){
    if(junjo.at(i) == 7){
      flag = true ;
      break;
    }
  }
  if(flag)
    cout << "Yes";
  else
    cout << "No";
    
  
}



Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pi 3.1415926536
#define pb push_back
#define N 1000000007
#define M 998244353
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nrep(i,a,b) for(int i=a;i>=b;i--)
int main(){
    ll t,i,j,l,h,n,x,k,y;
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>x>>y;
    if(y < 2*x){
    	cout<<"No\n";
    	return 0;
	}
    if((y - 2*x)%2 != 0){
    	cout<<"No\n";
    	return 0;
	}
    h = (y - 2*x)/2;
    k = x - h;
    if(k < 0 || h<0) cout<<"No\n";
    else cout<<"Yes\n";
}

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

#define ff first
#define ss second
#define pb push_back

using namespace std;
using ll = long long;
using ii = pair<int, int>;

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

int n;
ll fat[N];

ll inv(ll b){
	ll ans = 1;
	ll e = mod - 2;
	while(e){
		if(e&1){
			ans = (ans * b) % mod;
		}
		e >>= 1;
		b = (b * b) % mod;
	}
	return ans;
}

int main() {
	fat[0] = 1;
	for(int i = 1; i < N; i++){
		fat[i] = (fat[i-1] * i) % mod;
	}
	ll v[N];
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lld", v+i);
	}
	ll ans = 0;
	n--;
	ll ant = 0;
	for(int i = 0; i < n; i++){
		ll val = v[i+1] - v[i];
		ant = ant + (fat[n] * inv(i+1)) % mod;
		ant %= mod;
		ans += (val * ant) % mod;
		ans %= mod;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1792
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// solution 
//

use std::cmp;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        T: chars
    }

    let mut count = 0;
    let mut max = 0;

    for &c in T.iter() {
        if c == 'A' || c == 'T' || c == 'G' || c == 'C' {
            count += 1;
        } else {
            max = cmp::max(max, count);
            count = 0;
        }
    }
    max = cmp::max(max, count);

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


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int ms = 2e5+9;
int vet[ms];
int main(){
	int n,soma=0,m;
	cin >> n;
	for(int i = 0;i<n;i++) {
		cin >> vet[i];
		soma += vet[i];
	}
	cin >> m;
	int a,b;
	for(int i = 0;i<m;i++){
		cin >> a >> b;
		cout<<(soma-vet[a-1]+b)<<endl;
	}


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define dump(x) cerr << #x << "=" << x <<endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);

void solve()
{
	/*--------------------------*/

	int N, M; cin >> N >> M;
	int ans = 0;
	if (N >= 2) ans += N * (N - 1) / 2;
	if (M >= 2) ans += M * (M - 1) / 2;
	cout << ans << endl;

	/*--------------------------*/
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}

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

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int d = n % 10;
    if (d == 3) {
      System.out.println("bon");
    } else if (d == 0 || d == 1 || d == 6 || d == 8) {
      System.out.println("pon");
    } else {
      System.out.println("hon");
    }
  }
}

Measured memory_bytes: 32652
N, M, X = list(map(int,input().split()))
A = list(map(int,input().split(' ')))
#print(N, M, X, A)

modori_cost,iki_cost = 0,0 

for i in A:
  if i<X:
    modori_cost +=1
  else:
    iki_cost +=1
    

print(min(modori_cost,iki_cost))    
  
  
  
  

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

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

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

int main() {
    // source
    ll a, b;
    cin >> a >> b;
    ll ans = lcm(a, b);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char s[5];
	int i,k;
	scanf("%s",s);
  //  gets(s);
	k=1;
//	k=strlen(s);
	for(i=0;i<4;i++)
	{	
		if(s[i+1]==s[i])   {  
		k++;}}
		if(k>=2)        {  printf("Bad");	}
		else    {  printf("Good");	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
signed main() {
	ll x, a;
	cin >> x >> a;
	if (x < a)cout << 0 << endl;
	else cout << 10 << endl;
	ggr
}



Measured memory_bytes: 256
num = int(input())
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(arr[num-1])

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

using namespace std;

typedef long long ll;

const int maxV = 202020;

vector<int> G[maxV]; // 頂点情報のみのグラフ

// treeDFS(親, 現在地, 根から現在地までの距離, 根からの最大の距離, 根から最大の距離となる頂点
void treeDFS(int from, int current, int dist, int &maxDist, int &maxVertex) {
    // 距離と終点を更新
    if (dist > maxDist) {
        maxDist = dist;
        maxVertex = current;
    }

    for (auto to : G[current]) {
        // 逆流を防ぐ
        if (to == from) continue;
        treeDFS(current, to, dist + 1, maxDist, maxVertex);
    }
}

int getTreeDiameter() {
    int start = 0, end = 0, maxDist = 0;
    treeDFS(-1, start, 0, maxDist, end);
    start = end, end = 0, maxDist = 0;
    treeDFS(-1, start, 0, maxDist, end);
    return maxDist;
}

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

	int n;
	cin >> n;

	rep(i, n - 1){
		int a, b;
		cin >> a >> b;
		a--;
		b--;

		G[a].push_back(b);
		G[b].push_back(a);
	}

	int diam = getTreeDiameter();
	if(diam % 3 == 1){
		cout << "Second" << endl;
	}else{
		cout << "First" << endl;
	}

}


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

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		for (;;) {
			int n = sc.nextInt();
			int l = sc.nextInt();
			if ((n | l) == 0) {
				return;
			}
			Ant[] ant = new Ant[n];
			for (int i = 0; i < n; i++) {
				ant[i] = new Ant(i + 1, sc.next(), sc.nextDouble(), false);
			}
			int cnt = 0;
			int last = 0;
			double time = 0;
			double tmp = 0;
			while (cnt != n) {
				for (int i = 0; i < n; i++) {
					if (!ant[i].leave) {
						if (ant[i].dir.equals("R")) {
							ant[i].dis += 0.5;
						} else {
							ant[i].dis -= 0.5;
						}
					}
				}

				for (int i = 0; i < n; i++) {
					for (int j = i + 1; j < n; j++) {
						if (ant[i].leave || ant[j].leave) {
							continue;
						}
						if (ant[i].dis == ant[j].dis) {
							if (ant[i].dis * 10 % 10 != 5) {
								if (ant[i].dir.equals("R")) {
									ant[i].dir = "L";
									ant[j].dir = "R";
								} else {
									ant[i].dir = "R";
									ant[j].dir = "L";
								}
							}
						}
					}
				}
				tmp = 0;
				for (int i = 0; i < n; i++) {
					if (!ant[i].leave && (ant[i].dis == 0 || ant[i].dis == l)) {
						ant[i].leave = true;
						cnt++;
						if (time == tmp && ant[i].dir.equals("L")) {
							last = ant[i].num;
						} else if (tmp == 0) {
							last = ant[i].num;
						}
						tmp = time;
					}
				}
				time += 0.5;
			}
			System.out.println((int) time + " " + last);
		}
	}

	class Ant {
		int num;
		String dir;
		double dis;
		boolean leave;

		public Ant(int num, String dir, double dis, boolean leave) {
			super();
			this.num = num;
			this.dir = dir;
			this.dis = dis;
			this.leave = leave;
		}

	}

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

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

Measured memory_bytes: 23440
#include <iostream>
using namespace std;
int main(){
	char a[100];
	cin>>a;
	a[13]='\0';
	a[12]=a[11];
	a[11]=a[10];
	a[10]=a[9];
	a[9]=a[8];
	a[8]=a[7];
	a[7]=a[6];
	a[6]=a[5];
	a[5]=a[4];
	a[4]=' ';

	cout<<a<<endl;
	return 0;
}

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

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int [] ans = new int [20];
	Arrays.fill(ans, -1);
	int j = 0;
	while(true) {
		int n = sc.nextInt();
		if(n == 0){
			break;
		}
		int[] score = new int[n];
		int max_score = 0, min_score = 1000;
		int sum = 0;

		for (int i = 0; i < n; i++) {
			score[i] = sc.nextInt();
			sum += score[i];
			if(max_score <= score[i]){
				max_score = score[i];
			}
			if(min_score >= score[i]){
				min_score = score[i];
			}
		}
		ans[j] = (sum - max_score - min_score) / (n - 2);
		j++;
	}
	for(int i = 0; ans[i] != -1; i++){
		System.out.println(ans[i]);
		}
	}
}


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

int main() {
  int N;
  cin >> N;
  int a;
  int b = 0;
  int c = 1;
  int check = 0;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> a;
    vec.at(i) = a;
  }
  for (int i = 0; i < N; i++){
    c = vec.at(c - 1);
    b++;
    if(c == 2){
      check = 1;
      break;
    }
  }
  if (check == 1){
    cout << b << endl;
  }else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 640
/*
https://www.luogu.com.cn/blog/flashblog/solution-at2046

树 是 二 分 图！！！

也许看到这种反转题第一步就应该按照深度什么的来个黑白反转。。？这样才能进展qwq。。
还有，环套树也要考虑奇环和偶环哦！

这种转化下，将相邻两个同色同时反转 等价于 将相邻两个是否有硬币情况交换一下
奇环：断掉的边只有分摊部分转移、加快运输的作用
*/
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 2e5 + 10;
int n, m, ans, stx, sty, fx, fy;
int to[N << 1], nxt[N << 1], lnk[N], cnt;
int dep[N], fa[N], s[N], a[N], top;

void add(int x, int y) {
    to[++cnt] = y, nxt[cnt] = lnk[x], lnk[x] = cnt;
}

int getfa(int x) {
    return fa[x] == x ? x : fa[x] = getfa(fa[x]);
}

void dfs(int x, int f, int val) {
    dep[x] = dep[f] + 1;
    fa[x] = f;
    s[x] = val;
    for (int i = lnk[x]; i; i = nxt[i]) {
        int y = to[i];
        if (y != f)
            dfs(y, x, -val), s[x] += s[y];
    }
}

int main() {
    cin >> n >> m;
    rep(i, 1, n) fa[i] = i;
    stx = sty = 1;
    rep(i, 1, m) {
        int x, y; scanf("%d%d", &x, &y);
        if ((fx = getfa(x)) != (fy = getfa(y))) fa[fx] = fy;
        else { stx = x, sty = y; continue; }  // 环上边，给它断掉！
        add(x, y), add(y, x);
    }
    dfs(stx, 0, 1);
    if (n == m) {
        for (int i = sty; i; i = fa[i]) a[++top] = s[i];
        if ((dep[stx] - dep[sty]) & 1) {  // 偶环
            if (s[stx]) return puts("-1"), 0;
            sort(a + 1, a + top + 1);
            for (int i = sty; i; i = fa[i]) s[i] -= a[top >> 1];
        } else {  // 奇环
            if (s[stx] & 1) return puts("-1"), 0;
            for (int i = sty; i; i = fa[i]) s[i] -= s[stx] >> 1;
        }
    } else if (s[stx]) return puts("-1"), 0;
    rep(i, 1, n) ans += abs(s[i]);
    return printf("%d\n", ans), 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
ll mod = 1000000007;
const int ms = 2e6+5;
ll fact[ms];
void factorial(){
    fact[0]=1;
    for(int i=1;i<ms;i++){
        fact[i] = i*fact[i-1];
        fact[i] %= mod;
    }
}
ll binpow(ll a, ll n, ll mod){
    if(n==0)
    return 1ll;
    if(n%2!=0)
    return binpow(a, n-1, mod)*a % mod;
    ll res = binpow(a, n/2, mod);
    return res*res % mod;
}
ll nCr(ll n, ll r){
    ll res=fact[n];
    ll d=fact[n-r]*fact[r];
    d %= mod;
    //fermat little theorum
    d = binpow(d, mod-2, mod);
    return (res*d) % mod;
}
void solve(){
    int k; cin>>k;
    string s; cin>>s;
    factorial();
    int n = s.size();
    ll ans=0;
    for(int i=n;i<=n+k;i++){
        ans += nCr(n+k, i) * binpow(25, n+k-i, mod);
        ans %= mod;
    }
    cout<<ans;
}
int main() {
    // int t; cin>>t;
    // while(t--){
        solve();
        // cout<<endl;
    // }
}

Measured memory_bytes: 20032
#include <stdio.h>
#include <math.h>
#include <time.h>

int main(void) {
	int n, k, x;

	scanf("%d %d", &n, &k);

	x = n - k;

	if (k == 1) {
		printf("0");
	}
	else {
		printf("%d", x);
	}
}

Measured memory_bytes: 1724
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	h := scanInts(n)
	ans := 0

	for {
		l := -1
		for i := 0; i < n; i++ {
			if h[i] > 0 {
				l = i
				break
			}
		}
		if l == -1 {
			break
		}
		r := l
		mi := h[l]
		for i := l + 1; i < n; i++ {
			if h[i] == 0 {
				break
			}
			r = i
			mi = min(mi, h[r])
		}
		ans += mi
		for i := l; i < r+1; i++ {
			h[i] -= mi
		}
	}
	fmt.Fprintln(wr, ans)
}


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

int main(){
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i,0,n)cin >> h[i];
	for(int i = n-1;i > 0;i--){
		if((h[i] - h[i-1]) < 0){
			h[i-1]--;
			if((h[i] - h[i-1]) < 0){
				cout << "No" << endl;
				return 0 ;
			}
		}
	}
	// rep(i,0,n)cout << h[i] << endl;
	cout << "Yes" << endl;
	return 0 ;
}

Measured memory_bytes: 640
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define MAX_N (int)1e5+20
#define INF 1e9+20
#define pb push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int,int> pii;
const int delta=(int)1e9+7;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	char a,b; cin>>a>>b;
	if(a<b) cout<<"<";
	else if(a==b) cout<<"=";
	else cout<<">";
	return cout<<endl,0;
}

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    a.reverse();

    let mut max = 2;
    let mut min = 2;
    for i in 0..n {
        max = max + a[i] - max % a[i] - 1;
        min = (min + a[i] - 1) / a[i] * a[i];
    }
    if max <= min {
        println!("-1");
    } else {
        println!("{} {}", min, max);
    }
}


Measured memory_bytes: 6396
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push(int x){
  /*topを加算してからその位置へ挿入*/
  S[++top]=x;
}

int pop(){
  top--;
  /*topが指していた要素を返す*/ 
  return S[top+1];
}

int main(){
  int a,b;
  top=0;
  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(b+a);
    }else if(s[0]=='-'){
      a=pop();
      b=pop();
      push(b-a);
    }else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }else {
      push(atoi(s)); 
    }
  }

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

  return 0;
}



Measured memory_bytes: 2140
import fractions


A, B = map(int, input().split())


gcd_ab = fractions.gcd(A,B)	



def factorization(n):
    arr = 0
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr += 1

    if temp!=1:
        arr += 1

    return arr

f = factorization(gcd_ab)
print(f + 1)





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

// clang-format off
#define forn(i, x, y) for(int i = x; i < y; i++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
#define printVector(a) for(auto it = a.begin() ; it != a.end(); it++) {cout << *it << endl;}
// clang-format on

using LL = long long;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;

const LL MOD = 1000000007;

int main()
{
  IOS;
  int N, K;
  cin >> N >> K;
  VI A(N);
  forn(i, 0, N) cin >> A[i];

  VVLL dp(N + 1, VLL(K + 1, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++)
  {
    dp[i][0] = 1;
    for (int j = 1; j <= K; j++)
    {
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
      if (j - A[i - 1] - 1 >= 0)
        dp[i][j] = (dp[i][j] + MOD - dp[i - 1][j - A[i - 1] - 1]) % MOD;
    }
  }
  cout << dp[N][K] << endl;

  return 0;
}


Measured memory_bytes: 83068
#include<bits/stdc++.h>
using namespace std;
int main(){
  long H,W,A,B;cin>>H>>W>>A>>B;
  if(2*A<=W&&2*B<=H){
    for(long i=0;i<H;i++){for(long j=0;j<W;j++)cout<<((j<A)^(i<B));cout<<endl;}
  }
  else cout<<"No";
}



Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  ll ANS[100001];
  REP(i,100001) ANS[i]=0;
  
  for(int x=1; x<=100; ++x){
    for(int y=1; y<=100; ++y){
      for(int z=1; z<=100; ++z){
        ANS[x*x+y*y+z*z+x*y+y*z+z*x]++;
      }
    }
  }  
  
  RREP(i,N) co(ANS[i]);
  return 0;
}

Measured memory_bytes: 4368
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  map<int, int>m;
  map<int, int>::iterator pm;
  int n, a[100000];
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    m.insert(pair<int, int>(a[i], i + 1));
  }
  pm = m.begin();
  while(pm != m.end()){
    cout << pm->second << ' ';
    ++pm;
  }
  return 0;
}

Measured memory_bytes: 5888
S = input()
if S == 'SUN':
    A = 7
elif S == 'MON':
    A = 6
elif S == 'TUE':
    A = 5
elif S == 'WED':
    A = 4
elif S == 'THU':
    A = 3
elif S == 'FRI':
    A = 2
elif S == 'SAT':
    A = 1
print(A)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int x, a;
	cin >> x >> a;
	int ans;
	if (x < a)ans = 0;
	else ans = 10;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int i,j,k,x,y,z,l,m,n,count1=0,count2=0;
void A(void);
void B(void);
void C(void);
void D(void);
void E(void);
void F(void);

int main(void){
    C();
}

void C(){
    double ans,d;
    int a,b,n,m,x,y;
    cin>>a>>b>>n>>m;
    ans=(double)abs((double)((n%12)+(double)m/60)*30-m*6);
    //x=a*cos(ans*M_PI/180);
    //y=a*sin(ans*M_PI/180);
    d=sqrt(a*a+b*b-2*a*b*cos(ans*M_PI/180));
    printf("%.15lf\n",d);
}

Measured memory_bytes: 4100
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); 
const int32_t mod = 1e9+7;
const int32_t maxn=2e5+5;

void solve(){
    int n;cin>>n;
    map<string,int> m;
    rep(i,0,n){
        string s;cin>>s;
        m[s]++;
    }
    int a=m["AC"];
    int b=m["WA"];
    int c=m["TLE"];
    int d=m["RE"];
    cout<<"AC x "<<a<<'\n';
    cout<<"WA x "<<b<<'\n';
    cout<<"TLE x "<<c<<'\n';
    cout<<"RE x "<<d<<'\n';
    
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3660
package main

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

type Dice struct {
	Faces []int
}

func NewDice(n []int) *Dice {
	d := &Dice{
		Faces: n,
	}

	return d
}

func (d *Dice) move(direction string) {
	switch direction {
	case "E":
		d.Faces[0], d.Faces[2], d.Faces[5], d.Faces[3] =
			d.Faces[3], d.Faces[0], d.Faces[2], d.Faces[5]
	case "W":
		d.Faces[0], d.Faces[2], d.Faces[5], d.Faces[3] =
			d.Faces[2], d.Faces[5], d.Faces[3], d.Faces[0]
	case "N":
		d.Faces[0], d.Faces[1], d.Faces[5], d.Faces[4] =
			d.Faces[1], d.Faces[5], d.Faces[4], d.Faces[0]
	case "S":
		d.Faces[0], d.Faces[1], d.Faces[5], d.Faces[4] =
			d.Faces[4], d.Faces[0], d.Faces[1], d.Faces[5]
	}
}

func (d *Dice) Move(direction string) *Dice {
	newDice := &Dice{
		Faces: make([]int, len(d.Faces)),
	}
	copy(newDice.Faces, d.Faces)
	newDice.move(direction)

	return newDice
}

func (d *Dice) Equal(another *Dice) bool {
	return d.equal(another, 0)
}

func (d *Dice) equal(another *Dice, depth int) bool {
	if reflect.DeepEqual(d.Faces, another.Faces) {
		return true
	}

	if depth == 4 {
		return false
	}

	return d.equal(another.Move("E"), depth+1) ||
		d.equal(another.Move("W"), depth+1) ||
		d.equal(another.Move("N"), depth+1) ||
		d.equal(another.Move("S"), depth+1)
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)

	sc.Scan()
	f1 := make([]int, 6)
	for i, s := range strings.Split(sc.Text(), " ") {
		f1[i], _ = strconv.Atoi(s)
	}
	d1 := NewDice(f1)

	sc.Scan()
	f2 := make([]int, 6)
	for i, s := range strings.Split(sc.Text(), " ") {
		f2[i], _ = strconv.Atoi(s)
	}
	d2 := NewDice(f2)

	if d1.Equal(d2) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1176
#include<stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int M[MAX][MAX];

void dijkstra(int n){
  int minv;
  int i;
  int d[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;
  while(1){
    minv = INFTY;
    int u = -1;
    for(i = 0;i<n;i++){
      if(minv > d[i] && color[i] != BLACK){
        u=i;
        minv = d[i];
      }
    }
    if(u==-1) break;
    color[u] = BLACK;
    for(int v = 0;v<n;v++){
      if(color[v] !=BLACK && M[u][v] != INFTY){
        if(d[v] > d[u] + M[u][v]){
          d[v] = d[u] + M[u][v];
          color[v] = GRAY;
        }
      }
    }
  }

  for(i = 0;i<n;i++){
    printf("%d %d\n",i,d[i]);
  }
}

int main(){
  int n;
  int i,j;
  scanf("%d",&n);
  for(int i;i<n;i++){
    for(int j = 0;j<n;j++){
      M[i][j] = INFTY;
    }
  }

  int k,c,u,v;
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      M[u][v] = c;
    }
  }

  dijkstra(n);

  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;


int main() {
	char str[200001];
	char buf[200000];
	cin >> str;
	int N = strlen(str);
	int x = 0;
	for (int i = 0; i < N; i++) {
		if (x > 0 && buf[x - 1] == 'S' && str[i] == 'T') {
			x--;
		}
		else {
			buf[x] = str[i];
			x++;
		}
	}
	cout << x;
	return 0;
}

Measured memory_bytes: 640
I0 = lambda :map(int,input().split())
I1 = lambda :int(input())
I2 = lambda :list(map(int,input().split()))
#####################################################
from collections import defaultdict
n = I1()
d = defaultdict(int)
for i in range(n):
    d["".join(sorted(input()))]+=1
res=0
for i in d.keys():
    if d[i] > 1:
        yy=d[i]-1
        res+=yy*(yy+1)//2
print(res)


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

int main(){
  int N, d;
  cin >> N;
  vector<int> t(2), x(2), y(2);
  t.at(0) = 0;
  x.at(0) = 0;
  y.at(0) = 0;
  for (int i=0; i<N; i++) {
    cin >> t.at(1) >> x.at(1) >> y.at(1);
    if (x.at(1) > x.at(0) && y.at(1) > y.at(0))
      d = x.at(1) - x.at(0) + y.at(1) - y.at(0);
    else if (x.at(1) <= x.at(0) && y.at(1) > y.at(0))
      d = x.at(0) - x.at(1) + y.at(1) - y.at(0);
    else if (x.at(1) > x.at(0) && y.at(1) <= y.at(0))
      d = x.at(1) - x.at(0) + y.at(0) - y.at(1);
    else
      d = x.at(0) - x.at(1) + y.at(0) - y.at(1);
    if (t.at(1)-t.at(0) >= d) {
      if ((t.at(1)-t.at(0)-d)%2 == 0) {
        x.at(0) = x.at(1);
        y.at(0) = y.at(1);
        t.at(0) = t.at(1);
      }
      else {
        cout << "No" << endl;
        break;
      }
    }
    else {
      cout << "No" << endl;
      break;
    }
  }
  if (x.at(0) == x.at(1) && y.at(0) == y.at(1))
    cout << "Yes" << endl;
}

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

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

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

/*追加部分*/



/*main関数*/

int main() {
FASTIO;
    int a, b, c, x; cin >> a >> b >> c >> x;
    int ans = 0;

    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <= c; k++){
                if(500*i + 100*j + 50*k == x)
                    ans++;
            }
        }
    }
    cout << ans << endl;

return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;

#define REP(i, a, n) for(ll i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lwb lower_bound
#define N 100010
#define M 200010
#define endl "\n"

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	string s, t;
	int ans = 0;
	
	cin >> s >> t;
	
	REP(i, 0, 3){
		if(s[i] == t[i]) ans++;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <string>
#include <stdio.h>

using namespace std;

int main()
{
  char cmd[2]; // command
  int digit; // digit to insert
  priority_queue<int> Q;
  while (true) {
    scanf(" %s", cmd);
    if (cmd[0] == 'i') { // if command is insert
      scanf(" %d", &digit);
      Q.push(digit);
    } else { // if command starts with 'e'
      if (cmd[1] == 'n') break; //if command is 'end'
      printf("%d\n", Q.top());
      Q.pop();
    }
  }
}

Measured memory_bytes: 6724
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main(){
    while(true){
        int num=0;
        int temp;
        cin>>temp;
        if(temp==0) break;
        int i=1;
        int j=1;
        int ans=0;
        while(i<=temp){
            //if(DEBUG) cout<<ans<<endl;
            if(ans==temp){
                num++;
            }
            if(ans<=temp){
                ans+=i++;
                continue;
            }
            else{
                ans-=j++;
                continue;
            }
        }
        cout<<num<<endl;
    }
    return 0;
}


Measured memory_bytes: 3024
// very hard to implement
// respect math's solution!!!

#include<cstdio>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int bx[11],h[11]; // 区切り板の x 座標, 高さ

double water[10];

// 区画 [l,r) だけを考えて, [l,r) にある区画 pos に水を a 単位だけ注ぐ
// [l,r) からあふれた水は注がずに a に残したままにする
void pour(int pos,double &a,int l,int r){
	if(r-l>=2){
		int i=l+1; // [l,r) の中で, 両端を除いて一番高い区切り板
		for(int j=l+1;j<r;j++) if(h[i]<h[j]) i=j;

		if(pos<i){
			pour(pos,a,l,i);
			pour(pos,a,i,r);
		}
		else{
			pour(pos,a,i,r);
			pour(pos,a,l,i);
		}
	}

	// 水が a 単位あまったので, 区画 [l,r) に均等に注ぐ
	// ( 余ったということは [l,r) はすでに水で満たされて同じ高さになっているということ )
	int width=bx[r]-bx[l];
	int height=min(h[l],h[r]);
	double add=a/(width*30);
	if(water[l]+add<height){ // a を全部使える
		a=0;
		for(int i=l;i<r;i++) water[i]+=add;
	}
	else{ // a が余る
		a-=(height-water[l])*width*30;
		for(int i=l;i<r;i++) water[i]=height;
	}
}

int main(){
	int T; scanf("%d",&T);
	while(T--){
		int n; scanf("%d",&n);
		bx[0]=0; h[0]=50;
		rep(i,n) scanf("%d%d",bx+i+1,h+i+1);
		bx[n+1]=100; h[n+1]=50; n++;

		int in[10]={}; // in[i] := ( 蛇口たちから区画 i に流れ込む単位時間当たりの流量 )
		int m; scanf("%d",&m);
		rep(i,m){
			int jx,a; // 蛇口 i の x 座標, 流量
			scanf("%d%d",&jx,&a);
			rep(j,n) if(jx<bx[j+1]) { in[j]+=a; break; }
		}

		int q; scanf("%d",&q);
		while(q--){
			rep(i,n) water[i]=0;

			int x,t; scanf("%d%d",&x,&t);
			rep(i,n){
				double a=in[i]*t; // 区画 i に a 単位だけ注ぐ
				pour(i,a,0,n);
			}

			int pos;
			for(pos=0;x>bx[pos+1];pos++);
			printf("%.9f\n",water[pos]);
		}
	}

	return 0;
}

Measured memory_bytes: 1064
#include <cstdio>
#include<stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;



int bubblesort(int A[],int N){
    int sw=0;
    bool flag=1;
    while(flag){
        flag=0;
        for(int j=N-1 ; j>=1 ; j--){
            if(A[j] < A[j-1]) {
                swap(A[j],A[j-1]);
                flag=1;
                sw++;
            }
        }

    }
    return sw;
}

int main(void){
    int A[100],N,sw;
    cin >> N;

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

    sw=bubblesort(A,N);

    for(int i=0 ; i<N ; i++){
        if(i) cout << " ";
        cout << A[i];
    }

    cout << endl;
    cout << sw << endl;

    return 0;
}


Measured memory_bytes: 3108
from collections import Counter

N = int(input())
s = []
for i in range(N):
  s.append(str(input()))

M = int(input())
t = []
for i in range(M):
  t.append(str(input()))

# 重複を削除
ss = list(set(s))

# 要素ごとの件数をもとめる
sc = Counter(s)
tc = Counter(t)

# test
# print(sc)

ans = 0
for i in range(len(ss)):
  wk = sc[ss[i]] - tc[ss[i]]
  if (ans < wk):
    ans = wk

if ans >= 0:
  print(ans)
else:
  print(0)







Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int dp[3030][3030];
int main(){
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();
    //int dp[n][m];
    memset(dp,0,sizeof(dp));
    //if(s[0]==t[0])
    //dp[0][0]=1;
    for(int i=1;i<n+1;i++){
        for(int j=1;j<m+1;j++){
            if(s[i-1]==t[j-1])
            dp[i][j]=1+dp[i-1][j-1];
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    //cout<<dp[n][m]<<endl;
    string ans;
    int i=n,j=m;
    while(i>0&&j>0){
        if(dp[i][j]==1+dp[i-1][j-1]&&s[i-1]==t[j-1]){
        ans.push_back(s[i-1]);
        i--;
        j--;
        }
        else if(dp[i-1][j]==dp[i][j])
        i--;
        else j--;
    }
    //cout<<ans;
    reverse(ans.begin(),ans.end());
    cout<<ans;
    return 0;
}

Measured memory_bytes: 39476
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
S=[]
for i in range(51):
  num1=0
  for a in A:
    if a&(1<<i):
      num1+=1
  S.append(num1)
f=0
for i in range(50):
  s=0
  flag=False
  for j in range(51)[::-1]:
    if i>j:
      s+=max(S[j],N-S[j])*(1<<j)
    elif i==j:
      if (K+1)&(1<<j):
        flag=True
        s+=S[j]*(1<<j)
      else:
        s=0
        break
    else:
      if (K+1)&(1<<j):
        s+=(N-S[j])*(1<<j)
      else:
        s+=S[j]*(1<<j)
  f=max(f,s)
s=0
for j in range(51):
  s+=S[j]*(1<<j)
f=max(f,s)

print(f)


Measured memory_bytes: 69208
#include<bits/stdc++.h>
#define inf 2000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define rng_23 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef set<int> si;
typedef multiset<int> msi;
typedef map<int,int> mii;
int main()
{
    double r;
    cin>>r;
    cout<<2.0*3.1416*r;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int Sz = 3e3 + 3;
using ii = pair<int,int>;

int n, m, k;
int x, y, z;
int val = 0;
int f[Sz][Sz][4];
int a[Sz][Sz];
int dp(int row, int col, int cnt){
    if(row > n || col > m) return 0;
    int &res = f[row][col][cnt];
    if(res != -1) return res;
    res = dp(row + 1, col, 0);
    if(cnt < 3) res += a[row][col];
    if(cnt < 3){
    if(a[row][col] != 0)
        res = max(res, dp(row, col + 1, cnt + 1) + a[row][col]);
        res = max(res, dp(row, col + 1, cnt));
    }
    //cout << row << " " << col << " " << res << '\n';
    return res;
}
void trace(int row, int col, int cnt){
    if(row > n || col > m) return ;
    if(f[row][col][cnt] == f[row + 1][col][0]) return trace(row + 1, col, 0);
    if(f[row][col][cnt] == f[row][col + 1][cnt]) return trace(row, col + 1, cnt);
    cout << row << " " << col << '\n';
    return trace(row, col + 1, cnt + 1);
}
int32_t main()
{
    //freopen("inp.txt" , "r", stdin);
    //freopen("out.txt", "w", stdout);
    memset(f, -1, sizeof f);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> k;
    while(k--){
        cin >> x >> y >> z;
        a[x][y] = z;
    }
    cout << dp(1, 1, 0);
    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

const double PI = 3.14159265358979;

int main() {
  int n;
  cin >> n;
  printf("%.10f\n",2.0*n*PI);
  
  return 0;
}


Measured memory_bytes: 3764
import sys
import math

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

s = sum(a)
a.sort(reverse=True)
border = s / (4 * m)

ans = True

for i in range(m):
    if (a[i] >= border):
        pass
    else:
        ans = False
        break

if (ans):
    print("Yes")
else:
    print("No")


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

a = ((A-1)+1)//2
b = (B+1)//2
# print (a, b)
a = a%2
b = b%2
# print (a,b)
if A%2 == 1:
    fa = (A-1)^a
else:
    fa = a
if B%2 == 0:
    fb = B^b
else:
    fb = b
# print (fa, fb)
print (fa^fb)

Measured memory_bytes: 3316
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N, T;
vector<int> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> T;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int pat = 0;
  int max_diff = 0;
  int min_v = INF;
  for (int i = 0; i < N; i++) {
    if (A[i] < min_v) {
      min_v = A[i];
    } else {
      int diff = A[i] - min_v;
      if (max_diff == diff) {
        pat++;
      } else if (diff > max_diff) {
        pat = 1;
        max_diff = diff;
      }
    }
  }

  cout << pat << endl;
  return 0;
}

Measured memory_bytes: 640
import math
import itertools
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
k = int(input())
ans = 0
xlist = list(range(1,k+1))

for i in range(k+1):
    ans += i

if k > 1:
    for x in itertools.combinations(xlist, 2):
        ans += gcd(x[0], x[1]) * 6
        # print(x)
        
if k > 2:
    for x in itertools.combinations(xlist, 3):
        ans += gcd(x[0], x[1], x[2]) * 6
        # print(x)

print(ans)

Measured memory_bytes: 9644
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int x;
  cin >> x;

  int ans = 1;
  for(int b = 2; b * b <= x; b++){
    int c = 1;
    while(c * b <= x){
      c *= b;
    }
    ans = max(ans, c);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
# e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

f.sort()
count=1
ans=[0 for i in range(a)]

for i in range(len(f)-1):
    if f[i]==f[i+1]:
        count+=1
    else:
        ans[f[i]-1]=count
        count=1
if count>=1:
    ans[f[-1]-1]=count
for i in ans:
    print(i)

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

ll n, a, b;

int main(){
    cin >> n >> a >> b;
    ll ans = 0;
    ll total = 0;
    ll unit = a + b;
    ll unitcount = n / unit;
    ans += unitcount * a;
    total += unitcount * (a + b);
    while(total < n){
        ll addblue = min(a, n - total);
        total += addblue;
        ans += addblue;
        ll addred = min(b, n - total);
        total += addred;
    }
    printf("%lld\n", ans);
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    for(int i = 1; i <= 9; ++i){
        if(n % i == 0){
            if(n / i < 10){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, N;
	char S[100001][11] = {};
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", S[i]);

	int j, k;
	long long count[5] = {};
	char s[6] = "MARCH";
	for (i = 1; i <= N; i++) {
		for (j = 0; j < 5; j++) if (S[i][0] == s[j]) count[j]++;
	}
	
	long long sum = 0;
	for (i = 0; i < 5; i++) {
		for (j = i + 1; j < 5; j++) {
			for (k = j + 1; k < 5; k++) sum += count[i] * count[j] * count[k];
		}
	}
	
	printf("%lld\n", sum);
	fflush(stdout);
	return 0;
}

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

int main(){
  int n,sorted=0,counter=0;
  bool flg=true;
  cin >> n;
  int* A = new int[n];

  for(int i=0;i<n;i++){
    cin >> A[i];
  }
  while(flg){
    flg = false;
    for(int i=n-1;i>sorted;i--){
      if(A[i]<A[i-1]){
        A[i] ^= A[i-1]; A[i-1] ^= A[i]; A[i] ^= A[i-1];
	counter++;
	flg = true;
      }
    }
    sorted++;
  }
  for(int i=0;i<n;i++){
    cout <<(i!=0 ? " " : "") << A[i];
  }
  cout << endl << counter << endl;
}


Measured memory_bytes: 3084