akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("-O3")
    #include <bits/stdc++.h>  
     
    using namespace std;
     
    typedef long long ll;
    typedef long double ld;
    typedef pair<int,int> p32;
    typedef pair<ll,ll> p64;
    typedef pair<double,double> pdd;
    typedef vector<ll> v64;
    typedef vector<int> v32;
    typedef vector<vector<int> > vv32;
    typedef vector<vector<ll> > vv64;
    typedef vector<vector<p64> > vvp64;
    typedef vector<p64> vp64;
    typedef vector<p32> vp32;
    ll MOD = 998244353;
    #define forn(i,e) for(ll i = 0; i < e; i++)
    #define forsn(i,s,e) for(int i = s; i < e; i++)
    #define rforn(i,s) for(ll i = s; i >= 0; i--)
    #define rforsn(i,s,e) for(ll i = s; i >= e; i--)
    #define ln "\n"
    #define dbg(x) cout<<#x<<" = "<<x<<ln
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define INF 1e18
    #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((ll)(x).size())
     
    ll mpow(ll a, ll b){
        if(b >= (MOD-1)) b %= (MOD-1);
        if(b==0) return 1;
        ll t1 = mpow(a,b/2);
        t1 *= t1;
        t1 %= MOD;
        if(b%2) t1 *= a;
        t1 %= MOD;
        return t1;
    }
     
    ll mpow(ll a, ll b, ll p){
        if(b==0) return 1;
        ll t1 = mpow(a,b/2,p);   t1 *= t1;
        t1 %= p;
        if(b%2) t1 *= a;
        t1 %= p;
        return t1;
    }
    ll modinverse(ll a, ll m){
        ll m0 = m; 
        ll y = 0, x = 1; 
        if (m == 1) return 0; 
        while (a > 1){
            ll q = a / m; 
            ll t = m; 
            m = a % m, a = t; 
            t = y; 
            y = x - q * y; 
            x = t; 
        }
        if (x < 0) x += m0; 
        return x; 
    }
    ll range(ll l, ll r){
        return l + rand()%(r-l+1);
    }
    
    int main()
    {
        ll t=1;
        //cin>>t;
        while(t--)
        {
            string a;
            cin>>a;
            ll ans=0,cs=0;
            for(char c : a)
            {
                if(c == 'R')
                {
                    cs++;
                    ans = max(ans,cs);
                }
                else cs = 0;
            }  
            cout<<ans<<endl;
        }
    }

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}
const int INF = 100000000;

int main(){
    int a, b;
    cin >> a >> b;
    cout << 6-a-b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  lli n, k;
  while (scanf("%lld %lld", &n, &k) != EOF)
    printf("%lld\n", min(n % k, abs(n % k - k)));
  return 0;
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){

    string s,t;
    cin >> s >> t;

    vector<vector<ll>> sl(26);
    vector<vector<ll>> tl(26);
    
    rep(i,s.size()){
      ll cs,ct;
      cs = s[i] - 'a';
      ct = t[i] - 'a';
      sl[cs].push_back(i);
      tl[ct].push_back(i);
    }

    bool ok = true;
    rep(i,26){
      if(sl[i].size()==0){
        continue;
      }

      ll ct = t[sl[i][0]] - 'a';
      if(tl[ct].size()!=sl[i].size()){
        cout << "No" << endl;
        return 0;
      }else{
        rep(j,sl[i].size()){
          if(sl[i][j]!=tl[ct][j]){
            cout << "No" << endl;
            return 0;
          }
        }
      }
    }

    cout << "Yes" << endl;

    
    return 0;
}

Measured memory_bytes: 4744
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;
    
    alias tmny = Tuple!(int, int);
    auto t = new tmny[][] (n);
    foreach (i; 0 .. n) {
        int a;
        readf("%s", &a);
        readln;
        
        foreach (_; 0 .. a) {
            int x, y;
            readf("%s %s", &x, &y);
            readln;
            
            t[i] ~= tmny(x, y);
        }
    }
    
    int ans = 0;
    
    bool isHonest(int v, int bt) { return ((1 << v) & bt) > 0; }
    
    outer: foreach (bt; 1 .. (1 << n)) {
        foreach (i; 0 .. n) {
            if (!isHonest(i, bt)) { continue; }
            
            foreach (ts; t[i]) {
                if (isHonest(ts[0] - 1, bt) != ts[1]) {
                    continue outer;
                }
            }
        }
        
        int cur = bt.popcnt;
        if (cur > ans) { ans = cur; }
    }
    
    ans.writeln;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int nmax=400005;
ll fac[nmax],finv[nmax],inv[nmax];
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<nmax;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
// modintを使うときはllをmintに
ll com(int n,int k){
  if(n<k||n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin >> n >> k;
    COMinit();
    if(n<=k){
        cout << com(n+n-1,n-1) << endl;
    }
    else{
        ll ans=0;
        for(int i=0;i<=k;i++){
            (ans+=com(n,i)*com(n-i-1+i,i)%mod)%=mod;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 9600
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
    int i,j,n,m,Tmin[27]= {0};
    string s;
    cin>>n;
    for(i=0; i<27; i++)
        Tmin[i]=100000;
    while(n--)
    {
        int Temp[27]= {0};
        cin>>s;
        for(i=0; i<s.length(); i++)
        {
            Temp[s[i]-'a']++;
        }
        for(i=0; i<26; i++)
        {
            if(Tmin[i]>Temp[i])
                Tmin[i]=Temp[i];
        }
    }
    for(i=0; i<26; i++)
    {
        for(j=0; j<Tmin[i]; j++)
            printf("%c",'a'+i);
    }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
a = []
for i in range(3):
    a.append(map(int, raw_input().split()))
A = 1
B = 1
while B < 3:
    A = 1
    while A < 3:
        if not a[B][A]-a[B-1][A] == a[B][0]-a[B-1][0]:
            print "No"
            sys.exit()
        if not a[B][A]-a[B][A-1] == a[0][A]-a[0][A-1]:
            print "No"
            sys.exit()
        A += 1
    B += 1
print "Yes"

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	int N, M; cin >> N >> M; 
	vector<int> A[100010] = {}; // i日目までにやる仕事を入れる
	for(int i = 0; i < N; i++){
		int a, b; cin >> a >> b; 
		if(a > M) continue; 
		A[M-a].push_back(b); 
	}
	for(int i = 0; i <= M; i++){
		sort(A[i].begin(), A[i].end(), greater<int>()); 
	}
	priority_queue<int, vector<int>, greater<int>> que; 
	for(int i = 0; i <= M; i++){
		for(int j = 0; j < A[i].size(); j++){
			if(que.size() <= i){
				que.push(A[i].at(j)); 
			}
			else if(que.size() == i+1){
				int m = que.top(); 
				if(A[i].at(j) > m){
					que.pop(); que.push(A[i].at(j)); 
				}
				else if(A[i].at(j) <= m){
					break; 
				}
			}
		}
	}
	int ans = 0; 
	while(que.size()){
		int m = que.top(); 
		ans += m; que.pop(); 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 6268
#include<stdio.h>
#define MAX 100

main()
{
  int i, j, N, A[MAX], irekae, minj, count=0;

  scanf("%d", &N);
  for(i=0; i<N; i++)
    {
      scanf("%d", &A[i]);
    }

  for(i=0; i<N; i++)
    {
      minj = i;
      
      for(j=i; j<N; j++)
	{
	  if(A[j] < A[minj])
	    {
	      minj = j;
	    }
	}

      if(A[minj] < A[i])
	{
	  irekae = A[i];
	  A[i] = A[minj];
	  A[minj] = irekae;
	  count++;
	}
    }
  
  for(i=0; i<N; i++)
    {
      printf("%d", A[i]);
      if(i<N-1)
	{
	  printf(" ");
	}
    }
  printf("\n");
  printf("%d\n", count);

  return 0;  
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
int n,k;
int dp[100001];
int solve(int arr[][3],int idx)
{
    if(idx>=n) return 0;
    int mi=0;
    for(int i=1;i<=k;i++)
    {
        int left=INT_MAX;
        if(idx+i <= n-1)
        {
            left=abs(arr[idx+i]-arr[idx])+solve(arr,idx+i);
        }
        mi=min(mi,left);
    }
    return dp[idx]=mi;
    
}

int main() {
    //memset(dp,-1,sizeof(dp));
	cin>>n;
	int arr[n][3];
	for(int i=0;i<n;i++)
	{
	    cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	int ans[n][3];
	memset(ans,0,sizeof(ans));
	ans[0][0]=arr[0][0],ans[0][1]=arr[0][1],ans[0][2]=arr[0][2];
	for(int i=1;i<n;i++)
	{
	    ans[i][0]=max(ans[i-1][1],ans[i-1][2])+arr[i][0];
	    ans[i][1]=max(ans[i-1][0],ans[i-1][2])+arr[i][1];
	    ans[i][2]=max(ans[i-1][1],ans[i-1][0])+arr[i][2];
	}
	int ma=0;
	for(int i=0;i<3;i++)
	{
	    ma=max(ma,ans[n-1][i]);
	}
	cout<<ma<<endl;
}
/*
3
10 40 70
20 50 80
30 60 90

210
*/

Measured memory_bytes: 2560
import itertools
import copy
from collections import deque
import heapq
n = int(input())
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

#エラトステネスの篩
def factory(n):
    num = int(n**0.5)+1
    prime = primes(num)
    disassembly = {}
    for i in prime:
        if n < i:
            return(disassembly)
            break
        count = 0
        while n % i == 0:
            n = n // i
            count += 1
        if not count == 0:
            disassembly[i] = count
    if n != 1:
        disassembly[n] = 1
    if disassembly == {}:
        disassembly[n] = 1
    return(disassembly)
ans = factory(n)
ans_list = []
for i in ans:
    for j in range(1,ans[i]+1):
        ans_list.append(i**j)
ans_list.sort()
answer = 0
for i in ans_list:
    if n%i == 0:
        answer += 1
        n = n//i
print(answer)


Measured memory_bytes: 20680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n, m;
	cin >> n>> m;
	vector<int> a(n);
	int sum = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sort(all(a));
	cout <<((a[n-m] >= sum /(4.0*m))?"Yes":"No") << endl;
	return 0;
}



Measured memory_bytes: 3600
# coding: utf-8
N, K = map(int, input().split())
# print(N, K)
S = input()
# print(S)
# print(chr(ord(S[K -1]) + 32))
s = ""
for i in range(N):
    if i == K - 1:
        s += chr(ord(S[K -1]) + 32)
    else:
        s += S[i]
print(s)

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

int up(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(){
  int n;
  scanf("%d", &n);
  int a[n];
  int i;
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  qsort(a, n, sizeof(int), up);
  int x, y, z;
  x = a[0];
  i = 1;
  int ans = 1;
  int flag = 1;
  int xn = 0;
  int yn = 0;
  int zn = 0;
  while(i < n){
    if(x != a[i]){
      y = a[i];
      xn = i;
      break;
    }else{
      i++;
    }
  }
  if(i == n && flag){
    y = x;
    z = x;
    flag = 0;
  }
  while(i < n){
    if(y != a[i]){
      z = a[i];
      yn = i - xn;
      break;
    }else{
      i++;
    }
  }
  if(i == n && flag){
    yn = n - xn;
    if(x ^ y == x && x ^ x == y && xn == yn * 2){
      z = x;
    }else if(x ^ y == y && y ^ y == x && yn == xn * 2){
      z = y;
    }else{
      //printf("2\n");
      ans = 0;
    }
    flag = 0;
  }
  while(i < n){
    if(z != a[i]){
      zn = i - yn - xn;
      break;
    }else{
      i++;
    }
  }
  if(i == n && flag){
    zn = n - yn - xn;
    //printf("%d %d %d\n", xn, yn, zn);
    if((xn != yn) || (yn != zn)){
      //printf("3\n");
      ans = 0;
    }
  }
  if(i != n){
    //printf("4\n");
    ans = 0;  //4種類以上はアウト
  }
  if(ans){
    //printf("%d %d %d\n", x, y, z);///////////
    if((x ^ y) != z){
      //printf("cond\n");
      ans = 0;
    }
  }
  if(ans){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <ctype.h>

int main(){
	char s[1024];
	int i;

	scanf("%[^\n]", s);
	for( i=0; s[i]!='\0'; i++ ){
		s[i] = (char)toupper( (int)s[i] );
	}
	printf("%s\n", s);

	return 0;
}

Measured memory_bytes: 524
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();
        int F = sc.nextInt();
        List<Integer> waterList = new ArrayList<>();
        List<Integer> sugerList = new ArrayList<>();
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j <= 100; j++) {
                int candidate = 100 * A * i + 100 * B * j;
                if (candidate <= F) {
                    waterList.add(candidate);
                }
            }
        }
        waterList = waterList.stream().distinct().collect(Collectors.toList());

        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j <= 100; j++) {
                int candidate = C * i + D * j;
                if (candidate <= F) {
                    sugerList.add(candidate);
                }
            }
        }
        sugerList = sugerList.stream().distinct().collect(Collectors.toList());
        double max = 0;
        int total = 100 * A, suger = 0;
        for (int wCandidate : waterList) {
            for (int sCandidate : sugerList) {
                if (wCandidate + sCandidate <= F) {
                    double percent = sCandidate * 100.0 / wCandidate;
                    if (percent <= E && percent > max) {
                        max = percent;
                        total = sCandidate + wCandidate;
                        suger = sCandidate;
                    }
                }
            }
        }
        System.out.println(total + " " + suger);
    }
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<ll> a(n + 1);
    a[0] = 0;
    for(int i = 1; i <= n; i++){
        ll an; cin >> an;
        a[i] = a[i - 1] + an;
    }
    ll ans = 1LL << 60;
    for(int i = 1; i < n; i++){
        ll sum = abs(a[i] - (a[n] - a[i]));
        ans = min(ans, sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int A,B,C;
	cin>>A>>B>>C;
	cout<<A*B*C/(max(A,max(B,C)))/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF+7;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)
#define int long long 

signed main(){
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;                                                                                                                                               
}


Measured memory_bytes: 256
def winrate(wn, wk):
    b = 0
    while wn * 2**b < wk:
        b += 1
    return 1/2 ** b

n, k = map(int,input().split())
ans = 0
for i in range(1, n+1):
    ans += 1/n * winrate(i, k)
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<random>
#include<ctime>
#include<cstdlib>
#include<complex>
#include<fstream>
using namespace std;

int main(){

  int n, a, b, x;
  cin >> n >> a >> b;

  cout << min(n*a, b) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
using namespace std;
int a,b;
signed main(){
	cin>>a;
	cout<<"Christmas";
	rep(i,25-a){
		cout<<" Eve";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
//using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dh[8] = {0, 0, 1, 1, 1, -1, -1, -1};
const int dw[8] = {1, -1, 0, 1, -1, 0, 1, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
using Graph = vector<vector<int>>;
Graph G;
  
/*------------------------------------------------------------------*/
int main(){
    int n; cin >> n;
    if(n < 2) cout << 1 << endl;
    else if(n < 4) cout << 2 << endl;
    else if(n < 8) cout << 4 << endl;
    else if(n < 16) cout << 8 << endl;
    else if(n < 32) cout << 16 << endl;
    else if(n < 64) cout << 32 << endl;
    else cout << 64 << endl;    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
#include <numeric>
using namespace std;


const long double PI = 3.14159265358979323846264338327950;
const int N = 2 * 1e5;


template <class T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}


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

	int a, b, ans;
	cin >> a >> b;
	// cout << "n:" << n << " m:" << m << '\n';
	for (int i = 1; i <= 1250; ++i) {
		if (2 * i / 25 == a && i / 10 == b) {
			cout << i << '\n';
			return 0;
		}
	}

	cout << -1 << '\n';
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  string t="abc";
  int c[3];
  mem(c);
  rep(i,s.size()) c[s[i]-'a']++;
  do {
    int d[3];
    mem(d);
    bool f=1;
    rep(i,s.size()) {
      d[t[i%3]-'a']++;
      if(d[t[i%3]-'a']>c[t[i%3]-'a']) f=0;
    }
    rep(i,3) {
      if(d[i]!=c[i]) f=0;
    }
    if(f) {
      pr("YES");
      return;
    }
  } while(next_permutation(all(t)));
  pr("NO");
}

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> num(1001,0);

void fact(ll N){
    ll ans = 1;
    
    for(int i = 2; i <= N; i++){
        ll cnt = 0;
        while(N % i == 0){
            N /= i;
            cnt++;
        }
        if(cnt != 0){
            num[i] += cnt;
        }
        
    }

}



int main(){
    ll N, ans = 1;
    cin >> N;
    for(int i = 1; i <= N; i++){
        fact(i);
    }
    for(int i = 0; i <= N; i++){
        ans = (ans * (num[i] + 1)) % ll(1e9  + 7);
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	string s;
	cin >> s;
	int sz = s.l_ength();
	ll dpa[sz+1], dpb[sz+1], dpc[sz+1];
	dpa[0] = 0;
	dpb[0] = 0;
	dpc[0] = 0;
	ll qg = 1;
	for( int i = 0; i < sz; ++i ){
		if( s[i] == '?' ){
			dpa[i+1] = ( dpa[i] * 3 + qg )%MOD;
			dpb[i+1] = ( dpb[i] * 3 + dpa[i] )%MOD;
			dpc[i+1] = ( dpc[i] * 3 + dpb[i] )%MOD;
			qg *= 3;
			qg %= MOD;
		} else if( s[i] == 'A' ){
			dpa[i+1] = (dpa[i] + qg)%MOD;
			dpb[i+1] = dpb[i];
			dpc[i+1] = dpc[i];
		} else if( s[i] == 'B' ){
			dpa[i+1] = dpa[i];
			dpb[i+1] = (dpb[i] + dpa[i])%MOD;
			dpc[i+1] = dpc[i];
		} else if( s[i] == 'C' ){
			dpa[i+1] = dpa[i];
			dpb[i+1] = dpb[i];
			dpc[i+1] = (dpc[i] + dpb[i])%MOD;
		}
	}
	/*
	for( int i = 0; i <= sz; ++i ){
		cout << dpa[i] << " " << dpb[i] << " " << dpc[i] << endl;
	}
	*/
	cout << dpc[sz] << endl;
	return 0;
}

Measured memory_bytes: 2816
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 2e5 + 15;
const int OFFSET = 1e5 + 5;
int arr[N + 5], bit[N + 5];

void update(int x) {
	for( ; x <= N; x += (x & -x)) bit[x]++;
}

int query(int x) {
	int total = 0;
	for( ; x ; x -= (x & -x)) total += bit[x];
	return total;
}

void hora(int tc) {
	ll n;
	cin>>n;
	for(int i = 0;i < n;i++) cin>>arr[i];
	int lo = 0;
	int hi = 1e9;
	int res = 0;
	ll ways = n * (n + 1) / 2;
	while(lo <= hi) {
		memset(bit, 0, sizeof bit);
		int mid = (lo + hi) / 2;
		int cur = 0;
		int ptr = 0;
		ll total = 0;
		for(int i = 0;i < n;i++) {
			int dir = ((arr[i] >= mid)?-1:1);
			ptr += dir;
			update(cur + OFFSET);
			cur += dir;
			total += (i + 1) - query(ptr - 1 + OFFSET);
		}
		if(total * 2 >= ways) {
			res = mid;
			lo = mid + 1;
		} else hi = mid - 1;
	}
	cout<<res<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(int i=0; i<(n); i++)
#define REPj(n) for(int j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/* 
	add utility Algorithm
*/

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string S;
    cin >> S;

    REPinit(i, 0, S.size()) {
        if (i % 2 == 0) {
            if (S.at(i) == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            if (S.at(i) == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
    }

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


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int) n; ++i)
int main(){
    string s, t;  
	cin >> s >> t;
    vector<int> p(26), q(26);
    rep(i, s.size()) {
      p[s[i] - 'a']++;
    }
    rep(i, t.size()) {
      q[t[i] - 'a']++;
    }
    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    rep(i, 26) {
      if (p[i] != q[i]) {
        cout << "No" << '\n';
        return 0;
      }
    }
    cout << "Yes" << '\n';

    return 0;
}

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

using namespace std;
int main()
{
	int i;

	vector<int>n(3);

	for (i = 0; i < 3; i++)
	{
		cin >> n[i];
	}
	sort(n.begin(), n.end());
	if (n[0] == 5 && n[1] == 5 && n[2] == 7)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

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

template <class E>
using Graph = vector<vector<E>>;

template<class D, D INF>
struct Dijkstra {
    vector<D> res; //res[i] = sからiまでの最短距離
    
    template<class E>
    Dijkstra(const Graph<E> &g, int s) {
        int V = (int)g.size();
        res = vector<D>(V, INF);
        
        using P = pair<D, int>;
        priority_queue<P, vector<P>, greater<P>> q;
        q.push(P(0, s));
        res[s] = 0;
        while (!q.empty()) {
            P p = q.top(); q.pop();
            if (res[p.second] < p.first) continue;
            for (E e: g[p.second]) {
                if (p.first+e.dist < res[e.to]) {
                    res[e.to] = p.first+e.dist;
                    q.push(P(res[e.to], e.to));
                }
            }
        }
    }
};

const int MN = 100100;

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    using P = pair<int, int>;
    set<int> gc[MN];
    vector<P> g[MN];
    for (int i = 0; i < m; i++) {
        int p, q, c;
        scanf("%d %d %d", &p, &q, &c); p--; q--;
        gc[p].insert(c);
        gc[q].insert(c);
        g[p].push_back(P(q, c));
        g[q].push_back(P(p, c));
    }

    int co = 0;
    map<P, int> p2id;
    for (int i = 0; i < n; i++) {
        gc[i].insert(0);
        for (int c: gc[i]) {
            p2id[P(i, c)] = co;
            co++;
        }
    }

    struct Edge {
        int to, dist;
    };
    Graph<Edge> gdist(co);
    for (int i = 0; i < n; i++) {
        for (P p: g[i]) {
            int j = p.first;
            int c = p.second;
            int mid = p2id[P(i, c)];
            int yid = p2id[P(j, c)];
            gdist[mid].push_back(Edge{yid, 0});
        }
        for (int c: gc[i]) {
            if (c == 0) continue;
            int mid = p2id[P(i, c)];
            int yid = p2id[P(i, 0)];
            gdist[mid].push_back(Edge{yid, 0});
            gdist[yid].push_back(Edge{mid, 1});
        }
    }
    Dijkstra<int, TEN(9)> djk(gdist, p2id[P(0, 0)]);
    int sid = p2id[P(0, 0)];
    int tid = p2id[P(n-1, 0)];
    int ans = Dijkstra<int, TEN(9)>(gdist, sid).res[tid];
    if (ans == TEN(9)) ans = -1;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 103484
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>
#include <ctime>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define sys system("pause")
#define ls rt<<1
#define rs rt<<1|1
const int maxn=1e5+10;
const int N=2e5+10;
using namespace std;
int id(int l,int r){return l+r|l!=r;}
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
int n,m,k,t,cnt[maxn];
int main()
{
    int i,j;
    scanf("%d%d",&n,&m);
    rep(i,1,m)scanf("%d%d",&j,&k),++cnt[j],++cnt[k];
    rep(i,1,n)if(cnt[i]&1)return 0*puts("NO");
    puts("YES");
    return 0;
}


Measured memory_bytes: 640
def solve(operands):
    for i in range(pow(2, len(operands) - 1)):
        tmp_equation = operands[0]
        for j in range(len(operands) - 1):
            tmp_equation += '+' if i >> j & 1 else '-'
            tmp_equation += operands[j + 1]
        if eval(tmp_equation) == 7:
            print(tmp_equation + '=7')
            return

if __name__ == "__main__":
    operands = list(input())
    solve(operands)

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int a, b;
    cin >> a >> b;
    cout << (a * 500 >= b ? "Yes" : "No");
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

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

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

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL a, b;
	cin >> a >> b;
	LL ans = max(a + b, max(a - b, a*b));
	O(ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n;
long a,b,h[1<<17];
main()
{
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)cin>>h[i];
	sort(h,h+n);
	long F=0,L=1e10;
	while(L-F>1)
	{
		long M=(L+F)/2;
		long D=b*M;
		long cnt=0;
		for(int i=0;i<n;i++)
		{
			if(h[i]<=D)continue;
			cnt+=(h[i]-D-1)/(a-b)+1;
		}
		if(cnt<=M)L=M;
		else F=M;
	}
	cout<<L<<endl;
}


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

int main() {
    int n; cin >> n;
    map<string, vector<int>> d;
    for(int i = 0; i < n; ++i) {
        string col; cin >> col;
        int den; cin >> den;
        d[col].push_back(den);
    }
    for(auto& p : d) sort(begin(p.second), end(p.second));

    int m; cin >> m;
    int cur_den = 0;
    bool ans = true;
    for(int i = 0; i < m; ++i) {
        string col; cin >> col;
        if(d.count(col) == 0) {
            ans = false;
            continue;
        }
        const int idx = upper_bound(begin(d[col]), end(d[col]), cur_den) - begin(d[col]);
        if(idx == (int)d[col].size()) {
            ans = false;
        } else {
            cur_den = d[col][idx];
        }
    }

    cout << (ans ? "Yes" : "No") << endl;
}



Measured memory_bytes: 21980
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

int main(){
        int n;
        cin >> n;
        double s[2000]={0};
        while(n != 0){ 
                double ave=0;
                for( int i = 0; i < n ; i++){
                        cin >> s[i];
                        ave += s[i];
                }   
                ave = ave/n;
                double var=0;
                for( int i = 0; i < n ; i++){
                        var += (s[i] - ave)*(s[i] - ave);
                }   
                var = var/n;    
                cout << setprecision(20);
                cout << showpoint <<  pow(var,0.5) << endl;
                cin >> n;
        }   

return 0;
}

Measured memory_bytes: 3376
fun main(args: Array<String>) {
    val binaryTree = BinaryTree<Int>()
    repeat(readLine()?.toInt() ?: 0) {
        val input = readLine()?.split(" ".toRegex()) ?: return@repeat
        when (input[0]) {
            "insert" -> binaryTree.insert(input[1].toInt())
            "print" -> binaryTree.printTree()
            "find" -> println(
                if (binaryTree.exists(input[1].toInt())) {
                    "yes"
                } else {
                    "no"
                }
            )
        }
    }
}

class BinaryTree<T: Comparable<T>> {
    private var root: Node? = null

    fun insert(key: T) {
        val newNode = Node(key)
        var x = root
        var y = x?.parent
        while (x != null) {
            y = x
            x = if (key < x.key) {
                x.leftChild
            } else {
                x.rightChild
            }
        }
        newNode.parent = y
        when {
            y == null -> root = newNode
            key < y.key -> y.leftChild = newNode
            else -> y.rightChild = newNode
        }
    }

    fun exists(key: T): Boolean {
        var node = this.root
        while (node != null) {
            if (key == node.key) {
                return true
            } else if (key < node.key) {
                node = node.leftChild
            } else {
                node = node.rightChild
            }
        }
        return false
    }

    fun printTree() {
        println(inorderTreeWalk())
        println(preorderTreeWalk())
    }

    private fun inorderTreeWalk(): String {
        val root = this.root ?: return ""
        return inorderTreeWalk(root)
    }

    private fun inorderTreeWalk(node: Node): String {
        val resultBuilder = StringBuilder()
        if (node.leftChild != null) {
            resultBuilder.append(inorderTreeWalk(node.leftChild!!))
        }
        resultBuilder.append(" ")
        resultBuilder.append(node.key)
        if (node.rightChild != null) {
            resultBuilder.append(inorderTreeWalk(node.rightChild!!))
        }
        return resultBuilder.toString()
    }

    private fun preorderTreeWalk(): String {
        val root = this.root ?: return ""
        return preorderTreeWalk(root)
    }

    private fun preorderTreeWalk(node: Node): String {
        val resultBuilder = StringBuilder()
        resultBuilder.append(" ")
        resultBuilder.append(node.key)
        if (node.leftChild != null) {
            resultBuilder.append(preorderTreeWalk(node.leftChild!!))
        }
        if (node.rightChild != null) {
            resultBuilder.append(preorderTreeWalk(node.rightChild!!))
        }
        return resultBuilder.toString()
    }

    inner class Node(val key: T) {
        var parent: Node? = null
        var leftChild: Node? = null
        var rightChild: Node? = null
    }
}


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

int main(){
  int a,b,c,max;
  cin >> a >> b >>c;
  if(a>b){
    if(a>c){
      max = a;
    }else{
      max = c;
    }
  }else{
    if(b>c){
      max = b;
    }else{
      max = c;
    }
  }
  cout << a+b+c-max << endl;
}

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

int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if(s==u) cout << a-1 << ' ' << b;
  else cout << a << ' ' << b - 1;
  return 0;
}

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

int main (){
    char a[101], b[101];
    int x, y;
    char z[101];
    scanf ("%s %s %d %d %s",a,b,&x,&y,z);

    int j = strcmp (z, a);
    if(j == 0){
        x-=1;
    }
    else {
        y -= 1;
    }
    printf("%d %d\n",x,y);
         return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main(void) {
	int k, x; cin >> k >> x;
	for (int i = x - k + 1; i < x + k; i++) {
		if (i > x - k + 1) cout << " ";
		cout << i;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
zero=0
minus=0

for i in A:
  if i==0:
    zero=1
  if i<0:
    minus+=1
#print(zero,minus)

A=list(map(abs,A))
if zero==1 or minus%2==0:
  print(sum(A))
else:
  print(sum(A)-2*min(A))



Measured memory_bytes: 14332
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1000+10;
int main()
{
    int n,y;
    while(~scanf("%d%d",&n,&y)){
        bool flag=0;
        for(int i=0;i<=n;i++)
            for(int j=0;j+i<=n;j++){
                if(i*10000+j*5000+(n-i-j)*1000==y){
                    flag=1;
                    printf("%d %d %d\n",i,j,n-i-j);
                    goto end;
                }
            }
        end: {
            if(!flag) printf("-1 -1 -1\n");

        }
    }

    return 0;
}


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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

int main()
{
	ll n , m; 
	cin >> n >> m; 
	ll G = m / n ;
	for (int i = G ; i >= 1 ; i --){
		if( m % i == 0 ){
			cout << i << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>

using namespace std;

struct edge {
	int from, to, cost;
	edge ( void ) : from(0), to(0), cost(0) {}
	edge ( int f, int t, int c ) : from(f), to(t), cost(c) {}
	bool operator <( const edge &e ) const {
		return cost < e.cost;
	}
};
typedef vector<edge> VE;
typedef vector<VE> VVE;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef pair<int, int> PII;

const int INF = 1 << 29;
const int MAX_N = 100;
const int MAX_C = 20;

int f ( VI q, VI r, int z )
{
	if (q.size() <= 1 || z == INF) { return INF; }
	if (z == 0) { return 0; }
	int res = 0;
	for (int i = 1, I = q.size(); i < I; ++i) {
		if (z < q[i]) {
			res += (z - q[i-1]) * r[i-1];
			break;
		}
		res += (q[i] - q[i-1]) * r[i-1];
	}
	return res;
}

int solve ( int n, int m, int c, int s, int g )
{
	VVVI wE(c, VVI(n, VI(n, INF)));
	for (int i = 0; i < c; ++i) {
		for (int j = 0; j < n; ++j) {
			wE[i][j][j] = 0;
		}
	}
	for (int i = 0; i < m; ++i) {
		int x, y, d, c;
		cin >> x >> y >> d >> c;
		wE[c-1][x-1][y-1] = wE[c-1][y-1][x-1] = min(wE[c-1][y-1][x-1], d);
	}
	for (int l = 0; l < c; ++l) {
		for (int k = 0; k < n; ++k) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < n; ++j) {
					wE[l][i][j] = min(wE[l][i][j], wE[l][i][k] + wE[l][k][j]);
				}
			}
		}
	}
	VI p(c);
	VVI q(c), r(c);
	for (int i = 0; i < c; ++i) {
		cin >> p[i]; q[i] = VI(p[i]); r[i] = VI(p[i]);
		q[i][0] = 0;
	}
	for (int i = 0; i < c; ++i) {
		for (int j = 0; j+1 < p[i]; ++j) {
			cin >> q[i][j+1];
		}
		for (int j = 0; j < p[i]; ++j) {
			cin >> r[i][j];
		}
		q[i].push_back(INF);
	}
	VVE E(n);
	for (int k = 0; k < c; ++k) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (i == j || wE[k][i][j] == INF) { continue; }
				E[i].push_back(edge(i, j, f(q[k], r[k], wE[k][i][j])));
			}
		}
	}

	VI mincost(n, INF);
	priority_queue<PII, vector<PII>, greater<PII> > que;
	mincost[s-1] = 0;
	que.push(PII(0, s-1));
	while (!que.empty()) {
		PII pii = que.top(); que.pop();
		int v = pii.second;
		if (mincost[v] < pii.first) { continue; }
		for (int i = 0, I = E[v].size(); i < I; ++i) {
			edge e = E[v][i];
			if (mincost[e.to] > pii.first + e.cost) {
				mincost[e.to] = pii.first + e.cost;
				que.push(PII(mincost[e.to], e.to));
			}
		}
	}
	return (mincost[g-1] == INF ? -1 : mincost[g-1]);
}

int main ( void )
{
	int n, m, c, s, g;
	while (cin >> n >> m >> c >> s >> g, n|m|c|s|g) {
		cout << solve(n, m, c, s, g) << endl;
	}
	return 0;
}

Measured memory_bytes: 4640
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> v(n, k - q);
    while (q--)
    {
        ll a;
        cin >> a;
        v[a - 1]++;
    }
    for (ll e : v)
        cout << (e > 0 ? "Yes" : "No") << "\n";
    return 0;
}

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    } else if (a * b == 15) {
        cout << "*" << endl;
    } else {
        cout << "x" << endl;
    }

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ld long double
        #define int long long
        #define print(t) cout << "Case #" << t << ": ";

        int const INF = 1e15;
        int32_t main()
        {
            tani_nachi_ke  
            
            
            int dx[4] = {0,0,-1,1};
            int dy[4] = {1,-1,0,0};

            int n,m;
            cin >> n >> m;
            int a,b;
            cin >> a >> b;
            int c,d;
            cin >> c >> d;

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

            deque<pair<int,int>> q;
            int dp[n][m];
            for(int i = 0; i < n; i++)
            {
                for(int j = 0; j < m; j++)
                    dp[i][j] = INF;
            }
            dp[a-1][b-1] = 0;
            q.push_front({a-1,b-1});
            while(!q.empty())
            {
                auto u = q.front();
                q.pop_front();
                int x = u.ff;
                int y = u.ss;
                // cout << x << " " << y << " " << dp[x][y] << endl;

                if(x == c-1 && y == d-1)
                    break;
                for(int l = 0; l < 4; l++)
                {
                    int nx = dx[l] + x;
                    int ny = dy[l] + y;

                    if(nx < 0 || ny < 0 || nx >= n || ny >= m || s[nx][ny] == '#')
                        continue;

                    if(dp[nx][ny] > dp[x][y])
                    {
                        dp[nx][ny] = dp[x][y];
                        q.push_front({nx, ny});
                    }
                }

                for(int l:{-2,-1,0,1,2})
                {
                    for(int r:{-2,-1,0,1,2})
                    {
                        int nx = l + x;
                        int ny = r + y;
                        if(nx < 0 || ny < 0 || nx >= n || ny >= m || s[nx][ny] == '#')
                            continue;
                        if(dp[nx][ny] > dp[x][y] + 1)
                        {
                            dp[nx][ny] = dp[x][y] + 1;
                            q.push_back({nx, ny});
                        }
                    }
                }
            }

            int ans = dp[c-1][d-1];
            if(ans == INF)
                cout << -1 << endl;
            else 
                cout << ans << endl;
            // cout << dp[c-1][d-1] << endl;



           return 0;
        }
          

Measured memory_bytes: 12616