akhauriyash/Code-Regression huggingface dataset:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = [0]*(n+1)
    c = [0]*(n+1)
    d = [0]*(n+1)
    e = [0]*(n+1)
    cmb = lambda x: (x*(x-1))//2
    for ai in a:
        b[ai] += 1
    for i, bi in enumerate(b):
        if bi:
            c[i] = cmb(bi)
            d[i] = cmb(bi-1)
    ans = sum(c)
    for i, (ci, di) in enumerate(zip(c, d)):
        e[i] = ans-ci+di
    for ai in a:
        print(e[ai])

if __name__ == "__main__":
    main()

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

using namespace std;

int main(){
	int n;
	long long ans = 0;
	cin >> n;

	for(int i=1;i<=n;++i){
		if(i%3 != 0 && i%5 != 0)
			ans+=i;
	}

	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3628
/************************************************
 * Au: Hany01
 * Prob: cpp
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

template <typename T> inline T read() {
	static T _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
//EOT


const int maxn = 1e5 + 5, maxm = 2e5 + 5;

int n, ans[maxn], up[maxn], deg[maxn];

vector<int> G[maxn];
int beg[maxn], v[maxm], nex[maxm], e;
inline void add(int uu, int vv, int ty = 1) {
	v[++ e] = vv, nex[e] = beg[uu], beg[uu] = e;
	if (ty) add(vv, uu, 0);
}

void init(int u, int pa) {
	up[u] = 0;
	for (register int i = beg[u]; i; i = nex[i]) {
		if (v[i] != pa) {
			init(v[i], u), deg[u] ^= 1;
			if (up[u]) G[up[u]].PB(up[v[i]]), G[up[v[i]]].PB(up[u]), up[u] = 0;
			else up[u] = up[v[i]];
		}
	}
	if (!up[u]) up[u] = u;
	else ans[u]=-2;
}

void DFS(int u, int las) {
	ans[u] = -las;
	Rep(i, SZ(G[u]))
		if (!ans[G[u][i]]) DFS(G[u][i], -las);
}

int main()
{
#ifdef hany01
	freopen("cpp.in", "r", stdin);
	freopen("cpp.out", "w", stdout);
#endif

	int fa, rt;
	For(i, 1, n = read<int>()) if ((fa = read<int>()) > 0) add(fa, i); else rt = i;
	init(rt, 0), e = 1, Set(beg, 0);
	For(i, 1, n) if ((fa = read<int>()) > 0) add(fa, i); else rt = i;
	init(rt, 0);
	For(i, 1, n) if (deg[i]) return puts("IMPOSSIBLE"), 0;

	puts("POSSIBLE");
	For(i, 1, n) if (!ans[i]) DFS(i, 1);
	For(i, 1, n) printf("%d ", ans[i]==-2?0:ans[i]);

	return 0;
}

Measured memory_bytes: 12160
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
	class Program
	{
		static void Main(string[] args)
		{
			var S = Console.ReadLine();
			var T = Console.ReadLine();

			var flag = true;
			if(S.Length != T.Length - 1)
			{
				flag = false;
			}

			for(int i = 0;i < S.Length; i++)
			{
				if(S[i] != T[i])
				{
					flag = false;
				}
			}

			if (flag)
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}

		}
	}
}

Measured memory_bytes: 25680
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    string s;
    cin >> s;

    bool f = true;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 1) {
            if (s[i] == 'R') f = false;
        } else {
            if (s[i] == 'L') f = false;
        }
    }

    if (f) cout << "Yes" << "\n";
    else cout << "No" << "\n";

    return 0;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}


const int maxn = 1e5+5;
const int mod = 1e9+7;
int mult(int a,int b){return ((LL)a*(LL)b)%mod;}
int add(int a,int b){return ((LL)a + (LL)b)%mod;}

int fast_pow(int a,int b){
    if(b == 0) return 1;
    int res = fast_pow(a,b/2);
    res = mult(res,res);
    if(b&1) res = mult(res,a);

    return (int)res;
}


int N,M,K;

LL fac[maxn*2];

void init(){
    fac[0] = 1;
    _for(i,1,maxn*2){
        fac[i] = mult(fac[i-1],i);
    }
}

int com(int a,int b){
    if(a <= 0 || b <= 0 || a-b <= 0) return 1;
    int k = fac[a];
    int k2 = mult(fast_pow(fac[a-b],mod-2),fast_pow(fac[b],mod-2));
    return mult(k,k2);
}



int main()
{
    init();
    cin >> N >> M >> K;
    int res = 0;

    int k1 = com(M*N-2,K-2);
    //cout << k1 << endl;
    int MM = mult(M,M);
    int NN = mult(N,N);

    _for(d,1,N){
        res = add(res,mult(d,mult(k1,mult(N-d,MM))));
    }
    _for(d,1,M){
        res = add(res,mult(d,mult(k1,mult(M-d,NN))));
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define INT INT_MAX
#define LONG LLONG_MAX
#define f(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
typedef long long ll;
using namespace std;

ll GCD(ll a, ll b) {
	if (b == 0)return a;
	return GCD(b, a%b);
}

ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}

ll mypow(ll a, ll b, ll c) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1, c)*a%c;
	else return mypow(a, b / 2, c)*mypow(a, b / 2, c) % c;
}

signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max({a,b,c})*9+a+b+c<<endl;
	return 0;
}


Measured memory_bytes: 764
#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); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  int res = 1001001001;
  if(x <= y){
    chmin(res, c * y * 2);
    chmin(res, c * x * 2 + b * (y-x));
    chmin(res, a * x + b * y);
  }
  if(x > y){
    chmin(res, c * x * 2);
    chmin(res, c * y * 2 + a * (x-y));
    chmin(res, a * x + b * y);
  }

  cout << res << endl;

  return 0;
}


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

int main()
{
	int a[5];

	for(int i=0; i<5; i++)
	{
		scanf("%d",& a[i]);
	}

	sort(a,a+5,greater<int>());

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

	return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String X = sc.next();
    char[]x = X.toCharArray();
    String Y = sc.next();
    char[]y = Y.toCharArray();
    
    if(x[0]+0 > y[0]+0) {
    	System.out.println(">");
    }else if(x[0]+0 < y[0]+0) {
   	 	System.out.println("<");
    }else {
    	System.out.println("=");
    }
}
    }

Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
int a[10010];

int main()
{
    cin >> N;
    
    rep2(i,1,N/3)rep2(j,1,N/3)rep2(k,1,N/3)
    {
        A = i*(i+j);
        B = j*(j+k);
        C = k*(k+i);

        A += B+C;
        if(A<=10000)a[A]++;
        else break;
    }
    rep2(i,1,N+1)
    {
        cout << a[i]<< endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B,L;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MOD = 998244353;
const ll MAX_M = 1<<17;
typedef pair<ll,ll> P;
vec seg(MAX_M<<1,-1);//1-indexedのセグ木

void calc(ll i){
    ll temp = i + MAX_M;
    while(temp > 1){
        temp >>= 1;
        seg[temp] = max(seg[temp<<1],seg[(temp<<1)+1]);
    }
}

void init(){
    rep(i,M) seg[MAX_M+i] = i;
    rep(i,MAX_M) calc(i);
}

void fill(ll i){
    seg[MAX_M+i] = -1;
    calc(i);
}

// index = 1, l = 0, r = MAX_M, i = M - A
// [l,r)での最大値がfindの返り値
// [0,i] の max を求める
ll find(ll index, ll l, ll r, ll i){
    if(l > i) return -1;
    if(r <= i + 1) return seg[index];
    return max(find(index<<1, l, (l+r)/2, i),
               find((index<<1)+1, (l+r)/2, r, i));
}

int main() {
    cin>>N>>M;
    vector<P> alb(N);
    rep(i,N){
        cin>>A>>B;
        alb[i] = {B,A};
    }
    sort(alb.begin(),alb.end());
    reverse(alb.begin(),alb.end());

    init();
    ll ans = 0;
    rep(i,N){
        P p = alb[i];
        ll date = find(1, 0, MAX_M, M - p.se);
        if(date == -1) continue;
        fill(date);
        ans += p.fi;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        int n;
        cin >> n;
        cout << (1000-n%1000)%1000 << endl;
    }
}

Measured memory_bytes: 3640
import std.stdio;
import std.conv;
import std.string;
import std.math;

void main() {

    ulong[] input = readln.split.to!(ulong[]);
    ulong n = input[0];
    ulong m = input[1];
    ulong d = input[2];

    ulong c = (n - d) * (d == 0 ? 1 : 2);

    double ans = c.to!double * (m - 1)/ n / n;
    writeln(format("%.10f", ans));
}

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

int main(){
    int n;
    cin >> n;
    string s[n];
    map<string, int> m;
    rep(i,n){
        cin >> s[i];
        m[s[i]] = 0;
    }
    rep(i,n){
        m[s[i]]++;
        if(s[i][s[i].size()-1] != s[i+1][0] && i+1 != n){
            cout << "No" << endl;
            return 0;
        }
    }
    for(auto x:m){
        if(x.second >= 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int ans = 1000 - n%1000;
    if(ans == 1000){
        dunk(0);
    }
    else{
        dunk(ans);
    }
    return 0;
}

Measured memory_bytes: 3592
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a > 8 || b > 8) {
			System.out.print(":(");
		}else {
			System.out.print("Yay!");
		}
	}
}


Measured memory_bytes: 21204
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    vector<long> a(n);
    vector<ll> s(n+1);
    s[0]=0;
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
        s[i+1]=s[i]+a[i];
    }

    ll min = LINF;
    for(i=1; i<n; i++) {
        ll val = abs(s[n]-s[i]*2);
        if(min>val) {
            min=val;
        }
    }

    printf("%lld\n", min);

    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        boolean[] a = new boolean[n+1];
        for (int i = 0; i < m; i++) {
            int tmp = sc.nextInt();
            a[tmp] = true;
        }

        long[] ans = new long[n+1];
        ans[0] = 1;
        for (int i = 0; i <= n; i++) {
            ans[i] = ans[i] % 1000000007;
            if (i+2 <= n && !a[i+2]) ans[i+2] += ans[i];
            if (i+1 <= n && !a[i+1]) ans[i+1] += ans[i];
        }

        System.out.println(ans[n]);
    }
}

Measured memory_bytes: 47476
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,count=0;
    int l[1100],r[1100];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> l[i] >> r[i];
    }
    for(int i=0;i<N;i++){
        count += r[i] - l[i]+1;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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



int main(){
    ll n;
    string s,t;
    cin >> n >> s >> t;
    string ans[2*n];
    REP(i,n){
        ans[2*i] = s[i];
        ans[2*i+1] = t[i];
    }
    REP(i,2*n){
        cout << ans[i];
    }
    cout << ' ' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char ch;
int a[5],s;
int main(){
	for(int i=1;i<=4;i++){
		cin>>ch;
		a[i]=ch-'0';
	}
	for(int i=1;i<=2;i++)
		for(int j=1;j<=2;j++)
			for(int k=1;k<=2;k++){
				s=a[1]+pow(-1,i)*a[2]+pow(-1,j)*a[3]+pow(-1,k)*a[4];
				if(s==7){
					cout<<a[1];
					if(i==1)cout<<'-';else cout<<'+'; 
					cout<<a[2];
					if(j==1)cout<<'-';else cout<<'+';
					cout<<a[3];
					if(k==1)cout<<'-';else cout<<'+';
					cout<<a[4];
					cout<<"=7"<<endl;
					return 0;
				}
			}
		
	
}

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

int main(void) {

	int N, X;
	vector<int> m;

	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		int a; cin >> a; m.push_back(a); X -= a;
	}

	int MM = *min_element(m.begin(), m.end());

	cout << (X / MM) + N;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    char ope[2]={'+','-'};
    int n,num[4];
    cin >> n;
    int k=10;
    for(int i=0;i<4;i++){
        num[i]=(n%k)/(k/10);
        k*=10;
    } 
    if(num[3]+num[2]+num[1]+num[0]==7){
        printf("%d+%d+%d+%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]+num[2]+num[1]-num[0]==7){
        printf("%d+%d+%d-%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]+num[2]-num[1]+num[0]==7){
        printf("%d+%d-%d+%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]+num[2]-num[1]-num[0]==7){
        printf("%d+%d-%d-%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]-num[2]+num[1]+num[0]==7){
        printf("%d-%d+%d+%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]-num[2]+num[1]-num[0]==7){
        printf("%d-%d+%d-%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]-num[2]-num[1]+num[0]==7){
        printf("%d-%d-%d+%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }else if(num[3]-num[2]-num[1]-num[0]==7){
        printf("%d-%d-%d-%d=7\n",num[3],num[2],num[1],num[0]); 
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
    
public class Main{

static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int[][] num=new int[201][3];
static int[] point=new int[201];

public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
int n=ir.nextInt();
for(int i=0;i<n;i++) num[i]=ir.toIntArray(3);
HashMap<Integer,Integer> map=new HashMap<Integer,Integer>();
for(int i=0;i<3;i++){
for(int j=0;j<n;j++){
if(!map.containsKey(num[j][i])) map.put(num[j][i],1);
else map.put(num[j][i],map.get(num[j][i])+1);
}
for(int j=0;j<n;j++) if(map.get(num[j][i])==1) point[j]+=num[j][i];
map.clear();
}
for(int i=0;i<n;i++) out.println(point[i]);
out.flush();
}

static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;

public InputReader(InputStream in) {this.in=in;}
  
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}

public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}

private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}

public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
 
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}

public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}

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

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

int main()
{
	int n=0;
	vector<int>a;

while(cin>>n)
{

if(n==0)
	{
		cout<<a.back()<<endl;
		a.pop_back();
	}
	else
	{
		a.push_back(n);
	}
	
}

	
return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    int d, n;
    cin >> d >> n;

    if(n==100) ++n;

    cout << n;
    rep(_, d) cout << "00";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int cnt[10][10];
int s;
int d[10];
int main(){
  int i;
  int k;
  int res = 0;
  rd(N);
  for(i=(1);i<(N+1);i++){
    s = 0;
    k = i;
    while(k){
      d[s++] = k % 10;
      k /= 10;
    }
    cnt[d[0]][d[s-1]]++;
  }
  for(i=(0);i<(10);i++){
    int j;
    for(j=(0);j<(10);j++){
      res += cnt[i][j] * cnt[j][i];
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// int N;
// int cnt[10][10];
// int s, d[10];
// {
//   int k, res = 0;
//   rd(N);
//   rep(i,1,N+1){
//     s = 0;
//     k = i;
//     while(k){
//       d[s++] = k % 10;
//       k /= 10;
//     }
//     cnt[d[0]][d[s-1]]++;
//   }
//   rep(i,10) rep(j,10) res += cnt[i][j] * cnt[j][i];
//   wt(res);
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mod=1000000007;
int r[4005],g[4005],b[4005];
int main(){
	ios;
	int n,i,j,l;
	ll ans=0;
	string s;
	cin>>n>>s;
	l=s.length();
	r[l]=0,g[l]=0,b[l]=0;
	for(i=l-1;i>-1;i--)
	{
		r[i]=r[i+1]; g[i]=g[i+1]; b[i]=b[i+1];
		if(s[i]=='R') r[i]++;
		else if(s[i]=='G') g[i]++;
		else b[i]++;
	}
//	cout<<r[0]<<b[0]<<g[0];
	for(i=0;i<l;i++)
	{
		for(j=i+1;j<l;j++)
		{
			if(s[i]!=s[j])
			{
				if((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R'))
				{
						ans+=b[j+1];
						if(2*j-i<l && s[j-i+j]=='B') ans--;
				}
				else if((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G'))
				{
						ans+=r[j+1];
						if(2*j-i<l && s[j-i+j]=='R') ans--;
				}
				else
				{
						ans+=g[j+1];
						if(2*j-i<l && s[j-i+j]=='G') ans--;
				}
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
 
using namespace std;
 
#define LL long long 
#define ULL unsigned long long 
#define LD long double 

LL euklides(LL a, LL b) {
	while(b!=0) {
		LL c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int t[n];
	if(n==1) {
		cin>>t[0];
		cout<<t[0];
		return 0;
	}
	cin>>t[0]>>t[1];
	LL nwd = euklides(t[0], t[1]);
	LL il = t[0] * t[1];
	LL nww = il / nwd;
	for(int i=2; i<n; i++) {
		cin>>t[i];
		nwd = euklides(nww, t[i]);
		il = nww * t[i];
		nww = il / nwd;
	}
	LL suma = 0;
	LL mianownik = nww;
	for(int i=0; i<n; i++) {
		LL x = nww / t[i];
		suma+=x;
	}
	LD w = (LD) mianownik / (LD) suma;
	cout<<setprecision(10)<<w;
}


Measured memory_bytes: 256
import sys #辞書型
cnts = {} #空の辞書
for line in sys.stdin:
    for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1
    #入力をラインごとに全て小文字に変換した後に、文字毎に分解して、辞書に入れています
  
for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))


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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

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

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 500500;

char S[MAX];

string st;

int res = 0;

int DP[MAX][2][2];

void _MAX(int& a, int x)
{
	a = max(a, x);
}

void solve(string& s)
{
	while(SZ(s) && s[SZ(s) - 1] == '0') s.erase(s.end() - 1);
	if (s.empty()) return;

	s += '0';

	VI a;
	int cnt = 0;
	FOR (i, 0, SZ(s))
	{
		if (s[i] == '1') cnt++;
		else
		{
			a.PB(cnt);
			cnt = 0;
		}
	}

	FOR (i, 0, SZ(a) + 1)
	{
		DP[i][0][0] = DP[i][0][1] = -INF;
		DP[i][1][0] = DP[i][1][1] = -INF;
	}

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

	FOR (i, 0, SZ(a))
	{
		FOR (j, 0, 2)
		{
			FOR (k, 0, 2)
			{
				if (DP[i][j][k] == -INF) continue;
				int nj, nk;

				if (k && a[i] == 1) nj = 0;
				else nj = 1;
				nk = 0;

				_MAX(DP[i+1][nj][nk], DP[i][j][k]);

				if (j == 1 && k == 0)
				{
					nj = 0;
					nk = 0;
					_MAX(DP[i+1][nj][nk], DP[i][j][k] + a[i]);

					if (a[i] > 1)
					{
						nj = 1;
						nk = 0;
						_MAX(DP[i+1][nj][nk], DP[i][j][k] + a[i] - 1);
					}
				}

				if (a[i] > 1 || k == 0)
				{
					nj = 0;
					nk = 1;
					int cnt = a[i];
					if (k) cnt--;

					_MAX(DP[i+1][nj][nk], DP[i][j][k] + cnt);
				}
			}
		}
	}

	int mx = -INF;
	mx = max(mx, DP[SZ(a)][0][0]);
	mx = max(mx, DP[SZ(a)][1][0]);

	res += mx;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n;
	scanf("%d", &n);
	scanf("%s", S);

	string s;

	FOR (i, 0, n)
	{
		s += S[i];
		if (s == "0")
		{
			s.clear();
		}

		if (SZ(s) >= 2)
		{
			if (s[SZ(s) - 1] == '0' && s[SZ(s) - 2] == '0')
			{
				solve(s);
				s.clear();
			}
		}
	}

	solve(s);

	cout<<res<<endl;
}


Measured memory_bytes: 3076
var
	llc,lltc,lc,ltc,tc,c,n,i:longint;
			
begin
	readln(n);
	read(llc);
	read(lc);
    lltc := 0;
	ltc := abs(llc - lc);
	for i := 3 to n do
	begin
		read(c);
        tc := lltc + abs(c - llc);
		if ltc + abs(c - lc) < tc then
        	tc := ltc + abs(c - lc);
		lltc := ltc;
		llc := lc;
		ltc := tc;
		lc := c;
	end;
	writeln(ltc);
end.


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

a_even = list(filter(lambda x: x % 2 == 0, a))
rtn = all(map(lambda x: x % 3 == 0 or x % 5 == 0, a_even))

if rtn:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
n = int(input())
alst = list(map(int, input().split()))
blst = list(map(int, input().split()))
k = sum(blst) - sum(alst)
cnt = 0
for a, b in zip(alst, blst):
    cnt += max(0, (b - a + 1) // 2)
if cnt <= k:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 10436
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;


int main(void){
	lld n,a,b;
	cin >> n >> a >> b;
	lld ans = 0;
	ans += (n/(a+b))*a;
	ans += min(a,(n%(a+b)));
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main(){
    long long int h, n, k, i, j;
    vector<long long int> v;
    long long int u[200000];
    
    cin >> n >> k;
    
    for(i = 0; i < n; i++){
        cin >> h;
        v.push_back(h);
    }

    for(i = 0; i < n; i++){
        u[i] = 1000000000;
    }
    
    u[0] = 0;
    
    for(i = 0; i < n; i++){
        for(j=1; j <= k; j++){
            u[i+j] = min(u[i+j], u[i] + abs(v[i] - v[i+j]));
        }
    }
    
    cout << u[n-1] << endl;
}


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

using namespace std;

static const int N = 1000;

int lcs(string X, string Y) {
  int c[N + 1][N + 1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for (int i = 0; i <= m; i++) {
    c[i][0] = 0;
  }
  for (int j = 1; j <= n; j++) {
    c[0][j] = 0;
  }

  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (X[i] == Y[j]) {
        c[i][j] = c[i - 1][j - 1] + 1;
      } else {
        c[i][j] = max(c[i - 1][j], c[i][j - 1]);
      }
      maxl = max(maxl, c[i][j]);
    }
  }

  return maxl;
}

int main() {
  string s1, s2;
  int n;

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s1 >> s2;
    cout << lcs(s1, s2) << endl;
  }

  return 0;
}



Measured memory_bytes: 7096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
#define N 100010
int main(){
    int n,a,b;cin>>n>>a>>b;
    string s;cin>>s;
    int total = 0, vtotal = 0;
    rep(i,s.size()){
        if(s[i]=='c')co("No");
        if(s[i]=='a'){
            if(total<a+b){co("Yes");total++;}else co("No");
        }
        if(s[i]=='b'){
            if(total<a+b&&vtotal<b){co("Yes");total++;vtotal++;}else co("No");
        }
    }
}

Measured memory_bytes: 896
def main36():
    data = input().split()
    num = []
    for i in range(2):
        num.append(int(data[i]))
    if int(abs(num[0]-num[1])) % 2 == 1:
        print("IMPOSSIBLE")
        return
    result = int(abs(num[0] + num[1]) / 2)
    print(result)
 
if __name__ == "__main__":
    main36()

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

import org.omg.CORBA.PUBLIC_MEMBER;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;

		int n = Integer.parseInt(reader.readLine());
		for (int i = 0; i < n; i++) {
			String s1 = reader.readLine();
			String s2 = reader.readLine();
			if (s1.length() > 80 && s2.length() > 80) {
				System.out.println("overflow");
			} else {
				BigInteger b1 = new BigInteger(s1);
				BigInteger b2 = new BigInteger(s2);
				String b = String.valueOf(b1.add(b2));
				System.out.println(b.length() > 80 ? "overflow" : b);
			}
		}
	}

}

Measured memory_bytes: 18464
#include<iostream>
#include<cstdio>
#include<set>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<string>
#include<vector>
#include<queue>
#define MAX_N 100010
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 100000005
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;
typedef long long int ll;
typedef pair<int,int> PI;

int N;
ll allsum=0;
ll A[MAX_N*2],sum[MAX_N*2];


bool check(ll shrt){
    int c1,c2,c3;
    for(c1=0;c1<N;c1++){
        c2=(int)(lower_bound(sum,sum+2*N+1,sum[c1]+shrt)-sum);
        if(c2>c1+N)
            continue;
        c3=(int)(lower_bound(sum,sum+2*N+1,sum[c2]+shrt)-sum);
        if(c3>c1+N)
            continue;
        if(allsum-(sum[c3]-sum[c1])>=shrt){
            return true;
        }
    }
    return false;
}

int main(){
    cin>>N;
    rep(i,N){
        cin>>A[i];
        allsum+=A[i];
        A[i+N]=A[i];
    }
    sum[0]=0;
    rep(i,2*N){
        sum[i+1]=sum[i]+A[i];
    }
    ll left = 0,right = allsum+1;
    while(right-left>1){
        ll mid = (right+left)/2;
        if(check(mid)){left=mid;}
        else{right=mid;}
    }
    cout<<left<<endl;
    return 0;
}

Measured memory_bytes: 4288
import sys

S = input()
T = input()
lenS = len(S)
lenT = len(T)
ans = ""
for i in range(lenS-lenT,-1,-1):
    for j in range(lenT):
        if S[i+j]!=T[j] and S[i+j]!="?":
            break
    else:
        ans = S[:i]+T+S[i+lenT:]
        ans = ans.replace("?","a")
        print(ans)
        sys.exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
import {isNumber} from "util";

function Main(input: string) {
  const lines: string[] = input.split('\n');
  const params1 = lines[0].split(' ');

  const n = parseInt(params1[0]);
  const m = parseInt(params1[1]);
  const p = lines.slice(1, m + 1).map(x => x.split(' ')[0]).map(x => parseInt(x));
  const s = lines.slice(1, m + 1).map(x => x.split(' ')[1]);

  let subject: { [n: number]: number } = {};
  let accepted = new Set();
  let accept = 0;
  let penalty = 0;
  for (let i = 0; i < m; i++) {
    if (typeof subject[p[i]] !== 'number') subject[p[i]] = 0;
    if (!accepted.has(p[i]) && s[i] === 'AC') {
      accept++;
      penalty += subject[p[i]];
      accepted.add(p[i]);
    }
    subject[p[i]]++;
  }
  console.log(`${accept} ${penalty}`);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll n,x,y,z;
	cin>>n;
	ll ans[10010]={0};
	for(x=1;x<=100;x++)
	{
		for(y=1;y<=100;y++)
		{
			for(z=1;z<=100;z++)
			{
				if(x*x+y*y+z*z+x*y+y*z+x*z<=n)
					ans[x*x+y*y+z*z+x*y+y*z+x*z]++;
			}
		}
	}
	for(x=1;x<=n;x++)
		cout<<ans[x]<<endl;
    return 0;
}





Measured memory_bytes: 3616
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n,m = get_nums_l()
nums = get_nums_l()

nums.sort()
kaisa = [0] * (m-1)

for i in range(m-1):
    kaisa[i] = nums[i+1] - nums[i]

kaisa.sort(reverse=True)

print(sum(kaisa[n-1:]))

Measured memory_bytes: 51752
def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]

s = input()
ls = len(s)
dp = ary(ls + 1, 4, 0)
dp[0][0] = 1
mod = 10 ** 9 + 7

for i in range(1, ls + 1):
    for j in range(4):
        #'?'のとき'ABC'の3通りに分岐させ、いずれも取らないので3倍
        dp[i][j] += dp[i - 1][j] * (3 if s[i - 1] == '?' else 1)

       #ほしい文字に変えた場合　または　ほしい文字の場合で取ったとき
        if j > 0:
            if s[i - 1] == '?' or s[i - 1] == 'ABC'[j - 1]:
                dp[i][j] += dp[i - 1][j - 1]
        dp[i][j] %= mod
print(dp[ls][3])

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int t = a-b;
	if(t>=c) {
		cout << '0' << endl;
	}
	else {
		cout << c-t << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import javax.management.monitor.CounterMonitor;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        int answer=0;
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //
        Output o1=new Output();
        Euclid e1=new Euclid();
        Compute c1=new Compute();

        //入力
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();


        //処理
        answer=n-k+1;
        //出力
        System.out.println(answer);
    }
}

class Output
{
    //answerの出力
    void Ans(int ans)
    {
        System.out.println(ans);
    }

    void Ans(double ans)
    {
        System.out.println(ans);
    }

    void Ans(String ans)
    {
        System.out.println(ans);
    }

    //配列の出力
    void OutputArray(int array[])
    {
        System.out.println(Arrays.toString(array));
    }

    void OutputArray(double array[])
    {
        System.out.println(Arrays.toString(array));
    }

    void OutputArray(String array[])
    {
        System.out.println(Arrays.toString(array));
    }
    //二次元配列の出力
    void OutputDeepArray(int array[][])
    {
        System.out.println(Arrays.deepToString(array));
    }

    void OutputDeepArray(double array[][])
    {
        System.out.println(Arrays.deepToString(array));
    }

    void OutputDeepArray(String array[][])
    {
        System.out.println(Arrays.deepToString(array));
    }
    //listの出力
    void OutputIntList(List <Integer> list)
    {
        System.out.println(Arrays.toString(list.toArray()));
    }

    void OutputDoubleList(List <Double> list)
    {
        System.out.println(Arrays.toString(list.toArray()));
    }

    void OutputSList(List <String> list)
    {
        System.out.println(Arrays.toString(list.toArray()));
    }
}

class Euclid
{
    public static int gcd(int x,int y)//ユークリッドの互除法を使って2値の最大公約数を求める
    {
        int tmp;
        if(x<y)
        {
            tmp=x;
            x=y;
            y=tmp;
        }
        if(x==0)//(x or y)=0の時は0でない時の値を返す
        {
            return y;
        }else if(y==0)
        {
            return x;
        }else
        {
            while ((tmp = x % y) != 0)
            {
                x = y;
                y = tmp;
            }
            return y;
        }
    }
}

class Compute
{
    int cumulativeSum(int A[],int k)//kの大きさごとに配列Aを切り取ってその区間内の数を足した時の最大値をreturn
    {
        int ans=0;
        //累積和表を作成
        int B[]=new int[A.length+1];//累積和に使う配列
        B[0]=0;
        for(int i=1;i<B.length;i++)
        {
            B[i]=B[i-1]+A[i-1];
        }

        //最大値を求める
        int tmp=0;
        ans=B[k]-B[0];
        for(int i=1;i<A.length-k;i++)
        {
            tmp=B[i+k]-B[i];
            if(tmp>ans)
            {
                ans=tmp;
            }
        }
        System.out.println(Arrays.toString(B));
        return ans;
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9 + 7;
LL const MaxSize = 300 + 5;
//LL const MOD = 998244353;

/*

 #https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d
 D - Lucky PIN

 Easy problem, but python version gives TLE in the last two cases
 */

int H, W, K;
string s[MaxSize];
int ans[MaxSize][MaxSize];
int nb;

void par(int rs, int re) {
	vector<int> cs;
	LP(c, 0, W)
	{
		LP(i, rs, re)
		{
			if (s[i][c] == '#') {
				cs.push_back(c);
				break;
			}
		}
	}

	LP(ci, 0, cs.size())
	{
		int colS = ci == 0 ? 0 : cs[ci];
		int colE = ci == cs.size() - 1 ? W : cs[ci + 1];

		nb++;
		LP(r, rs, re)
		{
			LP(c, colS, colE)
			{
				ans[r][c] = nb;
			}
		}
	}

}

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/A_1.in", "r", stdin);

	cin >> H >> W >> K;
	vector<int> sr;
	LP(i, 0, H)
	{
		cin >> s[i];
		if (s[i].find('#') == string::npos)
			continue;

		sr.push_back(i);
	}
	nb = 0;


	LP(i, 0, sr.size())
	{
		int bStart = i == 0 ? 0 : sr[i];
		int bEnd = i == sr.size() - 1 ? H : sr[i + 1];

//		cout << bStart << " " << bEnd << endl;
		par(bStart, bEnd);
	}


	LP(i, 0, H)
	{
		LP(j, 0, W)
		{
			cout << ans[i][j];
			if (j == W - 1)
				cout << endl;
			else
				cout << " ";
		}
	}

	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()

using namespace std;

int main() {
    nl // youtu.be/QosiU0JR_h8  
    string s;
    cin >> s;
    int cnt = 0;
    for(int i=0; i<s.size(); ++i) {
        if(s[i] == '1') cnt++;
    }
    cout << cnt;
    return 0;  
}

Measured memory_bytes: 3532
lst = []
s = sorted(list(input()))
lst.append(s)
t = sorted(list(input()),reverse=True)
lst.append(t)
lst.sort()
if lst[0] == lst[1]:
  answer = "No"
elif lst[0] == s:
  answer = "Yes"
else:
  answer = "No"
print(answer)

Measured memory_bytes: 3060
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

    public void Proc()
    {
        Dice d = new Dice(Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray());
        d.Move(Reader.ReadLine());
        Console.WriteLine(d.GetTopNum());
    }

    private class Dice {
        DiceState state = new DiceState(1, 2, 3);
        public int[] Label;
        public Dice(int[] label) {
            this.Label = label;
        }
        public int GetTopNum() {
            return this.Label[this.state.Top - 1];
        }
        public void Move(String str) {
            foreach(char c in str) {
                if(c == 'N') {
                    this.state = this.Move(this.state, MoveDir.N);
                } else if(c == 'S') {
                    this.state = this.Move(this.state, MoveDir.S);
                } else if( c== 'E') {
                    this.state = this.Move(this.state, MoveDir.E);
                } else {
                    this.state = this.Move(this.state, MoveDir.W);
				}
            }
        }

		private DiceState Move(DiceState current, MoveDir md)
		{
			DiceState ret = new DiceState(current.Top, current.Front, current.Rigt);
			if (md == MoveDir.N)
			{
				ret.Top = current.Front;
				ret.Front = 7 - current.Top;
			}
			if (md == MoveDir.S)
			{
				ret.Top = 7 - current.Front;
				ret.Front = current.Top;
			}
			if (md == MoveDir.E)
			{
				ret.Top = 7 - current.Rigt;
				ret.Rigt = current.Top;
			}
            if (md == MoveDir.W)
			{
				ret.Top = current.Rigt;
				ret.Rigt = 7 - current.Top;
			}
			return ret;
		}


	}


    private struct DiceState {
        public int Top;
        public int Front;
        public int Rigt;
        public DiceState(int t, int f, int r) {
            this.Top = t;
            this.Front = f;
            this.Rigt = r;
        }
    }

    enum MoveDir {
        N,
        S,
        E,
        W
    }

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"





1 2 4 8 16 32
SE


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 9492
#include<stdio.h>
#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 <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
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();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//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 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())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//chmaxs chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}



vector<LL> divisor(LL n) {
  vector< LL> ret;
  for(LL i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
void solve(long long N, long long M){
    LL ans=0;
    vector<LL> divs=divisor(M);
    for(auto d : divs){
        if(d*N<=M)ans=max(ans, d);
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256