akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n),b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];

    set<int> sa,so;
    set<int> t; rep(i,m) t.insert(b[i]);
    rep(i,n) so.insert(a[i]);
    rep(i,m) so.insert(b[i]);

    rep(i,n){
        if(t.count(a[i])){
            sa.insert(a[i]);
        }
    }

    cout << sa.size() << " " << so.size() << endl;
    for(auto v : sa){
        cout << v << endl;
    }
    for(auto v: so){
        cout << v << endl;
    }
}



Measured memory_bytes: 22012
// Lets go to the next level 
// AIM CM at CF *__* asap 
// Hit A,B,C and D faster and reach Candidate Master
// Remember you were also a novice when you started, 
// hence never be rude to anyone who wants to learn something
// Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts 
// Donot treat CP as a placement thing, love it and enjoy it, you will succeed for sure.  

#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
// Big two primes 
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long 
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 


signed main(){
  fio;
    int r;
    cin>>r;
    cout<<r*r;
  rr;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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


vector<ll> inv,fact,invfact;
void Mod_build(int n=1010101){
	fact.resize(n+1);
	inv.resize(n+1);
	invfact.resize(n+1);
	fact[0]=inv[0]=invfact[0]=1;
	inv[1]=1;
	for(ll i=0;i<n;i++){
		fact[i+1]=fact[i]*(i+1)%mod;
		if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
		invfact[i+1]=invfact[i]*inv[i+1]%mod;
	}
}
ll perm(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
	k%=mod-1;
	if(k<0)k+=mod-1;
	ll ret=1;
	while(k){
		if(k&1)ret=ret*n%mod;
		n=n*n%mod;
		k>>=1;
	}
	return ret;
}

int main(){
  int i,j;
  int n,k;
  cin>>n>>k;
  Mod_build();
  ll ans=0;
  for(i=0;i<=min(n,k);i++){
    ans+=(comb(n,i)*comb(n-1,n-i-1))%mod;
    ans%=mod;
    //cout<<ans<<endl;
  }
  cout<<ans<<endl;

}

Measured memory_bytes: 23936
import java.io.*;
import java.util.*;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int a = in.nextInt();
        int b = in.nextInt();
        if (a + b == 15) {
            System.out.println('+');
        } else if (a * b == 15) {
            System.out.println('*');
        } else
            System.out.println('x');
    }

}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException {super(System.out);}
}
class ContestScanner implements Closeable {
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}


Measured memory_bytes: 21588
//16
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<queue>

using namespace std;

struct S{
  int x,y,t,p;
  bool operator<(S a)const{
    return p>a.p;
  }
};

int main(){
  int sx,sy,gx,gy;
  int n;
  cin>>sx>>sy>>gx>>gy>>n;
  bool f[201][201]={};
  while(n--){
    int x,y;
    cin>>x>>y;
    f[y+100][x+100]=true;
  }
  int lx,ly;
  cin>>lx>>ly;
  int p[201][201][6];
  fill(p[0][0],p[201][0],1<<30);
  priority_queue<S> que;
  S is={sx,sy,0,0};
  que.push(is);
  while(!que.empty()){
    S c=que.top();
    que.pop();
    if(p[c.y+100][c.x+100][c.t]<=c.p)continue;
    p[c.y+100][c.x+100][c.t]=c.p;
    int dy[][7]={{1,0,-1,-1,-1,0,0},{1,1,0,-1,0,1,0}};
    int dx[]={0,1,1,0,-1,-1,0};
    for(int l=0;l<7;l++){
      int ny=c.y+dy[abs(c.x)%2][l];
      int nx=c.x+dx[l];
      if(-ly<=ny&&ny<=ly&&-lx<=nx&&nx<=lx&&!f[ny+100][nx+100]){
	S n={nx,ny,(c.t+1)%6,c.p+(abs(c.x*c.y*c.t)%6!=l)};
	que.push(n);
      }
    }
  }
  int r=*min_element(p[gy+100][gx+100],p[gy+100][gx+101]);
  cout<<((r!=1<<30)?r:-1)<<endl;
  return 0;
}

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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

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

const ll MAXN = 1000001;
bool P[MAXN];
bool S[MAXN];
vector<ll> PS;

template<typename T> T gcdraw(T a, T b)
{
    return a ? gcdraw(b%a, a) : b;
}

template<typename T> T gcd(T a, T b)
{
    const auto aa = abs(a), bb = abs(b);
    return aa > bb ? gcdraw(aa, bb) : gcdraw(bb, aa);
}

int main()
{
    ll N;
    cin >> N;

    vector<ll> A(N);
    rep (i, N) { cin >> A[i]; }

    PS.emplace_back(1);
    for (ll i=2;i*i<=MAXN;++i) if (!P[i])
    {
        for (ll j=2*i;j<=MAXN;j+=i) { P[j] = true; }
        PS.emplace_back(i);
    }

    bool isPairwise = true;

    ll cur = A[0];

    for (ll i=0;i<N;++i)
    {
        if (isPairwise) for (const auto& p: PS)
        {
            if (A[i] < p * p) { break; }
            if (A[i] % p) { continue; }

            const auto x = p;
            const auto y = A[i] / p;

            if (x != 1 && S[x]) { isPairwise = false; }
            if (y != 1 && S[y]) { isPairwise = false; }

            S[x] = true;
            S[y] = true;
        }

        cur = gcd(cur, A[i]);
    }

    const auto isSetwise = cur == 1;

    if (isPairwise)     { cout << "pairwise coprime" << endl; }
    else if (isSetwise) { cout << "setwise coprime" << endl; }
    else                { cout << "not coprime" << endl; }

    return 0;
}


Measured memory_bytes: 11968
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus>=201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

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

void solve(long long N){
  set<ll> s;
  FOR(i,1,10)FOR(j,1,10){
    s.insert(i*j);
  }
  if(s.count(N)){
    cout<<YES<<endl;
  }else{
    cout<<NO<<endl;
  }
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define s second
#define f first
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
main(){
  int x,y,q,n,ty,tx;
  pair<int,int> a[5000];
  cin>>n>>q;
  r(i,n)cin>>x>>y,a[i].f=x,a[i].s=y;
  sort(a,a+n);
  r(i,q){
    cin>>x>>y>>tx>>ty;
    int c=0;
    r(i,n){
      if(x<=a[i].f&&a[i].f<=tx&&y<=a[i].s&&a[i].s<=ty)c++;
      if(tx<a[i].f)break;
    }
    cout<<c<<endl;
  }
}

Measured memory_bytes: 3112
h, w = map(int, input().split())
field = []
for i in range(h):
  field.append(list(input()))
tfield = [x for x in zip(*field)]
wh = []
ww = []

for i in range(h):
  if len(set(field[i])) == 1 and field[i][0] == ".":
    wh.append(i)

for i in range(w):
  if len(set(tfield[i])) == 1 and tfield[i][0] == ".":
    ww.append(i)

for i in range(h):
  if i in wh:
    continue
  for j in range(w):
    if j not in ww:
      print(field[i][j], end="")
  print("")

Measured memory_bytes: 9456
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long

int main(){
	int a,b;
	cin>>a>>b;
	if(a+b==15)cout<<'+'<<endl;
	else if(a*b==15)cout<<"*"<<endl;
	else cout<<"x"<<endl;
	return 0;
}




Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.util.stream.*;

public class Main{

  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    String[] oneLine = br.readLine().split(" ", 0);
    int[] nl = Stream.of(oneLine).mapToInt(x -> Integer.valueOf(x)).toArray();
    String[] tList = new String[nl[0]];

    for(int i =0; i < nl[0]; i++){
      tList[i] = br.readLine();
    }

    Arrays.sort(tList);
    String result = Arrays.stream(tList).reduce("", (seed, value) -> seed + value);

    System.out.println(result);


  }
}


Measured memory_bytes: 26196
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
typedef long long ll;
using namespace std;
#define mod 1000000007


int main(){
    int a,b;cin >> a >> b;
    for(int i=1;i<1000000000;i++){
        if(abs(a-i)==abs(b-i)){
            cout << i << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main()
{
    IO;

    ll N; cin >> N;

    string ans = "";

    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }
    else if (N == 0) {
        cout << 0 << endl;
        return 0;
    }

    while (1) {
        if (N % 2 == 0) { 
            ans = to_string(0) + ans;
            N /= -2;
        }
        else if (N != 1) {
            ans = to_string(1) + ans;
            if (N >= 0) { N /= -2; }
            else { N = N / (-2) + 1; }
        }
        else if (N == 1) {
            ans = to_string(1) + ans;
            break;
        }
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3116
n, d = map(int, input().split())
t = []
for i in range(n):
  t.append(list(map(int, input().split())))

count = 0
for i in range(n):
  if t[i][0]**2 + t[i][1]**2 <= d**2:
    count += 1
print(count)

Measured memory_bytes: 45456
// E - Sum of gcd of Tuples (Hard)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)

#define MOD 1'000'000'007

// a^n mod m を計算する(繰り返し二乗法,二分累乗法:O(logn))
ll modpow(ll a, ll n) {
	ll m = MOD;
	ll x = 1;
	while(n > 0){
		if(n & 1) x = x * a % m;
		a = a * a % m;
		n >>= 1;
	}
	return x;
}

int main(){
	int N,K; cin>>N>>K;

	vector<ll> cnt_gcd(K+1);

	irp(g, K, 1-1){ // g:[K,1,-1] fixed gcd
		cnt_gcd[g] = modpow(K/g, N); // number of multiples of g
		rp(n, 2, K+1){ // n:[2,K]
			if(n*g > K) break;
			cnt_gcd[g] -= cnt_gcd[n*g];
		}
	}

	ll ans = 0;
	rp(g, 1, K+1) ans = (ans + (cnt_gcd[g] * g % MOD)) % MOD;
	cout<< ans <<endl;
}

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

int next_player_turn (char player) {
  if (player == 'a') {
    return 0;
  }
  else if (player == 'b') {
    return 1;
  }
  else if (player == 'c') {
    return 2;
  }

  return 0;
}

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

  string S_A, S_B, S_C;
  cin >> S_A >> S_B >> S_C;
  int cnt_A = 0, cnt_B = 0, cnt_C = 0;

  int turn = 0;
  for (int i = 0; ; ++i) {
    if (turn == 0) {
      if (S_A.size() <= cnt_A) {
        cout << 'A' << endl;
        return 0;
      }
      turn = next_player_turn(S_A.at(cnt_A));
      cnt_A++;
    }
    else if (turn == 1) {
      if (S_B.size() <= cnt_B) {
        cout << 'B' << endl;
        return 0;
      }
      turn = next_player_turn(S_B.at(cnt_B));
      cnt_B++;
    }
    else if (turn == 2) {
      if (S_C.size() <= cnt_C) {
        cout << 'C' << endl;
        return 0;
      }
      turn = next_player_turn(S_C.at(cnt_C));
      cnt_C++;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
long long a[1111];
vector<long long>v;
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
		long long s=0;
		for(int j=i;j<n;j++)
		{
			s+=a[j];
			v.push_back(s);
		}
	}
	sort(v.begin(),v.end());
	long long cur=0;
	for(int i=40;i>=0;i--)
	{
		long long ncur=cur+(1ll<<i);
		int ok=0;
		for(int j=0;j<v.size();j++)
		{
			if((ncur&v[j])==ncur)
			{
				ok++;
			}
		}
		if(ok>=k)
		{
			cur=ncur;
		}
	}
	cout<<cur<<endl;
	return 0;
}

Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std;
#define ll long double
#define pb push_back
#define mpp make_pair
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    fast;
    ll d,v,t;
    cin>>d>>t>>v;
    if(d/v<=t)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


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

int main()
{
  int n;
  cin>>n;
  vector<int>h(n);
  for(int i=0;i<n;i++)
  {
    cin>>h[i];
  }
  vector<int>dp(n,0);
  dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <complex>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
#define INF 1e9
#define MOD 1e9 + 7
using namespace std;

template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }

using P = complex<double>;
const double PI = acos(-1);
const double EPS = 1e-9;
// P p(a,b)=a+bi -> 点p(a,b)
namespace std {
  bool operator<(const P &a, const P &b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); }
  bool operator==(const P &a, const P &b) { return a.real() == b.real() && a.imag() == b.imag(); }
} // namespace std
// i倍すれば反時計回りに90度回転
P turn(P p, double t) { // t度回転
  return p * exp(P(.0, t * PI / 180.0)); //ベクトルにe^θiをかける
}

//内積
double dot(P a, P b) { return real(conj(a) * b); }
//外戚
double cross(P a, P b) { return imag(conj(a) * b); }

//////////////////////////////////////
// 直線(Line) 線分(Segment)          //
// L l(a,b);で直線ab                 //
// l[0]=a l[1]=b                    //
// e.g. L line(P(x1,y1),P(x2,y2));  //
//////////////////////////////////////
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a);
    push_back(b);
  }
};
int ccw(P a, P b, P c) {
  b -= a;
  c -= a;
  if (cross(b, c) > 0) return +1; // counter clockwise
  if (cross(b, c) < 0) return -1; // clockwise
  if (dot(b, c) < 0) return +2; // c--a--b on line
  if (norm(b) < norm(c)) return -2; // a--b--c on line
  return 0;
}

bool intersectSS(const L &s, const L &t) { return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 && ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0; }

signed main() {

  int q;
  cin >> q;
  while (q--) {
    int a, b, c, d, e, f, g, h;
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    L l(P(a, b), P(c, d));
    L m(P(e, f), P(g, h));
    cout << intersectSS(l, m) << endl;
  }
  return 0;
}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
int main(){
    int n;cin >> n;
    ll d,a;cin >> d >> a;
    vector<l_l> p(n);
    for(int i=0;i<n;i++){
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(),p.end());
    queue<l_l> q;
    d=d*2;
    ll total=0;
    ll ans=0;
    for(int i=0;i<n;i++){
        ll x=p[i].first;
        ll h=p[i].second;
        while(!q.empty()&&q.front().first<x){
            total-=q.front().second;
            q.pop();
        }
        h-=total;
        if(h>0){
            ll num=(h+a-1)/a;//切り上げ
            ll damage=num*a;
            ans+=num;
            total+=damage;
            q.push({x+d,damage});
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define mod 1000000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	int n,m;
	cin>>n>>m;
	vector<int> v(n);
	int sum = 0;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		sum += v[i];
	}
	int cnt = 0;
	for(int i=0;i<n;i++)
		if(v[i]*4*m>=sum)
			++cnt;
	if(cnt>=m)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

		
			



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

bool binarySearch( long N[], int Q, int num ){
 int left = 0;
 int right = num;

 while( left < right ){
  int mid = (left+right)/2;
  if( N[mid] == Q ){
    return true;
  }else if( Q < N[mid] ){
    right = mid;
  }else{
    left = mid+1;
  }
 }

 return false;
}

int main(){
 int n;
 cin >> n;
 long n_num[n];
 for( int i=0; i<n; i++ ){
   cin >> n_num[i];
 }

 int q;
 cin >> q;
 long q_num;
 int count = 0;
 for( int j=0; j<q; j++ ){
   cin >> q_num;
   if(binarySearch( n_num, q_num, n )){
     count++;
   }
 }

 cout << count << endl;

 return 0;
}


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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
	IOS;
  char ch;cin>>ch;
  if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')puts("vowel");
  else puts("consonant");

  return 0;
}



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

using namespace std;
const int INF=1000000000;

int main(){
	int n,k,a,b,m[10],sor[10][2000],dp[10][2000];
	vector<int> cc[10];
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		cc[b-1].push_back(a);
	}
	for(int i=0;i<10;i++){
		m[i]=cc[i].size();
		sort(cc[i].begin(),cc[i].end());
		for(int j=0;j<m[i];j++){
			sor[i][j]=cc[i][m[i]-j-1];
			if(j!=0)sor[i][j]+=sor[i][j-1]+2*j;
		}
		for(int j=m[i];j<2000;j++){
			sor[i][j]=0;
		}
	}
	for(int i=0;i<10;i++){
		for(int j=0;j<=k;j++){
			if(i==0&&j==0)dp[i][j]=0;
			if(i==0&&j!=0)dp[i][j]=sor[i][j-1];
			if(i!=0){
				dp[i][j]=dp[i-1][j];
				for(int ka=1;ka<=j;ka++){
					if(dp[i-1][j-ka]+sor[i][ka-1]>dp[i][j])dp[i][j]=dp[i-1][j-ka]+sor[i][ka-1];
				}
			}
		}
	}
	printf("%d\n",dp[9][k]);
}

Measured memory_bytes: 1384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

int x, y;
int main()
{
	cin >> x >> y;
	if ((x + y) % 2 == 0)
		cout << (x + y) / 2 << endl;
	else
		cout << (x + y) / 2 + 1 << endl;
}

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

long Euler(long n) {
    long p = n;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            p = p - p / i;
            while (n % i == 0) n /= i;
        }
    }
    if (n > 1) p = p - p / n;
    return p;
}

int main() {
    long n;
    cin >> n;
    cout << Euler(n) << endl;
}


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

int main() {
	// your code goes here
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<a[k-1];
	return 0;
}


Measured memory_bytes: 384
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const arr = lines.shift().split(' ');
  buildMaxHeap(arr);
  console.log(arr.reduce((s, e) => s += ' ' + e, ''));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  let left, right, largest;
  const maxHeapify = (i) => {
    left = 2 * i + 1;
    right = 2 * i + 2;
    if (left < n && Number(arr[left]) > Number(arr[i])) largest = left;
    else largest = i;
    if (right < n && Number(arr[right]) > Number(arr[largest])) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(arr.length / 2); i >= 0; i--) maxHeapify(i);
}



Measured memory_bytes: 110536
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

vector<int> huda(55);

void shuffle(int p,int c) {
	vector<int> tmp(p - 1);
	for (int i = 0; i < p - 1; ++i) tmp[i] = huda[i];
	for (int i = 0; i < c; ++i) huda[i] = huda[i + p - 1];
	for (int i = 0; i < p - 1; ++i) huda[c + i] = tmp[i];
}

int main() {
	int n, r;
	while (cin >> n >> r && n != 0 && r != 0) {
		for (int i = 1; i <= n; ++i) huda[n - i] = i;
		for (int i = 0; i < r; ++i) {
			int p, c;
			cin >> p >> c;
			shuffle(p, c);
		}
		cout << huda[0] << endl;
	}


	return 0;
}


Measured memory_bytes: 2996
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var input = Console.ReadLine();
            var inputs = input.Split(' ');
            var a = Int32.Parse(inputs[0]);
            var b = Int32.Parse(inputs[1]);
            
            var startTime = a + b;
            
            if (startTime >= 24)
            {
                Console.WriteLine(startTime - 24);
               
                return; 
            } 
            
                Console.WriteLine(startTime);
            
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <map>
using namespace std; 

int main(){
    int n,m; cin >> n >> m;
    vector<int> a(n,0);
    vector<int> z(n,0);
    int p;
    int ac=0;
    int wa=0;
    string s;
    for (int i = 0;i < m;i++){
        cin >> p >> s;
        if (s=="AC" && z[p-1]==0){
            ac+=1;
            z[p-1]=1;
            wa+=a[p-1];
        }
        else if (s=="WA"){
            a[p-1]+=1;
        }
    }
    cout << ac << " " << wa << "\n";
}


    

  


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	string ss = "CODEFESTIVAL2016";
	string s; cin >> s;
	ll cnt = 0;
	REP(i, s.size()) {
		if (s[i] != ss[i]) cnt++;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define ll long long
#define ld long double
#define fi first
#define se second
#define sz(x) x.size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}
template <class T> inline T gcd(T a, T b) {if (b) return gcd(b, a % b); else return a;}
template <class T> inline T lcm(T a, T b) {return (a * b) / gcd(a,b);}

signed main()
{
//	freopen("THREEPRIMES.inp", "r", stdin); freopen("THREEPRIMES.out", "w", stdout);
	fastio();

	string s, t; cin >> s >> t;
	int a, b; cin >> a >> b;
	string p; cin >> p;
	if (p == s) cout << a - 1 << ' ' << b;
	else cout << a << ' ' << b - 1;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;
ll mn1=-9223372036854775808;
int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
// --------------------------------------------------</TEMPLATE>--------------------------------------------------


void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*c,max(a*d,max(b*c,b*d)))<<endl;
}
int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);

}


Measured memory_bytes: 3664
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
  static void Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    var rule = Console.ReadLine().Split(' ').Select(x=>double.Parse(x)).ToArray();
    var elevation = Console.ReadLine().Split(' ').Select(x=>double.Parse(x)).ToArray();
    
    double difference = 999999;
    int result = 0;
    for(int i=0;i<n;i++){
      double temperature=rule[0]-elevation[i] * 0.006;
      double work = temperature-rule[1];
      if(work<0){work = work*-1;}
      if(difference>work){
        difference=work;
        result = i+1;
      }
    }
    
    Console.WriteLine(result);
  }
}

Measured memory_bytes: 13328
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main(){
    int n;
    long long k;
    cin >> n >> k;
    int a[n], b[n], c[n];
    int i,j;
    for(i=0;i<n;i++){
        cin >> a[i];
        b[i]=-1;
        c[i]=0;
    }
    int ai = 1;
    b[0]=1;
    c[0]=1;
    for(i=1;i<n;i++){
        ai=a[ai-1];
        if(i==k){
            cout << ai << endl;
            return 0;
        }
        if(c[ai-1]==1){
            for(j=0;j<i;j++){
                if(b[j]==ai){
                    int looplen = j-i;
                    int d = (k-i)%looplen;
                    cout << b[j+d] << endl;
                    return 0;
                }
            }
        }else{
            c[ai-1]=1;
        }
        b[i]=ai;

    }
    string s;
    cin >> s;
    if(s=="ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}

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

using namespace std;

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

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

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

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

const ll MOD = 1000000007ll;

int n;
char s[12525][12];

int main(){
    scanf("%d",&n);
    REP(i,n)scanf("%s",s[i]);
    int ans = 0;
    int _a=0,ba=0,b_=0;
    REP(i,n){
        int len = strlen(s[i]);
        REP(j,len-1)if(s[i][j]=='A' && s[i][j+1]=='B')ans++;
        if(s[i][0]=='B' && s[i][len-1]=='A'){
            ba++;
        }else if(s[i][0]=='B'){
            b_++;
        }else if(s[i][len-1]=='A'){
            _a++;
        }
    }
    if(_a>0 && b_>0){
        ans += ba + min(_a,b_);
    }else if(_a>0 || b_>0){
        ans += ba;
    }else{
        ans += max(0,ba-1);
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll x, ans = 0;
  cin >> x;
  for (ll i = 100; i < x; i += i / 100) {
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld;
#define has_bit(bit_mask, x) ((bit_mask) & (1ULL << (x)))
#define turn_on_bit(bit_mask, x) (bit_mask |= (1ULL << (x)))
#define turn_off_bit(bit_mask, x) (bit_mask &= (~(1ULL << (x))))
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define decToBin(name, num) string name = bitset<8>(num).to_string();
#define binToDec(name, binary) unsigned long name = bitset<8>(binary).to_ulong();
#define radToDeg(name, radians) double name = radians * 180 / M_PI;
#define all(x) x.begin(), x.end()
#define mapfind(mp, x) (mp.find(x) != mp.end())
#define arrfind(arr, x) (find(all(arr), x) != arr.end())
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define printMat(mat) for (auto &x : mat) { for (auto &y : x) cout << y << " "; cout << '\n'; }
#define printArr(arr) for (auto &x : arr) cout << x << " "; cout << '\n';
#define ceil(a, b) ((a+b-1)/b)
#define int ll
#define double ld
#define INF (1LL<<62)
#define M_PI 3.14159265358979323846
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
void str_replaceAll(string& str, const string& from, const string& to) { if(from.empty()) return; size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); } }
#define MOD 1000000007

int dp[101][100002];
signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    for (auto &x : arr) cin >> x;
    for (int j = 0; j <= k; ++j) dp[0][j] = (j <= arr[0]) ? 1 : 0;
    for (int i = 1; i < n; ++i)
    {
        for (int j = 1; j <= k; ++j) dp[i-1][j] = (dp[i-1][j] + dp[i-1][j-1]) % MOD;
        for (int j = 0; j <= k; ++j) dp[i][j] = (j-arr[i]-1 >= 0) ? (dp[i-1][j] - dp[i-1][j-arr[i]-1] + MOD) % MOD : dp[i-1][j];
    }
    cout << dp[n-1][k] << '\n';
    return 0;
}

Measured memory_bytes: 78336
#include<iostream>
using namespace std;
int main() {
  int n,sum;
  bool flag = false;
  cin >> n;
  for (int i = 0; i <= 25; i++) {
    for (int j = 0; j < 15; j++) {
      sum = 4*i+7*j;
      if(sum == n){
	cout << "Yes" << endl;
	flag = true;
      }
      if(flag){
	break;
      }
    }
    if(flag){
      break;
    }
  }
  if(!flag){
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;


int main() {
	int n; cin >> n;
	vector<string> s(n);
	for (int i = 0; i < n; i++) cin >> s[i];
	for (int i = 0; i < n; i++) sort(s[i].begin(), s[i].end());
	sort(s.begin(), s.end());
	s.push_back("@");
	ll ans = 0, cnt = 1;
	for (int i = 0; i < n; i++) {
		if (s[i] == s[i + 1]) cnt++;
		else ans += cnt*(cnt - 1) / 2, cnt = 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8116
#include <bits/stdc++.h>
     
    #define         ll      long long
     
    using namespace std;
     
    ll func(ll x)
    {
    	if(x==0) return 0;
    	if(x==1) return 1;
     
    	if(x%2==0)
    	{
    		if(x%4==0) return x;
    		else return x+1;
    	}
    	else return (func(x-1)^x);
    }
     
    int main()
    {
    	ll a, b;
     
    	cin >> a >> b;
     
    	cout << (func(a-1)^func(b)) << endl;
     
    	return 0;
    }

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

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

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> v(n);
  rep(i,n){
    cin >> v[i];
  }
  ll ans = 0;
  while(1){
    sort(all(v));
    if(v[n-1] < n){
      break;
    }
    ans += v[n-1] / n;
    rep(i,n-1){
      v[i] += v[n-1] / n;
    }
    v[n-1] -= v[n-1] / n * n;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i] << " "
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int32_t main(){
    SPEED;
    int n;
    cin >> n;
    int ans = 0;
    while(n--){
        int x;
        cin >> x;
        ans += x - 1;
    }
    cout << ans ;
}

Measured memory_bytes: 3664
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
y.append(Y)

a = max(x)
b = min(y)

if a < b:
    print('No War')
else:
    print('War')


Measured memory_bytes: 3060
n = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

cnt = 0

a = (factorization(n))
#print(a)
for i in range(len(a)):
    j = 1
    while a[i][1]>=j:
        a[i][1] = a[i][1]-j
        j = j+1
        cnt += 1

if n == 1:
    print(0)
else:
    print(cnt)

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

int w,h,cntW,cntB;
char map[51][51],mapW[51][51],mapB[51][51];


void visitB(int i, int j){
  mapB[i][j] = 'B';
  if( i+1 <= h && mapB[i+1][j] == '.' )visitB(i+1,j);
  if( i-1 >= 0 && mapB[i-1][j] == '.')visitB(i-1,j);
  if( j+1 <= w && mapB[i][j+1] == '.')visitB(i,j+1);
  if( j-1 >= 0 && mapB[i][j-1] == '.')visitB(i,j-1);
}

void visitW(int i, int j){
  mapW[i][j] = 'W';
  if( i+1 <= h && mapW[i+1][j] == '.' )visitW(i+1,j);
  if( i-1 >= 0 && mapW[i-1][j] == '.')visitW(i-1,j);
  if( j+1 <= w && mapW[i][j+1] == '.')visitW(i,j+1);
  if( j-1 >= 0 && mapW[i][j-1] == '.')visitW(i,j-1);
}



int main(){
  while(1){
    int i,j;
    cin >> w >> h;
    if ( w == 0 && h == 0 ) break;
    cntB = 0,cntW = 0;
    for( i = 1; i <= h; i++ ){
      for ( j = 1; j <=w; j++ ){
	cin >> map[i][j];
	mapW[i][j] = map[i][j];
	mapB[i][j] = map[i][j];
      }
    }

      
    for( i = 1; i <= h; i++ ){
      for( j = 1; j <= w; j++ ){
	if( mapB[i][j] == 'B' ){
	  visitB(i,j);
	}
      }
    }
    
    for( i = 1; i <= h; i++ ){
      for( j = 1; j <= w; j++ ){
	if( mapW[i][j] == 'W' ){
	  visitW(i,j);
	}
      }
    }
        
    for( i = 1; i <=h; i++ ){
      for( j = 1; j <= w; j++ ){
	if(map[i][j] == '.' ){
	  if( mapB[i][j] == 'B' && mapW[i][j] == 'W' ) continue;
	  else if( mapB[i][j] == 'B' ) cntB++;
	  else if( mapW[i][j] == 'W' ) cntW++;
	  }
	}
      }
    
    cout << cntB << " " << cntW << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1240
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
#define sz(x) ((int)(x).size())
#define int ll
#define el '\n'
template<class T> bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
typedef long long ll; typedef long double ld; typedef double dd; typedef pair<int, int> pii;
const ll INFLL=0x7f7f7f7f7f7f7f7f, MOD=1e9+9; const int INF=0x7f7f7f7f;

//////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is:\t"<<x<<'\n';
#define DD(x,y) cerr<<'('<<#x<<','<<#y<<") are:\t"<<x<<' '<<y<<'\n';
#define DDD(x,y,z) cerr<<'('<<#x<<','<<#y<<','<<#z<<") are:\t"<<x<<' '<<y<<' '<<z<<'\n';

/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<int>> adj; vv<int> vis, color; 
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m=MOD){ll res=1;x%=m;while(n){if(n&1)res=(res*x)%m;n>>=1;x=(x*x)%m;}return res;}
inline ll gcd(ll a, ll b){if(a<0) a=-a; if(b<0) b=-b; while (a>0 && b>0){if(a>b)a%=b;else b%=a;}return a+b;}

///////////////////// MAIN STARTS //////////////////////////////////
int32_t main(void){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());

ll a,b; cin>>a>>b;
ll d=abs(a-b);
if(d%2==1) cout << "IMPOSSIBLE" <<el;
else cout << (a+b)/2 << el;

return 0;
}


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

int main(){
    int N,X,Y; cin >> N >> X >> Y;
    X--;Y--;
    int cnt[N+1]={};
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            int tmp;
            if(i<=X&&Y<=j){ //被覆しているかどうか
                tmp=j-i-(Y-X-1);
            }else if(i<=X&&j<=Y){
                tmp=min(j-i,X-i+Y-j+1);
            }else if(X<=i&&Y<=j){
                tmp=min(j-i,i-X+1+j-Y);
            }else if(X<=i&&j<=Y){
                tmp=min(j-i,i-X+Y-j+1);
            }
            cnt[tmp]++;
        }
    }
    for(int i=1;i<N;i++){
        cout << cnt[i] << endl;
    }
}

Measured memory_bytes: 256