akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
	int x1,y1,x2,y2,x,y,i;
  	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
  
  	x=x2-x1;
  	y=y2-y1;
  
  	
      for(i=0;i<x;i++){
		printf("R");
      }
      for(i=0;i<y;i++){
		printf("U");
      }
      for(i=0;i<x;i++){
		printf("L");
      }
      for(i=0;i<y;i++){
		printf("D");
      }
      printf("D");
      for(i=0;i<x+1;i++){
		printf("R");
      }
      for(i=0;i<y+1;i++){
		printf("U");
      }
      printf("LU");
      for(i=0;i<x+1;i++){
		printf("L");
      }
      for(i=0;i<y+1;i++){
		printf("D");
      }
      printf("R");
}
      

Measured memory_bytes: 128
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x) cout << x << endl ; 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

int  a, b, c, d, e, f, l, r ; 
 
signed main() 
{ 
    ld density = -1.0;
    cin >> a >> b >> c >> d >> e >> f ; 
    a *= 100; b *= 100 ; 
    for (int i=0;i<=30;i++){ 
        if (a*i > f)  break ; 
        for (int j=0;j<=30;j++){
            int w = a*i+b*j;
            if (w > f )  break ; 
            int dissolve = min( f-w, (e*(a/100)*i + e*(b/100)*j) ) ; 
            for (int  ic = dissolve/c; w>0 and ic>=0 ; ic--){ 
                int cur = ( ic * c ) + ( (dissolve - ic*c ) / d ) * d ; 
                ld cur_density = (1.0*cur) / w ; 
                if (cur_density > density){
                    density = cur_density;
                    l = w+cur;
                    r = cur; 
                }
            }
        }
    }
    co( l << " " << r ) ; 
    return  0 ; 
} 

/* 
100 200 10 20 30 
   
*/ 


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

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        if(input[0]==input[1] && input[1] == input[2])
        {
            return "Yes";
        }

        return "No";
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 11092
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
using namespace std;
 
#define INF 1<<21
#define MOD 1000000007
 
int main(){
    char x,y;
    cin>>x>>y;
    if(x<y){
        cout<<"<"<<endl;
    }else if(x>y){
        cout<<">"<<endl;
    }else{
        cout<<"="<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,y;
    cin>>n>>y;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            if(10000*i+5000*j+1000*(n-i-j)==y){cout<<i<<" "<<j<<" "<<(n-i-j)<<endl;return 0;}
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
}


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

using namespace std;

int n;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int, P> PP;
vector<PP> z;
const ll INF = 1e14;

ll dp[5005][5005];
int main() {
  cin >> n;

  for(int i = 0; i < n; i++) {
    int h; int p;
    cin >> h >> p;  
    z.push_back(PP(h + p,P(h,p)));
  }
  sort(z.begin(),z.end());

  for(int i = 0; i < n; i++) fill(dp[i],dp[i]+n+1,INF);

  dp[0][0] = 0;
  dp[0][1] = z[0].second.second;

  for(int i = 1; i < n; i++) {
    for(int j = 1; j <= i + 1; j++) {
      if(z[i].second.first >= dp[i-1][j-1]) {
	dp[i][j] = min(dp[i-1][j-1] + z[i].second.second, dp[i-1][j]);
      }
      else dp[i][j] = dp[i-1][j];
      //  cout << dp[i][j] << endl;
    }
  }
  int ans = 0;
  for(int i = 0; i <= n; i++) {
    if(dp[n-1][i] != INF) ans = max(ans,i);
  }

  cout << ans << endl;
}
      

  

    
  


Measured memory_bytes: 195968
<?php
  	$num = str_split(trim(fgets(STDIN)));
	if($num[count($num)-1] == 3){
    	echo 'bon';
    }elseif($num[count($num)-1]==0||$num[count($num)-1]==1||
            $num[count($num)-1]==6||$num[count($num)-1]==8){
    	echo 'pon';
    }else{
    	echo 'hon';
    }
  
?>

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

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    string x;
    cin>>x;
    list<char> data;
    for(auto i : x){
        if(i != 'B')
            data.push_back(i);
        else if(!data.empty()){
            data.pop_back();
        }
    }
    for(auto i : data){
        cout<<i;
    }
    cout<<endl;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
def rotate_counter(vec):
  return (-vec[1], vec[0])


def apply(point, vec):
  return (point[0] + vec[0], point[1] + vec[1])


def main():
  (x1, y1, x2, y2) = map(int, input().split())
  vec = (x2 - x1, y2 - y1)

  vec = rotate_counter(vec)
  (x3, y3) = apply((x2, y2), vec)

  vec = rotate_counter(vec)
  (x4, y4) = apply((x3, y3), vec)

  print(x3, y3, x4, y4)


if __name__ == '__main__':
  main()



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

#define infi            5e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)

using namespace std;

inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}

// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
    //freopen("in.txt", "r", stdin);

    int w=rr,h=rr,n=rr;
    
    int max_x=w,min_x=0,max_y=h,min_y=0;
    int x,y,a;
    loop(i,n){
        x=rr;y=rr;a=rr;
        if(a==1)min_x = max(min_x,x);
        else if(a==2)max_x = min(max_x,x);
        else if(a==3)min_y = max(min_y,y);
        else if(a==4)max_y = min(max_y,y);
    }
    if(max_x<=min_x || max_y<=min_y)cout << 0 << endl;

    else cout << (max_x-min_x) * (max_y-min_y) << endl;

    return 0;
}

Measured memory_bytes: 256
S = str(input())
ans = 'No'
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2] \
    or S[0]==S[2] and S[1] == S[3] and S[0]!=S[1] \
    or S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]:
    ans = 'Yes'
print(ans)

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

const ll INF = (1LL<<31)-1;

template <typename T>
struct RSQ{

    int n = 1;
    vector<T> rsq;

    RSQ(int sz){
        while(n<sz) n*=2;
        rsq.resize(n*2+10);
    }

    void add(int i, T x){
        i += (n-1);
        rsq[i] += x;
        while(i>0){
            i = (i-1)/2;
            rsq[i] = rsq[i*2+1] + rsq[i*2+2];
        }
    }

    T getSum(int a, int b, int i, int l, int r){
        if(r<=a || b<=l) return 0;

        if(a<=l && r<=b) return rsq[i];
        else{
            T vl = getSum(a,b,i*2+1,l,(l+r)/2);
            T vr = getSum(a,b,i*2+2,(l+r)/2,r);
            return vl + vr;
        }
    }
};

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

    int N=1;
    while(N<n) N*=2;

    RSQ<ll> rsq(n);
    rep(i,q){
        int c; cin >> c;

        if(c){
            int s,t; cin >> s >> t;
            s--;t--;
            cout << rsq.getSum(s,t+1,0,0,N) << endl;
        }else{
            int x,y; cin >> x >> y;
            x--;
            rsq.add(x,y);
        }
    }
}


Measured memory_bytes: 4908
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    
    int K = scanner.nextInt();
    int N = scanner.nextInt();
    int locations[] = new int[N];
    
    for(int i = 0;i < locations.length;i++){
      locations[i] = scanner.nextInt();
    }
    
    int sumDistance = 0;
    int maxDistance = locations[1] - locations[0];
    sumDistance += maxDistance;
    
    for(int i = 2;i < locations.length;i++){
        
      
      int distance = Math.abs(locations[i - 1] - locations[i]);
      
      sumDistance += distance;
      if(distance > maxDistance){
        maxDistance = distance;
      }
      
      if(i == locations.length - 1){
        distance = Math.abs(K - locations[i]) + locations[0];
        sumDistance += distance;
        if(distance > maxDistance){
          maxDistance = distance;
        }
      }
    }
    
    sumDistance -= maxDistance;
    System.out.println(sumDistance);
  }
}

Measured memory_bytes: 85324
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<char>v[105];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a,b,r=0,c=0;
    cin>>a>>b;
    for(int i=0; i<50; i++)
    {
        for(int j=0; j<100; j++)
            v[i].push_back('.');
    }
    for(int i=50; i<100; i++)
    {
        for(int j=0; j<100; j++)
            v[i].push_back('#');
    }
    a--,b--;
    for(int i=0; i<50 && b; i+=2)
    {
        for(int j=0; j<100 && b; j+=2)
        {
            v[i][j]='#';
            b--;
        }
    }
    for(int i=99; i>=50 && a; i-=2)
    {
        for(int j=0; j<100 && a; j+=2)
        {
            v[i][j]='.';
            a--;
        }
    }
    cout<<"100 100"<<endl;
    for(int i=0; i<100; i++)
    {
        for(int j=0; j<100; j++)
            cout<<v[i][j];
        cout<<endl;
    }





    return 0;
}


Measured memory_bytes: 3668
// 2011/08/21 Tazoe

#include <iostream>
using namespace std;

void radix(int n)
{
	if(n/4!=0)		// nª0ÌÆ«ÉC0ÆoÍ³êéæ¤É
		radix(n/4);

	cout << n%4;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==-1)
			break;

		radix(n);
		cout << endl;
	}

	return 0;
}

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


int main() {
    ll N, x;
    cin >> N >> x;
    ll A[N];
    rep(i, N) cin >> A[i];
    ll count = 0;
    rep(i, N) {
        if (A[i] > x) {
            count += A[i] - x;
            A[i] = x;
        }
    }
    loop(i, 1, N) {
        ll sum = A[i - 1] + A[i];
        if (sum > x) {
            count += sum - x;
            A[i] -= (sum - x);
        }
    }
    cout << count << endl;
    return 0;
}



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

signed main(){
  int A,B;
  cin>>A>>B;
  int ans=-1;
  int i=0;
  while(i<=1009){
    int H=i*0.08;
    int Z=i*0.1;
    if(H==A&&Z==B){
      ans=i;
      cout<<ans<<endl;
      return 0;
    }else{
      i++;
    }
  }
  cout<<ans<<endl;
}

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

int main(){
    int A1,A2,A3; cin >> A1 >> A2 >> A3;
    A1+A2+A3 >= 22 ? cout << "bust" << endl : cout << "win" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();i+=2)
		cout<<s[i];
	cout<<endl;
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;

int main()
{
	queue<int> E;
	map<int, int> R;
	int n, e, p, q;
	while (cin >> n) {
		if (n == 0) break;
		R.clear();
		for (int i = 0; i < n; i++) {
			cin >> e >> p >> q;

			if (R[e] > 0) {
				R[e] += p * q;
			}
			else {
				R[e] = p * q;
				E.push(e);
			}
		}

		bool f = true;
		while (E.size() != 0) {
			int ep = E.front(); E.pop();
			if (R[ep] >= 1000000) {
				cout << ep << endl;
				f = false;
			}
		}

		if (f) cout << "NA" << endl;
	}
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int x,y;
    cin>>x>>y;
    string flag="No";
    for(int i=0;i<=x;i++){
        if(i*2+(x-i)*4==y){
            flag="Yes";
            break;
        }
    }
    cout<<flag<<endl;

    return 0;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
char s[666];
int L;
int main(void){
    scanf("%s",s),L=strlen(s);
    F(L-1)if(s[i]==65&&s[i+1]==67)return puts("Yes"),0;
    puts("No");
    return 0;
}


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

int A[1005][1005];
int p[1005];
bool use[1005];
int n;

bool al() {
  bool a = true;
  for(int i = 0; i < n; i++) {
    if(p[i] == n - 1) continue;
    a = false;
  }

  return a;
}

void init_u() {
  for(int i = 0; i < n; i++) use[i] = false;
}

int main() {
  cin >> n;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n - 1; j++) {
      cin >> A[i][j];
      A[i][j]--;
    }
  }
  int ans = 0;
  queue<int> q,nextq;
  for(int i = 0; i < n; i++) q.push(i);

  while(true) {
    init_u();
    while(!q.empty()) {
      int i = q.front();
      q.pop();
      if(use[i] || p[i] == n - 1) continue;
      if(!use[A[i][p[i]]] && i == A[A[i][p[i]]][p[A[i][p[i]]]]) {
	use[i] = true;
	use[A[i][p[i]]] = true;
	nextq.push(i);
	nextq.push(A[i][p[i]]);
	p[A[i][p[i]]]++;
	p[i]++;
      }
    }
    ans++;
 
    if(nextq.empty()) {
      cout << -1 << endl;
      return 0;
    }

   
  if(al()) {
    cout << ans << endl;
    return 0;
  }

  swap(q,nextq);
  }

}
  
    

 
  
  
  


Measured memory_bytes: 4224
#include <cmath>
#include <iostream>
#include <utility>

using namespace std;

int main() {
  const double pi = acos(-1);
  double x = 0, y = 0, angle = 90;
  int dis, dir;
  char c;
  while (true) {
    cin >> dis >> c >> dir;
    if (dis == 0 && dir == 0) break;
    x += dis * cos(angle * pi / 180.0);
    y += dis * sin(angle * pi / 180.0);
    angle -= dir;
  }
  cout << (int)x << '\n' << (int)y << endl;
}

Measured memory_bytes: 3332
#akash mandal: jalpaiguri government engineering college
import sys,math

def ii(): return int(input())
def mii(): return map(int,input().split())
def lmii(): return list(mii())


def main():
    a,b,c,d=mii()
    if a>b:
        a,b=b,a
    if c>d:
        c,d=d,c
    print(max(a*c,b*d,a*d,b*c))
if __name__=="__main__":
    main()

Measured memory_bytes: 62052
#include <iostream>

using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;

    cin >> n;
    for(int i=0; i < n; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for(int i=1; i<n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;
    return 0;
}



Measured memory_bytes: 3880
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

ll dp[100005] = {};

ll PowMod(ll a, ll n){
	if(n < 0) return PowMod(PowMod(a, -n), MOD-2);
	if(n == 0) return 1;
	if(n == 1) return a;
	if(n%2 == 0) return PowMod(a*a%MOD, n/2);
	return a*PowMod(a*a%MOD, n/2)%MOD;
}

int main(void){
	ll n, k;
	cin >> n >> k;

	repnr(i, k){
		dp[i] = PowMod(k / i, n);
		repn(j, k){
			if(j == 1) continue;
			if(i * j > k) break;
			dp[i] -= dp[i * j];
		}
		dp[i] %= MOD;
		if(dp[i] < 0) dp[i] += MOD;
	}

	ll ans = 0;
	repn(i, k){
		ans += dp[i] * i;
		ans %= MOD;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 4328
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long


int n, m;
int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  scanf("%d%d", &n, &m);
  int ans = 0;
  if(n >= 2) ans += n * (n - 1) / 2;
  if(m >= 2) ans += m * (m - 1) / 2;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	Scanner sc = new Scanner(System.in);
	
	private void doit(){
		while(sc.hasNext()){
			solve();
		}
	}

	private void solve() {
		int n = sc.nextInt();
		int [] freq = new int[6];
		for(int i = 0; i < n; i++){
			double weight = sc.nextDouble();
			boolean flg = false;
			for(int j = 0; j <= 4; j++){
				if(weight < 165.0 + (5 * j)){
					freq[j]++;
					flg = true;
					break;
				}
			}
			if(! flg){
				freq[5]++;
			}
		}
		for(int i = 0; i < 6; i++){
			System.out.print((i + 1) + ":");
			for(int j = 0; j < freq[i]; j++){
				System.out.print("*");
			}
			System.out.println();
		}
	}

	private void debug(Object... o) { System.out.println("debug = " + Arrays.deepToString(o)); }

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

Measured memory_bytes: 18420
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int ans=to_string(n).size();
  for(int i=1;i*i<=n;i++){
    if(n%i) continue;
    ans=min(ans,max((int)to_string(i).size(),(int)to_string(n/i).size()));
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  int r = 0;
  int m = 0;
  int N;
  cin >> N;

  vector<int> height(N); // N個の山の高さのデータ

  // 標高のデータを受け取る
  for (int i = 0; i < N; i++) {
    cin >> height.at(i);
  }
  // 最大値のチェックと宿数チェック
  for (int i = 0; i < N; i++) {
    if (m <= height.at(i)) {
      m = height.at(i) , r = r+1;
    }
    if (m > height.at(i)){
      m = m , r = r;
    }
  }
   cout << r << endl;
}


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

int main(){
  long long n;
  cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  int p = 0, q = 0;
  for(int i = 0; i < n; i++){
    if(a[i] % 2 == 0) p++;
    else q++;
  }
  if(q % 2 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct tree{
    size_t n,r,m,md;
    vector<vector<int>> e;
    vector<int> pa,d;
    vector<vector<int>> lc;
    explicit tree(int n_){
        n=n_;
        e.resize(n);
    }
    void add(int a,int b){
        e[a].emplace_back(b);
    }
    void r_dfs(int i,int p=-1,int D=0){
        pa[i]=p;d[i]=D;md=max(md,(size_t)D);++D;
        for(auto j:e[i]) r_dfs(j,i,D);
    }
    void r_i(int r_){
        pa.resize(n);d.resize(n);r=r_;md=0;
        r_dfs(r);
    }
    void b_lca(int r_){
        r_i(r_);
        m=1;int c=1;
        while(c<=md) ++m,c*=2;
        lc.resize(n,vector<int>(m,-1));
        fr(i,n) lc[i][0]=pa[i];
        fr(i,n) fr(j,m-1) if(lc[i][j]!=-1) lc[i][j+1]=lc[lc[i][j]][j];
    }
    int lca(int a,int b){
        if(a==b) return a;
        if(d[a]>d[b]) swap(a,b);
        if(d[a]!=d[b]) ifr(i,m) if((lc[b][i]!=-1)&&(d[a]<d[lc[b][i]])) b=lc[b][i];
        if(d[a]!=d[b]) b=pa[b];
        if(a==b) return a;
        ifr(i,m) if(lc[a][i]!=lc[b][i]) a=lc[a][i],b=lc[b][i];
        if(a!=b) a=pa[a];
        return a;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k,c;
    cin>>n;
    tree t(n);
    fr(i,n){
        cin>>k;
        fr(j,k) cin>>c,t.add(i,c);
    }
    t.b_lca(0);
    cin>>n;
    fr(_,n) cin>>k>>c,cout<<t.lca(k,c)<<endl;
}


Measured memory_bytes: 22600
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007LL;
int a[100000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N);
	int cnt = 1;
	for (int i = 1; i < N; i++) if (a[i] != a[i - 1]) cnt++;
	if (cnt == 1) {
		if (a[0] == N - 1 || a[0] * 2 <= N) cout << "Yes" << endl;
		else cout << "No" << endl;
		return 0;
	}
	else if (cnt == 2) {
		int k = 0;
		for (int i = 0; i < N; i++) if (a[i] == a[0]) k++;
		if (a[N-1]-a[0]==1 && a[N-1]>k && k + (a[N - 1] - k) * 2 <= N) cout << "Yes" << endl;
		else cout << "No" << endl;
		return 0;
	}
	cout << "No" << endl;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	
	int sum = a + b;
	int sub = a - b;
	int mul = a * b; 
	
	cout << max({sum, sub, mul}) << endl;
}


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

using namespace std;

int a[100010];

map<int, int> pos;

int main(void) {


	int n;
	cin>>n;
	
	for(int i = 0; i < n; ++i) {
		cin>>a[i];
		pos[a[i]] = i;
	}
	sort(a, a+n);

	int ans = 0;
	for(int i = 0; i < n; ++i) {
		int elem = a[i];
		if(i%2 != pos[elem]%2) {
			ans++;
		}
	}

	ans /= 2;

	cout<<ans;

	return 0;
}

Measured memory_bytes: 5376
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace Topic02
{
    class ALDS1_2_B
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            int[] A = ReadLine().Split()
                .Select(n => int.Parse(n)).ToArray();

            int result = 0;
            for (int i = 0; i < N; i++)
            {
                int minJ = i;
                for (int j = i; j < N; j++)
                {
                    if (A[j] < A[minJ])
                        minJ = j;
                }
                if (A[i] != A[minJ]) result++;
                int tmp = A[i];
                A[i] = A[minJ];
                A[minJ] = tmp;
            }

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < N; i++)
            {
                sb.Append(A[i]);
                sb.Append(" ");
            }
            WriteLine(sb.Remove(sb.Length - 1, 1));
            WriteLine(result.ToString());
            ReadKey();
        }
    }
}


Measured memory_bytes: 18284
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

#include <vector>
#include <set>
#include <functional>
using namespace std;

vector<pair<int,int>> lowlink(const vector<vector<int>>& G){
  vector<pair<int,int>> bridge;
  //vector<int> articulation;
  int n = G.size();
  vector<int> used(n,false),ord(n,0),low(n,0);
  function<int(int,int,int)> dfs = [&](int v,int k,int f){
    used[v] = true;
    ord[v] = k++;
    low[v] = ord[v];
    int cnt = 0;
    bool is_articulation = false;
    for(auto & to : G[v]){
      if(!used[to]){
        cnt++;
        k = dfs(to,k,v);
        low[v] = min(low[v] , low[to]);
        is_articulation |= (f != -1) && low[to] >= ord[v]; 
        if(ord[v] < low[to]) bridge.push_back({min(v,to),max(v,to)});
      }
      else if(to != f){
        low[v] = min(low[v] , ord[to]);
      }
    }
    is_articulation |= f == -1 && cnt > 1;
    //if(is_articulation) articulation.push_back(v);
    return k;
  };
  dfs(0,0,-1);
  return bridge;
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<int>> G(N);

  rep(i,0,M - 1){
    int a,b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  auto ans = lowlink(G);

  sort(all(ans));
  for(auto p : ans){
    cout << p.first << " " << p.second << endl;
  }
}



Measured memory_bytes: 4872
#include<iostream>

using namespace std;

int main(void)
{
  int n;
  string s; cin>>n>>s;
  int x=0;
  int max=0;
  
  for(int i=0;i<n;i++){
    if(s[i]=='I'){x++;}
    else{x--;}
    if(max<x){max=x;}
  }
  
  cout<<max<<endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = [int(i) for i in input().split()]

count = 0
count_max = 0

for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1
    
    else:
        count_max = max(count, count_max)

        count = 0

count_max = max(count, count_max)

print(count_max)

Measured memory_bytes: 14252
//https://atcoder.jp/contests/abc179/tasks/abc179_d
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

const int MAXN=2e5+4;
long long ans[MAXN];//递推答案
long long sum[MAXN];//前缀和

const int MAXK=10+4;
pair<int, int> seg[MAXK];//区间

const int MO=998244353;

int main() {
    int n,k;
    cin>>n>>k;
    for (int i=1; i<=k; i++) {
        cin>>seg[i].first>>seg[i].second;
    }

    //初始化
    ans[1]=1;
    sum[1]=1;

    for (int i=2; i<=n; i++) {
        for (int j=1; j<=k; j++) {
            int l=seg[j].first;
            int r=seg[j].second;

            ans[i]=(ans[i]+sum[max(0, i-l)]-sum[max(0, i-r-1)]+MO)%MO;
        }
        sum[i]=(sum[i-1]+ans[i])%MO;
    }

    cout<<ans[n]<<"\n";

    return 0;
}

Measured memory_bytes: 6688
#include <stdio.h>
#include<string.h>
#define N 36
#define TRUE 1
#define FALSE 0

typedef struct{
  char mark;
  short number;
  short tag;
}Card;


void SwapCard(Card *C, int i, int j){
  Card tmp;
  tmp = C[i];
  C[i] = C[j];
  C[j] = tmp;
}

int IsStable(Card *C,int n){
  int i;

  for(i=1; i<n; i++){
    if(C[i].number == C[i-1].number){
      if(C[i].tag < C[i-1].tag){
	      return FALSE;
      }
    }
  }
  return TRUE;
}
  
void BubbleSort(Card *C, int n){
  int i,j;
  Card copy[N];

  for(i=0; i<n; i++){
    copy[i] = C[i];
  }

  for(i=0; i<n-1; i++){
    for(j=n-1; j>i; j--){
      if(copy[j].number < copy[j-1].number){
      	SwapCard(copy,j,j-1);
      }
    }
  }

  for(i=0; i<n; i++){
    printf("%c%d",copy[i].mark, copy[i].number);
    if(i!=n-1) printf(" ");
  }
  printf("\n");
  
  if(IsStable(copy,n))printf("Stable\n");
  else printf("Not Stable\n");
  
}

void SelectionSort(Card *C, int n){
  int i,j,min;
  Card copy[N];

  for(i=0; i<n; i++){
    copy[i] = C[i];
  }

  for(i=0; i<n; i++){
    min = i;
    for(j=i; j<n; j++){
      if(copy[min].number > copy[j].number){
	      min = j;
      }
    }
    SwapCard(copy,i,min);
  }

  for(i=0; i<n; i++){
    printf("%c%d",copy[i].mark, copy[i].number);
    if(i!=n-1) printf(" ");
  }
  printf("\n");

  if(IsStable(copy,n)) printf("Stable\n");
  else printf("Not stable\n");
  
}

int main(){
  int i,n;
  char input[3];
  Card C[N];

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s",input);
    C[i].mark = input[0];
    C[i].number = input[1] - 48;
    C[i].tag = i;
  }

  BubbleSort(C,n);
  SelectionSort(C,n);

  return 0;
}



Measured memory_bytes: 2108
/*
 * 1023.c: Amazing Graze
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* constant */

#define MAX_AN	(100000)
#define MAX_CRD	(10000)
#define NUM_DIV	(200)

/* typedef */

typedef struct _point_t {
  int x, y;
  struct _point_t *next;
} point_t;

/* main */

int main(int argc, char **argv) {
  int i;
  int an, bn, r, r4, rr4;
  int sql;
  int ax, ay, bx, by, dx, dy;
  int xi, yi, id, bxi, byi, dxi, dyi;
  long power;
  point_t *pt, *pt0;
  static point_t pts[MAX_AN], *ars[NUM_DIV * NUM_DIV];
  static int npt;

  sql = MAX_CRD / NUM_DIV;

  for (;;) {
    scanf("%d", &an);
    scanf("%d", &bn);
    scanf("%d", &r);
    if ((an | bn | r) == 0) break;

    r4 = r * 4;
    rr4 = r4 * r4;

    bzero(ars, sizeof(point_t *) * NUM_DIV * NUM_DIV);
    npt = 0;

    for (i = 0; i < an; i++) {
      scanf("%d %d", &ax, &ay);

      xi = ax / sql;
      yi = ay / sql;

      id = yi * NUM_DIV + xi;
      pt = &(pts[npt++]);
      pt->x = ax;
      pt->y = ay;
      pt->next = ars[id];
      ars[id] = pt;
    }

    power = 0;

    for (i = 0; i < bn; i++) {
      scanf("%d %d", &bx, &by);

      bxi = bx / sql;
      byi = by / sql;

      for (dxi = -1; dxi <= 1; dxi++) {
	xi = bxi + dxi;
	if (xi < 0 || xi >= NUM_DIV) continue;

	for (dyi = -1; dyi <= 1; dyi++) {
	  yi = byi + dyi;
	  if (yi < 0 || yi >= NUM_DIV) continue;

	  pt = ars[yi * NUM_DIV + xi];
	  while (pt != NULL) {
	    dx = pt->x - bx;
	    dy = pt->y - by;
	    if (dx * dx + dy * dy <= rr4) power++;
	    pt = pt->next;
	  }
	}
      }
    }

    printf("%ld\n", power);
  }

  return 0;
}

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

bool check(vector<P> s){
  int h = 0;
  for (P p : s){
    int b =h+p.first;
    if (b <0) return false;
    h += p.second;
  }
  return true;

}
int main(){
  int n;
  cin >>n;
  vector<P> ls,rs;
  int total =0;
  rep(i,n){
    string s;
    cin >>s;
    int h =0, b=0;
    for (char c :s){
      if(c=='(') ++h; else  --h;
      b=min(b,h);
    }
    if (h>0) ls.emplace_back(b,h);
    else rs.emplace_back(b-h,-h);
    total +=h;
  }
  sort(ls.rbegin(),ls.rend());
  sort(rs.rbegin(),rs.rend());
  if (check(ls) && check(rs) && total==0){
    cout <<"Yes"<<endl;
  }else{
    cout << "No"<<endl;
  }
}


Measured memory_bytes: 18912
#include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>


using namespace std;

const int N = 100000 + 5;
int a[N];


int main(){

    int n, k;
    while(cin >> n >> k){

    int pos;


    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] == 1){
            pos = i;
        }
    }

    pos = max(pos, k);
    pos = min(n - k + 1, pos);

    int ans = 0;
    int tmp = pos;
    while(tmp > 1){
        ans++;
        tmp -= (k - 1);
    }
    tmp = pos;
    while(tmp < n){
        ans++;
        tmp += (k - 1);
    }
    if( k != 2 && pos > k && pos < (n - k + 1)){
        ans--;
    }
    cout << ans << endl;
    }
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define ran 101101

char s[ran];
int len;

int main() {
	scanf("%s", s);
	len = strlen(s);
	
	int ans1=0, ans2=0;
	for(int i=0;i<len;i++) {
		if (s[i]-'0'!=i%2) ans1++;
		if (s[i]-'0'==i%2) ans2++;
	}
	printf("%d\n", min(ans1, ans2));
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        v[i] -= c[i];
    }
    SORT(v);
    int ans = 0;
    REP(i, n){
        if(v[i] <= 0) continue;
        ans += v[i];
    }

    pr(ans);
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    if s.iter().cloned().collect::<HashSet<_>>().len() != 2 {
        println!("No");
        return;
    }
    if s.iter().filter(|&&x| x == s[0]).count() == 2 {
        println!("Yes");
    } else {
        println!("No");
    }
}

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()
}


Measured memory_bytes: 2116
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll a,b,c,d;
    cin >> a>>b>>c>>d;
    cout << min(a,b)+min(c,d)<<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>

#define N_size 100000000000

using namespace std;

int main(){
    int N,wordsuu,copysuu;
    cin  >> N;
    vector<string> W(N),copyW(N);
    bool shiritori = true;
    
    for(int i = 0;i < N;i++){
        cin >> W.at(i);
        copyW.at(i) = W.at(i);
    }

    sort(copyW.begin(),copyW.end());
    copyW.erase(unique(copyW.begin(),copyW.end()),copyW.end());

    copysuu = copyW.size();


    if(copysuu != N)
        shiritori = false;
    
    char kashiramoji;

    for(int i = 0;i < N;i++){
        wordsuu = W.at(i).size();
        if(i >= 1 && kashiramoji == W.at(i).at(0)){
            kashiramoji = W.at(i).at(wordsuu -1);
        }else if(i == 0){
            kashiramoji = W.at(i).at(wordsuu -1);
        }else{
            shiritori = false;
            break;
        }
    }

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


}

Measured memory_bytes: 256
/*
** Author: MAC45
*/

#include<bits/stdc++.h>
using namespace std;
main()
{
    int N,M,p=0;
    cin>>N>>M;
    int A[N];
    float v,sum=0;
    for(int i=0; i<N; i++)
        cin>>A[i],sum+=A[i];
    sort(A,A+N);
    for(int i=N-1; i>=0; i--)
    {
        v=ceil(sum/(4*M));
        if(v<=A[i])
            p++;
        if(p==M)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	ld pr = (ld)1/n;
	ld ans = 0;
	for(int i=1;i<=n;i++){
		if(i >= k){
			ans += 1;
			continue;
		}
		int t = 1;
		while(i*(1<<t) < k) t++;
		// cout<<i<<" "<<t<<endl;
		ans += (1/(ld)(1<<t));

	}
	ans *= pr;
	cout<<fixed<<setprecision(20);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
const int mn[10]={0,2,5,5,4,5,6,3,7,6};
int n,m,cnt[10101],a[11];
int main()
{
	for(int i=0;i<10050;i++)
	{
		cnt[i]=-1;
	}
	cin>>n>>m;
	cnt[0]=0;
	for(int i=1;i<=m;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+m);
	reverse(a+1,a+1+m);
	for(int i=1;i<=m;i++)
	{
		for(int j=mn[a[i]];j<=n;j++)
		{
			if(cnt[j-mn[a[i]]]!=-1)
			{
				cnt[j]=max(cnt[j],cnt[j-mn[a[i]]]+1);
			}
		}
	}
	while(n)
	{
		for(int i=1;i<=m;i++)
		{
			if(n-mn[a[i]]>=0 && cnt[n]-cnt[n-mn[a[i]]]==1)
			{
				n-=mn[a[i]];
				cout<<a[i];
				break;
			}
		}
	}
	cout<<endl;
	return 0;
}

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

bool check(string s, string t) {
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    
    int n = min(s.size(), t.size());
    for (int i=0; i< n; i++) {
        if (s[i] < t[i])
            return true;
        else if (s[i] > t[i])
            return false;
        else
            continue;
    }
    
    // 短い方の文字列が大きい方に含まれる場合
    if (s.size() < t.size()) // sの方が短ければtrue
        return true;
    else
        return false;
}

int main(void){
    // Your code here!
    string s, t;
    cin >> s >> t;
    bool x = check(s, t);
    if (x)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
// clang-format

#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;

using lli = long long int;

void solve(string a, string b) {

  string c,d;
  int aa = stoi(a);
  int bb = stoi(b);
  rep(i,aa) c += b;
  rep(i, bb) d += a;
  if(c>d){
    cout << d << endl;
  }else{
    cout << c << endl;
  }


}

int main() {
  string a, b;
  cin >> a >> b;
  solve(a, b);
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var d, n int
	fmt.Scan(&d, &n)

	if n == 100 {
		n++
	}
	if d == 0 {
		fmt.Println(n)
	} else if d == 1 {
		fmt.Println(n * 100)
	} else if d == 2 {
		fmt.Println(n * 10000)
	}
}


Measured memory_bytes: 512
open String
open Str

let rec sort swapOccurred (result: int list) (list: int list) =
  match list with
  | [] ->
    if swapOccurred then sort false [] (List.rev result)
    else List.rev result
  | x :: y :: tail ->
    if x <= y then sort swapOccurred (x :: result) (y :: tail)
    else sort true (y :: result) (x :: tail)
  | x :: tail -> sort swapOccurred (x :: result) [];;

let rec string_of_list result list =
  match list with
  | [] -> result
  | x :: tail ->
    if String.length result == 0 then string_of_list (string_of_int x) tail
    else string_of_list (result ^ " " ^ string_of_int x) tail;;

read_line()
|> Str.split (Str.regexp " ")
|> List.map int_of_string
|> sort false []
|> string_of_list ""
|> print_endline


Measured memory_bytes: 2164
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
using namespace std;
const int INF=1e17+5;
const int maxn=1e5+5;
int n,m,a[maxn],b[maxn],ans,sum;
int t[30][30];
bool judge(int x,int y)
{
    int h=0;
    fu(i,1,m)
    {
        h+=(t[x][i]-t[y][i])*(t[x][i]-t[y][i]);
    }
    int hh=sqrt(h);
    if(hh*hh==h)return 1;
    else return 0;

}
int32_t main()
{
    IOS;
    cin>>n>>m;
    fu(i,1,n)
    {
        fu(j,1,m)
        {
            cin>>t[i][j];
        }
    }
    fu(i,1,n)
    {
        fu(j,1,n)
        {
            if(i==j)continue;
            if(judge(i,j))ans++;
        }
    }
    cout<<ans/2;
    return 0;
}

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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

const int dx[4] = {0,  0, 1, -1};
const int dy[4] = {1, -1, 0,  0};
const int N = 1e2 + 7;
int a[N * N];
bool used[N][N];
int ans[N][N];
int n,m,k;
void dfs(int x,int y,int color){
	used[x][y] = 1;
	ans[x][y] = color;
	a[color]--;
	for(int i = 0; i < 4; i++){
		int x1 = x + dx[i];
		int y1 = y + dy[i];
		
		if (0 <= x1 && x1 < n && 0 <= y1 && y1 < m && !used[x1][y1]){
			if (a[color] > 0){
				dfs(x1,y1,color);
			}	
			else {
				color++;
				dfs(x1,y1,color);
			}
		} 
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;
	for(int i = 1; i <= k; i++)
		cin >> a[i];
	dfs(0,0,1);
	
	
	//cout << endl; 
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			cout << ans[i][j] << " ";
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

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

using ll = long long;

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

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int K; std::cin >> K;
  std::string S; std::cin >> S;
  if ( sz(S) <= K ) std::cout << S << std::endl;
  else std::cout << S.substr(0,K) << "..." << std::endl;
  return 0;
}



Measured memory_bytes: 3644