akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
        int h, w;
        while (1) {
                cin >> h >> w;
                if (h==0 && w==0) break;

                for (int i=0; i<h; i++) {
                        for (int j=0; j<w; j++) {
                                if(i==0 || i==h-1 || j==0 || j==w-1) {
                                        cout << "#";
                                } else {
                                        cout << ".";
                                }
                        }
                        cout << "\n";
                }
                cout << endl;
        }
        return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

struct Mint{
    int v;
    const long long MOD = 1000000007;
    Mint():v(0){}
    Mint(signed v):v(v){}
    Mint(long long t){v=t%MOD; if(v<0)v+=MOD;}

    Mint pow(long long k){
        Mint res(1), tmp(v);
        while(k){
            if(k&1)res*=tmp;
            tmp*=tmp;
            k>>=1;
        }
        return res;
    }
    Mint inv(){return pow(MOD-2);}

    Mint& operator+=(Mint a){v+=a.v; if(v>=MOD)v-=MOD; return *this;}
    Mint& operator-=(Mint a){v+=MOD-a.v; if(v>=MOD)v-=MOD; return *this;}
    Mint& operator*=(Mint a){v=1LL*v*a.v%MOD; return *this;}
    Mint& operator/=(Mint a){return (*this)*=a.inv();}
  
    Mint operator+(Mint a) const{return Mint(v)+=a;};
    Mint operator-(Mint a) const{return Mint(v)-=a;};
    Mint operator*(Mint a) const{return Mint(v)*=a;};
    Mint operator/(Mint a) const{return Mint(v)/=a;};

    Mint operator-(){return v ? MOD-v : v;}
    bool operator==(Mint a)const{return v==a.v;}
    bool operator!=(Mint a)const{return v!=a.v;}

    friend ostream& operator<<(ostream& os, const Mint& mint){
        os << mint.v;
        return os;
    }
};


int main(){
    ll n,k;
    cin>>n>>k;
    cout<<Mint(k).pow(n)<<endl;
    return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    cin >> n;
    map<string,int> mp;

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    long long int ans = 0;
    for (auto& p : mp) {
        int s = p.second;
        ans += (long long int)s*(s-1)/2;
    }

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

Measured memory_bytes: 11288
#include <bits/stdc++.h>
#include<iomanip>
using namespace std;
int main ()
{
  int N;
  cin >> N;
  
  if(N%2==0)//Nが偶数
    cout << 0.5000000000 << endl;
  
  if(N%2!=0)//Nが奇数
  {
    double count;
    int i;
    count=0;
    for ( i=1 ; i<=N ; i++ )//N以下の奇数を数える
    {
      if(i%2!=0)
        count++;
    }
    cout << fixed;
    cout << setprecision(10) << count/N << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

typedef unsigned long long ull;
const ull B=9973ULL;


int main(){
	ull n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	ull h=s[0];
	set<ull> st;
	ull l=0,r=0;
	ull invB=9063375710536127837ULL;
	ull curB=1;
	for(ull i=0;i<m;i++){
		string q;
		cin>>q;
		if(q=="R++"){
			r++;
			h=h*B+s[r];
			curB*=B;
		}
		if(q=="L++"){
			h-=curB*s[l];
			l++;
			curB*=invB;
		}
		if(q=="R--"){
			h=(h-s[r])*invB;
			r--;
			curB*=invB;
		}
		if(q=="L--"){
			l--;
			curB*=B;
			h+=curB*s[l];
		}
		st.insert(h);
	}
	cout<<st.size()<<endl;
}

Measured memory_bytes: 15532
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    string s;
    cin>>s;
    int ans = 10000;
    rep(i,0,s.length()-3){
        string c;
        c = s[i]; 
        c += s[i+1];
        c += s[i+2];
        int num = atoi(c.c_str());
        num = num - 753;
        if(ans > abs(num)) ans = abs(num);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */
int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(b - a) <= d && abs(c - b) <= d || abs(a - c) <= d) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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

#define ll long long int
#define str string

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Max = INF, Min = -1;
ll a = 0, b = 0, c = 0, n = 0, sum = 0;
pair<ll, ll> A[500000] = {}, B[500000] = {}, rui[500000] = {}, dp[100][10] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
str S, T;
bool check = true, check2 = false;

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

int main() {

	//Code Line
	cin >> n;
	for (int i = 0; i < n; i++) { cin >> A[i].first; A[i].second = i; }
	sort(A, A + n);
	for (int i = 0; i < n; i++)cout << A[i].second + 1 << " ";

	return 0;
}


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

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

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

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

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

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

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

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

fn main(){

    input!{
        a: usize,
        p: usize,
    }

    println!("{}", (3*a+p)/2);

}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    ll n,t,ans=1;
    cin >> n >> t;
    ll a[n];
    for (ll i=0;i<n;i++){
        cin >> a[i];
    }
    ll high=a[n-1],rieki[n];
    for (ll i=n-1;i>=0;i--){
        rieki[i]=high-a[i];
        high=max(a[i],high);
    }
    sort(rieki,rieki+n);
    for (ll i=n-2;i>=0;i--){
        if (rieki[i]==rieki[i+1]){
            ans++;
        }else{
            break;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1792
package main

import (
	"fmt"
	"math"
)

func main() {
	var x float64
	fmt.Scan(&x)

	i := 0
	y := float64(100)
	for ; y < x; i++ {
		y = math.Floor(y * 1.01)
	}
	fmt.Println(i)
}


Measured memory_bytes: 1760
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=200005;
int n,a[maxn],b[maxn];
inline bool check(int k){
	rep(i,1,2*n-1)b[i]=(a[i]>=k);
	int l=n,r=n;
	while(l>1&&b[l-1]!=b[l])l--;
	while(r<2*n-1&&b[r+1]!=b[r])r++;
	if(l==1&&r==2*n-1){
		return (n&1)?b[n]:(b[n]^1);
	}
	return n-l<r-n?b[l]:b[r];
}
int main(){
	read(n);rep(i,1,2*n-1)read(a[i]);
	int l=1,r=2*n-1,ans;
	while(l<=r){
		int md=(l+r)>>1;
		if(check(md)){
			ans=md;l=md+1;
		}else
			r=md-1;
	}printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	cin >> n;
	
	vector<int> t(n), x(n), y(n);
	for(int i = 0; i < n; ++i) {
		cin >> t[i] >> x[i] >> y[i];
	}
	
	int nowx = 0, nowy = 0, prevt = 0;
	bool yes = true;
	for(int i = 0; i < n; ++i) {
		int dL = abs(nowx - x[i]) + abs(nowy - y[i]);
		int dT = t[i] - prevt;
		
		if( (dL % 2 != dT % 2) || (dL > dT) ) {
			yes = false;
			break;
		}
		
		nowx = x[i]; 
		nowy = y[i];
		prevt = t[i];
	}
	
	if( yes ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 4552
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision
ll W, weight[110], value[110];

ll dp[110][100100]={0};
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int N;
    cin >> N >> W;
    rep(i,N){
        cin >> weight[i] >> value[i];
    }
    rep(i,N){
        for(int sum_w=0; sum_w<=W; sum_w++){
            if(sum_w-weight[i]>=0){
                chmax(dp[i+1][sum_w], dp[i][sum_w-weight[i]]+value[i]);
            }

            chmax(dp[i+1][sum_w],dp[i][sum_w]);        
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
#include <iostream>
#include<string>
using namespace std;
int main(){
	int l=0;
	string S;
	char D='+',sunadatyan='-';
	cin>>S;
	for(int i=0;i<4;i++){
		if(S[i]==D){
			l=l+1;
		}
		if(S[i]==sunadatyan){
			l=l-1;
		}
	}
	cout<<l<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	char a='a';
	cin>>s;
	for(int i=0;i<26;i++){
		int b=0;
		for(int j=0;j<s.size();j++){
			if(a==s[j]){
				b=1;
				break;
			}
		}
		if(b==0){
			cout<<a<<endl;
			return(0);
		}
		a+='b'-'a';
	}
	cout<<"None"<<endl;
  return(0);
}

Measured memory_bytes: 512
N = int(input())
li = list(map(int, input().split()))

count = 0
ans = 0
flag = False

for index, i in enumerate(li):
  if index + 1 > len(li) - 1:
    break

  if i >= li[index+1]:
    flag = True
    count += 1

  if i < li[index+1] and flag:
    if ans < count:
      ans = count

    flag = False
    count = 0

if count > ans:
  print(count)
else:
  print(ans)

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

using namespace std;
typedef long long ll;

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

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


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

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

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

void solve()
{
  ll N; cin >> N;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  
  vector<ll> a(N); rep(i, N) cin >> a[i];
  ll ans = 0;
  rep1(i, N - 1) {
    if(a[i] == a[i - 1]) {
      ans ++;
      a[i] = 1000100;
    }
  }

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


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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,b) for(int i= 0; i<(int)(b);i++)
#define FI(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 inp(a) for(auto& i : a) cin >> i;
#define what_is(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define MOD 1000000007
const int N = 2e5+7 ;
string s ;

int main(){fast ;
	int x,y,z ;
	cin >> x >> y >> z ;
	x = x - (2*z) ;
	int q = x / (y+z) ;
	int rem = x % (y+z) ;
	if(rem >= y)
		q++ ;
	cout << q << endl ;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll int64_t 
#define f(i,s,e) for(i=s;i<e;++i)
#define endl << "\n"
#define sp << " "
#define INF INFINITY
#define mset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI acos(-1) 
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define eb(a) emplace_back(a)
#define print(x) for(auto it:x) cout<<it<<' '; cout<<"\n";

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

int MAXN = 1000000 + 1 ; 
int spf[1000000 + 1]; 

ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
        spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
void factor(int x,int j,vector < set <int> > &vec) 
{
	bool f = true ; 
    while (x != 1) 
    { 
//        ret.push_back(spf[x]); 
//        x = x / spf[x];
		vec[spf[x]].insert(j) ;
		x = x/spf[x] ;
    }  
} 
int main()
{
	FAST_IO ;
	int i,j,k,n;
	cin >> n;
	vector <int> arr(n);
	for(i=0;i<n;++i)
		cin >> arr[i] ;
	j = arr[0] ;
	f(i,1,n)
		j = gcd(j,arr[i]) ;
	if(j!=1)
	{
		cout << "not coprime\n" ;
		return 0 ;
	}
	sieve() ;
	vector < set <int> > vec(MAXN) ;
	bool f = true ;
	f(i,0,n)
		factor(arr[i],i,vec) ;
	for(i=0;i<MAXN;++i)
	{
		if(vec[i].size()>1)
		{
			f = false;
			break ;
		}	
	}	
	if(f)
		cout << "pairwise coprime\n" ;
	else
		cout << "setwise coprime\n" ;
	return 0;
}
 
/*
If u haven't come up with an approach yet ,skip this one
  Try this when feeling stuck -
  1. Int overflow, array bounds
  2. Special cases (n=1?)
  3. Prove your approach to yourself(mathematical induction,counter-intuitive or stronger test cases)
  4. Calm down and don't look at standings and stop thinking about rating and think about the question
  5. Just do it! 
*/ 

//Benq's advice - 
/* 
	And following advices are must for me -
	* do something instead of nothing and stay organized
	* WRITE STUFF DOWN 
*/

//#define _GLIBCXX_DEBUG 
// It will convert WA verdict to runtime error if that error is caused due to out of bound excess , declare it at the top
//#pragma GCC optimize "trapv" 
// It will convert WA to runtime error if WA was caused due to int overflow error,declare it anywhere

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

int N,M,S,T;
struct edge {int to; ll cost;};
typedef pair<ll, int> P; // firstは最短距離, secondは頂点の番号

const ll INF=LLONG_MAX/2;
const int MAX_V=101010;
vector<edge> G[MAX_V];
vector<tuple<int,int,ll> > E;
ll d[MAX_V];
ll dp1[101010], dp2[101010];

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d, d+N, INF);
  d[s]=0;
  que.push(P(0, s));
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.second; // 頂点の番号
    if (d[v] < p.first) continue;
    for(int i=0;i<G[v].size();i++){
      edge e = G[v][i];
      if (d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){
  cin>>N>>M>>S>>T; S--, T--;
  rep(i,M){
    int u,v; ll d; cin>>u>>v>>d; u--, v--;
    G[u].push_back({v,d});
    G[v].push_back({u,d});
    E.push_back(make_tuple(u,v,d));
  }
  dijkstra(S);
  vector<P> V(N);
  rep(i,N) V[i]={d[i],i};
  sort(V.begin(),V.end());
  dp1[S]=dp2[T]=1;
  rep(i,N){
    int v=V[i].second;
    rep(j,G[v].size()){
      edge e=G[v][j];
      if(d[e.to]==d[v]+e.cost) (dp1[e.to]+=dp1[v])%=MOD;
    }
  }
  for(int i=N-1;i>=0;i--){
    int v=V[i].second;
    rep(j,G[v].size()){
      edge e=G[v][j];
      if(d[e.to]+e.cost==d[v]) (dp2[e.to]+=dp2[v])%=MOD;
    }
  }
  
  ll ans=dp1[T]*dp2[S]%MOD;
  rep(i,N) if(d[i]*2==d[T]){
    ll t=dp1[i]*dp2[i]%MOD;
    ans=(ans-t*t%MOD+MOD)%MOD;
  }
  for(auto e:E){
    int u=get<0>(e), v=get<1>(e);
    ll dd=get<2>(e);
    if(d[u]>d[v]) swap(u,v);
    if(2*d[u]<d[T]&&2*d[v]>d[T]&&d[u]+dd==d[v]){
      ll t=dp1[u]*dp2[v]%MOD;
      ans=(ans-t*t%MOD+MOD)%MOD;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 20844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            String Data = Console.ReadLine();
            int count = Int16.Parse(Data);
            int key;
            Data = Console.ReadLine();
            string[] datasplitted = Data.Split(' ');
            int[] matrix = new int[count];
            for (int i = 0; i < count; i++)
            {
                matrix[i] = Int16.Parse(datasplitted[i]);
            }
            Console.WriteLine(string.Join(" ", matrix));
            for (int i = 1; i < matrix.Length ; i++)
            {
                key = matrix[i];
                int j = i - 1;
                while (j >= 0 && matrix[j] > key)
                {
                    matrix[j + 1] = matrix[j];
                    j--;

                }
                matrix[j + 1] = key;
                Console.WriteLine(string.Join(" ", matrix));
            }
        }
    }
}



Measured memory_bytes: 15952
#include <iostream>
#include <vector>

int main()
{
    int n;
    std::cin >> n;

    std::vector<long long> a(n);

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

    double ans = 0;

    for (auto elem : a) {
        ans += 1.0 / elem;
    }

    ans = 1 / ans;

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


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

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		String s = sc.next();
		if(s.equals("ABC")) {
			System.out.println("ARC");
		}else {
			System.out.println("ABC");
		}
	}

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 32488
#include <iostream>

using namespace std;

int dish[5];

int main()
{

    int idx, m = 9;
    for (int i = 0; i < 5; i++)
    {
        cin >> dish[i];
        if (dish[i]%10 < m && dish[i]%10>0)
        {
            idx = i;
            m = dish[i]%10;
        }
    }
    int ans = 0;
    for (int i = 0; i < 5; i++)
    {
        if (i!=idx)
        {
            if (dish[i]%10 != 0)
            {
                ans += ((dish[i]/10)+1)*10;
            }
            else
            {
                ans += dish[i];
            }
        }
        else
        {
            ans += dish[i];
        }
    }
    cout << ans <<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int numlist[] = new int[5];
        int k = 0;
        boolean isOk = true;
        
        for(int i=0; i<5; i++){
            numlist[i] = sc.nextInt();
        }

        k = sc.nextInt();

        loop:for(int i=0; i<5; i++){
            for(int j=i+1; j<5; j++){
                if((numlist[j]-numlist[i])>k){
                    isOk = false;
                    break loop;
                }
            }
        }
        if(isOk){
            System.out.println("Yay!");
        }
        else{
            System.out.println(":(");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define forsn(i,x,y) for(long long i = (x) ; i <= (y) ; ++i)
typedef long long ll;
typedef long double ld;

int main() {
  vector<ll> abc(3,0);
  forn(i,3) {
    cin >> abc[i];
  }
  if(abc[0] % 2 == 0 || abc[1] % 2 == 0 || abc[2] % 2 == 0) {
    cout << 0 << endl;
  }
  else {
    sort(abc.begin(), abc.end());
    cout << abc[0] * abc[1] << endl;
  }
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N+1];
		for (int x=1;x<100;x++) {
			for (int y=1;y<100;y++) {
				for (int z=1;z<100;z++) {
					int temp = x*x+y*y+z*z+x*y+x*z+y*z;
					if (temp>N) {
						break;
					}
					A[temp]++;
				}
			}
		}
		for (int i=1;i<N+1;i++) {
			System.out.println(A[i]);
		}
	}
}

Measured memory_bytes: 38904
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

typedef long long ll;

int main() {
  int A,B; cin >> A >> B;
  if ( B % A == 0 ) cout << A+B << endl;
  else cout << B-A << endl;
  return 0;
}


Measured memory_bytes: 256
class Dice():
	def __init__(self):
		self.d = [0,1,2,3,4,5]
		self.rp = []

	def dice_n(self):
		self.d[4],self.d[0],self.d[1],self.d[5] = self.d[0],self.d[1],self.d[5],self.d[4]
		if (([self.d[0],self.d[1]],self.d[2])) not in self.rp:
			self.rp.append(([self.d[0],self.d[1]],self.d[2]))

	def dice_s(self):
		self.d[0],self.d[4],self.d[5],self.d[1] = self.d[4],self.d[5],self.d[1],self.d[0]

	def dice_w(self):
		self.d[0],self.d[2],self.d[5],self.d[3] = self.d[2],self.d[5],self.d[3],self.d[0]

	def dice_e(self):
		self.d[0],self.d[3],self.d[5],self.d[2] = self.d[3],self.d[5],self.d[2],self.d[0]

	def get_top(self):
		return self.d[0]

	def check_dice(self,n,m):
		for i in range(len(self.rp)):
			if self.rp[i][0] == [n,m]:
				return self.rp[i][1]

	def print_dice(self):
		print(self.rp)

if __name__ == '__main__':

	dd = list(map(int,input().split()))
	num = int(input())
	line = "NNNNWNNNNWNNNNWNNNNNENNNNENNNNENNNN"

	d = Dice()

	for di in line:
		if di == "N":
			d.dice_n()
		elif di == "S":
			d.dice_s()
		elif di == "W":
			d.dice_w()
		elif di == "E":
			d.dice_e()

	for i in range(num):
		n,m = map(int,input().split())
		nn = dd.index(n)
		mm = dd.index(m)
		ret = d.check_dice(nn,mm)
		print(dd[ret])



Measured memory_bytes: 5616
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main() {
	long long int a, b, x, y, i;
	int c[10000];
	cin >> a >> b;
	x = 0;
	for(i = 0; i < b; i++) {
		cin >> c[i];
		x = c[i] + x;
	}
	y = a - x;
	if(y < 0) {
		cout << -1;
	}
	else {
		cout << y;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k, n, a;
	cin>>n>>k;
	int m;
	REP(i, n){
		cin>>a;
		if(a==1){
			m=i;
		}
	}
	cout<<(n<=k ? 1 : (n-k-1)/(k-1)+2)<<'\n';
	return 0;
}


Measured memory_bytes: 256
local MOD = 1000000007
local N = io.read("n")
local C = {}
for i=1,N do
    C[i] = io.read("n")
end

local dp = {}
local last_pos = {}
dp[0] = 1
for i=1,N do
    if C[i] == C[i-1] then
        -- No stone between i-1 and i
        dp[i] = dp[i-1]
    else
        local c = C[i]
        if last_pos[c] then
            -- Stones from (last_pos[c], i) are reversible.
            -- Not reverse: dp[i-1]
            -- Reverse: dp[last_pos[c]]
            dp[i] = dp[i-1] + dp[last_pos[c]]
        else
            -- Can't reverse stone because this is first appearance of c
            dp[i] = dp[i-1]
        end
        last_pos[c] = i
    end
    --print(i,C[i],dp[i])
    dp[i] = dp[i] % MOD
end
print(dp[N])


Measured memory_bytes: 16868
#include<cstdio>
using namespace std;
const int N=2e5+5;
const int mo=1e9+7;
int n,ans,a[N],b[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=n;i;i--) b[i]=(b[i+1]+a[i])%mo;
	for (int i=1;i<n;i++) ans=(ans+(long long)a[i]*b[i+1])%mo;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n,m;
   cin >> n >> m;
   vector<int> a(n);
   priority_queue<int> s;
   f(i,0,n){
      cin >> a[i];
      s.push(a[i]);
   }
   while(m){
      int tp = s.top();
      s.pop();
      s.push(tp/2);
      m--;
   }
   int ans = 0;
   while(!s.empty()){
      ans += (s.top());
      s.pop();
   }
   cout << ans << '\n';
   return 0;
}

Measured memory_bytes: 2168
S = input()
n = len(S)
check = True
if n%2 == 0:
  for i in range(n//2):
    if not (S[2*i]=="R" or S[2*i]=="U" or S[2*i]=="D"):
      check = False
  for i in range(n//2):
    if not (S[2*i+1]=="L" or S[2*i+1]=="U" or S[2*i+1]=="D"):
      check = False
if n%2 != 0:
  for i in range((n+1)//2):
    if not (S[2*i]=="R" or S[2*i]=="U" or S[2*i]=="D"):
      check = False
  for i in range((n-1)//2):
    if not (S[2*i+1]=="L" or S[2*i+1]=="U" or S[2*i+1]=="D"):
      check = False
if(check):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;

typedef long long ll;

int main()
{
	ll n,a,b,c;
	scanf("%lld%lld%lld",&n,&a,&b);
	ll x;
	if(a-b>0)
		x = a-b;
	else
		x = b-a;
	if(x%2 == 0)
	{
		printf("%lld\n",x/2);
	}
	else
	{
		ll s1 = a-1 +b -1;
		ll ans1 = (s1+1)/2;
		ll s2 = n - a + n - b;
		ll ans2 = (s2+1)/2;
		printf("%lld\n",min(ans1,ans2));
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7

int main(){
    ll n; cin >> n;
    rep(i,50000){
        ll y = (double)i * 1.08;
        if(y==n){
            cout << i << endl;
            return 0;
        }
    }
    puts(":(");
}


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

using namespace std;

int main(){
    int N, M; cin >> N >> M; int roads[N] = {};
    for (int i = 0; i < M; i++) {
        int u, v; cin >> u >> v; roads[u-1]++, roads[v-1]++;
    }

    for (int i = 0; i < N; i++) cout << roads[i] << endl;

    return 0;
}


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

using ll = long long;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (ll i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (ll i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

template<typename T> using pop_max = std::priority_queue<T>;
template<typename T> using pop_min = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T> void LOG(const T& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T> void LOG(const vector<vector<T>>& a) { for (const auto& x : a) LOG(x); }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

ll ceil(ll a, ll b) { return a > 0 ? (a - 1) / b + 1 : a / b; }
ll gcd(ll a, ll b) { while (b != 0) { ll t = b; b = a % b; a = t; } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll gcd(const vector<ll>& v) { return accumulate(v.begin(), v.end(), 1LL, static_cast<ll(*)(ll, ll)>(gcd)); }
ll lcm(const vector<ll>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<ll(*)(ll, ll)>(lcm)); }
ll pow(ll x, ll y, ll z) { ll a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
ll inv(ll x, ll m) { return pow(x, m - 2, m); }

template<typename T> bool chmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<typename T> bool chmin(T& x, const T& y) { return x > y ? x = y, true : false; }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_cpp;

const ll INF = inf<ll>;
using P = pair<ll, ll>;
const ll M = 1000000007;
signed main() {
    ll n,x;
    cin>>n>>x;
    vector<ll> A(n);
    cin>>A;
    ll s=0;
    REP(i,n-1){
        ll d=A[i]+A[i+1]-x;
        if(d>0){
            if(A[i+1]-d>=0){
                A[i+1]-=d;
                s+=d;
            }else{
                A[i+1]=0;
                s+=d;
            }
        }
    }
    cout<<s<<endl;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  int res = 1;
  for (int i = 0; i < n; i++) {
    if (res <= k) {
      res *= 2;
    } else {
      res += k;
    }
  }
  cout << res << endl;
}

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

int main() {
	int n, x, t;
	cin >> n >> x >> t;
	if(n % x == 0) 
	cout << n / x * t << endl;
	else
	cout << ( n / x + 1 ) * t  << endl;

}

Measured memory_bytes: 3648
N = int(input())

list_ = list()

for i in range(N):
  X,L = map(int,input().split())
  max_ = min(10**9,X+L-0.1)
  min_ = max(0,X-L+0.1)
  list_.append((X,min_,max_))
list_.sort()

d = 0
nowmax = -1
nowmin = -1

for x, min_, max_ in list_:
  if nowmax > min_:
    d += 1
    nowmax = min(nowmax,max_)
  else:
    nowmin = min_
    nowmax = max_
  
print(N-d)
  

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

#define int long long

int32_t main()
{
    int n,k;
    cin>>n>>k;
    
    bool f[n+1]={0};
    
    for(int i=0;i<k;i++)
    {
        int q;
        cin>>q;
        
        for(int i=0;i<q;i++)
        {
            int x;
            cin>>x;
            f[x]=1;
        }
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(!f[i])
            cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
    
    lli n;
    cin >> n;
    map < string, vector < pair <lli,lli> > > m;
    for(int i =1;i<=n;i++){
        string s;
        cin >> s;
        lli p;
        cin >> p;
        m[s].push_back({p,i});
    }
    map < string, vector < pair <lli,lli> > > :: iterator i = m.begin();
    while(i!=m.end()){
        vector < pair <lli,lli> > v = i->second;
        sort(v.rbegin(),v.rend());
        for(int x = 0 ;x<v.size();x++)cout << v[x].second<<endl;
        i++;
    }

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,k;
signed main()
{
	scanf("%lld%lld",&n,&k);
	if(k%2==1) 
	{
		int a=n/k;
		printf("%lld\n",a*a*a);
	}
	else
	{
		int a=n/(k/2);
		a=(a+1)/2;
		printf("%lld\n",a*a*a+(n/k)*(n/k)*(n/k));
	}
	return 0;
}

Measured memory_bytes: 256
from collections import Counter


def words_sort_ordered(words_list):
    word_cnt = Counter()
    for word in words_list:
        word_cnt[word] += 1

    word_written_max_time = 0
    for each_word_ct in word_cnt.values():
        if each_word_ct > word_written_max_time:
            word_written_max_time = each_word_ct

    answer_words_list = []
    for word, number in dict(word_cnt).items():
        if number == word_written_max_time:
            answer_words_list.append(word)

    return sorted(answer_words_list)


if __name__ == '__main__':
    words_num = int(input())
    words_list = [input() for i in range(words_num)]
    for w in words_sort_ordered(words_list):
        print(w)


Measured memory_bytes: 43120
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double m,a;
    int n;
    cin>>n>>m;
    double sum=0;
    std::deque<double> deq;
    for (int i=0;i<n;i++) {
        cin>>a;
        deq.emplace_back(a);
        sum+=a;
    }
    double tmp=sum/(4*m);
    double count=0;
    for (int j=0;j<n;j++) {
        if (deq[j]>=tmp) {
            count++;
        }
    }
    if (count>=m) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}


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

using namespace std;

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  for (int i = min(A, B); i >= 1; i--) {
    if ((A % i == 0) && (B % i == 0)) {
      K--;
      if (K == 0) {
        cout << i;
        break;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef __int128_t ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

ll mod;

vector<vector<ll>> mat_mul(vector<vector<ll>> a, vector<vector<ll>> b) {
	int n = a.size();
	vector<vector<ll>> ans(n, vector<ll>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				ans[i][j] += a[i][k] * b[k][j];
				ans[i][j] %= mod;
			}
		}
	}
	return ans;
}

vector<vector<ll>> mat_pow(vector<vector<ll>> a, ll b) {
	int n = a.size();
	vector<vector<ll>> ans(n, vector<ll>(n));
	for (int i = 0; i < n; i++) ans[i][i] = 1;
	while (b) {
		if (b & 1) ans = mat_mul(ans, a);
		a = mat_mul(a, a);
		b >>= 1;
	}
	return ans;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

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

	ll l, a, b;
	long long cl, ca, cb, cmod;
	cin >> cl >> ca >> cb >> cmod;
	l = cl; a = ca; b = cb; mod = cmod;
	ll c = a + (l - 1) * b;
	vector<ll> cnt(20), dig(20);
	for (int i = 18; i >= 1; i--) {
		ll x = 1;
		rep(j, i - 1) x *= 10;
		ll st = x / b * b + a % b;
		if (st < x) st += b;
		chmax(st, a);
		ll en = x * 10 / b * b + a % b;
		if (en >= x * 10) en -= b;
		chmin(en, c);
		if (st > en) {
			dig[i] = dig[i + 1];
			continue;
		}
		ll len = (en - st) / b + 1;
		vector<vector<ll>> mat(3, vector<ll>(3));
		mat[0][0] = x * 10 % mod; mat[0][1] = mat[0][2] = mat[1][1] = mat[1][2] = mat[2][2] = 1;
		mat = mat_pow(mat, len - 1);
		ll sum = mat[0][0] * (st % mod) + mat[0][1] * (st % mod) + mat[0][2] * (b % mod);
		sum %= mod;
		cnt[i] = sum;
		dig[i] = dig[i + 1] + len * i;
	}
	ll ans = 0;
	for (int i = 18; i >= 1; i--) {
		ll x = dig[i + 1];
		ans += modpow(10, x) * cnt[i] % mod;
		ans %= mod;
	}
	cout << (long long)ans << '\n';
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
int main(){
    ll n,sum=0,a;
    unordered_map<ll,ll> mas;mas[0]=1;
    cin>>n;
    ll ans=0;
    lol(i,n){
	cin>>a;  sum+=a;
	if(mas.find(sum)==mas.end())mas[sum]=1;
	else{
	    ans+=mas[sum];
	    mas[sum]++;
	}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8520
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
typedef long long int ll;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define MOD 1000000007
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
//*s.find_by_order(p)   returns the value of pth largest starting from 0 
//s.order_of_key(p)   returns no. of items that are strictly < p 
//string bin = bitset<64>(m).to_string();     convert decimal m to binary   
int main()
{
      fast;ll t;t=1;
      while(t--)
      {
            ll n,i,j,q,x,a,b,y,s,c;
            cin>>n;
            s=0;
            map<ll,ll>m;
            for(i=0;i<n;i++){cin>>x;m[x]++;s=s+x;}
            cin>>q;
            for(i=0;i<q;i++){
                  cin>>b>>c;
                  x=m[b];y=m[c];
                  s=s-b*x+x*c;
                  m[b]=0;m[c]=x+y;
                  cout<<s<<"\n";
            }
      }
}

Measured memory_bytes: 9484
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline LL read(){
    LL x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-10;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 1e6+10;
const int MAXM = (int) 1e6+10;
const int sigma_size = (int) 26;

///--------------------START-------------------------
int a,b;

void work(){
    scanf("%d%d",&a,&b);
    int ok=0;
    for(int i=1;i<=3;i++){
        if((a*b*i)&1) ok=1;
    }
    if(ok) printf("Yes\n");
    else printf("No\n");
}

///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}


Measured memory_bytes: 256