akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
vector<bool> IsPrime;

void sieve(int max){
    if(max+1 > IsPrime.size()){     
        IsPrime.resize(max+1,true); 
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(int i=2; i*i<=max; ++i) 
        if(IsPrime[i])
            for(int j=2; i*j<=max; ++j) 
                IsPrime[i*j] = false;      
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int max = 100005;
    sieve(max);
    vector<int> count(max,0);
    rep(i,2,max){
        if (IsPrime[i] and IsPrime[(i+1)/2]) count[i]++;
    }
    rep(i,max-1) count[i+1] += count[i];
    int q,l,r;
    cin >> q;
    rep(i,q){
        cin >> l >> r;
        PRINT(count[r]-count[l-1]);
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n, l;
	cin >> n >> l;
	string s[n];

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

	sort(s, s+n);
	for(int i=0; i<n; i++){
		cout << s[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>

using namespace std;



int main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    int count=0;
    int t=n/r+1;
    
    for (int i=0;i<t;i++){// 赤の個数
        for (int j=0;;j++){// 緑の個数
            int a=n-r*i-g*j;
            if (a<0) break;
            if (a%b==0) count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int X =scan.nextInt();
        switch(X%7){
            case 4:
                System.out.println("mon");
                break;
            case 5:
                System.out.println("tue");
                break;
            case 6:
                System.out.println("wed");
                break;
            case 0:
                System.out.println("thu");
                break;
            case 1:
                System.out.println("fri");
                break;
            case 2:
                System.out.println("sat");
                break;
            case 3:
                System.out.println("sun");
                break;    
        }
        
    }

}


Measured memory_bytes: 26264
n, k, s = map(int, input().split())
ans = []


for i in range(k):
    ans.append(s)

if s != 10 ** 9:
    for j in range(n-k):
        ans.append(s+1)
else:
    for j in range(n-k):
        ans.append(1)

print(*ans)

Measured memory_bytes: 9580
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}
fn main() {

    let n: usize = read();
    let m = read();
    let mut wa_count = vec![0; n + 1];
    let mut ans_state = vec![false; n + 1];
    let mut ans_result = 0;
    let mut wa_result = 0;

    for _ in 0..m {
        let p: usize = read();
        let s: String = read();

        if ans_state[p]  {continue};

        if s == String::from("AC") {
            ans_state[p] = true;
            wa_result += wa_count[p];
            ans_result += 1;
        }else if s == String::from("WA") {
            wa_count[p] += 1;
        }
        
    }

    println!("{} {}", ans_result, wa_result);


}


Measured memory_bytes: 4352
#include <cstdio>
int main()
{
	int a , b , c ,d;
	while(~scanf("%d %d %d %d",&a,&b,&c,&d))
	{
		  if(a*b >= c*d)
		    printf("%d\n",a*b);
		    else
		       printf("%d\n",c*d);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c;
    cin >> k;
    int m = max({a, b, c});
    int ans = a + b + c + m * ((1 << k) - 1);
    cout << ans << endl;
}



Measured memory_bytes: 256
N,K = map(int,input().split())
pos = set()
for i in range(K):
    d = int(input())
    A = map(int,input().split())
    for x in A:
        pos.add(x)
ans = 0
for i in range(1,N+1):
    if i not in pos:
        ans += 1
print(ans)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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 wa[200010];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    ll ans = 1LL<<60;
    ll le=0, ri=sum;
    rep(i, n){
        le+=a[i]; ri = sum-le;
        ans = min(ans, abs(le-ri));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< string, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789


///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

ll X, K, D;
ll ans;

int main(){
    
    cin>>X>>K>>D;
    if( X < 0 ) X *= -1;
    
    ll A = X/D;
    
    if( A > K ){
        ans = X-K*D;
    }
    else{
        if( (K-A) % 2 ){
            ans = (X-(A+1)*D)*-1;
        }
        else{
            ans = X-A*D;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int s = 0;
  rep(i,n) s ^= a[i];
  rep(i,n) a[i] ^= s;
  rep(i,n) cout << a[i] << endl;
  return 0;
}

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

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

  // AABB;
  int BB = i % 100;
  int AA = i / 100;

  if (1 <= AA && AA <= 12) {
    if (1 <= BB && BB <= 12)
      cout << "AMBIGUOUS" << endl;
    else
      cout << "MMYY" << endl;
  } else {
    if (1 <= BB && BB <= 12)
      cout << "YYMM" << endl;
    else
      cout << "NA" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  int b[n];
  for (int i=0;i<n;i++){
    scanf("%d",&b[i]);
  }
  a[0]=b[0];a[1]=b[0];
  for (int i=1;i<n-1;i++){
    int x=a[i];
    if(x<b[i]){
      a[i]=x;
    }
    else{
      a[i]=b[i];
    }
    a[i+1]=b[i];
  }
  int y=0;
  for (int i=0;i<n;i++){
    y=y+a[i];
  }
  printf("%d\n",y);
}
    

Measured memory_bytes: 128
n, m=map(int, raw_input().split())
a=map(int, raw_input().split())
cnt=[0]*(n+1)
for i in a:
	cnt[i]+=1
cover=[0]*(n+1)
for j in range(n+1):
	for k in range(min(cnt[j], j)):
		cover[j-k]+=1
result=cover.count(0)-1

for i in range(m):
	x, new=map(int, raw_input().split())
	old=a[x-1]
	a[x-1]=new
	cnt[old]-=1
	if cnt[old]<old:
		cover[old-cnt[old]]-=1
		if cover[old-cnt[old]]==0:
			result+=1
	if cnt[new]<new:
		if cover[new-cnt[new]]==0:
			result-=1
		cover[new-cnt[new]]+=1
	cnt[new]+=1
	print result
assert result==cover.count(0)-1
for j in range(n+1):
	for k in range(min(cnt[j], j)):
		cover[j-k]-=1
assert cover==[0]*(n+1)
for i in a:
	cnt[i]-=1
assert cnt==[0]*(n+1)

Measured memory_bytes: 23324
import collections

def factor(m):
    num=m
    s=[]
    i=2
    while i*i<=m:
        if num%i:
            i+=1
        else:
            s.append(i)
            num//=i
    if num!=1:
        s.append(num)
    return s

def conb(n, r):
	N, R = n, r
	for i in range(1, r):
		N *= n-i
		R *= r-i
	return N // R
	
n,m=map(int,input().split())
a=factor(m)
b=collections.Counter(a)
mod=10**9+7
ans=1
for i in b.values():
    ans=(ans*conb(n+i-1,i))%mod
print(ans)

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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;
}

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n, d;
    cin >> n >> d;
    ll con = 0;
    REP(i, n) {
        ll x, y;
        cin >> x >> y;
        if(x * x + y * y <= d * d) {
            con++;
        }
    }
    cout << con << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 3656
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = input()

for i in range(len(S)):
	T =  (ord(S[i])-65 + N)%26 + 65
	print(chr(T), end="")

print()

Measured memory_bytes: 6612
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int main(){
    for(int n; cin >> n, n;){
        vector<vector<P> >e(n + 1);
        vector<int>path(n + 1);
        for(int i = 2; i <= n; i++)cin >> path[i];
        for(int i = 2; i <= n; i++){
            ll w;
            cin >> w;
            e[i].push_back(P(path[i], w));
            e[path[i]].push_back(P(i, w));
        }
        ll ans = 0;
        ll tmp = 0;
        int idx = -1;
        for(int i = 1; i <= n; i++){
            for(int j = 0; j < e[i].size(); j++){
                int to = e[i][j].first;
                if(e[i].size() == 1 || e[to].size() == 1){
                    ans += e[i][j].second;
                    e[i][j].first = -1;
                }
                else{
                    tmp += e[i][j].second;
                    idx = i;
                }
            }
        }
        ans /= 2;
        if(idx < 0){
            cout << ans << endl;
            continue;
        }
        tmp /= 2;
        ans += 3 * tmp;
        vector<ll>depth(n + 1);
        stack<ll>To, From, Depth;
        To.push(idx); From.push(-1); Depth.push(0);
        int mxIdx = idx;
        while(!To.empty()){
            ll x = To.top(); To.pop();
            ll from = From.top(); From.pop();
            ll dep = Depth.top(); Depth.pop();
            depth[x] = dep;
            if(depth[x] > depth[mxIdx]){
                mxIdx = x;
            }
            for(int i = 0; i < e[x].size(); i++){
                int to = e[x][i].first;
                if(to < 0)continue;
                if(to == from)continue;
                To.push(to); From.push(x); Depth.push(dep + e[x][i].second);
            }
        }
        To.push(mxIdx); From.push(-1); Depth.push(0);
        while(!To.empty()){
            ll x = To.top(); To.pop();
            ll from = From.top(); From.pop();
            ll dep = Depth.top(); Depth.pop();
            depth[x] = dep;
            if(depth[x] > depth[mxIdx]){
                mxIdx = x;
            }
            for(int i = 0; i < e[x].size(); i++){
                int to = e[x][i].first;
                if(to < 0)continue;
                if(to == from)continue;
                To.push(to); From.push(x); Depth.push(dep + e[x][i].second);
            }
        }
        ans -= depth[mxIdx];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int N = cin.nextInt();
		Console.WriteLine((N*(N+1))/2);
	}
}

class Scanner
{
	string[] s;
	int i;

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

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

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

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

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

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

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

const int maxn = 200000+10;
char str[maxn];
char *y="Yes",*n="No";
bool exist(int a,int b)
{
    for(int i=a;i<b;++i)
        if(str[i]=='#'&&str[i+1]=='#')
            return false;
    return true;
}
bool three(int a,int b)
{
    for(int i=a+1;i<b;++i)
        if(str[i-1]=='.'&&str[i]=='.'&&str[i+1]=='.')
            return true;
    return false;
}
int main()
{
    ios::sync_with_stdio(false);
    int N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    cin>>str+1;
    str[0]='.';
    if(C<B&&B<D)
    {
        if(exist(A,C)&&exist(B,D))    cout<<y<<endl;
        else cout<<n<<endl;
    }else if(B<C&&C<D)
    {
        if(exist(B,D)&&exist(A,C))  cout<<y<<endl;
        else cout<<n<<endl;
    }else if(B<D&&D<C)
    {
        if(exist(A,C)&&three(B-1,D+1))  cout<<y<<endl;
        else cout<<n<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
int main(){

//    freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();
	int n;cin>>n;


	int conn[n][n];

	forn(i,n){
		forn(j,n-1)cin>>conn[i][j];
	}

	forn(i,n){
		forn(j,n-1)conn[i][j]--;
	}
	int ptr[n];
	forn(i,n)ptr[i] = 0;
	bool pos = true;
	int ans = 0;
	int max = (n*(n-1))>>1;
	while(true){
		if(ans > max){
			pos = false;
			break;
		}

		int mapp[n];
		bool done = true;
		forn(i,n){
			if(ptr[i] == n-1)continue;
			else{
				mapp[i] = 1;
				done = false;
			}
		}
		if(done == true)break;
		bool chg = false;
		forn(i,n){
			if(mapp[i] == 0)continue;
			int t = conn[i][ptr[i]];
			int x = conn[t][ptr[t]];

			if(mapp[t] == 0)continue;

			if(x == i){
				ptr[t]++;
				ptr[i]++;
				mapp[t] = 0;
				mapp[i] = 0;
				chg = true;
			}
			else continue;	
		}
		if(chg == false){
			pos = false;
			break;
		}
		ans++;
	}

	if(pos == false)cout<<-1;
	else cout<<ans;




    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#define MAX_NUM 1000
using namespace std;

int inputnumber(int *n){
	cin >> *n;
	return 0;
}

int inputnumbers(int n, int *a){
	for(int i=0;i<n;i++){
		cin >> *(a+i);
	}
	return 0;
}

void swap(int i,int j,int *a){
	int value=*(a+i);
	*(a+i)=*(a+j);
	*(a+j)=value;
}

int bubblesort(int n, int *a){
	int i,j,count=0;
	for(i=0;i<n;i++){
		for(j=n-1;j>0;j--){
			if(*(a+j)<*(a+j-1)){
				swap(j,j-1,a);
				count++;
			}
		}
	}
	return count;
}

int printnumbers(int n,int *a){
	for(int i=0;i<n-1;i++)
		cout << *(a+i) << ' ';
	cout << *(a+n-1) << endl;
	return 0;
}


int main() {
	int n,a[MAX_NUM];
	int count;

	inputnumber(&n);
	inputnumbers(n,a);
	count=bubblesort(n,a);
	printnumbers(n,a);
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3120
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int a,b;
    cin>>a>>b;
    if(a>=b) {
        rep(i,a) {
            cout<<b;
        }
    }
    else {
        rep(i,b) {
            cout<<a;
        }
    }
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll a,v;
    cin>>a>>v;
    ll b,w,t;
    cin>>b>>w>>t;
    if(a==b)
    {
        cout<<"YES\n";
        return;
    }
    ll d=abs(a-b);
    if(v<w)
    {
        cout<<"NO\n";
        return;
    }
    ll p=abs(v-w);
    p=p*t;
    if(p>=d)
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"NO\n";
    }
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

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

void    PrintList(const list<int> &List) {
    bool First=true;
    for (auto it=List.begin(); it != List.end(); it++) {
        if (First) {
            cout << *it;
            First=false;
        } else
            cout <<' ' <<*it;
    }
    cout <<endl;
}

void    deleteNode(const int &v, list<int> &List) {
    for (auto it=List.begin(); it != List.end(); it++) {
        if (v==*it) {
            List.erase(it);
            break;
        }
    }
}

int main() {
    list<int>   List;
    int N;
    cin >>N;
    string S;
    int v;
    for (int i=0; i<N; i++) {
        cin >>S;
        if ("insert"==S) {
            cin >>v;
            List.push_front(v);
        } else if("deleteFirst"==S)
            List.pop_front();
        else if("deleteLast"==S)
            List.pop_back();
        else {
            cin >>v;
            deleteNode(v, List);
        }
    }
    PrintList(List);
    return 0;
}


Measured memory_bytes: 34424
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int a, b;
    cin >> a >> b;
    if (a > 9 || b > 9) {
        cout << -1 << "\n";
    } else {
        cout << a * b << "\n";
    }
    return 0;
}

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


#define ll          long long
#define uint        unsigned int 
#define ld          long double
#define SAM         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define mod         1000000007
#define mxn         200005
#define pb          push_back
#define pii         pair<int,int>
#define f           first
#define s           second
#define sz(x)       (int)x.size()
#define all(x)      x.begin(),x.end()

using namespace std;

int main()
{
    SAM;
    int x,y,a,b;
    cin>>x>>y;

    a=0;
    b=x-a;
    while(1)
    {
        if(2*a+4*b==y)
        {
            cout<<"Yes";
            return 0;
        }
        else if(a==x && b==0)
        {
            if(2*a+4*b==y)
            {
                cout<<"Yes";
                return 0;
            }
            else
                break;
        }
        else
        {
            a++;
            b--;
        }
    }
    cout<<"No";

    
    return 0;
}




Measured memory_bytes: 3564
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll K, N;
  cin >> K >> N;
  vector<ll> A(N);
  for_each(begin(A), end(A), [](auto& x) { cin >> x; });

  sort(begin(A), end(A));

  // 差分の表を作る
  vector<ll> B(N);
  for (ll i = 0; i < N - 1; i++) {
    B[i] = A[i + 1] - A[i];
  }
  B[N - 1] = K - A[N - 1] + A[0];

  sort(begin(B), end(B));
  B.pop_back();
  ll ans = accumulate(cbegin(B), cend(B), 0LL);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	double N, x[20],ans=0;
	string u[20];
	cin >> N;
	for (int i = 0; i < N; i++)cin >> x[i] >> u[i];
	for (int i = 0; i < N; i++) {
		if (u[i] == "JPY")ans += x[i];
		else ans += x[i] * 380000;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define NUMBER_MAX (1<<15)

char is_sosuu[NUMBER_MAX];

void make_sosuu_list(void) {
	int i,j;
	for(i=0;i<NUMBER_MAX;i++)is_sosuu[i]=1;
	is_sosuu[0]=is_sosuu[1]=0;
	for(i=2;i<NUMBER_MAX;i++) {
		if(is_sosuu[i]) {
			for(j=i+i;j<NUMBER_MAX;j+=i)is_sosuu[j]=0;
		}
	}
}

int main(void) {
	int query,query2;
	int i,count;
	make_sosuu_list();
	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		count=0;
		query2=query/2;
		for(i=1;i<=query2;i++) {
			if(is_sosuu[i] && is_sosuu[query-i])count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    int F[110][10];
    int P[110][11];
    for(int i=0; i<N; i++){
        for(int j=0; j<10; j++){
            cin >> F[i][j];
        }
    }
    for(int i=0; i<N; i++){
        for(int j=0; j<11; j++){
            cin >> P[i][j] ;
        }
    }

    //
    int ans=-INT_MAX;
    for(int i=1; i< 1<<10; i++){ //
        int sum=0;
        for(int j=0; j<N; j++){
            int num=0;
            for(int k=0; k<10; k++){
                if( ( i & (1<<k) ) && (F[j][k]==1) ){
                    num++;
                }
            }
            sum += P[j][num];
        }
        ans = max(ans, sum);
    }

    cout << ans << endl;
}

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

const long long mod = 1000000007;

long long factorial(int x){
  long long fact = 1;
  for(int i = x; i > 1; i--){
    fact = (fact * i) % mod;
  }
  return fact;
}

int main(){
  int N, M;
  long long ans;
  cin >> N >> M;

  //差が2以上なら不可
  if(abs(N-M) >= 2){
    cout << 0 << endl;
    return 0;
  }

  //N == MならN!*M!*2
  if(N == M){
    ans = ((factorial(N) * factorial(M)) % mod * 2) % mod;
  }
  //N != M なら N!*M!
  else{
    ans = (factorial(N) * factorial(M)) % mod;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
//void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


#define N 200005
ll n;
vector<ll>v[N];
ll d[N];
void cal(ll k){
    queue<ll>q;
    rep(i,0,n-1)d[i]=inf;
    d[k]=1;q.push(k);
    while(!q.empty()){
        ll t=q.front();q.pop();
        for(auto x:v[t]){
            if(d[x]==inf){
                d[x]=d[t]+1;
                q.push(x);
            }
        }
    }
}

int main(){fastio
    cin>>n;
    rep(i,1,n-1){
        ll a,b;cin>>a>>b;a--;b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    cal(0);
    ll pos=-1,ma=0;
    rep(i,0,n-1){
        if(ma<d[i]){
            ma=d[i];
            pos=i;
        }
    }
    //rep(i,0,n-1)cout<<d[i]<<" ";cout<<endl;
    //cout<<pos<<endl;
    cal(pos);
    //rep(i,0,n-1)cout<<d[i]<<" ";cout<<endl;
    
    ma=0;
    rep(i,0,n-1)Max(ma,d[i]);
    if(ma%3==2)cout<<"Second"<<endl;
    else cout<<"First"<<endl;
    
    
    return 0;
}
//Nを変更



Measured memory_bytes: 15984
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
const ll MOD = 1000000007;
 
#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}
 
#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif
 
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll x;
    
    cin >> x;

    ll ans = 8-(x-400)/200;
    
    cout << ans << endl;
 
    return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
long long n, a[3005], b[3005];

int main(){
    scanf("%lld", &n);
    for(int i = 0; i < n; i++){
        scanf("%lld", a+i);
        b[i] = (n%2*2-1)*a[i];
        for(int j = i-1; j >= 0; j--){
            if((n-i+j)&1) b[j] = max(b[j+1] + a[j], b[j] + a[i]);
            else b[j] = min(b[j+1] - a[j], b[j] - a[i]);
        }
    }
    printf("%lld\n", b[0]);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long a,b,c,kk;
int main()
{
    cin>>a>>b>>c;
    if(b>=a)//第一天到达
    {
        cout<<1<<endl;
        return 0;
       // exit(0);//强制结束程序，子程序可用
    }
    if(c>=b)//出不去
    {
        cout<<-1<<endl;
        return 0;
    }
    if((a-b)%(b-c)>=1)kk=1;
    cout<<((a-b)/(b-c)+kk)*2+1<<endl;
}

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

int main(){

    string s;

    cin >> s;

    string t="AGCT";
    int ans=0;
    int te=0;
    rep(i,s.size()){
        rep(j,4){
            if(s[i]==t[j]){
                te++;
                break;
            }
            if(j==3){
                ans=max(ans,te);
                te=0;
            }
        }
    }

    ans=max(ans,te);

    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
#define PI 3.14159265





int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;

}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m;
string s;
char ch;
int main()
{
	getline(cin,s);
	int len=s.length();
	for(int i=0;i<len;i++) 
	{
		for(int j=0;j<i;j++)
		{
			if(s[i]=='F'&&s[j]=='C')
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

typedef long long ll;

const int MAX_A_LEN=2e5;

string A;

ll cnt['Z'-'A'+1];

int main(){
	cin>>A;
	ll ans=1;
	REP(i,(int)A.length()){
		ans+=i-cnt[A[i]-'a'];
		cnt[A[i]-'a']++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>vector<T> vec(int len, T elem) { return vector<T>(len, elem); } // auto dp = vec(52, vec(103, vec(103, INF)));
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>inline int popcount(T a) {return __builtin_popcount(a);}
template<class T>inline T emod(T a, T p) { return (a%p + p) % p;}
//-------------------
int h, w;
vector<string> s;
constexpr int MX = 3005;

int V;
struct Edge {
    int to;
    int cost;
};
vector<Edge> G[MX*MX];
int d[MX*MX];

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

void dijkstra(int s) {
    priority_queue<PII, vector<PII>, greater<PII> > que;
    fill(d, d+V, INF);
    que.push({0, s});

    while (!que.empty()) {
        PII p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] <= p.first) continue;
        d[v] = p.first;
        for (auto e: G[v]) {
            if (d[e.to] > d[v] + e.cost) { // make code faster
                que.push({d[v] + e.cost, e.to});
            }
        }
    }
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15);
    cin >> h >> w;

    int c[2]; cin >> c[0] >> c[1]; c[0]--; c[1]--;
    int cc[2]; cin >> cc[0] >> cc[1]; cc[0]--; cc[1]--;

    s.assign(h, "");
    rep(i, h) {
        cin >> s[i];
    }

    auto onfield = [&](int y, int x) {
        bool ans = true;
        if(y < 0 or h <= y) ans = false;
        if(x < 0 or w <= x) ans = false;
        return ans;
    };
    rep(i, h) {
        rep(j, w) {
            // cout << num[i][j] << " ";

            rep(k, 4) {
                int ni = i + dy[k];
                int nj = j + dx[k];
                if(onfield(ni, nj) and s[ni][nj]=='.') {
                    G[i*w+j].push_back({ni*w+nj, 0});
                }
            }
            for(int di=-2; di<=2; di++) {
                for(int dj=-2; dj<=2; dj++) {
                    int ni = i + di;
                    int nj = j + dj;
                    if(onfield(ni, nj) and s[ni][nj]=='.') {
                        G[i*w+j].push_back({ni*w+nj, 1});
                    }
                }
            }
        }
        // cout << endl;
    }


    V = h * w;
    dijkstra(c[0]*w+c[1]);

    int goal = cc[0]*w+cc[1];    
    if(d[goal]!=INF) cout << d[goal] << endl;
    else cout << -1 << endl;
    return 0;
}


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

char area[100][100];
using P=pair<char,bool>;

int main(){
  int n;
  std::cin >> n;
  int v[10][10]={};

  for (int i = 1; i <= n; i++) {

    int b=i%10;
    int t=i;
    while (t/10>0) {
      t/=10;
    }

    v[t][b]++;

    // std::cout << t << ' '<<b%10<<'\n';
  }



  ll ans=0;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      // std::cout << i <<':' << j<<' ';
      // std::cout << v[i][j] << '*'<<v[j][i]<<"   " ;
      // std::cout << v[i][j]*v[j][i] << '\n';
      ans+=v[i][j]*v[j][i];
    }
  }

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


  return 0;
}


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

int main(){
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  vector<int> a(m);
  for(int i = 0; i < m; i++){
    cin >> b[i];
  }
  
  int count = 0;
  for(int i = 0; i < n; i++){
    int y = 0;
    for(int j = 0; j < m; j++){
      cin >> a[j];
      y += b[j] * a[j];
    }
    if(y + c > 0)
      count++;
  }
  cout << count << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int dp[100010][2];

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

	string L;
	cin >> L;
	//reverse(all(L));

	dp[0][1] = 1;
	rep(i, 0, SZ(L))
	{
		if (L[i] == '1')
		{
			dp[i + 1][1] += dp[i][1] * 2;
			dp[i + 1][0] += dp[i][1];
		}
		else
		{
			dp[i + 1][1] += dp[i][1];
		}
		dp[i + 1][0] += dp[i][0] * 3;
		rep(j, 0, 2)
		{
			dp[i + 1][j] %= MOD;
		}
	}

	cout << (dp[SZ(L)][0] + dp[SZ(L)][1]) % MOD << endl;

	return 0;
}

Measured memory_bytes: 2000
#include<stdio.h>
void swap(int *x,int *y){
        int temp;

        temp=*x;
        *x=*y;
        *y=temp;

}
int main(void){
        int i,j,k;
        int height[10];

        i=0;

        while(scanf("%d",&height[i])==1){
                i++;
                if(i==10) break;
        }

        for(j=0;j<10;j++){
                if(height[j]<0 || height[j]>10000){
                        height[j]=0;
                }
        }

        for(i=0;i<10;i++){
                for(j=0;j<10;j++){
                        if(height[i]<height[j]){
                        swap(&height[i],&height[j]);
                        }
                }
        }       /*sort*/

        k=9;
        while(1){
                printf("%d\n",height[k]);
                k--;
                if(k==6) break;
        }

        return 0;
}

Measured memory_bytes: 600
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
const int MOD=1e9+7;
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n;
class CWalkOnMultiplicationTable {
public:
	void solve(std::istream& in, std::ostream& out) {
        in >> n;
        int ans=1e12;
        for(int i=1;i*i<=n;i++)
            if(n%i==0)
                ans=min(ans,i+n/i);
            out << ans-2 << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	CWalkOnMultiplicationTable solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
while 1
    a = gets.split.map(&:to_i)
    if a[0] == 0 && a[1] == 0 then
        break
    end
    puts ("#" * a[1] + "\n") + ("#" + "." * (a[1] - 2) + "#\n") * (a[0] - 2) + ("#" * a[1] + "\n")
    puts
end


Measured memory_bytes: 6968
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

//below here
int n;
int k;
vector<int> line(n);

vvvector<ll> dp;

ll func(int place,int select,int remain){
	if(place==n+1){
		return line[select];
	}

	if(dp[place][select][remain]>=0){
		return dp[place][select][remain];
	}

	ll res = INFLL;
	if(remain){
		chmin(res,func(place+1,select,remain-1));
		chmin(res,line[select]+func(place+1,0,remain-1));
	}
	if(line[select]>line[place]){
		chmin(res,line[select]-line[place]+func(place+1,place,remain));
	}else{
		chmin(res,func(place+1,place,remain));
	}
	return dp[place][select][remain] = res;
}

int main(){
	cin >> n >> k;
	line.push_back(0);
	rep(i,n){
		int d;
		cin >> d;
		line.push_back(d);
	}
	dp.resize(n+1,vvector<ll>(n+1,vector<ll>(k+1,-1)));
	cout << func(1,0,k) << endl;
	return 0;
}


Measured memory_bytes: 216960
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<tuple>
#include<map>
#define ll long long
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define REP(i, n) FOR(i, 0, n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;

const int MAX_N = 110;
const int MAX_V = 110000;
const ll INF = 1LL << 60;

int N;
ll W, w[MAX_N], v[MAX_N];
ll dp[MAX_N][MAX_V] = {0};

int main() {
    // 入力
    cin >> N >> W;
    REP(i, N) cin >> w[i] >> v[i];

    // DP初期化
    REP(i, MAX_N) REP(j, MAX_V) dp[i][j] = INF;
    dp[0][0] = 0;

    for (int i = 0; i < N; i++) {
        for (int sum_v = 0; sum_v < MAX_V; sum_v++) {
            if (sum_v - v[i] >= 0) {
                chmin(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i]);
            }
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }

    ll ans = 0;
    for (int sum_v = 0; sum_v < MAX_V; sum_v++) {
        if (dp[N][sum_v] <= W) {
            ans = sum_v;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 94720
L,R = map(int, input().split() )
#2019=3*673
judge=2018

if R-L > 671:
    judge=0
elif L%673 > R%673 :
    judge=0
else:
    i_s=list(range(L, R))
    judge_tmp=[]
    for i in i_s:
        judge_tmp.append(min([(i*j)%2019 for j in range(i+1, R+1)]) )
    judge = min(judge_tmp)
print(judge)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int n,k,d,a;
	int i,j,f[101]={0},c=0;
	scanf("%d %d",&n,&k);
	for(i=0;i<k;i++){
		scanf("%d",&d);
		for(j=0;j<d;j++){
			scanf("%d",&a);
			f[a]=1;
		}
	}
	for(i=1;i<=n;i++){
		if(f[i]==0){
			c++;
		}
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 1716
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10000;

/* typedef */

typedef pair<double,double> pdd;

struct Edge {
  double d;
  int i, j;
  Edge() {}
  Edge(double _d, int _i, int _j): d(_d), i(_i), j(_j) {}
  bool operator>(const Edge& e) const { return d > e.d; }
};

typedef vector<Edge> ve;

struct UFT {
  int links[MAX_N], ranks[MAX_N], sizes[MAX_N];
  UFT() {}

  void clear(int n) {
    for (int i = 0; i < n; i++)
      links[i] = i, ranks[i] = sizes[i] = 1;
  }

  int root(int i) {
    int i0 = i;
    while (links[i0] != i0) i0 = links[i0];
    return (links[i] = i0);
  }

  int rank(int i) { return ranks[root(i)]; }
  int size(int i) { return sizes[root(i)]; }
  bool same(int i, int j) { return root(i) == root(j); }
  
  int merge(int i0, int i1) {
    int r0 = root(i0), r1 = root(i1);
    int mr;
    if (ranks[r0] == ranks[r1]) {
      links[r1] = r0;
      sizes[r0] += sizes[r1];
      ranks[r0]++;
      mr = r0;
    }
    else if (ranks[r0] > ranks[r1]) {
      links[r1] = r0;
      sizes[r0] += sizes[r1];
      mr = r0;
    }
    else {
      links[r0] = r1;
      sizes[r1] += sizes[r0];
      mr = r1;
    }
    return mr;
  }
};

/* global variables */

int n, m;
pdd pts[MAX_N];
ve edges;
UFT uft;

/* subroutines */

/* main */

int main() {
  cin >> n >> m;

  for (int i = 0; i < n; i++) cin >> pts[i].first >> pts[i].second;

  for (int k = 0; k < m; k++) {
    int i, j;
    cin >> i >> j;
    i--, j--;

    double dx = pts[j].first - pts[i].first;
    double dy = pts[j].second - pts[i].second;
    double d = sqrt(dx * dx + dy * dy);

    edges.push_back(Edge(d, i, j));
  }
  sort(edges.begin(), edges.end(), greater<Edge>());

  uft.clear(n);

  double sum = 0.0;

  for (int k = 0; k < m; k++) {
    Edge& e = edges[k];

    if (uft.same(e.i, e.j))
      sum += e.d;
    else
      uft.merge(e.i, e.j);
  }

  printf("%.3lf\n", sum);

  return 0;
}

Measured memory_bytes: 1980