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

struct num {
	long long a, b;
};


int main() {
	long long n, m;
	long long ans = 0;
	long long x=0;
	pair<long long ,long long> number[100000];
	cin >> n >> m;
	for (int i = 0;i < n;++i)cin >> number[i].first >> number[i].second;
	sort(number, number + n);
	while (1) {
		m -= number[x].second;
		if (m <= 0)break;
		x++;
	}for (int j = 0;j <= x;++j)ans += number[j].first*number[j].second;
	ans += number[x].first * m;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
S_d,T = list(input()),list(input())

if len(S_d) < len(T):
  print("UNRESTORABLE");exit()

flag = 1
for i in range(-len(T),-len(S_d)-1,-1):
  key = 0
  for j in range(len(T)):
    if S_d[i+j]=="?" or S_d[i+j]==T[j]:
      key+=1
    else:
      break
  if key == len(T):
    st=len(S_d)+i
    break
  else:
    st=-1

if st==-1:
  print("UNRESTORABLE")
else:
  for i in range(len(S_d)):
    if st <= i and i < st+len(T):
      print(T[i-st],end="")
    elif S_d[i]=="?":
      print("a",end="")
    else:
      print(S_d[i],end="")
      

Measured memory_bytes: 38512
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;


void main(){
    long n, k;
    readlnTo(n, k);
    long[] a;
    foreach(i; iota(n)) {
        a ~= readLong();
    }
    long[] s;
    s ~= 0;
    foreach(i; iota(n)) {
        s ~= s.back + a[i] - k;
    }
    auto t = s.dup();
    t.sort();
    long[long] h;
    foreach(ti; t.uniq()) {
        h[ti] = h.length + 1;
    }

    auto bit = new long[](n+2);
    void add(long i) {
        if(i < n+2) {
            bit[i] += 1;
            add(i + (i & -i));
        }
    }
    long sum(long i) {
        if(i == 0) {
            return 0;
        }
        return bit[i] + sum(i - (i & -i));
    }
    long ans = 0;
    foreach(si; s) {
        ans += sum(h[si]);
        add(h[si]);
    }
    writeln(ans);
}



Measured memory_bytes: 26492
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}


int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n)cin >> h[i];
  ll res = 0;
  for(int i = 100; i > 0; i--){
    int curr = 0;
    for(int j = 0; j < n; j++){
      if(h[j] == i){
        curr++;
        h[j]--;
      }else{
        if(curr > 0){
          res++;
        }
        curr = 0;
      }
    }
    if(curr > 0)res++;
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  Scanner sc;

  Main() {
    sc = new Scanner( System.in );
  }

  public static void main(String[] args) {
    new Main().run();
  }

  int cal(int y, int m, int d) {
    int days = 0;

    days += y * ( 20 + 19 ) * 5 + ( ( y - 1 ) / 3 ) * 5;
    days += ( m / 2 ) * ( 20 + 19 ) - ( ~m & 1 ) * 19;
    if ( y % 3 == 0 ) {
      days += ( m - 1 ) / 2;
    }
    days += d;

    return days;
  }

  void run() {
    int n = ni();
    int atm = cal( 1000, 1, 1 );
    for ( int i = 0; i < n; ++i ) {
      int y = ni();
      int m = ni();
      int d = ni();

      int days = cal( y, m, d );
      System.out.println( atm - days );
    }
  }

  int ni() {
    return sc.nextInt();
  }

  void debug(Object... os) {
    System.err.println( Arrays.deepToString( os ) );
  }
}

Measured memory_bytes: 20452
program main
	implicit none
    integer :: n, m, c
    integer, allocatable :: a(:), b(:)
    integer :: ans, judge, i, j
    read(*, *) n, m, c
    allocate(a(m)); allocate(b(m))
    read(*, *) (b(i), i = 1, m)
    ans = 0
    do j = 1, n
    	read(*, *) (a(i), i = 1, m)
        judge = 0
        do i = 1, m
        	judge = judge + a(i)*b(i)
        enddo
        if (judge + c.gt.0) ans = ans + 1
    enddo
    write(*, *) ans
deallocate(a); deallocate(b)
stop
end program main

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int M,D;
    cin>>M>>D;
    int cnt=0;
    rep(i,M+1){
        if(i==0) continue;
        rep(j,D+1){
            if(j==0) continue;
            if(j/10>=2 && j%10>=2 && (j/10)*(j%10) == i) cnt++;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <limits.h>

using namespace std;

int cnt=0;

void bubbleSort(int v[], int n)
{
    int i, j;
    for (i=1;i<=n;i++)
        for(j=1;j<=n-i;j++)
            if(v[j]>v[j+1])
            {
                swap(v[j],v[j+1]);
                cnt++;
            }
}

int main()
{
    int n,v[101];
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>v[i];
    bubbleSort(v,n);
    for(int i=1;i<=n;++i)
        if(i!=n)cout<<v[i]<<" ";
        else cout<<v[i]<<endl;
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 3112
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
count=[0]*3
for i in range(N):
  if P[i]<=A :
    count[0]+=1
  elif P[i]<=B :
    count[1]+=1
  else :
    count[2]+=1
print(min(count))

Measured memory_bytes: 9120
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int

#define M_DEBUG 1
#define PI 3.141592653589793
#define MOD 100000007

#define DEBUG 1


int n;

int main(void) {
    int x, y, ans = 0;

    cin >> x >> y;

    if (x == 1 && y == 1) {
        ans += 400000;
    }

    if (x > 3) x = 4;
    if (y > 3) y = 4;

    ans += (4 - x) * 100000 + (4 - y) * 100000;


    cout << ans << endl;

    return 0;
}

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

int main(){
  int n;
  string s;
  cin >>n;
  
  for(int i=0;i<n;i++){
    cin >> s;
    if(s =="Y"){
      cout <<"Four"<<endl;
      break;
    }
    else if (i==n-1)
      cout <<"Three"<<endl;
  }
}

Measured memory_bytes: 256
/*Remember: The Struggle is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

//reference:
//https://codeforces.com/blog/entry/74134?#comment-582525

//very interesting problem!

#include<bits/stdc++.h>
using namespace std;

#define     int          long long int
#define     ld           long double
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     (__gcd((a),(b)))
#define     lcm(a,b)     (((a)*(b))/gcd((a),(b)))
#define     pb           push_back
#define     ins          insert
#define     pii          pair<int,int>
#define     F            first
#define     S            second
#define     makep        make_pair
#define     maket        make_tuple
#define     show(x)      for(auto c:x)cout<<c<<" ";cout<<"\n";
#define     show2(x)     for(auto c:x)cout<<c.F<<" "<<c.S<<"\n";

const int inf=1e18,M=1e9+7;
const int N=2e5+5;

vector<int> fact(N),invfact(N);

int pw(int x,int n)
{
    int res=1;

    x%=M;
    for(;n;n/=2)
    {
        if(n%2)
            res=(res*x)%M;

        x=(x*x)%M;
    }

    return res;
}

void compute_fact()
{
	fact[0]=1;
	for(int i=1;i<N;++i)
        fact[i]=(fact[i-1]*i)%M;

	invfact[N-1]=pw(fact[N-1],M-2);
	for(int i=N-2;i>=0;--i)
        invfact[i]=(invfact[i+1]*(i+1))%M;
}

int nCr(int n,int r)
{
	if(n<r)
		return 0;

	int res=(fact[n]*invfact[r])%M;
	res=(res*invfact[n-r])%M;

	return res;
}


void solve()
{
    compute_fact();

    int n,k;
    cin>>n>>k;

    int m=min(k,n-1),ans=0;
    for(int i=0;i<=m;++i)
    {
        ans=(ans+(nCr(n,i)*nCr((n-i)+i-1,i))%M)%M;
    }

    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




Measured memory_bytes: 3968
'''
difficult   　: 
ペナルティ　  　:分
実際の回答時間  :分
WAの回数　     :回
合計時間　　  　:分
'''
from operator import mul
def myAnswer(B:list,A:list,C:int) -> int:
   counter=0
   for a in A:
      if( sum(map(mul,B,a)) + C > 0):
         counter += 1
   return counter




def modelAnswer():
   tmp=1
def main():
   N,M,C = map(int,input().split())
   B = list(map(int,input().split()))
   A=[]
   for _ in range(N):
      A.append(list(map(int,input().split())))
      
   ans = myAnswer(B[:],A[:],C)
   print((ans))


if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL A, B, X;
	in >> A >> B >> X;

	LL ans = 1145148101919;
	rep(i, 114514)
	{
		LL want = X - 1000 * i;
		if (want < 0) want = 0;
		LL res = A * i + (want + 499) / 500 * B;
		ans = std::min(ans, res);
	}

	out << ans << std::endl;
}



Measured memory_bytes: 3108
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
#include<algorithm>
#include <queue>
typedef long long ll;
const int mod=998244353;
const int maxn=1e6+5;
const ll INF=100000000000000005;
const double eps=1e-11;
using namespace std;
ll n,m,p;
int vis[15];
int path[15];
struct node{
    double x,y;
}save[maxn];
double temp=1;
double sum=0;
double cal(node a,node b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
void dfs(int t)
{
    if(t==n+1)
    {
        double z=0;
        for(int i=1;i<=n-1;i++)
        {
            int x=path[i],y=path[i+1];
            sum+=cal(save[x],save[y]);
        }
        return;
    }
    for(int i=1;i<=n;i++)
        if(!vis[i])
        {
            vis[i]=1;
            path[t]=i;
            dfs(t+1);
            vis[i]=0;
        }
}
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) temp*=i;
    for(int i=1;i<=n;i++)
        scanf("%lf%lf",&save[i].x,&save[i].y);
    dfs(1);
    printf("%.10lf\n",sum/temp*1.0);
    return 0;
}


Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

ll a[123456];
int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin>>n;
    int i;
    rep(i,n){
    	cin>>a[i];
    	if(a[i]==0){
    		cout<<0<<endl;
    		return 0;
    	}
    }
    ll ans=1;
    ll iinf=inf;
    iinf*=inf;
    rep(i,n){
    	if(a[i]<=iinf/ans){
    		ans*=a[i];
    	}
    	else{
    		ans=-1;
    		break;
    	}
    }
    if(ans>iinf){
    	ans=-1;
    }
    cout<<ans<<endl;
    return 0;   
}


Measured memory_bytes: 4384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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


	int N, A, B;
	cin >> N >> A >> B;

	cosp(min(A, B));
	co(max(0, A + B - N));

	Would you please return 0;
}

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

int main() {
  long long N;
  cin >> N;
  N--;
  long long M = 26;
  int count = 1;
  for (int i = 0; i < 11; i++) {
    if (N < M){
      break;
    }
    else {
      N -= M;
      M *= 26;
      count++;
    }
  }
  M /= 26;
  
  vector<int>A(count);
  for (int i = 0; i < count; i++) {
    A.at(i) = N/M;
    N -= A.at(i)*M;
    M /= 26;
    A.at(i) += 97;
    printf("%c",A.at(i));
  }
  cout << endl;
}
  

Measured memory_bytes: 3580
def solve(N):
    if N < 10:
        return N
    num = 9
    while num < N:
        num *= 10
        num += 9
    num -= 9
    num //= 10

    k = int(str(N)[0] + str(num))
    if k <= N:
        return sum(int(c) for c in str(k))
    else:
        k = int(str(N)[0] + str(num)) - num - 1
        return sum(int(c) for c in str(k))


if __name__ == "__main__":
    N = int(input())
    print(solve(N))


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

// vector の表示用デバッグ
template<class T>
void debug(const vector<T>& v){
    cout << "[debug]" << endl << "{";
    for(int i = 0 ; i < v.size() ; i++ )
        cout << (i? ", " : "") << v[i];
    cout << "}" << endl;
}

int first(int n){
    return ((1 << n) - 1);
}

// 次の組合せを返す (32bitのintを返す)
int nextSet(int x){
    int small, ripple, newSmall,ones;
    small = x & -x;
    ripple = x + small;
    newSmall = ripple & -ripple;
    ones = (( newSmall / small ) >> 1) - 1;
    return (ripple | ones);
}

// bit列に対応するvectorを返す 
// ( i 番目のbitが 1 => i 番目の要素を選んでいる, i 番目のbitが 0 => i番目の要素を選んでいない)
vector<int> setComb(int s, int n, vector<int> a){
    vector<int> c;
    for(int i=0 ; i < n ; i++ ){
        if( s & 1 ) c.push_back( a[i] );
        s >>= 1;
    }
    return c;
}

// {a[0], a[1], ... , a[n-1]} の n 個の要素から k 個選んだ組合せを出力
int main(){
	const int n = 10;
    int k, s;
    while( cin >> k >> s , k || s ){
        vector<int> a(n);
        int ans = 0;
        for(int i=0 ; i < n ; i++ ){
            a[i] = i;
        }
        
        int x = first(k);
        while( !(x & ~first(n) ) ){
            vector<int> c = setComb( x , n , a );
            // 組合せ c に対する操作
            int sum = 0;
            for(int i=0 ; i < c.size() ; i++ ) sum += c[i];
            if( sum == s ) ans++;
            x = nextSet( x );
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1216
n=int(input())
bits = list(map(int,input().split()))
ans = set()
for i in reversed(range(n)):
  for j in range(i+(i+1),n,i+1):
    bits[i] ^= bits[j]
  if bits[i] == 1:
    ans.add(i+1)
print(len(ans))
print(*ans)

Measured memory_bytes: 19592
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
int to[200005];
int vst[200005], path[200005];
int main () {
  int n;
  ll k;
  scanf("%d %lld", &n, &k); ++k;
  FOR(i, 1, n) {
    scanf("%d", &to[i]);
  }
  int u = 1, cy, hd;
  for (int i = 1; ; ++i, u = to[u]) {
    if (i == k) {
      printf("%d\n", u); return 0;
    }
    if (vst[u]) {
      cy = i - vst[u]; hd = vst[u] - 1; break;
    }
    vst[u] = i; path[i] = u;
  }
  k = (k - hd) % cy;
  printf("%d\n", k == 0 ? path[hd + cy] : path[k + hd]);
  return 0;
}

Measured memory_bytes: 5912
from sys import stderr, setrecursionlimit, exit
setrecursionlimit(2147483647)
def getInt():
    return int(input())
def getInts():
    return [int(i) for i in input().split()]
def getIntLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInt())
    return res
def getIntsLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInts())
    return res
def debug(*args, **kwargs):
    print(*args, file=stderr, **kwargs)

n, m = getInts()
x = sorted(getInts())

if n >= m:
    print(0)
    exit()

b = sorted([x[i+1] - x[i] for i in range(m-1)])

print(sum(b[:m-n]))


Measured memory_bytes: 13832
package main

import (
	"fmt"
)

func main() {
	var a, b, c, X int
	fmt.Scan(&a, &b, &c, &X)
	ans := 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if (i*500)+(j*100)+(k*50) == X {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(a+b,min(b+c,c+a))<<endl;
	return 0;
}

Measured memory_bytes: 256
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
firsttaka = T1 * A1
firstao = T1 * B1
sumtaka = T1 * A1 + T2 * A2
sumao = T1 * B1 + T2 * B2
if sumtaka == sumao:
    print('infinity')
elif firsttaka > firstao and sumtaka > sumao:
    print(0)
elif firsttaka < firstao and sumtaka < sumao:
    print(0)
else:
    sumabs = abs(sumtaka - sumao)
    firstabs = abs(firsttaka - firstao)
    ans = (firstabs // sumabs) * 2
    amari = firstabs % sumabs
    if amari > 0:
        ans += 1
    print(ans)

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

int main() {
  int N;
  cin >> N;
  vector<string>A(N);
  for(int i=0; i<N; i++)cin >> A.at(i);
  
  string ans="Yes";
  
  for(int i=0; i<N-1; i++){
    if(A.at(i).at(A.at(i).size()-1)!=A.at(i+1).at(0))ans="No";
  }
  
  sort(A.begin(), A.end());
  
  for(int i=0; i<N-1; i++){
    if(A.at(i)==A.at(i+1))ans="No";
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, K, Q, L;
int jump[MAX][33];

int func(int i, int j) {
	if (j == 0) return jump[i][0];
	int &ret = jump[i][j];
	if (ret != -1) return ret;
	return ret = func(func(i, j -1), j - 1);
}

int main()
{
	int i, j, k, x, a, b;
	scanf("%d", &N);
	vector<int> vec;
	memset(jump, -1, sizeof(jump));

	for (i = 0; i < N; ++i) {
		scanf("%d", &x);
		vec.push_back(x);
	}
	scanf("%d%d", &L, &Q);
	sort(vec.begin(), vec.end());
	for (i = 0; i < N; ++i) {
		auto it = upper_bound(vec.begin(), vec.end(), vec[i] + L);
		--it;
		jump[i + 1][0] = it - vec.begin() + 1;
	}
	j = 0;
	while (N > (1 << j)) j++;
	for (i = 1; i <= N; ++i) {
		func(i, j);
	}

	for (i = 1; i <= Q; ++i) {
		scanf("%d%d", &a, &b);
		int days = 0;
		if (a > b) swap(a, b);
		for (k = j; k >= 0; --k) {
			if (jump[a][k] < b) {
				a = jump[a][k];
				days += (1 << k);
			}
		}
		printf("%d\n", days + 1);
	}
}

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

int main() {
  
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  if (a < b) swap(a,b);
  if (a < c) swap(a,c);
  
  int ans = a * pow(2,k) + b + c;
  
  cout << ans << endl;
}

Measured memory_bytes: 3916
#include<iostream>
using namespace std;
int main(){
	string s;
	long long k;
	cin>>s>>k;
	for(int i=0;i<s.size();i++){
		if(s[i]=='1'){
			k--;
		}else{
			cout<<s[i];
			break;
		}
		if(k==0){
			cout<<1;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

/**
   ceil(0, 2) == 0
   ceil(1, 2) == 1
   ceil(2, 2) == 1
   ceil(3, 2) == 2
   ceil(4, 2) == 2
*/
template<class T>
T ceil(T dividend, T divisor)
{
    return (dividend + (divisor - 1)) / divisor;
}

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

    struct Station {
        int C;
        int S;
        int F;
    };

    std::vector<Station> ss;
    for (int i = 0; i < N-1; ++i) {
        Station t;
        std::cin >> t.C >> t.S >> t.F;
        ss.push_back(t);
    }

    for (int s = 0; s < N-1; ++s) {
        int t = 0;
        for (int i = s; i < N-1; ++i) {
            if (t < ss[i].S) {
                t = ss[i].S + ss[i].C;
            }
            else {
                t = ceil(t, ss[i].F) * ss[i].F + ss[i].C;
            }
        }
        std::cout << t << std::endl;
    }
    std::cout << 0 << std::endl;
    return 0;
}


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

#define ll long long
#define ii pair<int, int>
#define ff first 
#define ss second 
map<ll, ll> mp;

int main(){
	ll i,j,a,n,ans = 0;
	vector<ll> v2;
	vector<ll> v4;

	ll x = -1, y = -1;
	scanf("%lld", &n);
	while(n--){
		scanf("%lld", &a);
		mp[a]++;
	}
	for(auto it : mp){
		if(it.ss >= 4)
			v4.push_back(it.ff);
		if(it.ss >= 2)
			v2.push_back(it.ff);
	}
	sort(v2.begin(), v2.end());
	sort(v4.begin(), v4.end());

	reverse(v2.begin(), v2.end());
	reverse(v4.begin(), v4.end());

	if(v2.size() >= 2)
		ans = max(ans, v2[0] * v2[1]);
	if(v4.size() >= 2)
		ans = max(ans, v4[0] * v4[1]);
	if(v2.size() >= 1 && v4.size() >= 1)
		ans = max(ans, v2[0] * v4[0]);
	if(v4.size() >= 1)
		ans = max(ans, v4[0] * v4[0]);

	printf("%lld\n", ans);
    
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define ll long long
#define fastio cin.sync_with_stdio(false); cin.tie(NULL)
#define all(x) x.begin(),x.end()
using namespace std;
void dfs(int x, vector<vector<int>> & adj,vector<bool> &visited){
    visited[x]=true;
    for (auto &a :adj[x]){
        if (visited[a])continue;
        dfs(a,adj,visited);
    }
}
int main ()
{
  fastio;
  int n,m ;
  int numCon=0;
  cin>>n>>m;
  vector <bool> visited(n,false);
  vector<vector<int>>adj(n,vector<int>());
for (int i=0;i<m;i++){
  int x,y;
  cin>>x>>y;x--;y--;
  assert(x>=0&&x<n);
  assert(y>=0&&y<n);
    adj[x].push_back(y);
    adj[y].push_back(x);
}

for (int i =0;i<n;i++){
    if (!visited[i]){
        dfs(i,adj,visited);
        numCon+=1;
    }
}
cout<<numCon-1<<endl;
return 0;
}


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

int main() {
  int N;
  cin >>N;
  if(N<105) {
    cout <<0<<endl;
  } else if(N<135) {
    cout <<1<<endl;
  } else if(N<165) {
    cout <<2<<endl;
  } else if(N<189) {
    cout <<3<<endl;
  } else if(N<195){
    cout<<4<<endl;
  } else {
    cout <<5<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import bisect

n=int(input())
A=list(map(int,input().split()))
q=int(input())

for i in range(q):
    k=int(input())
    j=bisect.bisect(A,k)
    if j-1>=0 and A[j-1]==k:
        print(1)
    else:
        print(0)



Measured memory_bytes: 17216
using System;
using System.Linq;

namespace ALDS1_5_B_MergeSort
{
	class Program
	{
		static void Main ( string[] args )
		{
			int dataCount = int.Parse (Console.ReadLine ());
			int[] numArray = new int[dataCount];
			numArray = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();

			MergeSort (numArray);

			Console.WriteLine (string.Join (" ", Array.ConvertAll (numArray, num => num.ToString ())));
			Console.WriteLine (Count);
		}

		static int Count = 0;

		static void MergeSort ( int[] numArray )
		{
			MergeSort (numArray, 0, numArray.Length);
		}

		static void MergeSort ( int[] numArray, int leftIndex, int rightIndex )
		{
			//3?????\??????????´????????????¨???
			//0~1 ??
			//0~2 ???
			if (leftIndex + 1 < rightIndex)
			{
				int middleIndex = (leftIndex + rightIndex) / 2;
				MergeSort (numArray, leftIndex, middleIndex);
				MergeSort (numArray, middleIndex, rightIndex);
				Merge (numArray, leftIndex, middleIndex, rightIndex);
			}
		}

		static void Merge ( int[] numArray, int leftIndex, int middleIndex, int rightIndex )
		{
			int n1 = middleIndex - leftIndex;
			int n2 = rightIndex - middleIndex;

			int[] leftArray = new int[n1 + 1];
			int[] rightArray = new int[n2 + 1];

			for (int index = 0; index < n1; index++)
			{
				leftArray[index] = numArray[leftIndex + index];
			}
			for (int index = 0; index < n2; index++)
			{
				rightArray[index] = numArray[middleIndex + index];
			}

			//sentinel
			leftArray[n1] = int.MaxValue;
			rightArray[n2] = int.MaxValue;

			int left = 0;
			int right = 0;

			for (int index = leftIndex; index < rightIndex; index++)
			{
				Count++;

				if (leftArray[left] <= rightArray[right])
				{
					numArray[index] = leftArray[left];
					left++;
				}
				else
				{
					numArray[index] = rightArray[right];
					right++;
				}
			}
		}
	}
}

Measured memory_bytes: 95380
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;
 
public class Main implements Runnable{
    static final int INF = (int)1e9 + 7;
	int V,E;
	int[][] cap;
    boolean[] used;
	
	//Ford-Fulkerson
    public int dfs(int v,int t,int f){
		
        if(v == t)return f;
		
        used[v] = true;
        for(int i = 0;i < V;i++){
            if(!used[i] && cap[v][i] > 0){
                int d = dfs(i,t,Math.min(f, cap[v][i]));
                if(d > 0){
                    cap[v][i] -= d;
                    cap[i][v] += d;
                    return d;
                }
            }
        }
		
        return 0;
    }
	
    public int max_flow(int s,int t){
        int flow = 0;
        for(;;){
            Arrays.fill(used, false);
            int f = dfs(s,t,INF);
            if(f == 0)return flow;
            flow += f;
        }
    }
 
    @SuppressWarnings("unchecked")
    public void solve() {
        V = nextInt();
        E = nextInt();
		
		cap = new int[V][V];
		
        used = new boolean[V];
		
        for(int i = 0;i < E;i++){
 
            int u = nextInt();
            int v = nextInt();
            int c = nextInt();
			
			cap[u][v] = c;
        }
 
        out.println(max_flow(0,V-1));
    }
 
    public static void main(String[] args) {
        new Thread(null,new Main(),"",32 * 1024 * 1024).start();
    }
 
    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;
 
    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }
 
    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }
 
    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }
 
    public int nextInt() {
        return Integer.parseInt(next());
    }
 
    public long nextLong() {
        return Long.parseLong(next());
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
 
    @Override
    public void run() {
        out.flush();
        new Main().solve();
        out.close();
 
    }
}

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

using namespace std;

const int num = 100;
int N, M, Q, arr[num], a[num], b[num], c[num], d[num], ans=0;

int CalcP(){
   int ret = 0;
   for(int i=0; i<Q; i++)
     if(arr[b[i]] - arr[a[i]] == c[i])
       ret += d[i];
   return ret;
}

void dfs(int index, int cur){
  if(index == N+1){
    ans = max(ans, CalcP());
    return;
  }
  
  for(int i=cur; i<=M; i++){
    arr[index] = i;
    dfs(index+1, i);
  }
}

int main(){
  cin >> N >> M >> Q;
  for(int i=0; i<Q; i++) 
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  
  dfs(1,1);
  cout << ans << endl;
  return 0; 
}


Measured memory_bytes: 3636
#include <iostream>

#define modulo 1000000007


int pow(long long base, int expo){
    long long cp = 1;
    while(expo){
        if(expo%2) {
            cp *= base;
            cp %= modulo;
        }
        base *= base;
        base %= modulo;
        expo /= 2;
    }
    return cp;
}

int inverse_mod(int n){
    return pow(n, modulo-2);
}

int ncr(int n, int r){
    long long base = 1;
    for (int i = 0; i < r; ++i) {
        base *= n;
        base %= modulo;
        --n;
    }
    for (int i = 2; i <= r; ++i) {
        base *= inverse_mod(i);
        base %= modulo;
    }
    return base;
}

int main(){
    int n, a, b;
    std::cin >> n >> a >> b;
    int out = pow(2, n) - 1;
    out -= ncr(n ,a);
    out -= ncr(n, b);
    while(out < 0){
        out += modulo;
    }
    std::cout << out;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,y,cnt=0,flag=0;
  cin>>n>>y;
  rep(i,n+1){
    if (flag==0) {
      rep(j,n-i+1){
        cnt=10000*i+5000*j+1000*(n-i-j);
        if (cnt==y) {
          cout<<i<<" "<<j<<" "<<n-i-j<<endl;
          flag+=1;
          break;
        }
      }
    }
  }
  if (flag==0) {
    cout<<"-1 -1 -1"<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

const int h = 100, w = 100;
char f[h][w];
signed main(){
	int A, B;
	cin >> A >> B;
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			f[i][j] = i < h / 2 ? '.': '#';
		}
	}
	A--; B --;
	for(int i = 0; i < h / 2 - 1; i += 2) {
		for(int j = 0; j < w; j += 2) {
			if(B > 0) {
				f[i][j] = '#';
				--B;
			}
		}
	}
	for(int i = h/2+1; i < h; i += 2) {
		for(int j = 0; j < w; j += 2) {
			if(A > 0) {
				f[i][j] = '.';
				--A;
			}
		}
	}
	cout << h << " " << w << endl;
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			cout << f[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <forward_list>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <string>
#include <bitset>
#include <memory>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <cstdint>
#include <iomanip>
#include <tuple>
#include <random>

typedef unsigned long long int ull;
typedef long long int ll;

using namespace std;

int main(void) {
    vector<int> a;
    int n,p[2] = {0},t;
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> t;
        a.push_back(t);
    }
    sort(a.begin(),a.end(),greater<int>());
    for(int i = 0;i < n;i++)
        p[i%2] += a[i];
    cout << p[0] - p[1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define MAX 100005
int main()
{
    ll i,j,k,l,n,m;
    in(n);
    if(n==2)
    {
        puts("1");
        exit(0);
    }
    ll ans=2;
    for(i=2;i*i<=n-1;i++)
    {
        if((n-1)%i==0)
        {
            ans++;
            m=(n-1)/i;
            if(m!=i)ans++;
        }
    }
    m=n;
    for(i=2;i*i<=m;i++,n=m)
    {
        if(n%i==0)
        {
            while(n%i==0)
                n/=i;
            if(n%i==1)ans++;
        }
    }
    out(ans);endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){
    long long N, sum=0;
    cin >> N;
    long long *A = new long long[N+1];
    long long b;
    for(int i=1; i<=N; i++){
        cin >> A[i];
        A[i] -= i;
    }
    sort(A+1, A+N+1);
    b = A[N/2 + 1];
    for(int i=1; i<=N; i++){
        sum += abs(A[i]-b);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
//24
#include<iostream>
#include<map>
#include<deque>
#include<algorithm>

using namespace std;

struct P{
  int n,x;
  bool operator<(P a)const{
    return x<a.x;
  }
};

int main(){
  for(int q,l;cin>>q>>l,q|l;){
    deque<P> deq;
    map<int,int> m;
    for(int i=0;i<q;i++){
      int qu,x;
      cin>>qu>>x;
      if(qu==0){
	P p={x,i};
	deq.push_back(p);
	m[x]=i;
	if(deq.size()>l){
	  m.erase(deq[0].n);
	  deq.pop_front();
	}
      }else if(qu==1){
	x--;
	m.erase(deq[x].n);
	deq.erase(deq.begin()+x);
      }else if(qu==2){
	cout<<deq[x-1].n<<endl;
      }else{
	P s={0,m[x]};
	deque<P>::iterator d=lower_bound(deq.begin(),deq.end(),s);
	m.erase(d->n);
	deq.erase(d);
      }
    }
    cout<<"end"<<endl;
  }
  return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#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>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int bubble_sort(vi &a, int n) {
    int cnt = 0;
    bool flag = true;
    while (flag) {
        flag = false;
        for (int j = n-1; j >= 1; j--) {
            if (a[j] < a[j-1]) {
                swap(a[j], a[j-1]);
                cnt++;
                flag = true;
            }
        }
    }
    return cnt;
}

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

    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int ans = bubble_sort(a, n);
    rep(i, n) cout << a[i] << (i == n-1 ? '\n' : ' ');
    cout << ans << endl;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for(int i = 1; i <= n; i++) {
    sum += i - 1;
  }
  for(int i = 1; i <= m; i++) {
    sum += i - 1;
  }
  cout << sum << endl;
  return 0;
}


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

typedef long long lint;
typedef long double ldouble;
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const lint inv = MOD - 2;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

const int MAX = (int)1e5 + 10;

int main(){
    int n;
    cin >> n;
    vector< pair<int, int> > va(MAX), vb(MAX);
    rep(i, MAX){
        va[i].first = 0;
        va[i].second = i;
        vb[i].first = 0;
        vb[i].second = i;
    }
    rep(i, n/2){
        int a, b;
        cin >> a >> b;
        va[a].first++;
        vb[b].first++;
    }
    SORT(va);
    SORT(vb);
    int ans = n;
    if(va[MAX-1].second != vb[MAX-1].second){
        ans -= (va[MAX-1].first + vb[MAX-1].first);
    }else if(va[MAX-2].first < vb[MAX-2].first){
        ans -= (va[MAX-1].first + vb[MAX-2].first);
    }else{
        ans -= (va[MAX-2].first + vb[MAX-1].first);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }


int main() {
	ll N,M,sum;
	sum = 1;
	cin >> N >> M;
	sum = (N * 2 + M) / 4;
	if (sum > M / 2) sum = M / 2;
	cout << sum;
	cin >> N;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	t %= mod;
	if (n % 2 == 1)t *= a;
	return t % mod;
}

const int INF = 1001001001;
//const ll INF = 1e18;


int main() {
	int n, m;
	cin >> n >> m;
	if (n == m)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        for (int v=0; v<n; ++v) {
            char s = ' ';
            int[] nums = new int[9];
            ArrayList<Integer> R = new ArrayList<>();
            ArrayList<Integer> G = new ArrayList<>();
            ArrayList<Integer> B = new ArrayList<>();
            for (int i=0; i<9; ++i) {
                nums[i] = sc.nextInt();
            }
            for (int i=0; i<9; ++i) {
                s = sc.next().charAt(0);
                if (s == 'R') {
                    R.add(nums[i]);
                }
                if (s == 'G') {
                    G.add(nums[i]);
                }
                if (s == 'B') {
                    B.add(nums[i]);
                }
            }
            if (R.size() % 3 + G.size() % 3 + B.size() % 3 != 0) {
                System.out.println(0);
                continue;
            }
            System.out.println((comb(R) && comb(G) && comb(B)) ? 1 : 0);
        }
        sc.close();
    }

    private static boolean comb(ArrayList<Integer> l) {
        if (l.size() == 0) return true;
        int n[] = connvert(l);
        Arrays.sort(n);
        return check(n, 0, n.length);
    }

    private static boolean check(int[] n, int r, int l) {
        int[][] pos = {
            {0,1,1,1,1,2,2,2,2},
            {0,0,1,1,2,2},
            {0,1,2},
            {0,0,0},
        };
        int listlen = l - r;
        if (listlen == 9) {
            for (int i=0; i<9; ++i) {
                if (n[i+r] - n[r] != pos[0][i]) {
                    return check(n, 0, 3) && check(n, 3, 9) || check(n, 0, 6) && check(n, 6, 9);
                }
            }
        } else if (listlen == 6) {
            for (int i=0; i<6; ++i) {
                if (n[i+r] - n[r] != pos[1][i]) {
                    return check(n, r, r+3) && check(n, r+3, r+6);
                }
            }
        } else {
            boolean flag = true;
            for (int i=0; i<3; ++i) {
                if (n[i+r] - n[r] != pos[2][i]) {
                    flag = false;
                    break;
                }
            }
            if (!flag) {
                for (int i=0; i<3; ++i) {
                    if (n[i+r] - n[r] != pos[3][i]) {
                        return false;
                    }
                }
            }
        }
        return true;
    }

    private static int[] connvert(ArrayList<Integer>l) {
        int[] res = new int[l.size()];
        for (int i=0; i<l.size(); ++i) {
            res[i] = l.get(i);
        }
        return res;
    }
}



Measured memory_bytes: 28876
#include <bits/stdc++.h>
using namespace std;
int main() {
     string S;
     cin >> S;
     int ans = 999;
     int p = 0; int x = 0;
     for(int i = 0; i < S.size()-2; i++){
          p = (S[i]-'0')*100 + (S[i + 1]-'0')*10 + (S[i + 2]-'0');
          x = abs(753 - p);
          ans = min(ans,x);
     }
     cout << ans << endl;
}

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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define sort(x) sort(x.begin(), x.end());
#define rese(x) reverse(x.begin(), x.end());

int main() {
   ll n;
   cin>>n;
   vll a(n);
   ll wa=0;
   rep(i,n) cin>>a[i];
   
   ll now=a[0];
   ll sum=0;
   rep(i,n){
       wa+=a[i];
       if(a[i]<=now){
           sum+=now;
       }
       else{
           sum+=a[i];
           now=a[i];
       }
   }
   cout<<sum-wa<<endl;
}


Measured memory_bytes: 4784
N = int(input())
p = [int(i) for i in input().split()]
r = sorted(p)
for i in range(N):
    for j in range(i+1,N):
        q = []
        for k in range(N):
            if(k == i):
                q.append(p[j])
            elif(k == j):
                q.append(p[i])
            else:
                q.append(p[k])
        if(p == r or q == r):
            print("YES")
            exit()
print("NO")

Measured memory_bytes: 9148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
ll a,b,n,ans;
int main(){
	cin >> a >> b >> n;
	ans=a*min(n,b-1)/b;
	ans=max(ans,a*n/b-a*(n/b));
	ll c=n/b*b-1;
	ans=max(ans,a*c/b-a*(c/b));
	cout << ans;
	return 0;
}

Measured memory_bytes: 3652
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int a[] = {0, 0, 0};
    int ans = 0;
    rep(i, 3) cin >> a[i];
    rep(i, 3) {
        ans = max(ans, a[i]*10 + a[(i+1) % 3]  + a[(i+2)%3]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int flag[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        a[i]++;
    }
    rep(i,MAX_N){
        flag[i] = 0;
    }
    rep(i,n){
        flag[a[i]-1]++;
        flag[a[i]]++;
        flag[a[i]+1]++;
    }
    cout << *max_element(flag,flag+MAX_N) << endl;
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
acollection = list(map(int, input().split()))

dp = [0]*(10**5+1)

accum = 0
for value in acollection:
    dp[value] = dp[value] + 1
    accum += value

q = int(input())

for _ in range(q):
    b, c = map(int, input().split())

    changingNum = dp[b]
    diff = c * changingNum - b * changingNum
    accum += diff
    print(accum)

    dp[c] = dp[c] + changingNum
    dp[b] = 0



Measured memory_bytes: 21012
using System;
class c
{
    static void Main()
    {
        var inp = Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
        double ans = inp[0] * inp[1] / 2;
        int ans2 = 0;
        if (inp[0] / 2 == inp[2] && inp[1] / 2 == inp[3]) ans2 = 1;
        Console.WriteLine("{0} {1}", ans, ans2);
    }
}

Measured memory_bytes: 13268