akhauriyash/Code-Regression huggingface dataset:
import sys
import copy

def main():
    sum=0
    S = list(map(str, input()))
    hoge = tmp = []

    op_cnt = len(S) - 1

    for i in range(2 ** op_cnt):
        op = [""] * op_cnt
        for j in range(op_cnt):
            if ((i >> j) & 1):
                op[op_cnt -1 -j] = "+"

        S_tmp = copy.deepcopy(S)
        for k in range(len(op)):
            S_tmp.insert(1+k*2,op[k])
        sum+=(eval("".join(S_tmp)))
    print(sum)

main()

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define Si size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define Em empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define Fi first
#define Se second
#define Pi acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>

void FAST();
LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);









int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,x,a[7];
    for(i=1;i<=5;i++)
    {
        cin >> a[i];
    }
    cin >> x;
    sort(a+1,a+6);
    if(a[5]-a[1] > x)
    {
        cout << ":(";
    }
    else
    {
        cout << "Yay!";
    }
    return 0;
}







void FAST()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}


Measured memory_bytes: 256
fun main(){
  abc085b()
}

fun abc085b(){
    val n = readLine()!!.toInt()
    var numArrayList: ArrayList<Int> = arrayListOf()
    for(i in 0 until n){
        numArrayList.add(readLine()!!.toInt())
    }
    print(numArrayList.toSet().size)
}

Measured memory_bytes: 36792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main{

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        if(n >= 400 && n < 600) System.out.println(8);
        if(n >= 600 && n < 800) System.out.println(7);
        if(n >= 800 && n < 1000) System.out.println(6);
        if(n >= 1000 && n < 1200) System.out.println(5);
        if(n >= 1200 && n < 1400) System.out.println(4);
        if(n >= 1400 && n < 1600) System.out.println(3);
        if(n >= 1600 && n < 1800) System.out.println(2);
        if(n >= 1800 && n < 2000) System.out.println(1);
    }

    static void sort(int[] a){
        ArrayList<Integer>l = new ArrayList<>();
        for(int i: a)
            l.add(i);
        Collections.sort(l);
        for(int i = 0; i < a.length; i++)
            a[i] = l.get(i);
    }

    static class FastScanner{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next(){
            while(!st.hasMoreTokens())
                try{
                    st = new StringTokenizer(br.readLine());
                } catch(IOException e){
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt(){
            return Integer.parseInt(next());
        }
        int[] readArray(int n){
            int[] a = new int[n];
            for(int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        long nextLong(){
            return Long.parseLong(next());
        }
    }
}

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

int main(void) {
	int n; cin >> n;
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];

	vector<int> dpa(n), dpb(n), dpc(n);
	dpa[0] = a[0]; dpb[0] = b[0]; dpc[0] = c[0];

	for (int i = 1; i < n; i++) {
		dpa[i] = max(dpb[i-1], dpc[i-1]) + a[i];
		dpb[i] = max(dpa[i-1], dpc[i-1]) + b[i];
		dpc[i] = max(dpa[i-1], dpb[i-1]) + c[i];
	}

	cout << max(max(dpa[n-1], dpb[n-1]), dpc[n-1]) << endl;

	return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int m = 3;
vector <int> p2(31);
vector <vector <int> > ans;

int multiply_by_p2(int x, int h){
    int c = x;
    for(int i = 0 ; i < h ; i++){
        ans.push_back({0, c, c, m++});
        c = m - 1;
    }
    return m - 1;
}
int multiply_bits(int a, int b){
    ans.push_back({0, a, b, m++});
    ans.push_back({1, p2[0], m - 1, m});
    m++;
    return m - 1;
}
int less_than_or_equal(int x, int y){
    int c = m;
    ans.push_back({0, p2[0], y, m++});
    ans.push_back({1, x, c, m++});
    return m - 1;
}
vector <int> get(int f){
    vector <int> ret(31);
    int c = m++;
    for(int i = 30 ; i >= 0 ; i--){
        int cc = m;
        ans.push_back({0, c, p2[i], m++});
        ret[i] = less_than_or_equal(cc, f);
        ans.push_back({0, c, multiply_by_p2(ret[i], i), c});
    }
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ans.push_back({0, 0, 1, m++});
    m++;
    p2[0] = m;
    ans.push_back({1, 4, 3, m++});
    for(int i = 1 ; i <= 30 ; i++){
        p2[i] = m;
        ans.push_back({0, p2[i - 1], p2[i - 1], m++});
    }
    auto A = get(0);
    auto B = get(1);
    for(int i = 0 ; i <= 30 ; i++){
        for(int j = 0 ; j <= 30 ; j++){
            int p = multiply_bits(A[i], B[j]);
            p = multiply_by_p2(p, i + j);
            ans.push_back({0, 2, p, 2});
        }
    }
    cout << ans.size() << endl;
    for(auto &i : ans){
        cout << (i[0] == 0 ? '+' : '<') << " " << i[1] << " " << i[2] << " " << i[3] << "\n";
    }
}


Measured memory_bytes: 5696
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
//#include<chrono>
//#include<mt19937>
using namespace std;
typedef long long int llint;
const llint big=2e8;
const int mod=10000000;
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pub push_back
#define res resize
#define ins insert
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int n,m,h,i,j,ans=0,q;cin>>n>>m;
	vector<int> mot(n);//元のボール配列
	vector<int> bal(n+1);//その数字のボールの数
	for(i=0;i<n;i++){cin>>q;mot[i]=q;bal[q]++;}
	vector<int> kan(n+1);//区間をいくつ
	for(i=1;i<=n;i++){for(j=max(0,i-bal[i]+1);j<=i;j++){kan[j]++;}}
	for(i=1;i<=n;i++){if(kan[i]==0){ans++;}}
	for(h=0;h<m;h++){
		int x,y;cin>>x>>y;x--;
		bal[mot[x]]--;
		if(mot[x]-bal[mot[x]]>0){
			kan[mot[x]-bal[mot[x]]]--;
			if(kan[mot[x]-bal[mot[x]]]==0){ans++;}
		}
		mot[x]=y;
		if(mot[x]-bal[mot[x]]>0){
			if(kan[mot[x]-bal[mot[x]]]==0){ans--;}
			kan[mot[x]-bal[mot[x]]]++;
		}
		bal[mot[x]]++;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3840
get = lambda  : int(input())
getlist = lambda : list(map(int, input().split(" ")))

n = get()
arr = []
for i in range(n):
    arr.append(getlist())

ok = False
for i in range(n-2):
    if arr[i][0] == arr[i][1] and arr[i+1][0] == arr[i+1][1] and arr[i+2][0] == arr[i+2][1]:
        ok = True
        break
if ok:
    print("Yes")
else:
    print("No")

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vi> a(3,vi(3));
    rep(i,3)rep(j,3){
        cin>>a[i][j];
    }
    int n; cin>>n;
    vector<vector<bool> > c(3,vector<bool>(3,false));
    rep(i,n){
        int b; cin>>b;
        rep(j,3)rep(k,3){
            if (a[j][k]==b){
                c[j][k] = true;
                break;
            }
        }
    }
    bool ans=false;
    rep(i,3){
        if (c[i][0] && c[i][1] && c[i][2]){
            ans = true;
            break;
        }
    }
    rep(i,3){
        if (c[0][i] && c[1][i] && c[2][i]){
            ans = true;
            break;
        }
    }
    if (c[0][0]&&c[1][1]&&c[2][2]) ans=true;
    if (c[0][2]&&c[1][1]&&c[2][0]) ans=true;
    if (ans){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=2*1e5+2;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s,t;
	cin>>s>>t;
	int a,b;
	cin>>a>>b;
	string u;
	cin>>u;
	if(u==s)
	{
		cout<<a-1<<" "<<b;
	}
	else cout<<a<<" "<<b-1;
} 
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b;
    int num = 0;
    int ans;
    cin >> a >> b;
    for(int i=1;i<=b-a;i++){
        num += i;
    }
    ans = num - b;
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 256
"""
int #整数
float #小数

#標準入力
a=input()
a,b=map(int,input().split()) #入力は行ごと
#標準出力
print(a)
ptrint("Hello")
#for
for name in fruits: #fruitの頭から操作
    print(name)
#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト内の2の数
abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値

extension_1 = []
for i in range(10):
    extension_1.append(i)
extension_1
#>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

comprehension_1= [i for i in range(10)]
comprehension_1
#>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
"""
import math
import sys
X,N=map(int,input().split())
if N==0:
    print(X)
    sys.exit()
number = list(map(int, input().split()))
d =[0]*102
for i in number:
    d[i]=101
    
for j in range(102):
    if d[j]==101:
        continue
    d[j] = abs(X-j)
ans = min(d)
k=0
for l in range(102):
    if d[l]==ans:
        break
    k=k+1
print(k)
    




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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/11/22  Problem: 012_agc_a / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	N *= 3;
	VL a(N);
	FOR(i, 0, N) { cin >> a[i]; }
	SORT(a);
	int cnt = 0;
	for (int i = N - 2; cnt<N/3; i -= 2) {
		ans += a[i];
		cnt++;
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int d[] = new int[n];
		for(int i = 0; i < n; i++){
			d[i] = sc.nextInt();
		}

		int total = 0;
		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				total += d[i]*d[j];
			}
		}
		System.out.println(total);
	}

}


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

int main() {
  int n, q;
  cin >> n >> q;
  dsu d(n);
  rep(i,q) {
    int t, u, v;
    cin >> t >> u >> v;
    if(t == 0) d.merge(u, v);
    else{
      if(d.same(u, v)) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    int n;
    cin >> n;
    double ans = 0;
    rep(i, 0, n){
        double x;
        string s;
        cin >> x >> s;
        if(s == "JPY") ans += x;
        else ans += 380000.0 * x;
    }
    printf("%.10f\n", ans);
}

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

using namespace std;

#define show(x) cerr << #x << " = " << x << endl;

int main()
{
  int n, t;
  vector<int> times;


  cin>>n>>t;

  while(n--)
  {
    int e;
    cin>>e;
    times.push_back(e);
  }

  if(times.size()==1)
  {
    cout<<t<<endl;
    return 0;
  }

  long long totalTime = 0;
  for(int i=1;i<times.size();i++)
  {
    long long r = min(t, times[i]-times[i-1]);
    totalTime += r;
  }

  totalTime+=t;

  cout<<totalTime<<endl;


  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 998244353;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

int main(){
    ld pi = 3.14159265358979323846;
    ld a,b,h,m; cin >> a >> b >> h >> m;
    ld csq = a*a + b*b - 2.0* a * b * cos(min(abs(2.0*pi*(h/12.0 + m/720.0) - 2.0*pi*m/60.0) , (abs(2.0*pi*m/60.0 - 2.0*pi*(h/12.0 + m/720.0)))));
    ld c = sqrt(csq);
    cout << setprecision(15) << c << endl;
    return 0;
}

Measured memory_bytes: 4160
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(void) {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;

    vector<long long> A(X), B(Y), C(Z);
    for (int i = 0; i < X; i++) cin >> A[i];
    for (int i = 0; i < Y; i++) cin >> B[i];
    for (int i = 0; i < Z; i++) cin >> C[i];

    sort(A.begin(), A.end(), greater<long long>());
    sort(B.begin(), B.end(), greater<long long>());
    sort(C.begin(), C.end(), greater<long long>());
    
    vector<long long> AB(X*Y);
    for (int i = 0; i < X; i++) {
        for (int j = 0; j < Y; j++) {
            AB[i*Y+j] = A[i] + B[j];
        }
    }
    sort(AB.begin(), AB.end(), greater<long long>());

    long long AB_small_size = min(K, X*Y);
    vector<long long> AB_small = vector<long long>(AB.begin(), AB.begin() + AB_small_size);

    vector<long long> ABC(AB_small_size*Z);
    for (int i = 0; i < AB_small_size; i++) {
        for (int j = 0; j < Z; j++) {
            ABC[i*Z+j] = AB_small[i] + C[j];
        }
    }
    sort(ABC.begin(), ABC.end(), greater<long long>());

    for (int i = 0; i < K; i++) {
        cout << ABC[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
int same(int x,int y)
{  if(x==y)
   return 1;
   return 0;
}
int main()
{   string s;
    cin>>s;
    int x1=0;
    int x2=0;
    int y1=0;
    int y2=0;
    int n=s.length();
    for(int i=0;i<n;i++)
    {   if(s[i]=='N')
        x1=1;
        else if(s[i]=='S')
        x2=1;
        else if(s[i]=='W')
        y1=1;
        else if(s[i]=='E')
        y2=1;
	}
	if(same(x1,x2)&&same(y1,y2))
	printf("Yes\n");
	else
	printf("No\n");


















return 0;
}

Measured memory_bytes: 256
// Problem : D - Sum of Divisors
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_d
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}
vi prime,spf;
void sieve(int n)
{
	incd(prime,n+1);
	incd(spf,n+1);
	for(int i=0;i<=n;i++)
	spf[i]=i;
	prime[0]=1;
	prime[1]=1;
	for(int i=2;i*i<=n;i++)
	if(!prime[i])
	for(int j=i*i;j<=n;j+=i)
	{
		prime[j]=1;
		if(spf[j]==j)
		spf[j]=i;
	}
}
void solve()
{
int n;cin>>n;
sieve(n);
int sum=0;
for(int i=1;i<=n;i++)
{
	int factors=1;int cnt=0;
	int x=i,prev=spf[x];
	while(x!=1)
	{
		int y=spf[x];
		if(y==prev)
		{
			cnt++;
		}
		else
		{
			factors*=(cnt+1);
			cnt=1;
		}
		prev=y;
		x/=y;
	}
	factors*=(cnt+1);
	sum+=i*factors;
}
cout<<sum;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 159480
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,q;
  cin>>n>>q;
  vector<int> ki[n];
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    ki[a].push_back(b);
    ki[b].push_back(a);
  }
  int num[n]={0};
  int flag[n]={0};
  rep(i,q){
    int a,b;
   
    cin>>a>>b;
     a--;
    num[a]+=b;
  }
  int ans[n]={0};
  function<void(int,int)> dfs=
    [&](int u,int x){
      flag[u]=1;
      x+=num[u];
      ans[u]=x;
      for(auto &v:ki[u]){
	if(flag[v]==0) dfs(v,x);
      }
    };
  dfs((int)0,(int)0);
  rep(i,n){
    if(i) cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 30592
import numpy as np
NM = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
X=np.ones(NM[0])
AB=[]
for i in range(NM[1]):
  AB.append([int(x) for x in input().split()])
  if H[AB[i][0]-1]>H[AB[i][1]-1]:
    X[AB[i][1]-1]=0
  elif H[AB[i][0]-1]<H[AB[i][1]-1]:
    X[AB[i][0]-1]=0
  else:
    X[AB[i][1]-1]=0
    X[AB[i][0]-1]=0
x=0
for i in range(NM[0]):
  if X[i]==1:
    x+=1
print(x)

"""
6 5
8 6 9 1 2 1
1 3
4 2
4 3
4 6
4 6

3
"""

Measured memory_bytes: 48228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> rank(9);
  rep(i,n){
    int r = a[i];
    if(r<=399) rank[0]++;
    else if(r<=799) rank[1]++;
    else if(r<=1199) rank[2]++;
    else if(r<=1599) rank[3]++;
    else if(r<=1999) rank[4]++;
    else if(r<=2399) rank[5]++;
    else if(r<=2799) rank[6]++;
    else if(r<=3199) rank[7]++;
    else rank[8]++;
  }
  //cout << rank[5] << endl;
  int ans = 0;
  int sum;
  rep(i,9){
    if(rank[i]>0 && i<=7) ans++;
    if(i==8) sum = rank[8];
  }
  if(ans==0 && sum>0) cout << 1 << " " << sum << endl;
  else if(ans>0 && sum>=0) cout << ans << " " << ans + sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long int lli;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<pll> vop;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define REP(i,a,b) for( int i=a;i<b;i++)
#define REPR(i,a,b) for(int i=a;i>=b;i--)
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define PI 3.14159265358979323846
const ll N = 100005;

struct LessSecond
{
    template<typename T, typename U>
    bool operator()(const std::pair<T, U> &x, const std::pair<T, U> &y) const
    {
        return x.second < y.second;
    }
};

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }

ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); }

ll modInverse(ll a, ll m) { ll g = __gcd(a, m); return power(a, m - 2, m); }


int main()
{


    fastIO;
    int test = 1;
    //cin >> test;
    while (test--)
    {
        string s, t;
        cin >> s >> t;
        int ans = 0;
        REP(i, 0, s.size())
        {
            if (s[i] != t[i])
                ans++;
        }
        cout << ans << endl;
    }
    return 0;
}



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

typedef long long ll;

int main () {
	int N, K;
	vector <int> v;
	cin >> N >> K;
	for (int i=0; i<N; i++) {
		int tmp;
		cin >> tmp;
		v.push_back (tmp);
	}
	sort (v.begin(), v.end());
	int sum = 0;
	for (int i=0; i<K; i++)  {
		sum += v[i];
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=998244353;
const int N=25;
char s[N][N];
int n,m,ans;
int C[N][N],P[N];
int f[N][N],g[N][N];
int ok1[1<<10][N];
int ok2[1<<10][N];
void init(){
	P[0]=1;
	For(i,1,N-1) P[i]=2*P[i-1];
	For(i,0,N-1) C[i][0]=1;
	For(i,1,N-1) For(j,1,i)
		C[i][j]=C[i-1][j]+C[i-1][j-1];
}
int main(){
	init();
	scanf("%d%d",&n,&m);
	For(i,1,n) scanf("%s",s[i]+1);
	f[0][0]=1;
	For(S,0,2*N-2) For(i,0,N-1) if (S>=i&&S-i<=N-1)
		For(k,1,N-1-(S-i)) f[S-i+k][i]=(f[S-i+k][i]+1ll*f[i][S-i]*C[S-i+k][k])%mo;
	For(i,0,N-1) For(j,0,i) f[i][j]=f[j][i]=(f[i][j]+f[j][i])%mo;
	f[0][0]=1;
	For(i,1,n) For(j,1,m) For(x,0,i) For(y,0,j)
		g[i][j]=(g[i][j]+1ll*C[i][x]*C[j][y]%mo*f[x][j-y]%mo*f[i-x][y])%mo;
	For(i,0,(1<<n)-1) For(j,1,m){
		int cnt=0,S=0;
		For(k,1,n) if (i&(1<<(k-1)))
			cnt+=(s[k][j]=='#'),S++;
		ok1[i][j]=(cnt&&cnt!=S);
	}
	For(i,0,(1<<m)-1) For(j,1,n){
		int cnt=0,S=0;
		For(k,1,m) if (i&(1<<(k-1)))
			cnt+=(s[j][k]=='#'),S++;
		ok2[i][j]=(cnt&&cnt!=S);
	}
	For(i,1,(1<<n)-1) For(j,1,(1<<m)-1){
		bool fl=1;
		For(k,1,m) if (j&(1<<(k-1))) fl&=ok1[i][k];
		For(k,1,n) if (i&(1<<(k-1))) fl&=ok2[j][k];
		if (!fl||!(i+j)) continue;
		int S1=n,S2=m;
		//cout<<i<<' '<<j<<endl;
		For(k,1,m) if (j&(1<<(k-1))) S2--;
		For(k,1,n) if (i&(1<<(k-1))) S1--;
		if (!S1&&!S2) ans=(ans+1)%mo;
		else if (!S1||!S2) ans=(ans+P[S1+S2])%mo;
		else ans=(ans+g[S1][S2])%mo;
	}
	//cout<<f[n][m]<<endl;
	ans=(ans+f[n][m])%mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 512
#ABC0126-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
import math
n,k=IL()
ans=0
for i in range(1,n+1):
    if i>=k:
        ans+=1
    else:
        ans+=1/pow(2,math.ceil(math.log(k/i,2)))
print(ans/n)

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


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

    if(k>= n) dunk(0);

    else{
        sort(h.begin(),h.end());

        ll ans=0;
        rep(i,n-k){
            ans += h[i];
        }

        dunk (ans);
    }
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
using namespace std;
class IDisplay
{
public:
	virtual void disp(bool result) =0;
	virtual ~IDisplay(){}
};
class Display:public IDisplay
{
	static string msg[2];
public:
	void disp(bool result) { 
		cout << msg[result] << endl;
	}
};
string Display::msg[2]= { "Yes","No" };
class Circle
{
	int x, y,r;
	bool over(int b, int r, int m){	return (b+r > m) ? true : false;}
	bool under(int b, int r){	return (b-r < 0) ? true : false;}
public:
	Circle(int x, int y ,int r) :x(x), y(y),r(r) {}
	bool error(int W, int H)
	{
		if (!under(x, r) && !under(y, r) && !over(x, r, W) && !over(y, r, H)) return false;
		return true;
	}
};
class Rect
{
	int W, H;
public :
	Rect(int w, int h) :W(w), H(h) {}
	bool over(Circle& circle) {return circle.error(W, H);}
};
int main()
{
	int w,h,x,y,r;
	cin >> w>>h>>x>>y>>r;
	Display dspp;
	IDisplay* dsp= &dspp;
	Rect rect(w, h);
	Circle circle(x, y, r);
	dsp->disp(rect.over(circle));
	return 0;

}

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

int main(){
    int n,count=0, ans=0;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];

    vector<int> list(n);
    rep(i,n) list[i] = i+1;
    int a = 0, b = 0, equal_count = 0;
    do {
        count++;
        if (p == list || q == list ) {
            equal_count++;
            if (p == list && q == list) {
                ans = 0;
            }
            else {
                if (equal_count==1) {
                    a = count;
                } else {
                    b = count;
                }
            }
            
        }
        
    } while(next_permutation(list.begin(), list.end()));
    cout << b-a << endl;
    return 0;
}

Measured memory_bytes: 3612
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static long B;
  static long C;
  static double min = 9999999;
  static long ans = 0;




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

    int N = scanner.nextInt();

    double ans = 0;

    for (int i = 0; i < N; i++) {
      double mon = scanner.nextDouble();
      String s = scanner.nextLine();
//      System.out.println(s);


      if(s.equals(" JPY")){
        ans += mon;
      }else{
        ans += mon * 380000.0;
      }
    }

    System.out.println(ans);

  }

  public static boolean retAns(String s){


    String[] h = s.split("/");

    if(Integer.parseInt(h[0]) <= 2018) return true;

    if(Integer.parseInt(h[1])  <= 4) return true;


    return false;
  }


}


Measured memory_bytes: 24532
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N,P;
  string S;
  cin>>N>>P>>S;
  ll ans=0;
  if(P!=2&&P!=5){
    reverse(all(S));
    vector<ll> X(N+1);
    vector<ll> Y(N+1);
    Y[0]=1;
    rep(i,N+1) if(i) Y[i]=Y[i-1]*10%P;
    rep(i,N+1){
      if(i){
        X[i]=(S[i-1]-'0')*Y[i-1];
        X[i]=(X[i]+X[i-1])%P;
      }
    }
    sort(all(X));
    ll A=1;
    rep(i,N+1){
      if(i){
        if(X[i]!=X[i-1]){
          ans+=A*(A-1)/2;
          A=1;
        }else A++;
      }
    }
    ans+=A*(A-1)/2;
  }else if(P==2){
    rep(i,N){
      if((S[i]-'0')%2==0){
        ans+=i+1;
      }
    }
  }else{
    rep(i,N){
      if((S[i]-'0')%5==0){
        ans+=i+1;
      }
    }
  }
  cout<<ans<<endl;
}




Measured memory_bytes: 3716
S=input()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
    print('Yes')
elif S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]:
    print('Yes')
elif S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]:
    print('Yes')
else:
    print('No')

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

string s[100];
int n, m, arr[100][100];

int main(){
	cin>>n>>m;
	
	for(int i=1; i<=n; i++){
		cin>>s[i];
		s[i]="0"+s[i];
	}
	
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(s[i][j]=='#'){
				for(int k=-1; k<=1; k++){
					for(int l=-1; l<=1; l++){
						arr[i+k][j+l]++;
					}
				}
			}
		}
	}
	
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(s[i][j]=='#') cout<<"#";
			else cout<<arr[i][j];
		}
		cout<<endl;
	}
}


Measured memory_bytes: 3640
//Bite Eating
#include<stdio.h>
int main(){
    int N,L,sum = 0,less = 10000,less_n;
    int data[200],sa[200];
    scanf("%d%d",&N,&L);
    for(int i = 1;i <= N;i++){
        data[i-1] = L + i - 1;
        // printf("%d\n",data[i-1]);
    }
    // printf("-------\n");
    for(int i = 0;i < N; i++){
        sa[i] = (0 - data[i])*(0 - data[i]);
        // printf("sa=%d\n",sa[i]);
        //絶対値の2乗

        if(less > sa[i]){
            less = sa[i];
            less_n = i;
        }
        // printf("less:%d,less_n:%d\n-------",less,less_n);
    }

    for(int i = 0; i < N; i++){
        if(i != less_n){
            sum+=data[i];
            // printf("%d %d\n",data[i],sum);
        }
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << a*b << '\n';
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;
#define PI 3.141592653589793


int main()
{
	double a, b, x;cin>>a>>b>>x;
	double h=x/(a*a);
	double ans;
	//cout<<h<<endl;
	if(h>=(b/2))
	{
		ans=atan((b-h)/(a/2.0))*180/PI;
	}
	else
	{
		double sa=a*h*2/b;
		ans=atan(a*h*2/sa/sa)*180/PI;
	}
	

	printf("%.10f",ans);
	return 0;
}

Measured memory_bytes: 256
L,R=map(int,input().split())
if R-L>=2019:
  print(0)
else:
  ans=114514
  bia=1
  total=R-L+1
  for i in range(total-1):
    i2=i+L
    for j in range(total-bia):
      j2=j+L+bia
      if (i2*j2)%2019<ans:
        ans=(i2*j2)%2019
  print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
const int N=100;
const int W=10000;
int n,w,v[N],wi[N];
int dp[N+1][W+1];


int main(){
	stack<ll> st;
	string s;
	getline(cin,s);
	ll i=0;
	while(i<s.size()){
		char c = s[i];
		if(c==' '){
			i++;
			continue;
		}
		if(c=='+'||c=='-'||c=='*'){
			ll x,y,z;
			x = st.top();
			st.pop();
			y = st.top();
			st.pop();
			if(c=='+')z = x+y;
			else if(c=='-')z=y-x;
			else z=x*y;
			st.push(z);
		}else{
			ll x = c - '0';
			while(s[i+1]<='9'&&s[i+1]>='0'){
				i++;
				x *= 10;
				x += s[i] - '0';
			}
			st.push(x);
		}
		i++;
	}
	cout<<st.top()<<endl;
}


Measured memory_bytes: 3212
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>

using namespace std;

int main(){
  long N,K;
  long a[200005];
  fill_n(a,200005,0);
  long t;
  long count;

  cin >> N >> K;
  for(int i=0;i<N;++i){
    cin >> t;
    a[t-1]++;
  }
  count = N;
  sort(a,a+N,greater<int>());
  for(int i=0;i<K;++i){
    count -= a[i];
  }
  cout << count << endl;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-9;

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

bool check(int x, int y, vector< vector<int> >& a, int& num) {
	if (x == -1) return false;
	a[y][x] = 0;
	int n = a.size();
	for (int k = 0; k < (n == 1 ? 1 : 4); k++) {
		int cnt = -1;
		for (int _x = x, _y = y; _x >= 0 && _x < n && _y >= 0 && _y < n && !a[_y][_x]; _x += dx[k], _y += dy[k])
			cnt++;
		for (int _x = x, _y = y; _x >= 0 && _x < n && _y >= 0 && _y < n && !a[_y][_x]; _x -= dx[k], _y -= dy[k])
			cnt++;
		if (cnt >= n) num++;
	}
	return false;
}

int main() {
	int n, u, v, m;
	cin >> n >> u >> v >> m;
	vector< vector<int> > a(n, vector<int>(n)), b = a;
	vector<int> xa(1000001, -1), ya = xa, xb = xa, yb = xa;
	for (int y = 0; y < n; y++)
		for (int x = 0; x < n; x++) {
			int k; cin >> k;
			a[y][x] = k;
			xa[k] = x; ya[k] = y;
		}
	for (int y = 0; y < n; y++)
		for (int x = 0; x < n; x++) {
			int k; cin >> k;
			b[y][x] = k;
			xb[k] = x; yb[k] = y;
		}
	int na = 0, nb = 0;
	while (m--) {
		int k; cin >> k;
		check(xa[k], ya[k], a, na);
		check(xb[k], yb[k], b, nb);
		bool fa = (na >= u), fb = (nb >= v);
		if (fa && fb) {
			cout << "DRAW" << endl;
			return 0;
		}
		if (fa && !fb) {
			cout << "USAGI" << endl;
			return 0;
		}
		if (!fa && fb) {
			cout << "NEKO" << endl;
			return 0;
		}
	}
	cout << "DRAW" << endl;
}

Measured memory_bytes: 17892
l = [0,1,32,243,1024,3125,7776,16807,32768,59049,100000,161051,248832,371293,537824,759375,1048576,1419857,1889568,2476099,3200000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176,69343957,79235168,90224199,102400000,115856201,130691232,147008443,164916224,184528125,205962976,229345007,254803968,282475249,312500000,345025251,380204032,418195493,459165024,503284375,550731776,601692057,656356768,714924299,777600000,844596301,916132832,992436543,1073741824,1160290625,1252332576,1350125107,1453933568,1564031349,1680700000,1804229351,1934917632,2073071593,2219006624,2373046875,2535525376,2706784157,2887174368,3077056399,3276800000,3486784401,3707398432,3939040643,4182119424,4437053125,4704270176,4984209207,5277319168,5584059449,5904900000,6240321451,6590815232,6956883693,7339040224,7737809375,8153726976,8587340257,9039207968,9509900499,10000000000,10510100501,11040808032,11592740743,12166529024,12762815625,13382255776,14025517307,14693280768,15386239549,16105100000,16850581551,17623416832,18424351793,19254145824,20113571875,21003416576,21924480357,22877577568,23863536599,24883200000,25937424601,27027081632,28153056843,29316250624,30517578125,31757969376,33038369407,34359738368,35723051649,37129300000,38579489651,40074642432,41615795893,43204003424,44840334375,46525874176,48261724457,50049003168,51888844699,53782400000,55730836701,57735339232,59797108943,61917364224,64097340625,66338290976,68641485507,71008211968,73439775749,75937500000,78502725751,81136812032,83841135993,86617093024,89466096875,92389579776,95388992557,98465804768,101621504799,104857600000,108175616801,111577100832,115063617043,118636749824,122298103125,126049300576,129891985607,133827821568,137858491849,141985700000,146211169851,150536645632,154963892093,159494694624,164130859375,168874213376,173726604657,178689902368,183765996899,188956800000,194264244901,199690286432,205236901143,210906087424,216699865625,222620278176,228669389707,234849287168,241162079949,247609900000,254194901951,260919263232,267785184193,274794888224,281950621875,289254654976,296709280757,304316815968,312079600999,320000000000]

x = int(input())

flag = False
for i in range(len(l)):
    for j in range(len(l)):
        a = l[i]
        b = l[j]
        if a - b == x:
            print("{} {}".format(i, j))
            
            flag = True
            break
        
        a = l[i] * -1
        b = l[j]
        if a - b == x:
            print("{} {}".format(i * -1, j))
            
            flag = True
            break
        
        a = l[i]
        b = l[j] * -1
        if a - b == x:
            print("{} {}".format(i, j * -1))
            
            flag = True
            break
        
        a = l[i] * -1
        b = l[j] * -1
        if a - b == x:
            print("{} {}".format(i * -1, j * -1))
            
            flag = True
            break
        
    if flag:
        break

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

int main(){
  int N,M;
  int sum = 0;
  cin >> N;
  M = N;
  while(N > 0){
    sum += N % 10;
    N /= 10;
  }
  if(M % sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
queue = (1..9).map {|x| [x] }
k = gets.to_i
count = 0
ans = -1

loop do
  x = queue.shift
  count += 1
  
  if count == k
    ans = x
    break
  end

  if x.last == 0
    queue << (x + [0]) << (x + [1])
  elsif x.last != 9
    last = x.last
    queue << (x + [last - 1]) << (x + [last]) << (x + [last + 1])
  elsif x.last == 9
    queue << (x + [8]) << (x + [9])
  end
end

puts ans.join('')

Measured memory_bytes: 37884
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n;
        cin >> n;

        if (n >= 30)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
int main()
{
	ll a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	if (c >= a) {
		c -= a;
		a = 0ll;
		b = MAX(b - c, 0ll);
	}
	else {
		a -= c;
	}
	printf("%lld %lld", a, b);
	return 0;
}

Measured memory_bytes: 256
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n,m = map(int,input().split())
e = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    e[a].append(b)
    e[b].append(a)
qv = int(input())
Q = [list(map(int,input().split())) for i in range(qv)]

color = [0]*(n+1)
used = [-1]*(n+1)

for v,d,c in Q[::-1]:
    if used[v] > d:
        continue
    
    q = deque([[v,d]])
    while q:
        now, dis = q.popleft()
        if dis < 0:
            continue
        if color[now] == 0:
            color[now] = c
        for nex in e[now]:
            if used[nex] < dis-1:
                used[nex] = dis-1
                q.append([nex,dis-1])
    
for i in color[1:]:
    print(i)

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

int main(){
string n;
cin >> n;
if(n[0]==n[1] && n[1]==n[2] && n[2]==n[0]){
  cout << "Yes" << endl;
}else if(n[1]==n[2] && n[2]==n[3] && n[3]==n[1]){
  cout << "Yes" << endl;
}else{
  cout << "No" << endl;
}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n, x, y;
    cin >> n >> x >> y;
    int cnt[n-1];
    for(int i=0; i<n; i++) cnt[i]=0;
    for(int i=0;i<n; i++){
      for(int j=i+1; j<n; j++){
        int tmp = min(j-i, abs(x-1-i)+abs(y-1-j)+1);
        cnt[tmp-1]++;
      }
    }
    for(int i=0; i<n-1; i++)
      cout << cnt[i] << endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
using lli = long long int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
  int n, m;
  cin >> n >> m;
  vector<string> a(n), b(m);
  for(auto& s : a) cin >> s;
  for(auto& s : b) cin >> s;

  rep(i, n-m+1){ rep(j, n-m+1){
    bool check = true;
    
    rep(x, m) rep(y, m)
      if(a.at(i+x).at(j+y)!=b.at(x).at(y))
        check = false;

    if(check) {
      cout << "Yes" << endl;
      return 0;
    }  
  }}
  
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
if k>((n-1)*(n-2))//2:
  print(-1)
  exit()
print(n-1+((n-1)*(n-2))//2-k)
for i in range(2,n+1):
  print(1,i)
cnt=((n-1)*(n-2))//2-k
for i in range(2,n+1):
  for j in range(i+1,n+1):
    if cnt>0:
      print(i,j)
      cnt-=1
    else:
      break

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
string k;
int n, d;
const int MOD = 1000000007;
vector dp(10001, vector (101, vector (2, 0))); // 上からi桁見てDで割ったあまりがjでありK以下であることが確定して{いる, いない}場合の数
void solve(){
  dp[0][0][1] = 1;
  for(int i=0; i<n; i++){
    int digit = k[i] - '0';
    for(int j=0; j<d; j++){
      for(int num=0; num<10; num++){
        if(num < digit){
          dp[i+1][(j+num)%d][0] += dp[i][j][0] + dp[i][j][1];
        }
        else if(num == digit){
          dp[i+1][(j+num)%d][0] += dp[i][j][0];
          dp[i+1][(j+num)%d][1] += dp[i][j][1]; 
        }
        else{
          dp[i+1][(j+num)%d][0] += dp[i][j][0];
        }
        dp[i+1][(j+num)%d][0] %= MOD;
        dp[i+1][(j+num)%d][1] %= MOD;
      }
    }
  }
}
int main(){
  cin >> k >> d;
  n = k.size();
  solve();
  cout << ((dp[n][0][0] + dp[n][0][1]) % MOD + MOD - 1) % MOD<< endl;
}

Measured memory_bytes: 58896
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	int INF = 1 << 28;
	double EPS = 1e-10;

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

	int w, h;
	char s[][];

	void run() {
		while (true) {
			w = sc.nextInt();
			h = sc.nextInt();
			if ((w | h) == 0)
				break;
			s = new char[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					s[i][j] = sc.next().charAt(0);
				}
			}
			int ans = INF;

			int dx[][] = new int[2][9];
			int dy[][] = new int[2][9];
			dx[0] = new int[] { 1, 1, 2, 1, 2, 3, 1, 2, 1 };
			dy[0] = new int[] { -2, -1, -1, 0, 0, 0, 1, 1, 2 };
			dx[1] = new int[] { -1, -1, -2, -1, -2, -3, -1, -2, -1 };
			dy[1] = new int[] { -2, -1, -1, 0, 0, 0, 1, 1, 2 };
			for (int k = 0; k < w; k++) {
				if (s[h - 1][k] == 'S') {
					Queue<Node> q = new PriorityQueue<Node>(w * h * 2,
							new Comparator<Node>() {
								@Override
								public int compare(Node o1, Node o2) {
									// TODO 自動生成されたメソッド・スタブ
									return o1.t - o2.t;
								}
							});
					int d[][][] = new int[2][w][h];
					for (int i = 0; i < 2; i++) {
						for (int j = 0; j < w; j++) {
							Arrays.fill(d[i][j], INF);
						}
					}
					d[0][k][h - 1] = 0;
					d[1][k][h - 1] = 0;
					q.add(new Node(k, h - 1, 0, 0));
					q.add(new Node(k, h - 1, 1, 0));
					while (!q.isEmpty()) {
						Node n = q.poll();
						int x = n.x;
						int y = n.y;
						int t = n.t;
						int leg = n.leg;
						if (d[leg][x][y] < t)
							continue;
						for (int i = 0; i < 9; i++) {
							int nx = x + dx[leg][i];
							int ny = y + dy[leg][i];
							if (nx < 0 || ny < 0 || nx >= w || ny >= h
									|| s[ny][nx] == 'X')
								continue;
							int nt = 0;
							if (s[ny][nx] >= '1' && s[ny][nx] <= '9') {
								nt = s[ny][nx] - '0';
							}
							if (d[leg ^ 1][nx][ny] > d[leg][x][y] + nt) {
								d[leg ^ 1][nx][ny] = d[leg][x][y] + nt;
								q.add(new Node(nx, ny, leg ^ 1, nt));
							}
						}
					}
					for (int i = 0; i < w; i++) {
						if (s[0][i] == 'T')
							for (int j = 0; j < 2; j++) {
								ans = Math.min(ans, d[j][i][0]);
							}
					}
				}
			}
			System.out.println(ans != INF ? ans : -1);
		}
	}
}

class Node {
	int x;
	int y;
	int leg;
	int t;

	Node(int x, int y, int leg, int t) {
		this.x = x;
		this.y = y;
		this.leg = leg;
		this.t = t;
	}
}

Measured memory_bytes: 73640