akhauriyash/Code-Regression huggingface dataset:
import bisect
import sys
input = sys.stdin.readline


class SegmentTreeRMQ(object):  # 1-indexed
    def __init__(self, size, value):
        self.len = 1 << size.bit_length()
        # print(self.len)
        self.array = [value] * (2 * self.len)

    def update(self, i, x):
        i += self.len
        while i > 0:
            self.array[i] = max(self.array[i], x)
            i >>= 1
        # print(self.array)

    def get(self, i):
        return self.array[i + self.len]

    def get_maximum(self, l, r):
        L = l+self.len
        R = r+self.len
        ANS = -1 << 30

        while L < R:
            if L & 1:
                ANS = max(ANS, self.array[L])
                L += 1

            if R & 1:
                R -= 1
                ANS = max(ANS, self.array[R])
            L >>= 1
            R >>= 1

        return ANS


N = int(input())
xd_array = [list(map(int, input().split())) for _ in range(N)]

xd_array = sorted(xd_array, key=lambda x: x[0])
x_array = [i[0] for i in xd_array]
d_array = [i[1] for i in xd_array]

mod = 998244353

tree = SegmentTreeRMQ(N, -1)
ans_array = [0] * (N+1)
ans_array[-1] = 1
for i in range(N-1, -1, -1):
    move = x_array[i] + d_array[i] - 0.1
    max_index = bisect.bisect_left(x_array, move)
    max_move = max(i, tree.get_maximum(i, max_index))
    tree.update(i, max_move)
    ans_array[i] = (ans_array[i+1] + ans_array[max_move + 1]) % mod

print(ans_array[0])


Measured memory_bytes: 110268
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,m,c=0;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vector<ll>adj[n];
    for(int i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        x--;y--;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    for(int i=0;i<n;i++)
    {  ll g=0;
        for(int j=0;j<adj[i].size();j++)
            {
                if(a[i]<=a[adj[i][j]])
                    {
                        g=1;
                        break;
                    }

            }
            if(g==0)
            {
                c++;
            }

        //cout<<endl;
    }
    cout<<c<<endl;


}
return 0;
}

Measured memory_bytes: 10276
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
typedef unsigned long long int lint;
const int num = 1000000007;
inline int prime(lint m, lint n) {
	int ans = 1;
	while (n != 0) {
		if(n % 2 == 1) ans = ans * m % num;
		m = m * m % num;
		n = n / 2;
	}
	return ans;
}
int main() {
	lint m, n;
	cin >> m >> n;
	cout << prime(m, n) << endl;
	return 0;
}

Measured memory_bytes: 3104
#include <stdio.h>

int main(void)
{
	int a,b,i;
	scanf("%d %d",&a,&b);
		if(b==100){
		b=b+1;
	}
	if(a>0){
		for(i=0;i<a;i++){
			b=b*100;
		}
	}
	printf("%d",b);
	return 0;
}

Measured memory_bytes: 128
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Integer A = Integer.parseInt(sc.next());
        Integer B = Integer.parseInt(sc.next());
        Integer C = Integer.parseInt(sc.next());
        int count = 0;
        int tmpA = 0;
        int tmpB = 0;
        int tmpC = 0;

        List<String> ABCList = new ArrayList<String>();
        ABCList.add(A.toString() + B.toString() + C.toString());

        while (true) {
            if (A % 2 != 0 || B % 2 != 0 || C % 2 != 0) {
                break;
            }
            tmpA = A;
            tmpB = B;
            tmpC = C;

            A = tmpB / 2 + tmpC / 2;
            B = tmpC / 2 + tmpA / 2;
            C = tmpA / 2 + tmpB / 2;

            count++;

            if (ABCList.contains(A.toString() + B.toString() + C.toString())) {
                count = -1;
                break;
            }
            ABCList.add(A.toString() + B.toString() + C.toString());
        }

        PrintWriter out = new PrintWriter(System.out);
        out.println(count);
        out.flush();
        sc.close();
    }
}

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

typedef struct{
    double x;
    char u[4];
} money;

int main(){
    int N,i;
    char str[4]="BTC";
    double sum=0;
    scanf("%d",&N);
    money M[N];
    for(i=0;i<N;i++){
        scanf("%lf%s",&(M[i].x),(M+i)->u);
        if(strcmp((M+i)->u,str)==0) M[i].x*=380000.0;
    }
    for(i=0;i<N;i++){
        sum+=M[i].x;
    }
    printf("%f\n",sum);
    return 0;
    
    
    
}


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

int a,b,c,d;

int main()
{
    cin>>a>>b>>c>>d;
    if (a+b>c+d)
        puts("Left");
    else if(a+b==c+d)
        puts("Balanced");
    else
        puts("Right");
    return 0;
}

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

#define pb push_back
#define fi first
#define se second

const int mx = 1234567;
const int md = 1e9+7;
const int inf= 1e100;
const double eps = 1e-6;
const double pi = acos(-1.0);

typedef long long ll;

int dr[8] = {-1,-1,+0,+1,+1,+1,+0,-1};// counter clockwise
int dc[8] = {+0,-1,-1,-1,+0,+1,+1,+1};
int dr4[4] = {-1,+1,+0,+0};//UDLR
int dc4[4] = {+0,+0,-1,+1};

int ar[mx],xar[mx],uses[mx];
ll arr[mx];
int tab[1000][1000];
string st[1000];
int ar1[mx],ar2[mx],ar3[mx],ar4[mx];

void solve(){
	int n, m;
	scanf("%d",&n);
	if(n >= 400 && n <=599) cout<<8<<'\n';
	else if(n >= 600 && n <=799) cout<<7<<'\n';
	else if(n >= 800 && n <=999) cout<<6<<'\n';
	else if(n >= 1000 && n <=1199) cout<<5<<'\n';
	else if(n >= 1200 && n <=1399) cout<<4<<'\n';
	else if(n >= 1400 && n <=1599) cout<<3<<'\n';
	else if(n >= 1600 && n <=1799) cout<<2<<'\n';
	else if(n >= 1800 && n <=1999) cout<<1<<'\n';

}

int main(){
    int tk = 1,cs = 0;
//    freopen("in.txt","r", stdin);
//    freopen("out.txt","w", stdout);

//    scanf("%d",&tk);
    while(tk--)
        solve();
    return 0;
}


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

int main(){
    long int N;
    cin>>N;
    long int A[N+1],B[N+1];
    for (int i=0;i<N;i++){
        cin>>A[i];
        B[i]=A[i];
    }
    sort(A,A+N);
    A[N]=0;
    long int num[N],ans=0,j=0,f[N],k=0,l=-1;
    for (int i=0;i<N;i++){
        if (A[i]!=A[i+1]){
            num[j]=A[i];
            k=i-l;
            l=i;
            ans+=(k-1)*k/2;
            f[A[i]]=-(k-1)*k/2+(k-1)*(k-2)/2;
            j+=1;
        }
    }
    for (int i=0;i<N;i++){
        cout<<ans+f[B[i]]<<endl;
    }
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define all(a)  (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

vi a = {3,5,7};

void dfs(vi &v, int n, ll num = 0){
  for(int i : a){
    ll nnum = 10*num + i;
    if(nnum > n) continue;
    v.push_back(nnum);
    dfs(v, n, nnum);
  }
}

int main(){
  int n, ans = 0; cin >> n;
  vi v;
  dfs(v, n);
  rep(i, v.size()){
    string s = to_string(v[i]);
    int check[10] = {0};
    rep(j, s.size()){
      check[s[j]-'0'] = 1;
    }
    if(check[3] && check[5] && check[7]) ans++;
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
 <url:https://agc005.contest.atcoder.jp/tasks/agc005_a>
 問題文============================================================
 文字列 X が与えられます。X の長さは偶数であり、半分は S 、もう半分は T からなります。
 
 高橋君は ST という文字列が苦手です。なので以下の操作を 10^10000 回行うことにしました。
 
 X の(連続な)部分文字列で ST となるもののうち、最も左側にあるものを取り除く。存在しないならば何もしない。
 最終的に X は何文字になるかを求めてください。
 
 =================================================================
 
 解説=============================================================
 
 問題名 STring
 
 STはstackの ST
 よってstack
 
 stackで一つ手前の文字を確認しつつ左から右へなめる
 ================================================================
 */
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    string X; cin >> X;
    stack<string> st;
    for(int i = 0; i < (int)X.length(); i++){
        if(X[i] == 'S') st.push("S");
        else{
            if(!st.empty()){
                string c = st.top();
                if(c == "S") {
                    st.pop();
                    continue;
                }
            }
            st.push("T");
        }
    }
    cout << st.size() << endl;
    return 0;
}


Measured memory_bytes: 11412
N,M=map(int,input().split())
p=[]
S=[]
for i in range(M):
    x,y=input().split()
    p.append(int(x)-1)
    S.append(y)
WA=[0 for i in range(N)]
AC=[0 for i in range(N)]
for i in range(M):
    if S[i]=="AC":
        AC[p[i]]=1
    else:
        if AC[p[i]]==0:
            WA[p[i]]+=1
ans1=sum(AC)
ans2=0
for i in range(N):
    if AC[i]==1:
        ans2+=WA[i]
print(ans1,ans2)

Measured memory_bytes: 66264
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
#define dwn(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	string s;
	cin >> s;
	int cnt = 0;
	for (int i = 0; i < 6; i++) {
		if (s[i] == '1') cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> D(M);
  for (int i = 0; i < M; i++) cin >> D[i];
  int sum = accumulate(D.begin(), D.end(), 0);
  if (N < sum) {
    printf("-1\n");
  } else {
    printf("%d\n", N - sum);
  }

  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	char a1, a2, a3, b1, b2, b3;
	cin >> a1 >> a2 >> a3 >> b3 >> b2 >> b1;

	if(a1==b1 && a2==b2 && a3==b3) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

    private static void solution(int N, int A, int B) {

		int sum = 0;
		for(int i = 1; i <= N; i++) {
			if(isBoundedSum(i, A, B)) {
				sum += i;
			}
		}

		System.out.println(sum);

	}

	private static boolean isBoundedSum(int value, int A, int B) {

		int sum = 0;

		while(value != 0) {
			int reminder = value % 10;
			sum += reminder;

			if (sum > B) {
				return false;
			}

			value = value / 10;
		}

		if (sum < A) {
			return false;
		} else {
			return true;
		}
	}

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int N = in.nextInt();
		int A = in.nextInt();
		int B = in.nextInt();
		
		solution(N, A, B);
	}


}

Measured memory_bytes: 21844
import java.util.*;
public class Main {
	public static void main(String[] args) {
		A();
	}
	
	public static void A() {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();
		if(s1.compareTo(s2) < 0) System.out.println("<");
		else if(s1.compareTo(s2) == 0) System.out.println("=");
		else System.out.println(">");
	}
}


Measured memory_bytes: 21844
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N := getInt()
	s := getString()
	cnt := 1
	for i := 1; i < N; i++ {
		if s[i] != s[i-1] {
			cnt++
		}
	}
	out(cnt)
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int K[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin >> k;
    cout << K[--k] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define INF 200000000
#define NIL -1
#define WHITE 1
#define BLACK 3
int n,a[101][101],d[101],color[101],pi[101],adj[101];

void prim(int r){
  int i;
  for(i=1;i<=n;i++){
    d[i]=INF;
    pi[i]=NIL;
    color[i]=WHITE;
  }
  d[r]=0;
}
int main(){

  int i,j,min,sum=0,  min2,f,u,v,k,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=INF;
    }
  }

  for(i=0;i< n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j< k;j++){
      scanf("%d%d",&v,&c);
      a[u][v]=c;
      
    }
  }
  prim(0);
  u=0;
  while(1){

    min=INF;

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

      color[u]=BLACK;

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

      }
    }
  
 
for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]);
  }


  return 0;
}

Measured memory_bytes: 640
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1)
	{
		cerr << name << " = " << arg1 << endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args)
	{
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
		__f(comma+1, args...);
	}
#else
#define debug(...)
#endif

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

// priority_queue<ll, vector<ll>, less<ll>>pq;     // Max Heap
// priority_queue<ll, vector<ll>, greater<ll>>pq;  // Min Heap

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth (1 based indexing) smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

const int MAXN = 1e6 + 2;

ll n, a[MAXN], vis[MAXN], cnt[MAXN], ans;
set<ll>s;

int main()
{
	FAST_IO;

    cin >> n;
    for(int i=0;i<n;i++)
    {
    	cin >> a[i];
    	cnt[a[i]] += 1;
    	s.insert(a[i]);
    }
    for(auto it : s)
		for(int j=2*it;j<MAXN;j+=it) 
			vis[j] = 1;
	for(auto it : s)
		if(!vis[it] && cnt[it] == 1) ans += 1;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 29232
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main()
{
auto s = readln.chomp.to!int;
writeln((s/3600).to!string ~ ":" ~ (s%3600/60).to!string ~ ":" ~ (s%3600%60).to!string);
}


Measured memory_bytes: 2476
#include<bits/stdc++.h>
#include <math.h>
#include <cmath>
#include <limits>
#include <iostream>
#include <assert.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main(){

	string s;
	cin>>s;
	if(s=="SUN")cout<<"7"<<endl;
	if(s=="MON")cout<<"6"<<endl;
	if(s=="TUE")cout<<"5"<<endl;
	if(s=="WED")cout<<"4"<<endl;
	if(s=="THU")cout<<"3"<<endl;
	if(s=="FRI")cout<<"2"<<endl;
	if(s=="SAT")cout<<"1"<<endl;

	return 0;

}



Measured memory_bytes: 384
cnt = [0 for i in range(4)]
for i in range(3):
    a, b = map(int, input().split())
    cnt[a - 1] += 1
    cnt[b - 1] += 1
if sorted(cnt) == [1, 1, 2, 2]:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 61896
a,b,c,d=[int(k) for k in input().split(" ")]

def bezout(a,b) :              # retourne (g,u,v) tel que g = a*u + b*v et g = pgcd(a,b)
    if b == 0 : return (a,1,0)
    q = a // b 
    r = a % b
    (g,u1,v1) = bezout(b,r)    
    return (g,v1,u1-q*v1)      # joli algo :-)



def nbdb(n,d):
    return n//d

def nbdbi(l,r,d):
    return nbdb(r,d)-nbdb(l-1,d)

def solve():
    g=bezout(c,d)[0]
    return b-a+1-nbdbi(a,b,c)-nbdbi(a,b,d)+nbdbi(a,b,c*d//g)

print(solve())



Measured memory_bytes: 3064
def order(n):
    if n == 0: return 10
    else: return n


def ceil(num, target):
    if num % target == 0: return num
    return ((int)(num / target) + 1) * target


P = [input() for _ in range(5)]
P_sorted = sorted(P, key=lambda pi: order(int(pi[-1])), reverse=True)

ans = 0
for pi in P_sorted[:-1]:
    ans += ceil(int(pi), 10)

print(ans + int(P_sorted[-1]))

Measured memory_bytes: 9072
#include<bits/stdc++.h>
using namespace std;
const int MAXN=112345;
int dist[MAXN],grau[MAXN];
vector<int> grafo[MAXN];
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int a,b;
        scanf("%d %d",&a,&b);
        grafo[a].push_back(b);
        grau[b]++;
    }
    queue<int> fila;
    for(int i=1;i<=n;i++)
    {
        dist[i]=1;
        if(grau[i]==0)fila.push(i);
    }
    int resp=0;
    while(!fila.empty())
    {
        int cur=fila.front();fila.pop();
        resp=max(dist[cur],resp);
        //printf("%d %d\n",cur,dist[cur]);
        for(int i=0;i<grafo[cur].size();i++)
        {
            int viz=grafo[cur][i];
            grau[viz]--;
            if(grau[viz]<0)continue;
            dist[viz]=max(dist[viz],dist[cur]+1);
            if(grau[viz]==0)fila.push(viz);
        }
    }
    printf("%d\n",resp-1);
    return 0;
}


Measured memory_bytes: 6784
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {
    int N, D, X;
    cin >> N >> D >> X;

    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

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


    cout << sum + X << endl;

}






















































Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int A,B,C,D;
  scanf("%d%d%d",&A,&B,&C);
  D = B/A;
  if(D>C){
  printf("%d\n",C);
  }else{
    printf("%d\n",D);
  }
  return 0;
}


Measured memory_bytes: 128
w, h, x, y = gets.split.map &:to_i

center_x = w / 2
center_y = h / 2

trans_x = w - x
trans_y = h - y
if trans_x == x && trans_y == y
  bool = 1 # 複数ある
else
  bool = 0
end
menseki = ((w * h)/2.0)
puts "#{menseki} #{bool}"


Measured memory_bytes: 1788
#include<bits/stdc++.h>
const int MN=100000+5,P=1000000007,inv2=P+1>>1;
using namespace std;
typedef long long ll;
template<typename T>inline T&IN(T&in){
	in=0;char c=getchar();int f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))in=in*10+c-'0',c=getchar();
	return in*=f;
}
int n;
int a[4][MN],c[2];
int t[MN];
int lowbit(int x){return x&(-x);}
void add(int p,int d){while(p<=n)t[p]+=d,p+=lowbit(p);}
int sum(int p){int c=0;while(p)c+=t[p],p-=lowbit(p);return c;}
void input(){
	IN(n);
	for(int i=1;i<=3;++i)for(int j=1;j<=n;++j)IN(a[i][j]);
	for(int i=1;i<=n;++i){
		if(a[2][i]%3!=2||abs(a[2][i]-a[1][i])!=1||abs(a[3][i]-a[2][i])!=1||(a[2][i]/3)&i&1)return puts("No"),void();
		c[i&1]^=(a[1][i]>a[3][i]);
	}
	for(int i=1;i<=n;i+=2)c[0]^=(sum(n)-sum(a[2][i]/3+1))&1,add(a[2][i]/3+1,1);
	memset(t,0,sizeof t);
	for(int i=2;i<=n;i+=2)c[1]^=(sum(n)-sum(a[2][i]/3+1))&1,add(a[2][i]/3+1,1);
	if(c[0]==0&&c[1]==0)puts("Yes");
	else puts("No");
}
int main(){
	input();
	return 0;
}

Measured memory_bytes: 1792
use io::*;

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);
    let s: Vec<char> = sc.next::<String>().chars().collect();

    let ans = s.len() >= 4
        && s[0] == 'A'
        && s[2..s.len() - 1].iter().filter(|c| **c == 'C').count() == 1
        && s[1].is_lowercase()
        && s[2..].iter().all(|c| c.is_lowercase() || *c == 'C');

    println!("{}", if ans { "AC" } else { "WA" });
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


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

int n,maxn;
vector<int> V,maxV;

void Shred(int sum,int m,string s)
{
  if(sum>n){
    return;
  }
  if(s.empty()){
    if(maxn==sum){
      maxV[0]=-1;
    }
    else if(maxn<sum){
      maxn=sum;
      maxV.clear();
      for(int i=0;i<V.size();i++){
	maxV.push_back(V[i]);
      }
    }
    return;
  }
  for(int i=1;i<s.length()+1;i++){
    m=atoi(s.substr(0,i).c_str());
    V.push_back(m); 
    Shred(sum+m,m,s.substr(i,s.length()));
    V.pop_back();
  }
}

int main()
{
  string s;
  int m,flag;
  while(1){
    cin>>n>>s;
    if(n==0 && s[0]=='0')break;
    maxn=0;flag=0;
    for(int i=1;i<s.length()+1;i++){
      V.clear();
      m=atoi(s.substr(0,i).c_str());
      V.push_back(m); 
      Shred(m,m,s.substr(i,s.length()));
      V.clear();
    }
    if(maxV[0]==-1)cout<<"rejected"<<endl;
    else if(maxn==0)cout<<"error"<<endl;
    else{
      cout<<maxn;
      for(int i=0;i<maxV.size();i++)cout<<" "<<maxV[i];
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    int a[n + 1];
    a[0] = 0;
    for (int i = 1; i <= n; i++)
    {
        if (s[i - 1] == 'I') a[i] = a[i - 1] + 1;
        else if (s[i - 1] == 'D') a[i] = a[i - 1] - 1;
    }
    sort(a, a + n + 1);
    cout << a[n];
}

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

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

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

    if(a[0] == a[1] && a[1] == a[2]) cout << 1 << endl;
    else if(a[0] == a[1] && a[1] != a[2]) cout << 2 << endl;
    else if(a[0] != a[1] && a[1] == a[2]) cout << 2 << endl;
    else cout << 3 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc;
		String str="";
		String[] kojin;
		int[] bt=new int[4];		//A B AB O

		for(int i=0; i<3; i++) {
			bt[i]=0;
		}

	sc=new Scanner(System.in);
		while(sc.hasNext()) {
			str=sc.next();
			kojin=str.split(",");

			if(kojin[1].equals("A")) {
				bt[0]++;
			}
			else if(kojin[1].equals("B")) {
				bt[1]++;
			}
			else if(kojin[1].equals("AB")) {
				bt[2]++;
			}
			else if(kojin[1].equals("O")) {
				bt[3]++;
			}
		}

		for(int i=0; i<4; i++) {
			System.out.println(bt[i]);
		}
		sc.close();
	}
}


Measured memory_bytes: 26300
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long int llint;

int main(){
	llint X;
	llint grad=0;
	cin >> X;

	grad+=(X/500)*1000;
	X=X%500;

	grad+=(X/5)*5;
	X=X%5;

	cout << grad << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    string S, T[] = { "dreamer","dream","eraser","erase" };
    cin >> S;

    bool ok = true;
    for (int i = S.size()-1; i >= 0;) {
        if (i >= 6 && S.substr(i - 6, 7) == T[0])i -= 7;
        else if (i >= 4 && S.substr(i - 4, 5) == T[1])i -= 5;
        else if (i >= 5 && S.substr(i - 5, 6) == T[2])i -= 6;
        else if (i >= 4 && S.substr(i - 4, 5) == T[3])i -= 5;
        else {
            ok = false;
            break;
        }
    }

    cout << ((ok) ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std ;
string shuffle(string a , int b){
  string A , B ;
  A = a.substr(0,b);
  B = a.substr(b,a.length()-b);
  string ans = B  + A ;
  return ans ;
}
int main () {
  while(1){
    string a ;
    cin >> a ;
    if(a=="-") break ;
    int N ;
    cin >> N ;
    for(int i = 0 ; i < N ; i++ ){
      int b ;
      cin >> b ;
      a = shuffle(a,b);
    }
    cout << a << endl ;
  }
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
using lli = long long;

int n,arr[3][100001];
lli cnt[3][100001];

int main() {
    scanf("%d",&n);
    for(int i=0;i<3;i++) for(int j=0;j<n;j++) scanf("%d",&arr[i][j]);
    for(int j=0;j<n;j++) cnt[0][j]=1;
    
    for(int i=0;i<3;i++) sort(arr[i],arr[i]+n);
    for(int i=1;i<3;i++) {
        lli s=0;
        for(int j=0,k=0;j<n;j++) {
            while(k<n && arr[i-1][k] < arr[i][j]) s+=cnt[i-1][k++];
            cnt[i][j]=s;
        }
    }

    lli ans=0;
    for(int i=0;i<n;i++) ans += cnt[2][i];
    printf("%lld\n",ans);
    
    return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {

	int min = Integer.MAX_VALUE;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for (int i=0;i<N-1;i++) {
			int temp = sc.nextInt();
			a[temp]++;
		}
		for (int i=1;i<=N;i++) {
			System.out.println(a[i]);
		}
	}

}

Measured memory_bytes: 61764
from itertools import product
n,m,x = [int(x) for x in input().split()]
c = []
a = []
for _ in range(n):
    tmp = [int(x) for x in input().split()]
    c.append(tmp[0])
    a.append(tmp[1:])

ans = 1<<60

for v in product([0,1], repeat=n):
    score = [0]*m
    money = 0
    for j in range(n):
        if v[j] == 1:
            money += c[j]
            for k in range(m):
                score[k] += a[j][k]
    if min(score) >= x:
        ans = min(ans,money)

if ans == 1<<60:
    print(-1)
else:
    print(ans)

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

b = [False] * n
b_index = []
b_count = 0
for i in range(n-1, -1, -1):
  flag = bool(a[i])
  for j in range(2*i+1, n, i+1):
    flag ^= b[j]
  b[i] = flag
  if flag:
    b_index.append(str(i+1))
    b_count += 1
print(b_count)
print(' '.join(b_index))

Measured memory_bytes: 17208
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

// Data :
type Data struct {
	X, V int
}

// Datas :
type Datas []Data

func (p Datas) Len() int {
	return len(p)
}

func (p Datas) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Datas) Less(i, j int) bool {
	return p[i].X > p[j].X
}

func f(a map[int]int) Datas {
	x := make(Datas, 0)
	for i, v := range a {
		x = append(x, Data{v, i})
	}
	sort.Sort(x)
	return x
}

func main() {
	sc.Split(bufio.ScanWords)
	n := getInt()
	x := make(map[int]int)
	y := make(map[int]int)
	for i := 0; i < n; i++ {
		a := getInt()
		if i%2 == 0 {
			x[a]++
		} else {
			y[a]++
		}
	}
	// out(x, y)

	xd := f(x)
	yd := f(y)
	// out(xd[:3])
	// out(yd[:3])
	ans := n - xd[0].X - yd[0].X

	if xd[0].V == yd[0].V {
		if xd[0].X == yd[0].X {
			if len(x) == 1 {
				ans = n - xd[0].X
			} else if xd[1].X > yd[1].X {
				ans = n - xd[0].X - xd[1].X
			} else {
				ans = n - xd[0].X - yd[1].X
			}
		} else if xd[0].X > yd[0].X {
			ans = n - xd[0].X - yd[1].X
		} else {
			ans = n - yd[0].X - xd[1].X
		}
	}

	out(ans)
}


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

int main()
{
    string s;
    cin >> s;
    string ans = "Yes";
    if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0]){
        for(int i=0;i<3;i++){
            if(s[i] != 'a' && s[i] != 'b' && s[i] != 'c'){
                ans = "No";
            }
        }
    }
    else{
        ans = "No";
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
N, M = map(int, input().split())
tree = [-1 for i in range(N)]

def root(x):
    if tree[x] < 0:
        return x
    tree[x] = root(tree[x])
    return tree[x]
def find(x, y):
    return root(x) == root(y)
def union(x, y):
    x = root(x)
    y = root(y)
    if x != y:
        if tree[x] < tree[y]:
            x, y = y, x
        tree[x] += tree[y]
        tree[y] = x
        return 1
    return 0

cnt = 0
for i in range(M):
    x, y, z = map(int, input().split())
    cnt += union(x - 1, y - 1)
print(N - cnt)

Measured memory_bytes: 79236
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>

using namespace std;

int d[100'000];

int main()
{
    int n;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> d[i];
    }

    sort(d, d + n, [](const int &l, const int &r) {
        return l < r;
    });

    int hi = d[n / 2];
    int lo = d[n / 2 - 1];

    cout << hi - lo << endl;
    return 0;
}

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

int main() {
  int N, M, tmp, count, point;
  cin >> N;
  vector<string> B(N);
  point = 0;
  
  for (int i = 0; i < B.size(); i++) 
    cin >> B.at(i);
  
  cin >> M;
  vector<string> R(M);
  
  for (int i = 0; i < R.size(); i++) 
    cin >> R.at(i);
  

  for(int i = 0; i < B.size(); i++) {
    count = 0;
    for (int j = 0; j < B.size(); j++) {
      if (B.at(i) == B.at(j))
        count++;
    }
    for (int j = 0; j < R.size(); j++) {
      if (B.at(i) == R.at(j))
        count--;
    } 
   // cout << count << endl;
    if (count > point)
      point = count;
  }
  
  cout << point << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

const size_t MAXN = 10000 + 3;

int main() {
  int n;
  scanf("%d", &n);
  static char s[MAXN];
  scanf("%s", s);

  for (size_t i = 0; s[i]; i++) {
    int u = (s[i] - 'A' + n) % 26;
  	putchar(u + 'A');
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 256
import sys, math, bisect

def search_bisect(N, K, A_list):
    times = 32
    left = 0
    right = A_list[-1]


    while( math.ceil(left) != math.ceil(right) ):
        """
        全ての板を長さmid以下にできるかを二分探索で探す
        True -> より小さい長さにチャレンジ
        False -> より長いものでチャレンジ

        M回の切断で長さSの板は、長さS/(M+1)の板(M+1)本に切断可能
        """
        mid = (left+right)/2
        index = bisect.bisect_right(A_list, mid)
        time = 0

        for i in range(index, N):
            time +=math.ceil(A_list[i]/mid)-1
        if(time <= K):
            #success
            right = mid
        else:
            left = mid
    return math.ceil(left)



if(__name__ == "__main__"):
    """
    N, D = map(int, input().strip().split() )
    D_sq = D**2
    xy_list = []
    for i in range(N):
        xy = list( map(int, input().strip().split() ) )
        xy_list.append(xy)
    """
    N, K = map(int, input().strip().split() )
    A_list = list( map(int, input().strip().split() ) )

    A_list.sort()
    if(K==0):
        print(A_list[-1])
    else:
        length = search_bisect(N, K, A_list)
        print(length)


Measured memory_bytes: 31248
def gcd(x, y):
    while y != 0:
        x, y = y, x%y
    return x


N = int(input())
A = list(map(int, input().split()))
first_gcd = A[0]
for i in range(len(A)):
    first_gcd = gcd(first_gcd, A[i])
print(first_gcd)

Measured memory_bytes: 14224
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	int nN, nM;
	cin >> nN >> nM;

	int nArr[100][100] = {}; //all 0
	int nB[100] = {};
	for (size_t i = 0; i < nN; ++i)
	{
		for (size_t j = 0; j < nM; ++j)
		{
			cin >> nArr[i][j];
		}
	}

	for (size_t i = 0; i < nM; i++)
	{
		cin >> nB[i];
	}
	for (size_t i = 0; i < nN; i++)
	{
		int nSum = 0;
		for (size_t j = 0; j < nM; j++)
		{
			nSum += nArr[i][j] * nB[j];
		}
		cout << nSum << endl;
	}

	//system("pause");
	return 0;
}

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

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++)
  {
    cin >> s[i];
  }

  int ans = 1000000;
  for (int bit = 0; bit < (1<<(h-1)); bit++)
  {
    queue<int> que;
    for (int i = 0; i < h-1; i++)
    {
      if(bit&(1<<i)){
        que.push(i);
      }
    }
    vector<vector<int>> vec;
    int start = 0;
    int cnt = que.size();
    while(start<h){
      vector<int> row(w);
      int end=h-1;
      if(!que.empty()){
        end = que.front();
        que.pop();
      }
      for (int i = 0; i < w; i++)
      {
        for (int j = start; j <= end; j++)
        {
          row[i]+=s[j][i] - '0';
        } 
      }
      vec.push_back(row);
      start=end+1;
    }

    vector<int> sum((int)vec.size());
    vector<int> now((int)vec.size());
    for (int i = 0; i < w; i++)
    {
      bool flg = false;
      for (int j = 0; j < (int)vec.size(); j++)
      {
        now[j] = vec[j][i];
        if(now[j]>k){
          cnt = 1000000;
          i=w;
          break;
        }
        sum[j] += now[j];
        if(sum[j]>k) flg=true;
      }
      if(flg){
        for (int x = 0; x < (int)vec.size(); x++)
        {
          int nowx = now[x];
          sum[x] = nowx;
        }
        cnt++;
      }
    }
    ans = min(ans,cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int md = 1e9+7;
const int sz = 1e5;
// int A[sz+1];
// int F[sz+1];

int A[sz+1];


void solve(){
	int a,b,c,d;cin>>a>>b>>c>>d;
	// int p,q;
	int ans = max({a*c,a*d,b*c,b*d});
	cout<<ans;


return;
}



int32_t main()
{
    // IOS;
    // A[0] = 0;
    // F[0] = 1;

    // for (int i = 1; i <= sz; ++i)
    // {
    // 	A[i] = A[i-1]+i;
    // 	F[i] = F[i-1]*i;
    // }

    // for(int i=0;i<10;i++){
    // 	cout<<A[i]<<" ";
    // }
    // cout<<endl;
    // for(int i=0;i<10;i++){
    // 	cout<<F[i]<<" ";
    // }
    // cout<<endl;    
    // coust<<"A and F is filled"<<endl;
    // int t;
    // cin >> t;
    // while (t--) 
        solve();
    return 0;
        

    
}



Measured memory_bytes: 3632
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

#[allow(dead_code)]
fn chmin<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x > y && {
        *x = y;
        true
    }
}

#[allow(dead_code)]
fn chmax<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x < y && {
        *x = y;
        true
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input!(l: usize, r: usize);

    let mut ans = 1 << 50;
    let m = 2019;
    let lim = min(r + 1, l + m);
    for i in l..lim {
        for j in i + 1..lim {
            ans = min(ans, (i * j) % m);
        }
    }

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


Measured memory_bytes: 4352
/*  -*- coding: utf-8 -*-
 *
 * a.cc: C: Multiple Gift
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  ll x, y;
  cin >> x >> y;

  int c = 0;
  for (ll a = x; a <= y; a <<= 1, c++);

  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
        import java.util.Arrays;
        import java.util.Collections;
        import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String forecast = sc.next();
        String actual = sc.next();
        char[] forecastChar = forecast.toCharArray();
        char[] actualChar = actual.toCharArray();
        
        int counter = 0;
        for (int i = 0; i < 3; i++) {
            
            if (forecastChar[i] == actualChar[i]) {
                counter++;
            }
            
        }
        
        System.out.println(counter);

    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

signed main(){
	lint N; cin >> N;
	vector<lint> a(N);
	lint sum = 0;
	for(lint i = 0; i < N; i++) cin >> a[i], sum += abs(a[i]);
	sort(a.begin(), a.end());
	if(a[0] > 0) sum -= a[0] * 2;
	if(a[N - 1] < 0) sum += a[N - 1] * 2;
	cout << sum << endl;
	
	lint x = a[0];
	for(lint i = 1; i < N - 1; i++){
		if(a[i] >= 0){
			cout << x << " " << a[i] << endl;
			x -= a[i];
		}
	}
	cout << a.back() << " " << x << endl;
    x = a.back() - x;
    for (int i = 1; i < N - 1; ++i) {
        if (a[i] < 0) {
            cout << x << " " << a[i] << endl;
            x -= a[i];
        }
    }
}

Measured memory_bytes: 2688
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    d = int(ipt())
    c = [int(i) for i in ipt().split()]
    s = [[int(i) for i in ipt().split()] for _ in range(d)]
    ld = [-1]*26
    edval = [0]*26

    for i in range(d):
        edval = s[i]*1
        for j in range(26):
            dl = i-ld[j]
            edval[j] += c[j]*dl*(dl+1)//2
        v = edval.index(max(edval))
        ld[v] = i
        print(v+1)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 70636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
 
int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}
 
int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}
 
int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

class union_find{
private:
	int par[114514],rank[114514];
public:
	void init(int n){
		rep(i,n){
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x){
		if(par[x]==x)return x;
		else return par[x]=find(par[x]);
	}
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(rank[x]<rank[y])par[x]=y;
		else{
			par[y]=x;
			if(rank[x]==rank[y])rank[x]++;
		}
	}
	bool same(int x,int y){
		if(find(x)==find(y))return true;
		else return false;
	}
};

int n,m,p[114514],x,y;
vector<int> ta[114514],wa[114514];
union_find mu;
int cnt,ans;

signed main(){
	cin>>n>>m;
	mu.init(n);
	rep(i,n)cin>>p[i];
	rep(i,m){
		cin>>x>>y;
		mu.unite(x,y);
	}
	rep(i,n){
		ta[mu.find(i+1)].push_back(i+1);
		wa[mu.find(i+1)].push_back(p[i]);
	}
	rep(i,114514){
		if(ta[i].size()){
			cnt=0;
			int k=0;
			sort(all(ta[i]));
			sort(all(wa[i]));
			rep(j,(int)ta[i].size()){
				while(ta[i][j]>wa[i][k]&&k<=(int)wa[i].size()-2)k++;
				if(ta[i][j]==wa[i][k])cnt++;
			}
			ans+=cnt;
		}
	}
	cout<<ans<<endl;
}









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

using Int = int;
using namespace std;

#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; };
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; };
template<class T> T th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

int main(){
	std::vector<bool> prime(112345, 1);
	prime[0] = prime[1] = 0;
	for(int i = 2; i < 400; ++i) if(prime[i]){
		for(int k = i * 2; k < prime.size(); k += i) prime[k] = 0;
	}
	// for(int i = 0; i < 100; ++i) if(prime[i]) std::cout << i << std::endl;
	int x;
	std::cin >> x;
	for(int i = x;; ++i) if(prime[i]){
		std::cout << i << std::endl;
		return 0;
	}
}


Measured memory_bytes: 256