akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
int b;
signed main(){
  while(cin >> b && b!=0){
    int y=floor(sqrt(2.0*(double)b));
    int c=0;
    while(1){
      if(y<=0) break;
      if(2*b%y==0){
        if(y%2!=0 || 2*b/y%2!=0){
          cout << (((2*b)/y)+1-y)/2 << " " << y << endl;
          c++;
          break;
        }
        y--;
      }
      else y--;
    }
    if(c==0) cout << b << " " << "1" << endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200000

int main(){
	int a[4];
	int x, y, z;
	int s, ans;
	f(i,4)a[i] = 0;
	f(i, 3){
		scanf("%d %d", &x, &y);
		a[x - 1]++;
		a[y - 1]++;
	}
	ans = 1;
	f(i , 4)ans *= a[i];

	if(ans%2==1)printf("NO\n");
	else printf("YES\n");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e18;
const int inf=2e9;
const ll MOD=1000000007;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main(){
    ll N,M;cin>>N>>M;
    set<ll> info;
    rep(i,N){
        ll p;cin>>p;
       info.insert(p/2);
    }
    ll LCM=*info.begin();
    for(auto p:info){
        ll k=p;
        while(!(k%2)){
            k/=2;
            if(info.count(k)){
                cout<<0<<endl;
                return 0;
            }
        }
        if(p%2==0 and info.count(p/2)){
            cout<<0<<endl;
            return 0;
        }
        LCM=LCM/__gcd(LCM,p)*p;
        if(LCM>M){
            cout<<0<<endl;
            return 0;
        }
    }
    ll ans=(M-LCM)/(LCM*2)+1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4992
loop do
	n = gets.to_i
	break if n.zero?

	hash = Hash.new(0)
	n.times do
		i, p, q = gets.split.map(&:to_i)
		hash[i] += p * q
	end

	good_workers = hash.select{|k, v| 1_000_000 <= v}.keys
	puts good_workers.empty?? 'NA' : good_workers
end

Measured memory_bytes: 6108
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef  long long ll;


int main(){
  int n;
  int a;
  ll maxi = 0;

  cin >> n;

  for(int i =0; i < n; i++){
    cin >> a;
    maxi += a-1;
  }

  cout << maxi << endl;

  
  return 0;
}




Measured memory_bytes: 256
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli find_max(lli __a,lli __b){return __a^((__a^__b) & -(__a<__b));}
lli add(lli __a,lli __b,lli MOD){lli x = (__a+__b)%MOD; return x; }
lli mul(lli a,lli b,lli MOD){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b,lli MOD){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b,lli MOD){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}
void printVector(vector<int>a){for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}

vector<lli> uniqueIt(vector<lli>temp){
  set<lli> temp1;
  for(int i=0;i<temp.size();i++){
    temp1.insert(temp[i]);
  }
  vector<lli>returnIt(temp1.begin(),temp1.end());
  return returnIt;
}
vector<lli> findAllPrimeFactors(lli n){
  set<lli> primeFactors;
  if(n%2==0){
    primeFactors.insert(2);
    while(n%2==0){
      n/=2;
    }
  }
  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0){
      primeFactors.insert(i);
      while(n%i==0){
        n/=i;
      }
    }
  }
  if(n>2){
    primeFactors.insert(n);
  }
  vector<lli>temp(primeFactors.begin(),primeFactors.end());
  return temp;
}

int main()
{
  //use ./a.out filename(input)
  //ifstream cin("input");
  //ofstream cout("output.txt");
  lli t,i,j;
  t=1;
  //cin>>t;
  lli counter1=0;
  while(t--)
  {
    int a,b;
    cin>>a>>b;
    cout<<(3*a+b)/2<<endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int x, ans = 0;
  scanf("%d", &x);
  while(ans==0){
    int yakusuu=0;
    for(int i=1;i<=x;i++){
      if(x%i==0){
        yakusuu++;
      }
    }
    if(yakusuu==2){
      ans=x;
      break;
    }
    x++;
  }
      
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
import sys
import numpy as np
from collections import Counter

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
A = list(map(int, input().split()))

VALID = np.ones((10 ** 6) + 10, dtype=np.bool)

A.sort()
C = Counter(A)

multi = []
for k, v in C.items():
    if v > 1:
        multi.append(k)

for x in multi:
    VALID[x::x] = False


ans = 0
for a in A:
    if VALID[a]:
        ans += 1
        VALID[a::a] = False

print(ans)


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
//const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define mp make_pair


int main() {
  string s;
  cin >> s;
  if (s.size() == 2) {
    cout << s << endl;
  }
  else {
    reverse(all(s));
    cout << s << endl;
  }
}


Measured memory_bytes: 256
unittest
{
	assert( [ "1 3 2" ].solve == 1 );
	assert( [ "1 3 1" ].solve == 2 );
	assert( [ "2 3 3" ].solve == 1 );
	assert( [ "2 3 1" ].solve == 5 );
	assert( [ "7 1 1" ].solve == 1 );
	assert( [ "15 8 5" ].solve == 437760187 );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto h = 0L;
	auto w = 0L;
	auto k = 0L;
	input.front.formattedRead!"%s %s %s"( h, w, k );
	
	const M = 10L ^^ 9 + 7;
	auto dp = new ModWorld!M[][]( 1 + h, w );
	dp[ 0 ][ 0 ] = 1;
	foreach( i; 0L .. h )
	{
		LOOP: foreach( b; 0L .. 1L << ( w - 1 ) )
		{
			foreach( j; 0L .. w - 2 )
			{
				auto bb = 3L << j;
				if( ( b & bb ) == bb ) continue LOOP;
			}
			
			for( auto j = 0L; j < w; j++ )
			{
				auto bb = 1L << j;
				if( b & bb )
				{
					dp[ i + 1 ][ j     ] += dp[ i ][ j + 1 ];
					dp[ i + 1 ][ j + 1 ] += dp[ i ][ j     ];
					j++;
				}
				else
				{
					dp[ i + 1 ][ j ] += dp[ i ][ j ];
				}
			}
		}
	}
	return dp[ $ - 1 ][ k - 1 ];
}

// モジュラ整数型（n mod M）
struct ModWorld( long M )
{
	long n;
	
	void opUnary( string OP )() if( OP == "++" ){ this.n = ( this.n + 1 ) % M; }
	void opUnary( string OP )() if( OP == "--" ){ this.n = ( this.n + M - 1 ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "+"  ){ this.n = ( this.n + r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "-"  ){ this.n = ( this.n + M - r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "*"  ){ this.n = ( this.n * r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "/"  ){ this *= r ^^ ModWorld( M - 2 ); }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "^^" )
	{
		auto a = this.n;
		this.n = 1L;
		for( auto i = r.n; 0 < i; i >>= 1 )
		{
			if( i & 1 ) this.n = ( this.n * a ) % M;
			a = ( a * a ) % M;
		}
	}
	auto opBinary( string OP )( ModWorld r ){ auto l = this; l.opOpAssign!OP( r ); return l; }
	
	void opAssign( long r ){ this.n = r; }
	void opOpAssign( string OP )( long r ){ this.opOpAssign!OP( ModWorld( r ) ); }
	auto opBinary( string OP )( long r ){ return this.opBinary!OP( ModWorld( r ) ); }
	auto opBinaryRight( string OP )( long l ){ return ModWorld( l ).opBinary!OP( this ); }
	auto opEquals( long r ){ return this.n == r; }
	
	auto toString(){ return this.n.to!string; }
}


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

int main(){
    string s;
    cin >> s;
    
    if(s.at(0) == s.at(2)) cout << "Yes" << endl;
    else cout << "No" << endl;
  
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,tmp=0;
	cin>>n;
	for(int i=105;i<=n;i+=2){
		int cnt=2;
		for(int j=2;j<i;j++) if(i%j==0) cnt++;
		if(cnt==8) tmp++;
	}
	cout<<tmp<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,s=0,t,x=0,y,z,p=0,q;
    cin>>n;
    int a[n];
    for(int i=0;i<n;++i)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;++i)
    {
        t=abs(-100-a[i]);
        s=s+t*t;
    }
    for(int j=-99;j<=100;++j)
    {
        for(int i=0;i<n;++i)
        {
            t=abs(j-a[i]);
            p=p+t*t;
        }
        s=min(s,p);
        p=0;
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3628
N = int(input())
al = "abcdefghijklmnopqrstuvwxyz"
atoi = {s:i for i, s in enumerate(al)}

def func(s, i):
    if i == N:
        print(s)
        return

    maxi = max([atoi[c] for c in s])
    for c in al[:maxi+2]:
        func(s+c, i+1)

func("a", 1)



Measured memory_bytes: 4412
#include<iostream>
using namespace std;
int a[1001],ans,bns;
int main()
{
    for(int i=1;i<=3;i++)
    {
    cin>>a[i];
    if(a[i]==5)ans++;
    if(a[i]==7)bns++;
     }
     if(ans==2&&bns==1)cout<<"YES"<<endl;
     else cout<<"NO"<<endl;
     return 0;
    
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
using namespace std;
int main(void) {
  for(; true;) {
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        cout << "#";
      }
      cout << endl;
    }
    if(h == 0 && w == 0)
      break;
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 998244353
#define PI 3.141592653
#define INF 100000000000000

ll powe(ll a, ll b){//aのb乗のmod
    ll ret = 1;
    while(0 < b){
        if((b%2) == 0){
            a = (a*a)%MOD;
            b >>= 1;
        }
        else{
            ret = (ret*a)%MOD;
            b--;
        }
    }
    return ret;
}

vector<ll> seg(powe(2,19),0);

void add(ll ind, ll v){
    ind+=powe(2,18);
    seg[ind]=v;
    while(true){
        ind/=2;
        if (ind==0) break;
        seg[ind]=max(seg[ind*2],seg[ind*2+1]);
    }
}

ll query(ll l, ll r){
    ll po = powe(2,18);
    l+=powe(2,18);
    r+=powe(2,18);
    ll ans=seg[l];
    while(l<r){
        if(l%2){
            ans=max(ans,seg[l]);
            l++;
        }
        l/=2;
        if(r%2){
            ans=max(ans,seg[r-1]);
            r--;
        }
        r/=2;
    };
    return ans;
}

int main(){
    ll n, x, d; cin >> n;
    vector<ll> pos(n);
    vector<vector<ll>> robs(n,vector<ll>(3));//start, cover, index
    vector<ll> cov(n);
    REP(i,n) cin >> robs[i][0] >> robs[i][1];
    sort(robs.begin(),robs.end());
    REP(i,n) pos[i]=robs[i][0];
    cov[n-1]=n-1;
    REP(i,n) add(i,i);
    FORD(i,n-2,0){
        ll ncov = lower_bound(pos.begin(),pos.end(),robs[i][0]+robs[i][1])-pos.begin();
        cov[i]=query(i,ncov);
        add(i,cov[i]);
    }
    vector<ll> dp(n+1);
    dp[n]=1;
    FORD(i,n-1,0) dp[i]=(dp[i+1]+dp[cov[i]+1])%MOD;
    cout << dp[0] << endl;
}

Measured memory_bytes: 19968
bool DBG = false;
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using ld = long double;
//using i128 = __int128_t;
//using bint = boost::multiprecision::cpp_int;
//using d1024 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1024>>;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define dcouts(x) if(DBG) couts(x)
#define dcoutn(x) if(DBG) coutn(x);
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;



void solve(){
  int n, a, b; cin >> n >> a >> b;
  a *= n;
  coutn( min(a,b) );
}


int main(void){
  //std::cout << std::fixed << std::setprecision(100);
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>	
#include <vector>
#include <array>
#include <map>
#include <algorithm>
typedef unsigned LL;

typedef struct tuple{
    LL weight;
    LL value;
} tuple;

bool operator<(const tuple& t1, const tuple& t2){ return t1.value < t2.value; }
bool operator==(const tuple& t1, const tuple& t2){ return t1.value == t2.value; }
tuple operator+(const tuple& t1, const tuple& t2){ return tuple {t1.weight + t2.weight, t1.value + t2.value};}

const unsigned MAX_W = 1000;
const unsigned MAX_N = 1000;
std::array<std::array<tuple, MAX_W+1>, MAX_N+1> dp{};
std::array<std::array<bool, MAX_W+1>, MAX_N+1> isdpable{};

tuple rec(const std::vector<tuple>& items, LL w, LL i = 0) {
    if (isdpable[i][w]) {
        return dp[i][w];
    }
    tuple retval;
    if (items.size() <= i) {
        retval = tuple{0,0};
    }
    else if (w < items.at(i).weight) {
        retval = rec(items, w, i + 1);    //i?????????????????????????????????
    } else {
        retval = std::max( rec(items, w - items[i].weight, i + 1) + items[i], //i???????????????????????????
                           rec(items, w, i + 1),                              //i?????????????????????????????????
                           [](auto a,auto b){
                               if (a == b) return a.weight > b.weight;
                               else return a < b;
                           });
    }
    dp[i][w] = retval;
    isdpable[i][w] = true;
    return retval;
}

void show_res(const tuple& resault) { 
    static LL i{1};
    std::cout << "Case " << i << ":" << std::endl;
    std::cout << resault.value << std::endl;
    std::cout << resault.weight << std::endl;
    i++;
}
void show_tup(const tuple& t) {
    std::cout << t.value << std::endl;
    std::cout << t.weight << std::endl;
}

int main(int argc, char const* argv[])
{
    for(;;){
        LL W{}, N{};
        std::vector<tuple> items{};
        std::cin >> W >> N;
        if (W==0) {
            break;
        }
        items.resize(N);
        for (LL i = 0; i < N; i++) {
            tuple input{};
            std::cin >> input.value;
            std::cin.ignore();
            std::cin >> input.weight;
            std::cin.ignore();
            items[i] = (input);
        }
        auto resault = rec(items, W);
        show_res(resault);
        for (auto&& a : isdpable) {
            for (auto&& b : a) {
                b = false;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 11976
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 998244353
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0ll)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1ll);

/*======================================================================*/

void solve(){
    int a, v, b, w, t;
    cin >> a >> v >> b >> w  >> t;
    if(abs(a-b) <= (v-w)*t)cout << "YES\n";
    else cout << "NO\n";
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

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

int main() {
  int n,k;
  cin >> n >> k;
  
  
  if((n-1)%(k-1)==0){
    cout << (n-1)/(k-1) << endl;
  }
  else{
    cout << (n-1)/(k-1)+1 << endl;
  }
  
}

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

int n;
char a[100005];

int main()
{
	scanf("%s",a+1);
	n = strlen(a+1);
	int S = n/2+1, E = (n+1)/2;
	while(S>1) {
		if(a[S-1] != a[S] || a[S-1] != a[E+1]) break;
		S--; E++;
	}
	printf("%d\n",n-S+1);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    const ll LINF = 1LL << 60;
    const int SMAX = 2500;
    using plpii = pair<ll,pii>;
    auto makep = [](const ll time,const int to,const int sil) {
        return make_pair(time,make_pair(to,sil));
    };

    int N, M;
    cin >> N >> M;
    int S; cin >> S;
    vector<vector<plpii>> g(N);
    REP(i,M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        ll toll, t;
        cin >> toll >> t;
        g[u].push_back(makep(t,v,toll));
        g[v].push_back(makep(t,u,toll));
    }
    vector<ll> C(N),D(N);
    REP(i,N) cin >> C[i] >> D[i];

    S = min(S,SMAX);
    vector<vector<ll>> dp(N,vector<ll>(SMAX+5,LINF));
    dp[0][0] = 0;

    priority_queue<plpii,vector<plpii>,greater<plpii>> dj;

    auto append = [&](plpii p){
        ll time = p.first;
        int cnt = p.second.first;
        int sil = p.second.second;
        if (dp[cnt][sil] < time) return;
        
        // 1回分交換を追加
        if (sil + C[cnt] <= SMAX) {
            int sc = sil+C[cnt];
            ll tc = time + D[cnt];
            if (dp[cnt][sc] > tc) {
                dp[cnt][sc] = tc;
                dj.push(makep(tc,cnt,sc));
            }
        }

        // 辺を通る
        for(auto p2:g[cnt]) {
            ll time2 = time + p2.first;
            int to = p2.second.first;
            int sil2 = sil - p2.second.second;
            if (sil2 < 0) continue;
            if (dp[to][sil2] <= time2) continue;
            dp[to][sil2] = time2;
            dj.push(makep(time2,to,sil2));
        }
    };

    dj.push(makep(0,0,S));

    while(!dj.empty()) {
        plpii x = dj.top(); dj.pop();
        append(x);
    }

    FOR(i,1,N) {
        ll ans = LINF;
        REP(j,SMAX) ans = min(ans,dp[i][j]);
        OUT(ans)
    }

    return 0;
}

Measured memory_bytes: 6312
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef int64_t intl;


int main(){
  int S,W;
 cin >> S >>W;
  if ( W >= S ) {
    cout << "unsafe";
  }
  
  if( S > W ) {
    cout << "safe";
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
char a[100], b[100];
int main()
{
    int n;

    scanf("%d%s%s", &n, a, b);
    long long ans = 1;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            if (a[i] == b[i]) {
                ans = 3;
            } else {
                ans = 6;
                i++;
            }
            continue;
        }
        if (a[i] == b[i]) {
            if (a[i - 1] == b[i - 1]) {
                ans *= 2;
            }
        } else {
            if (a[i - 1] == b[i - 1]) {
                ans *= 2;
            } else {
                ans *= 3;
            }
            i++;
        }
        ans %= mod;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int comp(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}
int main(void){
int n, k, i=0, p[1000], sum=0;

    //printf("N K p1 p2 ... pN = ");   
    scanf("%d %d",&n,&k); 

    for(i=0;i<n;i++){
    scanf("%d",&p[i]);
    }; 

    qsort(p,n,sizeof(int),comp);

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

Measured memory_bytes: 1700
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    
    aa = "dream"
    aa = aa[::-1]
    bb = "dreamer"
    bb = bb[::-1]
    cc = "erase"
    cc = cc[::-1]
    dd = "eraser"
    dd = dd[::-1]
    
    S = S[::-1]
    
    while True:
        if len(S) == 0:
            break
            
        if len(S) < 5:
            print("NO")
            sys.exit()
        
        if S[:5] == aa or S[:5] == cc:
            S = S[5:]
        elif S[:6] == dd:
            S = S[6:]
        elif S[:7] == bb:
            S = S[7:]
        else:
            print("NO")
            sys.exit()
            
    print("YES")
    
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 135188
#include<stdio.h>
int main(void)
{
	int a[7], ruio=0, hideo=0,masatoy=0,i,j;
	for ( i = 1; i <= 6; i++){
		scanf("%d", &a[i]);
	}
	for (i = 1; i < 4; i++) {
		for (j = 4; j > i; j--) {
			if (a[j] > a[j - 1]) {
				ruio = a[j];
				a[j] = a[j - 1];
				a[j - 1] = ruio;

			}
		}
	}
	if (a[5] < a[6]) {
		a[5] = a[6];
	}
	printf("%d\n", a[1] + a[2] + a[3] + a[5]);
	return 0;
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define _boost ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define fi first
#define se second
#define clz __builtin_clz
#define clzll __builtin_clzll
#define bp __builtin_popcount
#define _unique(x) sort((x).begin(),(x).end()),(x).erase(unique((x).begin(), (x).end()),(x.end()))
#define all(x) (x).begin(),(x).end()
#define _rand(i,j) uniform_int_distribution<int>(i, j)(rng___)
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;
template < typename _T, typename _T2> string to_string(pair<_T,_T2> x) {return "<"+to_string(x.fi)+", "+to_string(x.se)+">";}
template < typename _T> string to_string(vector<_T> vec) {string s="[ "; for(auto el:vec)s+=to_string(el)+", "; s[s.size()-1]=']';s[s.size()-2]=' '; return s;}
string to_string(string s) {return s;}
template < typename _T> string to_string(set<_T> vec) {string s="{ "; for(auto el:vec)s+=to_string(el)+", "; s[s.size()-1]='}';s[s.size()-2]=' '; return s;}
template < typename _T, typename _T2> string to_string(map<_T,_T2> vec) {string s="{ "; for(auto el:vec)s+="mp["+to_string(el.fi)+"]= "+to_string(el.se)+", "; s[s.size()-1]='}';s[s.size()-2]=' '; return s;}
template < typename _T > inline void _DBG(const char *s, _T x){cerr << s << " = " << to_string(x) << "\n";}
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a){while(*s != ',') cerr << *s++;cerr << " = " << to_string(x) << "\n";_DBG(s + 1, a...);}
#ifdef LOCAL
#define _print(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define _print(...) ;//cout<<2;//(__VA_ARGS__)
#endif
mt19937 rng___(chrono::steady_clock::now().time_since_epoch().count());


const LL MOD = 1e9+7;//998244353;
const LL LLINF = 1e18+7;
const int N=1e5+8;
const int NN=50;
LL n,k;
vector<vector<LL>> mult(vector<vector<LL>> A,vector<vector<LL>> B)
{
    vector<vector<LL>> C(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++)
            {
                C[i][j]=(C[i][j]+A[i][k]*B[k][j])%MOD;
            }
        }
    }
    return C;
}
vector<vector<LL>> powe(vector<vector<LL>> M, LL k)
{
    if(k==0)
    {
        vector<vector<LL>> pom(n,vector<LL>(n,0));
        for(int i=0;i<n;i++)pom[i][i]=1;
        return pom;
    }
    vector<vector<LL>> pom= powe(M,k/2);
    pom=mult(pom,pom);
    if(k&1) pom=mult(pom,M);
    return pom;
}

int main()
{
    _boost;
    cin>>n>>k;
    vector<vector<LL>> M(n,vector<LL>(n));
    for(int i=0;i<n;i++) for(int j=0;j<n;j++)cin>>M[i][j];
    vector<vector<LL>> MM=powe(M,k);
    //_print(MM);
    LL summ=0;
    for(int i=0;i<n;i++)for(int j=0;j<n;j++) summ=(summ+MM[i][j])%MOD;
    cout<<summ;

}




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

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

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

 
int main() {
  int h,w,a,b;
  cin >> h >> w >> a >> b;
  rep(i,h){
    if(i < b){
      rep(j,w){
        if(j < a) cout << 1 ;
        else cout << 0;
      }
    }else{
      rep(j,w){
        if(j < a) cout << 0;
        else cout << 1;
      }
    }
    cout << endl;
  }

  return 0;
}





Measured memory_bytes: 1280
#include <iostream>
#include<vector>
using namespace std;
typedef long long ll;
int main() {
	int n;cin>>n;
	vector<ll> a(n);
	ll sum=0;
	ll mass=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		mass+=i+1;
	}
	ll count;
	if(sum%mass){
		cout<<"NO"<<endl;
		return 0;
	}else{
		count=sum/mass;
	}
	ll done=0;
//	cout<<count<<endl;
	for(int i=0;i<n;i++){
		if(a[(i+1)%n]-a[i]>count){
			cout<<"NO"<<endl;
			return 0;
		}
		if(a[(i+1)%n]-a[i]==count){
			continue;
		}
		if((count+a[i]-a[(i+1)%n])%n){
			cout<<"NO"<<endl;
			return 0;
		}
		done+=(count+a[i]-a[(i+1)%n])/(n);
	}
	if(done==count){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}


	return 0;
}


Measured memory_bytes: 1024
from collections import deque
from sys import stdin
n = int(input())
line = stdin.readlines()
ddl = deque()
for i in range(n):
    inp = line[i].split()
    if len(inp) == 2:
        op, data = inp
        data = int(data)
    else: op, data = inp[0], None
    if op == 'insert':
        ddl.appendleft(data,)
    elif op == 'delete':
        try:
            ddl.remove(data)
        except ValueError:
            pass
    elif op == 'deleteFirst':
        ddl.popleft()
    elif op == 'deleteLast':
        ddl.pop()

print(' '.join([str(item) for item in ddl]))

Measured memory_bytes: 190648
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    h,w,a,b = LI()
    r = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if (i < b) == (j < a):
                r[i][j] = 1

    return JAA(r, "\n", "")


print(main())



Measured memory_bytes: 15060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,e) for(int i = a;i < e;++i)

int main() {
	int N; 
	cin >> N;
	int ans = 0;
	FOR(i, 1, N + 1) {
		string s = to_string(i);
		ans += (int)s.size() % 2 == 1;
	}
	cout << ans << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int INF=1001001001;
const int mod=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  int64_t sum=0;
  for(int i=0;i<N;i++){
    if(i<N&&A[i+1]!=0){
      if(A[i]%2!=0){
        sum++;A[i]--;A[i+1]--;
      }
    }
    sum+=A[i]/2;
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3776
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def ang(n) Array.new(n){gsmi} end
def debug(k,v) puts "#{k}: #{v}" end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def arrays(n,num) #要素数、配列数
  ret = Array.new(num){Array.new(n)}
  n.times do |i|
    ins = gsmi
    num.times{|j| ret[j][i] = ins[j] }
  end
  ret
end
inf = Float::INFINITY
$stdin = File.open('input.txt') if File.exist?('input.txt')
n,w_max = gsmi #100, 10**9
ws,vs = arrays(n,2) #w, 10**5
ws.unshift 0
vs.unshift 0

v_max = 100001
dp = []
(n+1).times do
  dp << [inf] * (v_max + 1)
end
dp[0][0] = 0
(1..n).each do |i|
  v_max.times do |j|
    if(j-vs[i]>=0)
      #puts vs[i] if i==1 && j==1
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-vs[i]]+ws[i])
    else
      dp[i][j] = dp[i-1][j]
    end
    #dp[i][j] = dp[i-1][j] if dp[i][j] > dp[i-1][j]
  end
end

(v_max-1).downto(0) do |j|
  if dp[-1][j]<=w_max
    puts j
    exit
  end
end


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

const int INF = 1e9;

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

	int n;
	cin >> n;

	int mn_r = INF;
	int mx_r = 0;
	int mn_b = INF;
	int mx_b = 0;

	vector<pair<int, int>> balls(n);
	for (auto& [a, b] : balls) {
		cin >> a >> b;
		if (a > b) {
			swap(a, b);
		}

		mn_r = min(mn_r, a);
		mx_r = max(mx_r, a);
		mn_b = min(mn_b, b);
		mx_b = max(mx_b, b);
	}

	long long ans = 1LL * (mx_r - mn_r) * (mx_b - mn_b);

	mx_r = mx_b;
	set<pair<int, int>> blue;
	for (int i = 0; i < n; ++i) {
		auto& [a, b] = balls[i];
		if (a == mn_r && b == mx_r) {
			goto done;
		}
		if (a != mn_r && a < b) {
			swap(a, b);
		}

		blue.emplace(b, i);
	}

	while (!blue.empty()) {
		int ndx = blue.begin()->second;

		ans = min(ans, 1LL * (mx_r - mn_r) * (blue.rbegin()->first - blue.begin()->first));
		if (balls[ndx].first == mn_r || balls[ndx].first == mx_r || balls[ndx].first <= balls[ndx].second) {
			goto done;
		}

		blue.erase(blue.begin());
		swap(balls[ndx].first, balls[ndx].second);
		blue.emplace(balls[ndx].second, ndx);
	} done:

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

Measured memory_bytes: 14284
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll q = (n-1) / 11 + 1;
    ll r = n % 11;
    if (r == 0)
        r = 7;
    ll res = q * 2;
    if (r <= 6)
        cout << (ll)res - 1;
    else 
        cout << (ll)res;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]

for CX in range(101):
    for CY in range(101):
        H = -1
        ans = True
        for x, y, h in xyh:
            if h > 0:
                if H == -1:
                    H = h + abs(CX - x) + abs(CY - y)
                else:
                    if H != h + abs(CX - x) + abs(CY - y):
                        ans = False
                        break
            if not ans:
                break

        for x, y, h in xyh:
            if ans and h == 0:
                if H > h + abs(CX - x) + abs(CY - y):
                    ans = False

        if ans:
            print(CX, CY, H)
            break

    if ans:
        break

Measured memory_bytes: 3064
import java.io.PrintWriter;
import java.util.*;

public class Main {

    private static long gcd(long a, long b) {
        if ( a== 0)return b;
        return gcd(b % a, a);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long p = in.nextLong(),q = in.nextLong();
        //while (p > 0) {
            q /= gcd(p, q);
            long ans = 1;
            for (long i = 2; i * i <= q; i++) {
                if (q % i != 0) continue;
                ans *= i;
                while (q % i == 0) {
                    q /= i;
                }
            }
            ans *= q;
            out.println(ans);

            //p = in.nextLong();
            //q = in.nextLong();
        //}
        out.flush();
    }

}



Measured memory_bytes: 26392
using System;
using static System.Console;
using System.Linq;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
          int[] n = ReadLine().Split(' ').Select(int.Parse).ToArray();
          int an = 0, an1 = 0;
        
          if(n[0] > 1){
              for(int i = n[0] - 1; i >= 0; i--){
                  an += i;
              }
          }

          if(n[1] > 1){
              for(int i = n[1] - 1; i >= 0; i--){
                  an1 += i;
              }
          }

          WriteLine(an + an1);
      }
   }
}

Measured memory_bytes: 11348
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split(" ");
   //  String nyu=sc.nextLine();

int A=Integer.parseInt(nyu[0]);
int B=Integer.parseInt(nyu[1]);

if(A>12){
System.out.println(B);
}else if(5<A && A<13){
System.out.println(B/2);
}else if(6>A){
System.out.println("0");
}
	}
}

Measured memory_bytes: 21844
s = input()
a = 0
if s[0] != 'A':
    a = 2
for i in range(2, len(s) - 1):
    if (s[i] == 'C'):
        a += 1
    elif (not s[i].islower()):
        a += 3
if (not s[-1].islower()):
    a += 3
if (not s[1].islower()):
    a += 3
if a == 1:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 3064
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <utility>
 
bool solve(void){
	
	// Get input
	int n; scanf("%d", &n);
	std::vector<int> nums(n);
	for(int i=0; i<n; i++) scanf("%d", &nums[i]);
	
	// Mapping
	std::map<int, int> nummap;
	for(auto num: nums) nummap[num]++;
	std::vector<std::pair<int, int>> indvs;
	for(auto indv: nummap) indvs.push_back(indv);
	
	// Handling special cases
	if(indvs.size() > 3) return false; // a1 should be same as a4
	else if(indvs.size() == 1) return (indvs[0].first == 0); // 0 0 0 0 0 0 ...
	else if(indvs.size() == 2){ // 0 a a 0 a a 0 a a 0 a a //
		int zerocount, nonzerocount;
		if(indvs[0].first == 0) zerocount = indvs[0].second, nonzerocount = indvs[1].second;
		else if(indvs[1].first == 0) zerocount = indvs[1].second, nonzerocount = indvs[0].second;
		else return false;
		return ((zerocount * 2) == nonzerocount);
	}
	else if(indvs.size() == 3){ // a b c a b c a b c ... a b c
		if((indvs[0].first ^ indvs[1].first) != indvs[2].first) return false;
		for(int i=0; i<3; i++) if(indvs[i].second != indvs[(i+1)%3].second) return false;
		return true;
	}
	else throw "??";
}
 
int main(void){
	if(solve()) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 5372
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        string[] arr = Console.ReadLine().Split(' ');
        int N = int.Parse(arr[0]);
        int M = int.Parse(arr[1]);
        string s = "";
        if (N > M)
        {
            for (int i = 0; i < N; i++)
            {
                s += M.ToString();
            }
        }
        else
        {
            for (int i = 0; i < M; i++)
            {
                s += N.ToString();
            }
        }

        Console.WriteLine(s);
    }
}

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

const ll mod=1000000007;

int ketatume(int a){
  if(a<10)cout<<"00000"<<a;
  else if(a<100)cout<<"0000"<<a;
  else if(a<1000)cout<<"000"<<a;
  else if(a<10000)cout<<"00"<<a;
  else if(a<100000)cout<<"0"<<a;
  else if(a<1000000)cout<<a;
}

int main() {
  int n,m;
  cin >> n >> m;
  P a[m+1];
  vector<vector<P>> p(n+1);
  r(i,m){
    int a,b;
    cin >> a >> b;
    p[a].push_back(P(b,i+1));
  }
  r(i,n){
    if(p[i+1].empty()) continue;
    sort(p[i+1].begin(),p[i+1].end());
    vector<P> v=p[i+1];
    int s=1;
    for(auto && e:v){
      a[e.second]=P(i+1,s);
      s++;
    }
  }
  r(i,m){
    ketatume(a[i+1].first);
    ketatume(a[i+1].second);
      cout<<endl;
  }
}

Measured memory_bytes: 7808
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
#include <climits>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;

int main() {
    cin >> n;
    if(n==3||n==5||n==7){
        put("YES");
        return 0;
    }else{
        put("NO");
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#include<unordered_set>
#include <random>
#include <ctime>
#include <chrono>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int MAX=1e6+1;
const ll MM=1e16;
const ll mod=1e9+7;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}

int visi[2*MAX];
void solve()
{
    ll n,m,i,j,k,ans=0;
    cin>>n;
    vl a(n);
    map<ll,ll> mp;
    set<ll> work;
    fn(i,n){cin>>a[i];mp[a[i]]++;}
   // fn(i,n)cout<<a[i]<<endl;
    sort(all(a));
    fn(i,n)
    {
        if(visi[a[i]]!=-1)
        {
            if(mp[a[i]]==1)
            ans++;
            fs(j,1,MAX)
            {
                if(a[i]*j>=MAX)break;
                visi[a[i]*j]=-1;
            }
        }
        /*
        
        if(work.find(a[i])==work.end() && visi[a[i]]!=-1)
        {
            work.insert(a[i]);
            fs(j,1,MAX)
            {
                if(a[i]*j>=MAX)break;
                visi[a[i]*j]++;
            }
        }
        else
        {
            if(visi[a[i]]!=-1){
            fs(j,1,MAX)
            {
                if(a[i]*j>=MAX)break;
                visi[a[i]*j]=-1;
            }
            }
        }*/
        
    }
    /*fs(i,1,MAX)
    {
       // debug(i);
        if(visi[i]==1 && st.find(i)!=st.end())
        ans++;
    }*/

    cout<<ans<<endl;

}

int main()
{
  boost;
  ll t=1;
  //cin>>t;
  while(t--)
  {
      solve();
  }
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  string S;
  cin >> S;
  for(int i = 0; i < S.size(); i++) {
    if(i % 2) {
      if(S[i] == 'L' || S[i] == 'U' || S[i] == 'D') continue;
      cout << "No" << endl;
      return 0;
    } else {
      if(S[i] == 'R' || S[i] == 'U' || S[i] == 'D') continue;
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}




Measured memory_bytes: 256