akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import Counter

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

S = [0 for _ in range(N+1)]
for i in range(N):
    S[i+1] = S[i] + A[i]

ans = 0
counter = Counter(S)
for value, count in counter.items():
    ans += count * (count - 1) // 2

print(ans)

Measured memory_bytes: 44256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e9+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;

ll n, mod = 1000000007;
const ll MAX = 1e7 + 1;
vector<ll> v(MAX);



ll inv[MAX];

ll extgcd(ll a, ll b, ll& x, ll& y){
    ll d = a;
    if (b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    } else {
        x = 1; y = 0;
    }
    return d;
}

ll mod_inverse(ll a, ll m){
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x %m) %m;
}
#define P_MAX (3 * 1000000)

ll fact[P_MAX];
ll mod_fact(ll n, ll p, ll& e){
    e = 0;
    if (n == 0)return 1;
    ll res = mod_fact(n/p, p, e);
    e += n/p;
    
    if (n/p%2!=0) return res * (p - fact[n % p]) % p;
    return res * fact[n %p]%p;
}

ll mod_comb(ll n, ll k, ll p){
    if (n < 0 || k < 0 || n < k) return 0;
    ll e1, e2, e3;
    ll a1 = mod_fact(n, p, e1);
    ll a2 = mod_fact(k, p, e2);
    ll a3 = mod_fact(n - k, p, e3);
    if (e1 > e2 + e3) return 0;
    return a1 * mod_inverse(a2 * a3 % p, p) %p;
}

int main()
{
    ll X, Y, A, B;
    cin >> X >> Y;

    fact[0] = 1;
    for (int n = 1; n < P_MAX; n++){
        fact[n] = fact[n - 1] * n %mod;
        
        //cout << n << " " << fact[n] << endl;
    }
        
    if ((2 * X - Y) %3 != 0 || (2 * Y - X) %3 != 0){
        cout << 0;
        return 0;
    }
    A = (2 * X - Y)/3;
    B = (2 * Y - X)/3;
    //cout << A << " " << B << " ";
    
    
    cout << mod_comb(A + B, A, mod);
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if ((i % 2 == 0 && s.at(i) == 'L') || (i % 2 == 1 && s.at(i) == 'R')) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b,sum;
  scanf("%d %d", &a,&b);
  if(a>9 || b>9){
    printf("-1\n");
  }
  else{
    sum =a*b;
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;

ll sum(ll l, ll r){
    return (r+l)*(r-l+1)/2%MOD;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;cin>>n>>k;
    ll ans = 0;
    for(int i=k; i<=n+1; i++){
        ll m, M;
        m = sum(0,i-1);
        M = sum(n-i+1,n);
        ans += M-m+1+2*MOD;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    
    // 入力
    string s, t; cin >> s >> t;

    // アルファベット変換表の初期化
    //map<char, char> repp;
    map<char, char> rept;
    for(ll i=(ll)'a'; i<=(ll)'z'; i++){
        rept[(char)i] = (char)i;
        //repp[(char)i] = (char)i;
    }
    
    // SとTを先頭から1文字ずつチェック
    ll s_size = s.size();
    for(ll i=0; i<s_size; i++){
        // 不一致があれば変換表を更新
        if(rept[s[i]] != t[i]){
            char changeAlp = rept[t[i]];
            while(rept[changeAlp] != t[i]) changeAlp = rept[changeAlp];
            char tmp = rept[s[i]];
            rept[s[i]] = t[i];
            rept[changeAlp] = tmp;
        }
    }

    // 変換表にもとづきSを変換
    string ans = "";
    for(ll i=0; i<s_size; i++) ans += rept[s[i]];

    // 結果の出力
    (ans == t) ? Yes() : No();
}

Measured memory_bytes: 1044
n,q=map(int,input().split())
s=input()
ac=[0 for _ in range(n)]
if n==1:
  for i in range(q):
    print(0)
    exit()

count=0
for i in range(1,n):
  if s[i-1:i+1]=='AC':
    count+=1
  ac[i]=count

for i in range(q):
  l,r=map(int,input().split())
  print(ac[r-1]-ac[l-1])


Measured memory_bytes: 6184
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int cnt=0;
        int n = sc.nextInt();
        int x = sc.nextInt();
        while(n!=0 || x!=0){
            for(int i=1;i<=n;i++){
                for(int j=1;j<=n;j++){
                    for(int k=1;k<=n;k++){
                        if(i+j+k==x){
                            if(i<j && j<k){
                                cnt++;
                            }
                        }
                    }
                }
            }
            System.out.println(cnt);
            cnt=0;
            n=sc.nextInt();
            x=sc.nextInt();
        }
        sc.close();
    }
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int a, b, c;
  cin >> a >> b >> c;
  cout << a*b/2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  while(cin>>s){
    char c='d';
    if(s[0]=='o'&&s[1]=='o'&&s[2]=='o') c='o';
    if(s[3]=='o'&&s[4]=='o'&&s[5]=='o') c='o';
    if(s[6]=='o'&&s[7]=='o'&&s[8]=='o') c='o';
    if(s[0]=='o'&&s[3]=='o'&&s[6]=='o') c='o';
    if(s[1]=='o'&&s[4]=='o'&&s[7]=='o') c='o';
    if(s[2]=='o'&&s[5]=='o'&&s[8]=='o') c='o';
    if(s[0]=='o'&&s[4]=='o'&&s[8]=='o') c='o';
    if(s[2]=='o'&&s[4]=='o'&&s[6]=='o') c='o';
    
    if(s[0]=='x'&&s[1]=='x'&&s[2]=='x') c='x';
    if(s[3]=='x'&&s[4]=='x'&&s[5]=='x') c='x';
    if(s[6]=='x'&&s[7]=='x'&&s[8]=='x') c='x';
    if(s[0]=='x'&&s[3]=='x'&&s[6]=='x') c='x';
    if(s[1]=='x'&&s[4]=='x'&&s[7]=='x') c='x';
    if(s[2]=='x'&&s[5]=='x'&&s[8]=='x') c='x';
    if(s[0]=='x'&&s[4]=='x'&&s[8]=='x') c='x';
    if(s[2]=='x'&&s[4]=='x'&&s[6]=='x') c='x';
    
    cout << c << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("");
	sum = 0;
  	input.forEach((num)=>{
      sum += Number(num)
    })
  	console.log(sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,a[3];
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int s=a[0];
    for(int i=1;i<=s/3;i++){
        bool f=true;
        for(int j=0;j<n;j++){
            if(a[j]%i)f=false;
        }
        if(f)cout<<i<<endl;
    }
    bool f=true;
    for(int i=1;i<n;i++){
        if(a[i]%s)f=false;
    }
    if(f)cout<<s<<endl;
    return 0;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> void print(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void print(H head, T ...tail) { cout << head << " "; print(tail...); }

struct seq {
	int lo, bal;
};

int sgn(int x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; cin >> n;
	vector<seq> seqs;

	int acc = 0;
	rep(i, 0, n) {
		string s; cin >> s;
		int bal = 0, lo = 0;
		for (char c : s) {
			if (c == '(') bal++;
			else bal--;
			lo = min(lo, bal);
		}
		seqs.push_back(seq { -lo, bal });
		acc += bal;
	}

	if (acc) {
		cout << "No" << endl;
		return 0;
	}

	sort(all(seqs), [](const seq& a, const seq& b) {
			if (sgn(a.bal) != sgn(b.bal)) {
				return sgn(a.bal) > sgn(b.bal);
			} else {
				if (sgn(a.bal) == 1 || sgn(a.bal) == 0) {
					return a.lo < b.lo;
				} else {
					return a.bal + a.lo > b.bal + b.lo;
				}
			}
			});

	int cur = 0;
	for (auto p : seqs) {
		if (cur < p.lo) {
			cout << "No" << endl;
			return 0;
		}
		cur += p.bal;
	}

	cout << "Yes" << endl;
}


Measured memory_bytes: 11544
import math

K = int(input())

table = [[math.gcd(a, b) for a in range(K + 1)] for b in range(K + 1)]

gcd_count = [0] * 201

for a in range(1,K + 1):
    for b in range(1,K + 1):
        gcd_count[table[a][b]] += 1

ans = 0

for ab in range(1,K + 1):
    for c in range(1,K + 1):
        ans += gcd_count[ab] * table[ab][c]

print(ans)

Measured memory_bytes: 9348
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define Alint(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1ll << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, MAX = 1e18, INF = -1e9;
typedef long double ld;

lint N, arr[200000], arr2[200000];
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> arr[i] >> arr2[i];
	}
	sort(arr, arr + N);
	sort(arr2, arr2 + N);
	if (N % 2 == 1) {
		cout << arr2[N / 2] - arr[N / 2] + 1;
	}
	else {
		lint upper = arr2[N / 2] + arr2[N / 2 - 1];
		lint lower = arr[N / 2] + arr[N / 2 - 1];
		cout << (upper - lower + 1);
	}
}


Measured memory_bytes: 6732
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

set<int> st[100];

signed main()
{
    int N,M; cin>>N>>M;

    REP(i,N){
        int k; cin>>k;
        while(k--){
            int a; cin>>a;
            st[a-1].insert(i);
        }
    }

    int ans=0;
    REP(i,M){
        if(st[i].size()==N) ans++;
    }
    cout<<ans<<endl;
 
}


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

using namespace std;

const int N = 1e5 + 5;

struct node {
  node() {
    for (int i = 0; i < 26; i++) child[i] = 0;
    id = 0;
    cnt = 0;
  }
  node* child[26];
  int id, cnt;
};

char s[4 * N], per[30];
int cnt[N][26][26], up[N];
node* root;

void add(char* s, int id) {
  int n = strlen(s);
  node* now = root;
  for (int i = 0; i < n; i++) {
    int c = s[i] - 'a';
    if (now->child[c] == NULL) {
      now->child[c] = new node();
    }
    now->cnt++;
    now = now->child[c];
  }
  now->cnt++;
  now->id = id;
}

void dfs(node* now, int z[26][26], int carry) {
  if (now->id) {
    up[now->id] = carry;
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < 26; j++) {
        cnt[now->id][i][j] = z[i][j];
      }
    }
    carry++;
  }
  int lower[26] = {};
  for (int i = 0; i < 26; i++) {
    if (now->child[i] == NULL) continue;
    lower[i] = now->child[i]->cnt;
  }
  for (int i = 0; i < 26; i++) {
    if (now->child[i] == NULL) continue;
    for (int j = 0; j < 26; j++) {
      if (i == j) continue;
      z[i][j] += lower[j];
    }
    dfs(now->child[i], z, carry);
    for (int j = 0; j < 26; j++) {
      if (i == j) continue;
      z[i][j] -= lower[j];
    }
  }
}

int tmp[26][26];

int main() {
  int n;
  scanf("%d", &n);
  root = new node();
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    add(s, i);
  }
  dfs(root, tmp, 0);
  
  int q;
  scanf("%d", &q);
  while (q--) {
    int k;
    scanf("%d %s", &k, per);
    int bef = up[k] + 1;
    for (int i = 0; i < 26; i++) {
      for (int j = i + 1; j < 26; j++) {
        bef += cnt[k][per[j]-'a'][per[i]-'a'];
      }
    }
    printf("%d\n", bef);
  }
  
  return 0;
}


Measured memory_bytes: 291200
n=1000000
p=[1]*(n+1)
p[0],p[1]=0,0
for i in range(2,int(n**0.5)+1):
    if p[i]:        
        for j in range(i*i,n+1,i):
            p[j]=0
#p=[i for i in range(n+1) if p[i]==1]
while 1:
    n=int(input())
    if n==0: break
    for i in range(n,2,-1):
        if (p[i],p[i-2])==(1,1):
            print(i-2,i)
            break

Measured memory_bytes: 14892
function main(input) {
    var args = input.trim().split("\n");
    var info = args[0].split(" ").map((v) => parseInt(v));
    var S = info[0]; // 人数
    var K = info[1]; // ポイント
    var Q = info[2]; // 回数
    var correctPersons = args.slice(1);

    if (K > Q) {
        var i = 0;
        while (S > i) {
            console.log("Yes");
            i++;
        }
        return;
    }

    var lowestLine = Q - K + 1;

    var correctSum = Array(S).fill(0);

    for(var j = 0; correctPersons.length > j; j++ ) {
        var correctPersonIndex = correctPersons[j] - 1;
        correctSum[correctPersonIndex] = correctSum[correctPersonIndex] + 1;
    }

    for(var k = 0; correctSum.length > k; k++) {
        if (correctSum[k] >= lowestLine) {
            console.log("Yes");
        } else {
            console.log("No");
        }
    }

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(void){
	int x,a,b;
	cin>>x>>a>>b;
	if(-a+b<=0)
		cout<<"delicious"<<endl;
	else if(-a+b<=x)
		cout<<"safe"<<endl;
	else
		cout<<"dangerous"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int N;
  double gokei = 0;
  int i;
  char JorB[256];
  double kane;

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%lf %s",&kane,JorB);
    if(JorB[0] == 'B'){
      gokei += kane*380000;
    }else{
      gokei += kane;
    }
  }

  printf("%f\n",gokei);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
//struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


void solve(std::vector<long long> A){
	ll res = 0;
	bool can = true;
	if (A[0]+A[1]+A[2] <= 21) can = false;
	if (can) cout << "bust" << "\n";
	else cout << "win" << "\n";
}

int main(){
    std::vector<long long> A(3);
    for(int i = 0 ; i < 3 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(std::move(A));
    return 0;
}


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

int main() {
    int a,cnt;cin >> a;
    cnt = 0;
    vector<int> b(a),c(a);
    for(int i=0;i<a;i++){
        cin >> b[i];
    }
    for(int l=0;l<a;l++){
        cin >> c[l];
    }

    for(int j=0;j<a;j++){
        if(b[j]>c[j]){
            cnt += b[j] - c[j];
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include<complex>

using namespace std;

typedef long long            ll;
typedef unsigned             ui;
typedef unsigned long long   ull;
typedef pair<int,int>        i_i;
typedef pair<ll,int>         ll_i;
typedef pair<ll,ll>          ll_ll;
typedef pair<double,int>     d_i;
typedef pair<double,double>  d_d;
typedef vector<int>          vi;
typedef vector<vector<int> > vii;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,x,y);
  if(x%y==0)puts("-1");
  else putv((ll)x*(y+1));
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>

#define DBL_MIN 0.000000000000001

#define A_P(n,a,d) (n/2)*(2*a + (n-1)*d)
using namespace std;

//ちゃんとlong型でやってる？

int main(void){
    long X;
    cin >> X;
    int sum = 0;
    for(int i =0 ; i < 1000000; i++){
        sum += i;
        if(sum >= X){
            cout << i << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 3644
import numpy as np

answer = False
BINGO = np.array([True, True, True])

a11,a12,a13=map(int,input().split())
a21,a22,a23=map(int,input().split())
a31,a32,a33=map(int,input().split())
A = np.asarray([[a11,a12,a13],[a21,a22,a23],[a31,a32,a33]])
N=int(input())
b=[int(input()) for i in range(N)]
b=list(set(b))

bingo = (A==b[0])
for i in range(1, len(b)):
  bingo = bingo + (A==b[i])

for i in range(3):
  if any(bingo[i,:]==False):
    pass
  else:
    answer = True
    break

if answer == False:
  for i in range(3):
    if any(bingo[:,i]==False):
      pass
    else:
      answer = True
      break

if answer == False:
  if not any(np.array([bingo[0,0],bingo[1,1],bingo[2,2]])==False):
    answer = True

if answer == False:
  if not any(np.array([bingo[0,2],bingo[1,1],bingo[2,0]])==False):
    answer = True

if answer == True:
  print("Yes")
else:
  print("No")


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

#define ll long long
#define ld long double
#define mod 1000000007LL
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define endl '\n'
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mp make_pair
#define pb(x) push_back(x)
#define fo(i, a, n) for (i = (a); i < (n); i++)
#define foe(i, a, n) for (i = (a); i <= (n); i++)
// clang-format off
#define vin(a) for (ll i = 0; i < sz(a); i++) { cin >> a[i]; } 
#define vout(a) for (auto x : a) { cout << x << " "; }
#define sws                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0)
// clang-format on
#define pd(x) cout << x
#define sd(x) cin >> x
#define nl cout << endl
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define foreach(i, a)                                                          \
  for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
// int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
void solve() {
  ll m, n;
  ll i, j;
  string s;
  cin >> n;
  cin >> s;
  ll ans = 0;
  stack<ll> st;

  fo(i, 0, n) {
    if (s[i] == 'R')
      st.push(i);
  }

  fo(i, 0, n) {
    if (st.size() == 0)
      break;
    if (s[i] == 'W') {
      if (st.top() > i) {
        ans++;
        st.pop();
      }
    }
  }

  cout << ans << endl;
}

int main() {
  sws;
  solve();
  return 0;
}

Measured memory_bytes: 5080
#![allow(unused_imports)]
#![allow(dead_code)]

use std::thread;
use std::io::{ self, Read };
use std::fmt;
use std::iter::Iterator;
use std::cmp::*;
use std::collections::*;
use std::str::*;
use std::mem::*;
use std::cell::*;

#[derive(Default)]
struct Input {
    buf: VecDeque<String>
}

impl Input {
    fn new() -> Input {
        Input { buf: VecDeque::new() }
    }

    fn read<T: FromStr>(&mut self) -> T 
    where <T as FromStr>::Err: fmt::Debug {
        self.next().unwrap().parse::<T>().unwrap()
    }

    fn read_2<T: FromStr, U: FromStr>(&mut self) -> (T, U)
    where <T as FromStr>::Err: fmt::Debug,
          <U as FromStr>::Err: fmt::Debug {
        (self.read(), self.read())
    }

    fn read_3<T: FromStr, U: FromStr, V: FromStr>(&mut self) -> (T, U, V)
    where <T as FromStr>::Err: fmt::Debug,
          <U as FromStr>::Err: fmt::Debug,
          <V as FromStr>::Err: fmt::Debug {
        (self.read(), self.read(), self.read())
    }

    fn read_bytes(&mut self) -> Vec<u8> {
        self.next().unwrap().into_bytes()
    }

    fn read_n<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where <T as FromStr>::Err: fmt::Debug {
        let mut v = Vec::new();
        for _ in 0..n { v.push(self.read::<T>()); }
        v
    }
}

impl Iterator for Input {
    type Item = String;
    fn next(&mut self) -> Option<String> {
        while self.buf.is_empty() {
            let mut s = String::new();
            let _res = io::stdin().read_line(&mut s);
            self.buf.extend(s.split_whitespace().map(|s| s.to_owned()));
        }
        self.buf.pop_front()
    }
}

fn run() {
    let mut ip = Input::new();
    const MOD: i64 = 1000000007;
    let n = ip.read();
    
    let mut v = vec![];

    for &k in &[1, -1] {
        for _ in 0..n {
            v.push((ip.read::<i64>(), k));
        }
    }
    v.sort();

    let mut y = 1;
    let mut s = 0i64;

    for (_, k) in v {
        if s * k < 0 {
            y = y * s.abs() % MOD;
        }
        s += k;
    }
    println!("{}", y);
}

fn main() {
    let _ = thread::Builder::new()
        .stack_size(50 * 1024 * 1024)
        .spawn(run).unwrap()
        .join();
}

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

#define ll long long
const int MOD = 1e9 + 7;
#define INF 2e9

#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

#define MATCH(_str, _ptn) regex_match(_str, regex(_ptn))
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)

# define pb push_back

# define INIT() cin.tie(0); ios::sync_with_stdio(false); cout << fixed << std::setprecision(20)

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; }

ll n,x,t;
string s;
int main() {
    INIT();

    cin >> n >> x >> t;
    cout << (n / x + (n % x > 0 ? 1 : 0)) * t;
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(void){
  int n,m,i;
  int a,sum=0;
  
  scanf("%d %d", &n, &m);
  sum=n;
  
  for(i=1; i<=m; i++){
    scanf("%d", &a);
    sum-=a;
  }
  
  if(sum>=0){
    printf("%d", sum);
  }else{
    printf("-1");
  }

  
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int a[410] = {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 << a[k-1] << endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

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

    ll r = 0, g = 0, b = 0;
    rep(i, n){
        if(s[i] == 'R'){
            r++;
        }
        if(s[i] == 'G'){
            g++;
        }
    }
    b = n - (r+g);

    ll ans = b * r * g;
    rep(i, n){
        for (int j = i+1; j < n; ++j) {
            int k = j+(j-i);
            if(k < 0 || k >= n) continue;
            if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) {
                if(j - i == k - j){
                    ans--;
                }

            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3644
#include<iostream>

using std::cout;
using std::cin;
using std::max;

#define INF 999999999;

int x, y, S, M;	

int tax(double a, double b){return (int)(b * (100+a) / 100);}

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

	while(1){
		cin >> x >> y >> S;
		if(x == 0 && y == 0 && S == 0) break;
		for(double i = 1.0; i < S; i+=1.0){
			for(double j = 1.0; j < S; j+=1.0){
				int n1, n2, n3, n4;
				n1 = tax((double)x, i);
				n2 = tax((double)x, j);
				if( n1+n2 == S){
					n3 = tax((double)y, i);
					n4 = tax((double)y, j);
					M = max(n3+n4, M);

				}
			}
		}

		cout << M << "\n";
		M = 0;
	}

	return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const int MOD = 1000000007;
const ll INF = 1LL << 60;

int n,m;
vector<vector<int>> G;

//メモ化再帰
int dp[100100];
int rec(int v){
  if(dp[v] != -1) return dp[v]; //既に更新済みならリターン
  int res = 0;
  for (auto nv: G[v]){
    chmax(res,rec(nv)+1);
  }
  return dp[v] = res; //メモしながらリターン
}

int main(){
  cin >> n >> m;
  G.assign(n, vector<int>());
  rep(i,m){
    int x,y; cin >> x >> y;
    x--,y--;
    G[x].push_back(y);
  }
  
  rep(i,n) dp[i] = -1;
  
  int res = 0;
  rep(i,n) chmax(res,rec(i));
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 8192
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInt :: IO Int
readInt = fst . fromJust . C.readInt <$> C.getLine

main :: IO ()
main = do
  n <- readInt
  putStrLn $ if f n then "No" else "Yes"

f :: Int -> Bool
f n =  null [(a,b) | a <- [0.. aa]
                   , b <- [0.. bb]
                   , 4*a + 7*b == n
                   ]
  where
    aa = n `div` 4
    bb = n `div` 7

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

typedef long long ll;
typedef tuple<ll, ll, ll> mytuple;
const ll INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589793238;

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) { if (b == 0) {return a;} else {return GCD(b, a % b);} }
// a と b の最小公倍数を返す関数
long long LCM(long long a, long long b) { return a/GCD(a,b)*b; }

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

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

  switch(N % 10) {
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon" << endl;
      break;
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon" << endl;
      break;
    case 3:
      cout << "bon" << endl;
      break;
  }

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	long long n,k,a,b,ans=1000000007;
	cin>>n>>k;
	vector<long long>x(n);
	rep(i,n)cin>>x[i];
	for(int i=0;i<=n-k;i++){
	    if(x[i]*x[i+k-1]>=0){
	        ans=min(ans,max(abs(x[i]),abs(x[i+k-1])));
	    }
	    else{
	        ans=min(ans,min(abs(x[i]*2-x[i+k-1]),abs(x[i+k-1]*2-x[i])));
	    }
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int tab[300000];
int main()
{

string x;


        cin>>x;



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

        if(x[i] == x[i+1])
        {

            if(x[i+1] == x[i+2])
            {

                cout<<"Yes"<<endl;
                return 0;

            }

        }

    }

    cout<<"No"<<endl;





    return 0;
}


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


int main (){
  int l, r, d, ans;
  cin >> l >> r >> d;
  ans = r/d - (l-1)/d;
  
  cout << ans << endl;
  return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> vecD(N); for(int i=0; i<vecD.size(); i++){ cin >> vecD[i]; }
    
    sort(vecD.begin(), vecD.end(), greater<int>());
    
    int num=1;
    for(int i=1; i<vecD.size(); i++){
        if(vecD[i-1]!=vecD[i]){
            num++;
        }
    }

    cout << num;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<map>
using namespace std;
int n,a[200005];
long long k;
map<int,int> mp;
int main()
{
	scanf("%d%lld",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int now=1;
	for(int i=1;i<=n;i++)
	{
		if(mp[now])
		{
			int x=mp[now];
			int ans=x+((k-x)%(i-x)),tmp=1;
			if(k<=n) ans=k; 
			for(int j=1;j<=ans;j++) tmp=a[tmp];
			printf("%d\n",tmp);
			return 0;
		}
		mp[now]=i;
		now=a[now];
	}
} 


Measured memory_bytes: 13216
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

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

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, k;
    cin >> n >> k;

    double ans = 0;
    for(int i = 1; i <= n; i++){
        int x = i;
        int cnt = 0;
        while(x < k){
            cnt++;
            x *= 2;
        }
        ans += 1.0 / (double) n * pow(0.5, cnt);
    }
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int k;
int sum;
int main()
{
    cin>>k;
    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++)
        for(int q=1;q<=k;q++)
    {
        sum+=__gcd(i,__gcd(j,q));
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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 int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> g(h + 2, vector<int>(w + 2, INF));
    REP(i, h + 2) g[i][0] = g[i][w + 1] = -1;
    REP(i, w + 2) g[0][i] = g[h + 1][i] = -1;

    deque<tuple<int, int, int>> q;
    string s;
    REP1(i, h) {
        cin >> s;
        REP1(j, w) {
            if (s[j - 1] == '#') {
                g[i][j] = 0;
                q.emplace_back(i, j, 0);
            }
        }
    }
//    REP(i, h + 2) {
//        REP(j, w + 2) {
//            cout << g[i][j] << " ";
//        }
//        cout << endl;
//    }

    vector<int> hi{-1, 0, 1, 0};
    vector<int> wi{0, 1, 0, -1};

    int r, c, d;
    while (!q.empty()) {
        tie(r, c, d) = q.front(); q.pop_front();

        REP(i, 4) {
            if (g[r + hi[i]][c + wi[i]] > d + 1) {
                g[r + hi[i]][c + wi[i]] = d + 1;
                q.emplace_back(r + hi[i], c + wi[i], d + 1);
            }
        }
    }
    int ans = 0;
    REP1(i, h) REP1(j, w) chmax(ans, g[i][j]);
    cout << ans << endl;
}



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

/*
 (imin,imax] -> imax
 return minimum index such that v[index] >= value
 auto f(int mid) {return v[mid] >= value;}
 */
template<class F>
auto  minimize(Int imin,Int imax,F &f){
    while(imax - imin > 1){
        Int mid = imin + (imax - imin)/2;
        if(f(mid)) imax = mid;
        else imin = mid;
    }
    return imax;
}

/*
 [imin,imax) -> imin
 return maximum index such that v[index] <= value
 auto f(int mid) {return v[mid] <= value;}
 */
template<class F>
auto  maximize(int imin,int imax,F &f){
    while(imax - imin > 1){
        int mid = imin + (imax - imin)/2;
        if(f(mid)) imin = mid;
        else imax = mid;
    }
    return imin;
}
int main(){
    Int N, K;
    cin >> N >> K;
    vector<Int>A(N),F(N);
    for(auto& e : A)
        cin >> e;
    for(auto& e : F)
        cin >> e;
    if(accumulate(A.begin(), A.end(),0LL) <= K)
        return puts("0") * 0;
    sort(A.begin(),A.end());
    sort(F.begin(),F.end(), greater<>());
    auto comp = [&](Int mid){
        Int tK = K;
        for(Int i = 0; i < N; ++i){
            if( mid < F[i]){
                
                tK -= A[i];
                
            } else if(mid == F[i]){
                                
                tK -= (A[i] - 1);
                
            } else {
                
             if(A[i] * F[i] > mid) {
                    Int idx = mid / F[i];
                    if(A[i] - idx < 0)  return false;
                    tK -= (A[i] - idx);
                }
            }
        }
        return tK >= 0;;
    };
    Int ub = (1LL << 60);
    cout << minimize(0LL,ub,comp)<< endl;
    
}



Measured memory_bytes: 3328
#include <iostream>
#include <string>
#define llint long long 

using namespace std;

string s, t;
llint S, T;
llint sumS[100005], sumT[100005];
llint Q;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s >> t;
	S = s.size(), T = t.size();
	s = "#" + s, t = "#" + t;
	
	for(int i = 1; i <= S; i++){
		sumS[i] = sumS[i-1];
		if(s[i] == 'A') sumS[i]++;
		else sumS[i] += 2;
	}
	for(int i = 1; i <= T; i++){
		sumT[i] = sumT[i-1];
		if(t[i] == 'A') sumT[i]++;
		else sumT[i] += 2;
	}
	
	cin >> Q;
	llint a, b, c, d;
	for(int i = 0; i < Q; i++){
		cin >> a >> b >> c >> d;
		if((sumS[b]-sumS[a-1]) % 3 == (sumT[d]-sumT[c-1])%3) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2412
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
    char x, y;
    cin >> x >> y;
    if (x < y) cout << "<" << endl;
    else if (x == y) cout << "=" << endl;
    else cout << ">" << endl;
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    map<int, vector<int>> mm;
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        mm[b].push_back(a);
    }
    long answer = 0;
    vector<bool> d(m + 1, false);
    for (auto it = mm.rbegin(); it != mm.rend(); ++it) {
        sort(it->second.begin(), it->second.end());
        int available = it->second[0];
        while (available < m + 1 && d[available]) ++available;
        for (int dd: it->second) {
            int ddd = max(dd, available);
            while (ddd < m + 1 && d[ddd]) ++ddd;
            if (ddd < m + 1) {
                answer += it->first;
                d[ddd] = true;
                while (available < m + 1 && d[available]) ++available;
            } else {
                break;
            }
        }
    }
    cout << answer << endl;
}


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

using namespace std;

int main(){
  int N;
  cin >> N;
  int P[10], Q[10], A[10];
  rep(i,N) cin >> P[i];
  rep(i,N) cin >> Q[i];
  rep(i,N) A[i]=i+1;
  int a, b, num=0;
  do{
    num++;
    rep(i,N){
      if(P[i]!=A[i]) break;
      if(i==N-1) a=num;
    }
    rep(i,N){
      if(Q[i]!=A[i]) break;
      if(i==N-1) b=num;
    }
  }while(next_permutation(A,A+N));
  cout << abs(a-b) << endl;
  
  return 0;
}

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

public class Main {
  
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    String t = sc.next();
    
    char sArray[] = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      sArray[i] = s.charAt(i);
    }
    Arrays.sort(sArray);
    char tArray[] = new char[t.length()];
    for (int i = 0; i < t.length(); i++) {
      tArray[i] = t.charAt(i);
    }
    Arrays.sort(tArray);
    char tReverse[] = new char[t.length()];
    for (int i = 0; i < t.length(); i++) {
      tReverse[i] = tArray[t.length() - 1 - i];
    }
    
    String sF = String.valueOf(sArray);
    String tR = String.valueOf(tReverse);
    
    if (tR.compareTo(sF) > 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    
  }
}

Measured memory_bytes: 21588
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)


int main() {
	int n, k;
	cin >> n >> k;
	if (n >= 2 * k - 1)cout << "YES" << endl;
	else cout << "NO" << endl;
 	return 0;
}

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

int main(void){
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    int ans=0;
    for(int i=1;i<=n;i++){
      if(i<=k)
        ans+=x;
      else
        ans+=y;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <stdexcept>
#include <utility>
// #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,n,h) for(int i = n; i < h; ++i)
#define rep3(l,n,h) for(int l = n; l <= h; ++l)
using namespace std;


int main() {
    string s;
    cin >> s;
    string h;
    int k;
    rep(i, s.length()) {
        if (s[i] == 'C') {
            h += s[i];
            k = i;
            break;
        }
    }
    rep2(j, k+1, s.length()) {
        if (s[j] == 'F') {
            h += s[j];
            break;
        }
    }
        if (h == "CF") {
            cout << "Yes";
        } else {
            cout << "No";
        }

        return 0;
    }


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

int main() {
  int64_t x, k, d;
  cin >> x >> k >> d;
  
  if (x < 0)
    x *= -1;
  
  int64_t s = k - x / d;
  
  if (s <= 0)
    cout << x - d * k << endl;
  else {
    if (s % 2 == 0)
      cout << x % d << endl;
    else
      cout << (x % d - d) * -1 << endl;
  }
}


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

int main() {
  while (true) {
    int w, d;
    cin >> w >> d;
    if (w == 0 && d == 0) return 0;

    int hf[w], hs[d];
    for (int i = 0; i < w; i++) {
      cin >> hf[i];
    }
    for (int i = 0; i < d; i++) {
      cin >> hs[i];
    }

    sort(hf, hf + w);
    sort(hs, hs + d);

    int pf = w - 1, ps = d - 1;
    int ans = 0;
    while (pf >= 0 || ps >= 0) {
      if (pf < 0) {
	ans += hs[ps];
	ps--;
      } else if (ps < 0) {
	ans += hf[pf];
	pf--;
      } else {
	if (hf[pf] == hs[ps]) {
	  ans += hf[pf];
	  pf--;
	  ps--;
	}
	else if (hf[pf] > hs[ps]) {
	  ans += hf[pf];
	  pf--;
	} else {
	  ans += hs[ps];
	  ps--;
	}
      }
    }
    cout << ans << endl;
  }
}

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

int main(){
  int x,n;
  int tmp2=600,ans=600;
  cin >>x>>n;
  int tmp;
  vector<int>a(601,1);
  for(int i=0;i<n;i++){
    cin >>tmp;
    a.at(tmp+300)=-1;
  }
  for(int i=0;i<601;i++){
    if(a.at(i)==-1)
      continue;
    if(tmp2>abs(x-(i-300))){
      tmp2=abs(x-(i-300));
      	ans=i-300;
    }
    else if(tmp2==abs(x-(i-300))){
      if(ans>i-300)
        ans=i-300;
    }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 3636
import sys
l,r = map(int, input().split())

if r == l+1:
    print((l*r)%2019)
    sys.exit()

for i in range(1,10**6+1):
    v = 2019*i
    if l<=v and r>=v:
        print(0)
        sys.exit()

ans = 2020
for i in range(l,r):
    for j in range(i+1,r+1):
        dp = (i*j)%2019
        if ans>dp:
            ans = dp

print(ans)

Measured memory_bytes: 3064