akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>


  int solve(int i, int n,int m, int a[2000]){
  int res;
  if (m == 0)
    return 1;
  if (i >= n)
    return 0;
  res = solve(i+1,n,m,a) || solve(i+1,n,m-a[i],a);
  return res;
}
int main(){
  int i,n,q,a[2000],m[2000];
  scanf("%d",&n);
  for (i = 0 ;i < n; i++) 
    scanf("%d",&a[i]);
  scanf("%d",&q);
  for(i = 0; i < q; i++)
    scanf("%d",&m[i]);
  for (i = 0; i< q; i++) {
    if (solve(0,n,m[i],a))
      printf("yes\n");
    else
      printf("no\n");
  }
  return 0;
}
  

Measured memory_bytes: 1796
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int n;
    cin >> n;
    cout << 48 - n << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;



int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int x, y;
	cin >> x >> y;
	
	c *= 2;
	int ans = c*max(x,y);
	for (int i = max(x, y); i >= 0; i--) {
		int t;
		t = i * c + max(0, x - i)*a + max(0, y - i)*b;
		ans = min(ans, t);
	}
	cout << ans << endl;
	return 0;
}


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

struct P {
    bool operator<(const P& p) const {
        return s < p.s;
    }
    int s, t, c;
};

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

    int n, c;
    cin >> n >> c;

    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i].s >> p[i].t >> p[i].c;
    }

    sort(p.begin(), p.end());

    int m = 0;
    P r[30] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= m; j++) {
            if (r[j].t + (r[j].c != p[i].c) <= p[i].s) {
                r[j] = p[i];
                if (j == m) m++;
                break;
            }
        }
    }

    cout << m << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>

int main() {
    int N, Y;
    std::cin >> N >> Y;
    for (int x = 0; x <= N; x++) {
        for (int y = 0; x + y <= N; y++) {
            for (int z = 0; x + y + z <= N; z++) {
                if (x + y + z == N && 10000 * x + 5000 * y + 1000 * z == Y) {
                    std::cout << x << ' ' << y << ' ' << z << std::endl;
                    return 0;
                }
            }
        }
    }
    std::cout << "-1 -1 -1" << std::endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;

struct edge{int v,u,c;};
struct vec{int u,c;};
typedef vector<vec> vecV;
typedef vector<edge> vecE;
typedef vector<vecV> graph;

graph path;

struct vertex{
    int dist, v;
    bool operator <(const vertex& r)const{
        return dist > r.dist;
    }
};

int N,M;
const int MAX_N = 110;
const int INF = 1e9;

int D[MAX_N][MAX_N];
bool vsi[MAX_N];

void dijkstra(int S){
    D[S][S] = 0;
    memset(vsi,0,sizeof(vsi));
    priority_queue<vertex> Q;
    Q.push({0,S});
    while(!Q.empty()){
        vertex V = Q.top();
        Q.pop();
        if(vsi[V.v])continue;
        vsi[V.v] = 1;
        for(vec e:path[V.v]){
            if(D[S][e.u] > V.dist + e.c){
                D[S][e.u] = V.dist + e.c;
                Q.push({D[S][e.u],e.u});
            }
        }
    }
}

int main(){
    scanf("%d%d",&N,&M);
    path.assign(N+1, vecV());

    int x,y,z;
    vecE s;
    for(int i=0;i<M;i++){
        scanf("%d%d%d",&x,&y,&z);
        path[x].push_back({y,z});
        path[y].push_back({x,z});
        s.push_back({x,y,z});
    }

    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            D[i][j] = INF;
        }
    }

    for(int i=1;i<=N;i++){
        dijkstra(i);
    }

    int ans = 0;
    for(edge e:s){
        if(D[e.v][e.u] < e.c)ans++;
    }
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 384
from collections import defaultdict
import bisect

s = list(input())
t = list(input())

dic = defaultdict(list)

for i in range(len(s)):
    dic[s[i]].append(i)

loop = 0
mark = -1
for i in t:
    if len(dic[i]) == 0:
        loop = -1
        break
    ind = bisect.bisect_right(dic[i], mark)
    if ind == len(dic[i]):
        ind = 0
        loop += 1
    mark = dic[i][ind]

if loop == -1 :
    print(-1)
else:
    print(loop * len(s) + mark +1)




Measured memory_bytes: 60432
#include <iostream>
#define N 100
#define INFINITY 2000000000
using namespace std;
int n,k,u,v,c,M[N][N],d[N],p[N],mincost,i,j;
string color[N];
void dijkstra(void);
int main(){
  cin >> n;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=-1;
    }
  }
  for(i=0;i<n;i++){
    cin >> u;
    cin >> k;
    for(j=0;j<k;j++){
      cin >> v >> c;
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}
void dijkstra(){
  for(i=0;i<n;i++) color[i]="WHITE",d[i]=INFINITY;
  d[0]=0;
  p[0]=-1;
  while(1){
    mincost=INFINITY;
    for(i=0;i<n;i++){
      if(color[i]!="BLACK"&&d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==INFINITY) break;
    color[u]="BLACK";
    for(i=0;i<n;i++){
      if(color[i]!="BLACK"&&M[u][i]!=-1){
	if(d[u]+M[u][i]<d[i]){
	  d[i]=d[u]+M[u][i];
	  p[i]=u;
	  color[i]="GLAY";
	}
      }
    }
  }
  for(i=0;i<n;i++) cout << i << ' ' << d[i] << endl;
}

Measured memory_bytes: 1252
import java.io.*;
public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] data = br.readLine().split(" ");
		
		int a = Integer.parseInt(data[0]);
		int b = Integer.parseInt(data[1]);
		
		System.out.println(a>b ? "a > b" : a<b ? "a < b" : "a == b"); 
	}
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

using Graph = vector<vector<int>>;

void visit(const Graph &g, int v, vector< vector<int> >& scc,
		   stack<int> &S, vector<bool> &inS,
		   vector<int> &low, vector<int> &num, int& time){
  low[v] = num[v] = ++time;
  S.push(v); inS[v] = true;
  for(auto& e: g[v]) {
    int w = e;
    if (num[w] == 0) {
      visit(g, w, scc, S, inS, low, num, time);
      low[v] = min(low[v], low[w]);
    } else if (inS[w])
      low[v] = min(low[v], num[w]);
  }
  if (low[v] == num[v]) {
    scc.push_back(vector<int>());
    while (1) {
      int w = S.top(); S.pop(); inS[w] = false;
      scc.back().push_back(w);
      if (v == w) break;
    }
  }
}
void SCC(const Graph& g,
		 vector< vector<int> >& scc) {
  const int n = g.size();
  vector<int> num(n), low(n);
  stack<int> S;
  vector<bool> inS(n);
  int time = 0;
  REP(u, n) if (num[u] == 0)
    visit(g, u, scc, S, inS, low, num, time);
}

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

  int N;
  while(cin>>N,N){
	vector<double> ps(N);
	Graph G(N);
	REP(i,N){
	  cin >> ps[i];
	  int m; cin >> m;
	  REP(j,m){
		int a; cin >> a;
		--a;
		G[i].PB(a);
	  }
	}
	VVI scc;
	SCC(G, scc);
	VI gr(N);
	int M = SZ(scc);
	REP(i,M){
	  for(int u: scc[i])
		gr[u] = i;
	}
	vector<set<int>> G_(M);
	REP(i,N){
	  for(int to: G[i])
		if(gr[i] != gr[to])
		  G_[gr[i]].insert(gr[to]);
	}
	VI in(M);
	REP(i,M) for(int to: G_[i]) in[to]++;
	double ans = 1.;
	REP(i,M){
	  if(in[i] == 0){
		double prod = 1.;
		REP(j,N) if(gr[j] == i) prod *= ps[j];
		ans *= 1. - prod;
	  }
	}
	cout << fixed << setprecision(9) << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3372
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();

        for (int i = 1; i <= 200000; i++) {
            if((int)(i * 0.08) == a && (int)(i * 0.10) == b){
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);
    }
}


Measured memory_bytes: 23764
A = [int(input()) for _ in range(5)]
b = []
for i,one in enumerate(A):
    b.append([(one-1)%10,i])
b = sorted(b, key=lambda x:-x[0])
ans = 0
for one in b[:-1]:
    if A[one[1]]%10==0:
        ans+=A[one[1]]
    else:
        ans+=(A[one[1]]//10+1)*10
print(ans+A[b[-1][1]])

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
    const int mod=1e9+7;
    int n;
    cin>>n;
    vector<vector<long long>>dp(n+1,vector<long long>(4));
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        dp[i+1][0]+=dp[i][0]*8%mod;
        dp[i+1][1]+=dp[i][0]%mod;
        dp[i+1][2]+=dp[i][0]%mod;
        dp[i+1][1]+=dp[i][1]*9%mod;
        dp[i+1][3]+=dp[i][1]%mod;
        dp[i+1][2]+=dp[i][2]*9%mod;
        dp[i+1][3]+=dp[i][2]%mod;
        dp[i+1][3]+=dp[i][3]*10%mod;
    }
    cout<<dp[n][3]%mod<<endl;
    return 0;
}

Measured memory_bytes: 73320
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a.sort()
import bisect
c = list(map(int, input().split()))
d = [0] * (n+1)
for i in range(n):
    d[i+1] = a[i]
for i in range(n):
    d[i+1] += d[i]
for i in range(m):
    n = bisect.bisect_right(a,b[i])
    n = d[n]
    if c[i] <= n:
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 65680
s = gets.chomp

tmp = 0
lev = 1
mod = [0] * 2019

s.chars.reverse.each { |c|
  tmp = (c.to_i * lev + tmp) % 2019
  mod[tmp] += 1
  lev = (lev * 10) % 2019
}

puts mod.sum { |m| m * (m - 1) / 2 } + mod[0]


Measured memory_bytes: 26388
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    if(A == B && A == C){
        cout << "No" << endl;
    }
    else if (A == B && A != C)
    {
        cout << "Yes" << endl;
    }
    else if (C == B && A != C)
    {
        cout << "Yes" << endl;
    }
    else if (A == C && B != C)
    {
        cout << "Yes" << endl;
    }
    else if(A != B && B != C && A != C){
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
# DP(動的計画法)
N, M = map(int, input().split())
A = set(int(input()) for _ in range(M))

m = 1000000007

t = [0] * (N + 2)
t[0] = 1
for i in range(N):
    if i in A:
        t[i] = 0
    else:
        t[i + 1] = (t[i + 1] + t[i]) % m
        t[i + 2] = (t[i + 2] + t[i]) % m
print(t[N])


Measured memory_bytes: 17304
#include <math.h>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N, 0);
  for (int i = 0; i < N; ++i) cin >> a[i];

  vector<vector<long long int>> table(N + 1, vector<long long int>(K + 1, 0));
  int mod = pow(10, 9) + 7;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      if (i == 1) {
        if (a[0] >= j)
          table[i][j] = 1;
        else
          table[i][j] = 0;
      } else if (j == 0) {
        table[i][j] = 1;
      } else {
        table[i][j] = table[i - 1][j];
        if (j > a[i - 1]) table[i][j] -= table[i - 1][j - a[i - 1] - 1];
        table[i][j] += mod;
        table[i][j] %= mod;
        table[i][j] += table[i][j - 1];
        table[i][j] %= mod;
      }
    }
  }
  cout << table[N][K];
}

Measured memory_bytes: 80256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AHappyBirthday {
public:
	void solve(istream& in, ostream& out) {
        int a, b;
        in >> a >> b;
        if(a <= 8 && b <= 8) out << "Yay!" << endl;
        else out << ":(" << endl;
	}
};

int main() {
	AHappyBirthday solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int k,n;
	int a[100000];
	while (cin>>n>>k,n!=0&&k!=0) {
		long long sum=0,max;
		for (int i=0; i<k; i++) {
			cin>>a[i];
			sum+=a[i];
		}
		max=sum;
		for (int i=k; i<n; i++) cin>>a[i];
		for (int i=k; i<n; i++) {
			sum=sum+a[i]-a[i-k];
			max=sum>max?sum:max;
		}
		cout<<max<<endl;
	}
}

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define FILL(a, b) memset(a, b, sizeof(a))

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
const int INF = 0x3F3F3F3F;
const int MOD = 1e9 + 7;
const int MAX = 2e5 + 5;

int D, G;
int p[11], c[11];

int main() {
    
    scanf("%d%d", &D, &G);
    G /= 100;
    for (int i = 1; i <= D; i++) {
        scanf("%d%d", &p[i], &c[i]);
        c[i] /= 100;
    }
    
    int best = INF;
    for (int m = 0; m < (1 << D); m++) {
        int curr = 0, currN = 0;
        for (int i = 1; i <= D; i++) {
            if (m & (1 << (i - 1))) {
                curr += i * p[i] + c[i];
                currN += p[i];
            }
        }
        for (int i = D; i >= 1 && curr < G; i--) {
            if (!(m & (1 << (i - 1)))) {
                int n = min(p[i] - 1, (G - curr + 1) / i);
                curr += i * n;
                currN += n;
                //printf("%d %d %d\n", i, curr, currN);
            }
        }
        if (curr >= G) {
            best = min(best, currN);
        }
        //printf("\n");
    }
    printf("%d\n", best);
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main() {
    abc166c()
}

fun abc166c() {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    sc.nextLine()
    val height = sc.nextLine().split(" ").map { it.toInt() }.toIntArray()
    val neighbor = Array<MutableSet<Int>>(n) { mutableSetOf()}
    for (i in 1..m) {
        val a = sc.nextInt() - 1
        val b = sc.nextInt() - 1
        neighbor[a].add(b)
        neighbor[b].add(a)
    }
    var count = 0
    for ((i, e) in neighbor.withIndex()) {
        var hasHeigher = false
        for (s in e) {
            if (height[i] <= height[s]) {
                hasHeigher = true
                break
            }
        }
        if (!hasHeigher) count++
    }
    println(count)
}

Measured memory_bytes: 93752
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int A = in.nextInt();
		if(N%500>A) {
			System.out.println("No");
		}
		else {
			System.out.println("Yes");
		}
		in.close();
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

vector <int> vec;

typedef long long ll;
typedef pair<ll, ll> pl;
typedef vector <ll> vl;
typedef set <ll> sl;
typedef vector <pair <ll, ll>> vll;
typedef map <string, int> msi;

string s, s1;
int n, beg, kol, ans;


int main() {
	ios::sync_with_stdio(false);


	cin >> n;
	cin >> s;
	int balance = 0;
	
	for (int i = 0; i < n; i++)
	{
		if (s[i] == ')')
		{
			if (balance <= 0)
				beg++;
			else
				balance--;
		}
		else
		{
			balance++;
		}
	}
	for (int i = 0; i < beg; i++)
		cout << '(';
	cout << s;
	for (int i = 0; i < balance; i++)
		cout << ')';

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int n,k,ans;

int main(){
	cin>>n>>k;
	if(n%k==0)printf("0\n");
	else printf("1\n");
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        if (X == 7 || X == 5 || X == 3){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}



Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int n,m ;
    cin >> n >> m ;
    int mi = 1 ;
    int M = n;
    int l,r ;
    for (int i = 0; i < m; i++)
    {
        cin >> l >> r ;
        mi = max(mi,l) ;
        M = min(M,r) ;
    }
    
    cout << max(M-mi+1,0) << endl;
    
    
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int X,Y;
  cin >> X >> Y;
  bool check=false;
  for(int i=0;i<X+1;i++){
    if(2*i+4*(X-i)==Y){
      check = true;
    }
  }
  if(check){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};


int main(void) {
  string s,t;
  cin >> s >> t;
  cout << t << s << endl;
  
  
  
         
         
  
}


Measured memory_bytes: 256
s = input()
q = int(input())

from collections import deque
s = deque(s)
count = 0
for i in range(q):
    query = input()
    if query == "1":
        count += 1
    else:
        t,f,c = query.split()
        if f == "1":
            if count % 2 == 0:
                s.appendleft(c)
            else:
                s.append(c)
        else:
            if count % 2 == 0:
                s.append(c)
            else:
                s.appendleft(c)
s = "".join(s)
if count % 2 == 0:
    print(s)
else:
    print(s[::-1])

Measured memory_bytes: 102772
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<vector<int>> dist(210,vector<int>(210,inf));
int main(){
    cout << fixed << setprecision(10);
    int n,m,r;
    cin >> n >> m >> r;
    vector<int> des(r);
    rep(i,r) cin >> des[i];
    rep(i,r) des[i]--;
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        dist[a][b] = c;
        dist[b][a] = c;
    }
    rep(k,n){
        rep(i,n){
            rep(j,n) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        }
    }
    sort(des.begin(),des.end());
    int ans = inf; 
    do{
        int now = 0;
        rep(i,r-1){
            now += dist[des[i]][des[i+1]];
        }
        ans = min(now,ans);
    }while(next_permutation(des.begin(),des.end()));
    //N!の順列の全探索
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3804
#include<iostream>
using namespace std;
long long a[200010],ans;
int n;
int main()
{
    cin>>n;
    int i;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=2;i<=n;i++)
    {
        if(a[i]<a[i-1])
        {
            ans+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<ans;
    system("pause");
    return 0;
}


Measured memory_bytes: 5244
#include<bits/stdc++.h>
using namespace std;
long long N,M,K;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> N >> M >> K;
	K = min(K,M - 1);
	cout << N * K / M - N * (K / M) << endl;
}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<math.h>
#include<limits.h>
using namespace std;


int main(){


long long x;
cin>>x;
long long count=0;
if(x%11==0){

count=x/11*2;
}

else if(x % 11<=6){
    count=x/11*2+1;
}

else {
    count=x/11*2+2;
}

cout<<count;
return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	int n=read();
	rep(i,1,9)
		rep(j,1,9)
			if (i*j==n) {puts("Yes");return 0;}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
/*    特徴    */

/*    教訓    */

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

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //



// --------- library end - //


int main(){

  ll N, K;
  cin >> N >> K;
  vector<ll> ps;
  rep(i, N){
    ps.push_back(il());
  }

  sort(begin_end(ps));
  ll ans = 0;
  rep(i, K){
    ans += ps[i];
  }

  cout << ans << endl;

  
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class T> struct Dinic {
  struct Edge { int to, rev; T cap; };
  const T inf = numeric_limits<T>::max();
  const int n;
  VV<Edge> g;
  V<> dist, i;
  Dinic(int n) : n(n), g(n), dist(n), i(n) {}
  void add_edge(int from, int to, T cap, T rcap = 0) {
    assert(from != to);
    assert(cap >= 0);
    if (!cap) return;
    g[from].emplace_back(Edge{to, (int)g[to].size(), cap});
    g[to].emplace_back(Edge{from, (int)g[from].size() - 1, rcap});
  }
  void bfs(int s) {
    fill(begin(dist), end(dist), -1);
    queue<int> que;
    dist[s] = 0;
    que.push(s);
    while (!que.empty()) {
      int v = que.front(); que.pop();
      for (const auto& e : g[v]) {
        if (dist[e.to] != -1 or !e.cap) continue;
        dist[e.to] = dist[v] + 1;
        que.push(e.to);
      }
    }
  }
  T dfs(int v, int s, T f) {
    if (v == s) return f;
    for (; i[v] < (int)g[v].size(); ++i[v]) {
      Edge& e = g[v][i[v]];
      if (dist[e.to] >= dist[v] or !g[e.to][e.rev].cap) continue;
      T d = dfs(e.to, s, min(f, g[e.to][e.rev].cap));
      if (d > 0) {
        g[e.to][e.rev].cap -= d;
        e.cap += d;
        return d;
      }
    }
    return 0;
  }
  T max_flow(int s, int t) {
    assert(s != t);
    T res = 0;
    while (true) {
      bfs(s);
      if (dist[t] == -1) return res;
      fill(begin(i), end(i), 0);
      while (true) {
        T f = dfs(t, s, inf);
        if (!f) break;
        res += f;
      }
    }
  }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  int s[2], t[2];
  for (int i = 0; i < 2; ++i) {
    cin >> s[i] >> t[i], --s[i], --t[i];
  }
  V<> u(m), v(m);
  for (int i = 0; i < m; ++i) {
    cin >> u[i] >> v[i], --u[i], --v[i];
  }

  auto solve = [&]() -> int {
    int S = n, T = n + 1;
    Dinic<int> g(T + 1);
    for (int i = 0; i < 2; ++i) {
      g.add_edge(S, s[i], m);
      g.add_edge(t[i], T, m);
    }
    for (int i = 0; i < m; ++i) {
      g.add_edge(u[i], v[i], 1, 1);
    }
    return g.max_flow(S, T);
  };

  int res = solve();
  swap(s[1], t[1]);
  res = min(res, solve());
  cout << res << '\n';
}


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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using V = vector<T>;
using P = pair<int, int>;

/*
 */

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

  V<int> a(n);
  rep(i, 0, n) cin >> a[i];

  map<int, int> cnt;
  rep(i, 0, n){
    cnt[a[i]]++;
  }

  int ans = 0;
  for(auto i : cnt){
    ans += i.second*(i.second-1)/2;
  }

  rep(k, 0, n){
    int t = cnt[a[k]];
    int tmp = t*(t-1)/2;
    cout << ans - tmp + (t-1)*(t-2)/2 << endl;;
  }

  return 0;
}



Measured memory_bytes: 11008
#include<bits/stdc++.h>
using namespace std;
int a,now,ans,n;
int main()
{
	cin>>n;
	for(int s=0;s<n;s++)
	{
		cin>>a;
		if(a>now)ans=ans+a-now;
		now=a;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
card = [list(map(int, input().split())) for _ in range(3)]
n = int(input())


for _ in range(n):
    b = int(input())
    for row in range(3):
        for col in range(3):
            if b == card[row][col]:
                card[row][col] = 0

result = "No"

for i in range(3):
    if card[i][0] == 0 and card[i][1] == 0 and card[i][2] == 0:
        result = "Yes"
        break
    if card[0][i] == 0 and card[1][i] == 0 and card[2][i] == 0:
        result = "Yes"
if result == "No":
    if card[0][0] == 0 and card[1][1] == 0 and card[2][2] == 0:
        result = "Yes"
    elif card[0][2] == 0 and card[1][1] == 0 and card[2][0] == 0:
        result = "Yes"

print(result)


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


using namespace std;

typedef struct {
  int h, w;
} POINT;

int main(void) {
  POINT *map;
  int *dist;
  int h, w;
  int d, diff;
  int q;
  int l, r;
  int tmp;
  int mp;
  
  scanf("%d%d%d", &h, &w, &d);
  map = new POINT[h * w + 1];
  dist = new int[h * w + 1];
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      scanf("%d", &tmp);
      map[tmp].h = i;
      map[tmp].w = j;
      dist[tmp] = -1;
    }
  }
  
  for (int i = 1; i <= d; i++) {
    dist[i] = 0;
    for (int j = i + d; j <= h * w; j += d) {
      dist[j] = dist[j-d] + abs(map[j].h - map[j-d].h) + abs(map[j].w - map[j-d].w);
    }
  }
    
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &l, &r);
    printf("%d\n", dist[r] - dist[l]);
  }
  return 0;
}
      

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define DEBUG

#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define REPR(i, n) for(ll i = n; i >= 1; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define INF 1e9+123
#define VEC(type,A,N) vector<type> A(N+10)
#define VECi(type,A,N,i) vector<type> A(N+10,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N+10,vector<type>(M+10))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N+10,vector<type>(M+10,i))
#define ALL(v) v.begin()+1, v.end()-9
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
int main(){
    ll N;
    cin>>N;
    
    int count=1;
    REP(i,N){
        int a;
        cin>>a;
        if(a==count)count++;
        //s(i,a,count);sl();
        
    }
    if(count==1)cout<<-1;
    else cout<<N-count+1;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
#include <cmath>
#include <stack>
#include <bitset>
#include <queue>

using namespace std;

#define int long long
#define MAX 1e18

signed main() {
    string s,t;
    cin >> s >> t;

    for(int i = 0; i < 26; i++) {
        if(s + char('a' + i) == t) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, thousand, hundred, ten, one;
  cin >> N;
  thousand = N / 1000;
  hundred = N / 100 % 10;
  ten = N / 10 % 10;
  one = N % 10;
  // cout << thousand << "|" << hundred << "|" << ten << "|" << one << endl;
  
  // 全部同じ場合
  if (thousand == hundred && thousand == ten && thousand == one) {
    cout << "Yes" << endl;
  }
  // 3つが同じ場合①
  else if (thousand == hundred && thousand == ten) {
    cout << "Yes" << endl;
  }
  // 3つが同じ場合②
  else if (hundred == ten && hundred == one) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
data = [int(x) for x in input().split(' ')]

bs = []
for i in range(n):
    if i != n-1:
        if data[i] < data[i+1]:
            bs.append('b')
        else:
            bs.append('s')
    else:
        bs.append('s')

money = 1000
units = 0
for i in range(n):
    if bs[i] == 'b':
        units += money // data[i]
        money = money % data[i]
    else:
        money += data[i] * units
        units = 0

print(money)

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

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

    int number=0,min=0;

    for(int i=0; i<s.size()-2; i++){
        number=stoi(s.substr(i,3));
        if(abs(number-753)<min|| min==0){
            min=abs(number-753);
        }
    }

    cout<<min<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
#define H 500000
 
int maxHeapify(int*,int);
int x;
 
int main(){
 
  int i,A[H];
 
  scanf("%d",&x);
  for(i=1; i<=x; i++)
    scanf("%d",&A[i]);
 
  for(i=x/2; i>=1; i--){
    maxHeapify(A,i);
  }
 
  for(i=1; i<=x; i++){
    printf(" %d",A[i]);
  }
  printf("\n");
 
  return 0;
}
 
int maxHeapify(int *A,int i){
 
  int l,r,largest,temp;
 
  l = 2*i;
  r = 2*i+1;
 
  if(l <= x && A[l] > A[i]){
    largest = l;
  }else largest = i;
 
  if(r <= x && A[r] > A[largest]){
    largest = r;
  }
 
  if(largest != i){ 
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
   
  maxHeapify(A,largest);
  }
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
ll repow(ll k,ll n)
{
    ll ans=1;
    for(int i=0;i<n;i++)
    {
        ans= (((ans)*k) )%mod;
    }
    return ans;
}
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n],b[n],c[n],tm=1;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        c[i]=a[i];
    }
    for(int i=0;i<n;i++)
       {
          cin>>b[i];
          if(b[i]>a[i] && tm==1)
          {
              tm=0;
          }
       }
    sort(c,c+n);
    int ain,bin,ans=0;
    do{
            int ai=1,bi=1;
        for(int i=0;i<n;i++)
        {
           if(c[i]!=a[i])
           {
               ai=0;
           }
           if(c[i]!=b[i])
           {
               bi=0;
           }
        }
        if(ai+bi>=1)
        {
            if(ai)
                ain=ans;
            if(bi)
                bin=ans;
        }

        ans++;

    }
    while(next_permutation(c,c+n));
    //cout<<ain<<" "<<bin<<" ";
    cout<<abs(ain-bin);
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, c;
    cin >> a >> b >> c;
    if( ( b * 10 + c ) % 4 ) cout << "NO";
    else cout << "YES";
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
import sys
from fractions import gcd

N = int(input())
input = sys.stdin.readline().rstrip()
A = list(map(int, input.split()))

L = [0] * N  # 左からi番目までのgcdをメモった配列
R = [0] * N  # 右からi番目までのgcdをメモった配列
L[0] = A[0]
R[0] = A[N - 1]
for i in range(1, N):
    L[i] = gcd(L[i - 1], A[i])
    R[i] = gcd(R[i - 1], A[N - 1 - i])

ans = 0
for i in range(N - 2):
    ans = max(ans, gcd(L[i], R[N - i - 3]))
ans = max(ans, R[N - 2])
ans = max(ans, L[N - 2])
print(ans)

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

int main(void){
  int i,j,k,n,s;
  char ca[201],can[201];

  while(1){
    scanf("%s\n%d", ca, &n);
    if(!strcmp(ca, "-")) break;
   
    for(i=0;i<n;i++){
      scanf("%d", &s);
      for(j=s;ca[j]!='\0';j++)
        can[j-s] = ca[j];
      for(k=0;k<s;k++)
        can[j-s+k] = ca[k];
     
      for(j=0;ca[j]!='\0';j++)
        ca[j] = can[j];
    }

    printf("%s\n", ca);
  }

  return 0;
}


Measured memory_bytes: 2104
from sys import stdin
from itertools import accumulate
q = int(stdin.readline().rstrip())
l_r = [list(map(int,stdin.readline().rstrip().split())) for _ in range(q)]
max_n = 0
for s in l_r:
    max_n = max(s[1], max_n)
# print(max_n)
# print(l_r)

a = [i for i in range(max_n+1)]

def isPrime(num):
    if num == 0 or num == 1:
        return False
    ans = True
    for i in range(2,int(num/2)+1):
        if num % i == 0:
            ans = False
            break
    return ans
b = [1] * (max_n+1)
b[0] = 0
b[1] = 0
for i in range(2,max_n+1):
    if b[i]:
        j = i*2
        while j <= max_n:
            b[j] = 0
            j += i
# print(b)
c = [1 if x == 1 and b[int((i+1)/2)] == 1 else 0 for i,x in enumerate(b)] 
# print(c)
s = list(accumulate(c))
# print(len(s))

for i in range(q):
    print(s[l_r[i][1]]-s[l_r[i][0]-1])

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

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

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

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

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

    cin >> s >> k;
    rep(i, Size(s))
    {
        string co;
        rrep(j, i, min((ll)i + k, (ll)Size(s)))
        {
            co += s[j];
            mp[co]++;
            if (mp[co] >= 2)
                continue;
            ans[cnt++] = co;
        }
    }
    sort(ans, ans + cnt);
    Cout(ans[k - 1]);
    return 0;
}


Measured memory_bytes: 9728
w, h, x, y, r = gets.split.map(&:to_i)

left_of_circle = x - r
right_of_circle = x + r
top_of_circle = y + r
bottom_of_circle = y - r

if left_of_circle >= 0 && right_of_circle <= w &&
   top_of_circle <= h && bottom_of_circle >= 0
  puts 'Yes'
else
  puts 'No'
end


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

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )

#define INF 1000000000

void swap(int* x, int *y)
{
	int t;

	t = *x;
	*x = *y;
	*y = t;
}

int binary_search(int p[], int n, int key)
{
	int left, right, middle;

	left = 0;
	right = n-1;


	while (left <= right)
	{
		middle = (left + right) / 2;

		if (p[middle] == key)
			return middle;
		else if (p[middle] > key)
		{
			right = middle - 1;
		}
		else if (p[middle] < key)
		{
			left = middle + 1;
		}
	}

	return -1;

}

void bubble_sort(int p[], int n)
{
	int i, j;

	for (i = 0; i < n-1; i++)
	{
		for (j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[i], &p[i + 1]);
		}
	}
}

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

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

	if (a < b && b < c)
		printf("Yes\n");
	else
		printf("No\n");


}


Measured memory_bytes: 2076
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <regex>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include<tuple>

using namespace std;

const int MAX = 20;
const int DP_MAX = 1001;
const int INF = 1 << 30;



int main() {
	int D, G;
	int p[MAX], c[MAX];
	long long dp[MAX + 1][DP_MAX];

	cin >> D >> G;
	for (int i = 0; i < D; i++) {
		cin >> p[i] >> c[i];
	}

	for (int i = 0; i < MAX + 1; i++) {
		for (int j = 0; j < DP_MAX; j++) {
			dp[i][j] = -1;
		}
	}
	dp[0][0] = 0;

	for (int i = 0; i < D; i++) {
		for (int j = 0; j < DP_MAX; j++) {
			if (dp[i][j] == -1)continue;
	
			for (int k = 0; k < p[i]; k++) {
				if (k == p[i] - 1) {
					dp[i + 1][j + k + 1] = max(dp[i + 1][j + k + 1], dp[i][j] + (i + 1) * 100 * (k + 1) + c[i]);
				}
				else {
					dp[i + 1][j + k + 1] = max(dp[i + 1][j + k + 1], dp[i][j] + (i + 1) * 100 * (k + 1));
				}
			}
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
		}
	}

	for (int i = 0; i < DP_MAX; i++) {
		if (dp[D][i] >= G) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdbool.h>
#define N 1000000

typedef struct{
  bool ch;
  int last;
  int n;
}data;
  

bool prime[1000006]={0};
data nowmap[1505][1505]={0};
int map[1505][1505]={0};
int mapx[1000006]={0};
int mapy[1000006]={0};
//nx=x+d[i],ny=y+d[i^1]
int d[4]={0,1,0,-1};
int m,n,last=-1,maxnum;

data solve(int num);
void setprime();
void set();
void search();

int main(void){
  int i,j,k;
  data ans;
  set();
  setprime();
  while(1){
    scanf("%d %d",&m,&n);
    if(n+m==0)break;
    last = 0;
    maxnum=0;
    search();
    for(i=1;i<=m;i++)nowmap[mapx[i]][mapy[i]].ch=0;
    //printf("max%d\n",maxnum);
    ans = solve(n);
    printf("%d %d\n",ans.n,ans.last);
  }
  /*for(i=1;i<=N;i++){
    if(mapx[i]>1000||mapx[i]<0)printf("x%d %d\n",i,mapx[i]);
    if(mapy[i]>1000||mapy[i]<0)printf("y%d %d\n",i,mapy[i]);
    }*/
  return 0;
}

void set(){
  int i,j=0,nowx=500,nowy=500,count=1,dir=1;
  map[500][500]=1;
  mapx[1]=500;
  mapy[1]=500;
  for(i=1;;i++){
    for(j=1;j<=i;j++){
      nowx+=d[dir];
      nowy+=d[dir^1];
      map[nowx][nowy]=++count;
      mapx[count]=nowx;
      mapy[count]=nowy;
      //if(count==N)printf("%d %d %d %d\n",nowx,nowy,count,dir);
      if(count==N)return;
    }
    dir++;
    dir%=4;
    for(j=1;j<=i;j++){
      nowx+=d[dir];
      nowy+=d[dir^1];
      map[nowx][nowy]=++count;
      mapx[count]=nowx;
      mapy[count]=nowy;
      //if(count==N)printf("%d %d %d %d\n",nowx,nowy,count,dir);
      if(count==N)return;
    }
    dir++;
    dir%=4;
  }
}

void setprime(){
  int i,j;
  prime[0]=1;
  prime[1]=1;
  for(i=2;i<=N;i++){
    if(prime[i]==1)continue;
    for(j=2;i*j<=N;j++)prime[i*j]=1;
  }
  //for(i=0;i<=N;i++)printf("%d ",prime[i]);
}

data solve(int num){
  int x=mapx[num],y=mapy[num];
  int i,nextx=x,nexty=y+1;
  data d,rd;
  bool ch=0;
  rd.ch=1;
  rd.last=0;
  rd.n=0;
  if(nowmap[x][y].ch==1)return nowmap[x][y];
  //nowmap[x][y]=next;
  for(i=-1;i<=1;i++){
    nextx = x + i;
    if(map[nextx][nexty]==0||map[nextx][nexty]>m)continue;
    ch=1;
    d=solve(map[nextx][nexty]);
    if(rd.n<d.n||(rd.n==d.n&&rd.last<d.last)){
      rd.last=d.last;
      rd.n=d.n;
    }
  }
  if(prime[num]==0){
    rd.n++;
    if(rd.last==0)rd.last=num;
  }
  nowmap[x][y]=rd;
  return rd;
}

void search(){
  int count=0,x=mapx[n],y=mapy[n];
  while(map[x][y]<=m&&map[x][y]>=1){
    y++;
    count++;
  }
  maxnum=count+1;
}



Measured memory_bytes: 32228
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n, x[105], y[105], h[105], x1, y1, h1, id;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d%d%d", &x[i], &y[i], &h[i]);
    if(h[i]) x1 = x[i], y1 = y[i], h1 = h[i], id = i;
  }
  for(int i = 0; i <= 100; i++){
    for(int j = 0; j <= 100; j++){
      int hi = h1 + abs(x1 - i) + abs(y1 - j), b = 1;
      for(int k = 0; k < n; k++){
        if(k == id) continue;
        if(max(0, hi - abs(i-x[k]) - abs(j-y[k])) != h[k]) b = 0;
      }
      if(b) printf("%d %d %d\n", i, j, hi);
    }
  }
}

Measured memory_bytes: 256
class in{struct myIterator{int it;const bool rev;explicit constexpr myIterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(myIterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const myIterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const myIterator& begin(){return i;}const myIterator& end(){return n;}};

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

using i64 = long long;
i64 calc(i64& mean, const vector<i64>& vec, vector<i64>& ma) {
    i64 res = 0LL;
    for(int i : in(vec.size())) {
        i64 t = vec[i];
        i64 plus = mean > t ? mean - t : t - mean;
        ma[i] += plus;
        res += plus << 1LL;
    }
    return res;
}
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    i64 w, h, n;
    cin >> w >> h >> n;
    vector<i64> xcoord(n), ycoord(n);
    for(int i : in(n))
      cin >> xcoord[i] >> ycoord[i];
    auto sortx = xcoord, sorty = ycoord;
    sort(sortx.begin(), sortx.end());
    sort(sorty.begin(), sorty.end());
    vector<i64> midId = {n / 2};
    if(~n & 1) midId.emplace_back(n / 2 - 1);
    tuple<i64, i64, i64> ans(1e18, 0LL, 0LL);
    for(auto id1 : midId) for(auto id2 : midId) {
        i64 x = sortx[id1], y = sorty[id2];
        vector<i64> ma(n, 0LL);
        i64 sum = calc(x, xcoord, ma) + calc(y, ycoord, ma);
//        cout << x << ' ' << y << ' ' << sum << ' '; for(i64 k : ma) cout << k << ' '; cout << endl;
        sum -= *max_element(ma.begin(), ma.end());
        ans = min(ans, make_tuple(sum, x, y));
    }
    i64 sum, x, y; tie(sum, x, y) = ans;
    cout << sum << '\n' << x << ' ' << y << endl;
    return 0;
}

Measured memory_bytes: 6920
#include<cstdio>
#include<set>
int main(){
  int n;
  scanf("%d", &n);
  std::multiset<int> ms;
  for(int i = 0; i < n; ++i){
    int a;
    scanf("%d", &a);
    ms.insert(a);
  }
  int x = *ms.begin(), y = *ms.rbegin();
  for(int i = 0; i < n; ++i){
    auto itr = ms.find(x ^ y);
    if(itr == ms.end()){
      puts("No");
      return 0;
    }
    ms.erase(itr);
    y ^= x;
    x ^= y;
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
long long n,m,i,j,x,y,flag,book[100005],sd[100005],sum,c,p,ans;
long long top,nex[400005],to[400005],fir[100005];
void lj(int u,int v){
	top++;
	nex[top]=fir[u];
	fir[u]=top;
	to[top]=v;
}
void ss(int v,int w){
	sd[v]=w;
	for(int top1=fir[v];top1;top1=nex[top1])
		if(sd[to[top1]]==0)
			ss(to[top1],w+1);
		else if(sd[v]>sd[to[top1]]){ 
			if((sd[v]-sd[to[top1]]&1)==0)
				flag=1;
		}
}
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
   	n=read();m=read();
   	for(i=1;i<=m;i++){
		x=read();y=read();
		lj(x,y);
		lj(y,x);
		book[x]=1;
		book[y]=1;
	}
	for(i=1;i<=n;i++)
		if(book[i]==0)
			sum++;
	for(i=1;i<=n;i++)
		if(book[i]==1&&sd[i]==0){
			flag=0;
			ss(i,1);
			if(flag==1)
				p++;
			else
				c++;
		}
	ans=sum*n*2-sum*sum+c*c*2+p*(p+c*2);
	pus(ans,2);
    return 0;
}

Measured memory_bytes: 10752