akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

struct point {
	ll x;
	ll y;
	point(ll x = 0, ll y = 0) : x(x), y(y) {}
};

ll dist(point a, point b) {
	return abs(a.x - b.x) + abs(a.y - b.y);
}

ll dist_x(point a, point b) {
	return abs(a.x - b.x);
}

ll dist_y(point a, point b) {
	return abs(a.y - b.y);
}

int main() {
	ll k;
	point goal;
	cin >> k >> goal.x >> goal.y;
	point current(0ll, 0ll);
	if(k % 2 == 0 && dist(current, goal) % 2 == 1) {
		cout << -1 << endl;
		return 0;
	}
	int dx = 1, dy = 1;
	if(goal.x < 0) dx = -1;
	if(goal.y < 0) dy = -1;
	vector<point> ans;
	while(dist(current, goal) > 2 * k || dist(current, goal) % 2 == 1) {
		if(dist_x(current, goal) >= k) {
			current.x += dx * k;
		}
		else if(dist_x(current, goal) > 0) {
			current.y += dy * (k - dist_x(current, goal));
			current.x = goal.x;
		}
		else {
			current.y += dy * k;
		}
		ans.push_back(current);
	}
	if(current.y > goal.y) dy = -1;
	else dy = 1;
	if(dist(current, goal) > 0) {
		ll remain = dist(current, goal) / 2;
		if(dist_x(current, goal) >= remain) {
			current.y += -1 * dy * (k - remain);
			current.x += dx * remain;
		}
		else {
			current.y += dy * (remain - dist_x(current, goal));
			current.x += dx * (k - remain + dist_x(current, goal));
		}
		ans.push_back(current);
		ans.push_back(goal);
	}
	cout << ans.size() << endl;
	for(auto i : ans) {
		cout << i.x << ' ' << i.y << endl;
	}
}


Measured memory_bytes: 5484
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#define ALL(X) X.begin(), X.end()
#define SZ(A) int((A).size())
#define RALL(X) X.rbegin(), X.rend()
#define FOR(B) for (size_t i = 0; i < B; i++)
#define FOR2(B) for (size_t j = 0; j < B; j++)
#define FORE(B) for (size_t i = 1; i <= B-1; i++)
#define FORC(A, B) for (size_t i = A; i < B; i++)
#define PRINT(X) cout << X << endl
#define PRINTALL(E, X) { FOR(X) {cout << E[i] << endl; } }
#define PRINTSIDE(E, X) { FOR(X) {cout << E[i] << " ";} }
#define READALLI(V, N) FOR(N) {int x; cin >> x; V.push_back(x); }
#define READALL(V, N) FOR(N) {LL x; cin >> x; V.push_back(x); }
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXN 100000
#define SQRSIZE  317
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll>VL;
typedef vector<pii> vpii;
typedef map<int, int> mii;
typedef map<char, int>mci;
typedef map<string, int> msi;
typedef set<int> si;
const int INF = (1 << 30);

int main() {
   mci s, t;
   mci::iterator it;
   string ss, ts;
   cin >> ss >> ts;
   for(int q = 0; q < ss.size(); q++){
       s[ss[q]]++;
       t[ts[q]]++;
   }
   vi vs, vt;
   for(it = s.begin(); it != s.end(); ++it){
       if(it->second > 0)
           vs.push_back(it->second);
   }

    for(it = t.begin(); it != t.end(); ++it){
        if(it->second > 0)
            vt.push_back(it->second);
    }

    sort(vs.begin(), vs.end());
    sort(vt.begin(), vt.end());
    for(int q = 0; q < max(vs.size(), vt.size()); q++){
        if(vs[q] != vt[q]){
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";

   return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<int,int> P;


int main(){
    string s; cin >> s;
    int q; cin >> q;
    deque<char> pre,tale;
    int rev_cnt=0;
    rep(i,q){
        int n; cin >> n;
        if(n==1){
            // reverse(pre.begin(),pre.end());
            // reverse(tale.begin(),tale.end());
            // swap(pre,tale);
            rev_cnt++;
        }else{
            int a; cin >> a;
            char b[1]; cin >> b[0];
            if(a==1&&rev_cnt%2==0){pre.push_front(b[0]);}
            if(a==1&&rev_cnt%2==1){tale.push_back(b[0]);}
            if(a==2&&rev_cnt%2==0){tale.push_back(b[0]);}
            if(a==2&&rev_cnt%2==1){pre.push_front(b[0]);}
        }
    }
    string ans="";
    rep(i,pre.size()){
        ans+=pre[i];
    }
    ans+=s;
    rep(i,tale.size()){
        ans+=tale[i];
    }
    if(rev_cnt%2 == 1){
        reverse(ans.begin(),ans.end());
        // reverse(pre.begin(),pre.end());
        // reverse(tale.begin(),tale.end());
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1248
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<iomanip>
using namespace std;

int main()
{
	map<double, double> x;
	map<double, double> y;
	map<double, double> z;
	map<double, double> s;
	auto k = x.begin();
	for (int a = 0; a < 8; a++) {
		double b, c;
		cin >> b >> c;
		x.insert(pair<double,double>(c,b));
	}
	k = x.begin();
	k++; k++;
	s.insert(pair<double, double>(k->first, k->second));
	k++;
	s.insert(pair<double, double>(k->first, k->second));
	for (int a = 0; a < 8; a++) {
		double b, c;
		cin >> b >> c;
		y.insert(pair<double, double>(c,b));
	}
	k = y.begin();
	k++; k++;
	s.insert(pair<double, double>(k->first, k->second));
	k++;
	s.insert(pair<double, double>(k->first, k->second));
	for (int a = 0; a < 8; a++) {
		double b, c;
		cin >> b >> c;
		z.insert(pair<double,double>(c,b));
	}
	k =z.begin();
	k++; k++;
	s.insert(pair<double, double>(k->first, k->second));
	k++;
	s.insert(pair<double, double>(k->first, k->second));

	k = x.begin();
	cout <<  k->second<< fixed << setprecision(2) << " "<<k->first<< endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k = y.begin();
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
		k = z.begin();
		cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k = s.begin();
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
	k++;
	cout << fixed << setprecision(0) << k->second << fixed << setprecision(2) << " " << k->first << endl;
}

Measured memory_bytes: 3204
//package src.com.jetman.atcoder;

import java.util.*;

/**
 * @description:
 * @author: Jetman
 * @create: 2020-08-29 14:39
 **/
public class Main {

    Scanner sc = new Scanner(System.in);

    long MOD = 998244353L;

    long dp[];

    private void slove() {

        int n = sc.nextInt();
        int k = sc.nextInt();

        int[][] a = new int[k][2];
        for (int i = 0; i < k; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        dp = new long[n+1];
        dp[1] = 1;
        long[] sum = new long[n+1];
        sum[1] = 1;
        for (int i = 2; i <= n ; i++) {
            long tmp = 0;
            for (int j = 0; j < k; j++) {
                int l = i - a[j][1] > 0 ? i - a[j][1]-1 : 0;
                int r = i - a[j][0] > 0 ? i - a[j][0] : 0;
                dp[i] = (dp[i] + sum[r] - sum[l] + MOD)%MOD;
            }
            sum[i] = (sum[i-1] + dp[i])%MOD;
        }


        System.out.println(dp[n]);



    }

    private void build(Map<Integer, List<Integer>> edge, int l, int r) {
        List<Integer> list = edge.getOrDefault(l, new ArrayList<>());
        list.add(r);
        edge.put(l,list);
    }


    public static void main(String[] args) {
        new Main().slove();
    }
}


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

int main()
{
    int trans = 'a' - 'A';
    string str;

    getline( cin, str );
    
    for( int i = 0; i < str.size(); i++ )
    {
        if( str[i] >= 'a' && str[i] <= 'z' )
            str[i] = str[i] - trans; 
    }

    cout << str << endl;

    return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];
    ll s=0;
    rep(i,N) s ^= a[i];
    rep(i,N) {
        ll ans=0;
        ans = a[i] ^ s;
        if (i != 0)
            cout << " ";
        cout << ans;
    }
    cout << endl;
}


Measured memory_bytes: 4404
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VectorSpaceModel
{
    class Program
    {
        // https://codeforces.com/contest/ + ContestId

        static void Main(string[] args)
        {
            var a = Console.ReadLine();

            var balance = 0;
            var isok = true;

            for (int i = 0; i < a.Length; i++)
            {
                if (i % 2 == 0)
                {
                    if (a[i] != 'h')
                    {
                        isok = false;
                        break;
                    }
                }
                else
                {
                    if (a[i] != 'i')
                    {
                        isok = false;
                        break;
                    }
                }
            }


            if (isok && a.Length % 2 == 0)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");


        }

    }

}


Measured memory_bytes: 11092
/*------U Have To DO It------*/
/*      BY-> RicoProg        */
/*        ___ 
           __|__|
          |  |___           */
#include <bits/stdc++.h>
using namespace std;
 
/**/
 
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define ld long double
#define beg(i ,n) for(ll i=0;i<n;i++)
#define beg1(i ,n) for(ll i=1;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back 
#define eb emplace_back
#define mp make_pair
#define nl "\n" 
#define sp " "
#define vec(v , n) vector<ll> v(n)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pll pair<ll , ll>
#define mii map<int , int>
#define mll map<ll , ll>
#define mlb map<ll , bool>
#define msi map<string , int>
#define mci map<char , int>
#define f1 first
#define f2 second

//---------------------------------------------------GLOBAL----------------------------------------------------------
const ll MOD2 = 998244353 ;
const ll MOD = 1e9 + 7 ;
const ll MAX = 1e5 + 7 ;
const ll inf = 1e18L + 5 ;
const double pi = 3.14159265358979323846 ;
ll fpow(ll n , ll m ){ll res=1 ;while(m>0){if(m&1){res*=n ;}m/=2 ;n*=n ;}return res;}
ll modInv(ll n){return fpow(n , MOD-2);}
//---------------------------------------------------FUNCTIONS-------------------------------------------------------

const ll nax = 1e5 + 5 ;

void solve(){
	ll x , y ;
    cin >> x >> y; 
    ll xtra = y - 2*x ; 
    if(xtra < 0 || xtra&1) cout << "No" << nl ;
    else if(xtra/2 <= x) cout << "Yes" << nl ;
    else cout << "No" << nl ;
}

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

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
	string s;

	cin >> s;

	for(int i=0;i<s.size();i++){
		cout << s[i];
		if(i == 3)cout << " " ;
	}
	cout <<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
  int findSumOfDigits(int n){
    int sum = 0;
    while(n > 0){
      sum += n % 10;
      n /= 10;
    }
    return sum;
  }
int main(void){
  int N;
  cin >> N;
  int sum = findSumOfDigits(N);
  if(N % sum == 0) cout << "Yes" <<endl;
  else cout << "No" <<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    S = list(input())


    if len(S) == 26:
        # abc = [chr(i) for i in range(97, 123)]
        # print(S)
        for i in range(25, -1, -1):
            for j in range(25, i, -1):
                # print(i, j, S[i], S[j])
                if S[i] < S[j]:
                    ans = S[:i] + [S[j]]
                    printlist(ans, '')
                    return

        print(-1)

    else:
        abc = [chr(i) for i in range(97, 123)]

        for s in S:
            if s in abc:
                abc[ord(s) - 97] = 0

        for t in abc:
            if t != 0:
                S.append(t)
                printlist(S, k='')
                return


if __name__ == '__main__':
    solve()


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

int main() {
    char A,B;
    cin >> A >> B;
    if ((A == 'H' && B == 'H')||(A == 'D' && B == 'D')) {
        cout << 'H' << endl;
    }
    else {
        cout << 'D' << endl;
    }
}



Measured memory_bytes: 3488
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int N, L;
  vector<string> sv;
  
  cin >> N >> L;
  for(int i = 0; i < N; i++) {
    string tmp;
    cin >> tmp;
    sv.push_back(tmp);
  }
  sort(sv.begin(), sv.end());
  
  for(int i = 0, svsize = sv.size(); i < svsize; i++) {
    cout << sv[i] << flush;
  }
  cout << endl;
  
  return 0;
}
  

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        final int m = fs.nextInt();
        final int mines = fs.nextInt();
        final int[] rows = new int[n + 1];
        final int[] cols = new int[m + 1];
        final List<int[]> bombs = new ArrayList<>();
        final Set<String> seen = new HashSet<>();
        int maxR = 0;
        int maxC = 0;
        for (int i = 0; i < mines; i++) {
            final int x = fs.nextInt();
            final int y = fs.nextInt();
            maxR = Math.max(maxR, ++rows[x]);
            maxC = Math.max(maxC, ++cols[y]);
            bombs.add(new int[] { x, y });
            seen.add(x + "," + y);
        }
        int res = 0;
        for (int[] bomb : bombs) {
            res = Math.max(res, rows[bomb[0]] + cols[bomb[1]] - 1);
        }
        for (int i = 1; i <= n; i++) {
            if (rows[i] == maxR) {
                for (int j = 1; j <= m; j++) {
                    res = Math.max(res, maxR + cols[j] - (seen.contains(i + "," + j) ? 1 : 0));
                }
                break;
            }
        }
        for (int i = 1; i <= m; i++) {
            if (cols[i] == maxC) {
                for (int j = 1; j <= n; j++) {
                    res = Math.max(res, maxC + rows[j] - (seen.contains(j + "," + i) ? 1 : 0));
                }
                break;
            }
        }
        System.out.println(res);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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 a,b;
void solve(){
	cin >> a >> b;
	cout << a*b << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define pll pair<ll,ll>
const ll maxn= 2e5+10;
const ll mod = 5000000  ;
const ll base= 1e7;
ll a[maxn];
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*  if (fopen("D_tst.INP","r"))
      {
          freopen("D_tst.INP","r", stdin);
          freopen("D_tst_1.cpp", "w",stdout);
      }*/
      ll n;
       cin>>n ;
       ll nw=0;
       ll mg=0;
       ll cst=1000;
       for (int i=1;i<=n;i++)
       {
           cin>>a[i];
       }
        nw=cst/a[1];
              mg=a[1];
              cst=cst%a[1];
       for (int i=2;i<=n;i++)
       {

            if(a[i]>mg)
            {
                cst=nw*a[i]+cst;
                mg=0;
                nw=0;
                 nw=cst/a[i];
              mg=a[i];
              cst=cst%a[i];
            }
            else if (a[i]<mg)
            {
              cst=cst+mg*nw;
              mg=a[i];
              nw=cst/a[i];
              cst=cst%a[i];
            }

       }

           cst=cst+nw*mg;
       cout <<cst;


}
/*10 1
56 12 68 23 41 29 97 69 79 76
1 3 5
*/


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define MOD 10000
using namespace std;
 
int P[100];
int n, k;
int memo[4][101][4];
 
int search(int ren, int d, int p){
  if(d == n) return 1;
  if(memo[ren][d][p] != -1) return memo[ren][d][p];
 
  int res = 0;
  if(P[d] == 0){
    for(int i = 1; i <= 3; i++){
      if(p == i){
    if(ren + 1 >= 3) continue;
    res += search(ren+1, d+1, i) % MOD;
      }else{
    res += search(1, d+1, i) % MOD;
      }
    }
  }else{
    if(p == P[d]){
      if(ren + 1 >= 3) res = 0;
      else res += search(ren+1, d+1, P[d]) % MOD;
    }
    else res += search(1, d+1, P[d]) % MOD;
  }
 
  memo[ren][d][p] = res % MOD;
  return memo[ren][d][p];
  //return res;
}
 
int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
 
  cin >> n >> k;
  for(int i = 0; i < 4; i++) for(int j = 0; j < 100; j++) for(int k = 0; k < 4; k++) memo[i][j][k] = -1;
  for(int i = 0; i < 100; i++){
    P[i] = 0;
  }
  for(int i = 0; i < k; i++){
    int d, p;
    cin >> d >> p;
    d--;
    P[d] = p;
  }
 
  cout << search(1, 0, 0) << endl;
 
  return 0;
}

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

#define int long long
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).end()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a,n) sort(a, a+n)
#define sortvec(V) sort(all(V))

typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;
void solve()
{
    int n;
    cin >> n;
    int ans = 0;
    int a[n + 1];
    for(int i = 0; i <= n; i++) a[i] = 1;
    a[0] = 0;
    for(int i = 2; i <= n; i++)
        for(int j = i; j <= n; j += i)
            a[j] += 1;
    for(int i = 1; i <= n; i++)
        ans += i * a[i];
    cout << ans << endl;
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
}

Measured memory_bytes: 81880
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    L, R = LI()

    # L %= 2019
    # R %= 2019
    # if R <= L:
    #     R += 2019

    ans = 2018    
    for i, j in itertools.combinations(range(L, min(R, L + 2019) + 1), 2):
        ans = min(i * j % 2019, ans)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10144
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;cin>>n;
  int a[n];
  for(int i = 0; n > i; i++)cin>>a[i];
  long long sh = 0;
  long long nw = 0;
  for(int i = 0; n > i; i++){
    nw = (long long)nw+a[i];
    if(i % 2 == 0)if(nw<=0)sh = (long long)sh+1-nw,nw=1;
    if(i % 2 == 1)if(nw>=0)sh = (long long)sh+nw+1,nw=-1;
  }
  long long hs = 0;
  nw = 0;
  for(int i = 0; n > i; i++){
    nw = (long long)nw+a[i];
    if(i % 2 == 1)if(nw<=0)hs = (long long)hs+1-nw,nw=1;
    if(i % 2 == 0)if(nw>=0)hs = (long long)hs+nw+1,nw=-1;
  }
  cout << min(hs,sh) << endl;
}

Measured memory_bytes: 640
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextLong() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextDouble() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	for i, v := range a {
		if i > 0 {
			io.writer.WriteString(" ")
		}
		fmt.Fprintf(io.writer, "%v", v)
	}
	io.writer.WriteString("\n")
}

func (io *Io) PrintfLn(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format + "\n", a...)
}

func (io *Io) PrintIntLn(a ...int) {
	for i, v := range a {
		if i > 0 {
			io.writer.WriteString(" ")
		}
		fmt.Fprint(io.writer, v)
	}
	io.writer.WriteString("\n")
}

type UnionFind struct {
	data []int
}

func NewUnionFind(n int) *UnionFind {
	data := make([]int, n)
	for i := 0; i < n; i++ {
		data[i] = -1
	}
	return &UnionFind{
		data,
	}
}

func (u *UnionFind) root(x int) int {
	if u.data[x] < 0 {
		return x
	} else {
		r := u.root(u.data[x])
		u.data[x] = r
		return r
	}
}

func (u *UnionFind) same(x, y int) bool {
	return u.root(x) == u.root(y)
}

func (u *UnionFind) size(x int) int {
	return -u.data[u.root(x)]
}

func (u *UnionFind) merge(x, y int) {
	x = u.root(x)
	y = u.root(y)
	if x != y {
		if u.size(x) < u.size(y) {
			x, y = y, x
		}
		u.data[x] += u.data[y]
		u.data[y] = x
	}
}

type Tuple2 struct {
	first, second int
}

func main() {
	io := NewIo()
	defer io.Flush()
	N, K, L := io.NextInt(), io.NextInt(), io.NextInt()
	ar := NewUnionFind(N)
	for i := 0; i < K; i++ {
		p, q := io.NextInt(), io.NextInt()
		p--
		q--
		ar.merge(p, q)
	}
	br := NewUnionFind(N)
	for i := 0; i < L; i++ {
		p, q := io.NextInt(), io.NextInt()
		p--
		q--
		br.merge(p, q)
	}
	c := make(map[Tuple2]int)
	for i := 0; i < N; i++ {
		c[Tuple2{ar.root(i), br.root(i)}]++
	}
	ans := make([]int, N)
	for i := 0; i < N; i++ {
		ans[i] = c[Tuple2{ar.root(i), br.root(i)}]
	}
	io.PrintIntLn(ans...)
}


Measured memory_bytes: 20224
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int X, t;
	cin >> X >> t;

	cout << max(0LL, X - t) << endl;

	return 0;
}

Measured memory_bytes: 256
N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]
T=sorted(T)
answer=0
base=T[0]
count=0

for t in T:
    if t>base+K or count>=C:
        answer+=1
        base=t
        count=1
    else:
        count+=1
    #print(t,count)
answer+=1

print(answer)


Measured memory_bytes: 8280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  vector <ll> v1 = {1, 3, 5, 7, 8, 10, 12};
  vector <ll> v2 = {4, 6, 9, 11};
  ll a, b; cin >> a >> b;
  ll tmp1, tmp2;
  rep(i, 7) {
    if (v1.at(i) == a) tmp1 = 1;
    if (v1.at(i) == b) tmp2 = 1;
  }
  rep(i, 4) {
    if (v2.at(i) == a) tmp1 = 2;
    if (v2.at(i) == b) tmp2 = 2;
  }
  if (a == 2) tmp1 = 3;
  if (b == 2) tmp2 = 3;
  if (tmp1 == tmp2) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;

using int64 = long long;

int main()
{
  int64 K, A, B;
  cin >> K >> A >> B;

  int64 D = A - B;

  if(D <= 0) {
    if(A >= K) {
      cout << 1 << endl;
    } else {
      cout << -1 << endl;
    }
  } else {
    cout << 1 + 2 * ((K - A + D - 1) / D) << endl;
  }
}

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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll i, j, k;
    string A;
    cin >> A;
    ll N = A.length();
    vector<vll> P;
    for(i = 0; i < 26; i++) {
        char c = 'a' + i;
        vll Pi(N, 0);
        ll p = N;
        for(j = N - 1; j >= 0; j--) {
            if(A[j] == c) {
                p = j;
            }
            Pi[j] = p;
        }
        P.push_back(Pi);
    }
    vll dp(N + 2, 0);
    dp[N + 1] = 0;
    dp[N] = 1;
    for(i = N - 1; i >= 0; i--) {
        ll minl = INF;
        for(j = 0; j < 26; j++) {
            // char c = 'a' + j;
            minl = min(minl, 1 + dp[P[j][i] + 1]);
        }
        dp[i] = minl;
    }
    string ans = "";
    ll p = 0;
    while(1) {
        for(j = 0; j < 26; j++) {
            char c = 'a' + j;
            if(dp[P[j][p] + 1] + 1 == dp[p]) {
                ans += c;
                p = P[j][p] + 1;
                if(p >= N) {
                    cout << ans << endl;
                    return 0;
                }
                break;
            }
        }
    }
}


Measured memory_bytes: 47212
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}




int main(){
    int W, H, x, y;
    cin >> W >> H >> x >> y;

    cout << fixed << setprecision(10) << (double) W * H/2  << " ";
    cout << ( (W == x*2 && H == y*2)?1:0) << endl;


}

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

using namespace std;

using ll = long long;

vector<vector<int>> tree;
vector<int> v;

void up(int node, int val)
{
    v[node] += val;
    for (auto e : tree[node])
        up(e, v[node]);
    return;
}

int main() 
{
    int n, q; cin >> n >> q;
    tree = vector<vector<int>>(n, vector<int>());
    for (int i = 0; i < n - 1; i++)
    {
        int a, b; cin >> a >> b;
        tree[a - 1].push_back(b - 1);
    }
    v = vector<int>(n, 0);
    while (q--)
    {
        int p, x; cin >> p >> x;
        v[p - 1] += x;
    }
    up(0, 0);
    for (auto e : v)
        cout << e << " ";
    return 0;
}

Measured memory_bytes: 20352
#include <stdio.h>
#include <vector>
 
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(void)
{
  int K, X;
 
  scanf("%d %d",&K, &X);
  
  rep(i,K-1){
    if(X-K+i+1>-1000000) printf("%d ",X-K+i+1);
  }
  rep(i,K){
    if(X+i<1000000) printf("%d ",X+i);
  }
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string A;
	scan(A);
	int alnum[26]={};
	ll ans=1;
	rep(i,A.size()){
		ans+=i-alnum[A[i]-'a'];
		alnum[A[i]-'a']++;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 640
def judge():
    if m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    judge()



Measured memory_bytes: 5600
#include <iostream>

using namespace std;

int main(){
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int cnt = 0;
  for(int i = 0; i <= A; i++){
    for(int j = 0; j <= B; j++){
      for(int k = 0; k <= C; k++){
        if(i*500 + j*100 + k*50 == X) cnt++;
      }
    }
  }
  cout << cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
 
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
int main(){
    int n;
    cin>>n;
    rep(i,n){
        string s;cin>>s;
        set<string> se;
        rep(i,s.size()-1){
            string a=s.substr(0,i+1);
            string b=s.substr(i+1);
            string c=a,d=b;
            reverse(all(c));
            reverse(all(d));
            se.insert(a+b);
            se.insert(b+a);
            
            se.insert(a+d);
            se.insert(d+a);
            
            se.insert(d+c);
            se.insert(c+d);
            
            se.insert(b+c);
            se.insert(c+b);
        }

        // for(auto t:se){
        //     cout<<t<<endl;
        // }
        cout<<se.size()<<endl;
    }
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
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;}
// head

const int N=201000;
int n,len[N],p[N];
ll ans;
int main() {
	scanf("%d",&n);
	rep(i,0,n) {
		scanf("%d",p+i);
		if (p[i]>i) {
			puts("-1");
			return 0;
		}
		len[i-p[i]]=max(len[i-p[i]],p[i]);
	}
	rep(i,0,n-1) if (p[i]+1<p[i+1]) {
		puts("-1");
		return 0;
	}
	rep(i,0,n) ans+=len[i];
	printf("%lld\n",ans);
}


Measured memory_bytes: 1792
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()

  for i in range(N+1):
    x=i*1.08
    if int(x)==N:
      return i
  return ':('

# main()
print(main())


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a%3 == 0 || b%3 == 0 || (a+b)%3 == 0){
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,p[10000],i,sum=0,max;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
    sum+=p[i];
  }
  max=p[0];
  for(i=1;i<n;i++){
    if(max<p[i]){
      max=p[i];
    }
  }
  sum-=max/2;
  printf("%d",sum);
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
a.insert(0,0)

dist=0
for i in range(n):
  dist+=abs(a[i]-a[i+1])
dist+=abs(a[n])
for i in range(1,n):
  print(dist-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]))
print(dist-abs(a[n]-a[n-1])-abs(a[n])+abs(a[n-1]))

Measured memory_bytes: 14048
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		class Data
		{
			int id;
			int score;
		}
		ArrayList<Data> data = new ArrayList<>();
		
		for(; ;)
		{
			String[] input = scanner.next().split(",");
			
			int id = Integer.parseInt(input[0]);
			int score = Integer.parseInt(input[1]);
			if(id==0 && score==0)
			{
				break;
			}
			
			Data d = new Data();
			d.id = id;
			d.score = score;
			data.add(d);
		}
		
        Collections.sort(
                data,
                new Comparator<Data>()
                {
                    @Override
                    public int compare(Data o1, Data o2)
                    {
                        return o1.score>o2.score ? -1: 1;
                    }
                });
		
		for(; scanner.hasNext();)
		{
			int id = Integer.parseInt(scanner.next());
			int lank = 1;
			for(int i=0; i<data.size(); i++)
			{
				if(id == data.get(i).id)
				{
					System.out.println(lank);
					break;
				}
				if(i < data.size()-1)
				{
					if(data.get(i).score > data.get(i+1).score)
					{
						lank ++;
					}
				}
			}
		}
		
	}
}

Measured memory_bytes: 25888
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;


int main()
{
	int N = 2000001, offset = 1000000;
	int k, x;
	cin >> k >> x;
	x += offset;

	for (int i = max(0, x - k + 1); i <= min(N, k + x - 1); ++i)
		cout << i - offset << " ";
	cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[10000];
int main(){
	int n,ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		for(int j=2;j<=sqrt(a[i]);j++){
			if(a[i]!=j&&a[i]%j==0){
				goto age;
			}
		}
		ans++;
		age:;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3104
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=200005;
int n,q;
int op[N],g[N];
char ss[N],a[N],b[N];
bool check1(int pos)
{
    if (pos<1) return true;
    for (int u=1;u<=q;u++)
    {
        if (ss[pos]-'A'==op[u]) pos+=g[u];
        if (pos<=0) return true;
    }
    return false;
}
bool check2(int pos)
{
    if (pos<1) return true;
    for (int u=1;u<=q;u++)
    {
        if (ss[pos]-'A'==op[u]) pos+=g[u];
        if (pos>n) return true;
    }
    return false;
}
int main()
{
    scanf("%d%d",&n,&q);
    scanf("%s",ss+1);
    for (int u=1;u<=q;u++)
    {
       	scanf("%s%s",a,b);
        op[u]=a[0]-'A';
        g[u]=(b[0]=='R')?1:-1;
    }
    int l=0,r=n,lalal,L,R;
    while (l<=r)
    {
        int mid=(l+r)>>1;
        if (check1(mid)) {l=mid+1;lalal=mid;}
        else r=mid-1;
    }
    L=lalal;l=1,r=n+1;
    while (l<=r)
    {
        int mid =(l+r)>>1;
        if (check2(mid)) {lalal=mid;r=mid-1;}
        else l=mid+1;
    }
   R=n-lalal+1;
    printf("%d\n",max(0,n-L-R));
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanInt(M);
    scanInt(X);
    vector<int> C; C.reserve(N);
    vector<vector<int>> A; A.reserve(N);
    REP(i, N){
        scanInt(Ci);
        C.emplace_back(Ci);
        scanVecInt(Ai, M);
        A.emplace_back(Ai);
    }
    ll result = llmax;
    vector<int> temp(M, 0);
    function<void(int, ll)> func = [&](int n, ll total){
        if (N <= n){
            for (auto& e : temp){
                if (e < X) return;
            }
            result = min(result, total);
            return;
        }
        func(n + 1, total);
        REP(m, M) temp[m] += A[n][m];
        func(n + 1, total + C[n]);
        REP(m, M) temp[m] -= A[n][m];
    };
    func(0, 0);
    if (result == llmax){
        cout << "-1" << endl;
    }else{
        cout << result << endl;
    }
}


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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> WA(N);
	int cnt_AC = 0, cnt_WA = 0;
	for (int i = 0; i < M; i++) {
		int tmp;
		string s;
		cin >> tmp >> s;
		if (s == "WA") {
			WA.at(tmp - 1)++;
		}
		else {
			if (WA.at(tmp - 1) >= 0) {
				cnt_WA += WA.at(tmp - 1);
				cnt_AC++;
				WA.at(tmp - 1) = -1e6;
			}
		}
	}

	cout << cnt_AC << " " << cnt_WA << endl;
}

Measured memory_bytes: 640
def resolve():
    N = int(input())
    All = 1
    No0 = 1
    No09 = 1
    for i in range(N):
        All = All * 10 % (10**9+7)
        No0 = No0 * 9 % (10**9+7)
        No09 = No09 * 8 % (10**9+7)
    ans = All - 2*No0 + No09
    print(ans % (10**9+7))

resolve()

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long m,n;
	cin>>m>>n;
	long long a[m+1];
	for(int i=1;i<=m;i++)
	cin>>a[i];
	sort(a+1,a+m+1);
	long long s=0;
	for(int i=1;i<=m-n;i++)
	{
		s+=a[i];
	}
	cout<<s;
	return 0;
 } 

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
  int n;

  cin >> n;

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

  int ans=0;
  int temp = a[0];
  for(int i = 1; i < n; i++){
    if( temp == a[i] ){
      ans++;
      temp = -1;
    }
    else
      temp = a[i];
  }

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


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

using namespace std;

int par[10010], rank[10010];

void init(int s) {
    for (int i = 0; i < s; i++) {
        par[i] = i;
        rank[i] = 0;
    }
}

int find(int x) {
    if (par[x] != x) par[x] = find(par[x]);
    return par[x];
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rank[x] > rank[y])
        par[y] = x;
    else {
        par[x] = y;
        if (rank[x] == rank[y]) rank[y]++;
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int main(void) {
    int n, q, com, x, y;
    cin >> n >> q;

    init(n);
    for (int i = 0; i < q; i++) {
        cin >> com >> x >> y;
        if (com) {
            if (same(x, y)) cout << 1 << endl;
            else cout << 0 << endl;
        } else
            unite(x, y);
    }

    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define forn(i,n) for (int i=0;i<n;i++)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define trav(a,x) for (auto& a : x)

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) ((int)(x).size())
#define mem(x,a) memset(x,a,sizeof(x))

typedef vector<int> vi;
typedef pair<int,int> pii;

const int MOD = 1e9+7;
const int INF = 1e18;
const int N = 2e5 + 5;

int n , cnt[N] , sz[N] ,col[N] , ans[N];
vi g[N]; 
int f (int n){
 return (n * (n + 1))/2 ;
}
void dfs(int u , int par = 0){
 sz[u] = 1 ;
 int c = col[u] ;
 int temp = cnt[c] , delta = 0;

 trav(to , g[u]){
  if(to == par)continue;
  int last = cnt[c] ;
  dfs(to , u);
  delta = cnt[c] - last ;
  sz[u] += sz[to] ;

  ans[c] += f(sz[to] - delta) ;
 }
 cnt[c] =temp +  sz[u];
}
int32_t main()
{
 cin >> n ;
 // n++;
 rep(i,1 ,n + 1)cin >> col[i];
 forn(i,n-1){
  int u , v ;
  cin >> u >> v ;
  g[u].pb(v);
  g[v].pb(u);
 }
 dfs(1 , 0);

 rep(i , 1 , n + 1){
  cout << f(n) - ans[i] - f(n - cnt[i]) << endl ;
 }

 return 0;
}        

Measured memory_bytes: 39360
// The Balance
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int a = sc.nextInt(), b = sc.nextInt(), d = sc.nextInt();
			if ((a | b | d) == 0)
				break;
			int x = 100000, y = 100000;
			for (int i = 0; i <= x + y; i++)
				for (int j = 0; i + j <= x + y; j++) {
					while (a * i - b * j > d)
						j++;
					if (b * j - a * i > d)
						break;
					if (a * i == b * j + d || a * i + b * j == d
							|| b * j == a * i + d) {
						if (i + j < x + y) {
							x = i;
							y = j;
							continue;
						}
						if (i + j == x + y && a * i + b * j < a * x + b * y) {
							x = i;
							y = j;
						}
					}
				}
			System.out.println(x + " " + y);
		}
		sc.close();
	}
}

Measured memory_bytes: 20204
n, a, b, c, d = map(int, input().split())
S = input()

if c < d and (S[a-1:d+1].count("##") == 0):
    print("Yes")
    exit()

if c > d and (S[b-2:d+1].count("...") >= 1) and (S[a-1:d+1].count("##") == 0):
    print("Yes")
    exit()

print("No")


Measured memory_bytes: 9468
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#pragma endregion

void solve() {
    int k, x;
    cin >> k >> x;
    if (500 * k >= x) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256