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

/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______
 * |\  \|\  \  |\  ___ \  |\  ___ \
 * \ \  \/  /|_\ \   __/| \ \   __/|
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

const int mxN = 200010;

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

	int N;
	cin>>N;
	vector<int> a(N);
	for(int i = 0;i < N;i++) cin>>a[i];
	bool can = true;
	for(int i = 0;i < N;i++) {
		can &= a[i] <= (i?a[i-1]:-1) + 1;
	}
	if(!can) {
		cout<<"-1\n";
		return 0;
	}
	long long res = 0;
	for(int i = 0;i < N;i++) {
		if(a[i] == 0) continue;
		res++;
		if(a[i] != a[i-1] + 1) {
			res += a[i] - 1;
		}
	}
	cout<<res<<'\n';
	return 0;
}


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

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

	int N = s.size();
	int l= 0;
	int r = N - 1;
	vector<int> lx;
	vector<int> rx;
	int lxn = 0;
	int rxn = 0;
	while( r > l ) {
		while( s[l] == 'x' ) {
			lx.push_back( l - lxn );
			lxn++;
			l++;
		}
		while( s[r] == 'x' ) {
		rx.push_back( N - 1 - (r + rxn) );
			rxn++;
			r--;
		}
		if( s[l] != s[r] ) {
			cout << -1 << endl;
			return 0;
		}
		l++;
		r--;
	}
	int ans = lx.size() + rx.size();
	map<int, int> mpl;
	for( int i = 0; i < lx.size(); i++ ) {
		mpl[ lx[i] ]++;
	}
	map<int, int> mpr;
	for( int i = 0; i < rx.size(); i++ ) {
		mpr[ rx[i] ]++;
	}
	for( auto it = mpl.begin(); it != mpl.end(); it++ ) {
		int n = it->first;
		int num = min( mpl[n], mpr[n] );
		ans -= num * 2;
	}

	cout << ans << endl;
}


Measured memory_bytes: 6016
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K):
    ans = 0
    for a in range(1, N+1):
        if (a + a % K) % K != 0:
            continue
        n = math.floor(((N-(K-a) % K))/K)
        m = math.floor((N-(a % K))/K)
        if (K-a) % K != 0:
            n += 1
        if a % K != 0:
            m += 1
        ans += n * m

    return ans


def main():
    N, K = read_int_n()
    print(slv(N, K))


if __name__ == '__main__':
    main()


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

int A[2000];
int MOD = 1000000007;

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

    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    int t = 0;

    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < i; ++j) {
            if (A[j] > A[j + 1]) {
                int tmp = A[j];
                A[j] = A[j + 1];
                A[j + 1] = tmp;
                ++t;
            }
        }
    }

    unordered_map<int, int> m;

    for (int i = 0; i < N; ++i) {
        m.emplace(A[i], i);
    }

    long long T = 0;

    for (int i = 0; i < N; ++i) {
        T += m[A[i]];
    }

    long long KK = (long long)K * (K - 1) / 2 % MOD;
    long long ans = (T * KK) % MOD + ((long long)t * K) % MOD;
    ans %= MOD;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()


int main() {
  string s;
  cin >> s;
  int left, right;
  rep(i, s.size()) {
    if (s[i] == 'A') {
      left = i;
      break;
    }
  }
  rep(i, s.size()) {
    if (s[i] == 'Z') right = i;
  }
  cout << right - left + 1;
  return 0;
}

Measured memory_bytes: 640
import java.util.*;

 class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];
        int max = 0;
        int cnt = 0;
        for(int i = 0; i<N; i++) {
        	x[i] = sc.nextInt();
        }
        int wk = 0;
        for (int i = 0; i<N; i++) {
        	wk = x[i];
        	while(wk % 2 == 0) {
        		wk = wk / 2;
        		cnt++;
        	}
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 34372
#include <iostream>
#include <cstdlib>
#include <stack>
using namespace std;

int main()
{
	stack<int> S;
	int a,b;
	char s[100];
	while(cin >> s) {
	    if (s[0] == '+')
	    {
	    	a = S.top();
	    	S.pop();
	    	b = S.top();
	    	S.pop();
	    	S.push(a + b);
	    }
	    else if (s[0] == '-')
	    {
	    	a = S.top();
	    	S.pop();
	    	b = S.top();
	    	S.pop();
	    	S.push(b - a);
	    }
	    else if (s[0] == '*')
	    {
	    	a = S.top();
	    	S.pop();
	    	b = S.top();
	    	S.pop();
	    	S.push(a * b);
	    }
	    else
	    {
	    	S.push(atoi(s));
	    }
	}
	cout << S.top() << "\n";
	return 0;
}


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

int main(){
  int n;
  cin>>n;
  int sa=0,sb=0,sc=0;
  for(int day=1;day<=n;day++){
      int a,b,c,ta,tb,tc;
      cin>>a>>b>>c;
      ta = max(sb+a,sc+a);
      tb = max(sa+b,sc+b);
      tc = max(sa+c,sb+c);
      sa=ta; sb=tb; sc=tc;
  }
  cout<<max({sa,sb,sc})<<endl;
}

Measured memory_bytes: 3580
s = input()

# dream dreamer erase eraser
def f():
    global s
    while True:
        if len(s) <= 9:
            if s in ["dream","dreamer","erase","eraser"]:
                return "YES"
            else:
                return "NO"

        if s[:5] == "dream":
            if s[5:7] == "er" and s[7] != "a":
                s = s[7:]
            else:
                s = s[5:]
        elif s[:5] == "erase":
            if s[5] == "r":
                s = s[6:]
            else:
                s = s[5:]
        else:
            return "NO"
            

print(f())

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> mp;
  rep(i, N) {
    cin >> A[i];
    mp[A[i]]++;
  }
  sort(all(A));
  vector<bool> num(1000005, true);
  int ans = 0;
  rep(i, N) {
    if(num[A[i]]) {
      if(mp[A[i]] == 1) ans++;
      for(int j=1; A[i]*j<1000005; j++) num[A[i]*j] = false;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13596
''' Hey stalker :) '''
INF = 10**10
def main():
    #print = out.append
    ''' Cook your dish here! '''
    s = input()
    print('x'*len(s))



''' Pythonista fLite 1.1 '''
import sys
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
#from functools import reduce
import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')


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

using namespace std;

struct expand_type {
    template <typename... T>
    expand_type (T&&...) {}
};
template <typename... ArgTypes>
void print (ArgTypes... args) {
    expand_type {0, (cerr << args << ", ", 0)...};
    cerr << "\b\b \n";
}
#define printv(x) cerr << "["; for(auto i : (x)) cerr << i << ", "; cerr << "\b\b]\n";

typedef unsigned long long ull;
typedef long double ld;


int main () {
    std::ios::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    string s, t;
    cin >> s >> t;

    if ((int) s.size() < 1 || (int) s.size() > 10 || (int)s.size() != (int)t.size() - 1 || s != t.substr (0, (int)t.size() - 1)) {
        puts ("No");
        return 0;
    }
    for (char c : t) {
        if (c < 'a' || c > 'z') {
            puts ("No");
            return 0;
        }
    }
    puts ("Yes");
    return 0;
}


Measured memory_bytes: 3648
a, b, c, d = map(int, input().split())
cntT = 0
cntA = 0
while c>0:
    cntT += 1
    c -= b
while a > 0:
    cntA += 1
    a -= d
if cntT <= cntA:
    print("Yes")
else:
    print("No")

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

int main() {
	int num[2][100];
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < 100; j++)
			num[i][j] = 0;
	for (int i = 0; i < 2; i++) {
		string str;
		cin >> str;
		for (int j = str.size() - 1, k = 99; j >= 0; j--, k--) {
			num[i][k] = (int)(str[j] - '0');
		}
	}
	for (int i = 0; i < 100; i++) {
		if (num[0][i] > num[1][i]) {
			cout << "GREATER" << endl;
			return 0;
		}
		if (num[0][i] < num[1][i]) {
			cout << "LESS" << endl;
			return 0;
		}
	}
	cout << "EQUAL" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S1 = sc.next();
        String S2 = sc.next();
        int mod = 1_000_000_007;
        long ans = 1;
        int flag = -1; // flag==0: yoko, flag==1: tate
        for (int i=0;i<N;i++) {
            if (i==0) {
                if (i!=N-1 && S1.charAt(i)==S1.charAt(i+1)) {  //yoko
                    ans = 6;
                    i++;
                    flag=0;
                } else {
                    ans = 3;
                    flag=1;
                }
                continue;
            }
            // System.out.println("i: " + i + " flag: " + flag);
            if (flag==0) { // yoko
                if (i!=N-1 && S1.charAt(i)==S1.charAt(i+1)) { // yoko
                    ans = ans*3%mod;
                    i++;
                } else { // tate
                    flag=1;
                }
            } else { // tate
                if (i!=N-1 && S1.charAt(i)==S1.charAt(i+1)) { // yoko
                    ans = ans*2%mod;
                    flag=0;
                    i++;
                } else { // yoko
                    ans = ans*2%mod;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>

using namespace std;

#define ll long long
#define f0(i,n)for(i=0;i<n;i++)
#define f1(i,n)for(i=1;i<=n;i++)
#define fc(i,c,n)for(i=c;i<=n;i++)
#define f0r(i,n)for(i=n-1;i>=0;i--)
#define f1r(i,n)for(i=n;i>0;i--)
#define fcr(i,c,n)for(i=n;i>=c;i--)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef list<ll> LST;
typedef vector<ll> VEC;
typedef map<ll, ll> MAP;

ll i, j, q;
ll n, m, p, k, t, s, v;
ll a, b, c, d;
ll x, y, z, l, r;
ll one = 1, zero = 0, ans = 0;
ll mod = 1000000007;
ll INF = 9223372036854775807;
ll a1, a2, a3, a4;
string st1, st2, st3;
char ch1, ch2, ch3;

int main() {
	ifstream fin("Text.txt");
	
	cin >> n;
	MAP mp;
	ans = 0;
	f0(i, n) {
		cin >> a;
		b = mp[a-1] + 1;
		ans = max(ans, b);
		mp[a] = b;
	}
	cout << n - ans << endl;
	return 0;
}

Measured memory_bytes: 12800
#include "bits/stdc++.h"
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
using namespace std;


int main(){
	char c1[100],c2[100];
  	string s1,s2;
  	cin >> s1 >> s2;
  
  	rep(i,0,s1.size()){
      c1[i] = s1[i];
    }
  
  	rep(i,0,s2.size()){
      c2[i] = s2[i];
    }
  
  	sort(c1,c1+s1.size());
  	
  	sort(c2,c2+s2.size());
  
  	if(s1.size() < s2.size()){
      rep(i,0,s1.size()){
        if(c1[i] != c2[i]){
          break;
        }
        else if(i == s1.size()-1){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  	
  	sort(c1,c1+s1.size());
  	sort(c2,c2+s2.size(),greater<int>());
  
  	if(c1[0] < c2[0]){
      cout << "Yes" << endl;
    }
  	else{
      cout << "No" << endl;
    }
  
  	
  	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;


int main() {
    int K;
    cin >> K;
    if (K % 2 == 0) {
        std::cout << K / 2 * K / 2 << '\n';
        return 0;
    }
    if (K % 2 == 1) {
        std::cout << (K * (K / 2) + (K / 2)) / 2<< '\n';
        return 0;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;



long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int a) {
	if (a < 0) {
		return -a;
	}
	return a;
}

long long N, M, wa, K, W, ans, k[5],A,B;
string s, t[100];
bool a, b, c;
int main() {
	cin >> A>>B>>K;
	if (B -A  > K) {
		for (int i = 0; i < K; i++) {
			cout << A + i << endl;
		}

		for (int i = K - 1; i >= 0; i--) {
			if (B - i > A + K - 1) {
				cout << B - i << endl;
			}
		}
	}
	else {
		for (int i = A; i <= B; i++) {
			cout << i << endl;
		}
	}
	return 0;
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	string b;
	cin >> b;
	FOR(i,0,b.size()){
		if(b[i] == 'A')cout << 'T';
		if(b[i] == 'C')cout << 'G';
		if(b[i] == 'G')cout << 'C';
		if(b[i] == 'T')cout << 'A';
	}
}

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

int main(void)
{
    int n, r;
    cin >> n >> r;
    int ans;
    if (n >= 10)
    {
        ans = r;
    }
    else
    {
        ans = r + (100 * (10 - n));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define LL long long

LL n;
LL a[100005];
LL dif[100005];

int main()
{
    while(~scanf("%lld",&n))
    {
        LL sum=0;
        for(int i=0;i<n;++i)
        {
            scanf("%lld",&a[i]);
            sum+=a[i];
        }
        LL k=n*(n+1)/2;
        if(sum%k!=0)
        {
            printf("NO\n");
            continue;
        }
        k=sum/k;
        for(int i=0;i<n-1;++i)
            dif[i]=a[i+1]-a[i];
        dif[n-1]=a[0]-a[n-1];
        //for(int i=0;i<n;++i) cout<<dif[i]<<endl;
        int flag=1;
        for(int i=0;i<n;++i)
        {
            if(dif[i]==k) continue;
            LL c=k-dif[i];
            if(c<0||c%n!=0)
                flag=0;
        }
        if(flag) printf("YES\n");
        else printf("NO\n");
    }
}


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

int main(){
    
    int n, a, min = 1000000, max = -1000000;
    long long sum = 0;
    
    cin >> n;

    for(int i = 0; i < n; i++){
    cin >> a;
    if(a < min){min = a;}
    if(a > max){max = a;}
    sum += a;
    }
    
    cout << min << " " << max << " " << sum << endl;
    }


Measured memory_bytes: 3076
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//A+Bは0
		//Aは0のみ、Bは0か1(すべて0もしくは1の場合もある)
		//A+Bに0がX個含まれるか判定
		//A+B-X>=0であればYES、そうでなければNO
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();

		int evaluation0 = a + b - x;
		int evaluation1 = a - x;
		if(evaluation0 >= 0 && evaluation1 <= 0){
			System.out.println("YES");

		}else{
				
			System.out.println("NO");
		}
		
		
	
	}
}


Measured memory_bytes: 22868
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using static Input;
class Program
{
    static int A;
    static int B;

    static void INPUT()
    {
        A = NextInt();
        B = NextInt();
    }
    static void OUTPUT()
    {
       	for(int idx = Math.Max(B - A + 1, -1000000); idx < Math.Min(B + A, 1000000); idx++)
        {
        	Console.WriteLine(idx);
        }
    }
    static void Main(string[] args)
    {
#if DEBUG  
        TESTINPUT();
#else
        INPUT();
#endif
        OUTPUT();
    }

    static void TESTINPUT()
    {
        //A = new int[] { 1, 1, 1, 1, 1 };
        //B = new int[] { 1, 1, 1, 1, 1 };
        A = 3;
        B = 4;
      
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}



Measured memory_bytes: 13268
#include<stdio.h>

int main(void)
{
        int a, b, c;

        scanf("%d%d", &a, &b);
    
        if(a >= 13) {
                c = b;
        } else if(a >= 6) {
                c = b/2;
        } else if(a <= 5) {
                c = 0;
        }
        printf("%d", c); 
        return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
    int a,b,v,w,t,k,d;
    cin>>a>>v>>b>>w>>t;
    if(a==b){cout<<"YES";return 0;}
    d=abs(b-a);
    k=v-w;
    if(k*t>=d){cout<<"YES";}
    else{cout<<"NO";}
    return 0;
}

Measured memory_bytes: 3636
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0
      ? os << vec[i]
      : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0
      ? os << deq[i]
      : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion

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

  int N;
  cin >> N;
  vector<int> d(N);
  cin >> d;
  int a = 0;
  REP(i, N)
  FOR(j, i + 1, N) {
    a += d[i] * d[j];
  }
  cout << a << "\n";
}


Measured memory_bytes: 256
import java.io.*;

class Main{
 public static void main(String[] args)throws IOException{
   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   String[] strAry; 
   int H,W,i,j;
      
   while(true){
     strAry = br.readLine().split(" ");
     H = Integer.parseInt(strAry[0]);  
     W = Integer.parseInt(strAry[1]);
     if(H==0&&W==0) break;
     for(j=0;j<H;j++){
       for(i=0;i<W;i++){
        if(j%2==0){
         if(i%2==0){
          System.out.print("#");
         }else{          
          System.out.print("."); 
         }
        }else{
         if(i%2==0){
          System.out.print(".");
         }else{          
          System.out.print("#"); 
         }
        }  
       
       }
       System.out.print("\n");  
     }     
     System.out.print("\n");  
     
    }  
      


  }
}

Measured memory_bytes: 36168
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const int INF=1e9;


int main(){
  int h,n;
  cin>>h>>n;
  vector<int> a(n),b(n);
  vector<int> dps(h+1);
  
  rep(i,n){
     cin>>a[i];
     cin>>b[i];
   }

  rep(i,h){
    dps[i]=INF;
  }
  
  dps[h]=0;

  for(int h2=h;h2>=0;h2--){//体力を1ずつ減らして考える．
    rep(i,n){//魔法iを使用する場合．
      if(h2-a[i]<0){
        dps[0]=min(dps[0],dps[h2]+b[i]);
      }else{
        dps[h2-a[i]]=min(dps[h2-a[i]],dps[h2]+b[i]);
      }
    }
  }
  cout<<dps[0]<<endl;
}


Measured memory_bytes: 3668
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int n,m; //　バイドルの数、費用
string str;
int c[333],v[333],d[333],l[333];
ll dp[333][333]; 
int solve(int i,ll sum,int *data);
int main(){
 
  while(cin >> n >> m){
    for(int i=0;i<n;i++){
      getchar(); // 最初のごみ取り
      getline(cin , str);
      cin >> c[i] >> v[i] >> d[i] >> l[i];
    }
  
    memset( dp , -1 , sizeof(dp) );
    int A = solve( 0 , 0  , &v[0] );
    memset( dp , -1 , sizeof(dp) );
    int B = solve( 0 , 0  , &d[0] );
    memset( dp , -1 , sizeof(dp) );
    int C = solve( 0 , 0  , &l[0] );
    memset( dp , -1 , sizeof(dp) );
    cout << max( max( A , B ) , C ) << endl;
  }
}
int solve(int i,ll sum,int *data){
  int ret = 0;
  if(i == n)return 0;

  if(dp[i][sum] != -1)return dp[i][sum];
  if(sum+c[i]>m){
    ret = max( ret , solve( i + 1 , sum , data ));
  }else {
  for(int j=0;j*c[i]<=(m-sum);j++){
    ret = max( ret , solve( i + 1 , sum + (j*c[i]) , data ) + (data[i] * j));
  }
  }

return dp[i][sum] = ret;
}

Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100009] = {-1};
ll inf = 1e9;
ll n;
ll arr[100009];
ll dfs(int index)
{
  //cout<<index<<endl;
  if (index >= n - 1)
    return 0;

  if (dp[index] != -1)
    return dp[index];  //cout<<index<<endl;
  ll choice1 =inf, choice2 = inf;
  if (index < n - 2)
  {
    choice2 = abs(arr[index] - arr[index + 2]) +dfs(index + 2);
   ;
  }
  choice1 = abs(arr[index] - arr[index + 1])+dfs(index+1);
 
//cout<<index<<" "<<choice1<<" "<<choice2<<endl;
  return dp[index] = min(choice1, choice2);
}

int main()
{
  cin >> n;
  memset(dp,-1,sizeof dp);
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }  //cout<<dp[3]<<endl;
 cout<< dfs(0);

}

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

int main(){
    int h, w, m;
    cin >> h >> w >> m;
    vi bomh(h, 0), bomw(w, 0);
    set<P> bombs;
    rep(i,m){
        int a,b; cin>>a>>b; a--;b--;
        bomh[a]++;
        bomw[b]++;
        bombs.insert(P(a,b));
    }
    set<int> argh, argw;
    int maxh = 0, maxw = 0;
    rep(i,h)chmax(maxh, bomh[i]);
    rep(i,w)chmax(maxw, bomw[i]);
    rep(i,h)if(maxh==bomh[i])argh.insert(i);
    rep(i,w)if(maxw==bomw[i])argw.insert(i);
    
    ll count = (ll)argh.size()*argw.size();
    int ans = maxh+maxw;
    if(count>bombs.size()){
        cout<< ans <<endl;
        return 0;
    }
    
    for(auto b: bombs){
        int h = b.first;
        int w = b.second;
        if(argh.count(h) && argw.count(w))
            count--;
    }
    
    if(!count)
        cout << ans-1 << endl;
    else
        cout << ans << endl;
    return 0;
}

Measured memory_bytes: 47872
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	// sort.Ints(a)
	// limit := a[n-1]
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		m[a[i]]++
		m[a[i]+1]++
		m[a[i]-1]++
	}
	// fmt.Println(m)

	ans := -1
	for _, v := range m {
		if ans < v {
			ans = v
		}
	}
	fmt.Println(ans)

	// max := -1
	// for i := 0; i <= limit; i++ {
	// 	count := 0
	// 	for j := 0; j < n; j++ {
	// 		if a[j]-1 == i || a[j]+1 == i || a[j] == i {
	// 			count++
	// 		}
	// 	}
	// 	if max < count {
	// 		max = count
	// 	}
	// }

	// fmt.Println(max)

}


Measured memory_bytes: 7168
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

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

  ll count;
  ll ans = 0;
  for(ll i=1; i<=N; i+=2){
    count = 0;
    for(ll j=1; j<=i; j++){
      if(i % j == 0) count++;
    }
    if(count == 8) ans++;
  }

  print(ans);

  return 0;
}


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

int main(){
  int N,M,a,L;
  vector<int> v;
  scanf("%d%d%d",&N,&M,&a);
  L=a/=2;
  v.push_back(a);
  REP(i,N-1){
    scanf("%d",&a);
    a/=2;
    L=lcm(L,a);
    v.push_back(a);
  }
  REP(i,N){
    if((L/v[i])%2==0){
      cout<<0<<endl;
      return 0;
    }
  }
  cout<<M/L-M/(L*2)<<endl;
}

Measured memory_bytes: 3856
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

ll K;
vl A(100005);

ll last(ll x){
    ll now=x;
    rep(i,K){
        now-=now%A[i];
    }
    return now;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> K;
    rep(i,K){
        cin >> A[i];
    }
    ll r_short=-1,ok=INF;
    while(abs(ok-r_short)>1){
        ll mid=(ok+r_short)/2;
        if(last(mid)<2){
            r_short=mid;
        }
        else{
            ok=mid;
        }
    }
    if(last(ok)!=2){
        cout << -1 << endl;
        return 0;
    }
    cout << ok << ' ';
    ll over=INF;ok=-1;
    while(abs(over-ok)>1){
        ll mid=(over+ok)/2;
        if(last(mid)>2){
            over=mid;
        }
        else{
            ok=mid;
        }
    }
    cout << ok << endl;
}

Measured memory_bytes: 3916
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

struct UnionFind{
   vector<int> par;
   UnionFind(int n):par(n,-1){}
   int find(int x){
       if(par[x]<0)return x;
       return par[x]=find(par[x]);
   }
   bool unite(int x,int y){
       x=find(x);
       y=find(y);
       if(x==y)return false;
        par[x]+=par[y];
        par[y]=x;
       return true;
   }

   bool same(int x,int y){
       return find(x)==find(y);
   }
   int size(int x){
       return -par[find(x)];
   }
};

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,M; cin >> N >> M;
    UnionFind uf(N+1);
    int P[N];
    rep(i,N) {cin >> P[i]; P[i]--;}
    rep(i,M){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(P[a],P[b]);
    }
    int ans=0;
    rep(i,N){
        if(uf.same(i,P[i])) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s = sc.nextLine().split(" ");
    int[] cost = new int[N];
    for(int i = 0; i < N; i++){
      cost[i] = Integer.parseInt(s[i]);
    }
    
    int[] result = new int[N];
    for(int i = 0; i < N; i++){
      if(i == 0){
        result[i] = 0;
      }else if(i == 1){
        result[i] = Math.abs(cost[i] - cost[i-1]);
      }else{
        int a = Math.abs(cost[i] - cost[i-1]) + result[i-1];
        int b = Math.abs(cost[i] - cost[i-2]) + result[i-2];
        result[i] = (a < b ? a: b);
      }
    }
    System.out.println(result[N-1]);
  }
}

Measured memory_bytes: 36560
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#define llint long long

using namespace std;

struct edge{
	llint to, cost;
	edge(llint a, llint b){
		to = a, cost = b;
	}
};

llint parent[4005];
llint N, M, Q;
vector< pair<llint, pair<llint, llint> > > vec;
vector<edge> G[4005];
llint dist[4005][4005];

void init(){
	for(llint i = 1; i <= N; i++){
		parent[i] = i;
	}
}

llint root(llint i){
	if(parent[i] == i) return i;
	return parent[i] = root(parent[i]);
}

bool same(llint i, llint j)
{
	return root(i) == root(j);
}

void unite(llint i, llint j)
{
	llint root_i = root(i), root_j = root(j);
	if(root_i == root_j) return;
	parent[root_i] = root_j;
}

void dfs(llint v, llint prev, llint s, llint val)
{
	dist[s][v] = val;
	for(llint i = 0; i < G[v].size(); i++){
		if(G[v][i].to == prev) continue;
		dfs(G[v][i].to, v, s, max(val, G[v][i].cost));
	}
}

int main(void)
{
	cin >> N >> M;
	llint a, b, c;
	for(llint i = 0; i < M; i++){
		cin >> a >> b >> c;
		vec.push_back( make_pair(c, make_pair(a, b) ) );
	}
	sort(vec.begin(), vec.end());
	
	init();
	llint cost = 0;
	for(llint i = 0; i < vec.size(); i++){
		a = vec[i].second.first, b = vec[i].second.second;
		if(same(a, b)) continue;
		unite(a, b);
		cost += vec[i].first;
		G[a].push_back(edge(b, vec[i].first));
		G[b].push_back(edge(a, vec[i].first));
	}
	
	for(llint i = 1; i <= N; i++){
		dfs(i, -1, i, 0);
	}
	
	cin >> Q;
	llint S, T;
	for(llint q = 0; q < Q; q++){
		cin >> S >> T;
		cout << cost - dist[S][T] << endl;
	}
	return 0;
}

Measured memory_bytes: 137576
N = int(input())
S = input()

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            fi = S.find(str(i))
            if fi < 0:
                continue
            fj = S[fi+1:].find(str(j))
            if fj < 0:
                continue
            fk = S[fi+fj+2:].find(str(k))
            if fk < 0:
                continue
            ans += 1

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int position = S.length() - 1;
		long ans = 0;
		for (int i = S.length() - 1; i >= 0; i--) {
			if(S.charAt(i) == 'B') {
				ans += position - i;
				position--;
			}
		}
		
		System.out.println(ans);
		
		sc.close();
	}
}


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

int main() {
	int n,x;
	cin >> n >> x;
	vector<int> a(n);
	for(int i=0;i<n;i++)
	{
		int z;
		cin >> z;
		a.at(i) = abs(z-x);
	}
	sort(a.begin(),a.end());
	if(n==1)
	{
		cout << a.at(0) << endl;
		return 0;
	}
	int g=0;
	for(int i=0;i<n-1;i++)
	{
		int b=a.at(i+1),c=g,d=1;
		if(g==0)
		{
			c=a.at(i);
		}
		while(d != 0)
		{
			g = c;
			d = b%c;
			b = c;
			c = d;
		}
	}
	cout << g << endl;
	return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
struct post {
	string self;
	vector<post*> sub;
	post(string s_) {
		self = s_;
	}
	post() {};
};
void print(post p,int level) {

	REP(i, level)cout << '.';
	cout << p.self << endl;
	REP(i, p.sub.size()) {
		print(*p.sub[i],level+1);
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<post> v(n);
	int k;
	string m;
	cin >> k >> m;
	v[0] = post(m);
	REP(i, n - 1) {
		cin >> k >> m;
		v[i + 1] = post(m);
		v[k-1].sub.push_back(&v[i+1]);
	}
	print(v[0],0);
	return 0;
}

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

using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  int a[1000] = {0};
  for (int i = 0; i < n; ++i)
  {
    int k;
    cin >> k;
    for (int j = 0; j < k; ++j)
    {
      int s;
      cin >> s;
      a[s]++;
    }
  }
  int ans = 0;
  for (int i = 1; i <= m; ++i)
  {
    if (a[i] == n)
      ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
long long h[100000] = {};
int main()
{
  int n, k;

  scanf("%d%d", &n, &k);

  for (int i = 0; i < n; i++)
  {
    scanf("%lld", &h[i]);
  }
  sort(h, h+n);
  int start = 0;
  for (int i = 0; i < n-k+1; i++)
  {
    if (h[i+k-1] - h[i] < h[start+k-1] - h[start])
      start = i;
  }
  printf("%d\n", h[start+k-1] - h[start]);
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	int ans = 0;
	for (int i = 1; i * i <= N; i++) {
		ans = i * i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int x, a, b;

    scanf("%d%d%d", &x, &a, &b);

    if(abs(x-a) < abs(x-b)){
        printf("A\n");
    }else{
        printf("B\n");
    }

    return 0;
}

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

int main() {
	string s;
	cin >> s;
	ll ans = 0;
	int n = s.size();
	vector<ll> v(2020);
	rep(i, n) {
		int now = (int) (s[i] - '0');
		vector<ll> n = v;
		rep(j, 2019) {
			if(v[j] == 0) continue;
			ll next = (j*10 + now)%2019;
			n[next] += v[j];
			n[j] -= v[j];
			// if(i<5) cout << i << " " << j << " " << next << " " << v[next] << " " << v[j] << endl;
		}
		v = n;
		v[now]++;
		ans += v[0];
	}
	// rep(i, 2019) cout << i << " :" << v[i] << endl;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3700
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD!long;
	auto M = RD!long;

	if (abs(N - M) > 1)
	{
		writeln(0);
		return;
	}

	long cnt1 = 1, cnt2 = 1;
	foreach (i; 0..N)
	{
		modm(cnt1, N - i);
	}
	foreach (i; 0..M)
	{
		modm(cnt2, M - i);
	}
	long ans = cnt1;
	modm(ans, cnt2);
	if (N == M) modm(ans, 2);

	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 256
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int n,l[N],k[N],r[N],ans;vpii f,b;

void Solve(vector<pair<int, int>>& cams)
{
    priority_queue<int> pq;
    // int result = 0;
    int initalAns = ans;

    for(auto i : cams)
    {
        pq.push(-i.second);
        ans+=i.second;
        //we assume its left is best
        while(pq.size()>i.first)ans+=pq.top(),pq.pop();
    }

}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int testcases;
    cin >> testcases;
    while(testcases--)
    {

        cin>>n;ans=0;

        std::vector<pair<int, int>> f;
        std::vector<pair<int, int>> b;
        
    rep(i,1,n)cin>>k[i]>>l[i]>>r[i];
    rep(i,1,n){
        if(l[i]>r[i]){
            ans+=r[i];
            f.pb({k[i],l[i]-r[i]});
        }
        else{
            ans+=l[i];
            b.pb({n-k[i],r[i]-l[i]});
        }
    }
    sort(all(f)),sort(all(b));

    Solve(f);
    Solve(b);

        std::cout << ans << "\n";

    }

    return 0;
}


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

typedef long long lli;

int main() {
  lli a, b, n;
  while(cin >> a >> b >> n) {
    int ten = 1;
    int da = 0;
    while(a / ten) {
      ten *= 10;
      ++da;
    }
    ten /= 10;
    --da;
    int base = 0;
    while(da >= 0) {
      base += a / ten % 10;
      base %= b;
      base *= 10;
      ten /= 10;
      --da;
    }
    int sum = 0;
    for(int i = 0; i < n; ++i) {
      sum += base / b;
      base %= b;
      base *= 10;
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
string a;
int n,m,x,y;
int main(){
    cin>>a;
    for(int i=0;i<a.size();i++){
        if(a[i]=='N') n++;
        if(a[i]=='S') m++;
        if(a[i]=='W') x++;
        if(a[i]=='E') y++;
    }
    if(!n && m || n && !m) cout<<"No"<<endl;
    else if(!x && y || x && !y) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
/*CODED BY

|||||||THE LNM INSTITUTE OF INFORMATION TECHNOLOGY||||||||||||


  *****                   <<<<<<<<<<*>>>>>>>>>
  *******                 ********************
  ***   ***                        ***
  ***    ***                       ***
  ***     ***    **************    ***
  ***      ***   *DARSHAN JAIN*    ***
  ***      ***   **************    ***
  ***      ***                     *** 
  ***     ***                      ***  
  ***    ***              ***      ***
  ***   ***      ****      ***     ***       ****
  *******        |19|       ***   ***        |19|
  *****          ****          ***           ****


|||||||THE LNM INSTITUTE OF INFORMATION TECHNOLOGY||||||||||||  

*/



#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define M 1000000007
#define mint INT_MAX;
#define checkloop cout<<"i="<<i<<"     "<<"j="<<j<<endl;
#define checkvalue(qq,ww) cout<<"value1="<<qq<<"     "<<"value2="<<ww<<endl;
#define output(out) cout<<out<<endl;
#define linechange cout<<endl;
#define space cout<<"\t";
#define testoutput(first,out) cout<<first<<"===="<<out<<endl;
ll t,inp,inp1,inp2,n;
ll count=0;
#define ull unsigned long long int
ll dp1[1000000+6];
ll max=0;
int main() 
{
  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll count=0;
  for (int i = 0;i<s.size(); ++i)
  {
    if(s[i]!=s[i+1])
      count++;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 512
def insertion(v, n, g):
    c = 0
    for i in range(g, n):
        k = v[i]
        j = i-g
        while j >= 0 and v[j] > k:
            v[j+g] = v[j]
            j -= g
            c += 1
        v[j+g] = k
    return c


n = int(input())
v = [int(input()) for _ in range(n)]

g = []
t = n//2
while t > 1:
    g.append(t)
    t //= 2
g.append(1)
m = len(g)
cnt = 0
for i in range(m):
    cnt += insertion(v, n, g[i])

print(m)
print(" ".join([str(_g) for _g in g]))
print(cnt)
for _v in v:
    print(_v)



Measured memory_bytes: 45516
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	string a,b;
	cin>>a;
	b=a;
	reverse(a.begin(),a.end());
	if(a==b)cout<<"Yes";
	else cout<<"No";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3616