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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pi;
ll n, k, q, A[2050];
bool use[2050];
vector<pi> v;
int main(){
//	freopen("breaked.in", "r" ,stdin);
	cin >> n >> k >> q;
	for(ll i = 0; i<n; i++){
		cin >> A[i];
		v.push_back(pi(A[i],i));
	}
	sort(v.begin(), v.end());
	multiset<ll> chosen;
	ll ans = INT_MAX;
	use[n] = true;
	for(auto i : v){
		ll val = i.first, pos = i.second;
		priority_queue<ll, vector<ll>, greater<ll>> pq;
		for(ll j = 0; j<=n; j++){
			if(use[j]){ // if used already
				while(pq.size() >= k){ // choose the smallest one until k-1 left
					chosen.insert(pq.top());
					pq.pop();
				}
				while(pq.size() > 0) pq.pop();
			}else{
				assert(A[j] >= val);
				pq.push(A[j]);
			}
		}
		assert(pq.empty());
		use[pos] = true;
		if(chosen.size() < q){ chosen.clear(); continue; }
		while(chosen.size() > q) chosen.erase(--chosen.end()); // pick the q smallest ones
		ans = min(ans, *prev(chosen.end()) - *chosen.begin());
		chosen.clear();
	}
	cout << ans;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

using namespace std;
int main()
{
  int N;
  cin >> N;
  int A[2][3];
  cin >> A[0][0] >> A[0][1] >> A[0][2];
  cin >> A[1][0] >> A[1][1] >> A[1][2];
  {
    long long n = N;
    {
      vector<long long> dp(n+1);
      for (int i=0;i<=n;i++)
        dp[i] = i;
      for (int j=0;j<3;j++) {
        if (A[0][j] > A[1][j]) continue;
        bool changed = false;
        for (long long i=1;i<=n;i++) {
          if (i >= A[0][j]) {
            int v = dp[i-A[0][j]]+A[1][j];
            if (dp[i] < v) {
              dp[i] = v;
            }
          }
        }
      }
      n = dp[n];
    }
    {
      vector<long long> dp(n+1);
      for (long long i=0;i<=n;i++)
        dp[i] = i;
      for (int j=0;j<3;j++) {
        if (A[0][j] < A[1][j]) continue;
        bool changed = false;
        for (long long i=1;i<=n;i++) {
          if (i >= A[1][j]) {
            long long v = dp[i-A[1][j]]+A[0][j];
            if (dp[i] < v) {
              dp[i] = v;
            }
          }
        }
      }
      n = dp[n];
    }
    cout << n << endl;
  }
  return 0;
}


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

int main(){
  while(true){
    int n, m, t, p;
    cin >> n >> m >> t >> p;

    if(n==0 && m==0 && t==0 && p==0)
      break;

    int Ori[64][64] = { {0} };
    for(int y=0; y<m; y++){
      for(int x=0; x<n; x++){
	Ori[y][x] = 1;
      }
    }

    for(int i=0; i<t; i++){
      int d, c;
      cin >> d >> c;

      if(d==1){
	for(int x=0; x<c; x++){
	  for(int y=0; y<m; y++){
	    Ori[y][2*c-x-1] += Ori[y][x];
	    Ori[y][x] = 0;
	  }
	}

	for(int x=0; x<n; x++){
	  for(int y=0; y<m; y++){
	    Ori[y][x] = Ori[y][x+c];
	    Ori[y][x+c] = 0;
	  }
	}
      }
      else{
	for(int y=0; y<c; y++){
	  for(int x=0; x<n; x++){
	    Ori[2*c-1-y][x] += Ori[y][x];
	    Ori[y][x] = 0;
	  }
	}

	for(int y=0; y<m; y++){
	  for(int x=0; x<n; x++){
	    Ori[y][x] = Ori[y+c][x];
	    Ori[y+c][x] = 0;
	  }
	}
      }
    }

    for(int i=0; i<p; i++){
      int x, y;
      cin >> x >> y;

      cout << Ori[y][x] << endl;
    }
  }

  return 0;
}
			



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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int K; cin >> K;
    int A, B; cin >> A >> B;
    REPS(i, A, B) {
      if (i % K == 0) {
        cout << "OK" << endl;
        return 0;
      }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3640
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		Array.Sort(input);
		Array.Reverse(input);
		int lsum = 0;
        for(var i =0;i<input.Length;i++)
		{
			lsum += input[i];
		}
		string ans = "No";
		if (input[0] < lsum - input[0])
		{
			ans = "Yes";
		}
		
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13396
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

//がんばってputintつくるかぁ
const int MAX = 10000;
const int dm = 1 << 17;
char dn[dm], * di = dn, * owad = dn + dm - 20;
class shuturyoku_unko {
public:
	char C[MAX * 4];
	shuturyoku_unko() : C() {
		rep(i, MAX) {
			int X = i;
			rep(j, 4) {
				C[i * 4 + 3 - j] = '0' + X % 10;
				X /= 10;
			}
		}
	}
	void putint(ll A) {
		if (owad < di) {
			fwrite(dn, 1, di - dn, stdout);
			di = dn;
		}
		int dig = 1;
		if (A >= 100000000) {
			if (A >= 10000000000) dig = 3;
			else if (A >= 1000000000) dig = 2;
			memcpy(di + 4 + dig, C + A % 10000 * 4, 4);
			A /= 10000;
			memcpy(di + dig, C + A % 10000 * 4, 4);
			A /= 10000;
			memcpy(di, C + A * 4 + 4 - dig, dig);
			di += 8 + dig;
		}
		else if (A >= 10000) {
			if (A >= 10000000) dig = 4;
			else if (A >= 1000000) dig = 3;
			else if (A >= 100000) dig = 2;
			memcpy(di + dig, C + A % 10000 * 4, 4);
			A /= 10000;
			memcpy(di, C + A * 4 + 4 - dig, dig);
			di += 4 + dig;
		}
		else {
			if (A >= 1000) dig = 4;
			else if (A >= 100) dig = 3;
			else if (A >= 10) dig = 2;
			memcpy(di, C + A * 4 + 4 - dig, dig);
			di += dig;
		}
		*di++ = '\n';
	}
} f;



int A[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();
	ll kotae = 0;
	rep(i, N) {
		int kari = getint();
		A[kari]++;
		kotae += kari;
	}

	int Q = getint();
	rep(i, Q) {
		int b = getint();
		int c = getint();

		A[c] += A[b];
		kotae += A[b] * ll(c - b);
		A[b] = 0;

		f.putint(kotae);
	}


	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

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

	cin >> n;

	if(n == 1){
		cout << "Hello World" << endl;
	}else if(n == 2){
		cin >> a >> b;
		cout << a + b << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.charset.IllegalCharsetNameException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
}

class test {
    public void solve(FastReader in, PrintWriter out){
        int l=in.nextInt();
        int r=in.nextInt();
        int d=in.nextInt();
        int c=0;
        for(int i=l;i<=r;i++){
            if(i%d==0){
                c++;
            }
        }
        out.println(c);
    }
}

class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

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

    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    }
}

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

int main(){
    long long x;
    cin >> x;
    int ans = 1;
    long long cur = 100;
    while(1){
        cur = (long long)(double)cur*1.01;
        if(cur >= x)
            break;
        ans++;
    }
    cout << ans; 
    

    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ll L,R; cin>>L>>R;

    ll ans=2018;

    for (ll i=L; i<R; i++) {
        for (ll j=i+1; j<R+1; j++) {
            ans = min(ans, (i*j)%2019);
            if (ans==0) {
                cout << 0 << endl;
                return 0;
            }
        }
    }

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


Measured memory_bytes: 256
n, a, b, c = gets.split.map(&:to_i)

abc = [a, b, c]
mapping = { 'AB' => [0, 1], 'BC' => [1, 2], 'AC' => [2, 0] }

ss = []
n.times do
  ss << mapping[gets.rstrip]
end

outputs = []
outmap = ['A', 'B', 'C']

n.times do |i|
  x, y = ss[i]

  if abc[x] <= 0 and abc[y] <= 0
    puts 'No'
    exit
  end

  if abc[x] == abc[y] and i < n - 1
    # lookahead
    nxy = ss[i + 1]

    if nxy.include?(x)
      outputs << x
      abc[x] += 1
      abc[y] -= 1
    elsif nxy.include?(y)
      outputs << y
      abc[y] += 1
      abc[x] -= 1
    end
  elsif abc[x] < abc[y]
    outputs << x
    abc[x] += 1
    abc[y] -= 1
  else
    outputs << y
    abc[y] += 1
    abc[x] -= 1
  end
end

puts 'Yes'
outputs.each do |oc|
  puts outmap[oc]
end


Measured memory_bytes: 16276
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main (void) {
    ll N;

    cin >> N;

    string s = to_string(N);
    int numOfDigits = s.length();

    int h = s[0] - '0';

    int ans = 0;
    if (numOfDigits == 1) {
        ans = h;
    } else {
        ans = h - 1 + (numOfDigits - 1) * 9;
    }

    bool is_all_nine = true;
    for (int i = 1; i < numOfDigits; i++) {
        if (s[i] != '9') {
            is_all_nine = false;
        }
    }
    if (is_all_nine) {
        ans = h + (numOfDigits - 1) * 9;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// ABC_071_B

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

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

	vector<char> c(s.size());
	for(int i = 0; i < s.size(); ++i) {
		c[i] = s[i];
	}

	set<char> s_char(c.begin(), c.end());
	vector<char> v_char(s_char.begin(), s_char.end());
	sort(v_char.begin(), v_char.end());
	
	//for(int i = 0; i < v_char.size(); ++i) cout << v_char[i];
	//cout << "\n";

	char ans = ' ';

	if(s_char.size() == 26) cout << "None" << "\n";
	//else if(s_char.size() == 1 && v_char[0] != 'z') cout << char(v_char[0] + 1) << "\n";
	else if(v_char[0] != 'a') cout << 'a' << "\n";
	else {
		for(int i = 0; i < v_char.size()-1; ++i) {
			if((int)v_char[i] + 1 == (int)v_char[i+1]) ans = v_char[v_char.size()-1];
			else {
				ans = v_char[i];
				break;
			}
		}

		//cout  << ans << "\n";
		cout << char(ans + 1) << "\n";

	}

	//cout  << ans << "\n";
	//cout << ans + 1 << "\n";

	return 0;
}                   

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

const int maxN = 5000 + 9;

struct StringHash {
    ll BASE, MOD;
    vector<ll> h, pw;

    StringHash(const string &s, ll B, ll M){
        int n = (int)s.size();
        h.resize(n + 1);    pw.resize(n + 1);
        BASE = B;   MOD = M;
        pw[0] = 1;
        for(int i = 1; i <= n; i++){
            pw[i] = (pw[i - 1] * BASE) % MOD;
        }

        for(int i = 1; i <= n; i++){
            h[i] = (h[i - 1] * BASE + (s[i - 1] - 'a' + 1)) % MOD;
            //cerr << h[i] << ' ';
        }
        //cerr << '\n';
    }

    ll getHash(int i, int j){
        return (h[j] - h[i - 1] * pw[j - i + 1] + MOD * MOD) % MOD;
    }
};

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

    int n;  string s;
    cin >> n;
    cin >> s;

    StringHash f(s, 31, 1e9 + 7);
    StringHash g(s, 4723, 1e9 + 9);

    int ans = 0;
    int lo = 1, hi = n;
    while(lo <= hi){
        int len = (lo + hi) / 2;

        bool flag = false;
        map<pair<ll, ll>, int> idx;

        for(int i = 1; i + len - 1 <= n; i++){
            pair<ll, ll> p = make_pair(f.getHash(i, i + len - 1), g.getHash(i, i + len - 1));
            //cerr << i << ' ' << p.first << ' ' << p.second << '\n';
            if(idx.count(p)){
                if(i >= idx[p] + len){
                    flag = true;
                    break;
                }
            } else {
            	idx[p] = i;
            }
        }

        if(flag){
            ans = len;
            lo = len + 1;
        } else {
            hi = len - 1;
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int n,j,k,i,d,x,nr,in[100005],m,h[100005],y,ok;
vector <int > v[100005];
int main()
{
   cin>>n>>m;
   for(i=1;i<=n;i++)
    cin>>h[i];
   for(i=1;i<=m;i++)
   {
       cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
        }
        for(i=1;i<=n;i++)
        {
            if(in[i]==0)
            {   ok=1;
                for(j=0;j<v[i].size()&&ok;j++)
                    if(h[i]<=h[v[i][j]])
                    ok=0;
                if(ok)
                {
                    nr++;
                    for(j=0;j<v[i].size();j++)
                        in[v[i][j]]=1;
                }

            }
        }
        cout<<nr;

    return 0;

}


Measured memory_bytes: 9536
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N;
    int A[N]; rep(i,N) cin >> A[i];
    reverse(A,A+N);
    rep(i,N){
        if(i!=N-1) cout << A[i] << " ";
        else cout << A[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3096
#include <iostream>

using namespace std;

int digit(int n)
{
  int r = 1;

  for (;;)
  {
    if (n < 10)
    {
      break;
    }
    r += 1;
    n /= 10;
  }
  return r;
}

int pow(int a, int b)
{
  if (b == 0)
  {
    return 1;
  }
  int r = a;
  for (int i = 1; i < b; i++)
  {
    r *= a;
  }
  return r;
}

int main()
{
  int n;
  scanf("%d", &n);

  int d = digit(n);
  int r = 0;

  if (d % 2 == 1)
  {
    r += n - (pow(10, d - 1)) + 1;
  }

  d -= 1;
  for (;;)
  {
    if (d <= 0)
    {
      break;
    }
    if (d % 2 == 1)
    {
      r += 9 * pow(10, d - 1);
    }
    d -= 1;
  }

  // 100000
  //  99999 10000 ~ 99999 = 90000
  //    999 100~999       =   900
  //      9 1~9                 9
  printf("%d\n", r);
}


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

int main(){
    int h, w;
    int cost[10][10];
    cin >> h >> w;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cin >> cost[i][j];
        }
    }

    for(int k = 0; k < 10; k++){
        for(int i = 0; i < 10; i++){
            for(int j = 0; j < 10; j++){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }

    int ans = 0, x;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> x;
            if(x != -1) ans += cost[x][1];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

 class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String s1 = "CODEFESTIVAL2016";
        int count = 0;
        for(int i=0;i<s.length();i++) {
            if(s1.charAt(i) != s.charAt(i)) count = count +1;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21972
n = int(input())
ab = sorted([[int(i) for i in input().split()] for i in range(n)], reverse = True, key = lambda x: x[1])
cd = sorted([[int(i) for i in input().split()] for i in range(n)])

count = 0
for i in range(n):
    for j in range(len(cd)):
        if ab[i][0] < cd[j][0] and ab[i][1] < cd[j][1]:
            count += 1
            del cd[j]
            break

print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int Vmax = 1e5;
    int N, W; cin>>N>>W;
    vector<int> w(N, 0); vector<int> v(N, 0);
    for(int i = 0; i < N; i++) cin>>w[i]>>v[i];
    vector<vector<int> > dp(N+1, vector<int>(Vmax+1, 1e9+7));
    int m = 0;
    for(int i = 1; i <= N; i++){
	for(int j = 0; j <= Vmax; j++){
	    if(i == 1){
		dp[i-1][j] = j == v[i-1] ? w[i-1] : 1e9+7;
		dp[i-1][j] = j == 0 ? 0 : 1e9+7;
	    }
	    dp[i][j] = dp[i-1][j]; // set to the previous value
	    if(j >= v[i-1]) dp[i][j] = min(dp[i][j], dp[i-1][j-v[i-1]]+w[i-1]);
	   
	    if(dp[i][j] > W) dp[i][j] = 1e9+7;
	    else m = max(m,j);
	}
    }
    cout<<m<<endl;
}


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

int main() {
  int n;
  while ( cin >> n ) {
    vector<int> nums(n), dp(n);
    for ( auto& i : nums ) cin >> i;
    dp[0] = 0, dp[1] = abs(nums[0] - nums[1]);
    for ( int i = 2; i < n; ++i ) {
      dp[i] = min(dp[i - 1] + abs(nums[i - 1] - nums[i]), dp[i - 2] + abs(nums[i - 2] - nums[i]));
    }
    cout << dp[n - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
fun main(args : Array<String>) {
    val (n, h) = readLine()!!.split(" ").map { it.toInt() }
    val kk = Array(n) { readLine()!!.split(" ").map { it.toInt() } }

    val maxA = kk.maxBy { it[0] }!![0]
    val tk = kk.filter { it[1] > maxA }.sortedByDescending { it[1] }

    var cnt = 0
    var dmg = 0L

    for (i in tk) {
        dmg += i[1]
        cnt++

        if (dmg >= h) {
            println(cnt)
            return
        }
    }

    val rest = h - dmg
    println(cnt + (rest/maxA) + (if (rest % maxA == 0L) 0 else 1))
}

Measured memory_bytes: 72884
a,b =raw_input().split()
a,b = map(int,(a,b))
if a>b:
    a,b = map(str,(a,b))
    print "a > b"
elif a==b:
    a,b = map(str,(a,b))
    print "a == b"
else:
    a,b = map(str,(a,b))
    print "a < b"

Measured memory_bytes: 4208
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2-y2+y1 << " " << y2+x2-x1 << " " << x1-y2+y1 << " " << y1+x2-x1 << endl; 
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = map(int, input().split())

negative = 0
mi = 10 ** 9 + 1
zero = False
ans = 0
for ai in a:
    if ai < 0:
        negative += 1
    if abs(ai) < mi:
        mi = abs(ai)
    ans += abs(ai)
if negative % 2:
    ans -= 2 * mi
print(ans)


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const int N = 1e6+5;
string s,t = "Yes";
vector<int> v[N];
int n,result;
int a,b,c;

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

  cin >> a >> b >> c;
  cout << (c-(a-b) < 0 ? 0 : c-(a-b)) << endl;
}


Measured memory_bytes: 23680
S = input()

res = [0] * len(S)

odd, even, lpos, rpos = [0] * 4

now = 'R'
for (i, d) in enumerate(S):
  if d == now:
    if i % 2 != 0:
      odd += 1
    else:
      even += 1
  else:
    if d == 'L':
      lpos = i
      rpos = i-1
      if i % 2 != 0:
        res[lpos] += odd
        res[rpos] += even
      else:
        res[lpos] += even
        res[rpos] += odd
    if d == 'R':
      if i % 2 != 0:
        res[lpos] += even
        res[rpos] += odd
      else:
        res[lpos] += odd
        res[rpos] += even

    now = d
    odd, even = [0] * 2
    if i % 2 != 0:
      odd += 1
    else:
      even += 1

if i % 2 != 0:
  res[lpos] += odd
  res[rpos] += even
else:
  res[lpos] += even
  res[rpos] += odd

print(" ".join(map(str, res)))

Measured memory_bytes: 52956
S = list(input())
L = len(S)
B = int((L-1)/2)
C = int((L+3)/2)

flg = 0
for i in range(L):
    if i < B:
        if S[i] != S[B - 1 - i]:
            flg = 1
        if S[L - 1 - i] != S[C - 1 + i]:
            flg = 1

    if S[i] != S[L - 1 -i]:
        flg = 1

if flg == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
abm = input().split()

xyc = [0]*int(abm[2])

aa = input().split()
bb = input().split()
mi = [0]*int(abm[2])

for i in range(0,int(abm[2])):
  xyc[i] = input().split()

for i in range(0,int(abm[2])):
  x = int(xyc[i][0]) - 1
  y = int(xyc[i][1]) - 1
  c = int(xyc[i][2])
  mi[i] = int(aa[x]) + int(bb[y]) - c

ab = 0
aa =  [int(s) for s in aa]
bb =  [int(s) for s in bb]
ab = min(aa) + min(bb)
mi.append(ab)
print(min(mi))


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll  n,k;
    cin>>n>>k;
    if(n<=k){
        cout<<min(n,abs(n-k));
        return 0;
    }
    ll r=n%k;
    cout<<min(r,abs(r-k));
    
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			String text = sc.nextLine();
			text = text.replace('.', ',');
			text = text.replace(',', ' ');
			String[] word = text.split(" ");
			int count=0;
			
			for(int i=0; i<word.length; i++){		
				int n = word[i].length();
			
				if(n>=3 && n<=6) {
					if(count>0) System.out.print(" ");
					System.out.print(word[i].substring(0,n));
					count++;
				}
			}
			
			if(count>0) System.out.println();
		}
	
	}
}

Measured memory_bytes: 17212
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int a,b,x;
	cin >> a >> b >> x;
	if(x<a)
		NO;
	else if(x-a<=b)
		YES;
	else
		NO;
	ret 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define PI 3.141592653589793
int main(void)
{
  double a,b,C,c,L,S,H;
  scanf("%lf %lf %lf",&a,&b,&C);
  c=sqrt(((a*a)+(b*b))-(2*a*b*cos(C*PI/180)));
    L=a+b+c;
    S=(a*b*sin(C*PI/180))/2;
    H=S*2/a;
  printf("%f %f %f",S,L,H);
  return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector<pair<ll, ll>> prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		p.push_back(make_pair(i, 0));
		while ((n % i) == 0)
		{
			n /= i;
			p[i].second += 1;
		}
		p.push_back(make_pair(n, 0));
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ
ll combination(const ll n, const ll a)
{
	ll x = 1, y = 1;
	for (ll i = 0; i < a; i++)
	{
		x = x * (n - i) % MOD;
		y = y * (i + 1) % MOD;
	}
	return x * repeat_square(y, MOD - 2) % MOD;
}

int result = 0;

void dfs(int N, int M, int Q, vector<int> A, map<int, vector<int>> m)
{
	if (A.size() == N + 1)
	{ // 最初に入っている [1] は除いた数列で判定するため
		int temp = 0;
		rep(i, Q)
		{
			int a = m[i][0];
			int b = m[i][1];
			int c = m[i][2];
			int d = m[i][3];
			if ((A[b] - A[a]) == c)
				temp += d; // Aは 1番目から参照しているため、添字は -1 しなくて良い
		}

		if (temp > result)
			result = temp;
		return;
	}
	A.push_back(A.back()); // 直前の数を push（A1 <= A2 <= A3 ... An のため）
	while (A.back() <= M)
	{
		dfs(N, M, Q, A, m);
		A.back()++;
	}
}

int main()
{
	int A, B, H, M;
	cin >> A >> B >> H >> M;
	double result = 0;

  const long double PI = acos(-1);
	double h = H * 30 + M * 0.5; // 360 / 12 * 60
	double m = M * 6;
	double x = abs(h - m) ; // 度数×(π/180)

	result = sqrt(A*A + B*B - 2 * A * B * cos(x * (PI/180)));

	cout << fixed << setprecision(20) << result << endl;

	return 0;
}


Measured memory_bytes: 4140
// Solution to https://atcoder.jp/contests/dp/tasks/dp_p
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

const int MOD = 1e9 + 7;

struct result {
    long long black = 1, white = 1;

    long long either() const {
        return (black + white) % MOD;
    }
};

int N;
vector<vector<int>> adj;

const result &extend(const result &root) {
    return root;
}

result attach(const result &root, const result &child) {
    result answer;
    answer.black = root.black * child.white % MOD;
    answer.white = root.white * child.either() % MOD;
    return answer;
}

result dfs(int node, int parent) {
    result answer;

    for (int neighbor : adj[node])
        if (neighbor != parent) {
            result child = dfs(neighbor, node);
            answer = attach(answer, extend(child));
        }

    return answer;
}

int main() {
    scanf("%d", &N);
    adj.assign(N, {});

    for (int i = 0; i < N - 1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    printf("%lld\n", dfs(0, -1).either());
}


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

template<class T>
void merge(vector<T>& a,int left,int right){
  vector<T> tmp(right-left);
  int mid= (left+right)/2;
  int tl = left;
  int tr = mid;
  for(int idx=0;idx<(right-left);++idx){
    if(tl>=mid)tmp[idx]=a[tr++];
    else if(tr>=right)tmp[idx]=a[tl++];
    else tmp[idx] = (a[tl]<a[tr]?a[tl++]:a[tr++]);
  }
  for(int i=0;i<(right-left);++i){
    a[left+i] = tmp[i];
  }
}

template<class T>
void split(vector<T>& a,int left,int right){
  if(right-left>1){
    split(a,left,(left+right)/2);
    split(a,(left+right)/2,right);
  }
  merge(a,left,right);
}

template<class T>
void merge_sort(vector<T>& a){
  split(a,0,a.size());
}

template<class T>
class segtree {
private:
  ll n=1;
  T unit;
  std::vector<T> dat;
  std::function<T(T,T)> func;
public:
  segtree(){}
  segtree(std::vector<T>& a,T v,std::function<T(T,T)> f){
    build(a,v,f);
  }
  void build(std::vector<T>& a,T v,std::function<T(T,T)> f){
    ll sz=a.size();
    unit=v;
    func=f;
    while(n<sz)n<<=1LL;
    dat.resize(2*n-1,unit);
    for(int i=0;i<sz;++i)dat[i+n-1]=a[i];
    for(int i=n-2;i>=0;--i){
      dat[i]=func(dat[i*2+1],dat[i*2+2]);
    }
  }
  void update(ll idx,T val){
    idx+=n-1;
    dat[idx]=val;
    while(idx){
      idx--;idx>>=1LL;
      dat[idx]=func(dat[idx*2+1],dat[idx*2+2]);
    }
  }
  T query(ll a,ll b,ll k=0,ll l=0,ll r=-1){
    if(r<0)r=n;
    if( b<=l || r<=a )return unit;
    if( a<=l && r<=b )return dat[k];
    else{
      auto left=query(a,b,2*k+1,l,(l+r)/2);
      auto right=query(a,b,2*k+2,(l+r)/2,r);
      return func(left,right);
    }
  }
};


int main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];

  //merge_sort(a);
  sort(a.begin(),a.end());

  auto gcd = [](auto a,auto b){
    while(1){
      swap(a,b);
      if(b==0)return a;
      a%=b;
    }
  };

  segtree<ll> seg(a,0,gcd);

  ll ans = 1;
  rep(i,n){
    seg.update(i,0);
    ans = max(ans,seg.query(0,n));
    seg.update(i,a[i]);
  }
  cout<<(ans)<<endl;
  
}

Measured memory_bytes: 3072
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 int K =sc.nextInt();
      	 int g = 0;
      
      for(int a=1; a<=K; a++){
      for(int b=1; b<=K; b++){
      for(int c=1; c<=K; c++){
      g += gcd(gcd(a,b),c);
      }
      }
      }
      System.out.println(g);
    }
      public static int gcd(int num1,int num2) {
        if(num2==0) return num1;
        else return gcd(num2,num1%num2);
    }
}
      


Measured memory_bytes: 35608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll mod = 1000000007;
ll INF = 1000000009;

/*
struct bill{
    int t;
    int f;
    int o;
};
*/
//bill dp[2019][2019];
//dp[i][j]:i枚でj円を達成できるような紙幣の組み合わせ

void solve(){
    int n,m;
    cin >> n >> m;
    
    /*
    y = y/1000;
    
    rep(i,n+1){
        rep(j,y+1){
            dp[i][j].t = -1;
            dp[i][j].f = -1;
            dp[i][j].o = -1;
        }
    }

    bill b={0,0,0};
    dp[0][0]=b;
    bill b1={-1,-1,-1};
    bill b2={-1,-1,-1};
    bill b3={-1,-1,-1};

    for(int i=1; i<=n; i++){
        for(int j=1; j<=y; j++){
            if(j>=10) b1=dp[i-1][j-10];
            if(j>=5) b2=dp[i-1][j-5];
            b3=dp[i-1][j-1];

            if(j>=10&&b1.t!=-1){
                dp[i][j].t = b1.t +1;
                dp[i][j].f = b1.f;
                dp[i][j].o = b1.o;
            }

            else if(j>=5&&b2.t!=-1){
                dp[i][j].t = b2.t;
                dp[i][j].f = b2.f+1;
                dp[i][j].o = b2.o;
            }

            else if(b3.t!=-1){
                dp[i][j].t = b3.t;
                dp[i][j].f = b3.f;
                dp[i][j].o = b3.o+1;
            }

            else{
                dp[i][j].t=-1;
                dp[i][j].f=-1;
                dp[i][j].o=-1;
            }

            cout << "i:" << i << " j:" << j << " dp[i][j]:" << dp[i][j].t << " " << dp[i][j].f << " " << dp[i][j].o  << endl;

        }
        
    }
    
    cout << dp[n][y].t << " " << dp[n][y].f << " " << dp[n][y].o << endl;
    */
    int x=-1;
    int y=-1;
    int z=-1;
    for(int i=0; i<=n; i++){
        for(int j=0; j<=n; j++){
            int k = n-i-j;
            if(k>=0){
                if(i*10000+j*5000+k*1000==m){
                    x=i;
                    y=j;
                    z=k;
                }
            }
        }
    }

    cout << x << " " << y << " " << z << endl;

}

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


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

a,b = map(int,input().split())

str= input()

ans = ""

for i in range(a):
    if i == b-1:
        cha = str[i]
        c = cha.lower()
        ans += c
    else:
        ans += str[i]
print(ans)


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

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[N-1]-a[0];
}






Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Problem solver = new Problem();
        solver.solve(0, in, out);
        out.close();
    }

    static class Problem {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            long k = in.nextLong();
            int[] A = new int[n], B = new int[m];

            for (int i = 0; i < n; i++)
                A[i] = in.nextInt();
            for (int i = 0; i < m; i++)
                B[i] = in.nextInt();

            long[] a = new long[n + 1];
            for (int i = 0; i < n; i++)
                a[i + 1] = A[i] + a[i];

            long[] b = new long[m + 1];
            for (int i = 0; i < m; i++)
                b[i + 1] = B[i] + b[i];

            int j = m;
            long res = 0;
            for (int i = 0; i <= n; i++) {
                if (a[i] > k)
                    break;
                while(b[j] + a[i] > k)
                    j--;
                res = Math.max(res, i + j);
            }

            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

    }
}



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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  llong L;
  cin >> L;

  cout << fixed << setprecision(30) << L*L*L/27.0l << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define PI 3.14159265359

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

    const int nmax = 50;
    char A[nmax][nmax], B[nmax][nmax];

    rep(i,n){
        rep(j,n){
            cin >> A[i][j];
        }
    }

    rep(i,m){
        rep(j,m){
            cin >> B[i][j];
        }
    }

    bool exist = false;

    rep(i, n){
        rep(j, n){
            if(i + m -1 >= n or j + m - 1 >= n) continue;

            bool match = true;
            for(int y=0; y<m; y++){
                for(int x=0; x<m; x++){
                    if(A[i+y][j+x] != B[y][x]) match = false;
                }
            }
            if(match) exist = true;
        }
    }

    if(exist){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second

signed main(){
    int a,b,c;
    cin>>a>>b>>b>>b>>b>>c;
    if(b-a<=c)cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}


Measured memory_bytes: 256
N, M = [int(s) for s in input().split()]

num = 10 ** (N - 1) if N > 1 else 0
# print(num)
num_str = str(num)

char_list = []
for i in range(N):
    char_list.append(num_str[i])
# print(char_list)

flag_list = [False] * N
for _ in range(M):
    s, c = input().split()
    i = int(s) - 1

    if N > 1 and i == 0 and c == "0":
        char_list = None
        break

    if flag_list[i]:
        if char_list[i] != c:
            char_list = None
            break
    else:
        char_list[i] = c
        flag_list[i] = True

result = "-1"
if char_list is not None:
    result = "".join(char_list)
print(result)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line = reader.readLine();
		String[] str = line.split("");
		int N = str.length;
		int count = 0;
		for (int i = 0; i < N; i++) {
			if (str[i].equals("x")) {
				count++;
			}
		}
		if (count <= 7) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 22740
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;

typedef pair<int, int> P;

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

long x[300003][2];
int main() {
		long N;
		string s;
		cin >> N;
		cin >> s;
		REP(i, 2)REP(j, 2)x[i][j] = 0;
		REP(i,N) {
			if (s[i] == 'W')x[i+2][0] = x[i +1][0] + 1;
			else x[i + 2][0] = x[i + 1][0];
			if (s[i] == 'E')x[i+2][1] = x[i + 1][1] + 1;
			else x[i + 2][1] = x[i + 1][1];
		}
		long ans = INF;
		FOR(i,2, N+2) {
			long c = x[i-1][0]-x[0][0] + x[N+1][1]-x[i][1];
			if (c < ans)ans = c;
		}
		cout << ans << endl;
}


Measured memory_bytes: 5380
from itertools import accumulate as acc
f = lambda: map(int,input().split())
n,m,q = f()
d = [[0 for _ in range(n)]for _ in range(n)]
for _ in range(m):
    l,r = f()
    d[l-1][r-1] += 1
P,Q = [],[]
for _ in range(q):
    a, b = f()
    P.append(a)
    Q.append(b)

for i in range(n):
    d[i] = list(acc(d[i]))
for i in range(n-2,-1,-1):
    for j in range(n):
        d[i][j] += d[i+1][j]
for i in range(q):
    print(d[P[i]-1][Q[i]-1])

Measured memory_bytes: 14660
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define Inf 1000000000
#define nmax_def 110000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

int main() {
	string N;
	cin >> N;
	int K;
	cin >> K;
	int Nlen = N.length();
	ll ans = 0;
	vector<vector<vl>> DP(Nlen+1);
	rep(i, Nlen + 1) {
		DP[i].resize(2);
		rep(d, 2) { // 0 or other
			DP[i][d].resize(K + 1, 0);
		}
	}

	DP[0][0][0] = 1;

	rep(i, Nlen) {
		rep(k, K + 1) {
			DP[i + 1][0][k] += DP[i][0][k] + 9 * DP[i][1][k];
			if (k != K)
				DP[i + 1][1][k + 1] += DP[i][0][k] + 9 * DP[i][1][k];
		}
	}

	int count_not_zero = 0;
	rep(i, Nlen) {
		int n = (int)N[i] - (int)'0';
		if (i == Nlen - 1)
			n++;
		rep(d, n) {
			if (d == 0)
				ans += DP[Nlen - i][0][K - count_not_zero];
			else
				ans += DP[Nlen - i][1][K - count_not_zero];
		}
		if (n != 0)
			count_not_zero++;
		if (K - count_not_zero < 0)
			break;
	}
	ans -= DP[0][0][K]; // K != 0 なので無意味

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;

// 最大公約数を求める
template<typename T> T gcd(T a, T b)
{
	return b > 0 ? gcd(b, a % b) : a;
}

// 最小公倍数を求める
template<typename T> T lcm(T a, T b)
{
	return a / gcd(a, b) * b;
}

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

	println(lcm(a, b));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) { ll res=1; a%=mod; assert(b>=0); for(;b;b>>=1) { if(b&1) res=res*a%mod; a=a*a%mod; } return res; }
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 gcd2(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {   x = 1;  y = 0;  return a;   }
    ll xx, yy;
    ll res = gcd2(b, a%b, xx, yy);
    x = yy;     y = xx - yy * (a / b);
    return res;
}

// ll nCr(ll n, ll r) {
//     return ( ( ( (fac[n] * powmod(fac[n-r], mod-2)) % mod ) * powmod(fac[r], mod-2) ) % mod );
// }
// const ll sz = 1e6 + 5;
// vector<ll> fac(sz, 1);

// * ALways PASS arrays, strings etc to functions BY REFERENCE

vector<int> par, sz;

int fs(int x) {
    return ((par[x] == x) ? x : par[x] = fs(par[x]));
}

void us(int a, int b) {
    a = fs(a);
    b = fs(b);
    
    if (a == b)
        return;
    
    if (sz[a] > sz[b])
        swap(a, b);
        
    par[a] = b;
    sz[b] += sz[a];
}

int main() {
    // for (int i = 1; i < sz; i++)
    //     fac[i] = (fac[i-1] * i) % mod;
    
    int t = 1;
    // cin >> t;
    
    while(t--) {
        int n, m;
        cin >> n >> m;
        
        sz.resize(n,1);
        par.resize(n);
        for (int i = 0; i < n; i++)
            par[i] = i;
        
        int a, b;
        for (int i = 0; i < m; i++) {
            cin >> a >> b;
            us(a-1, b-1);
        }
        
        int mx_sz = 0;
        for (int i = 0; i < n; i++)
            mx_sz = max(mx_sz, sz[fs(i)]);
        
        cout << mx_sz << endl;
    }
    
	return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	string s;
	cin >>n >>s;
	
	VI z(n);
	rep(i, n) z[i] = s[i]=='R'? 0: s[i]=='G'? 1: 2;
	vector<VI> sm(3, VI(n+1));
	rep(i, n) rep(j, 3){
		sm[j][i+1] = sm[j][i] + (j==z[i]);
	}
	ll ans = 0;
	
	rep(i, n) rep2(j, i+1, n) if(z[i] !=z[j]){
		int p = (z[i]+z[j]==3)? 0 : (z[i]+z[j]==2)? 1: 2;
		ans += sm[p][n] - sm[p][j+1];
		if(j-i + j < n && z[j-i+j] == p) ans--; 
	}
	cout <<ans <<"\n";
	return 0;
}


Measured memory_bytes: 3720
import java.util.*;
import java.io.*;
public class Main
{
  public static void main(String [] args)
  {
    Scanner sc=new Scanner(System.in);
    int K=sc.nextInt();
     String s=sc.next();
    if(s.length()<=K)
      System.out.print(s);
    else
      System.out.print(s.substring(0,K)+"...");
    
  }
}

Measured memory_bytes: 27048