akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def fb_gen(count=1):
    while True:
        if count % 15 == 0:
            ans = 'FizzBuzz'
        elif count % 5 == 0:
            ans = 'Buzz'
        elif count % 3 == 0:
            ans = 'Fizz'
        else:
            ans = str(count)
        yield ans
        count += 1


def main(args):
    while True:
        m, n = map(int, input().split())
        if m == 0 and n == 0:
            break
        players = deque(range(1, m+1))
        fb = fb_gen()
        ok_count = 0
        for _ in range(n):
            p = input().strip()
            if p != fb.__next__():
                if len(players) > 1:
                    players.rotate(ok_count)
                    players.popleft()
                    ok_count = 0
            else:
                ok_count -= 1

        result = list(players)
        result.sort()
        print(*result)


if __name__ == '__main__':
    main(sys.argv[1:])

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

int main(){
    int n;
    int i,g;
    i = g = 0;
    string s;

    cin >> n;
    s = to_string(n);

    while(i<=2){
        if(s[i]=='7'){
            g++;
        }
        i++;
    }

    if(g != 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3680
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

int main() {
    int N, L;
    cin >> N >> L;
    ll a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < N - 1; i++) {
        ll num = a[i] + a[i + 1];
        if (num >= L) {
            cout << "Possible" << endl;
            for (int j = 0; j < i; j++) {
                cout << j + 1 << endl;
            }
            for (int j = N - 2; j >= i; j--) {
                cout << j + 1 << endl;
            }
            return 0;
        }
    }
    cout << "Impossible" << endl;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int mod = 1e9+7;
int main(){
  ll n;
  cin>>n;
  vector<ll> v(n);
  for(ll i=0; i<n; i++){
    cin>>v.at(i);
  }
  ll kabu =0;
  ll yen =1000;
  for(ll i=0;i<n-1;i++){
    ll tmp =v.at(i);
    ll ne = v.at(i+1);
    if(tmp<ne){
      kabu = max(yen/tmp,kabu);
      yen %= tmp;
    }
    else if(tmp>ne){
      yen += tmp * kabu;
      kabu =0;
    }
  }
  yen += v.at(n-1)*kabu;
  cout<<yen<<endl;
  
//    cout << fixed << setprecision(10);
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007


void solve()
{
	ll l,r;
	cin>>l>>r;
	if(r-l>=2019)
	{
		cout<<0;
		return;
	}
	ll ans=2018;
	for(ll i=l;i<=r;i++)
	{
		for(ll j=i+1;j<=r;j++)
			ans=min(ans,((i*j)%2019));
	}
	cout<<ans;
    return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
#define int long long int
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);

int f[105][105] = {};
struct node
{
  int x, y;
  bool flip = false;
  int cost = 0;
  node next(int sx, int sy)
  {
    int c = cost;
    if (f[sx][sy])
    {
      if (!flip)
        c++;
    }
    return node{sx, sy, f[sx][sy], c};
  }
  bool operator<(node &rhs) const
  {
    return cost < rhs.cost;
  }
};
int dist[205][205][2] = {};
void solve(long long H, long long W, std::vector<std::string> s)
{

  auto cmp = [](node &l, node &r) { return l.cost < r.cost; };
  priority_queue<node, vector<node>, decltype(cmp)> que(cmp);

  rep(i, 205) rep(j, 205) rep(k, 2) dist[i][j][k] = 1e8;
  rep(i, H) rep(j, W)
  {
    f[i][j] = s[i][j] == '#';
  }
  if (f[0][0])
  {
    node sx{0, 0, true, 1};
    que.push(sx);
  }
  else
  {
    node sx{0, 0, false, 0};
    que.push(sx);
  }
  while (!que.empty())
  {
    auto s = que.top();
    que.pop();
    // cout << s.x << " " << s.y << " " << s.cost << endl;
    if (!chmin(dist[s.x][s.y][s.flip], s.cost))
      continue;
    if (s.x + 1 < H)
      que.push(s.next(s.x + 1, s.y));
    if (s.y + 1 < W)
      que.push(s.next(s.x, s.y + 1));
  }
  cout << min(dist[H - 1][W - 1][0], dist[H - 1][W - 1][1]) << endl;
}

signed main()
{
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  std::vector<std::string> s(W);
  for (int i = 0; i < W; i++)
  {
    std::cin >> s[i];
  }
  solve(H, W, std::move(s));
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    int a,b;
    cin >> a >> b;

    if (a >= 13) {
        cout << b << '\n';
    } else if (a >= 6) {
        cout << b / 2 << '\n';
    } else {
        cout << 0 << "\n";
    }

    return 0;
}

Measured memory_bytes: 888
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int x1,x2,y1,y2;cin>>x1>>y1>>x2>>y2;
    //if(x2>x1)
    cout<<x2+(y1-y2) <<" "<< y2+(x2-x1)<<" "<<x1+(y1-y2) <<" "<< y1+(x2-x1)<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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


int main(){

    int A,a,b,i;
    scanf("%d %d",&a,&b);

    if(b==1){
        printf("0\n");
        return 0;
    }

    A=a;
    for(i=1;A<b;A=A+a-1){
        i++;
    }
    
    printf("%d\n",i);

    return 0;
}

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

int main() {
    int N, A;
    cin >> N;
    map<int, int> mp;
    rep(i,N) {
        cin >> A;
        ++mp[A];
    }
    string ans = "YES";
    if (mp.size() != N) ans = "NO";
    cout << ans << endl;
}


Measured memory_bytes: 12976
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {

int N,M;
cin>>N>>M;
int p[N+1];
rep3(i,N){
  cin>>p[i];
}
UnionFind U(N+1);
rep(i,M){
  int x,y;
  cin>>x>>y;
  U.unite(x,y);

}
int count=0;
rep3(i,N){
  if(U.same(p[i],i)){
    count++;
  }
}
cout<<count<<endl;

return 0;
}

Measured memory_bytes: 4024
import java.io.*;
import java.util.*;

class Program{
    String S[]; int N,T,A;
    void solve(String S[], int N, int T, int A){
        this.S = S; this.N = N; this.T = T; this.A = A;
        calc();
    }
    void calc(){
        double avg, diff = Double.MAX_VALUE; int temp = -1;
        for(int i=0;i<S.length;i++){
            avg = T - Integer.parseInt(S[i])*0.006;
            //System.out.println(avg);
            if(Math.abs(A-avg)<=diff){
                diff = Math.abs(A-avg);
                //System.out.println("SD"+diff);
                temp = i+1;
            }
        }
        System.out.println(temp);
    }
}
class Main{
    public static void main(String[] args) {
        Program obj = new Program();
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int T = in.nextInt(); int A = in.nextInt();
        in.nextLine();
        String S[]= in.nextLine().split(" ");
        //System.out.println(N+" "+T+" "+A+" "+Arrays.toString(S));
        obj.solve(S,N,T,A);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; i++) 

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, int> m;
    string S;
    rep(i, n) {
        cin >> S;
        m[S] = 1;
    }
    cout << m.size() << endl;
    return 0;
}

Measured memory_bytes: 19224
#include <stdio.h>
int main(){
int a[4][14],n,i,j;

scanf("%d",&n);

for(i=0;i<4;i++){
for(j=0;j<14;j++){
a[i][j]=0;
}
}
scanf("%*p");
for(i=0;i<n;i++){
char b;
int p;
scanf("%c %d\n",&b,&p);

if(b=='S'){
a[0][p]=1;}

else if(b=='H'){
a[1][p]=1;}

else if(b=='C'){
a[2][p]=1;}

else if(b=='D'){
a[3][p]=1;
}
}

char owari[]={'S','H','C','D'};
for(i=0;i<4;i++){
for(j=1;j<14;j++){
if(a[i][j]==0){
printf("%c %d\n",owari[i],j);}
}
}
return 0;

}

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

#define MAX 300000

int main()
{
	bool p[MAX];
	fill(begin(p), end(p), 1);
	p[0] = p[1] = 0;
	for (int i = 6; i < sqrt(MAX) + 1; i+=7) {
		if (p[i]) {
			for (int j = i * 2; j < MAX; j += i)
				p[j] = 0;
		}
	}
	for (int i = 8; i < sqrt(MAX) + 1; i+=7) {
		if (p[i]) {
			for (int j = i * 2; j < MAX; j += i)
				p[j] = 0;
		}
	}

	int n;
	while (cin >> n, n != 1) {
		int x = n;
		vector<int> v;

		for (int i = 6; i <= x; i+=7) {
			if (x % i == 0 && p[i]) {
				v.push_back(i);
			}
		}
		for (int i = 8; i <= x; i+=7) {
			if (x % i == 0 && p[i]) {
				v.push_back(i);
			}
		}

		sort(v.begin(), v.end());
		cout << n << ": ";
		for (int i = 0; i < v.size(); i++) {
			if (i != v.size() - 1) cout << v[i] << " ";
			else cout << v[i] << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1500
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        if(t.substring(0,s.length()).equals(s)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    public static Double calculate(Double base, Double n) {
        return Math.pow(Math.E, Math.log(base)/n);
    }

    public static int[] toArray(List<Integer> target) {

        final int[] result = new int[target.size()];
        for (int i = 0; i < result.length; i++) {
            result[i] = target.get(i);
        }

        return result;
    }
    public static boolean isMultiple (String s, int base, int m) {
	int temp = 0;
	for (int i=0; i<s.length(); i++) {
		temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
	}
	if (temp==0) {return true;}
	return false;
}
static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
             return Double.parseDouble(next());
         }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for(int i = 0; i < H; i++){
    cin >> S[i];
  }
  for(int i = 0; i < W + 2; i++){
    cout << '#';
  } 
  cout << endl;
  for(int i = 0; i < H; i++){
    cout << '#' << S[i] << '#' << endl;
  }
  for(int i = 0; i < W + 2; i++){
    cout << '#' ;
  }
  cout << endl;
}
  
  


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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    vi l(n);
    rep(i ,n) {
        cin >> l[i];
    }

    sort(all(l));
    ll ans = 0;
    rep(i, n) for (int j = i + 1; j < n; j++) {
        int a = l[i];
        int b = l[j];
        int x = upper_bound(l.begin(), l.end(), max(a-b, b-a)) - l.begin();
        int y = lower_bound(l.begin(), l.end(), a + b) - l.begin();
        int z = y - x;
        if (max(a-b,b-a) < a) z--;
        if (max(a-b,b-a) < b) z--;
        ans += z;
    }

        
    cout << ans / 3 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int ax, ay, bx, by, cx, cy;
ld a, b, c;

int main() {
	cin >> ax >> ay >> bx >> by >> cx >> cy;
	a = hypotl(ax - bx, ay - by);
	b = hypotl(ax - cx, ay - cy);
	c = hypotl(cx - bx, cy - by);
	ld p = (a + b + c) / 2;
	ld A = sqrtl(p * (p - a) * (p - b) * (p - c));
	ld r = A / p;
	ld mx = max(a, max(b, c));
	cout << fixed << setprecision(20) << mx * r / (2 * r + mx);
	return 0;
}



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

#define LL 					long long
#define ULL 				unsigned long long
#define pii 				pair<int,int>
#define fi 					first
#define se 					second
#define vi 					vector<int>
#define psb 				push_back
#define ppb 				pop_back
#define all(x)			 	(x).begin(),(x).end()
#define sz(x)				(int)(x).size()
#define endln 				printf("\n")
#define gc					getchar_unlocked
#define setmin(x)			memset((x), -1, sizeof((x)))
#define setnul(x)			memset((x), 0, sizeof((x)))
#ifndef getchar_unlocked
#define getchar_unlocked 	getchar
#endif
const int inf = 1e9 + 5;
const int mod = 1e9 + 7;

template <typename T>
void gi(T &ret) {
	ret = 0; char inp=gc(); int kl=1;
	while (inp<'0' || inp>'9') {if (inp=='-') kl=-1; inp=gc();}
	while ('0'<=inp && inp<='9') ret=(ret<<3)+(ret<<1)+(inp-'0'), inp=gc();
	if (kl<1) ret=-ret;
}

const int MAXN = 1e5+5;
int n, ans = 0, root = 0;
vi adj[MAXN];

int dfs (int now, int par) {
	int ch = 0, dpt = 0;
	for (auto nex : adj[now]) {
		if (nex==par) continue;
		dpt += dfs (nex,now);
		ch++;
	}
	ch--;
	if (ch) {
		if (dpt<ch) {
			ans += ch-dpt;
			dpt = ch;
		} else if (now==root && dpt==1 && ch==1) ans++;
	} else if (now==root) ans++;
	if (dpt) return 1;
	else return 0;
}

int main() {
	gi(n);
	for (int i=1; i<n; i++) {
		int a,b; gi(a); gi(b);
		adj[a].psb(b);
		adj[b].psb(a);
	}
//	for (int i=0; i<n; i++) if (sz(adj[i])==2) root = i;
	dfs (root,-1);
	printf ("%d\n", ans);
	return 0;
}



Measured memory_bytes: 11904
S = input()
T = input()

N = len(S)
Slist = {}
Tlist = {}
for i in range(N):
    if S[i] in Slist:
        Slist[S[i]] += 1
    else:
        Slist[S[i]] = 1
    if T[i] in Tlist:
        Tlist[T[i]] += 1
    else:
        Tlist[T[i]] = 1

M = len(Slist)
L = len(Tlist)
if M == L:
    skey = []
    tkey = []
    svalue = []
    tvalue = []
    for k, v in Slist.items():
        skey.append(k)
        svalue.append(v)
    skey.sort()
    svalue.sort()
    
    for k, v in Tlist.items():
        tkey.append(k)
        tvalue.append(v)
    tkey.sort()
    tvalue.sort()
    
    if svalue == tvalue:
        print('Yes')
    else:
        print('No')
        
else:
    print('No')

Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  string s;
  while(cin>>s){
    FOR(i,1,s.size()){
      if(s[i]!=s[i-1]){
        s.insert(i, " ");
        i++;
      }
    }
    stringstream ss(s);
    string trans[10] = {" ", "',.!?", "abcABC", "defDEF", "ghiGHI", "jklJKL", "mnoMNO", "pqrsPQRS", "tuvTUV", "wxyzWXYZ"};
    string ans = "";
    while(ss>>s){
      int n = s[0]-'0';
      if(n > 0){
        int m = (s.size()-1)%trans[n].size();
        ans += trans[n][m];
      }else{
        REP(i,s.size()-1)ans += " ";
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#define NIL -1
#define WHITE 1
#define BLACK 0
#define INF 100000

void prim(void);

int a[100][100];
int sum=0;
int n;

int main(){

  int i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a[i][j]);
      if(a[i][j]==NIL) a[i][j]=INF;
    }
  }

  prim();

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

  return 0;
}

void prim(){

  int d[100];
  int pi[100];
  int color[100];
  int i,j,u,v,mincost;
  
  for(u=0;u<n;u++){
    d[u]=INF;
    pi[u]=NIL;
    color[u]=WHITE;
  }
  d[0]=0;

  while(1){
    mincost=INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==INF) break;

    color[u]=BLACK;

    for(v=0;v<n;v++){
      if(color[v]!=BLACK && a[u][v]<d[v] ){
	pi[v]=u;
	d[v]=a[u][v];
      }
    }   
  }
  for(i=0;i<n;i++){
    sum+=d[i];
  }
  
}

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

int main()
{
  long N;
  cin >> N;
  long p[N];
  for (long i = 0; i < N; ++i)
    cin >> p[i];
  long count = 0;
  for (long i = 0; i < N; i++)
  {
    if (p[i] == i + 1)
    {
      long tmp = p[i];
      if (i == N - 1)
      {
        p[i] = p[0];
        p[0] = tmp;
      }
      else
      {
        p[i] = p[i + 1];
        p[i + 1] = tmp;
      }
      ++count;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
char SWI(int x){
  switch(x){
    case 1:return 'A';
    case 2:return 'B';
    case 3:return 'C';
    case 4:return 'D';
    case 5:return 'E';
    case 6:return 'F';
    case 7:return 'G';
    case 8:return 'H';
    case 9:return 'I';
    case 10:return 'J';
    case 11:return 'K';
    case 12:return 'L';
    case 13:return 'M';
    case 14:return 'N';
    case 15:return 'O';
    case 16:return 'P';
    case 17:return 'Q';
    case 18:return 'R';
    case 19:return 'S';
    case 20:return 'T';
    case 21:return 'U';
    case 22:return 'V';
    case 23:return 'W';
    case 24:return 'X';
    case 25:return 'Y';
    case 26:return 'Z';
  }
}
int swi(char Q){
  switch(Q){
    case 'A':return 1;
    case 'B':return 2;
    case 'C':return 3;
    case 'D':return 4;
    case 'E':return 5;
    case 'F':return 6;
    case 'G':return 7;
    case 'H':return 8;
    case 'I':return 9;
    case 'J':return 10;
    case 'K':return 11;
    case 'L':return 12;
    case 'M':return 13;
    case 'N':return 14;
    case 'O':return 15;
    case 'P':return 16;
    case 'Q':return 17;
    case 'R':return 18;
    case 'S':return 19;
    case 'T':return 20;
    case 'U':return 21;
    case 'V':return 22;
    case 'W':return 23;
    case 'X':return 24;
    case 'Y':return 25;
    case 'Z':return 26;
  }
}

int main(){
  int N; cin >> N;
  string S; cin >> S;
  string ans="";
  for(int i=0;i<S.size();i++){
    ans+=SWI((swi(S[i])+N-1)%26+1);
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fv            first
#define sv            second
#define ll            long long
#define pb            push_back
#define mp            make_pair
#define pll           pair<ll,ll>
#define pii           pair<int,int>
#define READ(x)       freopen(x,"r",stdin)
#define WRITE(x)      freopen(x,"w",stdout)
#define all(x)        (x).begin(),(x).end()
#define isWorking()   cout<<"Wroking"<<endl
#define FOR(i,x,y)    for(int i=x; i<y; i++)
#define SORT(x)       sort(x.begin(),x.end())
#define PRINT(ok)     cout<<(ok? "YES":"NO")<<endl
#define SetPrint(a,x) cout<<fixed<<setprecision(x)<<a<<endl
#define Fast_Input    ios_base :: sync_with_stdio(0),cin.tie(0);

const ll mod= 1e9+7,INF=1e18,mx= 1e6+5,mn=100;
int testCase=1,cas=0;

int main() {

    Fast_Input

    //cin>>testCase;
    while(testCase--) {
        int a,b; cin>>a>>b;

        if(a<=b){
            while(b--) cout<<a;
        }else while(a--) cout<<b;
        cout<<endl;
    }
    return 0;
}


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

typedef long long ll;

int a[200010];
int l[200010];
int r[200010];
stack<int> s;

int main() {
	// your code goes here
	int i, j, n, k;
	cin>>n;
	for(i=1; i<=n; ++i) {
		cin>>a[i];
	}
	for(i=1; i<=n; ++i)
		r[i]=n+1;
	ll ans=0;
	for(i=1; i<=n; ++i) {
		while(!s.empty() && a[s.top()]>=a[i])
			s.pop();
		if(!s.empty())
			l[i]=s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	for(i=n; i>=1; --i) {
		while(!s.empty() && a[s.top()]>=a[i])
			s.pop();
		if(!s.empty())
			r[i]=s.top();
		s.push(i);
	}
	for(i=1; i<=n; ++i) {
		ll x=r[i]-i;
		ll y=i-l[i];
		//cout<<l[i]<<" "<<r[i]<<endl;
		ans+=a[i]*x*y;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll N;
vector<double>p(3002);
vector<vector<double>>memo(3002,vector<double>(3002,-1));
double f(double i,double j){
	if(memo[i][j]!=-1)return memo[i][j];
	if(i==0){
		if(j==0)return 1;
		else return 0;
	}
	return memo[i][j]=(1-p[i-1])*f(i-1,j)+p[i-1]*f(i-1,j-1);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N;
	for(int i=0;i<N;i++)cin>>p[i];
	double ans=0;
	for(int i=0;i*2<N;i++){
		ans+=f(N,i);
	}
	cout<<setprecision(20)<<1-ans<<endl;
}


Measured memory_bytes: 71040
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
using ll = long long;

struct Graph {
    Graph(const int n)
    {
        edge.resize(n);
    }
    void addEdge(const int from, const int to)
    {
        edge[from].push_back(to);
    }
    vector<vector<int>> edge;
};


int main()
{
    int N, M, s, t;
    cin >> N >> M >> s >> t;
    s--, t--;
    Graph g(N);
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        g.addEdge(x, y);
        g.addEdge(y, x);
    }
    vector<bool> used(N, false);
    using P = pair<int, int>;
    queue<P> q;
    used[s] = true;
    q.push(make_pair(s, 0));
    constexpr int INF = 1 << 30;
    vector<int> dist(N, INF);
    while (not q.empty()) {
        const P p = q.front();
        dist[p.first] = p.second;
        q.pop();
        for (const int to : g.edge[p.first]) {
            if (not used[to]) {
                used[to] = true;
                q.push(make_pair(to, p.second + 1));
            }
        }
    }
    while (not q.empty()) {
        q.pop();
    }

    fill(used.begin(), used.end(), false);
    used[t] = true;
    q.push(make_pair(t, 0));
    vector<int> back_dist(N, INF);
    while (not q.empty()) {
        const P p = q.front();
        back_dist[p.first] = p.second;
        q.pop();
        for (const int to : g.edge[p.first]) {
            if (not used[to]) {
                used[to] = true;
                q.push(make_pair(to, p.second + 1));
            }
        }
    }
    const int D = dist[t] - 2;

    vector<ll> num(D + 1, 0);
    vector<ll> back_num(D + 1, 0);
    for (int i = 0; i < N; i++) {
        if (dist[i] <= D) {
            num[dist[i]]++;
        }
        if (back_dist[i] <= D) {
            back_num[back_dist[i]]++;
        }
    }

    ll sum = 0;
    for (int i = 0; i <= D; i++) {
        sum += num[i] * back_num[D - i];
    }
    cout << sum << endl;

    return 0;
}

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

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

#define REPR(i,n) for(int i =n; i >=0; --i)

#define _REP(i,m,n) for(int i =m; i <n; ++i)

#define INF 2e9
const int MOD = 1000000007;

using namespace std;

int main(){
    int n,m;cin >> n >> m;
    vector<bool> a(n+1,false);


    REP(i,m){
        int b;cin >> b;
        a[b] = true;
    }

    bool muri = false;
    vector<long long > dp(n+1,0);
    dp[0] = 1;
    dp[1] = 1;
    for(int i = 2; i <=n; ++i){
        if(a[i-1]== false)dp[i] += dp[i-1];
        if(a[i-2]== false)dp[i] += dp[i-2];
        if(a[i-1] == true && a[i-2] == true)muri = true;
        dp[i] %= MOD;
    }

    if(muri)cout << 0 << endl;
    else cout << dp[n] << endl;

    return 0;
}

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

int main(){
  long N, M, K;
  cin >> N >> M >> K;
  int A[200000], B[200000];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<M; i++) cin >> B[i];

  long a[200001], b[200001];
  a[0] = 0; b[0] = 0;
  for(int i=1; i<=N; i++){
    a[i] = a[i-1]+A[i-1];
    // cout << i << "," << a[i] << endl;
  } 
  for(int i=1; i<=M; i++){
    b[i] = b[i-1]+B[i-1];
    // cout << i << "," << b[i] << endl;
  } 

  int ans = 0, j = M;
  for(int i=0; i < 1+N; i++){
    if (a[i] > K) break;
    while(b[j] > K - a[i]) j--;
    ans = max(ans, i+j);
  }
  cout << ans << endl;
}


Measured memory_bytes: 8308
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    ans = 0
    s = a[0]
    if s <= 0:
        ans += 1-a[0]
        s = 1
    f = 1
    for i in a[1:]:
        s += i
        if f and (s >= 0):
            ans += s+1
            s = -1
        if not f and (s <= 0):
            ans += 1-s
            s = 1
        f ^= 1
    m = ans
    ans = 0
    s = a[0]
    if s >= 0:
        ans += a[0]+1
        s = -1
    f = 0
    for i in a[1:]:
        s += i
        if f and (s >= 0):
            ans += s+1
            s = -1
        if not f and (s <= 0):
            ans += 1-s
            s = 1
        f ^= 1
    print(min(m,ans))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 59376
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 998244353;


        signed main() {
        string c[3];
        for(int i=0;i<3;i++)cin>>c[i];
        for(int i=0;i<3;i++)cout<<c[i][i];

        


      }


        


Measured memory_bytes: 256
n = int(input())
s = input()
ans = 0
for i in range(1000):
  i_str = str(i).zfill(3)
  j = 0
  for k in s:
    if k == i_str[j]:
      j += 1
      if j == 3:
        ans += 1
        break
print(ans)
    

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

void Main()
{
  int N,M; cin >> N >> M;
  if (N >= M) {cout << 0 << endl; return;}
  vector<int> X(M);
  rep(i,M) cin >> X[i];
  sort(X.begin(), X.end());
  vector<int> dist(M-1);
  rep(i,M-1) dist[i] = X[i+1] - X[i];
  vector<int> distsort = dist;
  sort(distsort.begin(), distsort.end());
  //reverse(distsort.begin(), distsort.end());
  int nMinus1thLargestDist = distsort[max(N-2,0)];
  int ans = 0;
  int cnt = 0;
  rep(i,M-1-(N-1)) {
    ans += distsort[i];
  }
  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 1408
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main {
	
	void run() {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int max = count(1000, 1, 1);
		for(int t=0;t<n;t++) {
			int ds = count(sc.nextInt(), sc.nextInt(), sc.nextInt());
			System.out.println(max - ds);
		}
		
	}
	
	int count(int Y, int M, int D) {
		int y = 1, m = 1, d = 1;
		int c = 0;
		for(;;) {
			if( Y == y && M == m && D == d ) {
				return c;
			}
			
	
		d++;
			c++;
			if(y%3==0) {
				if(d == 21) {
					d = 1;
					m++;
				}
			}
			else {
				if(m%2 == 1) {
					if(d == 21) {
						d = 1;
						m++;
					}
				}
				else {
					if( d == 20 ) {
						d = 1;
						m++;
					}
				}
			}
			if( m == 11 ) {
				m = 1;
				y++;
			}
		}
	}
	
	void debug(Object... os  ) {
		System.err.println(deepToString(os));
	}
	
	public static void main(String[] args ) {
		new Main().run();
	}
}

Measured memory_bytes: 20456
import sys
S = input()

for i in range(2 ** 3):
    s = S[0]
    for j in range(3):
        if i >> j & 1:
            s += "+"
        else:
            s += "-"
        s += S[j + 1]
    if eval(s) == 7:
        print(s + "=7")
        sys.exit(0)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d){
    cout << "Left" << endl;
  }else if (a + b == c + d){
    cout << "Balanced" << endl;
  }else {
    cout << "Right" << endl;
  }
}


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

/* define const */
const int Nmax = 1000;
const int Wmax = 1000;
const int Hmax = 1000;
/* end up defineing const */

int arr[Wmax+1][Hmax+1] = {};
int a[Nmax];
int x[Nmax];
int y[Nmax];

int main()
{
  int W,H,N;
  cin >> W >> H >> N;
  for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> a[i];
  // end up inputting

  for (int i = 0; i < N; i++) {
    if (a[i] == 1) {
      for (int j = 1; j <= x[i]; j++) {
        for (int k = 1; k <= H; k++) {
          arr[j][k]++;
        }
      }
    }
else if (a[i] == 2) {
      for (int j = x[i]+1; j <= W; j++) {
        for (int k = 1; k <= H; k++) {
          arr[j][k]++;
        }
      }
    }
    else if (a[i] == 3) {
      for (int j = 1; j <= y[i]; j++) {
        for (int k = 1; k <= W; k++) {
          arr[k][j]++;
        }
      }
    }
    else {
      for (int j = y[i]+1; j <= H; j++) {
        for (int k = 1; k <= W; k++) {
          arr[k][j]++;
        }
      }
    }
  }

  int ans = 0;
  for (int i = 1; i <= W; i++)
    for (int j = 1; j <= H; j++)
      if (arr[i][j] == 0) ans++;

  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<int> a(N);
	
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	
	sort(a.begin(),a.end());
	
	cout<<a.back()<<' ';
	
	int ind = -1;
	int dif = -1;
	
	for(int i=0;i<N-1;i++){
		int b = min(a[i],a.back()-a[i]);
		if(dif<b){
			dif=b;
			ind=i;
		}
	}
	
	cout<<a[ind]<<endl;
		
    return 0;
}


Measured memory_bytes: 640
def fib(n):
    l = [0] * (n + 1)
    l[0] = 1
    l[1] = 1

    for i in range(2, n + 1):
        l[i] = l[i - 2] + l[i - 1]
    
    return l[n]

def main():
    n = int(input())
    print(fib(n))

main()


Measured memory_bytes: 5600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int maxn=1000000+10;
int n;
int a[maxn];
vector<int> g;
int cnt;
void insert_sort(int a[],int n,int g)
{
    for(int i=g;i<n;i++)
    {
        int key=a[i];
        int j=i-g;
        while(j>=0&&a[j]>key)
        {
            a[j+g]=a[j];
            j-=g;
            cnt++;
        }
        a[j+g]=key;
    }
}
void shell_sort(int a[],int n)
{
    int h=0;
    while(true)
    {
        h=3*h+1;
        if(h>n) break;
        g.push_back(h);
    }
    int len=g.size();
    for(int i=len-1;i>=0;i--)
    {
        insert_sort(a,n,g[i]);
    }

}

int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    cnt=0;
    shell_sort(a,n);
    int len=g.size();
    printf("%d\n",len);
    for(int i=len-1;i>=0;i--)
    {
        if(i!=len-1) printf(" ");
        printf("%d",g[i]);
    }
    printf("\n");
    printf("%d\n",cnt);
    for(int i=0;i<n;i++)
    {
        printf("%d\n",a[i]);
    }

    return 0;
}

Measured memory_bytes: 7048
import java.util.*;
import java.util.HashSet;
import java.util.Set;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[]a=new int[N];
        for(int i=0;i<N;i++){
            a[i]=sc.nextInt();
        }
        int min=10000;
        for(int i=0;i<N;i++){
            if(a[i]<=min){
                min=a[i];
            }
        }
        int max=0;
        for(int i=0;i<N;i++){
            if(a[i]>=max){
                max=a[i];
            }
        }
        System.out.println(max-min);
        
        

        }
       
        
    }

Measured memory_bytes: 22996
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, M, L;
  cin>>N>>M>>L;
  ll dist[N][N];
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      if(i==j) dist[i][j] = 0;
      else dist[i][j] = inf;
    }
  }
  int A, B;
  ll C;
  for(int i=0;i<M;++i) {
    cin>>A>>B>>C;
    A--;
    B--;
    dist[A][B] = C;
    dist[B][A] = C;
  }
  for(int k=0;k<N;++k) {
    for(int i=0;i<N;++i) {
      for(int j=0;j<N;++j) {
        dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
      }
    }
  }
  ll dist1[N][N];
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      if(i==j) dist[i][j] = 0;
      else if(dist[i][j]<=L) dist[i][j] = 1;
      else dist[i][j] = inf;
    }
  }
  for(int k=0;k<N;++k) {
    for(int i=0;i<N;++i) {
      for(int j=0;j<N;++j) {
        dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
      }
    }
  }
  int Q;
  cin>>Q;
  ll ans[Q];
  for(int i=0;i<Q;++i) {
    cin>>A>>B;
    A--;
    B--;
    if(dist[A][B]<inf) ans[i] = dist[A][B]-1;
    else ans[i] = -1;
  }
  for(int i=0;i<Q;++i) cout<<ans[i]<<endl;
}


Measured memory_bytes: 4912
#include <stdio.h>
int main()
{
  int work, x, y;

  scanf("%d%d", &x, &y);
  //input number to variable x, y

  while(y!=0){
    work=y;
    y=x%work;
    x=work;
  }
  //using Euclidean algorithm

  printf("%d\n", x);
  //out put answer

  return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	string s,t; cin>>s>>t;
	//i個ずらし
	rep(i,s.sz){
		string tmp;
		rep(j,s.sz){
			if(i+j<=s.sz-1) tmp.pb(s[i+j]);
			else tmp.pb(s[i+j-s.sz]);
		}
		if(tmp==t){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

Measured memory_bytes: 256
// ddcc_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int H, W, K;
    cin >> H >> W >> K;

    vector<vector<bool>> S;
    S.assign(H, vector<bool>(W, false));

    REP(i, H) {
        string s;
        cin >> s;
        REP(j, W){
            if (s[j] == '#') S[i][j] = true;
        }
    }

//    print(S);

    vector<bool> exists(H);
    REP(i, H) {
        REP(j, W){
            if (S[i][j]) exists[i] = true;
        }
    }

//    print(exists);

    int first=0;
    REP(i, H){
        if (exists[i]){
            first = i;
            break;
        }
    }

    vector<vector<int>> ans;
    ans.assign(H, vector<int>(W, -1));


    int tmp = 0;
    REPN(i, first, H){
        if (exists[i]){
            tmp++;
            bool mada = true;
            REP(j, W){
                if (mada){
                    if (S[i][j]) mada = false;
                    ans[i][j] = tmp;
                } else{
                    if (S[i][j]) tmp++;
                    ans[i][j] = tmp;
                }
            }
        } else {
            ans[i] = ans[i-1];
        }
    }

    REP(i, first){
        ans[i] = ans[first];

    }

    REP(i, H){
        for(int j=0;j<(W-1);j++) cout << ans[i][j] << " "; cout << ans[i][W-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 1152
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    v=A[i]
    j=i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j -= 1
    A[j+1]=v
    print(" ".join(map(str,A)))


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){
    int n, k;
    cin >> n >> k;
    cout << (n%k!=0) fin;
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



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

int N,M,P[1010];
int dp[1010][5] = {};

int main(){
	while(cin >> N >> M && N>0){
		for(int i=1;i<=N;i++){
			cin >> P[i];
		}
		vector<int> v;
		for(int i=0;i<=N;i++){
			for(int j=0;j<=N;j++){
				v.push_back(P[i]+P[j]);
			}
		}
		sort(v.begin(),v.end());
		int ans = 0;
		for(int i=0;i<v.size();i++){
			if(M-v[i]<0) continue;
			int s = upper_bound(v.begin(),v.end(),M-v[i])-v.begin();
			s--;
			ans = max(ans,v[i]+v[s]);
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 10768
N, M = map(int, input().split())
H = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

li = [0] + [-1] * N
for a, b in AB:
#     ma = max(H[a-1], H[b-1])
#     if ma==H[a-1]:
#         li[b]=-4
#     elif ma==H[b-1]:
#         li[a]=-4
#     else:
#         li[a]=-4
#         li[b]=-4

#     if H[a-1]>H[b-1]:
#         li[b]=-4
#     elif H[b-1]>H[a-1]:
#         li[a]=-4
#     else:
#         li[a] = li[b] = -4
        
    if H[a-1]>H[b-1]:
        li[b]=-4
    elif H[b-1]==H[a-1]:
        li[a] = li[b] = -4
    else:
        li[a]=-4

cnt=0

for i in range(N+1):
    if i==0:
        continue
    if li[i]==-4:
        cnt+=1
print(N-cnt)

Measured memory_bytes: 31284
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int h = scan.nextInt();
		int n = scan.nextInt();
		int count = 0;

		for (int i = 0; i < n; i++) {
			count += scan.nextInt();
		}

		if (h <= count)
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}


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

int main()
{
    int t=1;
    //cin>>t;
    
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        
        int p[n], ans=0;
        for(int i=0;i<n;i++)
        {
            cin>>p[i];
        }
        
        sort(p, p+n);
        
        for(int i=0;i<k;i++)
        {
            ans+=p[i];
        }
        
        cout<<ans;
    }    
    return 0;
}

Measured memory_bytes: 3600