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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;
typedef complex<int> point;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

#define watch(x) cerr << (#x) << " = " << (x)    << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}



void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}


void smain() {


    int n;
    cin >> n;
    vl a(n), b(n);
    fori (i, n) cin >> a[i];
    fori (i, n) cin >> b[i];


    vl dpos;
    ll dneg = 0, dall = 0;
    int ans = 0;
    fori (i, n) {
        ll d = a[i] - b[i];
        if (d > 0) dpos.push_back(d);
        else if (d < 0) dneg += -d, ans++;
        dall += d;
    }
//    watch(dpos);
    if (dall < 0) {
        cout << "-1";
        return;
    }
    sort(RALL(dpos));
    if (dneg == 0) {
        cout << "0";
        return;
    }
    for (int i = 0; ; ++i) {
        dneg -= dpos[i];
//        watch(dneg);
        if (dneg <= 0) {
            cout << ans + i + 1;
            return;
        }
    }

}

Measured memory_bytes: 2428
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,M;
ll a[1000010];
int main(){
    cin>>N>>M;
    ll sum=0;
    for(ll i=0;i<M;i++){
        cin>>a[i];
        sum+=a[i];
    }
    cout<<((sum>N)?(-1):(N-sum))<<endl;

    return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
    using namespace std;
    
    typedef pair<string , long> pair_t;

    bool comp(const pair_t &a , const pair_t &b){
        if(a.first == b.first ){
            return a.second > b.second;
        }
        return a.first < b.first;
    }

    int main(){
      int n , p;
      string s;
      cin >> n;
      vector<pair_t> v1 , v2;
      for(int i = 0; i < n ; i++){
          cin >> s >> p;
          pair_t t;
          t.first = s;
          t.second= p;
          v1.push_back(t);
          v2.push_back(t);
      }
      sort(v1.begin(), v1.end() , comp);

      for(int i = 0; i < n ; i++){
          s = v1[i].first;
          p = v1[i].second;
          for(int j = 0 ; j < n ; j++){
              if(v2[j].first == s && v2[j].second == p){
                  cout << (j + 1) << endl;
              }
          }
      }
      return 0;
    }

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

int main() {
    int x, y;
    cin >> x >> y;
    if ((4 * x - y) % 2 == 0 && 0 <= (4 * x - y) / 2 && (4 * x - y) / 2 <= x) {
        cout << "Yes" << endl;
    } 
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3576
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	a := getNextInt(scanner)
	b := getNextInt(scanner)
	for i := 0; i < 10000; i++ {
		if i*8/100 == a && i*10/100 == b {
			fmt.Fprintln(writer, i)
			return
		}
	}
	fmt.Fprintln(writer, -1)
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void){
  int a,b;
  char op;

  scanf("%d %c %d",&a,&op,&b);
  
  if(op=='+'){
    printf("%d\n",a+b);
  }
  else{
    printf("%d\n",a-b);
  }
  return 0;
}

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

#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define si set<int>
#define mi map<int,int>
#define mll map<long long,long long>
#define qi queue<int>
#define pb push_back
#define mod %
#define pow ^
#define pnode struct node
#define pair_int pair<int,int>
#define pq priority_queue

#define N 200001

ll seg[4*N];

unordered_map<int,int> m;

void init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


void build(int idx,int l,int r)
{
   if(l==r)
   {
      seg[idx] = 0;
      return;
   }

   int mid = (l+r)/2;
   build((2*idx)+1, l, mid);
   build((2*idx)+2, mid+1, r);
   seg[idx] = 0;
   return;
}


ll query(int idx,int l, int r, int a, int b)
{
   if(a>b)
      return 0;

   // subset
   if(a<=l && r<=b)
   {
      return seg[idx];
   }
   // no
   if(b<l || r<a)
   {
      return 0;
   }

   int mid = (l+r)/2;
   ll v1 = query((2*idx)+1, l, mid, a, b);
   ll v2 = query((2*idx)+2, mid+1, r, a, b);
   return max(v1, v2);

}

void update(int idx,int l,int r,int i,ll val)
{
   if(l==r)
   {
      seg[idx] = max(seg[idx], val);
      return;
   }

   int mid = (l+r)/2;
   if(i<=mid)
   {
      update((2*idx)+1, l, mid, i, val);
   }
   else
   {
      update((2*idx)+2, mid+1, r, i, val);
   }
   seg[idx] = max(seg[(2*idx)+1], seg[(2*idx)+2]);
   return;
}

int main()
{
   init();

   int h[N];
   ll a[N];
   vi v;

   int n;
   cin >> n;

   for(int i=0;i<n;i++)
   {
      cin >> h[i];
      v.pb(h[i]);
   }

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

   sort(v.begin(), v.end());
   int num = 0;
   for(auto i : v)
   {
      if(m[i]!=0)
         continue;
      m[i] = num;
      num++;
   }

   build(0,0,num-1);

   for(int i=0;i<n;i++)
   {
      int idx = m[h[i]];
      ll mx = query(0,0,num-1,0,idx-1);
      // cout << h[i] << " " << mx << endl;
      update(0,0,num-1,idx,mx+a[i]);
   }

   cout << seg[0] << "\n";
   return 0;
}


Measured memory_bytes: 17816
def solve(N, A):
    a = [(i, ai) for i, ai in enumerate(A)]
    a.sort(key=lambda x: x[1], reverse=True)

    # import numpy as np
    # dp = np.zeros((N+1, N+1), np.int8)

    dp = [[0] * (N + 1) for _ in range(N + 1)]

    dp[0][0] = 0
    for i, ai in enumerate(a):
        for l in range(i+1):
            r = i - l
            dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ai[1] * ((N-1-r) - ai[0]))
            dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + ai[1] * (ai[0] - l))

    print(max(dp[N]))

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    solve(N, A)


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

int main(){
    int n,l;
    cin>>n>>l;
    int sum=0, mini=1000;
    rep(i,n){
        if(abs(mini)>abs(l+i))mini=l+i;
        sum+=l+i;
    }
    cout<<sum-mini;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    ll cache = 1000;
    ll stock = 0;
    for(int i = 0; i < (N - 1); i++) {
        if(stock > 0){
            cache += (stock * A.at(i));
            stock = 0;
        }
        if(A.at(i) < A.at(i + 1)) {
            ll buy = cache / A.at(i);
            stock += buy;
            cache -= (buy * A.at(i));
        }
    }
    if(stock > 0) {
        cache += (stock * A.at(N - 1));
        // cout << (N - 1) << ": " << A.at(N - 1) << ": CELL" << endl;
    }

    cout << cache << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
  int n,k; cin>>n>>k;
  string s; cin>>s;
  s[k-1]+=32;
  cout<<s<<endl;

  }


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod =1000000007;





int main() {

	int a, p;
	cin >> a >> p;
	p += a * 3;

	cout << p / 2 << endl;


}

Measured memory_bytes: 256
/*
Author : N_o_o_B
Created : December 08 2019 17:29:14 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    int sum = 0;
    fori(i,3) {
        int x;
        cin >> x;
        sum+=x;
    }
    if(sum >= 22){
        cout << "bust" << endl;
    }
    else cout << "win" << endl;




    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a, b,n;
	int a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6, num,ans ;
	scanf("%d",&n);
	ans = 1000000;
	for (a = 1; a <= n-1; a++) {
		b = n - a;
		a1 = a % 10;
		a2 = (a % 100) - a1;
		a3 = (a % 1000) - a1 - a2;
		a4 = (a % 10000) - a1 - a2 - a3;
		a5 = (a % 100000) - a1 - a2 - a3 - a4;
		a6 = (a % 1000000) - a1 - a2 - a3 - a4 - a5;
		b1 = b % 10;
		b2 = (b % 100) - b1;
		b3 = (b % 1000) - b1 - b2;
		b4 = (b % 10000) - b1 - b2 - b3;
		b5 = (b % 100000) - b1 - b2 - b3 - b4;
		b6 = (b % 1000000) - b1 - b2 - b3 - b4 - b5;
			num = a1 + a2 / 10 + a3 / 100 + a4 / 1000 + a5 / 10000 + a6 / 100000 + b1 + b2 / 10 + b3 / 100 + b4 / 1000 + b5 / 10000 + b6 / 100000;
			if (ans > num) ans = num;
			else;




	}

	printf("%d", ans);
	return 0;
	
}

Measured memory_bytes: 128
#include <stdio.h>
int main ()
{
    int a,b,x,d;
    scanf("%d%d%d",&a,&b,&x);
    d=a+b;
    if(a==x)
    printf("YES\n");
    else if(a<x&&d>=x)
    printf("YES\n");
    else
    printf("NO\n");
    return 0;
}

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

int main() {
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << a[k-1] << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
As = list(map(int, input().split()))
As.sort(reverse=True)

BCs = []
for _ in range(M):
    b, c = map(int, input().split())
    BCs.append({'b': b, 'c': c})

BCs = sorted(BCs, key=lambda bc: bc['c'], reverse=True)
#print(BCs)

new_cards = []
for i in range(M):
    new_cards += [BCs[i]['c'] for _ in range(BCs[i]['b'])]
    if len(new_cards) >= N:
        break

if len(new_cards) < N:
    new_cards += [0 for _ in range(N-len(new_cards))]
#print(new_cards)

A_index = 0
new_index = 0
new_As = []
for i in range(N):
    if As[A_index] >= new_cards[new_index]:
        new_As.append(As[A_index])
        A_index += 1
    else:
        new_As.append(new_cards[new_index])
        new_index += 1

print(sum(new_As))


Measured memory_bytes: 46296
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char a[10], b[5];
	int n, i;

	scanf("%s %s", a, b);
	strcat(a, b);
	n = atoi(a);

	for (i = 1; i <= 1000; i++) {
		if (n == (i * i)) {
			printf("Yes");
			return 0;
		}
	}

	printf("No");

	return 0;
}


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

const int INF = 2e9;

int main(){
    int  k;
    string s;
    cin >> k >> s;
    int t = s.size();
    if(k < t) cout << s.substr(0,k) << "..." << endl;
    else cout << s << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll ans = max({a*c, a*d, b*c, b*d});
    cout << ans << endl;
    return 0;
}

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

#define N 100000
#define H 1000000000

int compare(const void *a, const void *b) {
	int ia = *(int *) a;
	int ib = *(int *) b;

	return ia - ib;
}

int main() {
	static int hh[N];
	int n, k, i, ans;

	scanf("%d%d", &n, &k);
	for (i = 0; i < n; i++)
		scanf("%d", &hh[i]);
	qsort(hh, n, sizeof *hh, compare);
	ans = H;
	for (i = 0; i + k - 1 < n; i++) {
		int x = hh[i + k - 1] - hh[i];

		if (ans > x)
			ans = x;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 892
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using static program.Input;
using static program.MyMath;
using static System.Console;

namespace program {
  class Program {
    static string Alp = "abcdefghijklmnopqrstuvwxyz";
    static void Main()
    {
      var a = ScanInt();
      while(true){
        if(a.isPrime()) break;
        a++;
      }
      WriteLine(a);
    }
  }
  
  static class Input {
    static public int ScanInt() { return int.Parse(Console.ReadLine()); }
    static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
    static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
    static public long ScanLong() { return long.Parse(Console.ReadLine()); }
    static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
    static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
    static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
    static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
    static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
    static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

    static public string ScanStr() { return Console.ReadLine(); }
    static public string[] ScanStrArray() { return ScanStr().Split(); }
    static public string RegaxReplace(this string arg1, string pattern, string replacement)
    {
      return Regex.Replace(arg1, pattern, replacement);
    }
  }
  
  static class MyMath {
    public static bool isPrime(this int p){
      if(p<=1) return false;
      for(int i=2; i*i<=p; i++)
        if(p%i==0) return false;
      return true;
    }
    public static bool isPrime(this long p){
      if(p<=1) return false;
      for(int i=2; i*i<=p; i++)
        if(p%i==0) return false;
      return true;
    }
    public static int GCD(int a, int b) {
        Func<int, int, int> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static long GCD(long a, long b) {
        Func<long, long, long> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static ulong extGCD(ulong a, ulong b, ref ulong x, ref ulong y) {
      if(b==0) {
        x=1; 
        y=0;
        return a;
      }
      var d = extGCD(b, a%b, ref y, ref x);
      y -= a/b *x;
      return d;
    }
    public static int LCM(int a, int b) { return a * b / GCD(a, b); }
    public static long LCM(long a, long b) { return a * b / GCD(a, b); }
  }
}


Measured memory_bytes: 13140
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

const int N = 10;

int n, m, k;
string g[N];

int main()
{
  cin >> n >> m >> k;
  for(int i = 0; i < n; i++) {
    cin >> g[i];
  }
  int ans = 0;
  for(int mr = 0; mr < (1 << n); mr++) {
    for(int mc = 0; mc < (1 << m); mc++) {
      int cnt = 0;
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
          if(g[i][j] == '#' && (mr & (1 << i)) && (mc & (1 << j))) {
            cnt++;
          }
        }
      }
      if(cnt == k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
#include <stdio.h>

typedef long long ll;
using namespace std;



bool isPrime(int n){
    if(n < 2){
        return 0;
    }
    if(n%2 == 0){
        return n==2;
    }
    for(int i=3;i*i<=n;i++){
        if(n%i == 0) return 0;
    }
    return 1;
}


int main() {

    ll n,m,k;
   cin>>n>>m>>k;
   vector<ll> a(n);
   vector<ll> b(m);
   for(int i=0;i<n;i++)cin>>a[i];
   for(int i=0;i<m;i++)cin>>b[i];
   ll t = 0;
   ll no1 = 0;
   ll no2 = 0;
    for(int i=1;i<n;i++)a[i]+=a[i-1];
    for(int i=1;i<m;i++)b[i]+=b[i-1];
    for(int i=0;i<n;i++){
        ll curr = a[i];
      //  cout<<curr<<endl;
        if(curr> k) break;
        auto it = lower_bound(b.begin(),b.end(),k-curr+1);
        int indx = it-b.begin();
       // cout<<"indx "<<indx<<" val "<<*it<<endl;
        if(indx <= 0 ) indx=0;
        no1 = max((ll)(i+1+indx),no1);
    }
    for(int i=0;i<m;i++){
        ll curr = b[i];
        if(curr> k) break;
        auto it = lower_bound(a.begin(),a.end(),k-curr+1);
        int indx = it-a.begin();
        if(indx <= 0 ) indx=0;
        no2 = max((ll)(i+1+indx),no2);
    }

    cout<<max(no1,no2)<<endl;

   
    return 0;
}


Measured memory_bytes: 6336
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int inf = 0x3f3f3f3f;

int n,k,v[55];
vector<int> s;

int main(){
    int ans = 0;
    scanf( "%d%d" , &n , &k );
    for( int i=0 ; i<n ; i++ ){
        scanf( "%d" , &v[i] );
    }
    for( int i=1 ; i<=n&&i<=k ; i++ ){
        for( int j=0 ; j<=i&&i+j<=k ; j++ ){
            for( int l=0 ; l<=i ; l++ ){
                int r = i-l; s.clear(); int sum = 0;
                for( int k=0 ; k<l ; k++ ){
                    s.push_back(v[k]); sum += v[k];
                }
                for( int k=0 ; k<r ; k++ ){
                    s.push_back(v[n-k-1]); sum += v[n-k-1];
                }
                sort( s.begin() , s.end() );
                for( int k=0 ; k<j ; k++ ){
                    sum -= s[k];
                }
                ans = max( ans , sum );
            }
        }
    }
    printf( "%d\n" , ans );
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  vector<vector<int>> c(10,vector<int>(10));
  for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
      cin>>c.at(i).at(j);
  vector<vector<int>> m=c;
  for(int x=0;x<10;x++)
    for(int i=0;i<10;i++)
      for(int j=0;j<10;j++)
        m[i][j]=min(m[i][j],m[i][x]+m[x][j]);
  int s=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int a;
      cin>>a;
      s+=(a!=-1?m[a][1]:0);
    }
  }
  cout<<s<<endl;
}

Measured memory_bytes: 3600
class BinaryIndexedTree:
    # a[i] = [0] * n
    def __init__(self, n):
        self.size = n
        self.data = [0] * (n+1)

    # return sum(a[0:i])
    def cumulative_sum(self, i):
        ans = 0
        while i > 0:
            ans += self.data[i]
            i -= i & -i
        return ans

    # a[i] += x
    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.data[i] += x
            i += i & -i

def main():
    from sys import stdin
    input = stdin.buffer.readline

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

    bit = BinaryIndexedTree(n)
    for i, ai in enumerate(a):
        bit.add(i, ai)

    ans = []
    for _ in range(q):
        typ, i, j = map(int, input().split())
        if typ == 0:
            bit.add(i, j)
        else:
            ans.append(bit.cumulative_sum(j) - bit.cumulative_sum(i))

    for i in ans:
        print(i)

main()


Measured memory_bytes: 61672
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int Nmax = 100010;
const int Tmax = 200010;

int main() {
    int n, C;
    cin >> n >> C;

    vector<int> s(Nmax), t(Nmax), c(Nmax), v(Tmax), cnt(Tmax);
    rep(i, n) {
        cin >> s[i] >> t[i] >> c[i];
        c[i]--;
    }

    rep(i, C) {

        rep(j, Tmax) {
            v[j] = 0;
        }

        rep(j, n) {
            if(c[j] == i) {
                v[2*s[j]-1]++;
                v[2*t[j]]--;
            }
        }

        rep(j, Tmax-1) {
            v[j+1] += v[j];
        }

        rep(j, Tmax) {
            if(v[j] > 0) {
                cnt[j]++;
            }
        }
    }

    int ans = 0;
    rep(i, Tmax) {
        if(ans < cnt[i]) {
            ans = cnt[i];
        }
    }

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

Measured memory_bytes: 2944
arr = []
h = Hash.new(0)
6.times{
    y, x = gets.chomp.split.map(&:to_i).sort
    h[[y, x]] += 1
    arr << y << x
}
arr.sort!.uniq!
cuboid = false
case arr.length
when 1
    cuboid = true
when 2
    cuboid = true if h[[arr[0], arr[0]]] == 2 && h[[arr[0], arr[1]]] == 4
    cuboid = true if h[[arr[0], arr[1]]] == 4 && h[[arr[1], arr[1]]] == 2
when 3
    cuboid = true if [[arr[0], arr[1]], [arr[0], arr[2]], [arr[1], arr[2]]].all?{|y, x| h[[y, x]] == 2}
end
puts cuboid ? "yes" : "no"


Measured memory_bytes: 8884
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
  ll n, k, s;
  cin >> n >> k >> s;
  vector<ll> ans(n);
  if (s == 1000000000) {
    for (int i = 0; i < n; i++) {
      if (i < k) {
        ans[i] = s;
      }
      else {
        ans[i] = 1;
      }
    }
  }
  else {
    for (int i = 0; i < n; i++) {
      if (i < k) {
        ans[i] = s;
      }
      else {
        ans[i] = 1000000000;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int hp(vector<vector<int>> v,vector<vector<int>> dp,int n){
    for(int i=1;i<=n;i++){
        dp[i][0]=max(v[i-1][1]+dp[i-1][1],v[i-1][2]+dp[i-1][2]);
        dp[i][1]=max(v[i-1][0]+dp[i-1][0],v[i-1][2]+dp[i-1][2]);
        dp[i][2]=max(v[i-1][1]+dp[i-1][1],v[i-1][0]+dp[i-1][0]);
    }
    return max(dp[n][0],max(dp[n][1],dp[n][2]));
}

int main() {
    int n;cin>>n;
    vector<int> t(3,0);
    vector<vector<int>> v(n,t),dp(n+3,t);
    for(int i=0;i<n;i++){
        cin>>v[i][0]>>v[i][1]>>v[i][2];
    }
    cout<<hp(v,dp,n)<<"\n";

	return 0;
}


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

int main(){
  long long A,V,B,W,T; cin >> A >> V >> B >> W >> T;
  long long diff=(A>B?A-B:B-A);
  if(W>=V) cout << "NO" << endl;
  else if((V-W)*T>=diff) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3632
import sys
from collections import deque
import copy
def main():
    x, N = map(int, input().split())
    if N == 0:
        print(x)
        sys.exit()
    p = [int(i) for i in input().split()]
    p.sort()
    min_ = 1000
    index_ = N
    count = [0] * 102
    for i in range(N):
        count[p[i]] = 1
    for i in range(102):
        if count[i] == 1:
            continue
        if min_ > abs(i - x):
            min_ = abs(i - x)
            index_ = i
    if min_ > abs(-1 - x):
        index_ = -1
    print(index_)


if __name__ == '__main__':
    main()


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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	int n;
	cin >> n;
	
	string s;
	cin >> s;
	
	vi w(n , 0), e(n , 0);
	rep(i , n){
		(s[i] == 'W' ? w : e)[i] = 1;
		if(i > 0){
			e[i] += e[i - 1];
			w[i] += w[i - 1];
		}
	}
	
	int ans = n;
	rep(i , n){
		int l = (i ? w[i - 1] : 0);
		int r = e[n - 1] - e[i];
		ans = min(ans , l + r);
	}


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

Measured memory_bytes: 2964
import sys
from collections import deque

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    graph = [[] for _ in range(N)]
    for _ in range(M):
        A, B = map(int, readline().split())
        A -= 1; B -= 1
        graph[A].append(B)
        graph[B].append(A)
    trace = [-1]*N
    trace[0] = 0

    que = deque([0])
    while True:
        fr = que.popleft()
        for to in graph[fr]:
            if trace[to] != -1:
                continue
            trace[to] = fr
            que.append(to)
        if len(que) == 0:
            break

    if -1 in trace:
        print('No')
        return

    print('Yes')
    for t in trace[1:]:
        print(t+1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 34740
import glob


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\135\\C'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'


class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class C(Common):

    def resolve(self):

        N = int(self.input_data())
        monster = [int(i) for i in self.input_data().split()]
        saver = [int(i) for i in self.input_data().split()]

        result = 0
        remaining = 0

        for i in range(N):
            if saver[i] + remaining > monster[i]:
                result += monster[i]
                remaining = saver[i] + remaining - monster[i]
                if remaining > saver[i]:
                    remaining = saver[i]
            else:
                result += saver[i] + remaining
                remaining = 0

        if remaining > monster[N]:
            result += monster[N]
        else:
            result += remaining

        print(str(result))


solver = C(REL_PATH)
solver.exec_resolve()


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

#define ll long long int
#define f(i,n) for(ll i = 0; i < n ; i++)
#define fn(i,n) for(ll i = 1; i < n ; i++)
#define F first 
#define pb push_back
#define S second
using namespace std;
ll dp[3005][3005];
char a[1001][1001];
ll r = 10000000, c = 10000000;
ll mn = INT_MAX;
ll mx = 1000000007;

ll numberOfPaths(ll n, ll m) 
{ 
    f(i,n)
    dp[i][0] = 1;

    for(ll j = 0; j < m; j++)
      dp[0][j] = 1;

     f(i,n)
         for(ll j = 0; j < m; j++)
          if(a[i][j] == '#')
            dp[i][j] = 0;


    fn(i,n)
         for(ll j = 1; j < m; j++)
            {
              if(dp[i][j] == 0)
                continue;

                dp[i][j] = (dp[i-1][j]%mx + dp[i][j-1]%mx)%mx;
            }
    
     
    return dp[n-1][m-1] ;//= (numberOfPaths(n - 1, m)%mx + numberOfPaths(n, m - 1)%mx)%mx; 
    
} 


 
int main()
{

     #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
     #endif
     
         ll n,m;
         memset(dp,-1,sizeof(dp));
         cin>>n>>m;

         f(i,n)
         for(ll j = 0; j < m; j++){
            cin>>a[i][j];
            if(i == 0 &&a[i][j] == '#' && r == 10000000)
              r = j;
            if(j == 0 && a[i][j] == '#' && c == 10000000)
              c = i;
            
         }

         while(r < m){
              a[0][r] = '#'; r++;}
          while(c < n){
              a[c][0] = '#'; c++;}
           
         
         

         //ll p[n],w[n];
        
         //string s1,s2; cin>>s1>>s2;
         //ll n = s1.length();
         //ll m = s2.length();
         //f(i,10) dp[i] = 100;
         //memset(dp,-1,sizeof(dp));
         //sol(s1,s2,n,m);
         
         cout<<numberOfPaths(n,m);
         
         //cout<<dp[0][3]<<endl;
         
        
         
   return 0;
}


Measured memory_bytes: 75144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin >> N;
  vector<int> A(N + 1, 0);
  rep(i, 1, N + 1) {
    cin >> A[i];
  }
  int now = 1;
  int ans = 1;
  rep(i, 0, N) {
    if (A[now] == 2) {
      cout << ans << endl;
      return 0;
    } else {
      now = A[now];
    }
    ++ans;
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define llenar(a,val)   memset(a,val,sizeof(a))
#define pb          push_back 
#define endl        "\n"
#define mostrar(x,y) cout<<x<<" "<<y<<endl;
#define f           first
#define s           second
#define mod         1000000007
#define EPS         1e-9
using namespace std;
typedef pair<int,int> ii;
typedef pair<pair<int,int>,int> iii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef long long ll;
typedef vector< pair<pair<int,int>,int> > viii;




int main(){
    ofstream out("output.txt");
    			
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];

    int b[n];
	b[n-1] = 0;
	int minimo = b[n-1];
	for(int i = n-2;i>=0;i--){
		if(a[i+1]<=a[i]){
			b[i] = b[i+1]+1;
		}
		else{
			b[i] = 0;
		}
	}
	int maximo = 0;
	for(int i =0;i<n;i++){
		//cout<<b[i]<<" ";
		maximo = max(maximo,b[i]);
	}
	cout<<maximo<<endl;	

    return 0;
}

 
 







Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll a,b,x;cin>>a>>b>>x;
    if(a>x)return cout<<"NO"  , 0;
    ll req = x-a;
    cout<<( req<=b ? "YES" : "NO" );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int N,M;
  cin >> N >> M;
  Graph G(N);
  REP(i,M){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<int> dist(N, -1);
  vector<int> idxs(N, -1);
  queue<int> que;
  dist[0] = 0;
  que.push(0);
  while (!que.empty()) {
    int v = que.front();
    que.pop();
    
    int idx = G[v][0];
	int dst = 1e9;
    for (int nv : G[v]) {
      if (dist[nv] != -1){
        if(dst >= dist[nv]){
          dst = dist[nv];
          idx = nv;
        }
        continue;
      }
      dist[nv] = dist[v] + 1;
      que.push(nv);
    }
    idxs[v] = idx;
  }
  string yn = "Yes";
  for(auto d : dist){
    if(-1 == d) yn = "No";
  }
  cout << yn << endl;
  for(int i=1; i<N; i++){
    cout << idxs[i]+1 << endl;
  }
}

Measured memory_bytes: 10648
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
typedef long long int ll;
#define REP(i,n) for(int i=0;i<signed(n);i++)
using namespace std;
const ll MOD = 1000000007;
const ll INF = 9e9;
ll N, M, ans = INF;
ll A[300010], S[301000];

int main() {
	fill(begin(A), end(A), 0);
	fill(begin(S), end(S), 0);
	N = M = 0;
	std::ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> A[i];
		S[i] += A[i];
		S[i + 1] = S[i];
	}
	//a:右半分の区切り i:真ん中 b:左半分
	//s:右の和 t:左の和
	ll a = 0, b = 2, s, t;
	REP(i, N - 1) {
		if (i == b)b++;
		s = (S[i] - S[a]) - S[a];
		t = (S[N - 1] - S[b]) - (S[b] - S[i]);
		bool f = true;
		if (i == 0)continue;
		while (f) {
			f = false;
			if (a + 1 == i)continue;
			if (abs(s)>abs(s - A[a + 1] * 2)) {
				s -= A[a + 1] * 2;
				a++; f = true;
			}
		}
		f = true;
		while (f) {
			f = false;
			if (b + 1 == N - 1 || b == N - 1)continue;
			if (abs(t)>abs(t - A[b + 1] * 2)) {
				t -= A[b + 1] * 2;
				b++; f = true;
			}
		}
		ans = min(ans, (max({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })
			- min({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })));
	}
	cout << ans << endl;
	cin >> a;
	return 0;
}


Measured memory_bytes: 5120
from collections import Counter
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    S = input()
    ans = 0
    r, g, b = [0 for _ in range(N+1)], [0 for _ in range(N+1)], [0 for _ in range(N+1)]
    for i in range(N):
        r[i+1], g[i+1], b[i+1] = r[i], g[i], b[i]
        if S[i] == "R":
            r[i+1] += 1
        elif S[i] == "G":
            g[i+1] += 1
        else:
            b[i+1] += 1
    
    for i in range(1, N-1):
        if S[i] == "R":
            ans += g[i] * (b[N] - b[i+1]) + b[i] * (g[N] - g[i+1])
            for j in range(1, min(i, N-i-1)+1):
                if {S[i-j], S[i+j]} == {"G", "B"}:
                    ans -= 1
        
        elif S[i] == "G":
            ans += r[i] * (b[N] - b[i+1]) + b[i] * (r[N] - r[i+1])
            for j in range(1, min(i, N-i-1)+1):
                if {S[i-j], S[i+j]} == {"R", "B"}:
                    ans -= 1
        elif S[i] == "B":
            ans += g[i] * (r[N] - r[i+1]) + r[i] * (g[N] - g[i+1])
            for j in range(1, min(i, N-i-1)+1):
                if {S[i-j], S[i+j]} == {"G", "R"}:
                    ans -= 1
    print(ans)

main()

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

#define rep(i, n) for (int32_t i = 0; i < n; ++i)
#define repl(i, n) for (int64_t i = 0; i < n; ++i)

using namespace std;

int main() {
  /* code */
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c || a != b && b != c && c != a) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 998244353
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li H, W;
li h, w;


int main() {
    cin >> H >> W;
    cin >> h >> w;

    if (W % w == 0 && H % h == 0) {
        puts("No");
        return 0;
    }

    li base = 500 * 500 * 2;

    if (h == 1) {
        puts("Yes");
        rep(i, H) {
            rep(j, W) {
                cout << (j % w == w - 1 ? -base * (w - 1) - 1 : base) << " ";
            }
            cout << endl;
        }
        return 0;
    }

    if (w == 1) {
        puts("Yes");
        rep(i, H) {
            rep(j, W) {
                cout << (i % h == h - 1 ? -base * (h - 1) - 1 : base) << " ";
            }
            cout << endl;
        }
        return 0;
    }
    puts("Yes");
    rep(i, H) {
        rep(j, W) {
            if (H % h > 0) {
                cout << (i % h == h - 1 ? -base * (h - 1) - 1 : base) << " ";
            } else {
                cout << (j % w == w - 1 ? -base * (w - 1) - 1 : base) << " ";
            }
            cout << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  string A;
  cin >> A;
  string B;
  cin >> B;

  if (A.size() > B.size())
    cout << "GREATER" << endl;
  else if (A.size() < B.size())
    cout << "LESS" << endl;
  else {
    rep(i, A.size()) {
      if (A[i] > B[i]) {
        cout << "GREATER" << endl;
        return 0;
      } else if (A[i] < B[i]) {
        cout << "LESS" << endl;
        return 0;
      }
    }
    cout << "EQUAL" << endl;
  }
}

Measured memory_bytes: 256
mod = pow(10,9)+7
N,M = map(int,input().split())
A = [int(input()) for i in range(M)]+[mod]
DP = [1]
k = 0
for i in range(1,N+1):
    if i==A[k]:
        DP.append(0)
        k+=1
    else:
        a = DP[i-1]
        b = DP[i-2] if i>1 else 0
        DP.append((a+b)%mod)
print(DP[N]%mod)

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

using namespace std;

//#define FILE_IO

typedef long long LL;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    int N;
    scanf("%d", &N);
    LL s = 0;
    LL ans = 0;
    for(int i = 1; i <= N; i++)
    {
        int x;
        scanf("%d", &x);
        if(x == 0)
        {
            ans += LL(s / 2);
            s = 0;
        }
        else
            s += x;
    }
    ans += LL(s / 2);
    printf("%lld\n", ans);

    return 0;
}


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

int main() {
  long long n;
  cin >> n;

  long long ans = 0;
  if ( n%2 == 0 ) {
    long long t = 10;
    while ( n >= t ) {
      ans += (n/t);
      t *= 5;
    }
  }

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


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


struct Node {
    int key;
    Node *parent,*left,*right;
    };

Node *root,*NIL;

void insert(int key) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = key;
    z->right = NIL;
    z->left = NIL;

    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        }else {
            x = x->right;
        }
    }

    z->parent = y;
    if(y == NIL) {
        root = z;
    }else {
        if(z->key < y->key) {
            y->left = z;
        }else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}

void preorder(Node *u) {
    if(u == NIL) return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}




int main() {

    int N,k;
    cin >> N;
    string s;
    

    for(int i = 0;i < N; i++) {
        cin >> s;
        if(s == "insert") {
            cin >> k;
            insert(k);
        }else {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }

}



Measured memory_bytes: 26524
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int N,X[200010],Y[200010];

signed main(){
  cin>>N;
  for(int t=1;t<=N;t++){
    cin>>X[t];
    Y[t]=X[t];
  }

  sort(Y+1,Y+1+N);

  for(int t=1;t<=N;t++){
    if(X[t]<=Y[N/2]){
      cout<<Y[N/2+1]<<"\n";
    }else if(X[t]>=Y[N/2+1]){
      cout<<Y[N/2]<<"\n";
    }
  }

  return 0;
}


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

int main(){
  int n; cin >>n;
  vector<int> a(n);
  ll ans = 1000;
  rep(i,n) cin >>a[i];
  rep(i,n-1){
    ll stocks = 0;
    if(a[i]<a[i+1]) stocks = ans/a[i];
    ans += (a[i+1]-a[i])*stocks;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636