akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;

        while( (line = br.readLine()) != null){
            int a = Integer.parseInt(line);
            int sum = 0;
            int time = 1;

            while(a*time < 600){
                sum += a * (int)(Math.pow(a*time , 2));
                time++;
            }

            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 23988
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
 
sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9 + 7
 
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
 
 
def main():
    a = sorted(list(zip(LI(),[0.25,0.5,1.0,2.0])), key=lambda x: x[0]/x[1])
    n = I() * 4
    r = 0
    for i in range(4):
        k,t = a[i]
        t = int(t*4)
        if n >= t:
            r += k * (n//t)
            n %= t
 
    return r
 
print(main())

Measured memory_bytes: 64492
#include <bits/stdc++.h>
#define rep(i,  x,  y) for(int i = x; i <= y; i ++)
#define ll unsigned long long
#define X first
#define Y second
#define ls rt << 1
#define rs rt << 1 | 1
#define INF 0x3f3f3f3f
#define mod 1000000007
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int N = 8e3 + 10;
int x, y, dpx[N << 1], dpy[N << 1], tmp[N << 1];
char s[N];
 
int main()
{
	cin >> s >> x >> y;
	int now = 0, type = 0;
	{
		int pos=0;
		while(s[now] == 'F') now ++, pos ++;
		dpx[pos + N] = dpy[N] = 1;
	}
	while(s[now])
	{
		now ++;
		int len = 0;
		while(s[now] == 'F') now ++, len ++;
		memset(tmp, 0, sizeof(tmp));
		if(type)
		{
			for(int i = 0; i + len < (N << 1); i ++)
				if(dpx[i])
					tmp[i + len] = 1;
			for(int i = len; i < (N << 1); i ++)
				if(dpx[i])
					tmp[i - len] = 1;
			memcpy(dpx, tmp, sizeof(dpx));
		}
		else
		{
			for(int i = 0; i + len < (N << 1); i ++)
				if(dpy[i])
					tmp[i + len] = 1;
			for(int i = len; i < (N << 1); i ++)
				if(dpy[i])
					tmp[i - len] = 1;
			memcpy(dpy,tmp,sizeof(dpy));
		}
		type ^= 1;
	}
	puts(dpx[x + N] && dpy[y + N] ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 384
#include <Foundation/Foundation.h>
int main() {
    @autoreleasepool{
        char s[102];
        scanf("%s",s);
        long n = strlen(s);
        if(n==1){
            puts("0");
            return 0;
        }
        NSMutableSet *set = [NSMutableSet set];
        NSMutableArray *S = [NSMutableArray array];
        for(long i=0;i<n;i++){
            [set addObject:@(s[i])];
            [S addObject:@(s[i])];
        }
        long ans = NSIntegerMax;
        for(NSNumber *c in set){
            char dest = [c charValue];
            NSMutableArray *T = [NSMutableArray arrayWithArray:S];
            long result = 0;
            while([[T valueForKeyPath:@"@distinctUnionOfObjects.self"] count] > 1){
                NSMutableArray *U = [NSMutableArray array];
                for(long i=0;i<[T count]-1;i++){
                    char x = [[T objectAtIndex:i] charValue];
                    char y = [[T objectAtIndex:i+1] charValue];
                    if(x==dest || y==dest){
                        [U addObject:@(dest)];
                    }else{
                        [U addObject:@(x)];
                    }
                }
                result++;
                T = U;
            }
            ans = MIN(ans, result);
        }
        printf("%ld\n",ans);
    }
}


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

#define PI 3.14159265359

int main() {
    double r;
    double area, length;
    cin >> r;
    
    area = pow(r, 2.0) * M_PI;
    length = 2 * M_PI * r;
    
    printf("%f %f\n", area, length);
}

Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>


using namespace std;

typedef long long ll;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
typedef pair<ll, ll> pll;


int main() {
	int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int>(n));

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


	bool canConsist = true;
	ll sum = 0;
	for (int i = 0; i < n;i++) {
		for (int j = i+1; j < n;j++) {
			bool isMin = true;
			for (int k = 0;k < n;k++) {
				
				if (a[i][j] > a[i][k] + a[k][j]) {
					canConsist = false;
					isMin = false;
				}
				else if (a[i][j] == a[i][k] + a[k][j] && i != k && j !=k) {
					isMin = false;
				}
			}
			if (!canConsist) {
				break;
			}
			if (isMin) {
				sum += a[i][j];
			}
		}
		if (!canConsist) {
			break;
		}
	}
	if (canConsist) {
		cout << sum << endl;
	}
	else {
		cout << -1 << endl;
	}


}




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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  while(1) {
    int x, y, s; cin >> x >> y >> s;
    if(x == 0 && y == 0 && s == 0) {
      break;
    }
    
    int ma = 0;
    for(int i=1;i<1000;++i) {
      for(int j=i;j<1000;++j) {
        if(i * (100 + x) / 100 + j * (100 + x) / 100 == s) {
          ma = max(ma, i * (100 + y) / 100 + j * (100 + y) / 100);
        }
      }
    }

    cout << ma << endl;
  }
}



Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	int n, a; cin >> n >> a;
	if (n % 500 <= a) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int a = 0, b = 0;
  if (N % 2 == 0){
    for(int i = 0; i < N; i += 2){
      a += vec.at(i);
      b += vec.at(i + 1);
    }
    cout << a - b << endl;
  }
  
  else {
    for(int i = 0; i < N; i += 2){
      if (i == N - 1){
        a += vec.at(N - 1);
        break;
      }
      a += vec.at(i);
      b += vec.at(i + 1);
    }
    cout << a - b << endl;
  }
}

Measured memory_bytes: 256
from collections import deque
n,power = map(int,input().split())
swing_ls = [0] * n
throw_ls = [0] * n
for i in range(n):
    swing, throw = map(int,input().split())
    swing_ls[i] = swing
    throw_ls[i] = throw
swing_best = max(swing_ls)
throw_ls.sort(reverse=True)
def isOK(index, key, l):
    if l[index] <= key:
        return True
    else:
        return False
def meguru_search(l, key):
    '''
    key以上の値を持つ最小のインデックスを返す
    '''
    left = -1
    right = len(l)

    while (right - left) > 1:
        mid = left + (right - left) // 2
        # 直感的に記憶　
            # 「含まれている」んだったら「含むを許容（等号付き）する右側」はmidまで動かして問題ない
                # 新しいrightの位置がkeyの位置だとしても、「含む」は許容されてる
            # 「含まれていない」んだったら「含まない(<)左の壁」をそこまで動かしてもkeyを通り過ぎることはない
        if isOK(mid, key, l):
            right = mid
        else:
            left = mid
    
    # whileを抜ける時、rightとleftは一個差で、かつkeyがrightの位置にある
    return right
last_ind = meguru_search(throw_ls, swing_best) - 1
if last_ind != -1:
    throw_use_q = deque(throw_ls[:last_ind+1])
else:
    throw_use_q = []
count = 0
while power > 0:
    if throw_use_q:
        point = throw_use_q.popleft()
        power -= point
    else:
        count += -(-power // swing_best)
        break
    count += 1
print(count)


Measured memory_bytes: 12704
import java.util.Arrays;
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int []data = new int[3];
        data[0] = sc.nextInt();
        data[1] = sc.nextInt();
        data[2] = sc.nextInt();

        Arrays.sort(data);
        System.out.println(data[0]+" "+data[1]+" "+data[2]);
        }
}

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

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    int N, K;
    string s;
    cin >> N >> s >> K;
    char comp = s[K - 1];
    REP(i, s.size()) {
        if(s[i] != comp) {
            s[i] = '*';
        }
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
TD=[list(map(int,input().split())) for _ in range(n)]
TD=sorted(TD,key=lambda x:-x[1])
#print(TD)
q=[]
ans=0
v=set()
cnt=0
for t,d in TD[:k]:
    ans+=d
    if t in v:
        q.append(d)
    else:
        v.add(t)

ans+=len(v)**2
cnt=ans
for t,d in TD[k:]:
    if t not in v and len(q)!=0:
        x=q.pop()
        ans+=d+2*len(v)+1-x
        v.add(t)
        cnt=max(ans,cnt)

print(cnt)


Measured memory_bytes: 69848
#include <bits/stdc++.h>
using namespace std;
long long n,H;
string s;
int main(){
  cin >> n;
  long long x[n],y[n],h[n];
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i] >> h[i];
  }
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      for(int k=0;k<n;k++){
        if(h[k]>0){
          H=h[k]+abs(x[k]-i)+abs(y[k]-j);
          break;
        }
      }
      bool f=true;
      for(int k=0;k<n;k++){
        if(max(H-abs(x[k]-i)-abs(y[k]-j),0LL)!=h[k]){
          f=false;
        }
      }
      if(f==true){
        cout << i << ' ' << j << ' ' << H << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N; 
	string S; cin >> S; 
	int R[200010] = {}; // S[0]-S[i-1]をRにするのに変えるWの個数
	int W[200010] = {}; // S[i]-S[N-1]をWにするのに変えるRの個数
	for(int i = 0; i < N; i++){
		if(S.at(i) == 'W') R[i+1] = R[i] + 1; 
		else R[i+1] = R[i]; 
	}
	for(int i = N; i >= 1; i--){
		if(S.at(i-1) == 'R') W[i-1] = W[i] + 1; 
		else W[i-1] = W[i]; 
	}
	int ans = 1145141919; 
	for(int i = 0; i <= N; i++){
		ans = min(ans, R[i] + W[i] - min(R[i], W[i])); 
	}
	cout << ans << "\n";
}

Measured memory_bytes: 5332
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
 
const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int n;
ll a[100000];
char c[100000];

int main() {
    cin >> n;
    rep(i,n) {
        if (i == 0) cin >> a[i];
        else cin >> c[i-1] >> a[i];
    }
    ll ans = 0;
    bool head = true;
    ll sum = 0;
    ll mcnt = INF*INF;
    ll pm = 0;
    rep(i,n) sum += a[i];
    rep(i,n-1) {
        if (c[i] == '+') {
            mcnt += a[i+1];
        } else {
            if (!head) ans = max(ans, sum-mcnt*2);
            head = false;
            mcnt = a[i+1];
            sum -= pm*2;
            pm = a[i+1];
        }
    }
    if (head) ans = sum;
    cout << max(ans, sum-mcnt*2) << endl;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x = 0;
  cin >> x;
  if(360 % x == 0){
    cout << 360 / x << endl;
  }
  else{
    for(int i = 1;i <= x;i++){
      if(360 * i % x == 0){
        cout << 360 * i / x << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 3620
fn main() {
    let n: usize = read();
    let s: String = read();
    let v: Vec<char> = s.chars().collect();
    let mut sv1: Vec<char> = Vec::new();
    let mut sv2: Vec<char> = Vec::new();
    for i in 0..n / 2 {
        sv1.push(v[i]);
    }
    for i in n / 2..n {
        sv2.push(v[i]);
    }

    if sv1 == sv2 {
        println!("Yes");
    } else {
        println!("No");
    }
}








//**********************************************************************************************************************************************//

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: u64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String s = sc.next();
        if (a >= 3200) {
            System.out.println(s);
            return;
        }
        System.out.println("red");
    }

}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

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

int main() {
  char c;
  cin >> c;
  if (c >= 'a' && c <= 'z')
    cout << 'a' << endl;
  else
    cout << 'A' << endl;
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
using namespace std;

int main(){
    REP(i,9)REP(j,9)cout<<i+1<<"x"<<j+1<<"="<<(i+1)*(j+1)<<endl;
    return 0;
}

Measured memory_bytes: 1120
#include <iostream>

using namespace std;

int main(void){
	double a,b;
	while(cin >> a >> b){
		if(a<35.5 && b<71.0)cout << "AAA" << endl;
		else if(a<37.5 && b<77.0)cout << "AA" << endl;
		else if(a<40.0 && b<83.0)cout << "A" << endl;
		else if(a<43.0 && b<89.0)cout << "B" << endl;
		else if(a<50.0 && b<105.0)cout << "C" << endl;
		else if(a<55.0 && b<116.0)cout << "D" << endl;
		else if(a<70.0 && b<148.0)cout << "E" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

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

int main()
{
	int a,b;
	cin >> a >> b;
	if((a*b)%2==0) cout << "Even" << endl;
	else cout << "Odd" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

s64 mypow(s64 x, s64 n)
{
    s64 ret = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            ret = ret * x % MOD;
        }
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

void comdiv(map<int, s64>& x, s64 y)
{
    for (int i = 2; i * i <= y; ++i)
    {
        if (y % i == 0)
        {
            s64 temp = 0;
            while (y % i == 0)
            {
                temp++;
                y /= i;
            }
            x[i] = MAX(x[i], temp);
        }
    }
    if (y > 1)
    {
        x[y] = MAX(x[y], 1);
    }
}

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

    s64 N;
    s64 a;
    vs64 ainv;
    cin >> N;
    ainv.resize(N);
    map<int, s64> com;
    rep (i, N)
    {
        cin >> a;
        comdiv(com, a);
        ainv[i] = mypow(a, MOD - 2ULL);
    }

    s64 g = 1;
    for (auto mcom : com)
    {
        g *= mypow(mcom.first, mcom.second);
        g %= MOD;
    }

    s64 ans = 0;
    rep (i, N)
    {
        ans += (g * ainv[i]) % MOD;
        ans %= MOD;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <stack>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <map>

using namespace std;

typedef pair<int,int> pii;

main(){
    int a, b, c;
    int num = 0;
    cin >> a >> b >> c;
    num += a*100; num+= b*10; num+=c;
    if(num%4==0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

h,a = I()
print(h//a if h % a == 0 else h//a+1)


Measured memory_bytes: 10424
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n, a, b; cin >> n >> a >> b;
    cout << min(a * n, b) << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b(n);

    for(int i=0;i<n;i++){
        cin>>a.at(i);
        b.at(i)=a.at(i);
    }
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());

    for(int i=0;i<n;i++){
        if(b.at(0)==a.at(i)){
            cout<<b.at(1)<<endl;
        }else{
            cout<<b.at(0)<<endl;
        }
    }

}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main()
  {int x, y; scanf("%2d%2d", &x, &y);
  bool b{y == 0 or y > 12};
  puts(x == 0 or x > 12 ? b ? "NA" : "YYMM" : b ? "MMYY" : "AMBIGUOUS");}

Measured memory_bytes: 3676
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
R,S,P = inpl()
t = list(input())
di = {'r':P, 's':R, 'p':S}
res = 0
ch = True
for i in range(k):
    for j in range(i,n,k):
        if j > i and t[j] == t[j-k] and ch:
            ch = False
            continue
        res += di[t[j]]
        ch = True
        # print(i,j)
        # print(res)
print(res)

Measured memory_bytes: 6136
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };
string LURD = "LURD";
bool M[16][16][4];

//????????¨??????????????????
int main() {
	rep(i, 0, 9) {
		if (i % 2) {
			rep(j, 0, 5) {
				char c; cin >> c;
				if (c == '1') {
					M[i / 2][j][3] = true;
					M[i / 2 + 1][j][1] = true;
				}
			}
		}
		else {
			rep(j, 0, 4) {
				char c; cin >> c;
				if (c == '1') {
					M[i / 2][j][2] = true;
					M[i / 2][j + 1][0] = true;
				}
			}
		}
	}
	int x = 0, y = 0, dir = 2, cnt = 0;
	do {
		rep(i, 0, 4) {
			//?????????????????????????£????????????????????????????????????????????????????????????????
			int dir2 = (dir + 3 + i) % 4;
			if (M[y][x][dir2]) {
				x += dx[dir2]; y += dy[dir2];
				dir = dir2;
				cout << LURD[dir2];
				break;
			}
		}
	} while (x || y);
	cout << endl;
	return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,mod=1e9+7;
int n,m,x[N*N],y[N*N],a[N][N],sum[N*N];
bool vis[N*N];
int main()
{
    scanf("%d%d",&n,&m);
    bool flag=true;
    for(int i=1;i<=n;i++)
    {
        int s;scanf("%d",&s);
        if(x[s]) flag=false;
        x[s]=i;
        vis[s]=true;
    }
    for(int i=1;i<=m;i++)
    {
        int s;scanf("%d",&s);
        if(y[s]) flag=false;
        y[s]=i;
        vis[s]=true;
    }
    for(int i=n*m;i>=1;i--)
    {
        if(x[i])
            for(int j=1;j<=m;j++) a[x[i]][j]=i;
        if(y[i])
            for(int j=1;j<=n;j++) a[j][y[i]]=i;
    }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        if(a[i][j]) sum[a[i][j]]++;
    else sum[n*m+1]++;
    ll ans=1;
    for(int i=n*m;i>=1;i--)
    {
        if(vis[i])
        {
            if(!sum[i]) flag=false;
            if(!(x[i]&&y[i])) ans=ans*sum[i]%mod;
            sum[i]--;
            sum[i]+=sum[i+1];
        }
        else
        {
            sum[i]+=sum[i+1];
            if(!sum[i]) flag=false;
            ans=ans*sum[i]%mod,sum[i]--;
        }
    }
    if(!flag) ans=0;
    printf("%lld\n",ans);
}


Measured memory_bytes: 13568
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

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

using namespace std;

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

    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    long long mod = 1000000007;

    vector<long long> b(0), c(0);
    for (int i = 0; i < n; i++) {
        if (a[i] < 0) {
            b.push_back(-a[i]);
        } else {
            c.push_back(a[i]);
        }
    }

    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    if (k == n) {
        long long res = 1;
        for (int i = 0; i < static_cast<int>(b.size()); i++) {
            res = res * b[i] % mod;
        }
        for (int i = 0; i < static_cast<int>(c.size()); i++) {
            res = res * c[i] % mod;
        }

        cout << (b.size() % 2 == 0 ? res : (mod - res) % mod) << endl;
    } else if (k % 2 == 1 && c.size() == 0) {
        long long res = 1;
        for (int i = 0; i < k; i++) {
            res = res * b[i] % mod;
        }

        cout << (mod - res) % mod << endl;
    } else {
        int bl = b.size() - 1, cl = c.size() - 1;
        for (int i = 0; i < k; i++) {
            if (bl >= 0 && (cl < 0 || b[bl] >= c[cl])) {
                bl--;
            } else {
                cl--;
            }
        }

        if ((b.size() - bl) % 2 == 0) {
            if (bl < 0 || cl == static_cast<int>(c.size()) - 1) {
                bl++;
                cl--;
            } else if (cl < 0) {
                bl--;
                cl++;
            } else if (b[bl] * b[bl + 1] >= c[cl] * c[cl + 1]) {
                bl--;
                cl++;
            } else {
                bl++;
                cl--;
            }
        }

        long long res = 1;
        for (int i = b.size() - 1; i > bl; i--) {
            res = res * b[i] % mod;
        }
        for (int i = c.size() - 1; i > cl; i--) {
            res = res * c[i] % mod;
        }

        cout << res << endl;
    }
}


Measured memory_bytes: 6976
from collections import deque
h,w = map(int, input().split())
hw = [input() for _ in range(h)]

def bfs(s):
    que = deque([s])
    m = [[-1]*w for _ in range(h)]
    sh, sw = s
    m[sh][sw] = 0
    ret = 0
    while que:
        now_h, now_w = que.popleft()
        for dh, dw in [(1,0), (-1,0), (0,-1), (0,1)]:
            nh = now_h + dh
            nw = now_w + dw
            if not (0<=nh<h and 0<=nw<w) or m[nh][nw] != -1 or hw[nh][nw] == '#':
                continue
            m[nh][nw] = m[now_h][now_w] + 1
            que.append((nh,nw))
            ret = max(ret, m[now_h][now_w] + 1)
    return ret

ans = 0
for y in range(h):
    for x in range(w):
        if hw[y][x] == '#':
            continue
        s = (y, x)
        ans = max(bfs(s), ans)

print(ans)

Measured memory_bytes: 9412
#include<stdio.h>

int main(int argc, char const *argv[]) {
  int n,b,f,r,v,i,j,k;
  int room[4][3][10]={0};
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d %d", &b, &f, &r, &v);
    room[b-1][f-1][r-1] += v;
  }
  //printf("\n");
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 3; j++) {
      for (k = 0; k < 10; k++) {
        printf(" %d", room[i][j][k]);
      }
      printf("\n");
    }
    if (i<3) {
      printf("####################\n");
    }
  }
  return 0;
}

Measured memory_bytes: 612
double M[12][4096],r,t;D[12],n;
double dfs(p,f){if(M[p][f]<0){
int i=0;
for(M[p][f]=0;i<n;i++)if(!(f&1<<i)&&(t=dfs(i,f|1<<i)+D[p]+D[i]-2*sqrt(D[p]*D[i]),M[p][f]<t))M[p][f]=t;
}return M[p][f];}
main(l,i,j,d){for(;~scanf("%d",&l);puts(d-r<=l?"OK":"NA")){
for(d=n=0;getchar()!='\n';d+=D[n++]*2)scanf("%d",D+n);
for(i=0;i<n;i++)for(j=0;j<1<<n;j++)M[i][j]=-1;
for(r=i=0;i<n;i++)t=dfs(i,1<<i),r=r>t?r:t;
}exit(0);}

Measured memory_bytes: 968
def minko_n(x,y,n):
    D = 0
    for i in range(len(x)):
        D += (abs(x[i]-y[i]))**n
    return D**(1/n)

def minko_f(x,y):
    l = []
    for i in range(len(x)):
        l.append(abs(x[i]-y[i]))
    return max(l)

n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

print(minko_n(x,y,1))
print(minko_n(x,y,2))
print(minko_n(x,y,3))
print(minko_f(x,y))


Measured memory_bytes: 5644
#include<cstdio>

int main() {
    int a,b,c,x,k;
    k =0;
    scanf ("%d %d %d",&a,&b,&c);
    for (int x = a;x <= b;x++){
        if (c % x == 0){
            k = k + 1;
        }
    }
    printf("%d\n",k);
}



Measured memory_bytes: 2716
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}



int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    cout << A*B << endl;
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

lli combi[2*100005][3];

lli nCr(lli n, lli r)
{
       if(n<r) return 0;
       if(n==r) return combi[n][r] = 1;
       if(r==0) return combi[n][r] = 1;
       if(r==1) return combi[n][r] = n;
       if(combi[n][r]) return combi[n][r];
       return combi[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main() {
  lli N;
  cin >> N;
  
  vector<lli> A(N);
  
  vector<lli> B(N+2,0);
  rep(i, N){
  cin >> A[i];
    B[A[i]]++;
  }
  lli all=0;
  rep(i, N){
  all+=nCr(B[i+1],2);
  }
  rep(i, N){
  cout <<all-  B[A[i]]+1 << endl; 
  }
  
}

Measured memory_bytes: 19712
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

using pqg = priority_queue<ll,vector<ll>, greater<ll> >; // 1,3,5..
using pql = priority_queue<ll,vector<ll> >; //5, 3, 1...

using pqg_p = priority_queue<P,vector<P>, greater<P> >; // 1,3,5..
using pql_p = priority_queue<P,vector<P> >; //5, 3, 1...

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)

class UnionFind {
public:
  bool same(int a,int b) {
    return  root(a) == root(b);
  }

  void unite(int a, int b) {
    int pa = root(a);
    int pb = root(b);
    if ( pa == pb ) return;

    if(rank[pa] < rank[pb]) {
      par[pa] = pb;
    } else {
      par[pb] = pa;
      if( rank[pa] == rank[pb]) rank[pa]++;
    }
  }

  UnionFind(int N): par(N), rank(N) {
    REP(i,N) {
      par[i] = i;
      rank[i] = 0;
    }
  }

  int root(int t) {
    if(par[t] == t) {
      return t;
    }
    else {
      return par[t] = root(par[t]); //親を覚えておく
    }
  }

private:

  vector<int> par;
  vector<int> rank;
};

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

  int N,K,L;
  cin >> N >> K >> L;

  UnionFind u1(N+1);
  UnionFind u2(N+1);

  REP(i,K) {
    int a,b;
    cin >>  a >> b;
    u1.unite(a,b);
  }

  REP(i,L) {
    int a,b;
    cin >>  a >> b;
    u2.unite(a,b);
  }

  map<P,int> m;
  REP1(i,N+1) {
    P p(u1.root(i),u2.root(i));
    m[p]++;
  }

  REP1(i,N+1) {
    P p(u1.root(i),u2.root(i));
    if (i > 1) cout << " ";
    cout << m[p];
  }
  cout << endl;

}


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

int main(){
    string X, Y;
    cin >> X >> Y;

    if(X > Y){
        cout << ">" << endl;
    }else if (X < Y)
    {
        cout << "<" << endl;
    }else
    {
        cout << "=" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
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; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  cin >> n;
  if(n%4==0){
      pri("Yes");
      return 0;
  }
  for(ll i=n;i>0;i-=4){
    if(i%7==0){
      pri("Yes");
      return 0;
    }
  }
  pri("No");
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    int cnt = 0;
    int abroad = 0;
    rep(i, N) {
        if(S[i] == 'a') {
            if(cnt < A + B) {
                cout << "Yes" << endl;
                cnt++;
            } else {
                cout << "No" << endl;
            }
        } else if(S[i] == 'b') {
            if(cnt < A + B && abroad < B) {
                cout << "Yes" << endl;
                cnt++;
                abroad++;
            } else {
                cout << "No" << endl;
            }

        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

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

int main() {

    string S;
    cin >> S;

    int num;
    int min = 999;
    for (int i=0; i<S.length()-2; i++) {
        num = stoi(S.substr(i, 3));
        if (abs(num - 753) < min) {
            min = abs(num - 753);
        }
    }

    cout << min << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
long long n,a,b;
int main()
{
    cin>>n>>a>>b;
    if(a>b)
        swap(a,b);
    if((b-a)%2==0)
        cout<<(b-a)/2;
    else
        cout<<min(a-1, n-b)+1+(b-a-1)/2;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [[0]*N for _ in range(2)]

A[0] = list(map(int, input().split()))
A[1] = list(map(int, input().split()))

ans = 0
for i in range(N):
    temp = 0
    for j in range(i+1):
        temp += A[0][j]
    for j in range(N-i):
        temp += A[1][-(j+1)]
    ans = max(ans, temp)

print(ans)

Measured memory_bytes: 3064
def s(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
n=int(input())
print(f'{n}: ',end='')
print(*s(n))


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 1000002
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d ", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

void solve()
{
    int n;
    cin>>n;
    vector<ll>a(n);
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a.begin(), a.end());
    int cnt = 0;
    ll tot[2] = {0};
    for(int i = n-1; i >= 1; i--)
    {
        if(a[i]==a[i-1])
        {
            tot[cnt] = a[i];
            cnt++;
            i--;
        }
        if(cnt==2)
            break;
    }
    cout<<tot[0] * tot[1]<<endl;
}

int main()
{
    FASTIO;
    solve();

    return 0;
}


Measured memory_bytes: 3944
N,M = map(int, input().split())
A = list(map(int, input().split()))
vote = sum(A)
#print(vote)
count = 0
line = 4*M
line2 = vote/line
#print(line2)
ans = "No"

for i in A:
    if (i >= line2):
        count += 1

#print(count)
if (count >= M):
    ans = "Yes"


print(ans)

Measured memory_bytes: 3064
n = int(input())
s = [input() for _ in range(n)]
ac, wa, tle, re = 0, 0, 0, 0

for i in range(n):
    if "AC" in s[i]:
        ac += 1
    elif "WA" in s[i]:
        wa += 1
    elif "TLE" in s[i]:
        tle += 1
    elif "RE" in s[i]:
        re += 1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)

Measured memory_bytes: 16356
def main():
    n, m, q = map(int, input().split())
    l = []
    for i in range(q):
        l1, l2, l3, l4 = map(int, input().split())
        l.append([l1, l2, l3, l4])
    B = []
    for a in range(1, m + 1):
        for b in range(a, m + 1):
            for c in range(b, m + 1):
                for d in range(c, m + 1):
                    for e in range(d, m + 1):
                        for f in range(e, m + 1):
                            for g in range(f, m + 1):
                                for h in range(g, m + 1):
                                    for i in range(h, m + 1):
                                        for j in range(i, m + 1):
                                            L = [a, b, c, d, e, f, g, h, i, j]
                                            A = []
                                            for I in range(n):
                                                A.append(L[I])
                                            C = 0
                                            for k in range(q):
                                                if A[l[k][1] - 1] - A[l[k][0] - 1] == l[k][2]:
                                                    C += l[k][3]
                                            B.append(C)
    print(max(B))
    
main()

Measured memory_bytes: 12696
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.math.BigDecimal;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        long A=sc.nextLong();
        long V=sc.nextLong();
        long B=sc.nextLong();
        long W=sc.nextLong();
        long T=sc.nextLong();

        long kyori=A-B;
        long KYORI=Math.abs(kyori);

        long HAYASA=V-W;

        long CALC=T*HAYASA;

        if(V<=W){
            System.out.println("NO");
        }else{
            if(CALC>=KYORI){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }

        //END
    }
}



Measured memory_bytes: 35776
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 1; i <= int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back


int r, c, k;
int grid[3333][3333];
int dp[3333][3333][4];
void solve()
{
    cin>>r>>c>>k;
    forn(_, k)
    {
        int i, j, v; cin>>i>>j>>v;
        grid[i][j] = v;
    }

    forn(i, r) forn(j, c) forn(k, 3)
    {
        dp[i][j][k] = max({dp[i-1][j][3], dp[i][j-1][k-1], dp[i-1][j][0], dp[i-1][j][1], dp[i-1][j][2]}) + grid[i][j];
        dp[i][j][k] = max({dp[i][j][k], dp[i-1][j][k], dp[i][j-1][k]});
        dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1]);
        //debug(i, j, k, dp[i][j][k]);
    }

    int A = 0;
    forn(k, 3)
    {
        A = max(A, dp[r][c][k]);
    }
    cout << A<<'\n';
}

signed main(void)
{
    int T = 1;
    cout << fixed;
    cout.precision(3);
    ios_base::sync_with_stdio(0); cin.tie(0);

    //cin>>T;
    while (T--) solve();
    return 0;
}

Measured memory_bytes: 374656
#include<iostream>
#include<cstdio>
#include<cstring>

typedef long long ll;

ll a,b,c,d,n;

int main()
{
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);
	b=std::min(b,a*2);
	c=std::min(c,b*2);
	d=std::min(d,c*2);
	n=(n/2)*d+(n%2)*c;
	printf("%lld\n",n);
	return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

ll ba[N];
ll cb[N];

int main()
{
  int n;
  cin>>n;
  ll a[n], b[n], c[n];
  rep(i, 0, n)
    cin>>a[i];
  rep(i, 0, n)
    cin>>b[i];
  rep(i, 0, n)
    cin>>c[i];
  sort(a, a+n);
  sort(b, b+n);
  sort(c, c+n);
  int j = 0;
  int co = 0;
  for(int i=0; i<n; i++)
  {
    while(j < n && a[j] < b[i])
    {
      co++;
      j++;
    }
    ba[i] = co;
  }
  ll ans = 0;
  j = 0;
  for(int i = 1; i<= n; i++)
  {
    while(j <n && b[j] < c[i-1])
    {
      ans += ba[j];
      j++;
    }
    cb[i] = cb[i-1] + ans;
  }
  cout<<cb[n]<<endl;
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll mod = 1e9+7;
int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int k,x;cin>>k>>x;
        if(x<=(500*k)){
            cout<<"Yes";
        }
        else
            cout<<"No";
    }
    return 0;   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lld unsigned long long int
#define MAX 2005
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
using namespace std;

int n, x, l, r=1, aux = 0;
char c[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin>>l;
        aux+=l;
        if(aux<=x)r++;
    }
    cout<<r<<endl;
}


Measured memory_bytes: 256
times = [["AAA",35.50,71.00],["AA",37.50,77.00],["A",40.00,83.00],["B",43.00,89.00],["C",50.00,105.00],["D",55.00,116.00],["E",70.00,148.00]]
while True:
    try:
        a,b = map(float,input().split())
    except:
        break
    for time in times:
        if a < time[1] and b < time[2]:
            print(time[0])
            break
        if time[0] == "E":
            print("NA")
        
    


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

int main(void){
    int n, x, count = 0;

    while(1){
        cin >> n >> x;
        if((n == 0) && (x == 0)) break;
        for(int i = 1; i <= n; i++){
            for(int j = 1; j < i; j++){
                for(int k = 1; k < j; k++){
                    if(i+j+k == x) count++;
                }
            }
        }
        cout << count << endl;
        count = 0;
    }
    return 0;
}


Measured memory_bytes: 3096
from sys import stdin

lines = stdin.readlines()
counter = []
each_line = []
for i, line in enumerate(lines):
    if i == 0:
        counter = [int(x) for x in (line.rstrip().split())]
    else:
        each_line.append(str(line.rstrip()))

line_sort = sorted(each_line)

answer = str()
for i in range(counter[0]):
    answer += line_sort[i]

print(answer)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> factor(ll x){
    vector<ll> prime;
    for (ll i = 2; i<=sqrt(x); i++) {
        if(x%i==0){
            while(x%i==0)x/=i;
            prime.push_back(i);
        }
        if(x==1)break;
    }
    if(x!=1)prime.push_back(x);
    prime.insert(prime.begin(),1);
    return prime;
};
//ユークリッドの互除法
ll gcd(ll x,ll y){
    if(x>y)swap(x,y);
    if(y%x==0)return x;
    return gcd(x,y%x);
};
int main(){
    ll a,b;
    cin >> a >> b;
    vector<ll> prime=factor(gcd(a,b)) ;
    cout << prime.size() << endl;
}

Measured memory_bytes: 256