akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int get_idx(char c){
    string alphabet="abcdefghijklmnopqrstuvwxyz";
    int idx=-1;
    REP(i,0,26){
        if(c==alphabet[i])idx=i;
    }
    return idx;
}

int main(){
    string s,t,s2,alphabet;
    cin >> s >> t;
    s2=s+s;
    vector<vector<int>> table(s2.length(),vector<int>(26,-1));

    alphabet="abcdefghijklmnopqrstuvwxyz";

    char c;
    REP(i,0,26){
        REP(pos,0,s2.length()){
            c=alphabet[i];
            if(s2[pos]==c)table[pos][i]=0;
            //cout << table[pos][i]<< " ";
        }
        //cout << endl;
    }
    //cout << endl;

    REP(i,0,26){
        int count=-1;
        bool flag=false;
        RREP(pos,0,s2.length()){
            if(table[pos][i]==0){
                flag=true;
                count=1;
            }else{
                count++;
            }
            if(flag){
                table[pos][i]=count;
            }else{
                table[pos][i]=-1;
            }
            //cout << table[pos][i] << " ";
        }
        //cout << endl;
    }

    //0だったらだめ、他の数字だったら加算
    ll ans=0,pos=0;
    
    REP(i,0,t.length()){
        c=get_idx(t[i]);
        if(table[pos][c]==-1){
            ans=-1;
            break;    
        }
        ans+=table[pos][c];
        pos=ans%s.length();
    }
    P(ans);

}

Measured memory_bytes: 27264
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



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

  	//数字の文字列をint型に一文字ずつ変換するラムダ式
  	auto strTOint = [&](char c){
  		return c - '0';
  	};
  	vector<int> a(s.size());
  		REP(i,s.size()){
  		a[i] = strTOint(s[i]);
  	}

  //for(auto x: a) cout << x << endl;
  int n = s.size();

  if(n == 1){
    cout << a[0] << endl;
    return 0;
  }



  for(int i = n - 1; i > 0; i--){

    //cout << "i" << i << endl;
    if(a[i] != 9 ){
      a[i] = 9;
      --a[i-1];
    }

  }

  //for(auto x: a) cout << x << endl;

  int sum = 0;
  REP(i,n) sum += a[i];
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
	long n,d,x,y,c=0;
	double s=0;
	scanf("%ld %ld",&n,&d);
	while(n--){
		scanf("%ld %ld",&x,&y);
		if(x>d || -x>d || -y>d ||y>d) continue;
		s=sqrt(x*x+y*y);
		if(s<=d) c++;
	}
	printf("%ld\n",c);
	return 0;
} 

Measured memory_bytes: 3764
#include<bits/stdc++.h>
#define N
#define CM cerr<<(&MOP1-&MOP2)/1024.0/1024.0<<endl
using namespace std;
template <class T> inline T Min(T x, T y){
    return x<y?x:y;
}
template <class T> inline T Max(T x, T y){
    return x>y?x:y;
}
bool MOP1;
int n;
int ans;
bool MOP2;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		if(i<=9)ans++;
		else if(i>=100&&i<=999)ans++;
		else if(i>=10000&&i<=99999)ans++;
	}
	printf("%d",ans);
	return 0;
}






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

int main(void){
    int N;
    cin >> N;
    vector<int> H(N);
    if (N < 1 && N > 20)
        return 0;
    for(int i = 0;i < N;i++){
        cin >> H[i];
        if(H[i] < 1 && H[i] >100)
            return 0;
    }

    int max = 0;
    int count = 1;
    for(int i = 0; i < N; i++){
        if(i != 0){
            count = H[i] - H[i - 1] >= 0 && H[i] >= max ? count + 1 : count;
        }
        max = H[i] > max ?  H[i] : max;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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 main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s;
    string t;
    cin >> s >> t;

    vvi dp(s.size() + 1, vi(t.size() + 1));

    rep(i, s.size())
    {
        rep(j, t.size())
        {
            chmax(dp[i + 1][j + 1], dp[i + 1][j]);
            chmax(dp[i + 1][j + 1], dp[i][j + 1]);

            if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
        }
    }

    string ans = "";
    int length = dp[s.size()][t.size()];
    for (int i = s.size(); i >= 1; i--)
    {
        for (int j = t.size(); j >= 1; j--)
        {
            if (dp[i][j] == length && s[i - 1] == t[j - 1])
            {
                ans += s[i - 1];
                length--;
                break;
            }
        }
    }

    reverse(all(ans));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 38544
#include<stdio.h>

int gcd(int x, int y) {
    if (y == 0)
        return (x);
     else
        return (gcd(y, x % y));
}


int main(void){
    int K,a,b,c;
    unsigned long sum=0;
    scanf("%d",&K);

    for(a=1;a<=K;a++){
        for(b=1;b<=K;b++){
            for(c=1;c<=K;c++){
                sum+=gcd(gcd(a,b),c);
            }
        }
    }

    printf("%lu\n",sum);

    return 0;
}

Measured memory_bytes: 1732
import math
n,h = (map(int,input().split()))
katanas = [[int(el) for el in input().split()] for _ in range(n)]

hit_max = max([el[0] for el in katanas])

katanas.sort(key=lambda x:(x[1],x[0]),reverse=True)

count = 0
for katana in katanas:

    #print(katana[1])

    if h <= 0:
        break
    if katana[1] > hit_max:
        h -= katana[1]
        count += 1
    else:
        break

    
if h <= 0:
    print(count)
else:
    print(count+math.ceil(h/hit_max))


Measured memory_bytes: 28932
from collections import deque

def switch(flag):
    if flag==1:
        return 2
    else:
        return 1

s = list(input())
n = int(input())


s = deque(s)

flag = 0
hanten = 1
counter = 0
for i in range(n):
    # 入力
    tmp = list(input().split())
    t = int(tmp[0])
    if len(tmp) == 3:
        f = int(tmp[1])
        c = tmp[2]
    #######################

    if t == 1:
        hanten = switch(hanten)
        counter += 1
    if t == 2:
        if (f == 1 and hanten == 1) or (f==2 and hanten==2):
            s.appendleft(c)
        if (f == 2 and hanten == 1) or (f==1 and hanten ==2):
            s.append(c)
    
if counter%2 !=0:
    s.reverse()

print("".join(s))

Measured memory_bytes: 76136
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        int a[] = new int [n + 1];



        for (int i = 1 ; i < n + 1 ; i++) {
            int count = 0;
            int b = i;
            while (b < k) {
                count++;
                b *= 2;
            }
            a[i] = count;
        }

        double ans = 0;
        for (int i = 1 ; i < n + 1 ; i++) {

            ans += Math.pow(2, -a[i]);
        }
        System.out.println(ans / n);

    }

}

Measured memory_bytes: 21844
import sys

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

# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

from collections import defaultdict
from collections import deque

def main():
	n,q=map(int,input().split())
	d=defaultdict(list)
	
	for i in range(n-1):
		a,b=map(int,input().split())
		d[a].append(b)
		d[b].append(a)
	
	cnt=[0]*(n+1)
	
	for i in range(q):
		p,x=map(int,input().split())
		cnt[p]+=x
	
	data=[]
	
	
	q=deque([1])
	sumi=set()
	
	while q:
		now=q.popleft()
		sumi.add(now)
		kouho=d[now]
		for i in kouho:
			if i not in sumi:
				q.append(i)
				cnt[i]+=cnt[now]
	
	print(*cnt[1:])
	
	
	
	
	
	
	
	
	
	
	
	
	

if __name__ == "__main__":
	main()


Measured memory_bytes: 77084
X = int(input())

num_list = []
for i in range(1, 33):
    if i ** 2 > X:
        break
    for j in range(2, 11):
        N = i ** j
        if N > X:
            break
        else:
            num_list.append(N)
print(sorted(set(num_list))[-1])


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

int main(){
  string s;
  long long k;
  cin >> s >> k;
  
  char ans = '1';
  int l = s.size();
  for(int i = 0; i < l; i++){
    ans = s.at(i);
    if(ans != '1') break;
    if(i == k-1) break;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int mp[101][101];
int main() {
    int n;
    cin>>n;

    if(n==1){
        int a,b,h;
        cin>>a>>b>>h;
        cout << a << " " << b << " " << h << endl;
        return 0;
    }
    vector<pair<int,int>> p;
    for(int i=0;i<n;++i){
        int a,b,h;
        cin>>a>>b>>h;
        p.push_back({a,b});
        mp[a][b]=h;
    }

    for(int i=0;i<=100;++i){
        for(int j=0;j<=100;++j){
            bool flag=true;
            int hh;
            for(int k=0;k<p.size();++k){
                int x=p[k].first,y=p[k].second;
                if(mp[x][y]!=0){
                   hh=abs(i-x)+abs(j-y)+mp[x][y];
                   break;
                }
            }
            for(int k=0;k<p.size();++k){
                int x=p[k].first,y=p[k].second;
                if(max(hh-abs(i-x)-abs(j-y),0)!=mp[x][y]){
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout << i << " " << j << " " << hh << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>
#include <stdlib.h>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
const int V = 10;
struct edge { int to, cost; };
std::vector<edge>v[100];
typedef std::pair<int, int>p;

int main() {
	long long int n, m, ans = 0;
	lldiv_t d;
	std::cin >> n >> m;
	if (n == m) {
		ans += 2;
		for (int i = n;i > 0;i--) {
			ans *= i;
			if (ans > Z) {
				d = std::lldiv(ans, Z);
				ans = d.rem;
			}
			ans *= m;
			m--;
			if (ans > Z) {
				d = std::lldiv(ans, Z);
				ans = d.rem;
			}
		}
		std::cout << ans << std::endl;
	}
	else if (n==m+1) {
		ans += 1;
		for (int i = n;m > 0;i--) {
			ans *= i;
			if (ans > Z) {
				d = std::lldiv(ans, Z);
				ans = d.rem;
			}
			ans *= m;
			m--;
			if (ans > Z) {
				d = std::lldiv(ans, Z);
				ans = d.rem;
			}
		}
		std::cout << ans << std::endl;
	}
	else if (n+1 == m ) {
		ans += 1;
		for (int i = m;n > 0;i--) {
			ans *= i;
			if (ans > Z) {
				d = std::lldiv(ans, Z);
				ans = d.rem;
			}
			ans *= n;
			n--;
			if (ans > Z) {
				d = std::lldiv(ans, Z);
				ans = d.rem;
			}
		}
		std::cout << ans << std::endl;
	}
	else {
		std::cout << 0 << std::endl;
	}
	return 0;
}

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

namespace BeginnerCont91
{
    class Program
    {
        static void Main(string[] args)
        {
            var inp = Console.ReadLine().Split();
            var a = int.Parse(inp[0]);
            var b = int.Parse(inp[1]);
            var c = int.Parse(inp[2]);
            Console.WriteLine((a+b >= c) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vaibhav ios_base::sync_with_stdio(false);cin.tie(NULL);
 
 
int main()
{
    vaibhav
    string s,t;
    cin>>s>>t;
    int co=0;
    for(int i=0;s[i]!='\0';i++)
      if(s[i]==t[i])
        co++;

      cout<<co;
 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

int main()
{


	ll n, k;
	cin >> n >> k;

	ll dp[k + 1];
	memset(dp, false, sizeof(dp));
	vector<ll>v(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	for (ll i = 0; i <= k; i++)
	{
		for (auto x : v)
		{
			if (x <= i && !dp[i - x])
			{
				dp[i]  = true;
			}
		}
	}
	if (dp[k])
	{
		cout << "First";
	}
	else
	{
		cout << "Second";
	}

}

Measured memory_bytes: 1024
Public Class Program
  Shared Sub Main()
    Dim abc As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim a As Long = abc(0)
    Dim b As Long = abc(1)
    Dim c As Long = abc(2)
    Dim output As Long = c - (a - b)
    If output < 0 Then output = 0
    Console.WriteLine(output.ToString())
  End Sub
End Class

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	int sum=0;
	int x[100];
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>x[i];
		if(k<=x[i]*2){
			sum=sum+(k-x[i])*2;
		}
		else if(k>x[i]*2){
			sum+=x[i]*2;
		}
	}
	cout<<sum<<endl;
}

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

int main() {
	string s;
	cin >> s;
	if (s[0] == s[1] || s[0] == s[2] || s[1] == s[2]){
		cout << "No";
		
	}else{
		cout << "Yes";
	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int p;
  int count=0;
  for(int i=1; i<=N; i++){
    cin >> p;
    if(p!=i){
      count++;
    }
  }
  if(count<=2){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

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

    scanf("%d %d %d", &a, &b, &c);

    int num = 0;

    for(int i=a; i<=b; i++){
        if(c%i==0){
            num = num + 1;
        }
    }

    printf("%d\n", num);
   
    

    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long A[N];
  int cnt = 0;
  bool flag = false;
  long k = INT_MAX;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] < 0) {
      cnt++;
    }
    if(A[i] == 0){
      flag = true;
    }
    sum += abs(A[i]);
    k = min(k, abs(A[i]));
  }
  
  if (flag || cnt % 2 == 0) {
    cout << sum << "\n";
  } else {
    cout << sum - 2 * k << "\n";
  }
  return 0;
}

Measured memory_bytes: 1024
H, W = list(map(int, input().split()))
grid = [list(input()) for _ in range(H)]

D = ((0, 1), (1, 0), (-1, 0), (0, -1))

for y in range(H):
    for x in range(W):
        if grid[y][x] != "#":
            continue
        flg = True
        for d in D:
            x1 = x + d[0]
            y1 = y + d[1]
            if x1 < 0 or W <= x1 or y1 < 0 or H <= y1:
                continue
            if grid[y1][x1] == "#":
                flg = False
                break

        if flg:
            print("No")
            import sys
            sys.exit(0)
print("Yes")


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

long long f(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long g(long long a, long long mod) {
    return f(a, mod-2, mod);
}

int main(void) {
    long long N, x[100005], D[100005], X, a, i;
    long long MOD=1000000007;
    scanf("%lld", &N);
    for (i=1; i<=N; i++) scanf("%lld", &x[i]);
    
    D[1]=1;
    for (i=1; i<=N-1; i++) {
        D[1]*=i;
        if (D[1]>=MOD) D[1]%=MOD;
    }
    for (i=2; i<=N-1; i++) {
        a=g(i, MOD)%MOD;
        D[i]=D[1]*a%MOD;
    }
    D[N]=0;
    for (i=1; i<=N-1; i++) {
        D[N]+=D[i];
        if (D[N]>=MOD) D[N]%=MOD;
    }
    for (i=1; i<=N-1; i++) D[i]*=-1;
    
    X=0;
    if (X>=MOD) X%=MOD;
    for (i=1; i<=N; i++) {
        a=x[i]%MOD;
        X+=D[i]*a;
        if (X<0) X+=(MOD-7)*MOD;
        if (X>=MOD) X%=MOD;
        // printf("%lld %lld\n", i, X);
    }
    if (X<0) X+=(MOD-7)*MOD;
    X%=MOD;
    // for (i=1; i<=N; i++) printf("%lld ", D[i]);
    // printf("\n");
    printf("%lld", X);
}

Measured memory_bytes: 1664
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
from collections import Counter as co
from collections import defaultdict
D,E=co(A),co(B)
for i in D:
  if D[i]+E[i]>N:
    print('No')
    exit()

d=defaultdict(int)
for i,e in enumerate(A):
  d[e]=i
ans=0
for i,e in enumerate(B):
  ans=max(ans,(d[e]-i+1))
s=B[-ans:]+B[:-ans]
print('Yes')
print(*s)

Measured memory_bytes: 72256
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
    int[] a= new int[n+1];
    int[] b= new int[n];
    for(int i=0;i<=n;i++){
      a[i]=sc.nextInt();
    }
    for(int i=0;i<n;i++){
      b[i]=sc.nextInt();
    }
    long df=0;
    for(int i=0;i<n;i++){
      if(a[i]<b[i]){
        b[i]=b[i]-a[i];
        df+=a[i];
        if(a[i+1]<b[i]){
          df+=a[i+1];
          a[i+1]=0;
        }else{
          a[i+1]=a[i+1]-b[i];
          df+=b[i];
        }
      }else{
        df+=b[i];
        b[i]=0;
      }
    }
    System.out.println(df);
  }
}

Measured memory_bytes: 64000
//AnkitCode99 (DP)....
//every ups and downs matter!

#include<bits/stdc++.h>
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr)
typedef long long int ll;

using namespace std;

const ll sz=1e5+5;
ll n;
double prob[3005],cache[3005][3005];
bool vis[3005][3005];

double dp(ll idx,ll no_of_heads)
{
    if(idx==n+1)
        return (no_of_heads*2)>=n;

    double &ans=cache[idx][no_of_heads];
    if(vis[idx][no_of_heads])
        return ans;

    vis[idx][no_of_heads]=1;
    ans=(1-prob[idx])*dp(idx+1,no_of_heads)+ prob[idx]*dp(idx+1,no_of_heads+1);
    return ans;
}

int main()
{
    fast;
    
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>prob[i];
    }

    cout<<fixed<<setprecision(12)<<dp(1,0);

}//Goodbye...

Measured memory_bytes: 79744
#include <stdio.h>
 
int main(void)
{
    int n,b,f,r,v,i,j,k,l;
    int h[4][3][10]={0};
     
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        h[b-1][f-1][r-1]+=v;
    }
     
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",h[i][j][k]);
            }
            printf("\n");
        }
        if(i==3) break;
        for(l=0;l<20;l++){
            printf("#");
        }
        printf("\n");
    }
     
    return 0;
}


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

using namespace std;

int main(void)
{
  int N, M;
  cin >> N >> M;
  vector<bool> red(N + 1, false);
  red[1] = true;
  vector<int> ball(N + 1, 1);
  vector<int> x(M, 0);
  vector<int> y(M, 0);
  for(int i = 0; i < M; i++){
    cin >> x[i] >> y[i];
  }

  for(int i = 0; i < M; i++){
    int xi = x[i];
    int yi = y[i];
    ball[xi]--;
    ball[yi]++;
    if(red[xi]){
      red[yi] = true;
      if(ball[xi] == 0)
        red[xi] = false;
    }
  }
  int res = count(red.begin(), red.end(), true);

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
const int inf = 1e9+10;
const ll INF = 1e16+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    int ans = 0;
    vector<pii> v;
    int i = 0;
    while(i<n){
    	int l = i;
    	int r = i;
    	while(s[i]==s[i+1]){
    		r++;
    		i++;
    	}
    	v.push_back({l,r});
    	i++;
    	ans+=r-l;
    	// cout<<r-l<<endl;
    }
    if(k>=v.size())
    	ans=n-1;
    else{
    	rep(i,k) ans+=2;
    }
    // ans+=tmp;
    cout<<min({ans,n-1})<<endl;
    return 0;

}
    

Measured memory_bytes: 1480
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    string o,e;
    cin >> o >> e;
    string ans = "";
    for (int i=0;i<e.length();i++){
        ans += o[i];
        ans += e[i];
    }
    if (o.length() != e.length()) ans += o[o.length()-1];
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a < b){
            for (int i = 0; i < b; i++) {
                System.out.printf("%d", a);
            }
            return;
        }
        for (int i = 0; i < a; i++) {
            System.out.printf("%d", b);
        }
    }
}


Measured memory_bytes: 21204
list_1 = [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]
k = int(input())
print(list_1[k-1])

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
using namespace std;
#define inf 1000000007
int m,f[1000003],a;
int main()
{
    scanf("%d",&m);f[m]=m;
    f[m-1]=(long long)m*m%inf;
    for(int i=m-2;i>=1;--i)
    {
        a=(a+f[i+3])%inf;f[i]=f[i+1];
        f[i]=(f[i]+(long long)(m-1)*(m-1)%inf)%inf;
        f[i]=(f[i]+a)%inf;f[i]=(f[i]+i+1)%inf;
    }
    printf("%d\n",f[1]);
    return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

double dis(double x1, double y1, double x2, double y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
double x[3], y[3];
signed main() {
	rep(i, 3)cin >> x[i] >> y[i];

	double a = dis(x[0], y[0], x[1], y[1]);
	double b = dis(x[1], y[1], x[2], y[2]);
	double c = dis(x[2], y[2], x[0], y[0]);

	double s = (a + b + c) / 2;
	double S = sqrt(s * (s - a) * (s - b) * (s - c));
	double h = S * 2 / max({ a, b, c });
	double ok = 0, ng = max({ a, b, c }) / 2;
	rep(_, 100) {
		double mid = (ok + ng) / 2.;
		double ans = (a + b + c) * mid / 2 +  mid * h;
		if (ans <= S)ok = mid;
		else ng = mid;
	}
	printf("%.12lf\n", ok);
}

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

int main(){

    while(1){
        int n, m; cin >> n >> m;
        if(!n) break;
        vector<int> max_score(n, 0);
        vector<int> min_score(n, 0);

        for(int i = 0; i < m; i++){
            int s, k; cin >> s >> k;
            vector<int> c(k);
            for(int j = 0; j < k; j++){
                cin >> c[j];
                c[j]--;
                max_score[c[j]] += s;
            }
            
            if(k == 1){
                min_score[c[0]] += s;
            }
        }

        int ans = 0;

        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i == j) continue;

                ans = max(ans, max_score[i] - min_score[j] + 1);
            }
        }
    
    cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

int main(){
	int N,M;
	set<int> S;
	set<int> G;
	vi v;
	cin >> N >> M;
	rep(i,M){
		int a,b;
		cin >> a >> b;
		if(a==1) S.insert(b);
		if(b==1) S.insert(a);
		if(a==N) G.insert(b);
		if(b==N) G.insert(a);
	}
	set_intersection(S.begin(),S.end(),G.begin(),G.end(),back_inserter(v));
	if(v.empty()){
		cout<< "IMPOSSIBLE" << endl;
	}else{
		cout << "POSSIBLE"<<endl;
	}
	return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define double long double
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
#define P pair<int,int>
//printf("%.12Lf\n",);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool integer(double n){
	if(n==long(n))return true;
	else return false;	
}
int pow(int b,int a){	
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}
int sankaku(int a){
	return a*(a+1)/2;
} 
bool search(int x){
	int n;
	int a[n];
	int l=0,r=n;
	while(r-l>=1){
		int i=(l+r)/2;
		if(a[i]==x)return true;
		else if(a[i]<x)l=i+1;
		else r=i;
	}
	return false;
}
signed main(){
	ic(a) ic(b) ic(c)
	cout<<c<<" "<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
/*@author hussein zayed ;
    ___  ___
   |\  \|\  \
   \ \  \_\  \
    \ \   ___ \USSEIN
     \ \  \\ \ \
      \ \__\\ \_\
       \|__| \|__|
****************************************
*/

#include <bits/stdc++.h>
using namespace std;
#define fr for(int i=0;i<n;++i)
#define fr1 for(int i=1;i<=n;++i)
#define cinA for(int i=0;i<n;++i){cin>>arr[i];}
#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}
#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}
#define ll long long
#define lnarray sizeof(arr)/sizeof(*arr)
#define vi vector<int>
#define vs vector<string>
void Fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int RD()
{
    int i ;
    cin>>i;
    return i;
}

inline float RF()
{
    float i ;
    cin>>i;
    return i;
}

inline double RDO()
{
    double i ;
    cin>>i;
    return i;
}

inline string RS()
{
    string i ;
    cin>>i;
    return i;
}

inline ll RLL()
{
    ll i ;
    cin>>i;
    return i;
}

int cm[200000];

ll sumSet(ll n)
{
    return (1ll*n*(n+1))/2;
}
string s;


bool isPrime(int n)
{
    if(n==1)
        return false;
    for(int i=2; i*i<=n; ++i)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int sumDigit(int n){
int sum =0;
  while (n != 0)
    {
        sum+= + n % 10;
        n = n / 10;
    }
    return sum;
}

ll power2(int n){
  ll ans=(1<<n);
  return ans;
}

ll sumpow2(ll n){
 ll sum=(n*(n+1)*(2*n-1))/6;
 return sum;
}
map<int ,int> mp;
vi vr;
int main(){
    Fast();
//freopen("output.txt" , "w" , stdout);
//freopen("wall.in" , "r" , stdin);
ll n=RLL(),h=RLL(),MAX=0;
ll l,r;
	vector<ll> b;

	for(int i=0;i<n;i++){
		cin>>l>>r;
		MAX=max(MAX,l);
		b.push_back(r);
	}
	sort(b.begin(),b.end());
	reverse(b.begin(),b.end());
	ll ans=0,k=0;
	while(h>0){
		h-=b[k];
		ans++;
		k++;
		if(k==n||b[k]<MAX){
			break;
		}
	}
	if(h>0)
	ans+=(h+MAX-1)/MAX;

cout<<ans;
}


Measured memory_bytes: 1400
s = input()

s_num = len(s)
flag = 0 if s_num%2==0 else 1
for i in range(s_num//2):
    if s[2*i:2*i+2] != 'hi':
        flag = 1

ans = 'No' if flag==1 else 'Yes'
print(ans) 


Measured memory_bytes: 2940
#include <stdio.h>

int main(void) {
int x=0,y=0,z=0;
scanf("%d%d%d",&x,&y,&z);  
int tmp = x;
x = y;
y= tmp;

tmp = x;
x = z;
z = tmp;

printf ("%d %d %d\n", x, y, z);
return 0; 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define U(i, a, b) for (int i = (a); i <= (b); ++i)
#define D(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;
int gi() {
  int f = 1, x = 0; char ch = getchar();
  while (ch < '0' || ch > '9') { if (ch == '-') f = -f; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return f * x;
}
typedef long long LL;
typedef pair<int,int> pi;

int main() {
	int n, x;
	cin >> x >> n;
	vector<int> p(n);
	map <int, int> vis;
	for (int i = 0; i < n; ++i) cin >> p[i], vis[p[i]] = 1;
	int now = 0x3f3f3f3f;
	for (int in = -300; in <= 300; ++in)
		if (abs(in - x) < abs(now - x) && !vis[in]) now = in;
	cout << now << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define N 200005

char ch[N];
int p[N];
long long a[30];
int n,len;
long long ans[30][1005];
long long length[N];
long long l,r;

void work(long long x,int flag)
{
	if (x == 0) return ;
	long long tmp = 0;
	if (x <= len)
	{
		for(int i = 1;i <= x;i++)
		{
			a[ch[i] - 'a'] += flag;
		}
		return;
	}
	else
	{
		int t = 1;
		while(length[t + 1] <= x) t++;
		for(int i = 0; i < 26;i++)
		{
			a[i] += ans[i][t] * flag;
		}
		work(x - length[t],flag);
	}
}

int main()
{
	//freopen("test.in","r",stdin);
	int j = 0;
	scanf("%s%lld%lld",ch + 1,&l,&r);
	len = strlen(ch + 1);
	//p[1] = 0;
	for(int i = 2;i <= len; i++)
	{
		while(j > 0 && ch[j + 1] != ch[i]) j = p[j];
		if (ch[j + 1] == ch[i]) j++;
		p[i] = j;
	//	printf("%d ",p[i]);
	}
	//puts("");
	len >>= 1;
	n = len - p[len];
	//printf("%d %d\n",len,n);
	if( len % n == 0)
	{
		for(int i = 1;i <= n;i++) a[ch[i] - 'a'] += (long long)r/n;
		for(int i = 1;i <= r % n; i++) a[ch[i] - 'a']++;
		for(int i = 1;i <= n;i++) a[ch[i] - 'a'] -= (long long)(l - 1)/n;
		for(int i = 1;i <= (l - 1) % n;i++) a[ch[i] - 'a']--;	
	}
	else
	{
		for(int i = 1;i <= n; i++)
		{
			ans[ch[i] - 'a'][0]++;
		}
		for(int i = 1;i <= len; i++)
		{
			ans[ch[i] - 'a'][1]++;
		}
		length[0] = n;
		length[1] = len;
		for(int i = 2;;i++)
		{
			length[i] = length[i - 1] + length[i - 2];
			if(length[i] > r) break;
			for(int j = 0; j < 26; j++)
				ans[j][i] = ans[j][i - 1] + ans[j][i - 2];
		}
		work(r,1);work(l - 1,-1);
	}
	for(int i = 0; i < 26; i++)
	{
		printf("%lld ",a[i]);
	}
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9


int main() {
	int N;
	cin >> N;
	char s[N];
	for (int i = 0; i < N; i++) cin >> s[i];
	int temp = 0;
	for (int i = 1; i < N; i++) {
		if (s[i] == 'E') temp++;
	}
	int ans = temp;

	for (int i = 1; i < N; i++) {
		if (s[i] == 'E') temp--;
		if (s[i - 1] == 'W') temp++;
		ans = min(ans, temp);
	}

	cout << ans << endl;


	return 0;
}

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

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

    int ans=0;
    while (N>0) {
        N=N/K;
        ans++;
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define rrep()
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> v(n),vv(n);
    rep(i,0,n){
        cin>>v[i];
        vv[i]=v[i];
    }
    
    Sort(v);
    int left=v[n/2-1],right=v[n/2],middle=v[n/2];
    
    rep(i,0,n){
        if(vv[i]<middle)cout<<right<<endl;
        else cout<<left<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3712
#include <stdio.h>

int main()
{
    int r, c, rsum = 0, csum = 0, rsumsum = 0;
    int i, j;
    
    scanf("%d %d", &r, &c);
    int hyo[r][c];
    
    for (i = 0; i < r; i++)
    {
        for (j = 0; j < c; j++)
        {
            scanf("%d", &hyo[i][j]);
        }
    }
    
    for (i = 0; i < r; i++)
    {
        for (j = 0; j < c; j++)
        {
            printf("%d ", hyo[i][j]);
            rsum += hyo[i][j];
        }
        printf("%d\n", rsum);
        rsumsum += rsum;
        rsum = 0;
    }
    
    for (j = 0; j < c; j++)
    {
        for (i = 0; i < r; i++)
        {
            csum += hyo[i][j];
        }
        printf("%d ", csum);
        csum = 0;
    }
    printf("%d\n", rsumsum);
    
    return 0;
}

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

int main(void){
    int n;
    string a,b,c;
    cin >> n >> a >> b >> c;
    int res = 0;
    rep(i,n){
        set<char> st = {a[i], b[i], c[i]};
        res += st.size() - 1;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 *   Author: Praveen Ojha
 *   Created: 27 January 2019
 *   Time: 01:18:36
**/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n][3];
    for(int i=0;i<n;i++)
    	cin>>a[i][0]>>a[i][1]>>a[i][2];
    int dp[n][3];
    memset(dp,0,sizeof dp);
    for(int i=0;i<3;i++){
    	dp[0][i]=max(a[0][(i+1)%3],a[0][(i+2)%3]);
    }
    for(int i=1;i<n;i++){
    	for(int j=0;j<3;j++){
    		dp[i][j]=a[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
    	}
    }
    int maxi=-1;
    for(int i=0;i<3;i++){
    	maxi=max(maxi,dp[n-1][i]);
    }
    cout<<maxi<<"\n";
return 0;
}

Measured memory_bytes: 2560
import Data.Functor ((<$>))

main :: IO ()
main = do
  [h, w] <- map (read :: String -> Int) . words <$> getLine
  if h == 0 && w == 0
    then return ()
    else do
      putStrLn . unlines . concat $
        [ [replicate w '#']
        , replicate (h-2) $ "#" ++ replicate (w-2) '.' ++ "#"
        , [replicate w '#']
        ]
      main




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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a == b and a != c) or (a == c and a != b) or (c == b and a != c))cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N,H,D;

ll fac[1000010];
ll dp[1000010];

int main(){
  cin>>N>>H>>D;

  fac[0]=1;
  for(int i=1;i<=N;i++) fac[i]=fac[i-1]*i%MOD;

  ll constant=0;
  for(int i=1;i<=N;i++) constant=(constant+fac[i])%MOD;

  dp[0]=1;
  dp[1]=fac[N];
  ll sum=dp[1];

  for(int i=2;i<=H;i++){
    dp[i]=sum*constant%MOD;
    if(i<=D) dp[i]=(dp[i]+dp[0]*fac[N]%MOD)%MOD;

    if(i-D>=1) sum=(sum-dp[i-D]+MOD)%MOD;
    sum=(sum+dp[i])%MOD;
  }

  cout<<dp[H]<<endl;

  return 0;
}


Measured memory_bytes: 15872
#include <cstdio>
#include <cstdlib>

int N,M;
int Xs[100008];
int cmp(const void *ka,const void *kb) {
	int a=*(int *)ka;
	int b=*(int *)kb;
	return a-b;
}
int modM_solo[100008];
int modM_pair[100008];
int getmin(int a,int b) {
	if(a>b) return b;
	return a;
}
int add(int a,int b,int c,int d) {
	int ret=getmin(b,d);
	b-=ret;
	d-=ret;
	if(b>0) {
		int temp=getmin(b,c*2);
		ret+=temp+a+(c*2-temp)/2;
	} else {
		int temp=getmin(d,a*2);
		ret+=temp+c+(a*2-temp)/2;
	}
	return ret;
}
int main() {
	scanf("%d%d",&N,&M);
	for(int i=0;i<N;i++) scanf("%d",&Xs[i]);
	qsort(Xs,N,sizeof(int),cmp);
	for(int i=0;i<N;i++) {
		if(Xs[i]==Xs[i+1]) {
			modM_pair[Xs[i]%M]++;
			i++;
		} else {
			modM_solo[Xs[i]%M]++;
		}
	}
	int sol=0;
	//case 0
	sol+=modM_pair[0]+modM_solo[0]/2;
	//case M/2
	if(M%2==0) sol+=modM_pair[M/2]+modM_solo[M/2]/2;
	for(int i=1;i<(M+1)/2;i++) sol+=add(modM_pair[i],modM_solo[i],modM_pair[M-i],modM_solo[M-i]);
	printf("%d\n",sol);
	return 0;
}


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

#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define eb emplace_back 
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pip;
typedef vector<int> vi;
const int INF = 1000000000;

typedef complex<double> pt;
typedef vector<pt> pol;
const double eps = 1e-8;
struct line : pol{
  line(){}
  line(pt a, pt b){ pb(a); pb(b);}
};

double dot(const pt a, const pt b){
	return real(conj(a) * b);
}
double crs(const pt a, const pt b){
  return imag(conj(a) * b);
}
int ccw(pt a, pt b, pt c){
  b-=a; c-=a;
  if(crs(b,c) > 0) return 1;
  if(crs(b,c) < 0) return -1;
  if(dot(b,c) < 0) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
bool intsp(line s, pt p){
  return abs(s[0] - p) + abs(s[1] - p) - abs(s[1] - s[0]) < eps;
}
bool intss(line s, line 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;
}
pt proj(line l, pt p){
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0] - l[1]);
  return l[0] + t * (l[0] - l[1]);
}
double distsp(line s, pt p){
  pt r = proj(s,p);
  if(intsp(s, r)) return abs(r-p);
  return min(abs(s[0]-p),abs(s[1]-p));
}
double distss(line s, line t){
  if(intss(s,t)) return 0;
  return min( min(distsp(s,t[0]), distsp(s,t[1])), min(distsp(t,s[0]), distsp(t,s[1])));
}

template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
  out << "{";
  rep(i,v.size()) out << v[i] << ", ";
  return out << "}" << endl;
}
int main(){
  int n;
  while(cin >> n, n){
	pt s,t;
	vi h(n);
	vector<double> d(n);
	int x, y;
	cin >> x >> y;
	s = pt(x,y);
	cin >> x >> y;
	t = pt(x,y);
	line seg(s,t);
	rep(i,n){
	  int w,z;
	  cin >> x >> y >> w >> z >> h[i];
	  pt a[4] = {pt(x,y), pt(w,y), pt(w,z),pt(x,z)};
	  d[i] = INF;
	  rep(j,4) d[i] = min(d[i], distss(seg, line(a[j], a[(j+1)%4])));
	  if(x <= real(s) && y <= imag(s) && real(s) <= w && imag(s) <= z) d[i] = 0;
	}

	double lb = 0, ub = INF;
	while(ub - lb > eps){
	  double mid = (lb + ub) / 2;
	  bool f = true;
	  rep(i,n){
		double m = mid - min((double)h[i],mid);
		if(mid * mid > d[i] * d[i] + m * m){
		  f = false;
		  break;
		}
	  }
	  if(f) {
		lb = mid;
	  }else{
		ub = mid;
	  }
	}

	cout << fixed << setprecision(10);
	cout << lb << endl;
  }
}

Measured memory_bytes: 3264
#include<iostream>
using namespace std;
int main() {
	int a,b;
	cin >> a>> b;
	if (a<b) {
		cout << "a < b" << endl;
	}
	else if (a > b) {
		cout << "a > b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include<cstdio>

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

using namespace std;

int main(){
	for(int n,k;scanf("%d%d",&n,&k),n||k;){
		int blood[100];
		rep(i,k)	scanf("%d",blood+i);
		rep(i,n)rep(j,k){
			int b;	scanf("%d",&b);
			blood[j]-=b;
		}
		bool ok=true;
		rep(i,k)if(blood[i]<0){ ok=false; break; }
		puts(ok?"Yes":"No");
	}

	return 0;
}

Measured memory_bytes: 0
/** Al-Amin Mahfuzur Rahman **/
             /** Email :- 7mahfuzur.rahman@gmail.com **/
              /**  FB :- tinyurl.com/7mahfuz   **/
      /** Institute :- Institute of science,trade and technology **/

#include <bits/stdc++.h>
#define rt return
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%I64d",&x)
#define scf(x) scanf("%f",&x)
#define LL long long
#define sc scanf
#define pf printf
#define pfi(x) printf("%d",x)
#define pfl(x) printf("%I64d",x)
#define NL printf("\n")
#define gap printf(" ")
#define YES printf("YES\n")
#define NO printf("NO\n")
#define Yes printf("Yes\n")
#define No printf("No\n")

#define MOD 1000000007
#define PI acos(-1.0)
#define sz(x) x.size()
#define sqr(x) ((x)*(x))
#define ek first
#define dui second
#define dist(x1,x2,y1,y2) sqrt(sqr(x1-x2)+sqr(y1-y2))

/** Vector **/
#define pb(x) push_back(x)
#define Maxvec(vector) *max_element(vector.begin(),vector.end())
#define Minvec(vector) *min_element(vector.begin(),vector.end())
#define Cntvec(vector,key) count(vector.begin(),vector.end(),key)
#define Revvec(vector) reverse(vector.begin(),vector.end())
#define cv(vector) vector.clear()
#define EraseV(vector,n) vector.erase(vector.begin(),vector.begin()+n)
#define eraseV(vector,n) vector.erase (vector.begin()+n)
#define Vswap(v1,v2) v1.swap(v2)
/** SET **/
#define setLB(set,n) set.lower_bound(n)
#define setUP(set,n) set.upper_bound(n)
#define setfind(set,n) set.find(n)
#define ins(n) insert(n)
/**String **/
#define Revstr(st) reverse(st.begin(),st.end())
#define line(st) getline(cin,st)
#define Sswap(st1,st2) st1.swap(st2)
#define portxy(st,x,y) st.substr(x,y)/**Portion from a string x to y taa**/
#define portz(st,z) st.substr(z) /**Portion of str from z to last **/
#define sfind(st,key) st.find(key)/** find the pos **/
#define stdlt(st,x,y) st.erase(x,y)/** erase(beg+x)/erase(beg+x,end-y) **/
#define kill(st) st.clear()
/** Array **/
#define Cntkey(arr,n,key) count(arr,arr+n,key)/** arr te kotobar key asee ta chking **/
#define Revarr(arr,n) reverse(arr,arr+n)
#define Maxarr(arr,n) *max_element(arr,arr+n)
#define Minarr(arr,n) *min_element(arr,arr+n);
/** Array must be sorted before use lower and upper bound  **/
#define LB(arr,n,key) *lower_bound(arr,arr+n,key)-1
#define UB(arr,n,key) *upper_bound(arr,arr+n,cnt)-1
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define CLR(a) memset(a,0,sizeof(a))
#define Aswap(a1,a2) a1.swap(a2)/** must a1==a2 **/
/**accumulate(a+1,a+n,a[0],myfunc)or accumulate(a,a+n,1/0,mufunc)or accumulate(a,a+n,variable)**/

#define lp0(i,n) for(i=0;i<n;i++)
#define lp00(i,n) for(i=0;i<=n;i++)
#define lp1(i,n) for(i=1;i<n;i++)
#define lp11(i,n) for(i=1;i<=n;i++)
#define lpab(i,a,b) for(i=a;i<b;i++)
#define lpAB(i,A,B) for(i=A;i<=B;i++)

#define MAX 100000
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
/**to chk 2 arr equal or not = if(equal(arr1,arr2,arr2+n)) its a bool**/
using namespace std;

int main()
{
  int n,m;cin>>n>>m;
  vector<int>vv[n+1];
  int x,y,i,j;

  lp0(i,m)
  {
     cin>>x>>y;
     vv[x].pb(y);vv[y].pb(x);
  }
   for(i=1;i<=n;i++)
   {
       cout<<sz(vv[i])<<endl;
   }

    rt 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));

int selectionSort(vector<int> &A, int N){
    int count = 0;
    for(int i = 0; i < N; i++){
        int min_j = i;
        for(int j = i; j < N; j++){
            if(A[j] < A[min_j]) {
                min_j = j;
            }
        }
        swap(A[i], A[min_j]);
        if(min_j != i) count++;
    }
    return count;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    int n = selectionSort(A, N);
    for(int i = 0; i < N; i++){
        cout << A[i];
        if(i != N - 1) cout << ' ';
    }
    cout << endl;
    cout << n << endl;
}



Measured memory_bytes: 3176