akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main(void){
    
    // 定義：データの個数「 N 」、データ入力の値「 data[N] 」、最大大利益を「 maximumProfit 」と置く
    int N, maximumProfit = INT_MIN;
    cin >> N;
    vector<int> data(N);
    
    // 入力：データの値を入力
    for(int i = 0; i < N; i++) cin >> data[i];
    
    // 定義：最小価格の値を「 minimumPrice 」と置く
    int minimumPrice = data[0];
    
    for(int j = 1; j < N; j++){
        
        //計算：変化後の値 ー 最小値の価格（一番最初は最初の価格）＝最大利益
        maximumProfit = max(maximumProfit, data[j] - minimumPrice);
        
        // 計算：最大利益を求めるためには最小価格の値を変化する値から引くことで求められるから
        minimumPrice = min(minimumPrice, data[j]);
    }

    cout << maximumProfit << endl;

}

/**************************時間オーバー********************************

#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main(void){
    
    // 定義：データの個数「 N 」、データ入力の値「 data[N] 」、最大大利益を「 maximumProfit 」と置く
    int N, maximumProfit = INT_MIN;
    cin >> N;
    vector<int> data(N);
    
    // 入力：データの値を入力
    for(int i = 0; i < N; i++) cin >> data[i];
    
    for(int after = 1; after < N; after++){
        for(int before = 0; before < after; before++)
            maximumProfit = max(maximumProfit, data[after] - data[before]);
    }

    cout << maximumProfit << endl;

}

*********************************************************************/





Measured memory_bytes: 3560
// !Start && !End 
//  0 se divide
//https: //www.youtube.com/watch?v=6Nb-prB-4P0&list=RD6Nb-prB-4P0&start_radio=1

// https: //www.youtube.com/watch?v=eYDI8b5Nn5s
// Electrify my OOOoooooOOOoooOOOOOoooooOOOooo!
#pragma optimise GCC(-O2)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define ve(x) vector<x>
#define f(a,b,c) for(int a=b;a<c;a++)
#define foto(x,v) for(auto x:v)
#define read(t) ll t; cin>>t;
#define reads(t) string t; cin>>t;
#define readarr(arr,n) ll arr[n]; f(i,0,n) cin>>arr[i];
#define forstl(i,v) for(auto &i: v)
#define ln endl
#define Endl endl
#define dbg(x) cout<<#x<<" = "<<x<<ln;
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<ln;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    Term "<< ++c <<" = "<<it<<ln;} cout<<ln;
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cout<<ln;
#define dbgarr(v,s,e) cout<<#v<<" = "; f(i,s,e) cout<<v[i]<<", "; cout<<ln;
#define addEdge(tr,k) f(i,0,k) { ll x,y; cin>>x>>y, tr[x].push_back(y), tr[y].push_back(x);}
#define all(v) v.begin(),v.end()

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); }

//														GLOBAL VARS
ll INF =LLONG_MAX;
const ll M= 1000000007;

//														USEFUL FUNCTIONS
ll powm(ll ,ll);

// 														MAIN
int main()
{ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    //It gets easier day by day, but the hard part is to........
    read(x) read(y)
    if(x<y) cout<<0;
    else cout<<10;
}










//													FUNCTIONS DECLARATIONS
ll powm(ll a, ll b) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%M;
		a=(a*a)%M;
		b>>=1;
	}
	return res;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define rep(i,a,b,c)            for(int i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(int i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define vpii                    vector<pair<int,int>>
#define si                      set<int>
#define usi                     unordered_set<int>
#define vi                      vector<int>
#define vld                     vector<ld>
#define vvi                     vector<vector<int>>
#define vvld                    vector<vector<ld>>
#define pii                     pair<int,int>
#define vvpii                   vector<vector<pair<int,int>>>
#define pqi                     priority_queue<int>
#define mii                     map<int,int>
#define mic                     map<int,char>
#define um                      unordered_map
#define umii                    um<int,int>
#define umic                    um<int,char>
#define umci                    um<char,int>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    int Testcases;cin>>Testcases;while(Testcases--)
#define input(a,n)              for(int i=0;i<n;++i) cin>>a[i];
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int32_t main()
{
	fastIO
	inp_out();
	int k,a,b;
	cin>>k>>a>>b;

	int val=(a%k);

	if(val!=0)
	{
		a+=(k-val);
	}
	if(a<=b)
		cout<<"OK";
	else cout<<"NG";

	return 0;
}

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

int main() {
  int x, y;
    cin >> x >> y;
    if (y - x * 2 >= 0 && x * 4 - y >= 0 && y % 2 == 0 )
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
}

Measured memory_bytes: 3624
K = int(input())
A,B = map(int,input().split())

result = []
for i in range(A,B+1):
#    print(i)
    if i % K == 0:
        result.append(1)
    else:
        result.append(0)
if sum(result) >0:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9184
#include <cassert>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

double A, V, B, W, T;
bool solve(void) {
  if(V <= W) {
    return false;
  }
  // if((A & 1) != (B & 1)) {
  //   if((V & 1) == 0) {
  //     return false;
  //   }
  // }
  double d = abs(A - B);
  double v = V - W;
  double t = d / v;
  return t <= T;
}

int main(void) {
  cin >> A >> V >> B >> W >> T;
  bool res = solve();
  puts(res ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())

ll N, K;
vector<ll> P, M;
ll p, m, z;

bool jugde_m(ll x) {
  ll cnt = 0;
  int ip = p, im = 0;
  while (im<m) {
    while (ip>0 && M[im]*P[ip-1]>x) {
      ip--;
    }
    cnt += ip;
    im++;
  }
  return cnt>=K;
}

bool jugde_p(ll x) {
  ll cnt = 0;
  int a, b;
  a = 0; b = p-1;
  while (a<b) {
    while (a<b && P[a]*P[b]<=x) {
      b--;
    }
    cnt += b-a;
    a++;
  }
  a = 0; b = m-1;
  while (a<b) {
    while (a<b && M[a]*M[b]<=x) {
      b--;
    }
    cnt += b-a;
    a++;
  }
  return cnt<=p*(p-1)/2+m*(m-1)/2-K;
}


int main() {
  cin >> N >> K;
  rep(i,N) {
    ll a;
    cin >> a;
    if (a>0) {
      P.push_back(a);
      p++;
    } else if (a==0) {
      z++;
    } else {
      M.push_back(a);
      m++;
    }
  }
  sort(all(M)); rsort(P);
  if (p*m>=K) {
    ll l = -1e18-1, u = -1;
    while (u-l>1) {
      ll mid = (l+u)/2;
      if (jugde_m(mid)) {
        u = mid;
      } else {
        l = mid;
      }
    }
    print(u);
  } else if (z*(z-1)/2+p*m+m*z+z*p>=K) {
    print(0);
  } else {
    K -= z*(z-1)/2+p*m+m*z+z*p;
    ll l = 0, u = 1e18;
    while (u-l>1) {
      ll mid = (l+u)/2;
      if (jugde_p(mid)) {
        u = mid;
      } else {
        l = mid;
      }
    }
    print(u);
  }
  return 0;
}

Measured memory_bytes: 5256
import java.io.*;
import java.util.*;

    public class Main {
    public static void main(String[] args)
    throws java.io.IOException{
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext()){
            int count =0;
            int n = scan.nextInt();
            if(n==1){System.out.println(0);continue;}
            boolean [] prime = new boolean [n+1];
            for(int i =0;i<=n;i++){
                prime[i]=true;
            }

            for(int i=2;i<=n;i++){
                if(prime[i]){
                    count++;
                    for(int k=i*2;k<=n;k+=i)prime[k]=false;
                }
            }
            System.out.println(count);
        }
    }
    }

Measured memory_bytes: 16000
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

int main(){
    int n;scanf("%d",&n);
    int h[n];for(int i=0;i<n;i++)scanf("%d",&h[i]);

    int ans=1;
    int flg=0;
    for(int i=1;i<n;i++){
        for(int j=0;j<i;j++){
            if(h[j]>h[i]){
                flg=1;
                break;
            }
        }
        if(!flg)
            ans++;
        flg=0;
    }
    printf("%d\n",ans);
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define ALL(x) (x).begin(), (x).end()

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

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    int N, Y;
    const int lim = 20000;
    cin >> N >> Y;

    bool hasAns = false;
    int xa = -1, ya = -1, za = -1;
    rep(x, N+1) {
        // cut
        if (9*x > lim-N)
            break;
        rep(y, N+1) {
            // cut
            int stotal = 9*x + 4*y;
            if(stotal > lim-N)
                break;

            if(stotal == Y/1000 - N) {
                xa = x;
                ya = y;
                za = N - xa - ya;
                if(za > -1) {
                    hasAns = true;
                    break;
                }
            }
        }
        if(hasAns)
            break;
    }

    if(hasAns)
        cout << xa << " " << ya << " " << za << endl;
    else
        cout << "-1 -1 -1" << endl;
    return 0;
}


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

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;

    for (int N = 0; N < 100000; N++){
        if ((int)((float)N * 0.08) == A && (int)((float)N * 0.10) == B){
            cout << N << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
    
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.Comparator;
import java.util.List;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    List<Integer> list = Arrays.asList(a, b, c);
    list.sort(Comparator.naturalOrder());

    System.out.println(list.stream().map(String::valueOf).reduce((x, y) -> x + " " + y).get());

    sc.close();
  }
}


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

int main() {
    float ta, ao, a, b, c, d;
    cin >> a >> b >> c >> d;
    ta = ceil(c / b);
    ao = ceil(a / d);
    if(ao >= ta){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 3688
s;n,k,i,y;d['   '];c(int*z){i=*1[&z]-*z;}main(x){for(scanf("%*d");~scanf("%d%d%d",&n,&k,&y);printf("%d\n",s)){for(i=--n;i;y=x)scanf("%d",&x),d[--i]=x-y;qsort(d,n,4,c);for(s=0;n>=k;s+=d[--n]);}}

Measured memory_bytes: 1192
using System;
using System.IO;
 
class Program
{
    static void Solve()
    {
        var n = sc.Int();
        var a = sc.Int();

        if (n % 500 <= a)
            pr.WriteLine("Yes");
        else
            pr.WriteLine("No");
    }
 
 
    static void Main(string[] args)
    {
        // pr.AutoFlush = true;
        Solve();
        pr.Flush();
    }
 
    static Scanner sc = new Scanner();
    static Printer pr = new Printer();
}
 
#region IO
class Scanner
{
    private int _i = 0; 
    private string[] line = new string[0];
 
    private T[] Enumerate<T>(int n, Func<T> f)
    {
        T[] ret = new T[n];
        for (int i = 0; i < n; i++)
            ret[i] = f();
        return ret;
    }
 
    public string Str()
    {
        if (line.Length <= _i)
        {
            line = Console.ReadLine().Split(' ');
            _i = 0;
        }
 
        return line[_i++];
    }
 
    public int Int() => int.Parse(Str());
    public long Long() => long.Parse(Str());
    public double Double() => double.Parse(Str());
    public int[] Int(int n) => Enumerate(n, Int);
    public long[] Long(int n) => Enumerate(n, Long);
    public double[] Double(int n) => Enumerate(n, Double);
    public string[] Str(int n) => Enumerate(n, Str);
}
 
class Printer : StreamWriter
{
    public Printer() : base(Console.OpenStandardOutput())
    {
        AutoFlush = false;
    }
}
#endregion

Measured memory_bytes: 11092
from bisect import bisect_right

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
b.sort()
c.sort()
ans = 0

bcb_cum = [0] * (n+1)
for i in range(n):
    bcb_cum[i+1] = bcb_cum[i] + n - bisect_right(c, b[i])
    
for x in a:
    l = bisect_right(b, x)
    ans += bcb_cum[n] - bcb_cum[l]

print(ans)


Measured memory_bytes: 23360
n = int(input())
H = list(map(int, input().split()))

dp = [0] * n

for i in range(n):
    if i == 0:
        dp[i] = 0
    elif i == 1:
        dp[i] = abs(H[0] - H[i])
    else:
        dp[i] = min(
            dp[i - 2] + abs(H[i - 2] - H[i]),
            dp[i - 1] + abs(H[i - 1] - H[i])
            )

print(dp[-1])

Measured memory_bytes: 52592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
#include <unordered_map>
using namespace std;

const int N = 200010;
const int mod = 1000000007;
map<pair<long long, long long>, int > mp;

long long mpow(long long a, long long b) {
	long long ans = 1;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

long long gcd(long long a, long long b) {
	return b ? gcd(b, a % b) : a;
}

int main()
{
	int ans = 0, a = 0, b = 0, o = 0;
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		long long x, y;
		scanf("%lld%lld", &x, &y);
		if (x == 0 && y == 0) {
			o++;
			continue;
		}
		if (x == 0) a++;
		else if (y == 0) b++;
		else {
			long long d = gcd(abs(x), abs(y));
			x /= d;
			y /= d;
			if (x < 0) x = -x, y = -y;
			mp[make_pair(x, y)]++;
		}
	}

	long long tot = 1;
	while (!mp.empty()) {
        pair<long long, long long> p = mp.begin()->first;		
		long long x = p.first, y = p.second, c = mp[p];
		long long xx = -y, yy = x;
		if (xx < 0) xx = -xx, yy = -yy;
		// (1, 2) => (2, -1)
		if (mp.count(make_pair(xx, yy))) {
			tot = tot * (mpow(2, c) + mpow(2, mp[make_pair(xx, yy)]) - 1) % mod;
			mp.erase(make_pair(x, y));
			mp.erase(make_pair(xx, yy));
		} else {
			tot = tot * mpow(2, c) % mod;
			mp.erase(make_pair(x, y));
		}
	}
	tot = tot * (mpow(2, a) + mpow(2, b) - 1) % mod;
	tot--;
	if (tot < 0) tot += mod;
	ans = (tot + o) % mod;

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15720
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std ;

int m ,n  ,  dis[15] , vis[15] , e[15][15] ;

const int MAX = 9999999 ; 

int need[205][205] ;


int a[10] ;


int dij(int u){
	for(int i = 0 ; i < 10 ; i++) dis[i] = e[u][i] ; // 题目特殊 , 每条边都有边权 , 所以其实初始化不用为无穷值  
	vis[u] = 1 ;
	
	//for(int i = 0 ; i < 10 ; i++) printf("%d\n" , dis[i]) ;
	
	for(int i = 0 ; i < 9 ; i++){
		int v ;
		int minn = MAX ;
		
		for(int j = 0 ; j <= 9 ; j++){
			if(!vis[j]&&dis[j]<minn){
				//system("pause") ;
				v = j ;
				minn = dis[j] ;
			//	printf("%d   %d  \n" , v , minn) ;
			}
		} 
		//system("pause") ;
		vis[v] = 1 ;
		for(int j = 0 ; j <= 9 ; j++){
			//printf("%d " , dis[1]) ;
			dis[j] = min(dis[j] , dis[v]+e[v][j]) ;
			//printf("%d\n" , dis[j]) ;	 
		}
	}
	
	return dis[1] ;
	//for(int i = 0 ; i <= 9 ; i++){
	//	printf("%d  " , dis[i]) ;
	//}
	//putchar('\n') ;
	
}

int main(){
	
	int m , n , s ;
	cin>>m>>n ;
	
	for(int i = 0 ; i < 10 ; i++){
		for(int j = 0 ; j < 10 ; j++){
			scanf("%d" , &e[i][j]) ;
		}
		//dis[i] = MAX ;
	}
	
	int sum = 0 ;
	
	//memset(vis,0,sizeof(vis)) ;
	
	//for(int i = 0 ; i <=9 ; i++){
		//dij(i) ;
		//a[i] = dis[1] ;
	//}
//	for(int i = 0 ; i <= 9 ; i++){
	//	printf("%d  " , a[i]) ;
//	}
	for(int i = 0 ; i <=9 ; i++){
		
		memset(vis,0,sizeof(vis)) ;
		for(int j = 0 ; j <= 9 ; j++){
			dis[j] = MAX ;
		}
		a[i] = dij(i);
		//printf("%d   "  , a[i]) ;
	}

	//for(int i = 0 ; i <=9 ; i++){
		//printf("%d    " , dis[i]) ;
	//}
	for(int i = 0 ; i < m ; i++){
		for(int j = 0 ; j < n ; j++){
			scanf("%d" , &s) ;
			if(s == -1) continue ;
			//printf("%d\n" , dis[need[i][j]]) ;
			//system("puase") ;
			
			sum += a[s] ;
		}
	}
	cout<<sum<<endl ;
	
	return 0 ;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define M 1000000007
#define ff first
#define ss second
#define pb push_back  
#define INF 1000000000000

									// nestedcode


 int main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   ll a,b;
   cin>>a>>b;
   if(a== b){
   	cout<<"Yes";
   }else	cout<<"No";
   
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}


console.log(main());
function main(){
  var n = o.a();
  return n%2?(n+1)/2/n:0.5;
}

Measured memory_bytes: 7372
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int tmp = num;
        boolean jdg = false;
        while(num > 0){
            if(num % 4 == 0){
                jdg = true;
                break;
            }
            num -= 7;
        }
        num = tmp;
        while(num > 0){
            if(num % 7 == 0){
                jdg = true;
                break;
            }
            num -= 4;
        }

        System.out.println(jdg?"Yes":"No");
    }
}

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

using namespace std;
const int N =100010;
int b[N];
int vis[N];
int main()
{
	int n,k,q;
	cin>>n>>k>>q;
	memset(vis,0,sizeof(vis));
	int id;
	for(int i=1;i<=q;i++) cin>>id,vis[id]++;
	for(int i=1;i<=n;i++) 
	{
		b[i]=k;
		b[i]=b[i]-(q-vis[i]);
		if(b[i]>=1)	puts("Yes");
		else puts("No");	
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    int now_x = 0;
    int now_y = 0;
    int now_t = 0;
    rep(i,n){
        int t,x,y;
        cin >>t >> x >> y;
        if((t-now_t)%2!=(abs(now_y-y)+abs(now_x-x))%2)
        {cout << "No" << endl;
        return 0;
        }
        if(t-now_t<abs(now_x-x)+abs(now_y-y)){
            cout << "No" << endl;
            return 0;
        }
        now_y = y;
        now_x = x;
        now_t = t;
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main(){
	int n,res=0;
	cin>>n;
	while(n>1000){
		n-=1000;
	}
	if(n<=1000){
		res=abs(n-1000);
	}
	cout<<res;
	
	
	return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;

inline int read() {
	int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}

const int N = 500005, mod = 1e9 + 7;
int F[N], sum[N], mn[N], mx[N];
struct Edge{ int v, l, r, x; } A[N];
bool cmp1(const Edge &A,const Edge &B) { return A.v > B.v; }
bool cmp2(const Edge &A,const Edge &B) { return A.l == B.l ? A.r < B.r : A.l < B.l; }

int main() {
	int n = read();
	for (int i = 1; i <= n; ++i) 
		A[i].x = read(), A[i].v = read();
	sort(A + 1, A + n + 1, cmp1);
		
	mn[1] = A[1].x;
	for (int i = 2; i <= n; ++i) mn[i] = min(mn[i - 1], A[i].x);
	for (int i = 1; i <= n; ++i) {
		int l = 1, r = i - 1, p = i;
		while (l <= r) {
			int mid = (l + r) >> 1;
			if (mn[mid] < A[i].x) p = mid, r = mid - 1;
			else l = mid + 1;
		}
		A[i].l = p;
	}
	mx[n] = A[n].x;
	for (int i = n - 1; i >= 1; --i) mx[i] = max(mx[i + 1], A[i].x);
	for (int i = n; i >= 1; --i) {
		int l = i + 1, r = n, p = i;
		while (l <= r) {
			int mid = (l + r) >> 1;
			if (mx[mid] > A[i].x) p = mid, l = mid + 1;
			else r = mid - 1;
		}
		A[i].r = p;
	}
	sort(A + 1, A + n + 1, cmp2);
	int p = 1, Ans = 0;
//	for (int i = 1; i <= n; ++i) cout << A[i].l << " " << A[i].r << "\n";
	for (int i = 1; i <= n; ++i) {
		while (A[p].r < A[i].l - 1) 
			p ++;
		F[i] = (sum[i - 1] - sum[p - 1] + mod) % mod;
		if (A[i].l == 1) F[i] = (F[i] + 1) % mod;
		sum[i] = (sum[i - 1] + F[i]) % mod;
		if (A[i].r == n) Ans = (Ans + F[i]) % mod;
	}
	cout << Ans;
	return 0;
}

Measured memory_bytes: 12672
#define rep(i,n) for(i=0;i<(n);++i)
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<utility>
#include<string>
#include<algorithm>
#include<bitset>
#include<queue>
#include<cmath>
#include<iomanip>
using ll = unsigned long long int;
using namespace std;



int src(){
    int N;
    cin>>N;
    double x[N],y[N];
    for(int i=0;i<N;++i){cin>>x[i]>>y[i];}
    double sum=0.0;
    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            sum+=sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
        }
    }
    cout<< setprecision(10) << fixed <<sum/N;
    cout<<"\n";

    return 0;
}

int main(int argc,char* argv[]){
    //ifstream in( argv[1] );
    //cin.rdbuf(in.rdbuf());
    src();    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
#pragma endregion

void solve() {
  int n;
  cin >> n;
  vi32 x(n);
  cin >> x;
  int ans = 1e9;
  reps(p, 100) {
    int sum = 0;
    rep(i, n) {
      sum += (x[i] - p) * (x[i] - p);
    }
    amin(ans, sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
typedef long long ll;
#define maxn 50
using namespace std;
int n,m;
int a[maxn],b[maxn];
bool graph[maxn][maxn];
bool visited[maxn];

void dfs(int v)
{
  visited[v]=true;
  for(int i=0;i<n;i++)
    {
      if(graph[v][i]==false) continue;
      if(visited[i]==true) continue;
      dfs(i);
    }
}
int main(int argc,char const* argv[])
{
  cin >> n >> m;
  int ans=0;
  for(int i=0;i<m;i++)
    {
      cin >> a[i] >> b[i];
      a[i]--,b[i]--;
      graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
    }
  for(int i=0;i<m;i++)
    {
      graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
      for(int j=0;j<n;j++) visited[j]=false;

      dfs(0);
      bool bridge=false;
      for(int j=0;j<n;j++) if(visited[j]==false) bridge=true;
      if(bridge) ans+=1;

      graph[a[i]][b[i]] = graph[b[i]][a[i]]=true;
    }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a == 5 || 7 && b == 5 || 7 && c == 5 || 7)
    {
        if(a+b+c == 17)
            printf("YES\n");
        else
            printf("NO\n");
    }
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 1612
mat=[]
for i in range(3):
  array=list(map(int,input().split()))
  mat.append(array)
#print(mat)

diff_tate=[]
for i in range(2):
  diff_tate.append([mat[i][0]-mat[2][0],mat[i][1]-mat[2][1],mat[i][2]-mat[2][2]])
#print(diff_tate)

diff_yoko=[]
for i in range(2):
  diff_yoko.append([mat[0][i]-mat[0][2],mat[1][i]-mat[1][2],mat[2][i]-mat[2][2]])
#print(diff_yoko)

for diff in diff_tate+diff_yoko:
  dset=set(diff)
  if len(dset)>1:
    print("No")
    break
else:
  print("Yes")

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	LL N, H;
	cin >> N >> H;
	vector<int> A(N);
	vector<int> B(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i] >> B[i];
	}
	SO(A); SO(B);
	LL ans = 0;
	for (int i = N - 1; i >= 0; --i) {
		if (B[i] <= A[N - 1]) {
			break;
		}
		H -= B[i];
		++ans;
		if (H <= 0) {
			cout << ans << endl;
			return;
		}
	}
	
	ans += (H + A[N - 1] - 1) / A[N - 1];
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

int main()
{
    // 整数の入力
    int n;
    cin >> n;
    
    // input of a_i
    int a[n+2];
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    a[0] = 0;
    a[n + 1] = 0;

    // yen total
    int yen;
    for (int i=1;i<=n+1;i++){
        yen = yen + fabs(a[i] - a[i - 1]);
    }

    // output
    int tmp;
    for(int i=1;i<=n;i++){
        tmp = 0;
        tmp = tmp + fabs(a[i + 1]-a[i - 1]);
        tmp = tmp - fabs(a[i]-a[i - 1]);
        tmp = tmp - fabs(a[i + 1]-a[i]);
        
        cout << yen + tmp << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    string s, hitachi("");
    cin >> s;

    rep(i,0,5)
    {
        hitachi += "hi";
        if (hitachi == s)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define R register
#define int long long
using namespace std;
const int N =2e6+200;
const ll mod = 1e9+7;
template <class Ruby_Rose> inline void read(Ruby_Rose &x)
{
 	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}
int n, val[N], ans;
signed main()
{
	read(n);
	for(R int i=1; i<=n; i++)read(val[i]);
	for(R int i=0; i<=62; i++)
	{
		int num[2]={0, 0};
		for(R int j=1; j<=n; j++)
		{
			num[(val[j]>>i)&1]++;
		}
		for(R int j=1; j<=n; j++)
		{
			num[(val[j]>>i)&1]--;
			ans=(ans+(1ll<<i)%mod*num[(val[j]>>i)&1^1]%mod)%mod;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    int x; cin >> x;
    while(1){
        int f = 0;
        for(int i = 2; i < (int)pow(x, 0.5) + 1; i++){
            if(x % i == 0){
                f = 1;
                break;
            }
        }
        if(f == 0){cout << x << endl; return 0;}
        x++;
    }
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    char s[5];
    Scs(s);

    int k = (s[0] - '0') * 10 + s[1]-'0';
    int l = (s[2] - '0') * 10 + s[3]-'0';


    if( k < 13 && l < 13 && k > 0 && l > 0 ) printf ("AMBIGUOUS\n");
    else if( l < 13 && l > 0 ) printf ("YYMM\n");
    else if( k < 13 && k > 0 ) printf ("MMYY\n");
    else  printf ("NA\n");



    return 0;
}



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

int main(){
	int n, m, l;
	cin >> n >> m >> l;
	long a[n][m];
	long b[m][l];
	long c[n][l];

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}//a入力
	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			cin >> b[i][j];
		}
	}//b入力
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			c[i][j] = 0;
		}
	}//c初期化

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			for(int k = 0; k < m; k++){
				c[i][j] += a[i][k]*b[k][j];
			}
		}
	}//a*b

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			cout << c[i][j];
			if(j != l-1) cout << " ";
		}
		cout << endl;
	}//c表示
	return 0;
}


Measured memory_bytes: 3336
/*     *******************Bismillahir Rahmanir Rahim************************
                          MD. ASFAKUL GHANI!
                          *ProMAGFAT*!
 SECRET_warning :)->FAT   CSE-25!
                          JAHANGIRNAGAR UNIVERSITY!
                          Dhaka,Bangladesh!
*/

#include <bits/stdc++.h>
#include <set>
using namespace std;

#define           fasterIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define           Im int main()
#define           ll long long
#define           sc scanf
#define           pf printf
#define           rn0 return 0
#define           rn return
#define           f0(i,n) for(ll i=0;i<n;i++)
#define           f1(i,n) for(ll i=1;i<=n;i++)
#define           f2(i,n) for(ll i=n-1;i>=0;i--)
#define           pi 2*acos(0.0)
#define           modulo 1000003
#define           dd double
#define           PI 3.14159265358979
#define           pi 2*acos(0.0)
#define           p_b push_back
#define           ps push

/*
ll for_binarySearch(ll a,ll b,ll aa[],ll x){while(a<=b){ll mid=(a+b)/2;if(aa[mid]==x) return 1;else if(aa[mid] > x) b=mid-1;else a=mid+1;}return -1;}
ll for_gcd(ll a,ll b){if(a==0) return b;else return for_gcd(b%a,a);}
ll for_prime(ll x){for (ll i=2;i*i<=x;i++){if(x%i==0) return 0;}return 1;}
void for_swap(char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
ll for_big_mod(ll b,ll p,ll m){if(p==0) return 1;else if(p%2==0){ll k=for_big_mod(b,p/2,m);return (k*k)%m;}else return ((b%m)*(for_big_mod(b,p-1,m)))%m;}
ll for_josephus(ll n,ll k){if(n==1) return 1;return (for_josephus(n-1,k)+k-1)%n+1;}
ll for_gcdExtended(ll a,ll b,ll *x,ll *y){if(a==0){*x=0;*y=1;return b;}ll x1,y1;ll gcd=for_gcdExtended(b%a,a,&x1,&y1);*x=y1-(b/a)*x1;*y=x1;return gcd;}
*/
/*
void debug1()
{
    cout << "***" << endl;
}

void debug11(ll n)
{
    cout << n << endl;
}
*/

Im
{
    /*#ifdef FAT
       freopen("input.txt","w",stdin);
    #endif // FAT*/

    fasterIO;
    ll n;
    cin>>n;
    cout << (n*n*n) << endl;

   // main();

    rn0;
}

Measured memory_bytes: 3124
package main

import (
	"fmt"
)

func main() {
	var A, B int
	fmt.Scan(&A, &B)
	fmt.Println((A * B) / gcd(A, B))
}

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


Measured memory_bytes: 512
#include<stdio.h>
main(){
  int i,x,y;
  for(i=1;;i++){
    scanf("%d %d",&x,&y);
    if(x==0 && y==0)
    break;
    if(x>y)printf("%d %d\n",y,x);
    else printf("%d %d\n",x,y);
  }
  return 0;
}



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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    vector<Pll> ws(N);
    for (ll i = 0; i < N; i++) {
        cin >> ws[i].second >> ws[i].first;
    }
    sort(ws.begin(), ws.end());

    bool ok = true;
    ll cur = 0;
    for (ll i = 0; i < N; i++) {
        cur += ws[i].second;
        if (cur > ws[i].first) ok = false;
        if (!ok) break;
    }

    cout << (ok ? "Yes\n" : "No\n");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const int mod=1000000000+7;

int addm(int& a,int b) {return (a+=b)<mod?a:a-=mod;}

template<class T,class U> bool smin(T& a,U b) {return a>b?(a=b,1):0;}
template<class T,class U> bool smax(T& a,U b) {return a<b?(a=b,1):0;}

vi al[100000];
bool vis[100000];
int n,m;

vi a[2];

void dfs(int i,int q) {
	vis[i]=1;
	for (int j:al[i]) if (!vis[j]) {
		dfs(j,q);
		break;
	}
	a[q].push_back(i);

}

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

	cin >> n >> m;
	for (int i=0;i<m;i++) {
		int u,v;cin >> u >> v;
		u--;v--;
		al[u].push_back(v);
		al[v].push_back(u);
	}

	dfs(0,0);
	dfs(0,1);
	a[1].pop_back();
	reverse(a[1].begin(),a[1].end());
	a[0].insert(a[0].end(),a[1].begin(),a[1].end());
	cout << a[0].size() << endl;
	for (int i=0;i<a[0].size();i++) {
		if (i) cout << ' ';
		cout << a[0][i]+1;
	}
	cout << endl;
}

Measured memory_bytes: 9720
import std;

const MOD = 10^^9 + 7;

long modPow(long x, long k, long m) {
    if (k == 0) return 1;
    if (k % 2 == 0) return modPow(x * x % m, k / 2, m);
    return x * modPow(x, k - 1, m) % m;
}

long calc(int n, int k) {
    long[long] memo;
    for (int g = k; g >= 1; g--) {
        long cnt = modPow(k / g, n, MOD);
        for (int i = g + g; i <= k; i += g) {
            cnt -= memo[i];
            if (cnt < 0) cnt += MOD;
        }
        memo[g] = cnt;
    }

    long ans = 0;
    foreach (g, cnt; memo) {
        auto x = g * cnt % MOD;
        ans = (ans + x) % MOD;
    }
    return ans;
}

void main() {
    int n, k; scan(n, k);
    writeln(calc(n, k));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


Measured memory_bytes: 8224
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define pb push_back
#define fst first
#define snd second
#define ALL(cont) cont.begin(), cont.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define fore(i, a, b) for (int i = a, almo5t = b; i < almo5t; ++i)
#define SZ(x) ((int)x.size())
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const int mod = 1e9+7;
const int MAXN = 3005;

ll dp[MAXN][MAXN], pr[MAXN][MAXN];


int main()
{
    FIN;
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#define endl '\n'
#endif
    int N;
    string s;
    cin>>N;
    cin>>s;
    dp[1][1] = 1;
    pr[1][1] = 1;
    fore(len, 2, N+1){ 
        fore(b,1,len+1){
            int L, R;
            if(s[len-2] == '<'){
                L = 0;
                R = b-1;
            } else
            {
                L = b;
                R = len-1;
            }
            dp[len][b] += pr[len-1][R] - pr[len-1][L-1];
            dp[len][b]%=mod;
            // fore(i,L,R+1){
            //     dp[len][b] += dp[len-1][i];
            //     dp[len][b]%=mod;
            // }

            pr[len][b] = pr[len][b-1] + dp[len][b];
        }
    }
    ll ans = 0;
    fore(i,1,N+1){
        ans = (ans + dp[N][i])%mod;
    }
    cout<<((ans)%mod+mod)%mod;
    return 0;
}


Measured memory_bytes: 95928
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    ll h, w;
    cin >> h >> w;
    if(h % 3 == 0 || w % 3 == 0) cout << 0 << endl;
    else{
        ll ans = h * w;
        for(int i = 1; i < w; i++){
            ll a = i * h;
            ll b = (w - i) * (h / 2);
            ll c = (w - i) * ((h + 1) / 2);
            ll m = max({a, b, c}) - min({a, b, c});
            ans = min(ans, m);
        }
        for(int i = 1; i < h; i++){
            ll a = i * w;
            ll b = (h - i) * (w / 2);
            ll c = (h - i) * ((w + 1) / 2);
            ll m = max({a, b, c}) - min({a, b, c});
            ans = min(ans, m);
        }
        ans = min({ans, w, h});
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int infI=1e9+5;
const long long infL=1e16;
const int MOD=1e9+7;
const int MAX=2e5+5;

#define mp make_pair
#define in &
#define pb push_back
#define ii pair<int,int>
#define iii pair<ii,int>
#define ll long long
#define pll pair<ll,ll>
#define vvl vector<vector<ll> >
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define eb emplace_back
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define popb pop_back()
#define se second
#define fi first
#define test(t) int t;cin>>t;while(t--)
#define debug(x) cerr<<"=>"<<#x<<" = "<<x<<endl

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    if(b==1){
        return a;
    }
    ll temp=power(a,b/2);
    temp=(temp*temp)%MOD;
    if(b%2){
        temp=(temp*a)%MOD;
    }
    return temp;
}

//only use if mod is prime
ll mod_inv(ll a,ll mod){
    a%=mod;
    return power(a,mod-2);
}

void extended_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return;
    }
    ll x1,y1;
    extended_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-((a/b)*y1);
    return;
}

//TLE can also occur if vectors are not passed by reference
//priority_queue implements max heap by default

int main(){
    fastio;
    int n;
    cin>>n;
    vi a(n),b(n);
    forn(i,0,n){
        cin>>a[i];
    }
    forn(i,0,n){
        cin>>b[i];
    }
    if(a>b){
        swap(a,b);
    }
    int ans = 0;
    while(a!=b){
        ++ans;
        next_permutation(a.begin(),a.end());
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
  string S;
  cin>>S;
  sort(S.begin(),S.end());
  if(S[0]==S[1]&&S[1]!=S[2]&&S[2]==S[3]){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
 return 0;}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    string s, t, l;
    int r, b;
    
    
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        s.replace(i, 1, "x");
    }
    
    
    
    cout << s;
    
}


Measured memory_bytes: 256
package main

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

func getScanner(fp io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 500001), 500000)
	return sc
}

func getHugeScanner(fp io.Reader, size int) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, size), size)
	return sc
}

func getNextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func getNextInt(sc *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(sc))
	return i
}

func getNextInt64(sc *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(sc), 10, 64)
	return i
}

func getNextFloat64(sc *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(sc), 64)
	return i
}

func DFS(color []int, to, cost [][]int, i, c int) {
	color[i] = c
	for k, v := range to[i] {
		if color[v] != -1 {
			continue
		}
		DFS(color, to, cost, v, color[i] ^ cost[i][k] % 2)
	}
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := getScanner(stdin)

	n := getNextInt(sc)

	to := make([][]int, n)
	cost := make([][]int, n)

	color := make([]int, n)

	for k := range color {
		color[k] = -1
	}

	for i := 1; i < n; i++ {
		u := getNextInt(sc)
		v := getNextInt(sc)
		w := getNextInt(sc)
		u--
		v--

		to[u] = append(to[u], v)
		to[v] = append(to[v], u)
		cost[u] = append(cost[u], w)
		cost[v] = append(cost[v], w)
	}

	DFS(color, to, cost, 0, 0)

	for _, v := range color {
		_, _ = fmt.Fprintf(stdout, "%v\n", v)
	}

}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 39808
K, S = map(int, input().split())
count = 0
for x in range(K+1):
    if K < 1/2 * (S - x):
        continue
    for y in range(min(S - x + 1, K + 1)):
        if K < (S - x - y):
            continue
        else:
            count += 1
print(count) 

Measured memory_bytes: 9184
#include<stdio.h>
#include<memory.h>
int main(){
	int n,i,j,k,e[1000],p[1000],q[1000];
	int c[1000],count=0,count2=0;
	int gokei=0;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(i=0;i<n;i++){
			scanf("%d %d %d",&e[i],&p[i],&q[i]);
			gokei=p[i]*q[i];
			for(j=0;j<i;j++){
				if(e[i]==e[j]){
					gokei+=p[j]*q[j];
				}
			}
			for(k=0;k<count;k++){
				if(e[i]==c[k]){
					goto a;
				}
			}
			if(gokei>=1000000){
				c[count]=e[i];
				count++;
			}
			a:
			gokei=0;
		}
		for(i=0;i<count;i++){
			printf("%d\n",c[i]);
		}
		if(count==0){
			printf("NA\n");
		}
		count=0;
		memset(c,0,sizeof(c));
	}
	
	return 0;
}

Measured memory_bytes: 2580
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

ll n,m;
char t[110][110];
ll dp[110][110];

ll f(ll x, ll y){
	ll &r=dp[x][y];
	if(r>=0)return r;
	if(x==0&&y==0){
		return r=(t[0][0]=='#');
	}
	r=1e9;
	if(x>0){
		r=min(r,f(x-1,y)+(t[x][y]=='#'&&t[x-1][y]=='.'));
	}
	if(y>0){
		r=min(r,f(x,y-1)+(t[x][y]=='#'&&t[x][y-1]=='.'));
	}
	return r;
}

int main(){FIN;
	cin>>n>>m;
	fore(i,0,n){
		fore(j,0,m){
			cin>>t[i][j];
		}
	}
	mset(dp,-1);
	cout<<f(n-1,m-1);
	
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	int length[200];
	int sum = 0;
	cin >> n;
	for (int i = 0; i < n*2; i++) {
		cin >> length[i] ;
	}
	sort(length, length + 2 * n);
	for (int i = 0; i < 2*n; i+=2) {
		sum += length[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 256