akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private static long MOD = 1_000_000_007;

    private void solve(Scanner sc) {
        int N = sc.nextInt();

        long p = 1;
        for (int i = 0; i < N; ++i) {
            p = (p * (i + 1) % MOD);
        }

        _out.println(p);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 21844
#include <stdio.h>

int main(void){

	int i,n,a,b,c;int d[3];

	scanf("%d",&n);

	for(i=0;i<n;i++){
		int t=0;
		scanf("%d%d%d",&a,&b,&c);
		d[0]=a*a;
		d[1]=b*b;
		d[2]=c*c;

		if(d[0]==d[1]+d[2])
			t++;
		if(d[1]==d[0]+d[2])
			t++;
		if(d[2]==d[0]+d[1])
			t++;
		if(t!=0)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;


signed main(){
  
  int N;
  cin >> N;
  
  int ans = 0;
  for( int i = 1; i <= sqrt(N); i++ ){
    if( N%i == 0 ){
      int A = N/i-1;
      if( A == 0 ) continue;
      int B = N/A;
      if( B == N%A ) ans += A;
      if( i == 1 || i == N/i ) continue;
      A = i-1;
      B = N/A;
      if( B == N%A ) ans += A;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <tuple>
#include <assert.h>

#define sqr(x) std::pow(x, 2.0)
#define INF 1e10
#define EPS 1e-10
#define REP(i, n) for (int i = 0; i < n; i++)
#define POS_OR_INF(x) (x > 0 ? x : INF)

using namespace std;

using ld = long double;

struct Point {
	Point() = default;
	Point(ld x, ld y): x(x), y(y) {}
	Point(const Point& s, const Point& e) : x(e.x-s.x), y(e.y-s.y) {}

	Point normalized(void) const {
		return Point(x / norm(), y / norm());
	}

	ld norm(void) const {
		return sqrt(x * x + y * y);
	}

	Point flipped(void) const {
		return Point(-x, -y);
	}

	Point normal_vector(bool normalize = false) const {
		auto vec = Point(-y, x);
		return normalize ? vec.normalized() : vec;
	}

	ld x, y;
};

using Vector = Point;

inline Vector points2vec(const Point& s, const Point& e) {
	return Vector(e.x - s.x, e.y - s.y);
}

inline ld distance(const Point& s, const Point& e) {
	return points2vec(s, e).norm();
}

inline ld distance_square(const Point& s, const Point& e) {
	return pow(points2vec(s, e).norm(), 2.0);
}

inline Vector operator * (const Vector& l, ld r) {
	return Vector(l.x * r, l.y * r);
}

inline Vector operator * (ld l, const Vector& r) {
	return r * l;
}

inline Vector operator / (const Vector& l, ld r) {
	return Vector(l.x / r, l.y / r);
}

inline Point operator + (const Point& l, const Point& r) {
	return Point(l.x + r.x, l.y + r.y);
}

inline Point operator - (const Point& l, const Point& r) {
	return Point(l.x - r.x, l.y - r.y);
}

inline istream& operator >> (istream& is, Point& p) {
	return is >> p.x >> p.y;
}

int main(int argc, char** argv) {
	int N;

	while (cin >> N && N > 0) {
		vector<Point> p(N);

		REP(i, N)
			cin >> p[i];

		long ans = 1;

		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				if (distance(p[i], p[j]) > 2.0) continue;

				auto mid = (p[i] + p[j]) / 2;
				auto l = sqrt(4 - distance_square(p[i], p[j])) / 2;
				auto normal = Vector(p[i], p[j]).normal_vector(true);

				auto center1 = mid + normal * l;
				auto center2 = mid - normal * l;

				long n1 = count_if(p.begin(), p.end(), [&](const Point& p) { return distance(center1, p) <= 1.0 + EPS; });
				long n2 = count_if(p.begin(), p.end(), [&](const Point& p) { return distance(center2, p) <= 1.0 + EPS; });

				ans = max(ans, max(n1, n2));
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3164
#include <iostream>
#include <bitset>

using namespace std;

int main(){
  int ans[21][11][156] = {0};
  int n, k, s;
  
  for(int i=1; i<(1<<20); i++){
    bitset<20> foo(i);
    if(foo.count() <= 10){
      int sum = 0;
      for(int j=0; j<20; j++)
	if(foo[j]==1)
	  sum+=(j+1);
      if(sum <= 155){
	int j = 19;
	while(foo[j] != 1)
	  j--;
	while(j<20){
	  ans[j+1][foo.count()][sum]++;
	  j++;
	}
      }
    }
  }
  
  while(cin >> n >> k >> s && n)
    cout << ans[n][k][s] << endl;   
  
  return 0;
}

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

signed main(){
    int N;cin>>N;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];
    long long ans=LLONG_MAX;
    int sig[2]={1,-1};
    REP(j,2){ 
        long long sum=0;
        long long count=0;
        REP(i,N){
            sum+=A[i];
            if(i%2==0&&sig[j]*sum<=0){
                count+=llabs(sum)+1;
                sum=sig[j]*1;
            }
            if(i%2==1&&sig[j]*sum>=0){
                count+=llabs(sum)+1;
                sum=-1*sig[j];
            }
        }
        ans=min(ans,count);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
N,K=map(int,input().split())
A=[]
for i in range(K):
    di=int(input())
    Ai=list(map(int,input().split()))
    A.extend(Ai)
L=list(range(1,N+1))
count=0
for i in L:
    if A.count(i)==0:
        count=count+1
    else:
        continue
print(count)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#include <functional>
using namespace std;
using ll = long long;

int main()
{
	ll n, k;
	cin >> n >> k;
	if (k == 1)
	{
		ll ans = -1e10;
		for (int i = 0; i < n; i++)
		{
			ll x;
			cin >> x;
			ans = max(ans, x);
		}
		cout << ans << endl;
		return 0;
	}
	const ll MOD = 1e9 + 7;
	if (n == k)
	{
		ll ans = 1;
		for (int i = 0; i < n; i++)
		{
			ll x;
			cin >> x;
			ans *= x;
			ans %= MOD;
		}
		cout << (ans + MOD) % MOD << endl;
		return 0;
	}
	priority_queue<ll> ppq;
	priority_queue<ll, vector<ll>, greater<ll>> npq;
	vector<ll> a(n);
	bool alln = true;
	for (int i = 0; i < n; i++)
	{
		ll x;
		cin >> x;
		if (x >= 0) ppq.emplace(x);
		if (x < 0) npq.emplace(x);
		a[i] = x;
		if (x > 0) alln = false;
	}
	if (alln)
	{
		if (k % 2)
			sort(a.rbegin(), a.rend());
		else
			sort(a.begin(), a.end());
		ll ans = 1;
		for (int i = 0; i < k; i++)
		{
			ans *= a[i];
			ans %= MOD;
		}
		cout << (ans + MOD) % MOD << endl;
		return 0;
	}
	ll ans = 1;
	priority_queue<ll, vector<ll>, greater<ll>> ansp;
	priority_queue<ll> ansn;
	for (int i = 0; i < k; i++)
	{
		if(ppq.empty())
		{
			ansn.push(npq.top());
			npq.pop();
			continue;
		}
		if(npq.empty())
		{
			ansp.push(ppq.top());
			ppq.pop();
			continue;
		}
		
		if (ppq.top() >= -npq.top())
		{
			ansp.emplace(ppq.top());
			ppq.pop();
		}
		else
		{
			ansn.emplace(npq.top());
			npq.pop();
		}
	}
	if (ansn.size() % 2)
	{
		if (ppq.empty())
		{
			ansp.pop();
			ansn.push(npq.top());
		}
		else if (npq.empty())
		{
			ansn.pop();
			ansp.push(ppq.top());
		}
		else if(ansp.empty())
		{
			ansp.push(ppq.top());
			ansn.pop();
		}
		else
		{

			if (ansp.top() * ppq.top() > ansn.top() * npq.top())
			{
				ansn.pop();
				ansp.push(ppq.top());
			}
			else
			{
				ansp.pop();
				ansn.push(npq.top());
			}
		}
	}
	while(ansp.size())
	{
		ans = ans*ansp.top()%MOD;
		ansp.pop();
	}

	while(ansn.size())
	{
		ans = ans*(ansn.top()+MOD)%MOD;
		ansn.pop();
	}
	cout << ans %MOD <<endl;


}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n)
        cin >> a.at(i);

    int b = 0;
    int m = 0;
    for (int i = 0; i < n; i++) {
        if (b+1 == a.at(i)) {
            b++;
            m = i;
        }
    }
    if (b == 0) {
        cout << -1 << endl;
        return 0;
    }

    cout << n - b << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define X first
#define Y second
#define rep(i,a,n) for (int i = a; i < n; i++)
#define ms(a, b) memset(a, b, sizeof(a))
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int MAXN = 1e3 + 10;
const int INF = 0x3fffffff;

struct Reader {
    static const int MX = 1e6;
    bool fail;
    char buf[MX], *p1, *p2;

    inline char nc() {
        if (p1 == p2) {
            p2 = (p1 = buf) + fread(buf, 1, MX, stdin);
            if (p1 == p2) return 0;
        }
        return *p1++;
    }

    template<class T> inline void read(T &x) {
        fail = true;
        char c = nc();
        bool b = 0;
        for (; c && !isdigit(c); c = nc()) if (c == '-') b = 1;
        if (c) fail = false;
        for (x = 0; isdigit(c); x = x * 10 + c - '0', c = nc());
        if (b) x = -x;
    }

    template<class T> inline Reader & operator >> (T &x) {
        if (!fail) read(x);
        return *this;
    }

    operator void*() {
        return fail ? 0 : (Reader*)this;
    }
} rd;

int n, m, r;
int d[MAXN][MAXN];
int q[MAXN];

void solve() {
    rd >> n >> m >> r;
    rep(i, 0, r)  rd >> q[i];
    sort(q, q + r);
    rep(i, 1, n+1) rep(j, 1, n+1) d[i][j] = INF;
    rep(i, 1, n+1) d[i][i] = 0;
    rep(i, 0, m)  {
        int u, v, w;
        rd >> u >> v >> w;
        d[u][v] = d[v][u] = w;
    }
    rep(k,1,n+1) rep(i,1,n+1) rep(j,1,n+1)
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    int ans = INF;
    do {
        int tmp = 0;
        rep(i, 1, r) tmp += d[q[i-1]][q[i]];
        ans = min(ans, tmp);
    } while(next_permutation(q, q + r));
    cout << ans << endl;
}

int main() {
#ifdef LOCAL
    freopen("case.in", "r", stdin);
#endif

    int T, cas = 0;
//    rd >> T;
//    while (T--) {
//        printf("Case #%d: ", ++cas);
        solve();
//    }
    return 0;
}


Measured memory_bytes: 3200
import java.util.*;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans = "Yes";
        for (int i=0; i<s.length(); i++){
            char ch = s.charAt(i);
            if (i % 2 == 0){
                if (ch == 'L'){
                    ans = "No";
                }
            }
            else{
                if (ch == 'R'){
                    ans = "No";
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

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

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) {
    cin >> a[i];
  }

  ll ans = INF;
  rep(i,1ll<<n) {
    if (__builtin_popcountll(i) < k) { continue; }
    // Here, i represents the visible buildings.
    ll h = 0; // maximum height in prev.
    ll now = 0;
    rep(j,n) {
      if (i>>j&1) { // j must be visible
        if (h >= a[j]) {
          now += h+1-a[j]; // a[i] => h+1
          h = h+1;
        }
      }
      chmax(h,a[j]);
    }
    chmin(ans,now);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import math
A,B,N=map(int,input().split())
result=0
if B<=N:
	x=(N//B)*B-1
	result=math.floor(A*x/B)-A*math.floor(x/B)
if B>N:
	result=math.floor(A*N/B)-A*math.floor(N/B)
if B==1:
  print(0)
else:
  print(result)


Measured memory_bytes: 9120
#include <bits/stdc++.h>
#include <string.h>
#define rep(i, n) for(int i = 0; i<(n); i++)
using namespace std;
typedef long long ll;
static const int MAX = 200000; 
//pi = 3.14159265358979323846

int main(){

  int a, b;
  cin >> a >> b;

  if(a >= 13)cout << b << endl;
  else if(a >= 6 && a <= 12)cout << b / 2 << endl;
  else if(a <= 5)cout << "0" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
const ll MAX=510000;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
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; }

ll gcd(ll a, ll b) {
  if (b==0) return a;
  else return gcd(b,a%b);
}
ll lcm(ll a, ll b) {
  ll g=gcd(a,b);
  return a/g*b;
}

int main(){
    ll N,g=1,ans=1;
    cin>>N;
    ll A[N],L[N],R[N];
    for(ll i=0;i<N;i++) cin>>A[i];
    
    L[0]=A[0];
    for(ll i=1;i<N;i++) L[i]=gcd(L[i-1],A[i-1]);
    reverse(A,A+N);
    R[0]=A[0];
    for(ll i=1;i<N;i++) R[i]=gcd(R[i-1],A[i-1]);
    chmax(ans,R[N-1]);
    chmax(ans,L[N-1]);
    for(ll i=1;i<N-1;i++) chmax(ans,gcd(L[i],R[N-i-1]));
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int cake = 0;
  int dan = 0;
  
  cin >> N ;
  
  vector<int> rice(N);
  for(int i=0;i<N;i++){
    cin>> rice.at(i);
  }
  
  sort(rice.begin(),rice.end());
  
  for(int i=0;i<N;i++){
   if(cake < rice.at(i)){
    cake = rice.at(i);
    dan++;
   }
  }

  cout << dan << endl;
}

Measured memory_bytes: 3640
import std.stdio;
import std.string, std.conv, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons;
import core.bitop, std.datetime, std.range;

void main(){
    auto rd = readln.split.to!(int[]);
    auto n = rd[0], q = rd[1];
    auto ds = new int[][](n, 1);
    auto n2s = iota(n).array;

    foreach(i ; 0 .. n){
        ds[i][0] = i;
    }

    foreach(lp ; 0 .. q){
        rd = readln.split.to!(int[]);
        auto c = rd[0], x = rd[1], y = rd[2];

        if(c == 0){
            merge(ds, n2s, x, y);
        } else{
            writeln(n2s[x] == n2s[y] ? 1 : 0);
        }
    }

    //writefln("%(%s\n%)", ds);
}

void merge(int[][] ds, int[] n2s, int x, int y){
    auto u = n2s[x];
    auto v = n2s[y];

    if(u == v) return;

    if(ds[u].length > ds[v].length) swap(u, v);

    ds[v] ~= ds[u];
    foreach(z ; ds[u]){
        n2s[z] = v;
    }
    destroy(ds[u]);
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    int n;
    while(cin >> n){
        if(n==0) break;

        vector<string> s(n),ans(n);
        vector<int> depth(n);
        rep(i,0,n){
            cin >> s[i];
            ans[i]=s[i];
        }

        //'+'????????????
        rep(i,1,n){
            rep(j,0,s[i].size()){
                if(s[i][j]!='.'){
                    ans[i][j-1]='+';
                    depth[i]=j-1;
                    break;
                }
            }
        }
        //'|'????????????
        rep(i,1,n){
            int idx1=i,idx2=-1;
            rep(j,idx1+1,n){
                if(depth[idx1]>depth[j]) break;
                if(depth[idx1]==depth[j]){
                    idx2=j;
                    break;
                }
            }
            if(idx2==-1) continue;
            rep(j,idx1+1,idx2) ans[j][depth[idx1]]='|';
        }
        //'.'???' '?????????
        rep(i,1,n) rep(j,0,s[i].size()) if(ans[i][j]=='.') ans[i][j]=' ';

        rep(i,0,n) cout << ans[i] << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 4256
#include<stdio.h>

int main()
{
	int tr[5],p;
	int i,j,min,sum,sum2;

	while(scanf("%d,%d,%d,%d,%d",tr,tr+1,tr+2,tr+3,tr+4)!= EOF)
	{
		p=0;
		min=13;
		sum=0;

		for(i=0;i<4;i++)
		{
			for(j=i+1;j<5;j++)
			{
				if(tr[i]==tr[j])
					p++;
			}
		}
		
		for(i=0;i<5;i++)
		{
			if(min>tr[i])
			{
				min=tr[i];
			}
			sum+=tr[i];
		}
		if(p)
		{
			switch(p)
			{
			case 1:
				printf("one pair\n");break;
			case 2:
				printf("two pair\n");break;
			case 3:
				printf("three card\n");break;
			case 4:
				printf("full house\n");break;
			case 6:
				printf("four card\n");break;
			}
		}
		else
		{
			sum2=(2*min+4)*5/2;
			if(sum==sum2)
				printf("straight\n");
			else if(min==1&&sum==47)
				printf("straight\n");
			else
				printf("null\n");
		}
	}

	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,l;cin>>n>>l;
    string ss[n];
    for (int i=0;i<n;i++)
        cin>>ss[i];
    sort(ss,ss+n);
    for (auto s:ss)
        cout<<s;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
k, s = map(int, input().rstrip("\n").split())
count = 0

for x in range(k + 1):
    for y in range(k + 1):
        if x + y > s:
            x = k + 1
            y = k + 1
            continue
        count += (s <= x + y + k)

print(count)

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main()
{
    int N;
    string ip;

    cin >> N;

    int count[4] = {0, 0, 0, 0};

    for (int i = 0; i < N; i++) {
        cin >> ip;

        if (ip == "AC") {
            count[0]++;
        } else if (ip == "WA") {
            count[1]++;
        } else if (ip == "TLE") {
            count[2]++;
        } else if (ip == "RE") {
            count[3]++;
        }
    }

    cout << "AC x " << count[0] << endl;
    cout << "WA x " << count[1] << endl;
    cout << "TLE x " << count[2] << endl;
    cout << "RE x " << count[3];

    return 0;

}

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

int main(){
    int n;
    cin >> n;
    vector <long> time(n), dead(n);
    rep(i,n) cin >> time[i] >> dead[i];

    vector <pair <long,long> > set(n);
    rep(i,n) set[i].first = dead[i], set[i].second = time[i];

    sort(all(set));

    long sum=0;
    bool ok=true;

    for(int i=0; i<n; i++){
        sum += set[i].second;
        if(sum > set[i].first){
            ok=false;
        }
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  if(A>=13){
    cout << B;
  }else if(6<=A && A<=12){
    cout << B/2;
  }else{
    cout << '0';
  }
  
  return 0;
}

Measured memory_bytes: 256
class Union():
    def __init__(self, n):
        self.para = [-1] * n
    
    def find(self, n):
        if self.para[n] < 0:
            return n
        
        else:
            self.para[n] = self.find(self.para[n])
            return self.para[n]
    
    def union(self, n, m):
        n = self.find(n)
        m = self.find(m)
        if n == m:
            return False
        else:
            if self.para[n] > self.para[m]:
                n, m = m, n
            
            self.para[n] += self.para[m]
            self.para[m] = n
    
    def same(self, n, m):
        return self.find(n) == self.find(m)

N = int(input()) 
X, Y = [], [] 
for i in range(N): 
    x,y = map(int,input().split()) 
    X.append((x,i)) 
    Y.append((y,i))
X.sort()
Y.sort()
ALL = []
for i in range(len(X)-1):
    ALL.append((X[i+1][0]-X[i][0], X[i][1], X[i+1][1]))
    ALL.append((Y[i+1][0]-Y[i][0], Y[i][1], Y[i+1][1]))
ALL.sort()
ut = Union(N)
cnt = 0
for a in ALL:
    n = a[1]
    m = a[2]
    if not ut.same(n,m):
        ut.union(n,m)
        cnt += a[0]
print(cnt)

Measured memory_bytes: 54572
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e;
    d=0;
    e=0;
    cin>>a>>b>>c;
    while(1){
       if(d>=c){
           break;
       } 
       d=a+d;
       e=e+1;
       if(e%7==0){
           d=d+b;
       }
    }
    cout<<e<<endl;
}



Measured memory_bytes: 3116
import sys
input = sys.stdin.readline
n = int(input())
alist = list(map(int,input().split()))
aalist = [0]*n
aset = set(alist)
adic = {}
for a in alist:
    if a not in adic:
        adic[a] = 0
    adic[a] += 1
a_counter = list(adic.items())

sigma = 0
for counter in a_counter:
    sigma += counter[1] * (counter[1] - 1) // 2

for i in range(n):
    aalist[i] = adic[alist[i]]-1

anslist = []
for a in aalist:
    anslist.append(sigma - a)

for ans in anslist:
    print(ans)



Measured memory_bytes: 101192
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
  int n,m;
  cin >> n >> m;
  int x[m],y[m],z[m];
  rep(i,m){
    cin >> x[i] >> y[i] >> z[i];
    x[i]--,y[i]--;
  }
  UnionFind tree(n);
  rep(i,m){
    tree.unite(x[i],y[i]);
  }
  int ans=0;
  int r[n]={};
  rep(i,n){
    r[tree.root(i)]++;
  }
  rep(i,n){
    if(r[i]>0)ans++;
  }
  cout << ans << endl;
return 0;}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;


int main() {
    int r, c;
    cin >> r >> c;

    vector<vector<int> > spread_sheet(r + 1, vector<int>(c + 1, 0));

    rep(y, r) {
        rep(x, c) {
            cin >> spread_sheet[y][x];
        }
    }

    rep(y, r) {
        int sum = 0;
        rep(x, c) {
            sum += spread_sheet[y][x];
        }
        spread_sheet[y][c] = sum;
    }

    rep(x, c + 1) {
        int sum = 0;
        rep(y, r) {
            sum += spread_sheet[y][x];
        }
        spread_sheet[r][x] = sum;
    }

    rep(y, r + 1) {
        rep(x, c + 1) {
            cout << spread_sheet[y][x];
            if (x == c) cout << endl;
            else cout << ' ';
        }
    }

}


Measured memory_bytes: 3140
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int num;
	double W, H, S, x, y;

	cin >> W >> H >> x >> y;

	S = W*H / 2;

	if (W / x==2&& H/y==2){
		num = 1;
	}
	else num = 0;

	printf("%9lf %d", S,num);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string.h>
#include <bitset>
#include <array>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	char c;
	cin >> c;
	cout << (char)((int)c+1);
	return 0;
}

Measured memory_bytes: 764
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import groupby
def resolve():
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    S=[0]*(n+1)
    for i in range(n):
        S[i+1]=S[i]+A[i]
        S[i+1]%=m

    ans=0
    S.sort()
    for key,iter in groupby(S):
        k=len(list(iter))
        ans+=k*(k-1)//2
    print(ans)
resolve()

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

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

  int ans = 0;
  rep(i,n) ans += i + 1;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let s = read::<String>();
    let n:u32 = s.chars().map(|x| x.to_digit(10).unwrap()).sum();
    let m :u32= s.parse().unwrap();
    let ans = if m % n == 0{
        "Yes"
    }else{
        "No"
    };
    println!("{}",ans );
}

Measured memory_bytes: 4352
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
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;
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const ll INF = 1LL << 60;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> h(110000);
  rep(i, n) cin >> h[i];

  vector<ll> dp(110000, INF);

  dp[0] = 0;

  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

  cout << dp[n - 1] << endl;

  return 0;
}


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

int main(){
    int n,i,*H;
    cin>>n;
    H =new int[n];
    for(i=0;i<n;i++){
        cin>>H[i];
    }
    for(int j=1;j<n+1;j++){
        cout<<"node "<<j<<":"<<" key = "<<H[j-1]<<", ";
        if(j!=1) cout<<"parent key = "<<H[j/2-1]<<", ";
        if(2*j-1<n) cout<<"left key = "<<H[2*j-1]<<", ";
        if(2*j<n) cout<<"right key = "<<H[2*j]<<", ";
        cout<<endl;
    }
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
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;}
template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){return a/GCD(a,b)*b;}

int main(){
	vector<ll> g[200010];
	ll n,m;
	cin >> n >> m;
	ll a[200010],b[200010];
	FOR(i,m){
		cin >> a[i] >> b[i];
		g[a[i]].push_back(b[i]);
		g[b[i]].push_back(a[i]);
	}
	vector<ll> v;

	FOR(i,g[1].size()){
		v.push_back(g[1][i]);
	}
	vector<ll> h;
	FOR(j,g[n].size()){
		h.push_back(g[n][j]);
	}
	h.push_back(0);
	h.push_back(1000000000000);
	sort(all(h));
	FOR(i,v.size()){
		auto itr=lower_bound(all(h),v[i]);
		if(*itr==v[i]){
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

	cout << "IMPOSSIBLE" << endl;


}

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

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

vector<vector<bool>> garden(110,vector<bool> (110,false));
int n;

void dfs(int i, int j){
	if(i>=n)return ;
	if(!garden[i][j])return ;
	garden[i][j] = false;
	dfs(i+1, j);
}

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> h(n);
	rep(i,n){
		cin>>h[i];
	}
	sort(all(h));
	int ans = inf;
	for(int i = 0; i+k-1<n; ++i){
		ans = min(ans, h[i+k-1]-h[i]);
	}
	cout<<ans<<endl; return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
int n;
int v[200005];
int dp[200005];
int f[200005];
vector<vector<int>> g;
void dfs(int p, int u) {
    int pos = lower_bound(f, f+n, v[p]) - f;
    int t = f[pos];
    f[pos] = v[p]; 
    dp[p] = lower_bound(f, f+n, inf) - f;
    for(auto i:g[p]) {
        if(i!=u)
        dfs(i, p);
    }
    f[pos] = t;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    g.resize(n+1);
    for(int i=0;i<n;i++) cin>>v[i];
    fill(f,f+n+2,inf);
    for(int i=1;i<n;i++) {
        int x, y;
        cin>>x>>y;
        x--; y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    dfs(0, -1);
    for(int i=0;i<n;i++) cout<<dp[i]<<endl;
    return 0;
}

Measured memory_bytes: 30736
#include <iostream>
#include <string>

void solve( const std::string &s ) {
    int N=0, W=0, E=0, S=0;
    for (const auto &c : s) {
        if (c == 'N') ++N;
        else if (c == 'W') ++W;
        else if (c == 'S') ++S;
        else ++E;
    }
    if ((N > 0 && S == 0) || (N == 0 && S > 0) || (W > 0 && E == 0) || (W == 0 && E > 0)) {
        std::cout << "No" << std::endl;
        return;
    }
    std::cout << "Yes" << std::endl;
}
int main() {
    std::string s;
    std::cin >> s;
    solve( s );
    return 0;
}


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

using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ign cin.ignore(numeric_limits<streamsize>::max(),'\n')

#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef map<int,int> MCI;
typedef unordered_map<int,int> UMII;
typedef unordered_map<char,int> UMCI;
typedef set<int> SI;
typedef long long int llint;

// Display Map
//~for (auto const& pair: m) {
//~std::cout << "{" << pair.first << ": " << pair.second << "}\n";
//~}

// Extract word(w) from sentence(s)
//~stringstream str(s);
//~string w;
//~while(str >> w){
//~// w is your word
//~}

//Memset Syntax
// memset(array, value,sizeof(array)) val is 0,-1 or bool only

// To get accurate precision
//~cout.precision(20);

int main() {
    fast_io;
    int x, n;
    cin >> x >> n;
    vector<int> v(n);
    for(auto &i : v) cin >> i;
    bool arr[102];
    memset(arr, true,sizeof(arr));
	for(int i = 0; i < (int)v.size(); i++){
		arr[v[i]] = false;
	}
	int l = x-1;
	int r = x+1;
	while(true){
		if(arr[x]){
			cout << x << endl;
			break;
		}
		if(arr[l] && l>=0){
			cout << l << endl;
			break;
		}
		if(arr[r] && r<=101){
			cout << r << endl;
			break;
		}
		l--;
		r++;
		
	}

}


Measured memory_bytes: 3656
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[0]*M
B=[0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
  A[i]-=1
  B[i]-=1

rec=[0]*N
for i in range(M):
  rec[A[i]]=max(rec[A[i]],H[B[i]])
  rec[B[i]]=max(rec[B[i]],H[A[i]])
s=0
for i in range(N):
  if H[i] > rec[i]:
    s+=1
print(s)
    

Measured memory_bytes: 21848
# coding: utf-8
# Your code here!

n=int(input())

x=[]
y=[]
h=[]
#n,T=[int(i) for i in input().split()]
A=[]
for _ in range(n):
#    x0,y0,h0=[int(i) for i in input().split()]
#    x.append(x0)
#    y.append(y0)
#    z.append(z0)
    a=[int(i) for i in input().split()]
    A.append(a)

A.sort(key=lambda x:x[2],reverse=True)

ax=-1
ay=-1
ah=-1
#print(A)

zz=101
for i in range(zz):
    for j in range(zz):
        ok=1
        h=abs(A[0][0]-i)+abs(A[0][1]-j)+A[0][2]
        for k in range(n):
            c=abs(A[k][0]-i)+abs(A[k][1]-j)
#            if i==2 and j==2:
#                print(h,k,c,A[k][0],A[k][1],A[k][2])
            if max(h-c,0) != A[k][2]:
                ok=0
                break
        if ok==1:
            ax=i
            ay=j
            ah=h
        if ok==1:
            break
        
    if ok==1:
        break
print(ax,ay,ah)
    




Measured memory_bytes: 3064
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
import math
import time
ts=time.time()
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

n=I()
t=[]
nx=[-1]*n
for i in range(n):
    a=[i-1 for i in LI()[::-1]]
    nx[i]=a.pop()
    t.append(a)

IsMatch=True
ans=0
MacthNum=0
search=set(range(n))

while IsMatch and MacthNum<n*(n-1)//2:
    ans+=1
    IsMatch=False
    done=set()
    nx_search=[]
    for i in search:
        if (i in done) or (nx[i] in done) or nx[i]==-1:
            continue
        c1=i
        c2=nx[i]
        if c1==nx[c2]:
            IsMatch=True
            MacthNum+=1
            if t[c1]:
                n_i=t[c1].pop()
                nx_search.append(c1)
            else:
                n_i=-1
            if t[c2]:
                n_n_i=t[c2].pop()
                nx_search.append(c2)
            else:
                n_n_i=-1
            nx[nx[i]],nx[i]=n_n_i,n_i
            done.add(c1)
            done.add(c2)
    search=[i for i in nx_search]
    ans=ans if IsMatch else -1

print(ans)

Measured memory_bytes: 65368
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int n, _time;
vector<PII> _team;

int main() {
	while ( ~scanf( "%d", &n ) && n ) {
		_team.resize( n );
		for ( int i = 0; i < n; i++ ) {
			scanf( "%d", &_team[i].second );
			_team[ i ].first = 0;
			for ( int j = 0; j < 8; j++ ) {
				scanf( "%d", &_time );
				if ( j % 2 ) {
					_team[ i ].first += _time;
				}
				else {
					_team[ i ].first += _time * 60;
				}
			}
		}
		sort( _team.begin(), _team.end() );
		printf( "%d\n", _team[ 0 ].second );
		printf( "%d\n", _team[ 1 ].second );
		printf( "%d\n", _team[ _team.size() - 2 ].second );
	}
	return 0;
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll abs2(ll a,ll b){
    return max(a,b) - min(a,b);
}
bool is_prime(int x){
    int i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    map<int,ll> mil;
    for(int i=1; i<=n;i++){
        for(auto u : prime_factorize((ll) i)){
            mil[u.first] += u.second;
        }
    }
    ll ans = 1;
    for(auto u : mil){
        ans *= u.second+1;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 

 
void solve()
{
    ll a ,b ;
    cin>>a>>b; 
    ll gc = __gcd(a , b) ;
    vector<ll>div  ;
    div.pb(1) ;
    if(gc%2==0){
    	div.pb(2) ;
    	while(gc%2==0){
    		gc/=2 ;
    	}
    }
    ll tgc = gc;
    for(ll i = 3 ; i*i <= tgc; i+= 2){
    	if(gc%i==0){
    		div.pb(i) ;
    		while(gc%i==0){
    			gc /= i ;
    		}
    	}
    }
    if(gc>1){
    	div.pb(gc) ;
    }
    cout<<div.size()<<endl;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3832
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int findSumDigits(int s) {
    int num = 0;
    int temp = 0;
    while (s) {
        temp = s % 10;
        num += temp;
        s = s / 10;
    }
    return num;
}

int countDivisorNum(int n) {
    int count = 0;
    for (int i = 1; i <= n; i++) {
        if (n % i == 0) {
            count++;
        }
    }
    return count;
}

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int temp = 0;

    while (1) {
        temp = c - b;
        if (temp <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        c = temp;
        temp = a - d;
        if (temp <= 0) {
            cout << "No" << endl;
            return 0;
        }
        a = temp;
    }

    return 0;
}

Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		boolean can = false;
		for(int i = 0;i <= N;i++) {
			if(i%4 == 0&&(N-i)%7==0) {
				can = true;
				break;
			}
		}
		System.out.println(can?"Yes":"No");
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define ll long long int
#define mod_ceil(a, b) (a % b) ? a / b + 1 : a / b
using namespace std;

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

    ll n, ans = 0, tmp, lm = -1;
    cin >> n;
    vector<ll> A;
    map<ll, ll> M;
    for (ll i = 0; i < n; i++)
    {
        cin >> tmp;
        // cout << M[tmp] << endl;
        if (M[tmp] == 0)
        {
            A.push_back(tmp);
        }
        lm = max(lm, tmp);
        M[tmp]++;
    }
    ll sz = A.size();

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

    vector<ll> pos(lm + 1);
    for (ll i = 0; i < sz; i++)
    {
        pos[A[i]] = i;
    }

    vector<bool> vis(sz, false);

    for (ll i = 0; i < sz; i++)
    {
        // cout << A[i] << " ";
        if (vis[i] == true)
            continue;
        if (M[A[i]] > 1)
        {
            vis[i] = true;
        }
        for (ll j = A[i] * 2; j <= lm; j += A[i])
        {
            // cout << A[j] << " ";
            if (M[j] > 0 and j % A[i] == 0)
            {
                vis[pos[j]] = true;
            }
        }
    }
    for (ll i = 0; i < sz; i++)
    {
        if (!vis[i])
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 74876
# ABC042C
N,K=map(int,input().split())
out=N
N=str(N)
a = list(map(int, input().split()))
while 1<2:
    N1=N
    i=0
    for i in range(len(a)):
        if str(a[i]) in N:
            N=int(N) 
            N+=1
            N=str(N)
    if N1==N:
        break

print(N)

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

#define ll long long
#define mod 1000000007
#define pb push_back

ll check[100000]={0};
//vector<ll,pair<ll,vector<ll>>> mp;
int main()
{
ll a,b;
cin>>a>>b;
if(a>=10)cout<<b<<endl;
else
cout<<(b+(10-a)*100)<<endl;
}


Measured memory_bytes: 256