akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n; cin >> n;
    /*int count=0;
    vector<string> goods(0);
    for (int i=0; i<n; i++){
        string now; cin >> now;
        if (i!=0){
            if (!(binary_search(goods.begin(), goods.end(), now))) {
                goods.push_back(now);
                //goods.at(count)=now;
                count++;
                sort(goods.begin(), goods.end());
            }
        } else {//i==0
            goods.emplace_back(now);
            //goods.at(count)=now;
            count++;
            sort(goods.begin(), goods.end());
        }
    }
    cout << count << endl;*/

    set<string> s;
    for (int i=0; i<n; i++){
        string now; cin >> now;
        s.insert(now);
    }

    cout << s.size()<< endl;

    return 0;
}

Measured memory_bytes: 19268
import java.util.*;
import java.math.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();

    int x = 0;
    int max = 0;

    char[] c = s.toCharArray();

    for (int i = 0; i < n; i++) {
      if (c[i] == 'I') {
        x++;
      } else if (c[i] == 'D') {
        x--;
      }

      max = Math.max(max,x);

    }

    System.out.println(max);
    
  }

}


Measured memory_bytes: 23636
input()
a=input().split()
lis=[]
t=0
for i in a:
  lis.append(int(i))
for k in lis:
  if k%2==0:
    if k%5==0 or k%3==0:
      pass
    else:
      t=1
      break
  else:
    pass
if t==0:
  print("APPROVED")
elif t==1:
  print("DENIED")

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

using namespace std;

int main() {
  int64_t N, A, B;
  cin >> N >> A >> B;
  int64_t K = N / (A + B);
  int64_t remain = N - (A + B) * K;
  remain = min(remain, A);
  cout << K * A + remain << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin >> n;
    if (n < 1000) {
        cout << "ABC" << endl;
    } else {
        cout << "ABD" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<fstream>
#include<utility>
#include<bitset>
#include<map>
#include<deque>
#include<cmath>
#include<random>
#include<string.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

ll dp[86];

ll f(ll x) {
	if (dp[x] > 0)return dp[x];
	else if (x == 0)return 2;
	else if (x == 1)return 1;
	else return dp[x] = f(x - 1) + f(x - 2);
}

int main() {
	makel(N);
	memset(dp, -1, sizeof(dp));
	say(f(N));
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    int a,b,h,m;
    cin>>a>>b>>h>>m;

    double x=a*cos((double)h*M_PI/6+(double)m*M_PI/(6*60))-b*cos((double)m*M_PI/30),
            y=a*sin((double)h*M_PI/6+(double)m*M_PI/(6*60))-b*sin((double)m*M_PI/30);

    double ans=sqrt(x*x+y*y);

    printf("%.10f\n",ans);

    return 0;

}

Measured memory_bytes: 4032
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
#define N_MAX 100000
using namespace std;
//????????????????????????
//?°????????????¨????°?????????§?????????????????´?????????
//?????£?????????????????????????????????????????¨??§??°?????£???????????¨?????????
 
int n;
 
int partition(int A[],int p,int r){//r????????????????????????????????????
    int x = A[r];
    int i = p;
    int tmp;
     
    for(int j=p;j<r;j++){
        if(A[j] <= x){
            tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
            i++;
        }
    }
    tmp = A[i];
    A[i] = A[r];
    A[r] = tmp;
 
    return i;//i???x??\????????°?????°??¨????????????
}
 
int main(){
    int A[N_MAX+1];
    int p;
 
    scanf("%d",&n);
 
    //?¢??????¨
    //printf("%d\n",n);
     
    for(int i=0;i<n;i++){
        scanf("%d",&A[i]);
 
        //?¢??????¨
        //printf("%d ",A[i]);
    }
 
    p = partition(A,0,n-1);
     
    if(n == 1){
        printf("[%d]\n",A[0]);
        return 0;
    }
    if(p == 0){
        printf("[%d]",A[0]);
    }else
        printf("%d",A[0]);
        for(int i=1;i<n;i++){
            if(i == p){
                printf(" [%d]",A[i]);
            }else
                printf(" %d",A[i]);
    }
    printf("\n");
}

Measured memory_bytes: 1584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pb push_back
#define mp make_pair
typedef pair<int,int> ii;
const double pi=3.141592653589793238462643383279;
typedef vector<int> vi;
vi a[100005];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	int h[n];
	for(int i=0;i<n;i++)cin>>h[i];
	for(int i=0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		x--;y--;
		a[x].pb(y);
		a[y].pb(x);
	}
	bool good[n];
	memset(good,true,sizeof good);
	for(int i=0;i<n;i++)
	{
		//if(i==5)cout<<"ha"<<endl;
		for(int j=0;j<a[i].size();j++)
		{
			//if(i==5)cout<<a[i][j]<<endl;
			if(h[a[i][j]]>=h[i])
			{
				//cout<<i<<endl;
				good[i]=false;
				break;
				
			}
		}
	}
	int cc=0;
	for(int i=0;i<n;i++)
	{
		if(good[i])cc++;
	}
	cout<<cc<<endl;
}

Measured memory_bytes: 10364
N,S=map(int,input().split())
A=list(map(int,input().split()))
dp=[[0 for i in range(3001)] for j in range(3001)]
#dp[X][S]=最後の物がX番目以下のもので、総和をSにしてくれる物の総数
dp[0][0]=1

mod=998244353

for i in range(N):
    w=A[i]
    for j in range(S+1):
        if j>=w:
            dp[i+1][j]+=(2*dp[i][j]+dp[i][j-w])
        else:
            dp[i+1][j]+=2*dp[i][j]
        dp[i+1][j]%=mod

print(dp[N][S]%mod)


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

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


}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
typedef long long ll;
ll gcd(ll a, ll b){if(a%b==0){return(b);}else{return(gcd(b, a%b));}}

int main(){
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n){cin >> a[i];}
	ll gcd_tmp = gcd(a[0],a[1]);
	reps(i,2,n){
		gcd_tmp = gcd(gcd_tmp, a[i]);
	}
	cout << gcd_tmp;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#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;
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define F first
#define S second
#define pb push_back
#define all(c)  c.begin(), c.end()
#define vb vector<bool>
#define vll vector<ll>
#define vp vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define lb "\n"
#define rep(i,a,b) for(int i = a;i<b;i++)
#define INF 998244353
#define MAX LLONG_MAX
#define PI 3.14159265358
ll max(ll x,ll y){if(x>y)return x;else return y;}
ll min(ll x,ll y){if(x>y)return y;else return x;}
long double dp[3000][3000],a[3000];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
      #ifdef LOCAL
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
   ll i,k,l,m,n,j;
   long double p=1.0,ans=0.0;
   cin>>n;
   rep(i,0,n)
   cin>>a[i+1];
   for(i=1;i<=n;i++)
   {
       p*=(1-a[i]);
     dp[i][0]=p;
   }
   dp[0][0]=1;
   rep(i,1,n+1)
   rep(j,1,n+1)
   {
       if(j>i)
       break;
       dp[i][j]=dp[i-1][j-1]*a[i];
       if((i-1)>=j)
        dp[i][j]+=dp[i-1][j]*(1-a[i]);
   }
   rep(i,n/2+1,n+1)
   ans+=dp[n][i];
   cout<<setprecision(10);
   cout<<fixed;
   cout<<ans;
}


Measured memory_bytes: 139264
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        const long MOD = 1000000007;
        var sc = new Scanner();
        int n = sc.nextInt();
        double a = 0;
        for (int i = 0; i < n; i++)
        {
            a += 1.0 / sc.nextInt();
        }
        Console.WriteLine(1.0 / a);
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

def ii():  return int(input())
def si():  return input()
def mi():  return map(int,input().strip().split(" "))
def li():  return list(mi())

def main():
    # pass
    k = ii()
    # return "ACL"*k
    print("ACL"*k)

# print(main())


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 9332
#include <iostream>
using namespace std;
int factorial(int n){
	if(n==0) return 1 ; else return(2*factorial(n-1)) ;
}
int main(){
	int x;
	while(cin>>x){
		int ans[10]={0};int ptr=0;int sum=0;
		for(int i=9;i>=0;i--){
			if(x==sum) break;
			int temp=factorial(i);
			if(x>=sum+temp) {ans[ptr++]=temp;sum+=temp;};
		};
		for(int i=ptr-1;i>=0;i--){
		if(i!=ptr-1) cout << ' ' ; cout << ans[i] ;
		};
		cout << '\n' ;
	};
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
  int n , m ;
  cin >> n  ;
  map<string,int> mpf ;
  map<string,int> mps ;
  string S ;
  rep(i,n){
    cin >> S ;
    mpf[S] ++ ;
  }
  cin >> m ;
  rep(i,m){
    cin >> S ;
    mps[S]++ ;
  }
  int ans ;
  for(auto p :mpf){
    string a = p.first ;
	ans = max(mpf[a] - mps[a],ans) ;
  }  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 25
#define Q -1
typedef struct{
  int p;
  int l;
  int r;
}Tree;
Tree tree[N];
int D[N],H[N];
void Depth(int st,int de);
int Height(int st);
int Setsu (int st);
void P (int st);

int main()
{
  int i,n,m,le,ri;
  int squrt=0;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    tree[i].p=-1;
  for(i=0;i<n;i++){
    scanf("%d%d%d",&m,&le,&ri);
    tree[m].l=le;
      tree[m].r=ri;
      if(le!=-1)
	tree[le].p=m;
      if(ri!=-1)
	tree[ri].p=m;
  }
  for(i=0;i<n;i++)
    if(tree[i].p==-1)
      squrt=i;

  Depth(squrt,0);
  Height(squrt);

  for(i=0;i<n;i++)
    P(i);
  
  return 0;
}
void Depth(int st,int de){
  if (st == -1)
    return;
  D[st]= de;
  Depth (tree[st].l,de+1);
  Depth (tree[st].r,de+1);
}

int Height(int st){
  int a=0,b=0;
  if(tree[st].l!=-1)
    a=Height(tree[st].l)+1;
  if(tree[st].r!=-1)
    b=Height(tree[st].r)+1;
  return H[st]=(a>b ? a:b);
}

int Setsu (int st){
  if(tree[st].p == -1)
    return -1;
  if(tree[tree[st].p].l!=st && tree[tree[st].p].l!=-1)
    return tree[tree[st].p].l;
  if(tree[tree[st].p].r!=st && tree[tree[st].p].r!=-1)
 return tree[tree[st].p].r;
  return -1;
}

void P (int st){
  int count=0;
  
  printf("node %d: parent = %d, sibling = %d, ",st,tree[st].p,Setsu(st));
  if(tree[st].l!=-1)
    count++;
  if(tree[st].r!=-1)
    count++;
  
  printf("degree = %d, depth = %d, height = %d, ",count,D[st],H[st]);

  if(tree[st].p ==-1){
    printf("root\n");
  }else if(tree[st].l==-1 &&tree[st].r==-1){
     printf("leaf\n");
  }else{
    printf("internal node\n");
  }
}
    



Measured memory_bytes: 2088
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
//str.substr(開始位置, 取り出す長さ);
using namespace std;
using ll = long long;
 
int main() {
	int a,b;
	cin >> a >> b;
	if (b % a ==0) {
		cout << a+b << endl;
	} else {
		cout << b-a << endl;
	}

	return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  bool flg = true;
  rep(i, s.size()) {
    if (i % 2 == 0 && s[i] == 'L') flg = false;
    if (i % 2 == 1 && s[i] == 'R') flg = false;
  }
  cout << (flg ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>

int n, s;
long long dp[10][1001];

int main()
{
	while( std::cin >> n >> s, n | s )
	{
		memset( dp, 0, sizeof( dp ) );

		dp[0][0] = 1;
		for( int k = 0; k <= 100; ++k )
		{
			for( int j = s; j >= 0; --j )
			{
				for( int i = n; i > 0; --i )
					if( j >= k )
						dp[i][j] += dp[i-1][j-k];
			}
		}

		std::cout << dp[n][s] << std::endl;
	}

	return 0;
}

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

int main() {
    long long q,h,s,d;
    cin >> q >> h >> s >> d;
    long long n;
    cin >> n;
    long long a=min({q*8,h*4,s*2,d});
    long long b=0;
    if(a==d){
        b=1;
    }
    long long ans=0;
    if(b==1){
        if(n%2==0){
            ans+=a*(n/2);
        }
        else{
            ans+=(a*(n/2))+min({q*4,h*2,s});
        }
    }
    else{
        ans+=(a/2)*n;
    }
    cout << ans << endl;
}

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

int main()
{
    int x;
    cin>>x;
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    string st="SSSSRRRRWSSSSRRRRWSSSSRRRRWSSSSRRRRW";
    REP(j,x-1)
    {
        int up,s,e,w,n,down;
        cin>>up>>s>>e>>w>>n>>down;
        bool flag=0;
        REP(i,st.size())
        {
            if(A==up&&B==s&&C==e&&D==w&&E==n&&F==down){cout<<"No"<<endl;return 0;}
            int temp;
            if(st.at(i)=='S')
            {
                temp=s;
                s=up;
                up=n;
                n=down;
                down=temp;
            }
            if(st.at(i)=='W')
            {
                temp=w;
                w=up;
                up=e;
                e=down;
                down=temp;
            }if(st.at(i)=='R')
            {
                temp=s;
                s=e;
                e=n;
                n=w;
                w=temp;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 3220
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main() {
    int N;
    cin >> N;
    vector<int> Ais;
    for (int i = 0; i < N; i++) {
        int Ai;
        cin >> Ai;
        Ais.push_back(Ai);
    }
    vector<int> vals;
    for (int ai : Ais) {
        if (vals.empty()) {
            vals.push_back(ai);
            continue;
        }
        auto it = partition_point(vals.begin(), vals.end(), [ai](int val) { return val >= ai; });
        if (it == vals.end()) {
            vals.push_back(ai);
        } else {
            *it = ai;
        }
    }
    cout << vals.size() << endl;
}



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

int main() {
  int n;
  cin >> n;
  double sum = 0;
  rep(i,n) {
    int a;
    cin >> a;
    sum += 1.0/a;
  }
  double ans = 1/sum;
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

k, q = map(int, input().split())
d_ = list(map(int, input().split()))

for _ in range(q):
    n, x, m = map(int, input().split())
    d = [di%m for di in d_]
    ans = n-1
    zero_acc = [0]
    sum_acc = [0]
    
    for di in d:
        zero_acc.append(zero_acc[-1]+(1 if di==0 else 0))
        sum_acc.append(sum_acc[-1]+di)
    
    s, a = divmod(n-1, k)
    ans -= s*zero_acc[-1]+zero_acc[a]
    last = x+s*sum_acc[-1]+sum_acc[a]
    ans -= last//m-x//m
    
    print(ans)

Measured memory_bytes: 119132
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

void solve(){
    int n;
    cin>>n;
    int sz=0;
    for(int i=1;i<=n;++i){
        if(2*n%i==0){
            if(2*n/i==i+1){
                sz=i;
                break;
            }
        }
    }
    if(!sz)cout<<"No\n";
    else{
        cout<<"Yes\n";
        cout<<sz+1<<"\n";
        vector<vector<int>>ans(sz+1,vector<int>(sz));
        int cnt=0;
        rep(i,sz)for(int j=i;j<sz;++j)ans[i][j]=++cnt;
        cnt=0;
        rep(i,sz)rep(j,sz+1)if(ans[j][i]==0)ans[j][i]=++cnt;
        rep(i,sz+1){
            cout<<sz<<" ";
            rep(j,sz){
                cout<<ans[i][j]<<" ";
            }
            cout<<"\n";
        }
    }
}
 
signed main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


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

int main() {
  string S,T;
  cin >> S >> T;
  
  int count = 0;
  for (int i=0;i<3;i++){
    if(S[i] == T[i]){
      count++;
    }else {
      continue;
    }
  }
  
  cout << count << endl;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
const long double pi = 3.14159265358979323846264338327950288;
int main() {
	string s;
	cin >> s;
	int j = 0;
	for (int i = 0; i < s.size();) {
		if (j == s.size()) {
			cout << "NO\n";
			return 0;
		}
		if (i + 7 <= s.size() && s.substr(i, 7) == "dreamer" && (i + 7 == s.size() || s[i + 7] != 'a'))
			i += 7;
		else if (i + 5 <= s.size() && s.substr(i, 5) == "dream")
			i += 5;
		else if (i + 6 <= s.size() && s.substr(i, 6) == "eraser" && (i + 6 == s.size() || s[i + 6] != 'a'))
			i += 6;
		else if (i + 5 <= s.size() && s.substr(i, 5) == "erase")
			i += 5;
		j++;
	}
	cout << "YES\n";
	cin >> s;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
	int x;
	scanf("%d",&x);
	if(x%2==0&&(x%3!=0&&x%5!=0))
	{
		printf("DENIED");
		return 0;
	}
	
}
printf("APPROVED");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	long long a, b;
	long long min, max;

	while (cin >> a >> b) {

		if (b > a) {
			long long dum = a;
			a = b;
			b = dum;
		}

		//cout << "a=" << a << "b=" << b << endl;
		
		//?????§??¬?´???°????±???????
		//???????????????????????????
		long long new_a = a, new_b = b;
		long long r;
		while (1) {
			r = new_a%new_b;
			if (r == 0) {
				max = new_b;
				break;
			}
			else {
				new_a = new_b;
				new_b = r;
				continue;
			}
		}

		//????°???¬?????°????±???????
		//2,000,000,000?????§?????????
		long long i=1, j=1;
		while (a*i<2000000000&&b*j<2000000000) {
			//cout << "ai=" << a*i << " bj=" << b*j << endl;
			if (a*i == b*j) {
				min = a*i;
				break;
			}
			else if (a*i < b*j) {
				i++;
			}
			else if (a*i > b*j) {
				j++;
			}
			
		}

		cout << max << " " << min << endl;
	}

	return 0;

}

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

typedef long long ll;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int lim = (n - 1) * (n - 2) / 2;
    if (k > lim) {
        printf("-1");
        return 0;
    }
    int diff = lim - k;
    int m = n - 1 + diff;
    vector<pair<int, int>> edges;
    for (int i = 1; i < n - 1; i++) {
        for (int k = i + 1; k < n; k++) {
            edges.emplace_back(make_pair(i, k));
        }
    }
    cout << m << endl;
    for (int i = 1; i < n; i++) {
        cout << i << " " << n << endl;
    }
    for (int i = 0; i < diff; i++) {
        cout << edges[i].first << " " << edges[i].second << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(data, 10, sizeof(int), compare_int)

//long long int a[100100];

int main(){
	int x, n;
	int p[120];
	int f=0;
	scanf("%d%d", &x, &n);
	for(int i=0; i<n; i++){
		scanf("%d", &p[i]);
		if(p[i] == x) f=1;
	}
	if(f==0) printf("%d\n", x);
	else{
		int ans=500;
		for(int i=1; i<120; i++){
			int g=0;
			for(int j=0; j<n; j++){
				if(p[j] == x-i) g=1;
			}
			if(g==0){
				ans = x-i;
				break;
			}
			g=0;
			for(int j=0; j<n; j++){
				if(p[j] == x+i) g=1;
			}
			if(g==0){
				ans = x+i;
				break;
			}
		}
		printf("%d\n", ans);
	}

	
	//printf("%d", ans+1);
	
	return 0;
}


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

#define MOD 1000000007

template<const long long M> class mint {
private:
	long long x;
public:
	constexpr mint(long long x = 0) :
			x((x % M + M) % M) {
	}
	constexpr long long value() {
		return x;
	}
	constexpr mint operator-() const {
		return mint(-x);
	}
	constexpr mint& operator+=(const mint &a) {
		if ((x += a.x) >= M)
			x -= M;
		return *this;
	}
	constexpr mint& operator-=(const mint &a) {
		if ((x += M - a.x) >= M)
			x -= M;
		return *this;
	}
	constexpr mint& operator*=(const mint &a) {
		(x *= a.x) %= M;
		return *this;
	}
	constexpr mint& operator/=(const mint &a) {
		return (*this) *= a.inv();
	}
	constexpr mint operator+(const mint &a) const {
		mint res(*this);
		return res += a;
	}
	constexpr mint operator-(const mint &a) const {
		mint res(*this);
		return res -= a;
	}
	constexpr mint operator*(const mint &a) const {
		mint res(*this);
		return res *= a;
	}
	constexpr mint operator/(const mint &a) const {
		mint res(*this);
		return res /= a;
	}
	constexpr mint pow(long long t) const {
		if (!t)
			return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1)
			a *= *this;
		return a;
	}
	constexpr mint inv() const {
		return pow(M - 2);
	}
	constexpr bool operator==(const mint &a) const {
		return x == a.x;
	}
	constexpr bool operator!=(const mint &a) const {
		return x != a.x;
	}

	friend istream& operator>>(istream &in, mint &a) {
		in >> a.x;
		if (a.x < 0)
			a.x += M;
		a.x %= M;
		return in;
	}
	friend ostream& operator<<(ostream &out, const mint &a) {
		out << a.x;
		return out;
	}
};

template<typename T> T combination(int n, int r) {
	T ans = 1;
	for (int i = 0; i < r; i++) {
		ans *= n - i;
	}
	for (int i = 1; i <= r; i++) {
		ans /= i;
	}
	return ans;
}

template<typename T> T ipow(T b, long long e) {
	if (e == 0) {
		return 1;
	} else if (e % 2 == 0) {
		return ipow(b * b, e / 2);
	} else {
		return ipow(b * b, e / 2) * b;
	}
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout
			<< ipow<mint<MOD>>(2, n) - combination<mint<MOD>>(n, a)
					- combination<mint<MOD>>(n, b) - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())
l = [a, b, c]
l.sort()
a, b, c = l[0], l[1], l[2]
cnt = 0
while not (a == b and b == c and a == c):
    a, b, c = l[0], l[1], l[2]
    if a+2 <= c:
        a += 2
    elif b+2 <= c:
        c += 2
    else:
        a += 1
        b += 1
    l[0] = a
    l[1] = b
    l[2] = c
    l.sort()
    cnt += 1
print(cnt)

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

using namespace std;

int popcount(char n[]){
  int ones = 0;
  for(int i = 0; n[i]; i++) ones += n[i]-'0';
  return ones;
}

int popcount(int n){
  int ones = 0;
  while(n){
    ones += n%2;
    n >>= 1;
  }
  return ones;
}

long long mod_pow(long long b, int x, int M){
  if(!x) return 1;
  if(x & 1) return (b * mod_pow(b, x-1, M))%M;
  long long tmp = mod_pow(b, x >> 1, M);
  return (tmp * tmp)%M;
}

int f(int n){
  int ret = 0;
  while(n){
    n %= popcount(n);
    ret++;
  }
  return ret;
}

const int MAXN = 2e5+10;

char X[MAXN];

int main(){
  int N;
  while(scanf("%d%s", &N, X) > 0){
    int num_ones = popcount(X);
    int rem0 = 0, rem1 = 0;

    for(int i = 0; X[i]; i++){
      if(num_ones > 1){
	rem0 = (rem0*2 + X[i]-'0')%(num_ones - 1);
      }
      rem1 = (rem1*2 + X[i]-'0')%(num_ones + 1);
    }

    for(int i = 0; i < N; i++){
      if(num_ones == 1 and X[i] == '1'){
	printf("0\n");
	continue;
      }

      int rem, x = N-1-i;
      if(X[i] == '0'){
	rem = (rem1 + mod_pow(2, x, num_ones+1))%(num_ones + 1);
      } else {
	rem = (rem0 - mod_pow(2, x, num_ones-1) + num_ones - 1)%(num_ones - 1);
      }

      printf("%d\n", 1 + f(rem));
    }
  }
}


Measured memory_bytes: 4000
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <map>
#include <queue>

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


//方針:各'.'からの最短の'#'を求める
//最短の最大値がres

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(){

    int H,W;
    cin >> H >> W;
    string a[H];
    int cost[H][W];

    REP(i,H)
    {
        cin >> a[i];
    }

    using pint = pair<int,int>;
    queue<pint> que;

    REP(i,H)
    {
        REP(j,W)
        {
            if(a[i][j] == '#')
            {
                que.push(pint(i, j));
                cost[i][j] = 0;
            }
            else
            {
                cost[i][j] = MOD;
            }
        }
    }

    while (!que.empty()) {
        auto cur = que.front();
        que.pop();
        for (int dir = 0; dir < 4; ++dir) {
            int nx = cur.first + dx[dir];
            int ny = cur.second + dy[dir];
            if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if (cost[nx][ny] == MOD) {
                cost[nx][ny] = cost[cur.first][cur.second] + 1;
                //-1のものはすべて白
                que.push(pint(nx, ny));
            }
        }
    }

    int res = 0;
    REP(i,H)
    {
        REP(j,W)
        {
            res = max(res, cost[i][j]);
        }
    }
    cout << res << endl;
    return 0;    
}



Measured memory_bytes: 13456
n=int(input())
s=input()
List=list(s)
for i in range(len(s)):
    if ord(List[i])+n<=90:
        List[i]=chr(ord(List[i])+n)
    else:
        List[i]=chr(ord(List[i])+n-26)
new_s="".join(List)
print(new_s)

Measured memory_bytes: 3060
#include <cstdio>
int N;
long long a[100002], b[100002], A[100002];
int main()
{
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%lld%lld", a + i, b + i);
	for (int i = N; i; i--)
	{
		A[i] = a[i] + A[i + 1] - a[i + 1];
		A[i] = (A[i] + b[i] - 1) / b[i] * b[i];
	}
	printf("%lld\n", A[1] - a[1]);
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>

using namespace std;

int main()
{
	
	int a,b,x;
	
	cin>>x>>a>>b;
	
	if(b-a<=0)
	{
		
		cout<<"delicious"<<endl;
		
	}
	
	else if(b-a<=x)
	{
		
		cout<<"safe"<<endl;
		
	}
	
	else cout<<"dangerous"<<endl;
    
    
}

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

int main()
{
	int a[2] = {};
	string s;
	cin >> s;
	int k = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A'&&k==0)
		{
			a[k] = i;
			k++;
		}
		if (s[i] == 'Z')a[k] = i;
	}
	cout << a[1] - a[0]+1;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 998244353;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, int b, int _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

vector<vector<int> > G;
vector<vector<ll> > dp;

void dfs(int v) {
  ll ret = 1;
  for (int nv : G[v]) {
    dfs(nv);
    // 0, 残す
    (dp[v][0] *= dp[nv][0] + dp[nv][1]) %= mod;
    (dp[v][1] *= dp[nv][1]) %= mod;
  }
}

void solve() {
  int n;
  cin >> n;
  // 座標は全部異なる
  vector<pii> v(n);
  rep(i, n) cin >> v[i].F >> v[i].S;
  sort(all(v));

  G.resize(n);
  // 自分を含むもので, 一番自分に近い左の

  // youtube editorial
  set<pii> s;
  for (int i = n - 1; i >= 0; --i) {
    int x = v[i].F, d = v[i].S;
    // i にカバーされてる範囲
    while (sz(s) && s.begin()->F < x + d) {
      G[i].eb(s.begin()->S);
      s.erase(s.begin());
    }
    s.insert(pii(x, i));
  }

  vector<int> in(n);
  rep(i, n) for (int v : G[i]) in[v] = 1;
  // cout << in << endl;

  dp = vector<vector<ll> >(n, vector<ll>(2, 1));
  ll ans = 1;
  rep(i, n) {
    if (in[i] == 0) {
      dfs(i);
      (ans *= dp[i][0] + dp[i][1]) %= mod;
    }
  }

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


Measured memory_bytes: 33920
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int n, m;
int a[N];
vector<int> g[N];

int32_t main()
{
	IOS;
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	for(int i = 1; i <= m; i++)
	{
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int ans = 0;
	for(int i = 1; i <= n; i++)
	{
		int ct = 0;
		for(auto &it:g[i])
			if(a[i] <= a[it])
				ct++;
		ans += (ct == 0);
	}
	cout << ans;
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 10000001;
const int INF = 1001001001;
const int MOD = 1000000007;

ll f[MAX];

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

    rep(i, MAX) f[i] = 2;
    f[1] = 1;

    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += i * f[i];
        if (i == 1) continue;
        for (int j = 2; i * j <= N; ++j) f[i * j]++;
    }

    cout << ans << endl;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

bool prime[1100];
void eratos ( int n){
	prime[2] = true; prime[0] = prime[1] = false;
	for(int i = 3; i <= n; i += 2) prime[i] = true, prime[i+1] = false;
	int limit = (int)sqrt((double)n) + 1;
	for(int i = 3; i <= limit; i += 2){
		if(!prime[i]) continue;
		for(int j = i * i, k = i * 2; j <= n; j += k) prime[j] = false;
	}
}

map<ll, int> fct(int n){
	map<ll,int> mp;
	for(int i=2; i<=n; i++) if(prime[i]){
		for(int w=n;w>0;w/=i) mp[i] += w/i;
	}
	return mp;
}

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	
	eratos(n+10);
	auto rmp = fct(n);
	
	//for(auto x :rmp) printf("%lld:%d, ",x.first,x.second); puts("");
	ll ans =1;
	for(auto x :rmp){
		(ans *= (x.second + 1LL)) %=MD;
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
 
class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int a, b, c;
        int count = 0;
        String[] num = in.readLine().split(" ");
        a = Integer.parseInt(num[0]);
        b = Integer.parseInt(num[1]);
        c = Integer.parseInt(num[2]);
        if (a > b) {
           throw new RuntimeException("error:You must write a<=b");
        }
        if (a < 1 || 10000 < a || b < 1 || 10000 < b || c < 1 || 10000 < c) {
             throw new RuntimeException("error:You must write 1<=a,b,c<=10000");
        }
        for (int i = a; i <= b; i += 1) {
            if (c % i == 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, M, Q;
int L[220000], R[220000];
int p[110000], q[110000];
int im[550][550];

signed main() {
    cin >> N >> M >> Q;
    for (int i = 0; i < M; i++) {
        cin >> L[i] >> R[i];
    }
    for (int i = 0; i < Q; i++) {
        cin >> p[i] >> q[i];
    }
    for (int i = 0; i < M; i++) {
        im[L[i]][R[i]]++;
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 2; j <= N; j++) {
            im[i][j] += im[i][j - 1];
        }
    }
    for (int i = 0; i < Q; i++) {
        int ans = 0;
        for (int j = p[i]; j <= q[i]; j++) {
            ans += im[j][q[i]];
        }
        cout << ans << endl;
    }
}


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

int main(){

  int n, s[100], sum=0;

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

  sort(s, s+n);

  if(sum%10!=0) cout<<sum<<endl;
  else{
    for(int i=0;i<n;i++){
      if(s[i]%10!=0){
        sum-=s[i];
        break;
      }
    }
    if(sum%10) cout<<sum<<endl;
    else cout<<0<<endl;
  }

  return 0;
}


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

int main() {
	int N;
	string S;
	cin >> N >> S;

	int ans = 0;

	for (int i = 0; i < N; i++) {
		string x = "", y = "";
		for (int j = 0; j < i; j++) {
			x += S[j];
		}
		for (int j = i; j < N; j++) {
			y += S[j];
		}
		int cnt = 0;

		for (int j = int('a'); j <= int('z'); j++) {
			int val = 2;
			for (int k = 0; k < x.size(); k++) {
				if (x[k] == char(j)) {
					val--;
					break;
				}
			}
			for (int k = 0; k < y.size(); k++) {
				if (y[k] == char(j)) {
					val--;
					break;
				}
			}
			if (val == 0) {
				cnt += 1;
			}
		}
		ans = max(ans, cnt);
	}
	cout << ans;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n=sc.nextInt();
    int x=sc.nextInt();
    int t=sc.nextInt();
    int sum=(n/x)*t;
    if(n%x!=0)sum+=t;
    System.out.println(sum);
  }
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  int a = A + B;
  int b = A - B;
  int c = A * B;
  cout << max({a,b,c}) << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
n,q = map(int,input().split())
d = defaultdict(list)
dp = [0] * n
ep = [0] * n
for i in range(n-1):
    ta,tb = map(int,input().split())
    d[ta-1].append(tb-1)
    d[tb-1].append(ta-1)
for i in range(q):
    ta,tb = map(int,input().split())
    dp[ta-1] +=tb
ep[0]+=1
l = deque()
l.append(0)

while l:
    t = l.pop()
    ep[t] = 1
    for i in d[t]:
        if not ep[i]:
            dp[i] += dp[t]
            l.append(i)
print(*dp)


Measured memory_bytes: 73236
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lll;
constexpr ll mod = 1000000007;

#define bs(n) (1ull<<(ull)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)

ll n;

bool ok(ll k) {
    if (k == 1)return false;
    ll c = n;
    while (c % k == 0 && c != 0) {
        c /= k;
    }
    return c % k == 1;
}

set<ll> t;

int main() {
    cin >> n;
    if (ok(n - 1))t.insert(n - 1);
    for (ll i = 1; i * i <= n; i++) {
        if (ok(i)) t.insert(i);
        if (ok(n / i))t.insert(n / i);
    }
    cout << t.size() << endl;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{
    string s; cin >> s;
    if (s=="ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ a.cpp
./a.out

*/

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];
    
    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;
    
    // 初期条件
    dp[0] = 0;
    
    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }
    
    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int A, B; string S; cin >> A >> B >> S;
    for (int i = 0; i < S.length(); ++i) {
        if (i != A) {
            if (S[i] == '-') {
                printf("%s\n", "No");
                return 0;
            }
        }
        else {
            if (S[i] != '-') {
                printf("%s\n", "No");
                return 0;
            }
        }
    }
    printf("%s\n", "Yes");
    return 0;
}


Measured memory_bytes: 3596
#include <cstdio>
using namespace std;

int main(){
	int n, g;
	while(scanf("%d\n", &g) != EOF){
		n = 1;
		while(g > 0){
			if(g % (n * 2) > 0){
				printf("%d", n);
				g -= n;
				printf("%c", (g > 1)? ' ' : '\n');
			}
			n *= 2;
		}
	}
}

Measured memory_bytes: 1036
import java.util.Scanner;

class Main{
	public static void main(String[] args) 	{
		Scanner sc = new Scanner(System.in);
		while(0 < 1){
				int n = sc.nextInt();
				int x = sc.nextInt();
				if(n == 0 && x == 0) break;
				int count = 0;
				for(int i = 1;i <= n;i++) {
					for(int j = i + 1;j <= n;j++) {
					    for(int k = j + 1;k <= n;k++) {
							if(i + j + k == x) count++;
						}
					}
				}
			    System.out.printf("%d\n",count);
			}
		sc.close();
	}	
}


Measured memory_bytes: 27400
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int k, n; cin >> k >> n;
	vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i];
	int mx = k + a[0] - a[n - 1]; for (int i = 1; i < n; i++) mx = max(mx, a[i] - a[i - 1]);
	int ans = k - mx;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4052