akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    n,m = LI()
    v = LIR(m)
    for i in range(m):
        v[i] = [v[i][0],v[i][1],i]
    v.sort(key = lambda x:x[1])
    f = [0 for i in range(n+1)]
    ans = [None for i in range(m)]
    for p,y,i in v:
        f[p] += 1
        s = "{:0>6}".format(p)
        t = "{:0>6}".format(f[p])
        ans[i] = s+t
    for i in ans:
        print(i)
#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 82284
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(4800//400 + 1)]
for i in a:
    b[i//400] += 1;
t = 0
ans = 0
for i in range(4800//400 + 1):
    if b[i] > 0:
        if i < 3200//400:
            ans+=1
        else:
            t+=b[i]
if ans > 0:
    print(ans,t+ans)
else:
    print(1,t)


Measured memory_bytes: 3060
import sys
from collections import Counter, defaultdict
from math import factorial

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def combinations_count(n, r): # 組み合わせ
    return factorial(n) // (factorial(n - r) * factorial(r))

N = ir()
S = defaultdict(int)
for _ in range(N):
    s = list(sr())
    s.sort()
    s = str(s)
    if s in S:
        S[s] += 1
    else:
        S[s] = 1

counter = Counter(S)
answer = 0
for v in counter.values():
    if v >= 2:
        answer += combinations_count(v, 2)

print(answer)


Measured memory_bytes: 26844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main()
{
    int  n;
    cin >> n;
    int s[n];
    rep(i, 0, n) cin >> s[i];
    int q;
    cin >> q;
    int t[q];
    rep(i, 0, q) cin >> t[i];

    int ans = 0;
    rep(i, 0, q) {
        int left = 0;
        int right = n;
        while(left < right) {
            int mid = (left + right) / 2;
            if (t[i] == s[mid]) {
                ans ++;
                break;
            } else if (t[i] < s[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3572
using System;

class A{
  static void Main(){
    int[] Ar = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    int x = Ar[0], a = Ar[1], b = Ar[2];
    if (Math.Abs(x - b) > Math.Abs(x - a)) Console.WriteLine("A");
    else Console.WriteLine("B");
  }
}


Measured memory_bytes: 27316
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll a, b;
  cin >> a >> b;
  print(a*b);
}


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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C& _a4, C _b4) { _a4 = min(_a4, _b4); }
template<class C> void maxi(C& _a4, C _b4) { _a4 = max(_a4, _b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream& operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto& vv : V) os << vv << ","; os << "]";
  return os;
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 101001;
vector<int> t,co;
int dp[MAX];
int cz[MAX];
int il = 0;
int kt[MAX];
int n,m,q;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> m >> q;
  R(i,q){
    int pom;
    cin >> pom;
    pom--;
    t.PB(pom);
  }
  reverse(ALL(t));
  for(int el:t){
    if(!cz[el]){
      cz[el] = 1;
      kt[el] = il;
      il++;
      co.PB(el);
    }
    int pom = kt[el];
    dp[pom]++;
    if(pom != 0)
      mini(dp[pom],dp[pom-1]);
  }
  int naj = 0;
  while(cz[naj])naj++;
  debug(naj);
  while(!co.empty() && naj > co.back()){
    naj = co.back();
    co.pop_back();
  }
  il = SZ(co);
  debug(il);
  if(il == 0 || dp[il-1] >= n)
    cout << "Yes\n";
  else
    cout << "No\n";
}


Measured memory_bytes: 4596
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
  ll k;
  cin >> k;
  queue<string> vc;
  vc.push("1");
  vc.push("2");
  vc.push("3");
  vc.push("4");
  vc.push("5");
  vc.push("6");
  vc.push("7");
  vc.push("8");
  vc.push("9");
  int i=0;
  string str;

  while(i!=k){
    str = vc.front();
    vc.pop();
    char t1 = str[0]-1;
    char t2 = str[0]+1;
    if('0'<=t1) vc.push(t1+str);
    vc.push(str[0]+str);
    if('9'>=t2) vc.push(t2+str);
    i++;
    //cout << str << endl;
  }
  for(int i=str.size()-1;i>=0;i--){
    cout << str[i];
  }
}

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

class Dice{
public:
	int m_t, m_s, m_e, m_w, m_n, m_b;
	Dice(int a[6]){
		m_t = a[0];
		m_s = a[1];
		m_e = a[2];
		m_w = a[3];
		m_n = a[4];
		m_b = a[5];
	}
	~Dice(){}
	void south(){
		int tmp = m_t;
		m_t = m_n;
		m_n = m_b;
		m_b = m_s;
		m_s = tmp;
	}
	void east(){
		int tmp = m_t;
		m_t = m_w;
		m_w = m_b;
		m_b = m_e;
		m_e = tmp;
	}
	void west(){
		int tmp = m_t;
		m_t = m_e;
		m_e = m_b;
		m_b = m_w;
		m_w = tmp;
	}
	void north(){
		int tmp = m_t;
		m_t = m_s;
		m_s = m_b;
		m_b = m_n;
		m_n = tmp;
	}
};

int main(){
	bool flag = false;
	int a[6], b[6];
	for (int i = 0; i < 6; i++) cin >> a[i];
	for (int i = 0; i < 6; i++) cin >> b[i];
	Dice k(a), l(b);
	for (int j = 0; j < 4; j++){
		k.north();
		if (k.m_t == l.m_t){
			flag = true;
			break;
		}
	}
	for (int j = 0; j < 4; j++){
		k.west();
		if (k.m_t == l.m_t){
			flag = true;
			break;
		}
	}
	k.north();
	for (int j = 0; j < 4; j++){
		k.west();
		if (k.m_t == l.m_s){
			flag = true;
			break;
		}
	}
	k.south();
	if (k.m_t != l.m_t) flag = false;
	if (k.m_s != l.m_s) flag = false;
	if (k.m_w != l.m_w) flag = false;
	if (k.m_n != l.m_n) flag = false;
	if (k.m_b != l.m_b) flag = false;
	if (k.m_e != l.m_e) flag = false;
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3136
def main():
    n, m = [int(i) for i in input().split()]
    s = []
    # 接続グラフ
    # i 番目のスイッチには 電球との接続情報が入っている
    a = [0 for i in range(n)]
    for j in range(m):
        k, *switch = [int(i) for i in input().split()]
        for s in switch:
            a[s-1] |= (1 << j)
    p = int(("".join(reversed([i for i in input().split()]))), base=2)

    ans = 0
    # 全探索
    for i in range(1<<n):
        t = 0
        for j in range(n):
            if (i >> j & 1) == 1:
                t ^= a[j]
        if t == p:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<ll, ll> mpii;
typedef unordered_map<ll, ll> umpii;
 
#define pb(v) push_back(v)
#define all(v) v.begin(), v.end()
#define upb(v, key) (upper_bound(all(v), key) - v.begin())
#define lob(v, key) (lower_bound(all(v), key) - v.begin())
 
ll inf = 1e9;
ll INF = inf * 1ll * inf;
ll mod = 1e9 + 7;
double eps = 1e-9;
const ld pi = ld(3.1415926535897932384626433832795);
ll dr[] = {-1, 0, 0, 1};
ll dc[] = {0, 1, -1, 0};

void mod_add(ll &a, ll b) {
  a += b;
  if(a > mod) a -= mod;
}
void mod_sub(ll &a, ll b) {
  a -= b;
  if(a < 0) a += mod;
}

//only for variables and vectors; 
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

/*...................................................*/

main()
{
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);

  ll t, n, m, i, j, k, q, u, v;
  // cin >> t;
  // ll tc = t;
  t = 1;
  while (t--)
  {
    cin >> n >> k;
    ll ans = 0;
    for(i = 0; i < n; i++) {
      cin >> u;
      ans += u >= k;
    }
    cout << ans;
    // cout << "Case #" << tc - t << ": ";

    cout << '\n';
  }
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val a =readLine()!!.split(" ")
    val square :Int = a[0].toInt()
    val trap :Int = a[1].toInt()
    val start :Int = a[2].toInt()
    val b =readLine()!!.split(" ")
    val fee :IntArray = IntArray(trap)
    var countl :Int = 0
    var countr :Int = 0
    for(i in fee.indices){
        fee[i] = b[i].toInt()
    }
    //println(fee.joinToString())
    for(i in 0..trap-1){
        if(fee[i] > 0 && start > fee[i]){
            //  countl.inc()
            countl = countl + 1
        }
        else if(fee[i] > start && square > fee[i]){
            //countr.inc()
            countr = countr + 1
        }
    }
    //println(countr)
    //println(countl)
    val ans :Int = if(countl >= countr) countr else countl
    println(ans)
}

Measured memory_bytes: 38116
import java.util.Scanner;

public class Main {

	static final int MAX = 50000;
	static boolean[] era = new boolean[MAX+1];
	static{
		era[0]=era[1]=true;
		for (int i = 2; i*i <= MAX ; i++) {
			if(!era[i]) for (int j = i*2; j <=MAX ; j+=i) {
				era[j]=true;
			}
		}
	}


	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n;
		while((n=scan.nextInt())!=0){
			int k=0;
			for (int i = 2; i <=n/2 ; i++) {
				if(n-i<0) break;
				if(!era[i] && !era[n-i]) k++;
			}
			System.out.println(k);
		}
	}
}

Measured memory_bytes: 33796
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

void dfs(u64 nd, int idx, vector< vector< int > > & t, vector< vector< u64 > > & d, l64 score[])
{
  if (score[idx]==-1) {
    score[idx] = nd;
    for (int i = 0; i < t[idx].size(); ++i) {
      dfs(nd+d[idx][i], t[idx][i], t, d, score);
    }
  }
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  vector< vector< int > > t(n);
  vector< vector< u64 > > d(n);
  for (int i = 0; i < n-1; ++i) {
    u64 a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    t[a].push_back(b);
    t[b].push_back(a);
    d[a].push_back(c);
    d[b].push_back(c);
  }
  int q, k;
  cin >> q >> k;
  k--;
  l64 score[n];
  for (int i = 0; i < n; ++i) score[i] = -1;
  dfs(0, k, t, d, score);
  for (int i = 0; i < q; ++i) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    cout << score[x] + score[y] << endl;
  }
  return 0;
}


Measured memory_bytes: 19840
#include<iostream>
#include<cstdio>
#include<cassert>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<cmath>
#include<string>
#include<sstream>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<vector>
#include<bitset>
#include<algorithm>

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 1007;
ll n,k;
int ans = 0;
int dp[N][N];
int solve(int len, int lastColor){
	if (dp[len][lastColor] != -1){
		return dp[len][lastColor];
	}
	if (len == n){
		return dp[len][lastColor] = 1;
	}
	if (len < n) {
		int x = 0;
		for(int i = 0; i < k; i++){
			if (lastColor != i){
				x += solve(len + 1,i);	
			}
		}
		return dp[len][lastColor] = x;
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	
	cin >> n >> k;
	memset(dp, -1, sizeof dp);
	
	cout << solve(0,1001) << endl;
  	return 0;
}


Measured memory_bytes: 4224
import itertools

def iln(): return list(map(int, input().split()))

def solve(N, M, constraints):
    max_so_far = 0
    for seq in itertools.combinations_with_replacement(range(1, M + 1), N):
        #print("Processing sequence: ", seq)
        curr_score = 0
        for const in constraints:
            a,b,c,d = const
            if seq[b-1] - seq[a-1] == c:
                curr_score += d

        max_so_far = max(max_so_far, curr_score)

    return max_so_far


N, M, Q = iln()
constraints = []
for i in range(Q):
    constraint = tuple(iln())
    constraints.append(constraint)

print(solve(N, M, constraints))


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

int main(){
    multiset<int> s;
    int N,M,x,sum=0;
    long long ans=0;
    cin>>N>>M;
    for (int i = 0; i < N; ++i) {
        cin>>x;
	sum+=x;
	sum=sum%M;
	s.insert(sum);
    }
    while(!s.empty()){
	auto itr=s.begin();
	long long a=s.count(*itr);
	if(*itr==0){
	    ans+=a+a*(a-1)/2;
	}else ans+=a*(a-1)/2;
	s.erase(*itr);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4992
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
char ch;
int read(){int n=0,p=1;for(ch=getchar();ch<'0' || '9'<ch;ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=1e5+5;
int n,h,cl[N],cr[N],d[N],fa[N];
int getfa(int x){return fa[x]?fa[x]=getfa(fa[x]):x;}
bool bz[N],exi[N];
void link(int u,int v)
{
	--d[u],++d[v];
	int fu=getfa(u),fv=getfa(v);
	if(fu!=fv) fa[fv]=fu;
}
int main()
{
	n=read(),h=read();
	fo(i,1,n)
	{
		int x,y,A=read(),B=read(),C=read(),D=read();
		if(C) x=-C;else x=A;
		if(D) y=D;else y=-B;
		x+=h,y+=h,exi[x]=exi[y]=1;
		link(x,y);
	}
	fo(i,0,h) if(d[i]<0) return puts("NO"),0;
	fo(i,h+1,h+h) if(d[i]>0) return puts("NO"),0;
	fo(i,0,h+h) if(d[i]) bz[i]=1;
	fo(i,0,h+h) bz[getfa(i)]|=bz[i];
	fo(i,0,h+h)
		if(i==getfa(i) && exi[i] && !bz[i]) return puts("NO"),0;
	return puts("YES"),0;
}

Measured memory_bytes: 128
N, M = map(int,input().split())
A = list(map(int, input().split()))
S = sum(A)
A_selected = [a for a in A if a >= (S/4/M)]
ret = len(A_selected) >= M
if ret:
    ret_str = 'Yes'
else:
    ret_str = 'No'
print(ret_str)

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  bool flg = false;
  if(s[0] == s[1] && s[2] == s[3] && s[0] != s[3]) flg = true;
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX = 310;
const long long INF = 1LL<<50;

long long G[MAX][MAX];
using pll = pair<long long, long long>;

int main() {
    int N, M; long long L;
    cin >> N >> M >> L;
    
    for (int i = 0; i < MAX; ++i) {
        for (int j = 0; j < MAX; ++j) G[i][j] = INF;
        G[i][i] = 0;
    }
    for (int i = 0; i < M; ++i) {
        int a, b; long long c;
        cin >> a >> b >> c; --a, --b;
        G[a][b] = G[b][a] = c;
    }

    vector<vector<pll> > dist(N, vector<pll>(N, {INF, INF}));
    for (int s = 0; s < N; ++s) {
        dist[s][s] = {0, 0};
        priority_queue<pair<pll, int>,
                       vector<pair<pll, int> >,
                       greater<pair<pll, int> > > que;
        que.push(make_pair(pll(0, 0), s));
        while (!que.empty()) {
            auto p = que.top();
            que.pop();
            
            long long v = p.second;
            long long kaisuu = p.first.first;
            long long used = p.first.second;
            
            if (p.first > dist[s][v]) continue;
            for (int nv = 0; nv < N; ++nv) {
                if (nv == v) continue;
                if (G[v][nv] > L) continue;
                long long nused = used + G[v][nv];
                pll np = {0, 0};
                if (nused > L) np = {kaisuu + 1, G[v][nv]};
                else np = {kaisuu, nused};

                if (chmin(dist[s][nv], np)) que.push(make_pair(np, nv));
            }
        }
    }

    int Q; cin >> Q;
    while (Q--) {
        int a, b; cin >> a >> b; --a, --b;
        
        long long res = dist[a][b].first;
        if (res >= INF) cout << -1 << endl;
        else cout << res << endl;
    }
}

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

int main() {
    int N,T,A;
    cin >> N >> T >> A;
    
    int H;
    double temp=10000;
    int near=0;

    for(int i=0;i<N;i++){
        cin >> H;
        if((fabs(A-(T-H*0.006)))<temp){
            near=i;
        }
        temp=min((fabs(A-(T-H*0.006))),temp);
    }
    cout << near+1 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int n, m, l;
	cin >> n >> m >> l;
	vvi dist(n, vi(n, inf));
	
	for(int i = 0; i < n; i++) {
		dist[i][i] = 0;
	}
	
	for(int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		dist[a][b] = c;
		dist[b][a] = c;
	}
	
	for(int k = 0; k < n; k++) 
		for(int i = 0; i < n; i++) 
			for(int j = 0; j < n; j++)
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

	vvi dist2(n, vi(n, inf));
	for(int i = 0; i < n; i++) {
		dist2[i][i] = 0;
	}
	
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if (dist[i][j] <= l) dist2[i][j] = 1;
		}
	}	
	
	for(int k = 0; k < n; k++) 
		for(int i = 0; i < n; i++) 
			for(int j = 0; j < n; j++)
				dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);

	int q;
	cin >> q;
	while(q--) {
		int s, e;
		cin >> s >> e;
		s--; e--;
		cout << (dist2[s][e] >= inf ? -1 : dist2[s][e] - 1) << endl;
	}
	
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define rep(a,b) for(ll int a=0;a<b;a++)
#define Tcase int t;cin>>t;while(t--)   
int main(){
  string s,t;
  cin>>s>>t;
  cout<<t<<s<<endl;
    
return 0;
}


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

int main() {
  int N;  //合計回数
  int K;  //足す数
  
  int Q = 1;  //出力される数
  
  int A;  //操作Aをする回数
  int B = N - A;  //操作Bをする回数
  
  cin >> N >> K;  //入力
  
  for (int i = 0; i < N; i++){
  	//Kよりも小さければ、二倍する
    if (Q <= K){
      Q *= 2;
    } else if (Q > K){
      Q += K;
    }
  }
  
  //出力
  cout << Q << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>

using namespace std;

class A {
	string s;
public:
	void solve()
	{
		ostringstream oss;

		for (char c : s)
		{
			if (c == '9') oss << '1';
			else oss << '9';
		}

		cout << oss.str() << endl;
	}

	A()
	{
		cin >> s;
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

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



using namespace std;
using ll=unsigned long long;
const ll mx= 1000000000000000000;


bool is_ok(ll a,ll b){
    return (mx/a <  b ? 0 : 1);
}






int main(){
    int n,i;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++){
        cin>>arr[i];
    }
    //cout<<arr[0]*arr[1]<<"\n";
    ll ans=1;
    bool ok=1;
    sort(arr,arr+n);
    if(arr[0]!=0)
    for(i=0;i<n;i++){
        if(!is_ok(ans,arr[i])){
            ok=0;
            break;
        }
        ans*=arr[i];
        if(ans>mx)ok=0;
    }
    else ans=0;
    if(ok)
    cout<<(ll)ans;
    else cout<<-1;
    return 0;
}


Measured memory_bytes: 4348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

template <typename Operator>
struct SegmentTree {
    Operator OP;
    using TypeNode = decltype(OP.NodeE);
    int length;
    vector<TypeNode> node;
    SegmentTree (int N) {
        length = 1;
        while (length < N) length <<= 1;
        node.assign(length << 1, OP.NodeE);
    }
    SegmentTree (vector<TypeNode> &vec) {
        length = 1;
        while (length < vec.size()) length <<= 1;
        node.assign(2 * length, OP.NodeE);
        for (int i = 0; i < vec.size(); ++i) node[i + length] = vec[i];
        for (int i = length - 1; i > 0; --i) node[i] = OP.func(node[(i << 1) + 0], node[(i << 1) + 1]);
    }
    void update(int idx, TypeNode val) {
        idx += length;
        node[idx] = OP.change(node[idx], val);
        while (idx >>= 1) node[idx] = OP.func(node[(idx << 1) + 0], node[(idx << 1) + 1]);
    }
    TypeNode get(int l, int r) {
        l += length;
        r += length;
        TypeNode vl = OP.NodeE, vr = OP.NodeE;
        while (r > l) {
            if (l & 1) vl = OP.func(vl, node[l++]);
            if (r & 1) vr = OP.func(node[--r], vr);
            l >>= 1;
            r >>= 1;
        }
        return OP.func(vl, vr);
    }
};

template <typename NodeType = int>
struct hoge {
    NodeType NodeE = 1001001001;
    NodeType func(NodeType x, NodeType y) {return min(x, y);}
    NodeType change(NodeType x, NodeType y) {return y;}
};

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    
    SegmentTree<hoge<>> ST(a);
    
    ll ans = 0;
    REP(i, n) {
        ll x = 0, y = 0;
        int left = -1, right = i;
        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (ST.get(mid, i) < a[i]) left = mid;
            else right = mid;
        }
        x = right;
        left = i; right = n;
        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (ST.get(i, mid + 1) < a[i]) right = mid;
            else left = mid;
        }
        y = left;
        ans += a[i] * (i - x + 1) * (y - i + 1);
    }
    
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6096
n = int(input())
L = tuple(map(int, input().split()))
from collections import Counter
LC = Counter(L)
L = sorted(list(set(L)))
n = len(L)

ans = 0
for i in range(n-2):
    ci = LC[L[i]]
    for j in range(i+1, n):
        cj = LC[L[j]]
        for k in range(j+1, n):
            ck = LC[L[k]]
            if L[k] < L[i] + L[j]:
                ans += ci*cj*ck
print(ans)

Measured memory_bytes: 68544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	string s,t;
	cin>>n>>s>>t;
	for(int i=n;i>0;i--){
		if(s.substr(s.size()-i)==t.substr(0,i)){
			cout<<n*2-i<<endl;
			return 0;
		}
	}
	cout<<2*n<<endl;
	return 0;
}


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

int main(){
    long n;
    cin >> n;
    long i = 0;
    long sum = 0 ;
    for(i=1;i<n+1;i++){
        if(i%3!=0 && i%5!=0){
            sum +=i;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
N = int(input())
dic = {}
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

Measured memory_bytes: 36576
#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>;

int main(){
    int n,m;
    cin >> n >> m;
    if(n==m){
        cout << "Yes"<< endl;
    }
    else{
        cout << "No" << endl;
    }
    

    return 0;
}

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

using namespace std;

#define ll long long

int main(){
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
 //  	#endif
  	int n;
  	cin >> n;
  	cout << (n-2)*180 ;
}


Measured memory_bytes: 256
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}


fn main() {
    let n : i64 = get_one();
    let d = -2863311530;
    let mut plus = false;
    let mut nd = n - d;
    let mut ans = String::new();
    for i in (0..33).rev() {
        let curp = 2_i64.pow(i);
        if nd < curp {
            ans.push(if plus { '1' } else { '0' });
        }
        else {
            ans.push(if plus { '0' } else { '1' });
            nd -= curp;
        }
        plus = !plus;
    }
    let mut ans2 = String::new();
    let mut valid = false;
    for c in ans.chars() {
        if !valid && c == '0' {
            continue;
        }
        valid = true;
        ans2.push(c);
    }
    if !valid {
        ans2.push('0');
    }
    println!("{}", ans2);
}


Measured memory_bytes: 4352
#include<algorithm>  
#include<iostream>  
#include<cstdio>  
#include<map>  
#include<set>  
using namespace std;  
string s, t;  
set<string> S;    //自动排序的容器 
  
void Work()  
{  
    int lens = s.size();  
    int lent = t.size();  
    for(int i = 0; i < lens; i++)  
    {  
        if(s[i] == '?' || s[i] == t[0])//如果字符相等  
        {  
            string tmp = s;              //构造判断子串之前的字符  
            for(int j = 0; j < i; j++)  
                if(tmp[j] == '?')  
                    tmp[j] ='a';      
            bool can = false;  
            for(int j = 0; j < lent; j++)    //判断是否为子串  
            {  
  
                if(tmp[i+j]!= '?' && tmp[i+j] != t[j])  //字符匹配  
                    break;  
                tmp[i+j] = t[j];  
                if(j == lent - 1) can = true;  
            }  
            if(can)  
            {  
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';//处理匹配后的字符  
                S.insert(tmp);  //压入容器  
            }  
        }  
    }  
    if(S.size() == 0) cout << "UNRESTORABLE" << endl;  
    else cout << *S.begin() << endl;  
}  
int main()  
{  
    cin >> s >> t;  
    Work();  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<int> cnt(100005, 0);
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        cnt[a+1]++;
    }
    int mx = 0;
    for (int i = 1; i <= 100001; i++) {
        mx = max(mx, cnt[i-1] + cnt[i] + cnt[i+1]);
    }
    cout << mx << '\n';
}


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

typedef long long int ll;
typedef pair<int,int> pi;
priority_queue<pi, vector<pi>, greater<pi> > pq; //min heap

ll mini(ll a,ll b){	return a<b?a:b;}
ll maxi(ll a,ll b){	return a>b?a:b;}
ll gcd(ll a,ll b){	if(b == 0)	return a;return gcd(b,a%b);}
ll binpow(ll n,ll x){	ll ans = 1;while(x){if(x & 1)	ans *= n;n *= n;x >>= 1;}return ans;}

ll mod = 1e9+7;

ll addmod(ll a, ll b){
    return (a+b)%mod; 
}

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

    int h,w;
    cin>>h>>w;
    vector<int> dp[h+1];
    for(int i=0;i<=h;++i)   dp[i].resize(w+1,0);

    vector<string> grid;

    string s;
    for(int i=0;i<h;++i){
        cin>>s;
        grid.push_back(s);
    }

    dp[0][0] = 1;

    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            if(i+1 < h && grid[i+1][j]=='.'){
                dp[i+1][j] = addmod(dp[i+1][j], dp[i][j]);
            }
            if(j+1 < w && grid[i][j+1]=='.'){
                dp[i][j+1] = addmod(dp[i][j+1], dp[i][j]);
            }
        }
    }    

    cout<<dp[h-1][w-1]<<"\n";

    return 0;
}

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

int gcd(int a, int b)
{
    if (a < b)
        return gcd(b, a);
    int ret;
    while ((ret = a % b))
    {
        a = b;
        b = ret;
    }
    return b;
}

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int &i : a)
    {
        cin >> i;
        i -= x;
        i = i < 0 ? -i : i;
    }
    if (n == 1)
    {
        cout << a[0] << "\n";
        return 0;
    }
    int ans = gcd(a[0], a[1]);
    for (int i = 2; i < n; i++)
    {
        ans = gcd(a[i], ans);
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	int temp,ind,cc,oc;
	cc = oc = 0;
	vector<bool> color(8,false);
	for (int i = 0; i < N; ++i) {
		cin >> temp;
		ind = temp/400;
		if (ind > 7) {
			++oc;
		}
		else if (!color[ind]) {
			color[ind] = true;
			++cc;
		}
	}
	if (cc == 0) {
		cout << 1 << " " << cc+oc << endl;
	}
	else {
		cout << cc << " " << cc+oc << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for(int (I)=(A);(I)<(B);++(I))
#define ALL(C) (C).begin(),(C).end()
#define INPUT(P) cin>>(P);
#define INPUT2(P1,P2) cin>>(P1)>>(P2);
#define INPUT3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3);
#define INPUTS(I,A,B,V) FOR(I,A,B)cin>>V[I];
#define OUTPUT(P) cout<<P<<endl;
#define OUTPUTS(I,A,B,V) FOR(I,A,B)cout<<V[i]<<endl;
typedef long long ll;
const double INF = 1e9;
inline void solve()
{
  int N;
  INPUT(N)
  switch (N) {
    case 1:
    OUTPUT("Hello World")
    break;
    case 2:
    int A,B;
    INPUT2(A,B)
    OUTPUT(A+B)
    break;
  }
}
int main(int argc,char**argv)
{
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int N,K;
	cin>>N>>K;
	int D[10];
	rep1(i,K)cin>>D[i];
	
	int ans=N;
	while(true){
	int x[5];
	int y=ans;
	x[1]=y%10,y=y/10;
	x[2]=y%10;y=y/10;
	x[3]=y%10;y=y/10;
	x[4]=y%10;y=y/10;
	x[5]=y%10;y=y/10;
	bool like=true;
	rep1(i,K)if(D[i]==x[5])like=false;
	if(x[5]==0)like=true;
	rep1(i,K)if(D[i]==x[4])like=false;
	if(x[5]==0&&x[4]==0)like=true;
	rep1(i,K)if(D[i]==x[3])like=false;
	if(x[5]==0&&x[4]==0&&x[3]==0)like=true;
	rep1(i,K)if(D[i]==x[2])like=false;
	if(x[5]==0&&x[4]==0&&x[3]==0&&x[2]==0)like=true;
	rep1(i,K)if(D[i]==x[1])like=false;
	if(like)break;
	else ans++;
	}
	cout<<ans;
}

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

string s;

int main() {
	cin>>s;
	long l=s.length();
	bool flag=1;
	
	long i,j;
	for(i=0,j=l-1;i<j;++i,--j)
		if(s[i]!=s[j]) {
			flag=0;
			break;
		}
	if(flag)
	for(i=0,j=(l-3)/2;i<j;++i,--j)
		if(s[i]!=s[j]) {
			flag=0;
			break;
		}
	
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
/**
 *    created by : PawPaw       
**/

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

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define PHI acos(-1)
#define EPS 0.000000001
#define N 1000001
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key 

int solve(){
  LL n, a, b, ans, k;
  cin >> n >> a >> b;
  ans = n;
  if(a > b) swap(a, b);
  if(abs(a-b) % 2 == 0) ans = min(abs(a-b)/2, ans);
  else {
    k = n + (n-b);
    ans = min(ans, abs(k-a)/2 + 1);
    
    k = 2 - a;
    ans = min(ans, abs(k-b)/2 + 1);
  }
  ans = min(ans, max(a-1, b-1));
  ans = min(ans, max(n-a, n-b));
  cout << ans << '\n';
  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,d=0,i;
    scanf("%d %d %d",&a,&b,&c);
    for(i=a;i<=b;i++)
    {
        if(c%i==0)
        {
            d+=1;
        }
    }
    printf("%d\n",d);
//kkin
    return 0;
}



Measured memory_bytes: 2064
//http://drken1215.hatenablog.com/entry/2018/11/06/120500
//参考にさせて頂いた解説
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<int> &q){queue<int> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    int N,l,si=-1;
    cin>>N;
    vector<pair<int,int> > XY(N);
    vector<int> H(N);
    rep(i,N){
        int a,b;
        cin>>a>>b>>H[i];
        XY[i]=make_pair(a,b);
        if(H[i]>0)si=i;
    }
    rep(i,101){
        rep(j,101){
            bool ok=true;
            int x=XY[si].first,y=XY[si].second;//任意のsiを使うのは、中心点は一意に求められるという題意から。
            int l=H[si]+abs(x-i)+abs(y-j);
            rep(k,N){           
                int x=XY[k].first,y=XY[k].second;
                if(H[k]>0&&l-H[k]!=abs(x-i)+abs(y-j))ok=false;//条件文の後ろの式二つは、問題文に記載されている式を変形させたもの？  
                if(H[k]==0 && l>abs(x-i)+abs(y-j))ok=false;
                }
            if(ok){
                cout<<i<<" "<<j<<" "<<l<<endl;
                return 0;
            }
        }
    }
    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let a: u64 = it.next().unwrap().parse().unwrap();
    let b: u64 = it.next().unwrap().parse().unwrap();
    let ans = a * b / gcd(a, b);
    println!("{}", ans);
}

fn main() {
    run();
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    char A, B, C;
    cin >> A >> B >> C;
    int a = A - '0';
    int b = B - '0';
    int c = C - '0';
    int ans = 0;
    if(a >= b && a >= c) { ans = a * 10 + b + c; }
    else if(b >= a && b >= c) { ans = b * 10 + a + c; }
    else { ans = c * 10 + b + a; }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
using static System.Math;
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var av = a.Average();
        var minv = 9999999999d;  var mini = 0;
        for (int i = 0; i < n; i++)
        {
            var w = Abs(av - a[i]);
            if (w< minv) { minv = w;  mini = i; }
        }
        Console.WriteLine(mini);
    }
}


Measured memory_bytes: 13268
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            if(S == "Sunny")
            {
                Console.WriteLine("Cloudy");
            }
            else if(S == "Cloudy")
            {
                Console.WriteLine("Rainy");
            }
            else
            {
                Console.WriteLine("Sunny");
            }
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 25616
// V solo
#include <bits/stdc++.h>

#define forn(i, a, b) for (int i = a; i <= b; ++i)

using namespace std;

const int N = (int)2e5 + 1;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int n, m, used[N], a[N];
int main (){
  scanf ("%d", &n);
  forn (i, 1, n){
    scanf ("%d", a + i);
  }
  int ans = 0;
  forn (i, 1, n - 1){
    if (!used[i] && !used[i + 1]){
      if (a[i] == a[i + 1]){
        used[i + 1] = 1;
        ans++;
      }
    }
  }
  printf ("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

const int NM = int(2e5);
ll fact[NM+1], finv[NM+1], inv[NM+1];

void comb_init(int N) {
    // init
    REP(i, 2) {
        fact[i] = 1;
        finv[i] = 1;
        inv[i] = 1;
    }

    FOR(i, 2, N+1) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll comb(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;

    return (fact[n] * finv[k] % MOD) * finv[n-k] % MOD;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll N, M, K;
    cin >> N >> M >> K;

    comb_init(N*M-2);
    ll c = comb(N*M-2, K-2);

    ll ans = 0;

    // x
    REP(d, M) {
        ans = (ans + (N * N * (M - d) % MOD) * c % MOD * d % MOD) % MOD;
    }

    // y
    REP(d, N) {
        ans = (ans + (M * M * (N - d) % MOD) * c % MOD * d % MOD) % MOD;
    }
    
    cout << fixed << setprecision(20);
    cout << ans << endl;

}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
const ll L = 1e5 + 5;
ll m[L];
ll pen2[L];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll pen = 0, ac = 0;
	ll n, m2;
	cin >> n >> m2;
	ll p;
	string s;
	while (m2--) {
		cin >> p >> s;
		if (m[p] == 0 && s == "WA") pen2[p] += 1;
		else if (m[p] == 0 && s == "AC") {
			m[p] = 1;
			ac += 1;
			pen += pen2[p];
		}
	}    
	cout << ac << ' ' << pen << endl;	
	return 0;
}

Measured memory_bytes: 1792
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X = list(map(int, input().split()))
 
x = list(map(int, input().split()))
x.append(X)
x.sort()
 
res = [abs(x[i+1]-x[i]) for i in range(len(x)-1)]
print(gcd(*res))

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

#define ll long long int

ll f(string s) {
    int cnt = 0, c = 0;
    char prev = '#';
    for(int i = 0; i < s.size(); i++) {
        if(prev == '#' || s[i] == prev) {
            c++;
            if(c % 2 == 0)
                cnt++;
        }
        else {
            c = 1;
        }
        prev = s[i];
    }
    return cnt;
}

bool isSame(string s) {
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != s[0])
            return false;
    }
    return true;
}

int main() {
    string s; ll k;
    cin >> s >> k;
    if(isSame(s)) {
        cout << k * s.size() / 2 << endl;
        return 0;
    }
    ll first = f(s);
    ll diff = f(s + s) - first;
    ll ans = first + diff * (k - 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256