akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin>>N;
  map<string, int> card;  // 名前→成績
  for(int i=0;i<N;i++){
    string s;
    cin >>s;
    if(card.count(s)){
      card[s] ++;
    }
    else{
      card[s] =1;
    }
  }
  cin>>M;
  for(int i=0;i<M;i++){
    string s;
    cin >>s;
    if(card.count(s)){
      card[s] --;
    }
    else{
      card[s] =-1;
    }
  }
  /*
  for(auto p: card){
    auto n = p.first;
    auto v = p.second;
    cout<< n<<":"<<v<<endl;
  }
*/
  int pay=0;
  for(auto p: card){
    auto v = p.second;
    pay = max(pay,v);
  }
  cout<< pay<<endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, m := nextInt(), nextInt()

	ans := n*(n-1)/2 + m*(m-1)/2
	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	ll n;
	cin>>n;
	ll v[n],c[n];
	input(v,n);
	input(c,n);
	ll ans=0;
	for(ll i=0;i<n;i++)
	ans+=max((ll)0,v[i]-c[i]);
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>
#include <cmath>

#define rep(i, n) for(int i = 0;i < (int)(n); i++)
#define pb push_back
typedef long long ll;

using namespace std;


int n;//頂点数
int m;//辺数
bool graph[60][60]; //graph[i][j] は iからjが繋がっているということ
bool vis[60]; //連結しているかをしらべるために辿ったことを表す配列

void dfs(int x) {//頂点xを訪れるという関数
    if (vis[x]) return;//すでに見ていたら
    vis[x] = true; //xに到達
    rep(i, n) {
        if (graph[x][i]) { //xとiが繋がっていたらという意味
            dfs(i);
        }
    }
}

int main(void) {
    vector<pair<ll, ll>> pm;
    cin >> n >> m;
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        pm.pb(make_pair(a,b));
        graph[a - 1][b - 1] = true;
        graph[b - 1][a - 1] = true;
    }
    int ans = 0;
    for (int j = 0; j < m; j++) {
        graph[pm[j].first - 1][pm[j].second - 1] = false;
        graph[pm[j].second- 1][pm[j].first - 1] = false;
        for (int i = 0; i < n; i++) vis[i] = false;
        dfs(0);//全部繋がってなかったらという判定なのでどこでもいい.
        graph[pm[j].first- 1][pm[j].second - 1] = true;
        graph[pm[j].second - 1][pm[j].first - 1] = true;
        bool connected = true;
        rep(i, n) {
            if (!vis[i]) {//dfsで探索して,全部繋がってなかったらfalse
                connected = false;
            }
        }
        if(!connected) ans++;

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


Measured memory_bytes: 256
package main

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

func main() {
	N, S := ReadInt(), ReadString()
	t := []byte(S)
	for i := 0; i < len(t); i++ {
		t[i] = (((t[i] - 'A') + byte(N)) % 26) + 'A'
	}
	fmt.Println(string(t))
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 1960
import numpy as np
N,K = map(int,input().split())
MOD = 10 ** 9 + 7
M = int(N**.5)

# M+1以上で、商がぢょうとxになるやつ
upper_cnt = np.zeros(M+1, dtype=np.int64)
a = np.arange(M+1, dtype=np.int64)
upper_cnt[1:] = N // a[1:] - np.maximum(M, N // (a[1:]+1))

# 数列の末端ごとの個数
# upperについては、個数にわたって合計をとる
lower = np.zeros(M+1, dtype=np.int64)
upper = np.zeros(M+1, dtype=np.int64)
# 0項目に1を置いておくとする
lower[1] = 1
for k in range(1,K+1):
    prev_lower = lower
    prev_upper = upper
    cum_lower = prev_lower.cumsum() % MOD
    cum_upper = prev_upper.cumsum() % MOD
    # 下側 to 下側
    lower = np.zeros(M+1, dtype=np.int64)
    lower += (cum_lower[-1] + cum_upper[-1])
    lower[1:] -= cum_upper[:-1] # 商がn-1以下だと受け付けない
    lower[0] = 0
    # 上側 to 上側：ないはず
    # 下側 to 上側：
    upper = cum_lower * upper_cnt
    lower %= MOD
    upper %= MOD
    
answer = (lower.sum() + upper.sum()) % MOD
print(answer)

Measured memory_bytes: 22636
def make_divisors(n,m):
    divisors = []
    for i in range(1,min(int(m**(1/2))+1,int(m//n)+1)):
      if m % i == 0:
          divisors.append(i)
          if i != m // i and m//i<=m//n:
              divisors.append(m//i)
    return divisors
n,m=map(int,input().split())
print(max(make_divisors(n,m)))



Measured memory_bytes: 3064
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
var n = +input.shift();
var nums = input.shift().split(' ').map(Number);
var swapTimes = 0;

function selectionSort(numbers) {
  for (var i = 0; i < numbers.length; i++) {
    var minIndex = i;
    for (var j = i; j < numbers.length; j++) {
      if (numbers[j] < numbers[minIndex]) minIndex = j;
    }

    if (minIndex !== i) {
      var tmp = numbers[i];
      numbers[i] = numbers[minIndex];
      numbers[minIndex] = tmp;
      swapTimes++;
    }
  }

  console.log(numbers.join(' '));
  console.log(swapTimes);
}

selectionSort(nums);

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

int sa(int a,int b){
	if(a>=b) return a-b ;
	else return b-a ;
}

int main(){
	int n ; cin >> n ;
	vector<int> h(n) ;
	for(int i=0;i<n;i++) cin >> h.at(i) ;
	vector<int> c(n,0) ;
	c.at(0) = 0 ;
	c.at(1) = sa(h.at(0),h.at(1)) ;
	for(int i=2;i<n;i++){
		c.at(i) = min(c.at(i-2)+sa(h.at(i),h.at(i-2)),c.at(i-1)+sa(h.at(i),h.at(i-1))) ;
	}
	cout << c.at(n-1) << endl ;
}

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


int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	if (a > b) {
		int tmp = a;
		a = b;
		b = tmp;
	}

	if (b > c) {
		int tmp = b;
		b = c;
		c = tmp;
	}

	if (a > b) {
		int tmp = a;
		a = b;
		b = tmp;
	}

	cout << a << " " << b << " " << c << endl;

    return 0;
}



Measured memory_bytes: 3088
#include<cstdio>
#include<algorithm>
using namespace std;
static const int MAX_A = 300000;

int N, Q;
int A[MAX_A + 1];

int main(){
	scanf("%d %d", &N, &Q);
	for(int i = 0; i < N; i++){
		int num;
		scanf("%d", &num);
		A[num] = 1;
	}
	for(int i = 1; i <= MAX_A; i++) A[i] += A[i - 1];
	for(int i = 0; i < Q; i++){
		int q;
		scanf("%d", &q);
		int res = 0;
		for(int j = 0; j <= MAX_A; j += q){
			int num;
			if(j + q >= MAX_A + 1) num = lower_bound(A + j, A + MAX_A + 1, A[MAX_A]) - (A + j);
			else num = lower_bound(A + j, A + j + q, A[j + q - 1]) - (A + j);
			res = max(res, num);
		}
		printf("%d\n", res);
	}
	return 0;
}



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

int main() {
	int N, K;
  	cin >> N >> K;
  	
  	int l = 1;
  	for (int i=0; i<N; i++) {
    	if(l * 2 > l + K) {
        	l = l + K;
        }
      	else if (l + K >= l * 2) {
        	l = l * 2;
        }
    }
  	cout << l << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 5;
int arr[mx], brr[mx];
int main()
{
    int n;
    cin >> n;
    for (int i=0; i<n; i++)
    {
        cin >> arr[i];
        brr[i] = arr[i];
    }
    sort(brr, brr + n);
    for (int i=0; i<n; i++)
    {
        if (arr[i]<brr[n/2])
            cout<<brr[n/2]<<endl;
        else
            cout<<brr[n/2-1]<<endl;
    }
}


Measured memory_bytes: 3712
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    int n = SZ(s);
    int k = 1;
    string last;
    vector<string> part;
    for(int i = 0; i < n; i++){
        if(i == 0){
            last = s[i];
            part.PB(last);
        }else{
            string t;
            t += s[i++];
            while(i < n && t == last){
                t += s[i];
                i++;
            }
            i--;
            if(t == last){
                part.pop_back();
                part.PB(last + t);
                last = last + t;
            }else{
                part.PB(t);
                last = t;
            }
        }
    }
    cout << SZ(part);
    return 0;
}
/*
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 11016
#include<bits/stdc++.h>
using namespace std;
int main(void){
char str[100 + 1];
cin>>str;
int n = strlen(str); 
for (int i = 0; i < n; i++) {
 if (i % 2 == 0) {
if (str[i] == 'L') {
 cout<<"No";
 return 0;
}
} 
  else {
if (str[i] == 'R') {
 cout<<"No";
return 0;
}
 }
 }

cout<<"Yes";
   return 0;
 }


Measured memory_bytes: 3600
/**
 *   author: sahushivam
 *   created: 26 January 2020 (Sunday)  17:40:15
**/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

void solve(){
	int h; cin>>h;
	int ans=0;
	int level=0;
	while(h>0)
	{
		int k=pow(2,level);
		level++;
		h=h/2;
		ans+=k;
	}
	cout<<ans;
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int t=1; while(t--) solve();
    return 0;
}

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

#define IL __inline__ __attribute__((always_inline))

#define For(i, a, b) for (int i = a, i##end = b; i <= i##end; ++ i)
#define FOR(i, a, b) for (int i = a, i##end = b; i < i##end; ++ i)
#define Rep(i, a, b) for (int i = a, i##end = b; i >= i##end; -- i)
#define REP(i, a, b) for (int i = (a) - 1, i##end = b; i >= i##end; -- i)

typedef long long LL;

template <class T>
IL bool chkmax(T &a, const T &b) {
  return a < b ? ((a = b), 1) : 0;
}

template <class T>
IL bool chkmin(T &a, const T &b) {
  return a > b ? ((a = b), 1) : 0;
}

template <class T>
IL T mymax(const T &a, const T &b) {
  return a > b ? a : b;
}

template <class T>
IL T mymin(const T &a, const T &b) {
  return a < b ? a : b;
}

template <class T>
IL T myabs(const T &a) {
  return a > 0 ? a : -a;
}

const int INF = 0X3F3F3F3F;
const double EPS = 1E-10, PI = acos(-1.0);

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define OK DEBUG("Passing [%s] in LINE %d...\n", __FUNCTION__, __LINE__)
/*------------------------------header------------------------------*/

int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a <= 0 && b >= 0) {
    puts("Zero");
  } else if (a > 0) {
    puts("Positive");
  } else {
    puts((b - a + 1) & 1 ? "Negative" : "Positive");
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MN 200005
#define LL long long
#define mp make_pair
#define fir first
#define sec second
#define pii pair<int,int>
inline void chkmax(int &a,int b){if(a<b)a=b;}
inline void chkmin(int &a,int b){if(a>b)a=b;}
inline int read(){
	   int a=0,fh=1;char c=getchar();
	   while(c>'9'||c<'0'){if(c=='-')fh=-1;c=getchar();}
	   while('0'<=c&&c<='9'){
		   a=a*10+c-48;
		   c=getchar();
	   }
	   return a*fh;
}
int main(){
	int a,n;
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a;
		if(a%2==0&&a%3!=0&&a%5!=0){
	puts("DENIED");return 0;}
	}puts("APPROVED");
	return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i) // ROF(i,n,0)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで降順
#define SUM(a) accumulate(all(a),int(0))
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>T add(const T &a, const T &b){return (a+b)%mod;}

signed main(){
  int n, m; cin >> n >> m;
  priority_queue<int> q;
  rep(i,n){
    int a; cin >> a;
    q.push(a);
  }

  rep(i,m){
    int a = q.top();
    q.pop();
    q.push(a/2);
  }

  int ans = 0;
  while(!q.empty()){
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 1400
// https://atcoder.jp/contests/agc032/tasks/agc032_a

#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long a, b, c;
    cin >> a >> b >> c;

    if (c > a + b) {
        cout << a + 2 * b + 1<< endl;
    } else {
        cout << b + c << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

char img[57][57], temp[57][57];
int main(){
	Lancer();
	ll n, res=1;
	cin >> n;
	for (int i = 1; i <=n; i++){
		res *= i;
		res %= 1000000007;
	}
	cout << res;
	cout << endl;
	return 0;
}


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

int main() {
  string s,t;
  cin>>s>>t;
  int n,m;
  n=s.size();
  m=t.size();
  if(n-m==0){
    for(int i=0;i<n;i++) cout<<s[i]<<t[i];
  }
  else{
    for(int i=0;i<n-1;i++) cout<<s[i]<<t[i];
    cout<<s[n-1]<<endl;
  }
}


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

vector<int> deck;

void swap(int n,int p,int c){
  int tmp[p-1];
  for(int i=0;i<p-1;i++)
    tmp[i]=deck[n-1-i];
  for(int i=0;i<c;i++){
    deck[n-1-i]=deck[n-p-i];
  }
  for(int i=0;i<p-1;i++)
    deck[n-1-c-i]=tmp[i];

}

int main(){
  int n,r,c,p;
  while(cin>>n>>r,n){
      deck.clear();
    for(int i=0;i<n;i++)
      deck.push_back(i+1);
    for(int i=0;i<r;i++){
      cin>>p>>c;
      swap(n,p,c);
    }
    // for(int i=0;i<deck.size();i++)
    //cout<<deck[deck.size() - 1 - i]<<endl;
    //cout<<endl;
    cout<<deck[deck.size()-1]<<endl;
  }
  return 0;
}

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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  sort(S.begin(), S.end());
  string answer = "";
  for (int i = 0; i < N; i++) {
    answer += S[i];
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	LL n, p;
	cin >> n >> p;
	LL ans = 1;
	for(LL i = 2; i * i <= p; ++i){
		if(p % i == 0){
			LL c = 0;
			for(; p % i == 0; p /= i){ ++c; }
			for(; c >= n; c -= n){ ans *= i; }
		}
	}
	if(n == 1){ ans *= p; }
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
As = gets.split.map(&:to_i)
BCs = readlines.map{|l| l.split.map(&:to_i)}

puts (As.map{|a| [1, a]} + BCs).sort_by{|b, c| -c}.lazy.flat_map{|b, c| [c] * b}.take(N).inject(:+)

Measured memory_bytes: 32284
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int n, m;
vector<int>graph[114514];
bool flag[114514];
int v1, v2;
void dfs(int v, vector<int>&p)
{
	flag[v] = true;
	for (int nex : graph[v])
	{
		if (!flag[nex])
		{
			p.push_back(nex);
			dfs(nex, p);
			break;
		}
	}
}

int main(void)
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int a, b;
		cin >> a >> b;
		--a; --b;
		graph[a].push_back(b);
		graph[b].push_back(a);
		v1 = a; v2 = b;
	}
	vector<int>h1, h2;
	h1.push_back(v1);
	h2.push_back(v2);
	flag[v1] = flag[v2] = true;
	dfs(v1, h1);
	dfs(v2, h2);
	vector<int>ans;
	for (auto itr = h1.rbegin(); itr != h1.rend(); ++itr)ans.push_back(*itr);
	for (auto itr = h2.begin(); itr != h2.end(); ++itr)ans.push_back(*itr);
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); ++i)
	{
		cout << ans[i] + 1 << " \n"[i == ans.size() - 1];
	}
	return 0;
}


Measured memory_bytes: 10104
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a,long long int b){
    if (b == 0)
      return a;
   return gcd(b, a % b);
}
long long int lcm(long long int a,long long int b){
    return (a*b)/gcd(a, b);
}

int main()
{
    long long int a,b,c,d,x,y,z;
     cin>>a>>b>>c>>d;
    x=(b/c-(a-1)/c);
    y=(b/d-(a-1)/d);
    z=(b/lcm(c,d)-(a-1)/lcm(c,d));
    x=x+y-z;


  cout<<b-a+1-x<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    int ans = 0;
    for(int i = 0; i < N - 2; i++){
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ans++;
    }

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


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

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

const int64 mod = 1e9+7;

vector<int32> G[112345];
int32 N;
vector<int64> A;

int64 dfs(int32 v, int32 p){
	if(G[v].size() == (p != -1)) return A[v];
	vector<int64> c;
	int64 sum = 0;
	REP(i, G[v].size()){
		if(G[v][i] == p) continue;
		c.push_back(dfs(G[v][i], v));
		sum += c[c.size()-1];
		if(c[c.size()-1] == -1) return -1;
	}
	sort(all(c), greater<int64>());
	int64 x = 2*A[v]-sum;
	if(A[v] > sum || (sum-x)%2) return -1;
	if(p == -1){
		if(G[v].size() > 1 && x != 0) return -1;
	}
	if((sum-x)/2 <= (sum-c[0]) && (sum-x)/2 <= sum/2) return x;
	return -1;
}

int main(void){
	cin >> N;
	A.resize(N);
	REP(i, N) cin >> A[i];
	REP(i, N-1){
		int32 a, b;
		cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	if(dfs(0, -1) == -1) cout << "NO" << endl;
	else cout << "YES" << endl;
}


Measured memory_bytes: 17408
s = gets.chomp
n = s.size

if s == "zyxwvutsrqponmlkjihgfedcba"
    puts -1
elsif n == 26
    (25).downto(1) do |i|
        next if s[i] < s[i-1]

        l = s[i-1].next
        s.slice!(i-1..25)

        (l.."z").each do |c|
            next if s.index(c)
            puts s + c
            break
        end

        break
    end
else
    ("a".."z").each do |c|
        next if s.index(c)
        puts s + c
        break
    end
end

Measured memory_bytes: 3836
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    bool f[4] = {false};
    for (int i = 0; i < 4;i++){
        int a;
        cin >> a;
        if(a==1)
            f[0] = true;
            if(a==9)
                f[1] = true;
                if(a==7)
            f[2] = true;
            if(a==4)
            f[3] = true;
    }
    bool flag = true;
    for (int i = 0; i < 4;i++){
        if(f[i]==false)
            flag = false;
    }
    if(flag)
        cout << "YES" << endl;
        else
            cout << "NO" << endl;
        return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int r,d,x;
    cin >> r >> d >> x;

    int y = x;
    for (int i = 1; i <= 10; i++)
    {
        int calc = (r * y) - d;
        cout << calc << endl;
        y = calc;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int x, y, s, t;
	cin >> x >> y >> s >> t;

	string path = "";
	int cx = x, cy = y;
	int vertical = t - y;
	int horizontal = s - x;
	path += string(vertical, 'U');
	path += string(horizontal, 'R');
	path += string(vertical, 'D');
	path += string(horizontal, 'L');

	path += 'L';
	path += string(vertical + 1, 'U');
	path += string(horizontal + 1, 'R');
	path += 'D';
	path += 'R';
	path += string(vertical + 1, 'D');
	path += string(horizontal + 1, 'L');
	path += 'U';

	cout << path << "\n";

	return 0;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int x, y;
char op;
for (int i = 0; ; i++){
cin >> x >> op >> y;
if (op=='+') cout << x+y << endl;
else if (op=='-') cout << x-y << endl;
else if (op=='*') cout << x*y << endl;
else if (op=='/') cout << x/y << endl;
else if (op=='?') break;
}
}

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

int main()
{
	string s;
    cin>>s;
    int count=0,count1=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='A')
            count++;
        else count1++;
    }
    if(count&&count1)
        cout<<"Yes\n";
    else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		if (n<105) System.out.println(0);
		else if (n<135) System.out.println(1);
		else if (n<165) System.out.println(2);
		else if (n<189) System.out.println(3);
		else if (n<195) System.out.println(4);
		else System.out.println(5);
	}
}

Measured memory_bytes: 25044
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner (System.in);
		int A,B,C;
		A = input.nextInt();
		B = input.nextInt();
		C = input.nextInt();
	if ((A==5&&B==5&& C== 7)|| (A==5&&B==7&& C== 5) || (A==7&&B==5&& C== 5) )
 { System.out.println("YES");}		
		else { System.out.println("NO");}

				
	}

}



Measured memory_bytes: 27060
import sys
from collections import Counter

N = int(sys.stdin.readline().rstrip())
As = list(map(int, sys.stdin.readline().rstrip().split()))

ll = [0] * N
lr = [0] * N
for i, a in enumerate(As):
    ll[i] = i + a
    lr[i] = i - a

cl = Counter(ll)
cr = Counter(lr)

ans = 0
for l in cl.keys():
    ans += cl[l] * cr[l]

print(ans)

Measured memory_bytes: 63492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

int N;

int main()
{
	cin >> N;
	if(N==1){
		cout << "Hello World" << endl;
	}else{
		ll a, b;
		cin >> a >> b;
		cout << a+b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}



int main(){
    double r;
    cin>>r;
    double area = r*r*M_PI;
    double circumference = 2*r*M_PI;
    cout<<setprecision(20)<<area<<" "<<setprecision(20)<<circumference<<endl;;
    return 0;
}
 




Measured memory_bytes: 3232
use io::*;

fn main() {
    let con =read_string();
    let mut sc =Scanner::new(&con);

    let n:i32 =sc.next();

    let mut ans:i32 =0;
    for i in 1..n+1{
        if i%2==0{
            continue;
        }
        let mut sum=0;
        for j in 1..i+1{
            if i%j==0{
                sum+=1;
            }
        }
        if sum==8{
            ans+=1;
        }
    }
    println!("{}",ans);
}

pub mod io {
    use std;
    use std::str::FromStr;
 
    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }
 
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }
 
        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }
 
        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }
 
        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }
 
    pub fn read_string() -> String {
        use std::io::Read;
 
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }
 
    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
int main() {
    int a,b,c;
    std::cin >> a >> b >> c;
    if (a==5 && b==5 && c==7){
        std::cout << "YES";
    }
    else if (a==7 && b==5 && c==5){
        std::cout << "YES";
    }
    else if (a==5 && b==7 && c==5){
        std::cout << "YES";
    }
    else {
        std::cout << "NO";
    }
    
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
 
struct Puddle{
    int start, end, area;
};
 
int main(){
    string str;
    cin >> str;
    int n = str.size(), overall = 0;
    stack<Puddle> S;
    stack<int> slope;
    Puddle temp; 

    for(int i = 0; i < n; i++){
        if(str[i] == '\\'){
            slope.push(i);
        } else if(str[i] == '/'){
            if(!slope.empty()){
                int b = slope.top();
                slope.pop();
                temp.start = b;
                temp.end = i;
                temp.area = i-b;
                overall += temp.area;
                while( !S.empty() ){
                    if(temp.start < S.top().start){
                        temp.area += S.top().area;
                        S.pop();
                    } else {
                        break;
                    }
                }
                S.push(temp);
            }
        }
    }
    cout << overall << endl;
    int m = S.size(), A[m];
    cout << m;
    for(int i = 0; i < m; i++){
        A[m - i - 1] = S.top().area;
        S.pop();
    }
    for(int i = 0; i < m; i++)
        cout << " " << A[i];
    cout << endl;
}

Measured memory_bytes: 1312
#include <iostream>
#include <string>

int main()
{
    std::string S;
    std::cin >> S;
    std::string S2 = S;
    int cnt = 0, cnt2 = 0;

    for (int i = 0; i < S.length(); ++i) {
        if (i % 2) {
            if (S[i] == '0') {
                S[i] = '1';
                ++cnt;
            }
            if (S2[i] == '1') {
                S2[i] = '0';
                ++cnt2;
            }
        } else {
            if (S[i] == '1') {
                S[i] = '0';
                ++cnt;
            }
            if (S2[i] == '0') {
                S2[i] = '1';
                ++cnt2;
            }
        }
    }

    int ans = cnt <= cnt2 ? cnt : cnt2;
    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
    int p=0;
	// ユークリッドの方法
	while( m > n )
	{
        m = m/2;
        p+=1;
	}
	return p;
}//gcd

int main()
{
    int a;
    char s[10];
    cin >> a >> s;
    if(a >= 3200){
        cout << s;
    }else{
        cout << "red";
    }
}

Measured memory_bytes: 256
/*
AtCoder Submission
*/

#include<bits/stdc++.h>

using namespace std;

/* Typedefs */
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <string,string> mss;

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

    string s;
    cin >> s;

    bool a = false, b = false, c = false;
    bool valid = true;
    for(char x : s){
        switch(x){
            case 'a':
                if(a) valid = false;
                else a = true;
                break;
            case 'b':
                if(b) valid = false;
                else b = true;
                break;
            case 'c':
                if(c) valid = false;
                else c = true;
                break;
            default:
                valid = false;
                break;
        }
    }

    if(a && b && c && valid) cout << "Yes" << endl;
    else cout << "No";

    return 0;
}


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

int main(){
	int n,m;
	cin >> n >> m;
	map<int,int> mp;
	rep(i,3){
		mp[i] = -1;
	}
	bool exist = true;
	rep(i,m){
		int s,c;
		cin >> s >> c;
		s--;
		if(mp[s] != -1 && mp[s] != c) exist = false;
		mp[s] = c;
	}
	if(!exist){
		cout << -1 << endl;
		return 0;
	}
	
	rep(i,1000){
		bool ok = true;
		string t = to_string(i);
		if(t.size() != n) continue;
		rep(j,t.size()){
			if(mp[j] != -1 && mp[j] != t[j] - '0') ok = false;
		}
		if(ok){
			cout << t << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;
    return 0;
}



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

int main(){
    ll A, B;
    cin >> A >> B;
    ll K = 1;
    while (true)
    {
        if(abs(A-K) == abs (B-K)){
            cout << K << endl;
            break;
        }else{
            K++;
        }
        if(K > A && K > B){
            cout << "IMPOSSIBLE" << endl;
            break;
        }
    }
    
}

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

using namespace std;
     
int main()
{
  int N, V[50], C[50];
  
  cin >> N;
  for( int i=0; i< N; i++ ) cin >> V[i];
  for( int i=0; i< N; i++ ) cin >> C[i];
  
  int x_y = 0;
  for( int i=0; i< N; i++ ) {
    int s = x_y + V[i] - C[i];
    if( s > x_y ) {
      x_y = s;
    }
  }
  
  cout << x_y << endl;

  return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    int count = 0;
    REP(i, S.size()) {
        if (i % 2) {
            if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') count++;
        } else {
            if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D') count++;
        }
    }
    if (count == S.size()) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  int s[m],c[m];
  for(int i=0;i<m;i++) {
    cin>>s[i]>>c[i];
    if(n!=1 && s[i]==1 && c[i]==0){
      cout<<-1<<endl;
      return 0;
    }
  }
  bool check=true;
  for(int i=0;i<m-1;i++){
    for(int j=i+1;j<m;j++){
      if(s[i]==s[j] && c[i]!=c[j]) check=false;
    }
  }
  if(!check){
    cout<<-1<<endl;
    return 0;
  }
  int ans[8];
  for(int i=0; i<8;i++) ans[i]=-1;
  for(int i=0;i<m;i++) ans[s[i]]=c[i];
  for(int i=1;i<=n;i++){
    if(ans[i]!=-1) cout<<ans[i];
    else if(n==1 || i!=1)cout<<0;
    else cout<<1;
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
from numpy import array, sum
n, m, c = map(int, input().split())
B = array(list(map(int, input().split())))
s = 0
for _ in range(n) :
    A = array(list(map(int, input().split())))
    if sum(A*B)+c>0 : s += 1
print(s)

Measured memory_bytes: 12424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

ll N, M;
ll a[2010], b[2010], c[2010];


signed main(void){
	cin >> N >> M;
	rep(i, M) cin >> a[i] >> b[i] >> c[i];
	rep(i, M) a[i]--, b[i]--;

	vector<long long> d(N, -INFF);
	d[0] = 0;
	rep(i, N)rep(j, M){
		chmax(d[b[j]], d[a[j]] + c[j]);
	}
	ll ans1 = d[N - 1];
	rep(j, M){
		chmax(d[b[j]], d[a[j]] + c[j]);
	}
	ll ans2 = d[N - 1];
	if(ans1 != ans2) printf("inf\n");
	else printf("%lld\n", ans1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int d[n];
	for(int i=0;i<n;i++){
		cin>>d[i];
	}
	int c=0,keta=1,flg=1;
	while(flg==1){
		flg=0;
		int keta10=pow(10,keta);
		if(c/keta10==1){
			keta++;
		}
		int a[keta];
		for(int i=0;i<keta;i++){
			int cc=c/pow(10,i);
			a[keta-i-1]=cc%10;
		}
		for(int i=0;i<=n-keta;i++){
			for(int j=0;j<keta;j++){
				if(d[i+j]!=a[j]) goto end;
			}
			flg=1;
			end:;
		}
		c++;
	}
	cout<<c-1<<endl;
    return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
using namespace std;
int main() {
  string str1, str2, str3;
  cin >> str1 >> str2 >> str3;
  cout << (char)(str1[0] - 32) << (char)(str2[0] - 32) << (char)(str3[0] - 32) << endl;
}

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


int main() {
	cout << setprecision(10);
	cerr << setprecision(10);
	int N, K;
	cin >> N >> K;
	vector<long double>A(N);
	long double maxsize = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		maxsize = (maxsize > A[i] ? maxsize : A[i]);
	}
	long double eps = 0.00001;
	long double l = eps;
	long double r = maxsize;
	while (r - l > eps) {
		long double x = (l + r) / 2;
		long long count = 0;
		for (int i = 0; i < N; ++i) {
			count += floor((A[i] / x));
			/*if (0 != fmod(A[i], x)) {
				count++;
			}*/
		}
		if (count > K) {
			l = x;
		}
		else {
			r = x;
		}
	}
	cout << ceil(r - eps) << endl;
	/*
	int ans = r / 1;
	if (0 != fmod(r, 1)) {
		ans++;
	}
	cout << ans << endl;*/
	return 0;
}


Measured memory_bytes: 6232
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s=="SUN") cout<<7<<'\n';
    else if(s=="SAT") cout<<1<<'\n';
    else if(s=="FRI") cout<<2<<'\n';
    else if(s=="THU") cout<<3<<'\n';
    else if(s=="WED") cout<<4<<'\n';
    else if(s=="TUE") cout<<5<<'\n';
    else if(s=="MON") cout<<6<<'\n';
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

const int MAX = 1e5+10;

int N, A, B, C;
string S[MAX];

bool dfs(vector<char> &res, int i) {
    if (i == N) return true;
    int &P = (S[i] == "AB") ? A : ((S[i] == "BC") ? B : C);
    int &Q = (S[i] == "AB") ? B : ((S[i] == "BC") ? C : A);
    int &R = (S[i] == "AB") ? C : ((S[i] == "BC") ? A : B);

    if (P == 0 && Q == 0) return false;
    if (P == 0) {
        P++;
        Q--;
        res.push_back(S[i][0]);
        return dfs(res, i+1);
    } else if (Q == 0) {
        P--;
        Q++;
        res.push_back(S[i][1]);
        return dfs(res, i+1);
    }
    if (i == N-1) {
        P++;
        Q--;
        res.push_back(S[i][0]);
        return dfs(res, i+1);
    }

    if (S[i] == S[i+1]) {
        if (P > Q) {
            P--;
            Q++;
            res.push_back(S[i][1]);
        } else {
            P++;
            Q--;
            res.push_back(S[i][0]);
        }
        return dfs(res, i+1);
    }

    if (S[i][0] == S[i+1][1]) {
        P++;
        Q--;
        res.push_back(S[i][0]);
        return dfs(res, i+1);
    } else {
        P--;
        Q++;
        res.push_back(S[i][1]);
        return dfs(res, i+1);
    }

    assert(false);
}

void solve() {
    REP (i, N) if (S[i] == "AC") S[i] = "CA";
    vector<char> res;
    if (dfs(res, 0)) {
        cout << "Yes" << endl;
        FORE (r, res) cout << r << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    cin >> N >> A >> B >> C;
    REP (i, N) cin >> S[i];
    solve();
}

Measured memory_bytes: 6876
#include <iostream>
#include <queue>
#include <string>
#include <cstdio>
using namespace std;

int main(){
  int a,b,d,cou,c;
  queue<int> t;
  queue<string> n;
  string g;
  char h;
  cin>>a>>b;
  for(int i=0;i<a;i++){
    cin>>g>>d;
    n.push(g);
    t.push(d);
  }
  cou=0;
  while(!t.empty()){
    g=n.front();n.pop();
    d=t.front();t.pop();
    if(d>b){
      n.push(g);
      t.push(d-b);
      cou+=b;
    }else {
      cou+=d;
      cout<<g<<" "<<cou<<endl;
    }
  }
  return 0;
}
    

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> ans(n);
    rep(i,n){
        ans[a[i]-1] = i+1;
    }
    rep(i,n) cout << ans[i] << endl;
    
    return 0;
}

Measured memory_bytes: 1664
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::HashMap;

const R: u64 = 1000000007;

fn pow(n: u64, p: u64, r: u64) -> u64 {
    let mut ret;

    if p == 0 {
        ret = 1;
    } else {
        ret = pow(n, p / 2, r);
        ret = ret * ret % r;
        if p % 2 == 1 {
            ret = ret * n % r;
        }
    }

    ret
}

fn fact(hm: &mut HashMap<u64, u64>, mut a: u64) {
    while a != 1 {
        let mid = (a as f64).sqrt() as u64;
        let mut k = a;
        let mut v = *hm.get(&a).unwrap_or(&0);
        for n in 2..mid + 1 {
            if a % n == 0 {
                k = n;
                v = *hm.get(&n).unwrap_or(&0);
                break;
            }
        }
        if k == a {
            a = 1;
        } else {
            a /= k;
        }
        hm.insert(k, v + 1);
    }
}

fn union(hm: &mut HashMap<u64, u64>, tmp: &HashMap<u64, u64>) {
    for (k, v1) in tmp.iter() {
        let mut v = *hm.get(k).unwrap_or(&0);
        if *v1 > v {
            v = *v1;
        }
        hm.insert(*k, v);
    }
}

fn lcm(a: &Vec<u64>, n: usize) -> u64 {
    let mut hm = HashMap::new();

    for i in 0..n {
        let mut tmp = HashMap::new();
        fact(&mut tmp, a[i]);
        union(&mut hm, &tmp);
    }

    let mut ret = 1;

    for (k, v) in hm.iter() {
        ret = ret * pow(*k, *v, R) % R;
    }

    ret
}

fn main() {
    let n: usize = read();
    let a: Vec<u64> = read_vec();

    let tmp1 = lcm(&a, n);

    let mut tmp2 = 0;
    for i in 0..n {
        tmp2 = (tmp2 + pow(a[i], R - 2, R)) % R;
    }

    let ans = tmp1 * tmp2 % R;

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


Measured memory_bytes: 4352
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
C = sum(sum(a&1 for a in aa) for aa in A)
if C&1:
    for i in range(1,H+1):
        for j in range(1,W+1)[::(i&1)*2-1]:
            if A[i-1][j-1]&1:
                A[i-1][j-1]=0
                break
        else:
            continue
        break
R = []
prev = None
for i in range(1,H+1):
    for j in range(1,W+1)[::(i&1)*2-1]:
        if prev is None:
            if A[i-1][j-1] & 1:
                prev = i, j
        else:
            y, x = prev
            R.append((y, x, i, j))
            if A[i-1][j-1] & 1:
                prev = None
            else:
                prev = i, j

print(len(R))
for r in R:
    print(*r)

Measured memory_bytes: 22696