akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)

const int INF = 1<<29;

int W, H, sx, sy, gx, gy;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
vector <vector <int>> maze;

bool inrange(int x, int y) {
	return 0 <= x && x < W && 0 <= y && y < H;
}

int dfs(int x, int y, int cnt) {
	//if (x == gx && y == gy) return cnt;
	if (cnt == 10) return INF;
	int res = INF;
	rep(4, i) {
		int nx = x + dx[i], ny = y + dy[i];
		if (inrange(nx, ny) && maze[ny][nx] == 3) {
			res = min(cnt+1, res);
			continue;
		}
		if (inrange(nx, ny) && maze[ny][nx] != 1) {
			while (inrange(nx+dx[i], ny+dy[i]) && maze[ny+dy[i]][nx+dx[i]] != 1 && maze[ny+dy[i]][nx+dx[i]] != 3) {
				nx += dx[i];
				ny += dy[i];
			}
			if (inrange(nx+dx[i], ny+dy[i]) && maze[ny+dy[i]][nx+dx[i]] == 3) {
				res = min(cnt+1, res);
				continue;
			}
			if (!inrange(nx+dx[i], ny+dy[i])) continue;
			if (maze[ny+dy[i]][nx+dx[i]] == 1) maze[ny+dy[i]][nx+dx[i]] = 0;
			res = min(res, dfs(nx, ny, cnt+1));
			if (maze[ny+dy[i]][nx+dx[i]] == 0) maze[ny+dy[i]][nx+dx[i]] = 1;
			//cout << cnt << ' ' << nx << ' ' << ny << endl;
		}
	}
	return res;
}

void solve(void){
	while (1) {
		cin >> W >> H;
		if (W == 0 && H == 0) break;
		vector <vector <int>> m(H, vector <int> (W, -1));
		maze = m;
		rep(H, i) rep(W, j) {
			cin >> maze[i][j];
			if (maze[i][j] == 2) {
				sx = j, sy = i;
			}
			if (maze[i][j] == 3) {
				gx = j, gy = i;
			}
		}
		int ans = dfs(sx, sy, 0);
		//cout << sx << ' ' << sy << ' ' << gx << ' ' << gy << endl;
		cout << (ans == INF ? -1 : ans) << endl;
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3000
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int32_t main() {
    fast_io();
    int n, x, y;
    cin >> n >> x >> y;
    int ans[n + 10] = {0};
    for (int i = 1; i <= n - 1 ; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            int dist = j - i;
            if ((x >= i) && (y <= j))
            {
                dist -= (y - x);
                dist++;
            }
            else
            {
                int z1 = abs(x - i);
                int z2 = abs(y - j);
                dist = min(dist, z1 + z2 + 1);
            }
            ans[dist]++;
        }
    }
    for (int i = 1; i <= n - 1; i++)
        cout << ans[i] << "\n";
    return 0;
}

Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    K, S = map(int, input().split())

    ans = 0
    for i in range(K+1):
        for j in range(K+1):
            if 0 <= S - (i + j) <= K:
                ans += 1

    return ans


if __name__ == '__main__':
    print(main())


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

#define ll long long

int main(){
           int n,f=0;
	cin >> n;
	while(n){
	    ll y=n%10;
	    if(y==7){
	        f=1;
	        break;
	    }
	    n=n/10;
	}
	if(f==1)
	cout<<"Yes";
	else
	cout<<"No";
//	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////
int main(){
    int n;
    scanf("%d", &n);
    vector<int> h(n);
    for (int& x : h) scanf("%d", &x);
    vector<int> dp(n ,INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j : {i + 1, i + 2}) {
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
        }
    }
    printf("%d\n", dp[n - 1]);
    
    return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class Main{
    public static void main(String[] a){
    	int x = 0;
    	
    	int h = 0;
    	double shikaku = 0;
    	double sankaku = 0;
    	Scanner scan = new Scanner(System.in);
    	while (true){ 
    	x = scan.nextInt();
    	h = scan.nextInt();
    	if (x == 0 && h == 0){
    		break;
    	}
    	shikaku = x*x;
        double takasa =  Math.sqrt(h*h+(x/2)*(x/2));
    	sankaku =  (x*takasa/2*4);
    	double S = x*Math.sqrt(4*h*h+x*x) + x*x;
    	System.out.println(S);
    	}
    }
}

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

int digsum(int x)
{
	int res=0;
	while (x>0)
	{
		res+=x%10;
		x/=10;
	}
	return res;
}

int main()
{
	int n;
	cin>>n;
	cout<<(n%digsum(n)==0 ? "Yes" : "No")<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x) cout << " >> " << #x << " "<<x<<endl;
void Solve_Case()
{
    priority_queue<int> A;
    int n,m;
    cin >> n >> m;
    vector<int> v(n);
    for(auto &i : v) cin >> i;
    for(auto i : v) A.push(i);
    for(int i=0;i<m;i++)
    {
        int element = A.top();
        A.pop();
        A.push(element/2);
    }
    int sum = 0 ;
    for(int i=0;i<n;i++)
    {
        sum += A.top();
        A.pop();
    }
   cout << sum;
}
signed main()
{
    int TestCases=1;

    while(TestCases--)
    {
        Solve_Case();
    }
	return 0;
}


Measured memory_bytes: 2168
var 
  i,loop,target,sum,max: longint;
  arr: array of integer;
 begin
 	max := 1 << 29;
  	read(loop);
    SetLength(arr,loop); // 配列の長さをセット
 	
    for i := 0 to loop -1 do begin 
    	read(arr[i]);
    end;
     
     for i := 0 to loop -1 do begin
     	sum := 0;
        target := arr[i];
        
        while target mod 2 < 1 do begin
        	 
            inc(sum); // インクリメント
         	target := target div 2; // target / 2
            
         end;  
         
         	if max > sum then begin
            	max := sum;
            end;
         	
     	end;
     
     writeln(max);
    
 end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
  int N;
  cin >> N;
  int s[105];
  for(int i = 0; i < N; i++){
    cin >> s[i];
  }
  sort(s,s+N);
  int sum;
  for(int i = 0; i < N; i++){
    sum+= s[i];
  }
  if(sum%10 != 0){
    cout << sum << endl;
    return 0;
  }
  else{
    for(int i = 0; i <N; i++){
      if(s[i]%10!= 0){
        cout << sum-s[i] << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;
  return 0;
}

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

int main() {

    int n;
    char s[100];

    scanf("%d %s", &n, s);

    int isCheck = 1;

    if (n % 2 != 0) {
        isCheck = 0;
    } else {

        int num = n / 2;

        for (int i = 0; i < num; i++) {

            if (s[i] != s[i + num]) {

                isCheck = 0;
                break;
            }

        }

    }
    
    printf("%s",(isCheck==1 ? "Yes" : "No"));


    return 0;

}


Measured memory_bytes: 128
let heisei s =
  let year = int_of_string (String.sub s 0 4) in
  let month = int_of_string (String.sub s 5 2) in
  if year < 2019 || (year = 2019 && month  <= 4) then "Heisei"
  else "TBD"
let () =
  Scanf.scanf "%s\n"
    (fun s -> heisei s) |> print_string

Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
using namespace std;
const int N=1e5+7;
#define ll long long
struct node {
	int v,id;
	bool operator <(node a) {
		if (v!=a.v) return v>a.v;
		return id>a.id; 
	}
}p[N];
int n,id;
ll ans[N];
int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&p[i].v),p[i].id=i;
	sort(p+1,p+n+1);
	id=n;
	for (int i=1;i<=n;i++) {
		id=min(id,p[i].id);
		if (p[i].v!=p[i+1].v) ans[id]+=1ll*i*(p[i].v-p[i+1].v);
	}
	for (int i=1;i<=n;i++) printf("%lld\n",ans[i]);
}

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

#define DEBUG 1

#if (DEBUG == 1)

#endif

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

  vector<vector<char>> a(H, vector<char>(W, '.'));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a.at(i).at(j);
    }
  }

  // row
  vector<int> checked_row;
  for (int i = 0; i < H; i++) {
    bool is_blank = true;
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) == '#') {
	is_blank = false;
      }
    }
    if (is_blank != true) {
      checked_row.push_back(i);
    }
  }

  // col
  vector<int> checked_col;
  for (int j = 0; j < W; j++) {
    bool is_blank = true;
    for (int i = 0; i < H; i++) {
      if (a.at(i).at(j) == '#') {
	is_blank = false;
      }
    }
    if (is_blank != true) {
      checked_col.push_back(j);
    }
  }

  for (int i : checked_row) {
    for (int j : checked_col) {
      cout << a.at(i).at(j);
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Here your code !

import sys
import math

list = ["2","3"]
r = sys.stdin.readlines()

n = [[int(i) for i in (j.split())] for j in r]
#e = [[int(i) for i in input().split()] for i in range(n)] 

for j in n:
    a = sum(j)
    d = int(math.log10(a)) + 1
    print(d)

Measured memory_bytes: 7704
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define srep(i, from, to) for(int i = from; i < (int)(to); i++)

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

  vector<pair<int, int>> abs(n);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    abs[i] = pair<int, int>(a, b);
  }

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

  ll ans = 0;
  priority_queue<int> q;
  int count = 0;
  srep(d, 1, m + 1) {
    srep(i, count, n) {
      if(abs[i].first != d) {
        break;
      }
      q.push(abs[i].second);
      count++;
    }
    if(q.size() > 0) {
      ans += q.top();
      q.pop();
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1660
#include <cstdio>
#include <vector>
#include <stack>
#include <utility>
#include <algorithm>

using namespace std;

const int kNil = -1;

enum class Color {
  kWhite,
  kGrey,
  kBlack,
};

template <class T>
struct Edge {
  using w_type = T;
  Edge(int u, int v, w_type w): u(u), v(v), w(w) { }
  int u, v;
  w_type w;
  bool operator<(const Edge<T> & rhs) const {
    if (w != rhs.w) { return w < rhs.w; }
    if (u != rhs.u) { return u < rhs.u; }
    return v < rhs.v;
  }
};

template <class Edge>
void GetOrder(const typename vector<Edge>::size_type node_now,
       const vector<vector<Edge>> & adjacency_list,
       vector<Color> & color,
       stack<typename vector<Edge>::size_type> & order) {

  color[node_now] = Color::kGrey;
  for (const auto & e: adjacency_list[node_now]) {
    if (color[e.v] == Color::kWhite) {
      GetOrder(e.v, adjacency_list, color, order);
    }
  }
  color[node_now] = Color::kBlack;
  order.push(node_now);
}

template <class Edge>
void DFSVisit(const typename vector<Edge>::size_type node_now,
       const vector<vector<Edge>> & adjacency_list,
       vector<Color> & color,
       vector<typename vector<Edge>::size_type> & component,
       unsigned & component_num) {
  color[node_now] = Color::kGrey;
  for (const auto & e: adjacency_list[node_now]) {
    if (color[e.v] == Color::kWhite) {
      DFSVisit(e.v, adjacency_list, color, component, component_num);
    }
  }
  color[node_now] = Color::kBlack;
  component[node_now] = component_num;
}

template <class Edge>
decltype(auto) StronglyConnectedComponent(const vector<Edge> & edges,
                 typename vector<Edge>::size_type node_num) {
  using size_type = typename vector<Edge>::size_type;

  vector<vector<Edge>> adjacency_list(node_num, vector<Edge>());
  for (const auto & e: edges) {
    adjacency_list[e.u].push_back(e);
  }

  vector<Color> color(node_num, Color::kWhite);
  stack<size_type> order;
  for (unsigned i = 0; i < node_num; ++i) {
    if (color[i] == Color::kWhite) {
      GetOrder(i, adjacency_list, color, order);
    }
  }

  vector<vector<Edge>> adjacency_list_reversed(node_num, vector<Edge>());
  for (const auto & e: edges) {
    adjacency_list_reversed[e.v].emplace_back(e.v, e.u, e.w);
  }
  color = vector<Color>(node_num, Color::kWhite);
  unsigned component_num = 0;
  vector<size_type> component(node_num);
  while (!order.empty()) {
    auto u = order.top();
    order.pop();
    if (color[u] == Color::kWhite) {
      DFSVisit(u, adjacency_list_reversed, color, component, component_num);
      ++component_num;
    }
  }

  return component;
}

int main(int argc, char const *argv[]) {
  using w_type = unsigned;

  vector<Edge<w_type>> edges;
  unsigned V, E;
  scanf("%u %u", &V, &E);
  for (unsigned i = 0; i < E; ++i) {
    unsigned u, v;
    w_type w;
    scanf("%u %u", &u, &v);
    edges.emplace_back(u, v, 1);
  }

  auto component = StronglyConnectedComponent(edges, V);
  unsigned q, u, v;
  scanf("%u", &q);
  for (unsigned i = 0; i < q; ++i) {
    scanf("%u %u", &u, &v);
    if (component[u] == component[v]) {
      printf("%d\n", 1);
    } else {
      printf("%d\n", 0);
    }
  }

  return 0;
}

Measured memory_bytes: 4716
#include <stdio.h>

int main(){
  int i, N, a;
  int cnt = 0;
  
  scanf("%d", &N);
  
  for(i = 1; i <= N; i++){
   scanf("%d", &a);
   if(i == 1 && a%2 == 1) cnt++;
   else if(i % 2 == 1 && a%2 == 1) cnt++;
  }
  
  printf("%d\n", cnt);
  
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const int INF = 1000000000;
int gcd(int p, int q){
  while(q != 0){
  int r = p % q;
  p = q;
  q = r;
  }
  return p;
}

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i,n) cin >> h[i];
  sort(h.rbegin(),h.rend());
  ll ans = 0;
  if(k>=h.size()) {
    cout << 0 << endl;
    return 0;
  }
  else {
    for(ll i = k; i < h.size(); ++i){
      ans += h[i];
    }
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  vll A(N);
  vll B(N);
  REP(i, 0, N) {
    cin >> A[i];
  }
  REP(i, 0, N) {
    cin >> B[i];
  }

  ll ma = 0;
  REP(i, 0, N) {
    ll su = 0;
    REP(j, 0, i+1) {
      su += A[j];
    }
    REP(k, i, N) {
      su += B[k];
    }

    if (ma < su) {
      ma = su;
    }
  }
  cout << ma << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	int c[4] = {};
	for(int i=0; i<6; i++){
		int tmp;
		cin >> tmp;
		tmp--;
		c[tmp]++;
	}
	for(int i=0; i<4; i++){
		if(c[i] > 2){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;

	return 0;
}

/*

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << setprecision(9);



return 0;
}
*/

/*

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << setprecision(9);



return 0;
}
*/

/*

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << std::setprecision(9);



return 0;
}
*/

/*

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << std::setprecision(9);



return 0;
}
*/

/*

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << std::setprecision(9);



return 0;
}
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  LL a,b,n; cin>>a>>b>>n;
  LL x = 0 ;
  if(n>=b){
  		x = b-1;
  }
  else{
  	x = n;
  }
  LL an = ((a*x)/b) - (a*(x/b));
  cout<<an<<endl;
  return 0;
}

Measured memory_bytes: 3652
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))


k=int(input())
s=input()
l=len(s)

if l>k:
    s=s[:k]+"..."

print(s)


Measured memory_bytes: 27132
import java.util.*;

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

		// argumentの取得
		Scanner s = new Scanner(System.in);

		int N = s.nextInt();
        String S = s.next();
        String T = s.next();
      
        // answer
        StringBuilder answer = new StringBuilder();
      
        for (int i=0; i < N; i++){
          answer.append(String.valueOf(S.charAt(i)));
          answer.append(String.valueOf(T.charAt(i)));
        }
           
		// 戻り値の返却
		System.out.println(answer);
	
	} 
}

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

int main() 
{ 
    
        int f=0;
      string s;
      cin>>s;
      for(int i=0;i<4;i++)
      {
      if(s[0]=='B' && s[1]=='B' && s[2]=='B')
      {
        f=1;
      }
      else if(s[0]=='A' && s[1]=='A' && s[2]=='A')
      {
        f=1;
      }
    }
  if(f==1)
  {
    cout<<"No"<<endl;
  }
  else
  {
    cout<<"Yes"<<endl;
  }
     
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc") cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include<stdio.h>
#define min(x,y) (x<y?x:y)

long long two(long long n)
{
	long long c=0;
	while(n%2==0)
	{
		n/=2;
		c++;
	}
	return c;
}
int main()
{
	long long N;
	while(scanf("%lld",&N)!=EOF)
	{
		long long i,ch,mm;
		ch=0;
		mm=0x3f3f3f3f;
		for(i=0;i<N;i++)
			scanf("%lld",&ch),
			mm=min(mm,two(ch));
		printf("%lld\n",mm);
	}
}

Measured memory_bytes: 128
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
p=n1()
f=False
q=sorted(p)

if p==q:
    f=True
else:
    for i in range(n):
        for j in range(i+1,n):
            a=p.copy()
            a[i],a[j]=a[j],a[i]
            if a==q:
                f=True
                break
p0(f,"YES","NO")

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

int main(){
    int n;
    while(cin>>n,n){
        int _n=n*(n-1)/2;
        vector<int>v(_n); rep(i,_n)cin>>v[i];
        if(_n==1){cout<<v[0]<<endl; continue;}
        int ans=0; rep(i,_n)ans+=v[i];
        cout<<ans/(n-1)<<endl;
    }
}

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

const int mod = 998244353;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	long long int tot = 0;
	for(auto it:s){
		tot<<=1;
		if(it == '1')	tot++;
		tot%=mod;
	}
	tot++;
	vector<pair<int,long long int> > v;
	for(int len=1;len<=n;len++)
		if(n*2%len==0){
			int block=n*2/len;
			if(block%2==0)	continue;
			long long int cur = 0;
			string cs;
			for(int i=0;i<n;i++)
				if(i/(len/2)%2==0)
					cs+=s[i%(len/2)];
				else
					cs+=char('1'+'0'-s[i%(len/2)]);
			for(int i=0;i<len/2;i++){
				cur<<=1;
				if(s[i]=='1')	cur++;
				cur%=mod;
			}
			cur++;
			if(cs>s)	cur--;
			for(auto it:v)
				if(len%it.first==0)
					cur-=it.second;
			cur=(cur%mod+mod)%mod;
			v.emplace_back(len,cur);
		}
	long long int ans=0;
	for(auto it:v)
		tot-=it.second,ans=(ans+it.first*it.second)%mod;
	ans+=tot%mod*2*n%mod;
	ans=(ans%mod+mod)%mod;
	cout<<ans<<endl;
}


Measured memory_bytes: 968
require 'pp'

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end

N, a_list = gets_n_and_i_list

mods = []
min_a = a_list.min
while true do 
  mods = a_list.map do |a|
    a % min_a
  end
  mods -= [0]
  if mods.empty?
    puts min_a
    exit
  end
  min_a = mods.min
end


Measured memory_bytes: 12152
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String S[] = s.split("");
    System.out.printf("%s",S[0]);
    System.out.printf("%d",s.length()-2);
    System.out.println(S[s.length()-1]);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
 
int main() {
  char a;
  cin >> a;
    
  if(a=='A') cout << 'T' << endl;
  if(a=='T') cout << 'A' << endl;
  if(a=='C') cout << 'G' << endl;
  if(a=='G') cout << 'C' << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define yes(a) printf(a ? "yes\n" : "no\n")
#define Yes(a) printf(a ? "Yes\n" : "No\n")
#define YES(a) printf(a ? "YES\n" : "NO\n") 
const long double PI = acos(-1);
const long long INF = (1 << 30);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

ll h, w;
string s[51];
ll dist[51][51];

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

  ll n;
  cin >> n;
  map<ll, ll> mp;
  for(ll i = 0; i < n; i++){
    ll a;
    cin >> a;
    mp[a]++;
  }

  ll ans = 0;
  for(auto x : mp){
    if(x.second % 2 != 0) ans++;
  }
  cout << ans << endl;
	return 0;
}

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

int main()
{
    string a,b;
    cin>>a>>b;
    cout<<b<<a;
//    scanf("%c",&a);
//    printf("%c\n",++a);
    printf("\n");
//    printf("%c\n",a);



}


Measured memory_bytes: 256
using System;

namespace AOJ.ITP
{
    public class MatrixVectorMultiplication
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);

            int[,] vector = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split(' ');
                for (int j = 0; j < m; j++) { vector[i, j] = int.Parse(input[j]); }
            }

            // 計算
            int[] answer = new int[n];
            for (int i = 0; i < m; i++)
            {
                int var = int.Parse(Console.ReadLine());
                for (int j = 0; j < n; j++) { answer[j] += vector[j, i] * var; }
            }

            // 出力
            for (int i = 0; i < n; i++) { Console.WriteLine(answer[i]); }
        }
    }
}

Measured memory_bytes: 5840
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	long N = sc.nextInt();
	for(long i = N;i >1;i--)
	{
		if(i*i <= N){
			System.out.println(i*i);
			break;
		}
	}
	if(N == 1 || N == 2 || N == 3){
		System.out.println(1);		
	}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++){
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      for (int k = j + 1; k < N; k++){
        if (L[k] < L[i] + L[j] && L[i] != L[j] && L[j] != L[k] && L[k] != L[i]){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
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() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N; cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  ll n = a[0];
  for(ll i=1; i<N; ++i) {
    n ^= a[i];
  }
  rep(i, N) {
    cout << (n ^ a[i]) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 4712
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  string input;
  int ans = 0;
  cin >> input;
  for(int i = 0; i < (int)input.size(); ++i){
    char ch = input[i];
    if(ch == '+')
    {
      ans++;
    }else{
      ans--;
    }
  }
  printf("%i\n",ans);
  return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

const PRIMES: &'static [u32] = &[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,
    37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];


fn count_prime(mut n: u32, c: &mut [u32]) {
    for (i, p) in PRIMES.iter().enumerate() {
        let p = *p;
        while n % p == 0 {
            n /= p;
            c[i] += 1;
        }
    }
}

fn main() {
    input!{
        n: u32,
    };

    let mut count = vec![0; PRIMES.len()];
    for i in 2..n + 1 {
        count_prime(i, &mut count);
    }
    // eprintln!("{:?}", count);
    let mut ans = 0;
    for c in count.iter() {
        let c = *c;
        if c >= 74 {
            ans += 1;
        }
    }
    for a in 0..count.len() {
        if count[a] < 2 {
            continue;
        }
        for b in 0..count.len() {
            if count[b] < 4 {
                continue;
            }
            if a != b && count[b] >= 24 {
                ans += 1;
            }
            for c in b + 1..count.len() {
                if count[c] < 4 {
                    continue;
                }
                if a == b || a == c {
                    if count[a] >= 14 {
                        ans += 1;
                    }
                } else {
                    ans += 1;
                }
            }
        }
    }
    
    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

M = int(input())
dc = [list(mapint()) for _ in range(M)]
ans = 0
nowd = 0
for m in range(M):
    d, c = dc[m]
    s = nowd + d*c
    ans += c+s//10
    nowd = s%10+s//10
    while nowd>=10:
        ans += nowd//10
        nowd = nowd%10+nowd//10
print(ans-1)

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

// https://qiita.com/EqualL2/items/6e3de4d1d09e2e5f3611
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
    ll N,X;
    ll x[100001];
    ll y[100001];
    std::cin >> N>>X;
    x[0]=X;
    for (int i = 0; i < N; i++) {
        std::cin >> x[i+1];
    }
    sort(x,x+N+1);
    for (int i = 0; i < N; i++) {
        y[i]=x[i+1]-x[i];
    }
    
    ll gcd = y[0];
    
    for (int i = 0; i < N; i++) {
        gcd = euclidean_gcd(gcd,y[i]);
    }

    std::cout << gcd << std::endl;
    
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    for (int i = 0; i < M; i++) {
        cin >> a.at(i) >> b.at(i);
        a.at(i)--;
        b.at(i)--;
    }
    vector<pair<int, int>> ab(M);
    for(int i = 0; i < M; i++) ab.at(i) = make_pair(b.at(i), a.at(i));
    sort(ab.begin(), ab.end());
    
    int ans = 0;
    int now_b = 0;
    while(now_b < M) {
        int i = 1;
        while(now_b+i < M && ab.at(now_b).first > ab.at(now_b+i).second) i++; //i-1個先まで串刺しにできる
        now_b += i; //次は、今串刺しにできなかったi個先から見始める
        ans++; //必要な串の本数をincrement
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 1792
a,b,c,x,y=io.read("*n","*n","*n","*n","*n")
if a+b<=c*2 then
    print(a*x+b*y)
else
    if x>=y then
        print(math.min(c*y*2+a*(x-y), c*x*2))
    else
        print(math.min(c*x*2+b*(y-x), c*y*2))
    end
end

Measured memory_bytes: 760
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>
#include <set>

const int INT_INF = 1e9;
const long long LONG_INF = 1e18;
const long long MOD = 1e9 + 7;

using namespace std;

int main()
{
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; i++)
    {
        if (i % k == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int M = 1000000;

int func(int x){
    if(x%2==0){
        return x / 2;
    }else{
        return 3 * x + 1;
    }
}

int main(){
    int s;
    cin >> s;
    vector<int> a(1,s);
    map<int,int> m;
    m[a.back()]++;
    for(int i=1;i<M;i++){
        a.push_back(func(a[i-1]));
        m[a.back()]++;
        if(m[a.back()]==2){
            cout << i+1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str, K: int):

    for i in range(K):
        if S[i] != "1":
            c = S[i]
            break
    else:
        print(1)
        return
    print(c)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: str
    K = int(next(tokens))  # type: int
    solve(S, K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
def main():
  #連立方程式を行列にして解いた
  n=int(input())
  a=tuple(map(int,input().split()))
  ans=[0]*n
  ans[0]=sum([a[i]*(-1)**i for i in range(n)])
  for i in range(1,n):
    #各行の関係式
    ans[i]=2*a[i-1]-ans[i-1]
  print(*ans)
if __name__=='__main__':
  main()

Measured memory_bytes: 14220
def honyaku(i,N):
    ans = []
    tmp = i
    for i in range(1,N+1):
        ans.append(tmp%2)
        tmp = tmp//2
    return ans
def check(s_list,d_list,p):
    tmp = 0
    for i in range(1,len(d_list)):
        if s_list[d_list[i]-1] == 1:
            tmp += 1
    if tmp%2 == p:
        return True
    else:
        return False

[N,M] = list(map(int,input().split()))
s = []
for i in range(M):
    s_tmp = list(map(int,input().split()))
    s.append(s_tmp)
p = list(map(int,input().split()))
ans = 0
for i in range(2**N):
    s_list = honyaku(i,N)
    ans_tmp = 0
    for j in range(M):
        if check(s_list,s[j],p[j]) == True:
            ans_tmp += 1
    if ans_tmp == M:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
int deg_count[100000];
int a[100000];
int b[100000];
vector <pair<int, int > > edges[100000];
int ans[100000];
bool used[100000];

void dfs(int cur, int prev_color, int color_num){
    used[cur] = true;
    int tmp_next_color = 1;
    for(int i = 0; i < edges[cur].size(); i++){
        int next = edges[cur][i].first;
        int edge_ind = edges[cur][i].second;
        if(!used[next]){
            if(tmp_next_color == prev_color){
                tmp_next_color++;
            }
            ans[edge_ind] = tmp_next_color;
            dfs(next, tmp_next_color, color_num);
            tmp_next_color ++;
        }
    }
}

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N - 1; i++){
        cin >> a[i] >> b[i];
        a[i] --;
        b[i] --;
        edges[a[i]].push_back(make_pair(b[i], i));
        edges[b[i]].push_back(make_pair(a[i], i));
        deg_count[a[i]] += 1;
        deg_count[b[i]] += 1;
    }
    int max_degree = *max_element(deg_count, deg_count + N);
    cout << max_degree << endl;

    dfs(0, 0, max_degree);
    for(int i = 0; i < N - 1; i++){
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 10112
#include <stdio.h>
     
    int main(){
    	int i, n, m, c[100010], a, b, r[100010]={1};
    	scanf("%d %d", &n, &m);
     
    for(i=0;i<n;i++)
    	c[i]=1;
     
    	while(m--){
    		scanf("%d %d", &a, &b);
    		c[--b]++;
    		c[--a]--;
    		r[b]|=r[a];
    		if(c[a]==0)
    			r[a]=0;
    	}
     
    	for(i=m=0;i<n;i++)
    		m+=r[i];
     
    	printf("%d\n", m);
     
    	return 0;
    }

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, i;
    cin>>n>>m;
    if(n>m){
        for(i=1;i<=n;i++){
            cout<<m;
        }
    }
    else if(n<m){
        for(i=1;i<=m;i++){
            cout<<n;
        }
    }
    else
        for(i=1;i<=n;i++){
            cout<<n;
        }
}


Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int N;
	cin >> N;

	set<char> hinaarare;
	rep(i, N) {
		char tmp;
		cin >> tmp;
		hinaarare.insert(tmp);
	}

	if (hinaarare.size() == 3) {
		cout << "Three" << endl;
	}
	else {
		cout << "Four" << endl;
	}
	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> a(N);
  REP(i, N) {
    cin >> a[i];
    a[i] %= M;
  }

  vector<int> sum(N + 1);
  sum[0] = 0;
  REP(i, N)
    sum[i + 1] = (sum[i] + a[i]) % M;

  map<int, ll> mp;
  REP(i, N + 1) mp[sum[i]]++;

  ll ans = 0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
    ans += itr->SE * (itr->SE - 1) / 2;
  }
  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    ll N, T;
    cin >> N >> T;
    vector<ll> t(N);
    ll MAX = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> t[i];
    }
    ll TIME = 0;
    ll pre = 0;
    for (int i = 0; i < N - 1; i++)
    {
        TIME += min(T, t[i + 1] - t[i]);
    }
    TIME += T;
    cout << TIME << endl;
}

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

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


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

 int P[N];
 REP(i,N){
   cin >> P[i];
 }

 int cnt = 1;
 int memory = P[0];

 FOR(i,1,N){
   if(memory >= P[i]){
     cnt++;
     memory = P[i];
   }
 }

 cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int r; cin >> r;
    if (r < 1200)
    {
        cout << "ABC\n";
    } else if (r < 2800) {
        cout << "ARC\n";
    } else {
        cout << "AGC\n";
    }
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>

#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL long long
#define int LL
#define INF  99999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;

int N;

signed main()
{
	QUICK_CIN;
	//ifstream cin("debug.txt");
	//ofstream cout("result.txt");

	while (cin >> N){
		if (!N) break;

		typedef pair < int, int > P;
		vector<P> arr(N);
		
		REP(i, N){
			cin >> arr[i].second >> arr[i].first;
		}

		sort(ALL(arr));

		int sum = 0;

		REP(i, N){
			sum += arr[i].second;
			if (sum > arr[i].first){
				cout << "No" << endl;
				goto END;
			}
		}

		cout << "Yes" << endl;

	END:;
	}

	return 0;
}

Measured memory_bytes: 1200
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, M): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };
    let (A, B): (Vec<usize>, Vec<usize>) = {
        let (mut A, mut B) = (vec![], vec![]);
        for _ in 0..M {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            A.push(iter.next().unwrap().parse().unwrap());
            B.push(iter.next().unwrap().parse().unwrap());
        }
        (A, B)
    };

    let G = {
        let mut G = vec![std::collections::HashSet::new(); N + 1];
        for i in 0..M {
            G[A[i]].insert(B[i]);
        }
        G
    };

    const INF: usize = 1_000_000_000_000;
    let ans = (1..(N + 1))
        .map(|s| {
            let mut p = vec![0; N + 1];
            let mut q = std::collections::VecDeque::new();
            q.push_back(s);
            let mut t = 0;
            while let Some(i) = q.pop_front() {
                for &j in &G[i] {
                    if j == s {
                        t = i;
                        break;
                    } else if p[j] == 0 {
                        p[j] = i;
                        q.push_back(j);
                    }
                }
            }
            if t == 0 {
                (INF, p)
            } else {
                let mut res = vec![];
                let mut i = t;
                let mut K = 1;
                while i != s {
                    res.push(i);
                    i = p[i];
                    K += 1;
                }
                res.push(s);
                (K, res)
            }
        })
        .min_by_key(|&(K, _)| K)
        .map(|(K, V)| {
            if K < INF {
                format!(
                    "{}\n{}",
                    K,
                    V.iter()
                        .map(|&v| v.to_string())
                        .collect::<Vec<_>>()
                        .join("\n")
                )
            } else {
                "-1".to_string()
            }
        })
        .unwrap();

    let ans = println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int N, A[200010], B[200010];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> N;
  for (int i = 0; i < N; i ++) cin >> A[i];
  for (int i = 0; i < N; i ++) B[i] = A[i];
	sort(A, A + N); reverse(A, A + N);
	for (int i = 0; i < N; i ++) 
	{
		if (B[i] == A[0]) cout << A[1];
		else cout << A[0];
		cout << endl;
	}
  return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    
    int main() {
    while(true){
     int h,w;
     cin >> h >> w;
     if(h!=0 || w!=0){
     rep(i,h){
     	rep(j,w){
     	cout <<  '#';
     	}
     	cout << '\n';
     }
     cout << '\n';
     }else {
     return 0;
     }
     }
     return 0;
    }


Measured memory_bytes: 3072
package main

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

func solve() {
	i := scanInt()
	ans := "No"
	str := strconv.Itoa(i)
	if str[0] == '7' || str[1] == '7' || str[2] == '7' {
		ans = "Yes"
	}
	fmt.Println(ans)
	return
}

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func pow(n int, m int) int {
	ans := 1
	for i := 0; i < m; i++ {
		ans *= n
	}
	return ans
}
func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 1756
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	string x;
	getline(cin,x);
	for(int i=1;i<=n;i++){
		getline(cin,x);
		for(int j=0;j<m;j++){
			cout<<x[j];
		}
		cout<<endl;
		for(int j=0;j<m;j++){
			cout<<x[j];
		}
		cout<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
ans = 0
h = Hash.new(0)

a.each do |i|
    h[i] += 1
    ans += i
end

q = gets.chomp.to_i

q.times do
    b, c = gets.chomp.split(" ").map(&:to_i)
    tmp = h[b]
    h[b] = 0
    h[c] += tmp
    ans = ans - tmp*b + tmp*c
    puts ans
end

Measured memory_bytes: 26564
#include<stdio.h>
int main()
{
    int a, b, c, d;
	scanf("%d%d", &a, &b);
	
	c = a + b;
	d = c / 2;
	
	if(c % 2 == 0)
	{
		printf("%d\n", d);
	}
	else
	{
		printf("%d\n", d + 1);
	}
	
	return 0;
}
	

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <string>
//#include <cmath>
#include <vector>
// #include <algorithm>
// #include <bits/stdc++.h>
using namespace std;

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

  vector<int> v(n);
  int max = -1000000;
  int min = 1000000;
  long sum = 0;
  for (int i=0; i<n; i++) {
    cin >> v[i];
    if(max < v[i]) max = v[i];
    if(min > v[i]) min = v[i];
    sum = sum + v[i];
  }

  cout << min << " " << max << " " << sum << endl;
  
  return 0;
}



Measured memory_bytes: 3136