akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl

#define lli long long int
#define ull unsigned long long int
#define mod 1000000007



int main()
{
    IOS;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int n,k;
    cin>>n>>k;
    int arr[n],dp[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
        dp[i]=INT_MAX;
    }
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++){
        for(int j=1;j<=k;j++){
            if(i-j>=0) {
                dp[i]=min(dp[i],abs(arr[i]-arr[i-j])+dp[i-j]);
            }
        }
    }
    
    cout<<dp[n-1];

    return 0;
}

Measured memory_bytes: 4352
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto x = readln.chomp.replace(" ", "").to!int;
  auto y = sqrt(x.to!double);
  
  if ( y - y.to!int > 0) {
    writeln("No");
  } else {
    writeln("Yes");
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

string n;
int main() {
    cin>>n;
    
    REP(i, 0, n.size()){
        if(n[i]=='1') cout<<9;
        else cout<<1;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner a = new Scanner(System.in);
    int x = a.nextInt();
    int y = a.nextInt();
    int c = a.nextInt();
  	x  = x-y;
    y = y+x;
    x = y-x;
    
    x = x - c;
    c = c+x;
    x = c-x;
    System.out.println(x + " "+ y + " " + c);
  }

}


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

int main(){
    int n,k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; ++i){
        cin >> p[i];
    }
    int sum = 0;
    sort(p, p + n);
    for (int i = 0; i < k; ++i){
       sum+=p[i]; 
    }
    cout << sum << endl; 
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define PAUSE \
    int t;    \
    cin >> t
#define int long long
#define vi vector<long long>
#define mapii map<long long, int>
#define mapci map<char, int>
#define append(x) push_back(x)
#define tcase          \
    long long t;       \
    scanf("%lld", &t); \
    while (t--)
#define maxheap priority_queue<int>
#define minheap priority_queue<int, vector<int>, greater<int>>
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
// #define debug(x, y) cout << "case #" << x << " at itr #" << y << endl
// #define debug(x) cout << "case #" << x << endl
#define ff first
#define ss second
#define range(ini, x) for (int itr = ini; itr < x; itr++)
#define takearr(x)    \
    for (auto &i : x) \
    cin >> i
#define print(x)     \
    for (auto i : x) \
        cout << i << " ";
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define foreach(i, x) for (auto i : x)
#define double long double
#define setbitcount __builtin_popcount

// #define range(ini, x, step) for( int itr = ini, i < x; itr += step )
using namespace std;
// using namespace __gnu_pbds;
// template < class type > using oset=tree<type, null_type,less<type>, rb_tree_tag,tree_order_statistics_node_update>;
const int mmx = 2e5 + 1;
const int mnx = 1e4 + 1;
const int mmod = 1e9 + 7;

int dp[mmx];

int fx(vi &arr, int idx, int K)
{
    int n = arr.size();

    if (idx >= n - 1)
    {
        dp[idx] = 0;
        return 0;
    }

    if (dp[idx] != -1)
        return dp[idx];

    int mini = INT_MAX;

    for (int i = 1; i <= K && idx + i < n; ++i)
    {
        mini = min(mini, abs(arr[idx] - arr[idx + i]) + fx(arr, idx + i, K));
    }

    dp[idx] = mini;
    return dp[idx];

    return 0;
}

signed main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int tcases;
    // cin >> tcases;
    tcases = 1;

    for (int __case = 1; __case <= tcases; __case++)
    {
        //cout << "Case #" << __case << ":";
        /* Code */
        memset(dp, -1, sizeof(dp));
        int N, K;
        cin >> N >> K;
        vi arr(N);
        takearr(arr);
        cout << fx(arr, 0, K) << endl;
    }

    return 0;
}


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

using namespace std;

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

    double d;
    cin >> d;
    cout << fixed << setprecision(10) << max(sqrt(2) * d, (int)d + 1.0) << endl;
}


Measured memory_bytes: 3288
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		System.out.println((int)Math.ceil((double)n/2));
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void print(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void print(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;




signed main(){
  int ans = 0;
  int a, b, c;
  cin >> a >> b;
  rrep(i,3){
    if((a*b*i)%2 == 1)ans = 1;
  }
  cout << (ans ? "Yes" : "No") << endl;
	return 0;
}










Measured memory_bytes: 256
line = input().split(" ")
syurui = int(line[0])
itemCnt = int(line[1])

line2 = input().split(" ")
line2 = list(map(int,line2))
line2.sort(reverse=True)
okFlg = True;

for i in range(itemCnt):
  if line2[i] < 1 / (4 * itemCnt) * sum(line2):
    okFlg = False;
  
if okFlg:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;    
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
#define PI 3.1415926535897932384626433832795
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define trav(x,v) for (auto &x : v)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define pv(v) trav(x, v) cout << x << " "; cout << endl; // print vector/array
#define pvv(vv) trav(xx, vv){pv(xx);} // print 2-d vector/2-d array
#define pm(m) trav(x, m) cout << x.F << ":" << x.S << " "; cout << endl; //print map/lookup table

const int MOD = 1000000007;

/**
 When there is nothing there is lonliness.
 **/

ll solve(ll n, ll W, vector<ll> &w, vector<ll> &v){
    ll dp[2][1000*n + 1];
    F0R(i,1000*n + 1){
        dp[0][i] = W+1;
        dp[1][i] = W+1;
    }
    dp[0][0] = 0;
    dp[1][0] = 0;
    for(int j=0;j<n;j++){
        for(int i=0;i<=1000*n;i++){
            if(v[j] <= i){
                dp[j%2][i] = min(dp[(j+1)%2][i], dp[(j+1)%2][i - v[j]] + w[j]);
            }
            else{
                dp[j%2][i] = dp[(j+1)%2][i];
            }
        }
    }
    ll ret=0;
    for(int i=0;i<=1000*n;i++){
        if(dp[(n-1)%2][i] <= W)
            ret = i;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,W;
    cin >> n >> W;
    vector<ll> w(n);
    vector<ll> v(n);
    F0R(i, n) cin >> w[i] >> v[i];
    cout << solve(n,W,w,v);
    return 0;
}

Measured memory_bytes: 5168
from collections import defaultdict
n,c=map(int,input().split())
x=[list(map(int,input().split()))for i in range(c)]
e=[[0]*c for i in range(3)]
for i in range(n):
    a=list(map(int,input().split()))
    for j in range(n):
        e[(i+j+2)%3][a[j]-1]+=1
p=float("inf")
for i in range(c):
    for j in range(c):
            if i!=j:
                for h in range(c):
                    if i!=h and j!=h:
                        p=min(p,sum([x[s][i]*d for s,d in enumerate(e[0])]+[x[s][j]*d for s,d in enumerate(e[1])]+[x[s][h]*d for s,d in enumerate(e[2])]))
print(p)                    

Measured memory_bytes: 3436
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = list(input())
c = Counter(S)
w = c["W"]
e = c["E"]
al = w + e
# WWWWW -> EEEEE
# 変えるべきE
ans = e
num_w, num_e = 0, e
for i in range(N):
    sign = S[i]
    if sign == "W":
        w += 1
        al = al + 1
        num_w += 1
    elif sign == "E":
        num_e -= 1
    ans = min(ans, num_e + num_w)
print(ans)



Measured memory_bytes: 6860
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        System.out.println(gcd(Math.max(x, y), Math.min(x, y)));
        sc.close();
    }

    static int gcd(int x, int y) {
        while (y > 0) {
            int r = x % y;
            x = y;
            y = r;
        }
        return x;
    }
}


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


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

    string s,t;
    cin >> s >> t;
    int ans=0;
    rep (i, 3) if (s[i]==t[i]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
int main()
{
    int a;
    int b;
    int d1;
    int k=0;
    int s1,s2=0;

    
            while(scanf("%d%d",&a,&b)!=EOF && k<200){
        s1=a+b;
        for(;;)
            {
                d1=s1%10;
                s2+=1;
                s1=s1/10;

                if(s1==0)
                    {
                        break;
                    }
            }

            k++;
            printf("%d\n",s2);
            s2=0;

    }
return 0;
}

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

signed main(){
	int n, k; cin >> n >> k;
	vector<int> a(n), b(n, 0);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	for(int i = 0; i < min(k, 100); i++){
		for(int j = 0; j < n; j++) b[j] = 0;
		for(int j = 0; j < n; j++){
			int left = max(0, j - a[j]);
			b[left]++; 
			int right = a[j] + j;
			if(right < n - 1) b[right + 1]--;
		}
		for(int j= 1; j < n; j++){
			b[j] += b[j - 1];
		}
		a  = b;
	}
	for(int i = 0; i < n; i++){
		cout << b[i] << " ";
	}
	cout << endl;
}

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

int main() {
  string s;
  cin >> s;

  string t = "YAKI";
  for (int i = 0; i < 4; ++i) {
    if (s[i] != t[i]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


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

int main() {
  int H,W;
  while(1){
    cin >> H >> W;
    if(H==0 && W==0)
      break;
    for(int i=1; i<=H; i++){
      for(int j=1; j<=W; j++){
      cout << '#';
    }
    cout << endl;
  }
    cout << endl;
  }
}



Measured memory_bytes: 3076
#include <stdio.h>
#include <algorithm>

long long int N, x, a[112345];
long long int ans = 0;

int main(void)
{
	scanf("%lld%lld", &N, &x);
	for (int i = 0; i < N; ++i) { scanf("%lld", &a[i]); }

	for (int i = 0; i < N - 1; ++i)
	{
		if (i == 0)
		{
			if (a[i] > x)
			{
				ans += a[i] - x;
				a[i] = x;
			}
			if (a[i] + a[i + 1] > x)
			{
				ans += (a[i] + a[i + 1]) - x;
				a[i + 1] -= (a[i] + a[i + 1]) - x;
			}
		}
		else
		{
			if (a[i] + a[i + 1] > x)
			{
				ans += (a[i] + a[i + 1]) - x;
				a[i + 1] -= (a[i] + a[i + 1]) - x;
			}
		}
	}

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
/*
 _____ ____ _____   ___   ___   ___   ___ 
|_   _/ __ \_   _| |__ \ / _ \ |__ \ / _ \
  | || |  | || |      ) | | | |   ) | | | |
  | || |  | || |     / /| | | |  / /| | | |
 _| || |__| || |_   / /_| |_| | / /_| |_| |
|_____\____/_____| |____|\___/ |____|\___/ 
*/
#include <bits/stdc++.h>
#include <fstream>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
// pair<int,int>ert(x==y); gives run time when false
using namespace std;
int dp[1000][1000];
int main(){
    CIN;
    int n,m;
    cin >> n >> m;
    char g[n][m];
    rep(i,0,n){
        rep(j,0,m){
            cin >> g[i][j];
        }
    }
    rep(i,0,n){
        if(g[i][0]=='#')break;
        dp[i][0] = 1;
    }
    rep(i,0,m){
        if(g[0][i]=='#')break;
        dp[0][i] = 1;
    }
    rep(i,1,n){
        rep(j,1,m){
            if(g[i][j]=='#')continue;
            dp[i][j] += dp[i][j-1];
            dp[i][j]%=MOD;
            dp[i][j] +=  + dp[i-1][j];
            dp[i][j]%=MOD;
        }
    }
    if(dp[0][0]==0){
        cout << 0;
        return 0;
    }
    cout << dp[n-1][m-1];
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;


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

  ll t = 0;
  for (ll i = 0; i < k; i++){
    t = (10*t + 7) % k;
    if (t == 0){
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  
  return 0;
}


Measured memory_bytes: 3572
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  string S;
  cin >> S;
  bool flag = true;
  rep(i,S.length()){
    if(i%2 == 0){
      if(S[i] == 'L') flag = false;
    }else{
      if(S[i] == 'R') flag = false;
    }
    if(!flag) break;
  }
  if(flag) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
from collections import deque
num_ver, times_plus = map(int,input().split())
done_ls = [0] * num_ver
graph_ls = [[] for _ in range(num_ver)]
for i in range(num_ver-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph_ls[a].append(b)
    graph_ls[b].append(a)

point_ls = [0] * num_ver
for i in range(times_plus):
    ver, point = map(int,input().split())
    ver -= 1
    point_ls[ver] += point

queue = deque()
queue.append([0,0])
ans_ls = [0] * num_ver
visited_ls = [0] * num_ver
while queue:
    ver, point_before = queue.pop()
    point_after = point_before + point_ls[ver]
    ans_ls[ver] = point_after
    visited_ls[ver] = 1
    for nex in graph_ls[ver]:
        if visited_ls[nex] != 1:
            queue.append([nex, point_after])
for ans in ans_ls:
    print(ans)
    




Measured memory_bytes: 68936
#include <iostream>
#include <vector>
#include<iomanip>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int N,Y;

int main(int argc, const char * argv[]) {
    cin >> N >> Y;
    int i,j,k;
    for (i = 0; i < N + 1; i++) {
        for (j = 0; j < N + 1 - i; j++){
            k = N - i - j;
            if ((10000 * i + 5000 * j + 1000 * k) == Y) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int max = 1;
		sc.close();
		for(int i=2;i<x;i++) {
			int pow = 2;
			while(true) {
				int num = (int) Math.pow(i,pow);
				if(num>x) break;
				if(num>max) max = num;
				pow++;
			}
			if(pow == 2) break;
		}
		System.out.println(max);
	}
}

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cout << name << " = " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names+1, ',');
    cout.write(names, comma - names) << " = " << arg1 <<" | ";
    __f(comma+1, args...);
}
#else
#define debug(...)
#endif

const int N = 2005;
const LL MOD = 1e9 + 7;
int s;
LL dp[N];

LL call(int sum)
{
    if(sum == 0)return 1;
    if(dp[sum] != -1)return dp[sum];
    LL ret = 0;
    for(int i = 3;i <= sum;i++){
        ret = (ret + call(sum - i)) % MOD;
    }
    return dp[sum] = ret;
}
int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    MEM(dp,-1);
    cin >> s;
    cout << call(s) << "\n";
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


Measured memory_bytes: 3684
from collections import *;M=lambda:map(int,input().split());r=range;n,k,l=M()
def f(m):
 *a,=r(n)
 def g(i):
  if a[i]==i:return i
  a[i]=g(a[i]);return a[i]
 for _ in r(m):p,q=M();a[g(q-1)]=g(p-1)
 return [g(i) for i in r(n)]
z=[*zip(f(k),f(l))];c=Counter(z);print(*(c[x]for x in z))

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

void solve(long long N){
    if (N == 1) {
        double ans = 1.0;
        printf("%.6f\n", ans);
    } else if (N % 2) {
        double ans = (N/2 + 1) / double(N);
        printf("%.6f\n", ans);
    } else {
        double ans = 0.5;
        printf("%.6f\n", ans);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

int main(){
    long long X,Y,n;
    cin>>X;
    n=0;
    Y=100;
    while(!(Y>=X)){
        Y=Y*1.01;
        //cout<<Y<<endl;
        ++n;
        //cout<<n<<endl;
    }
    cout<<n<<endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef pair<int,int> pii;

signed main(void) {
  int i,j;
  string s;
  cin>>s;
  ll n=s.size();
  vi a(26,0);
  rep(i,n)a[s[i]-'a']++;
  ll ans=n*(n-1)/2+1;
  ll sum=0;
  rep(i,26)if(a[i]){
    sum+=a[i]*(a[i]-1)/2;
  }
  cout<<ans-sum<<endl;
}


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

using namespace std;

int main(){
  string card;

  cin >> card;
  while(card!="-"){
    int m;

    cin >> m;

    int h;

    for(int i=0;i<m;i++){
      cin >> h;
      for(int j=0;j<h;j++){
        card+=card[0];
        card.erase(card.begin());
      }
    }

    cout << card << endl;
    cin >> card;
  }
  return 0;
}

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

public class Main{
public static void main(String arg[])throws Exception{
BufferedReader bff = new BufferedReader(new InputStreamReader(System.in));
PrintWriter wff = new PrintWriter(System.out);

String cad = bff.readLine();

if(cad.indexOf("AC") != -1){
wff.println("Yes");
}
else{
wff.println("No");
}
wff.flush();
}
}

Measured memory_bytes: 22996
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int d, t, s;
    cin >> d >> t >> s;

    cout << (s*t>=d ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

int main() {

	double c[3];

	while(cin >> c[0] >> c[1] >> c[2]) {
		if(!c[0]&&!c[1]&&!c[2]) {
			break;
		}
		sort(c, c+3);
		double R=sqrt(pow(c[0], 2)+pow(c[1], 2));

		int n;
		cin >> n;
		while(n) {
			int r;
			cin >> r;
			cout << (2*r>R ? "OK" : "NA") << endl;
			n--;
		}
	}

	return 0;

}

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

int m,d;
int s = 0;

int main(){
    scanf("%d%d",&m,&d);
    for (int i=1; i<=d; i++){
        for (int j=1; j<=m; j++){
            int d1 = i % 10;
            int d10 = i / 10;
            int t = d1 * d10;
            if (d1>=2 && d10>=2 && t==j){
            s++;
            }
        }
    }
    printf("%d",s);
    return 0;
}


Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()
	N := len(s)
	l := make([]int, N+1)
	r := make([]int, N+1)

	for i := 0; i < N; i++ {
		if s[i] == '<' {
			l[i+1] = l[i] + 1
		}
	}
	for i := N - 1; i >= 0; i-- {
		if s[i] == '>' {
			r[i] = r[i+1] + 1
		}
	}
	// out(l)
	// out(r)
	ans := 0
	for i := 0; i < N+1; i++ {
		ans += max(l[i], r[i])
	}
	out(ans)

}


Measured memory_bytes: 10240
/*
ID: i_love_7
TASK: 
LANG: C++
*/
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
string s;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>s;
	if(s=="abc" || s=="acb" || s=="bac" || s=="bca" || s=="cab" || s=="cba")
	cout<<"Yes";
	else
	cout<<"No";
	//system("pause");
	return 0;
}

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

int main()
{
	string S,T;
  	cin>>S;
  	cin>>T;
  	int i,flag=0;
  	for(i=0;i<S.size();i++)
    {
    	if(S[i]!=T[i])
        {
        	flag=1;
            break;
        }
    
    }
  	if(flag==1)
    {
    	cout<<"No"<<endl;
    }
  else
  {
  	cout<<"Yes"<<endl;
  }
  



	return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	
	public static int gcd(int a, int b){
		return b == 0 ? a : gcd(b, a % b);
	}
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			int[] as = new int[N];
			for(int i = 0; i < N; i++) {
				as[i] = sc.nextInt();
			}
			
			int[] l_gcd = new int[N];
			int[] r_gcd = new int[N];
			
			l_gcd[0] = as[0]; r_gcd[N - 1] = as[N - 1];
			for(int i = 1; i < N; i++) {
				l_gcd[i] = gcd(l_gcd[i - 1], as[i]);
			}
			for(int i = N - 2; i >= 0; i--) {
				r_gcd[i] = gcd(r_gcd[i + 1], as[i]);
			}
			
			int answer = Math.max(l_gcd[N - 2], r_gcd[1]);
			for(int i = 1; i < N - 1; i++) {
				answer = Math.max(answer, gcd(l_gcd[i - 1], r_gcd[i + 1]));
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 41120
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		double a = sc.nextInt();
		double b = sc.nextInt();
		if((a+1) / 2 < b) {
			System.out.println("NO");
		}else {
		    System.out.println("YES");
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
 
    using namespace std;
    using namespace __gnu_pbds;
 
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define int long long
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
 
    #define read(t) ll t;cin>>t;
    #define all(value) value.begin(),value.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
 
    #define what(value) cerr << #value << " is " << value << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
 
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1;
 
/*.....................................................................................................................*/
 
   
    //a.erase(unique(a.begin(),a.end()),a.end());
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll  man =(int)2e6+2 ,inf =1e18;
    const int mod=1e9+7;

    long long binpow(int a,int b,int m)
    {   
        a %= m;int res = 1;
        while (b > 0)
        { 
            if (b & 1)res=(res*a)%m;
            a=(a*a)%m  ;    b/=2; 
        }
        return res;
    }
    int modinv(int n,int m)
    {
        return binpow(n,mod-2,m);
    }

/*......................................................................................................................*/


signed main()
{
    fast;
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end());
    int ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            for(int k=j;k<n;k++)
            {
                set<int>x;
                x.insert(a[i]);
                x.insert(a[j]);
                x.insert(a[k]);
                if(x.size()==3)
                {
                    if(a[k]<a[i]+a[j])ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}   



Measured memory_bytes: 3632
N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

def step(n):
    s = 1
    ret = 0
    while n >= s:
        n -= s
        s += 1
        ret += 1
    return ret
if N == 1:
    print(0)
    exit()

factor = factorization(N)
ret = 0
for f, g in factor:
    ret += step(g)
print(ret)


Measured memory_bytes: 9492
#include<iostream>
#include <cstdio>
using namespace std;
int main(){
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    if(x>=r && x<=w-r && y>=r && y<= h-r) cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
	
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	int n; cin >> n;
	
	vector<ll> a(n), b(n, 0), c(n), d(n);
	rep(i, n){
		cin >> a[i];
		b[a[i]-1]++;
	}
	
	rep(i, n){
		
		if(b[i] > 2) c[i] = (b[i]-1) * (b[i]-2) / 2;
		else c[i] = 0;
		if(b[i] > 1) b[i] = b[i] * (b[i]-1) / 2;
		else b[i] = 0;
		
		d[i] = b[i] - c[i];
	}
	ll sum = 0;
	
	rep(i, n) sum += b[i];
	
	rep(i, n) cout << sum - d[a[i]-1] << endl;
	//rep(i, n) cout << sum << " " << d[a[i]-1] << endl;
		
	
	return 0;
}


Measured memory_bytes: 8832
import sys
import numpy as np
N, W = map(int, input().split())
it = iter(map(int, sys.stdin.read().split()))
dp = np.full(N * 1000 + 1, 10 ** 10, dtype=np.int64)
dp[0] = 0
for w, v in zip(it, it):
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print(((dp <= W) * np.arange(N * 1000 + 1)).max())

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

int main() {
  cout << fixed << setprecision(6);
  int N, K;
  cin >> N >> K;
  vector<double> kitai(N);
  for (int i = 0; i < N; i++) {
    double p;
    cin >> p;
    kitai[i] = (1+p)/2;
  }
  vector<double> ruiseki(N);
  ruiseki[0] = kitai[0];
  for (int i = 1; i < N; i++) {
    ruiseki[i] = ruiseki[i-1] + kitai[i];
  }
  double ans = 0;
  for (int i = 0; i <= N-K; i++) {
    if (i == 0) {
      ans = ruiseki[K-1];
      continue;
    }
    if (ruiseki[i+K-1] - ruiseki[i-1] > ans) {
      ans = ruiseki[i+K-1] - ruiseki[i-1];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3328
from collections import deque
import sys

input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, d, a = MAP()
monster = {}
x = []
for i in range(n):
    xx, hh = MAP()
    monster[xx] = hh
    x.append(xx)
x.sort()

q = deque()
ca = 0
cnt = 0
for i in range(n):
    cx, ch = x[i], monster[x[i]]
    
    while q and q[0][0] < cx:
        qx, qa = q.popleft()
        ca -= qa
    
    if ch - ca <= 0:
        continue
    
    cn = (ch - ca + a - 1) // a
    cnt += cn
    ca += cn * a
    q.append([cx+2*d, cn*a])
    
print(cnt)

Measured memory_bytes: 50068
# longest version bellman ford
N, M = map(int, input().split())
edges = []
for _ in range(M):
    a, b, c = map(int, input().split())
    edges.append((a-1, b-1, c))


inf = float("inf")
dist = [-inf for i in range(N)]
dist[0] = 0
is_cycle = False

#辺の緩和
for i in range(N):
    for edge in edges:
        new_dist = dist[edge[0]] + edge[2]
        if dist[edge[1]] < new_dist:
            dist[edge[1]] = new_dist
            if i==N-1 and edge[1] == N-1:
                is_cycle = True

ans = dist[-1] if not is_cycle else 'inf'
print(ans)

Measured memory_bytes: 9360
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll ans = 0;
    rep(i,n-1) ans += (n-1)/(i+1);
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3608
n=input()
l=[i for i in raw_input()]
s=0
e=n-1
ct=0
while s<e:
    if(l[s]=='W' and l[e]=='R'):
        l[s],l[e]=l[e],l[s]
        s+=1
        e-=1
        ct+=1
    if(l[s]=='R'):
        s+=1
    if(l[e]=='W'):
        e-=1
print ct


Measured memory_bytes: 77348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define sc(x) scanf("%d", &x)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define ABS(x) ((x)>=0?(x):(-(x)))
#define fastio ios::sync_with_stdio(0),cin.tie(0)
template<class T>T gcd(T a, T b){return b?gcd(b, a%b):a;}

int main()
{
    int a, b;
    sc(a); sc(b);
    int ans = a*b-a-b+1;
    printf("%d\n", ans);
    return 0;
}




Measured memory_bytes: 256
ABCD = input()

def dfs(i, expression, res):
    if i == 4:
        if res == 7:
            return expression
        else:
            return []
    else:
        ans = dfs(i + 1, expression + '+' + ABCD[i], res + int(ABCD[i])) or dfs(i + 1, expression + '-' + ABCD[i], res - int(ABCD[i]))
    return ans

ans = dfs(1, ABCD[0], int(ABCD[0]))
print(ans + '=7')


Measured memory_bytes: 38384
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    int bMinusA = b - a;
    int cMinusB = c - b;
    
    int baAbs = Math.abs(bMinusA);
    int cbAbs = Math.abs(cMinusB);
    
    if (bMinusA == cMinusB) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 23124
ABCD = input()
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
for i in range(1):
    if A + B + C + D == 7:
        print(str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
        exit()
    if A - B + C + D == 7:
        print(str(A) + "-" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
        exit()
    if A + B - C + D == 7:
        print(str(A) + "+" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
        exit()
    if A + B + C - D == 7:
        print(str(A) + "+" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
        exit()
    if A - B - C + D == 7:
        print(str(A) + "-" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
        exit()
    if A - B + C - D == 7:
        print(str(A) + "-" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
        exit()
    if A + B - C - D == 7:
        print(str(A) + "+" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
        exit()
    if A - B - C - D == 7:
        print(str(A) + "-" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
        exit()

Measured memory_bytes: 9304
import collections
n = int(input())
x = list(map(int, input().split()))
x = list(enumerate(x, 1))
x.sort(key = lambda x: x[1])
li = []
dic = {j: i for i, j in x}
for i, j in x:
    li += [i] * (i - 1)
for i, j in x:
    li += [i] * (n - i)
li = collections.deque(li)
ans = []
cnt = [0 for i in range(n + 1)]
for i in range(1, n ** 2 + 1):
    if i in dic:
        m = dic[i]
        if cnt[m] != m - 1:
            print("No")
            exit()
    else:
        m = li.popleft()
    cnt[m] += 1
    ans.append(m)
print("Yes")
print(*ans)

Measured memory_bytes: 14972
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<i64> a;
int main() {
  cin >> n;
  read_n(a, n);
  vector<i64> ml(n + 1), mr(n + 1);
  ml[1] = a[0];
  mr[n - 1] = a[n - 1];
  for (i64 i = 2; i <= n; ++i) ml[i] = max(ml[i - 1], a[i - 1]);
  for (i64 i = n - 2; i >= 0; --i) mr[i] = max(mr[i + 1], a[i]);

  for (i64 i = 0; i < n; ++i) {
    cout << max(ml[i], mr[i + 1]) << endl;
  }
  return 0;
}


Measured memory_bytes: 6272
#include <stdio.h>

int main(){
    char s[17];
    int low = 0;
    
    scanf("%s",s);
    for (int i = 0;i <= 16 ;i++ ) {
        if (s[i] == 'x') {
            low = low + 1;
        }
    }
    if (low <= 7) {
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}


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

int main()
{
    int m, money, y, n, c;
    bool q;
    double p;

    cin >> m;

    for( int i = 0; i < m; i++ )
    {
        cin >> money >> y >> n;

        int sum = 0;
        for( int j = 0; j < n; j++ )
        {
            cin >> q >> p >> c;
            
            int a = money;
            
            if( q )
            {
                for( int k = 0; k < y; k++ )
                {
                    int b = (int)( a * p );
                    a += b - c;
                }
                if( sum < a )
                    sum = a;
            }
            if( !q )
            {
                int d = 0;
                for( int k = 0; k < y; k++ )
                {
                    int b = (int)( a * p );
                    d += b;
                    a -= c;
                }
                if( sum < d + a )
                    sum = d + a;
            }
            
            if( sum < a )
                sum = a;
        }
        cout << sum << endl;
    }
    return 0;
}


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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    vc t;
    int i=0;
    while(i<s.size()){
        while(i<s.size()-1&&s.at(i)==s.at(i+1)){
            i++;
        }
        t.pb(s.at(i));
        i++;
    }
    cout << t.size()-1 << endl;
    return 0;
}


Measured memory_bytes: 640