akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;
const int M = 1e6 + 7;
const int INF = 1e9 + 7;
ll a[N];
int main()
{
    for(int i = 1; i <= 9; i++)
        a[i] = i;
    int len = 9;
    for(int i = 1; i <= len; i++)
    {
        int g = a[i] % 10;
        if(g == 0)
        {
            a[++len] = a[i] * 10;
            a[++len] = a[i] * 10 + 1;
        }
        else if(g == 9)
        {
            a[++len] = a[i] * 10 + 8;
            a[++len] = a[i] * 10 + 9;
        }
        else
        {
            a[++len] = a[i] * 10 + g - 1;
            a[++len] = a[i] * 10 + g;
            a[++len] = a[i] * 10 + g + 1;
        }
        if(len >= 100000)
            break;
    }
    int n;
    cin >> n;
    cout << a[n] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <algorithm>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

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

  std::string s;
  std::cin >> s;

  std::string::iterator it;
  std::stack<char> st;
  for (it = s.begin(); it != s.end(); it++) {
    if (*it == 'B') {
      if (!st.empty()) {
	st.pop();
      }
    } else {
      st.push(*it);
    }
  }

  std::string ans;
  while (!st.empty()) {
    char c = st.top(); st.pop();
    ans = c + ans;
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  #define int long long
  int N;
  cin >> N;
  vector<int> b(N);
  unordered_map<int, int> mp;
  int B = -1;
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
  }
  for (int i = N - 1; i >= 0; i--){
    if (b.at(i) == i + 1) {
      B = i;
      break;
    }
  }
  stack<int> answer;
  for (int i = 0; i < N; i++)  {
    if (B == -1) {
      cout << -1 << endl;
      return 0;
    }
    answer.push(B + 1);
    for (int j = B; j < N - i - 1; j++) {
      b.at(j) = b.at(j + 1);
    }
    B = -1;
    for (int j = N - i - 2; j >= 0; j--){
      if (b.at(j) == j + 1) {
        B = j;
        break;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << answer.top() << endl;
    answer.pop();
  }
}

Measured memory_bytes: 3600
def solve(mid):
    pos = (d[0] + d[1]) * (mid // 2)
    if mid % 2 == 1:
        pos += d[0]

    if mid % 2 == 1:
        nxt_pos = pos + d[1]
    else:
        nxt_pos = pos + d[0]

    if pos * nxt_pos < 0 or nxt_pos == 0:
        return True
    else:
        return False

t = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

v0 = a[0] - b[0]
v1 = a[1] - b[1]
d = [t[0] * v0, t[1] * v1]

if d[0] == -d[1]:
    print("infinity")
    exit()
    
ok = 0
ng = 10 ** 60
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve(mid):
        ok = mid
    else:
        ng = mid
print(ok)



Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int x;
	std::cin >> x;
	int pro = x;
	int ans;
	for (int i = 0;i < 2;++i) {
		ans = pro *= x;
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in();
    vector<int> A(N+2);
    A[0] = 0;
    REP(i,N)A[i+1] = in();
    A[N+1] = 0;
    int total = 0;
    REP(i,N+1)total += abs(A[i] - A[i+1]);
    REP(i,N){
        cout << total - abs(A[i] - A[i+1]) - abs(A[i+1] - A[i+2]) + abs(A[i] - A[i+2]) << "\n";
    }
}

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

int main() {
  string s;
  string flag;
  cin >> s;
  int len = s.size();
  for (int i=0; i<len; i++){
    if (i % 2 == 0){
      if (s[i] == 'L'){
        flag = "No";
      }
    }
    if (i % 2 == 1){
      if (s[i] == 'R'){
        flag = "No";
      }
    }
  }
  if (flag == "No"){
    cout << "No";
  }
  else {
    cout << "Yes";
  }
}


Measured memory_bytes: 256
#include<map>
#include<queue>
#include<cstdio>

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

using namespace std;

const int V_MAX=6000;
const int CAPA_INF=1<<29;
const int COST_INF=1<<29;

template<class T,class U>
struct edge{
	int v,rev;
	T capa;
	U cost;
	T flow;
};

template<class T,class U>
void add_directed_edge(vector< edge<T,U> > *G,int u,int v,T capa,U cost){
	G[u].push_back((edge<T,U>){v,G[v].size()  ,capa, cost,0});
	G[v].push_back((edge<T,U>){u,G[u].size()-1,   0,-cost,0});
}

template<class T,class U>
pair<T,U> augment(int n,vector< edge<T,U> > *G,int s,int t,U *pot){
	static int pre[V_MAX];
	static U d[V_MAX];
	rep(u,n) d[u]=(u==s?0:COST_INF);

	bool ok=false;
	priority_queue< pair<U,int> > Q; Q.push(make_pair(0,s));
	while(!Q.empty()){
		int u=Q.top().second;
		U cost=-Q.top().first; Q.pop();

		if(cost<d[u]) continue;
		if(u==t) ok=true;

		rep(i,G[u].size()){
			edge<T,U> &e=G[u][i];
			U cost2=cost+e.cost+pot[u]-pot[e.v];
			if(e.capa-e.flow>0 && cost2<d[e.v]){
				d[e.v]=cost2;
				pre[e.v]=e.rev;
				Q.push(make_pair(-cost2,e.v));
			}
		}
	}

	if(!ok) return make_pair(0,0);

	T water=CAPA_INF;
	for(int v=t;v!=s;){
		edge<T,U> &e1=G[v][pre[v]];
		edge<T,U> &e2=G[e1.v][e1.rev];
		water=min(water,e2.capa-e2.flow);
		v=e1.v;
	}

	U cost=0;
	for(int v=t;v!=s;){
		edge<T,U> &e1=G[v][pre[v]];
		edge<T,U> &e2=G[e1.v][e1.rev];
		e1.flow-=water;
		e2.flow+=water;
		cost+=water*e2.cost;
		v=e1.v;
	}

	rep(u,n) pot[u]+=d[u];

	return make_pair(water,cost);
}

template<class T,class U>
pair<T,U> primal_dual(int n,vector< edge<T,U> > *G,int s,int t){
	T ans1=0;
	U ans2=0;
	static U pot[V_MAX];
	while(1){
		pair<T,U> tmp=augment(n,G,s,t,pot);
		if(tmp.first==0) break;
		ans1+=tmp.first;
		ans2+=tmp.second;
	}
	return make_pair(ans1,ans2);
}

struct train{
	int t1,t2,cost;
};

int main(){
	for(int n;scanf("%d",&n),n;){
		vector<train> T[99];
		rep(i,n-1){
			int m; scanf("%d",&m);
			T[i].resize(m);
			rep(j,m) scanf("%d%d%d",&T[i][j].t1,&T[i][j].t2,&T[i][j].cost);
		}
		int n_class; scanf("%d",&n_class);

		int V=0;
		map<int,int> f[100][2];
		map<int,int>::iterator it,jt;
		rep(i,n-1) rep(j,T[i].size()) {
			int t1=T[i][j].t1,t2=T[i][j].t2;
			if(f[ i ][0].count(t1)==0) f[ i ][0][t1]=V++;
			if(f[i+1][0].count(t2)==0) f[i+1][0][t2]=V++;
			if(f[i+1][1].count(t2)==0) f[i+1][1][t2]=V++;
		}

		int s=V++;
		int t=V++;
		static vector< edge<int,int> > G[V_MAX];
		rep(u,V) G[u].clear();

		add_directed_edge(G,s,f[0][0].begin()->second,n_class,0);
		add_directed_edge(G,f[n-1][0].rbegin()->second,t,n_class,0);
		rep(i,n){
			for(it=f[i][0].begin();it!=f[i][0].end();++it){
				jt=it;
				++jt;
				if(jt!=f[i][0].end()){
					add_directed_edge(G,it->second,jt->second,n_class,0);
				}
			}
			for(it=f[i][1].begin();it!=f[i][1].end();++it){
				int t=it->first;
				add_directed_edge(G,it->second,f[i][0][t],1,0);
			}
		}
		rep(i,n-1) rep(j,T[i].size()) {
			add_directed_edge(G,f[i][0][T[i][j].t1],f[i+1][1][T[i][j].t2],1,T[i][j].cost);
		}

		pair<int,int> ans=primal_dual(V,G,s,t);
		printf("%d %d\n",ans.first,ans.second);
	}

	return 0;
}

Measured memory_bytes: 2116
/**
 * @author torith
 * @date 2018-10-28
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    bool a[8] = {};
    int rate_cnt = 0;
    for (int i = 0; i < N; ++i) {
        int t; cin >> t;
        if(0 < t && t < 400) a[0] = true;
        else if (399 < t && t < 800) a[1] = true;
        else if (799 < t && t < 1200) a[2] = true;
        else if (1199 < t && t < 1600) a[3] = true;
        else if (1599 < t && t < 2000) a[4] = true;
        else if (1999 < t && t < 2400) a[5] = true;
        else if (2399 < t && t < 2800) a[6] = true;
        else if (2799 < t && t < 3200) a[7] = true;
        else rate_cnt++;
    }

    int ans = 0;
    for (int i = 0; i < 8; ++i) {
        if(a[i]) ans++;
    }

    cout << max(ans,1) << " " << ans + rate_cnt << "\n";


    return 0;
}



Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
odd = 0
evn = 0
for i in range(1, n+1):
    if i%2:
        odd += 1
    else:
        evn += 1

print(odd/(odd+evn))

Measured memory_bytes: 3064
#include <stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d",&a,&b,&c);
  if(a>=b){
    if(c>=a) d=c*10+a+b;
    else d=a*10+b+c;
  }
  else{
    if(c>=b) d=c*10+b+a;
    else d=b*10+a+c;
  }
  printf("%d",d);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,p,i,j,k,n=0;
     string s;
     cin>>s;
     map<char,int>m;
     for(i=0;i<s.size();i++){
        m[s[i]]++;
     }
     set<char>S;
     set<char>::iterator it;
     for(i=0;i<s.size();i++){
        S.insert(s[i]);
     }
     for(it=S.begin();it!=S.end();it++){if(m[*it]!=2){n=1;}}
     if(n==0){cout<<"Yes\n";}
     else{cout<<"No\n";}



}



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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}


int main(void){
  ios::sync_with_stdio(false);
  int k, a, b;
  cin >> k >> a >> b;
  bool flag = false;
  FOR(i, a, b+1){
    if (i % k == 0){
      flag = true;
    }
  }
  if (flag) cout << "OK" << endl;
  else cout << "NG" << endl;
  return 0;
}



Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#define LEN 100

int 
main(int argc, char *argv[])
{
  char str[LEN+1];
  int len;
  int i;
  scanf("%s", str);
  len = strlen(str);
  for (i = 0; i < len; i++)
    str[i] = 'x';
  printf("%s", str);
}
  
  

Measured memory_bytes: 128
def count_black(matrix, mask_rows=[], mask_cols=[]):
  num_black = 0
  for i, row in enumerate(matrix):
    if i in mask_rows:
      continue
    for j, col in enumerate(row):
      if j in mask_cols:
        continue
      if col == "#":
        num_black += 1
  return num_black

def get_patterns(linenum):
  results = []
  patterns = 2**linenum
  for i in range(patterns):
    cmb = []
    if i & 1 == 1:
      cmb.append(0)
    if i & 2 == 2:
      cmb.append(1)
    if i & 4 == 4:
      cmb.append(2)
    if i & 8 == 8:
      cmb.append(3)
    if i & 16 == 16:
      cmb.append(4)
    if i & 32 == 32:
      cmb.append(5)
    results.append(cmb)
  return results

rows, cols, K = [int(x) for x in input().split(" ")]
matrix = []
for row in range(rows):
  matrix.append([x for x in input()])

row_ptrns = get_patterns(rows)
col_ptrns = get_patterns(cols)
result = 0
for row_ptrn in row_ptrns:
  for col_ptrn in col_ptrns:
    if count_black(matrix, row_ptrn, col_ptrn) == K:
      result += 1
print(result)

Measured memory_bytes: 9268
#include<iostream>
#include<string>
using namespace std;
int main(){
  int count;
  cin>>count;
  string s;
  cin>>s;
  int a=0;
  int b=1;
  int c=2;
  int n=0;
  while(c<count){
    if(s[a]=='A'&&s[b]=='B'&&s[c]=='C'){
      n++;
    }
    a++;
    b++;
    c++;
  }
  cout<<n<<endl;
  return 0;
  }

Measured memory_bytes: 256
N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
    unite(N+l, i)
#print(UF)
#for i in range(N+M):
#  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")


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

int main() {
	int N;
  	cin >> N;
  
  	for(int i = 1;; i++) {
    	if(i * i > N) {
        	cout << (i - 1) * (i - 1);
          	break;
        }
    }
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		String  str = sc.nextLine();
		System.out.println(str.toUpperCase());
		
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
}

Measured memory_bytes: 11000
#include<stdio.h>

    int main()

    {
       int i,j,n,a[100000],z;

       scanf("%d",&n);

       if(n>0&&n<=9)
       {
          printf("%d\n",n);
       }

       else if(n>=10&&n<=99)
       {
          printf("9\n");
       }

       else if(n>=100&&n<=9999)
       {
          if(n<=999)
          {
             z = (n-100)+10;

             printf("%d\n",z);
          }

          else if(n>999)
          {
             printf("909\n");
          }
       }

       else if(n>=10000&&n<=100000)
       {
          if(n<=99999)
          {
             z = 910 + (n-10000);

             printf("%d\n",z);
          }

          else if(n==100000)
          {
             printf("90909\n");
          }
       }
    }


Measured memory_bytes: 3188
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,j,N,K;
  cin>>N>>K;
  vec v(K+1,0),a(N);
  rep(i,N)cin>>a[i];
  vsort(a);
  rep1(j,K+1){
    rep(i,N){
      if(j<a[i])break;
      if(!v[j-a[i]]){v[j]=1;break;}
    }
  }
  if(v[K])print("First");
  else print("Second");
  return 0;
}

Measured memory_bytes: 1024
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    need = 0
    stock = 0
    for a, b in zip(A, B):
        if a > b: need += (a-b)
        if b > a: stock += (b-a)//2

    if stock >= need:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 10484
import sys
readline = sys.stdin.readline
write = sys.stdout.write

from heapq import heappush, heappop
class MinCostFlow:
    INF = 10**18

    def __init__(self, N):
        self.N = N
        self.G = [[] for i in range(N)]

    def add_edge(self, fr, to, cap, cost):
        G = self.G
        G[fr].append([to, cap, cost, len(G[to])])
        G[to].append([fr, 0, -cost, len(G[fr])-1])

    def flow(self, s, t, f):
        N = self.N; G = self.G
        INF = MinCostFlow.INF

        res = 0
        H = [0]*N
        prv_v = [0]*N
        prv_e = [0]*N

        while f:
            dist = [INF]*N
            dist[s] = 0
            que = [(0, s)]

            while que:
                c, v = heappop(que)
                if dist[v] < c:
                    continue
                for i, (w, cap, cost, _) in enumerate(G[v]):
                    if cap > 0 and dist[w] > dist[v] + cost + H[v] - H[w]:
                        dist[w] = r = dist[v] + cost + H[v] - H[w]
                        prv_v[w] = v; prv_e[w] = i
                        heappush(que, (r, w))
            if dist[t] == INF:
                return -1

            for i in range(N):
                H[i] += dist[i]

            d = f; v = t
            while v != s:
                d = min(d, G[prv_v[v]][prv_e[v]][1])
                v = prv_v[v]
            f -= d
            res += d * H[t]
            v = t
            while v != s:
                e = G[prv_v[v]][prv_e[v]]
                e[1] -= d
                G[v][e[3]][1] += d
                v = prv_v[v]
        return res

def solve():
    N = int(readline())
    if N == 0:
        return False
    P = []
    for i in range(N):
        *p, = map(int, readline().split())
        p.sort()
        P.append(p)
    mcf = MinCostFlow(2*N+2)
    P.sort()
    su = 0
    for i in range(N):
        xi, yi, zi = P[i]
        for j in range(i):
            xj, yj, zj = P[j]
            if xi > xj and yi > yj and zi > zj:
                mcf.add_edge(2*j+1, 2*i, 1, -xj*yj*zj)
        su += xi*yi*zi
        mcf.add_edge(2*i, 2*i+1, 1, 0)
        mcf.add_edge(2*N, 2*i, 1, 0)
        mcf.add_edge(2*i+1, 2*N+1, 1, 0)
    ans = su
    for i in range(N):
        f = mcf.flow(2*N, 2*N+1, 1)
        su += f
        ans = min(ans, su)
    write("%d\n" % ans)
    return True
while solve():
    ...


Measured memory_bytes: 6484
#include<cstdio>
#include<algorithm>
using namespace std;
int cnt,line[66][3],n,k;
void add(int l,int r,int len)
{
	cnt++;
	line[cnt][0]=l;
	line[cnt][1]=r;
	line[cnt][2]=len;
}
int DFS(int k)
{
	if(k==0) return 1;
	int nex=DFS((k-1)/2);
	int now=nex+1;
	if(k%2==0)
	{
		add(nex,now,0);
		add(nex,now,k/2);
		add(1,now,k);
	}
	else
	{
		add(nex,now,0);
		add(nex,now,k/2+1);
	}
	return now;
}
int main()
{
	scanf("%d",&k);
	k--;
	n=DFS(k);
	printf("%d %d",n,cnt);
	for(int i=1;i<=cnt;i++)
		printf("\n%d %d %d",line[i][0],line[i][1],line[i][2]);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

typedef long long ll;

const int MOD = (int)1e9 + 7;

int res[1005];

void get(int n) {
	for(int i = 2; i * i <= n; ++i) {
		if(n % i == 0) {
			while(n % i == 0) {
				++res[i];
				n /= i;
			}
		}
	}
	if(n > 1) ++res[n];
}

int main() {
	int n;
	scanf("%d", &n);
	for(int i = 2; i <= n; ++i) {
		get(i);
	}
	ll ans = 1;
	for(int i = 2; i <= n; ++i) {
		if(res[i]) {
			ans *= res[i] + 1;
			ans %= MOD;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 128
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 65184
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()

int main() {
  int x;
  cin >> x;
  int ans = 0;
  int gohyaku = int(x / 500);
  ans += gohyaku * 1000;
  x -= gohyaku * 500;
  ans += int(x / 5) * 5;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define INF (1LL << 32)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, X[1000], P;
vector<ll> E[1000];
ll dp[1001][5001];

ll dfs(ll v) {
  vector<ll> val(1000);
  REP(i, 0, E[v].size()) val[i] = dfs(E[v][i]);

  REP(i, 0, E[v].size() + 1) REP(j, 0, 5001) dp[i][j] = INF;
  dp[0][0] = 0;

  REP(i, 0, E[v].size()) {
    ll u = E[v][i], x = X[u], y = val[i];
    for(ll j = X[v]; j >= 0; j--) {
      if(j + x <= X[v]) dp[i + 1][j + x] = min(dp[i + 1][j + x], dp[i][j] + y);
      if(j + y <= X[v]) dp[i + 1][j + y] = min(dp[i + 1][j + y], dp[i][j] + x);
    }
  }

  ll ret = INF;
  REP(i, 0, X[v] + 1) ret = min(ret, dp[E[v].size()][i]);

  return ret;
}

int main(void) {
  cin >> N;
  REP(i, 1, N) {
    cin >> P;
    E[P - 1].push_back(i);
  }
  REP(i, 0, N) cin >> X[i];

  cout << (dfs(0) < INF ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 39424
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

const int N = 500001, M = 300000;
int nc = 0;
int rep[N], sz[N];
pair<int, pair<int, int> > p[M];
int sum;

int findu(int u){
    return rep[u] = (rep[u] == u ? u : findu(rep[u]));
}

void join(int a, int b){
    a = findu(a);
    b = findu(b);
    if (a == b)
        return;
    if (sz[a] < sz[b])
        swap(a, b);
    rep[b] = a;
    sz[a] += sz[b];
    nc--;
}
void mst(){
    sort(p, p + M);
    for (int i = 0; i < M; i++){
       int a = p[i].second.first;
       int b = p[i].second.second;
       if (rep[a] != rep[b])
            join(a, b);
       else
        sum += p[i].first;
    }
}

int main() {
	IO
	int n, x, y;
	cin >> n;
	vector<pair<pair<int, int>, int > >vx, vy;
	map<int, vector<pair<int, int> > > mp;
	iota(rep, rep + N, 0);
	fill(sz, sz + N, 1);
	nc = n;
	for (int i = 0; i < n; i++){
        cin >> x >> y;
        vx.push_back({{x, y}, i});
        vy.push_back({{y, x}, i});

	}
	sort(vx.begin(), vx.end());
	sort(vy.begin(), vy.end());
	for (int i = 1; i < n; i++){
        int diff = abs(vx[i].first.first - vx[i - 1].first.first);
        mp[diff].push_back({vx[i].second, vx[i - 1].second});

	}
	for (int i = 1; i < n; i++){
        int diff = abs(vy[i].first.first - vy[i - 1].first.first);
        mp[diff].push_back({vy[i].second, vy[i - 1].second});
	}
	ll ans = 0;
	for (auto i : mp){
        for (auto j : i.second){
            int id1 = j.first, id2 = j.second;
            if (findu(id1) != findu(id2))
                join(id1, id2), ans += i.first;

        }
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 13484
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x,sum=0; 
  cin>>a>>b>>c>>x;
    x/=50;
  for(int i=0;i<a+1;i++){
    for(int j=0;j<b+1;j++){
      for(int k=0;k<c+1;k++){
        if(i*10+j*2+k==x)sum++;
      }
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>


int main(void) {
    int N, A, B;
    scanf("%d %d %d", &N, &A, &B);
    if (B > N * A) {
        printf("%d\n", N * A);
    } else {
        printf("%d\n", B);
    }
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
    int x[100], n, min;
    int count = 0;

    // ????´???°??¨??°????????\???
    scanf("%d", &n);
    for(int i=0 ; i<n ; i++){
        scanf("%d", &x[i]);
    }

    // ???????????????
    for(int i=0 ; i<n-1 ; i++){
        min = i;
        for(int j=i+1 ; j<n ; j++){
            if(x[j] < x[min]) min = j;
        }
        // ???????????????????°??????§????????°???????????????
        if(min != i){
            swap(x[i], x[min]);
            count++;
        }
    }

    for(int i=0 ; i<n-1 ; i++){
        printf("%d ", x[i]);
    }
    printf("%d\n", x[n-1]);
    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 2712
pattern = raw_input()

first = pattern[0]
search = 'W' if first == 'B' else 'B'

moves = 0
spot = pattern.find(search)
while spot != -1:
    search = 'W' if search == 'B' else 'B'
    moves += 1
    pattern = pattern[spot:]
    spot = pattern.find(search)

print moves


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

const int MAX_SIZE = 1000000;
const int INF = INT_MAX;

int tree[MAX_SIZE * 3];
int size;
int L;
void Initialize();
void update(int x, int y);
int find(int index, int x, int y, int l, int r);

int main() {

	int n;
	cin >> size >> L;

	n = size;
	Initialize();

	for (int i = 0; i < n; ++i) {
		int value;
		cin >> value;
		update(i, value);
	}

	for (int i = 0; i < n - L + 1; ++i) {
		if (i != 0)
			cout << " ";
		cout << find(0, i, i + L, 0, size);
	}

	cout << endl;

	return 0;
}

void Initialize() {

	int n = size;
	size = 1;
	while (size < n)
		size *= 2;
	for (int i = 0; i < 2 * size - 1; ++i)
		tree[i] = INF;

}

void update(int x, int y) {

	int i = x + size - 1;
	tree[i] = y;

	while (i > 0) {
		i = (i - 1) / 2;
		tree[i] = min(tree[i * 2 + 1], tree[i * 2 + 2]);
	}

}

int find(int index, int x, int y, int l, int r) {

	if (r <= x || y <= l) {
		return INF;
	}
	else if (x <= l && r <= y) {
		return tree[index];
	}
	else {
		int leftValue = find(index * 2 + 1, x, y, l, (r + l) / 2);
		int rightValue = find(index * 2 + 2, x, y, (r + l) / 2, r);
		return min(leftValue, rightValue);
	}

}


Measured memory_bytes: 11300
n=int(input())
c=0
count=0
for i in range(n):
    a,b=map(int,input().split())

    if a==b:
        count+=1
    else:
        count=0
    if count==3:
        c=1
if c==1:
    print("Yes")
else:
    print("No")


    

Measured memory_bytes: 9104
// 2011/01/17 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		int cnt = 0;

		while(n!=1){
			if(n%2==0)
				n /= 2;
			else
				n = 3*n+1;
			cnt++;
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
 
int gcd(int x,int y){
  if(y==0){
    return x;
  }
 
  return gcd(y,x%y);
}
 
int main(){
  int x,y;
  cin >> x >> y;
 
  int ans=x+y+1-gcd(x,y);
  cout << ans << endl;
}


Measured memory_bytes: 3100
#include<iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	for(int i=1;i<=9;i++)
		for(int j=i;j<=9;j++){
			if(i*j==a){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
program main
  implicit none
  integer::H,W
  integer::AZ(26)=0
  character(100)::a
  integer::t(3)
  integer::i,j
  read*,H,W
  do i=1,H
    read*,A
    do j=1,W
      AZ(ichar(A(j:j))-ichar("a")+1)=AZ(ichar(A(j:j))-ichar("a")+1)+1
    end do
  end do
  t(1)=merge(1,0,mod(H,2)*mod(W,2)==1)
  t(2)=mod(H,2)*(W/2)+mod(W,2)*(H/2)
  t(3)=(W/2)*(H/2)
  do i=1,t(3)
    do j=1,26
      if(AZ(j)>=4)then
        AZ(j)=AZ(j)-4
        exit
      endif
    end do
  end do
  do i=1,t(2)
    do j=1,26
      if(AZ(j)>=2)then
        AZ(j)=AZ(j)-2
        exit
      endif
    end do
  end do
  do i=1,t(1)
    do j=1,26
      if(AZ(j)>=1)then
        AZ(j)=AZ(j)-1
        exit
      endif
    end do
  end do
  print"(A)",trim(merge("Yes","No ",maxval(AZ)==0))
end program main

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int a, b, c, d;
int x[3];

int ans(int* x)
{
    int s = a+b+c+d;
    if(x[0] == 1)
    {
        s = s - 2*b;
    }
    if(x[1] == 1)
    {
        s = s - 2*c;
    }
    if(x[2] == 1)
    {
        s = s - 2*d;
    }
    return s;
}

int main()
{
    cin >> n;
    a = n/1000;
    b = n/100 - 10*a;
    c = n/10 - 100*a - 10*b;
    d = n % 10;
    
    for(int i = 1; i < 9; i++)
    {
        x[2] = i % 2;
        x[1] = ((i - x[2])/2) % 2;
        x[0] = ((i-x[2]-2*x[1])/4) % 2;
        if(ans(x) == 7)
        {
            cout << a;
            if(x[0] == 0)
            {
                cout << "+";
            }
            else
            {
                cout << "-";
            }
            cout << b;
            if(x[1] == 0)
            {
                cout << "+";
            }
            else
            {
                cout << "-";
            }
            cout << c;
            if(x[2] == 0)
            {
                cout << "+";
            }
            else
            {
                cout << "-";
            }
            cout << d << "=7" << endl;
            return 0;
            
        }
    }
    

}

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

int main(){
  int x, a, b;
  cin >> x >> a >> b;
  
  if((x-a)*(x-a) < (x-b)*(x-b)){
    cout << "A" << endl;
  }
  else{
    cout << "B" << endl;
  }
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int a[] = new int[n + 1];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
            }

            int ans = 1;

            for (int i = 0; i < n; i++) {
                if (a[i] == ans) ++ans;
            }

            if (ans == 1) out.println(-1);
            else out.println(n - ans + 1);

        }

    }
}



Measured memory_bytes: 51096
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
#define oset tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define ff first
#define ss second


int main()
{
    lli n;
    cin >> n;
    map<lli, lli> mp;
    for(lli i=2; i*i<=n; i++){
        while(n%i == 0){
            mp[i]++;
            n/=i;
        }
    }
    if(n != 1) mp[n]++;
    lli ans = 0;
    for(auto el: mp){
        lli x = 1;
        while(el.ss >= x){
            ans++;
            el.ss-=x;
            x++;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int,Int> pii;
typedef pair<Int,double> pid;
typedef pair<double,double> pdd;
typedef pair<Int,pii> pip;
typedef pair<double,Int> pdp;
typedef vector<Int> veci;
typedef vector<double> vecd;
typedef vector<int> veci;
typedef vector<double> vecd;
typedef vector<veci> mati;
typedef vector<vecd> matd;
#define A first
#define B second
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define REP(i,a,b) for(int i = (a);i <= (b);i++)
#define FORO(i,n) REP(i,0,(int)n-1)
#define FORI(i,n) REP(i,1,(int)n)
#define FORIT(i,t) for(auto i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a,_b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
template<typename T>void getMin(T &a,T b) { if(a > b) a = b; }
template<typename T>void getMax(T &a,T b) { if(a < b) a = b; }
template<typename T> vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T> vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T> vector<T> getEmptyVector() { return vector<T>(); }
template<typename T> void appendAll(vector<T> &a, vector<T> b) { a.insert(a.end(), b.begin(), b.end()); }
// #define X first
// #define Y second
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const ll MOD = 1000000007;
const int MAXN = 1<<17;
const int inf = 1<<28;
const int NIL = -inf;
int popcount(int x)  { return __builtin_popcount(x); }
#define DUMP(a) \
    do { std::cout << #a " = " << (a) << ", "; } while(false)
#define DUMPLN(a) \
    do { std::cout << #a " = " << (a) << std::endl; } while(false)

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

    int N, M;
    cin >> N >> M;
    veci S(N + 1), T(M + 1);
    FORI(i, N) cin >> S[i];
    FORI(i, M) cin >> T[i];
    mati dp(N + 1, veci(M + 1));
    dp[0][0] = 1;
    FORI(i, N) dp[i][0] = 1;
    FORI(j, M) dp[0][j] = 1;
    FORI(i, N) {
        FORI(j, M) {
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
            if(dp[i][j] < 0) dp[i][j] += MOD;
            if(S[i] == T[j]) {
                dp[i][j] += dp[i - 1][j - 1];
            }
            dp[i][j] %= MOD;
        }
    }
    cout << dp[N][M] << endl;
    return 0;
}


Measured memory_bytes: 18936
package main
import (
  "fmt"
  "os"
)
func main() {
  var n,k int
  var m int64
  fmt.Scan(&n,&k)
  if k == 1 {
    fmt.Println(int64(n)*int64(n)*int64(n))
    os.Exit(0)
  } else if k == 2 {
    o := (n+1)/2
    e := n-o
    m = int64(o)*int64(o)*int64(o)
    m += int64(e)*int64(e)*int64(e)
    fmt.Println(m)
    os.Exit(0)
  }
  m = 0
  var zmax int = (2*n)/k
  for z:=1;z<=zmax;z++ {
    if (z*k)%2 != 0 { continue }
    b := (z*k)/2
    var xmin int = ceil(b+1,k)
    var xmax int = (2*b)/k
    var ymin int = ceil(2*b,k)
    var ymax int = (b+n)/k
    a := k*xmax-b
    c := k*ymin-b
    if a != b && b != c && c != a {
      m += 6*int64(xmax-xmin+1)*int64(ymax-ymin+1)
    } else if a == c {
      m += 6*int64(xmax-xmin)*int64(ymax-ymin)
      m += 3*int64(ymax-ymin)
      m += 3*int64(xmax-xmin)
      m++
    } else if a == b && b != c {
      m += 6*int64(xmax-xmin)*int64(ymax-ymin+1)
      m += 3*int64(ymax-ymin+1)
    } else if a != b && b == c {
      m += 6*int64(xmax-xmin+1)*int64(ymax-ymin)
      m += 3*int64(xmax-xmin+1)
    }
  }
  fmt.Println(m)
}
func ceil(n int,m int) int {
  return (n+m-1)/m
}

Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int N = in.nextInt();
        	int i = in.nextInt();
        	int ans = N + 1 - i;
        	out.println(ans);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 22996
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' '); 
            if(input[0] == input[1] && input[0] == input[2])
            {
                Console.WriteLine("Yes");
                return;
            }

            Console.WriteLine("No");
        }      
    }
}


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

using ll = long long int;
using P = std::pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rag(con) std::begin(con), std::end(con)

int main()
{
    int n;

    std::cin >> n;

    std::vector<int> d(n), e(n);

    rep(i, n)
            std::cin >>
        d[i] >> e[i];

    rep(i, n - 2)
    {
        if (d[i] == e[i] && d[i + 1] == e[i + 1] && d[i + 2] == e[i + 2])
        {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;

    return 0;
}

Measured memory_bytes: 3600
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

void outPut_YN(bool isYes) {
	if(isYes)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

const long long MOD = 1000000007;

long long fact(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

long long fact_mod(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum = (sum * i) % MOD;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long pow_mod(int a, int b) {
	long long ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}

long long powll(long long a, long long  b) {
	long long ans = 1;
	for (long long i = 0; i < b; i++)
		ans = ans * a;

	return ans;
}

long long modinv(long long a) {
	long long b = MOD, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= MOD;
	if (u < 0) u += MOD;
	return u;
}

vector<vector<int>> checkTree;
vector<int> turnTree;
vector<bool> isPassed;
int maxTurn;

int func(int pos, int turn) {
	cout << pos << endl;
	if (turn > maxTurn)
		return 0;

	if (checkTree[pos].size() > 0) {
		int max = 0;
		for (int i = 0; i < checkTree[pos].size(); i++) {
			if (!isPassed[checkTree[pos][i]]) {
				int t;
				if((t = func(checkTree[pos][i], turn + 1)) > max)
					max = t;
			}
		}
		isPassed[pos] = true;
		return max;
	}
	else {
		return turn;
	}
		
}


int main()
{
	long long n, m;

	cin >> n >> m;

	outPut_YN(n == m);

	return 0;
}

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

const int maxn = 1e5 + 5;

int A, B, M, a[maxn], b[maxn], x[maxn], y[maxn], c[maxn];

int main() {
    cin >> A >> B >> M;
    for (int i=0; i<A; i++) {
        cin >> a[i];
    }
    for (int i=0; i<B; i++) {
        cin >> b[i];
    }
    for (int i=0; i<M; i++) {
        cin >> x[i] >> y[i] >> c[i];
    }
    int ans = 0, besta = a[0], bestb = b[0];
    for (int i=0; i<A; i++) {
        besta = min(besta, a[i]);
    }
    for (int i=0; i<B; i++) {
        bestb = min(bestb, b[i]);
    }
    ans = besta + bestb;
    for (int i=0; i<M; i++) {
        ans = min(ans, a[x[i] - 1] + b[y[i] - 1] - c[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 2176
#include <bits/stdc++.h> 
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  cout<<t<<s<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x[ohara],y[ohara],sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<P,ll> mp;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>x[i]>>y[i];
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            mp[{x[i]-x[j],y[i]-y[j]}]++;
            ans=max(ans,mp[{x[i]-x[j],y[i]-y[j]}]);
        }
    }
    Cout(n-ans);
    return 0;
}


Measured memory_bytes: 2432
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<pair<int, int>> coor(N);
	for (int i = 0; i < N; i++) cin >> coor[i].first >> coor[i].second;

	map<pair<int, int>, int> memo;
	for (const auto &e1 : coor) {
		for (const auto &e2 : coor) {
			memo[{e1.first - e2.first, e1.second - e2.second}]++;
		}
	}

	int ans = 0;
	for (const auto &e : memo) {
		if (e.first.first != 0 || e.first.second != 0) {
			ans = max(ans, e.second);
		}
	}

	ans = N - ans;
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) {
		// practice contest

		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		String[] d = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
		int i;

		for (i = 0; i < d.length; i++) {
			if (s.equals(d[i])) {
				System.out.println(7 - i);
			}
		}
	}
}


Measured memory_bytes: 23636
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n-1; i >= 0; --i)
#define REP(i, s, n) for (int i = s; i< (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
ll inf = ll(1e18);
using ll1d = vector<ll>;
using ll2d = vector<ll1d>;
using ll3d = vector<ll2d>;

template<class Len = int>
class Dijkstra {
 private:
  int n;
  std::vector<std::vector<std::pair<int, Len> > > edges;
 public:
  explicit Dijkstra(int n) : n(n), edges(n) {}

  void add_edge(int from, int to, Len cost) {
    edges[from].push_back(std::pair<int, Len>(to, cost));
  }

  std::vector<Len> solve(int source) {
    const Len inf = 1e16;
    typedef std::pair<Len, int> pi;
    std::vector<Len> d(n, inf);
    std::priority_queue<pi, std::vector<pi>, std::greater<pi> > que;
    que.push(pi(0, source));
    while (!que.empty()) {
      pi p = que.top();
      que.pop();
      int idx = p.second;
      if (d[idx] <= p.first) {
        continue;
      }
      d[idx] = p.first;
      for (int j = 0; j < edges[idx].size(); ++j) {
        que.push(pi(p.first + edges[idx][j].second, edges[idx][j].first));
      }
    }
    return d;
  }
};

void solve(istream &ccin = cin, ostream &ccout = cout) {
  ll n;
  ccin >> n;
  Dijkstra<ll> dij(n);
  rep(i, n - 1) {
    ll a, b;
    ccin >> a >> b;
    --a;
    --b;
    dij.add_edge(a, b, 1);
    dij.add_edge(b, a, 1);
  }
  ll1d fennec = dij.solve(0);
  ll1d sunuk = dij.solve(n - 1);
  ll cntf = 0, cnts = 0;
  rep(i, n) {
    if (fennec[i] <= sunuk[i]) {
      ++cntf;
    } else {
      ++cnts;
    }
  }

  if (cntf > cnts) {
    ccout << "Fennec" << endl;
  } else {
    ccout << "Snuke" << endl;
  }

}

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


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

int main(){
      string s;cin >> s;
      string t;cin >> t;
      int n = s.length();
      int i = 0;
      while(i < n){
            if(s == t)return cout << "Yes", 0;
            char temp = s[n - 1];
            string temp2 = s.substr(0, n - 1);
            s = temp + temp2;
            i++;
      }
      cout << "No";
}

Measured memory_bytes: 256