akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int x;
char c;
inline int read()
{
	x=0; c=getchar();
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return x;
}
int main()
{
	long n = read(), ans = n;
	for (int i = 1; i < n; ++i)
	{
        int u = read(), v = read();
		if (u > v) { u ^= v; v ^= u; u ^= v; }
        ans += i * (n - i + 1) - u * (n - v + 1);
	}
	printf("%lld\n", ans);
  
    return 0;
}


Measured memory_bytes: 3708
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,i;
  long a,b,x[100010],ans=0;
  cin >> n >> a >> b;
  for (i=0;i<n;i++) cin >> x[i];
  for (i=0;i<n-1;i++){
    ans+=min(a*(x[i+1]-x[i]),b);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 998244353
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    ll A;
    string B;
    cin >> A >> B;
    string Bd = B.substr(0, B.size() - 3);
    string Bf = B.substr(B.size() - 2);
    output(A * (stoll(Bd) * 100 + stoll(Bf)) / 100);
    
    
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}
vector<vector<pair<ll,ll>>> v(100010);
ll n;
ll c;
ll col[100010];

void ki(ll i,ll j){  // iからjへ行った
    if(i==1 && j==1){
        ll k=1;
        rep(l,0,v[j].size()-1){
            col[v[j][l].second]=k;
            ki(j,v[j][l].first);
            k++;
        }
        c=max(c,k-1);
    }else{
        if(v[j].size()>1){
            ll k=1;
            ll co=0;
            rep(l,0,v[j].size()-1){
                if(col[v[j][l].second]!=0){
                    co=col[v[j][l].second];
                }
            }
                rep(l,0,v[j].size()-1){
                    if(col[v[j][l].second]==0){
                        if(co==k){
                            k++;
                            col[v[j][l].second]=k;
                            ki(j,v[j][l].first);
                            k++;
                        }else{
                            col[v[j][l].second]=k;
                            ki(j,v[j][l].first);
                            k++;
                        }
                    }
                }
                c=max(c,k-1);
            
        }
    }
}

int main(){
    cin>>n;
    ll a[n],b[n];
    rep(i,0,n-2){
        cin>>a[i]>>b[i];
        v[a[i]].pb(make_pair(b[i],i));
        v[b[i]].pb(make_pair(a[i],i));
    }
    c=0;
    ki(1,1);
    cout<<c<<endl;
    rep(i,0,n-2){
        cout<<col[i]<<endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 10752
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int n,t,ans;
	cin>>n>>t;
	ans = INF;
	int cc,ct;
	rep(i,n){
		cin>>cc>>ct;
		if(ct <= t){
			ans = min(ans, cc);
		}
	}
	if(ans == INF){
		cout<<"TLE"<<endl;
	}else{
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
using System;

namespace abc168_a
{
    class Program
    {
        static void Main(string[] args)
        {
            // 鉛筆の本数に従って、読みを出力
            var pencilCountText = ChoosePencilReading(int.Parse(Console.ReadLine()));
           
            Console.WriteLine(pencilCountText);
            Console.Read();
        }

        private static string ChoosePencilReading(int pencilNum)
        {
            switch (pencilNum % 10)
            {
                case 0:
                case 1:
                case 6:
                case 8:
                    return "pon";

                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                    return "hon";

                case 3:
                    return "bon";

                default:
                    return null;
            }
        }
    }
}


Measured memory_bytes: 27320
#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>;

int main() {
	int n,d;
	
	cin >> n >> d;
	double dd = d;
	double dist;
	int cnt=0;
	int x,y;
	ll lx,ly;
	rep(i,n) {
		cin >> x >> y;
		lx = x;
		ly = y;
		dist = sqrt(lx*lx+ly*ly);
		if (dist <= d) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3676
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> int runLength(int N, T *arr, T *val, int *len){
  int i;
  int rN;
  if(N==0){
    return 0;
  }
  rN = 1;
  val[0] = arr[0];
  len[0] = 1;
  for(i=(1);i<(N);i++){
    if(val[rN-1] == arr[i]){
      len[rN-1]++;
    }
    else{
      val[rN] = arr[i];
      len[rN] = 1;
      rN++;
    }
  }
  return rN;
}
char S[102];
int N;
long long K;
int sz;
int arr[100];
char tmp[100];
int main(){
  long long res = 0;
  N = rd(S);
  rd(K);
  sz = runLength(N, S, tmp, arr);
  if(sz==1){
    wt_L(K * N / 2);
    wt_L('\n');
    return 0;
  }
  if(S[0] == S[N-1]){
    int i;
    res += arr[0] / 2;
    res += arr[sz-1] / 2;
    res += ((arr[0] + arr[sz-1]) / 2) * (K-1);
    for(i=(1);i<(sz-1);i++){
      res += (arr[i] / 2) * K;
    }
  }
  else{
    int i;
    for(i=(0);i<(sz);i++){
      res += (arr[i] / 2) * K;
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191006-1

// --- original code ---
// char S[102];
// int N; ll K;
// int sz, arr[100]; char tmp[100];
// {
//   ll res = 0;
//   rd(S@N, K);
// 
//   sz = runLength(N, S, tmp, arr);
//   if(sz==1) wt(K * N / 2), return 0;
// 
//   if(S[0] == S[N-1]){
//     res += arr[0] / 2;
//     res += arr[sz-1] / 2;
//     res += ((arr[0] + arr[sz-1]) / 2) * (K-1);
//     rep(i,1,sz-1) res += (arr[i] / 2) * K;
//   } else {
//     rep(i,sz) res += (arr[i] / 2) * K;
//   }
//   wt(res);
// }


Measured memory_bytes: 256
#include <stdio.h>

void printOneLine(int A[], int N, int cnt)
{
	int i;
	
	for(i = 0; i < N; i++){
		if(i != 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n%d\n", cnt);
}

void selectionSort(int A[], int N)
{
	int i, j, minj, cnt = 0;
	
	for(i = 0; i < N; i++){
		minj = i;
		for(j = i; j < N; j++){
			if(A[j] < A[minj]){
				minj = j;
			}
		}
		if(minj != i){
			A[i]    ^= A[minj];
			A[minj] ^= A[i];
			A[i]    ^= A[minj];
			cnt++;
		}
	}
	printOneLine(A, N, cnt);
}

int main(void)
{
	int i, N, A[100];
	
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	
	selectionSort(A, N);
	
	return(0);
}



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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a>0 && c>0){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cmath> 
#include <vector> 
#include <queue>
using ll = long long;
using namespace std;
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
int main() {
    string S;cin>>S;
    string ans;
    if(S[0]==S[1]){
        if(S[0]!=S[2]&&S[2]==S[3]){
            ans="Yes";
        }else{
            ans="No";
        }
    }else if(S[0]==S[2]){
        if(S[0]!=S[1]&&S[1]==S[3]){
            ans="Yes";
        }else{
            ans="No";
        }
    }else if(S[0]==S[3]){
        if(S[0]!=S[1]&&S[1]==S[2]){
            ans="Yes";
        }else{
            ans="No";
        }
    }else{
        ans="No";
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
//list index out of rangeエラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep1(i, n) for (int i = 0; i < (int)(n); i++)



int main(){
  string s,t;
  cin >> s >> t;
  int ans = 0;
  rep1(i, s.size()){
    if(s[i] != t[i]){
      ans += 1;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3844
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args>
void dbg(Args&&... args) {
  using expander = int[];
  (void)expander {0,(static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {exit(0);}

int n, k;

void input() {
  scanf("%d %d", &n, &k);
}

void solve() {
  if (n % k != 0) {
    printf("1\n");
  } else {
    printf("0\n");
  }
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
  //  gen();
#endif
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
a1,a2 = map(int,input().split())
b1,b2 = map(int,input().split())
c1,c2 = map(int,input().split())

C = ((a1-b1)**2 + (a2-b2)**2)**(1/2)
A = ((b1-c1)**2 + (b2-c2)**2)**(1/2)
B = ((c1-a1)**2 + (c2-a2)**2)**(1/2)

S = abs((b1-a1)*(c2-a2)-(b2-a2)*(c1-a1))

r1 = B*S/(B*(A + B + C) + 2*S)
r2 = C*S/(C*(A + B + C) + 2*S)
r3 = A*S/(A*(A + B + C) + 2*S)

print(max(r1,r2,r3))

Measured memory_bytes: 38384
#include <iostream>

int a[1000005];
int n;

long long calc(int mod){
  long long sum = 0, res = 0;
  for (int i = 0; i < n; i++){
    sum += a[i];
    if (i%2 == mod && sum <= 0) {
      res += 1-sum;
      sum = 1;
    }
    else if (i%2 != mod && sum >= 0){
      res += sum+1;
      sum=-1;
    }
  }
  return res;
}

int main(){

  std::cin.tie(0);
  std::cin >> n;
  for(int i=0; i<n; i++) std::cin >> a[i];

  std::cout << std::min(calc(0), calc(1)) <<'\n';
  return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
  ll n,k;
  cin>>n>>k;
  V<ll> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  ll ans=-inf,l=0,r=0;
  ll sum=0;
  for(int i=0;i<n;i++){
      if(i<k)sum+=a[i];
      else{
          if(a[i]>0)r+=a[i];
      }
  }
  chmax(ans,l+sum+r);
  chmax(ans,l+r);
  for(int i=0;i<n-k;i++){
       if(a[i]>0)l+=a[i];
       sum-=a[i];
       sum+=a[i+k];
       if(a[i+k]>0)r-=a[i+k];
       chmax(ans,l+sum+r);
       chmax(ans,l+r);
  }
  cout<<ans<<"\n";
}


Measured memory_bytes: 3948
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner str = new Scanner(System.in);
        int H = str.nextInt();
        int N = str.nextInt();

        for(int i = 0; i < N; i++){
            H -= str.nextInt();
        }

        if(H <= 0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }

        str.close();


    }
}

Measured memory_bytes: 47164
#include <bits/stdc++.h>
#define MAXN 100100
using namespace std;

int alt[MAXN];
int pd[MAXN];
int n, k;

int main (){
	cin >> n >> k;
	
	int i,j;
	
	for(i = 1; i <= n; i++){
		cin >> alt[i];
	}
	
	for(i = 2; i <= n; i++){
		pd[i] = 1999999999;
		for(j = 1; j <= k && i-j >= 1; j++){
			pd[i] = min(pd[i], pd[i-j] + abs(alt[i] - alt[i-j])); 
		}
	}
	
	cout << pd[n] << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
 
void print(int* A, int N){
  int i;
  for(i = 0; i < N; i++){
    if(i) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}
 
int bubble_sort(int* A, int N){
  int i,j, cnt = 0;
  for(i = 0; i < N; i++)
    for(j = N-1; j >= i+1; j--)
      if(A[j] < A[j-1]){
    int tmp = A[j];
    A[j] = A[j-1];
    A[j-1] = tmp;
    cnt++;
      }
  print(A,N);
  return cnt;
}
 
int main(){
  int i,N,data[100];
  scanf("%d",&N);
  for(i = 0; i < N; i++) scanf("%d",&data[i]);
  printf("%d\n",bubble_sort(data,N));
  return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(5);
  for(int i= 0; i< 5; i++){
    cin >> a.at(i);
  }
  for(int i= 0; i<4; i++){
    if(a.at(i) == 0){
      cout << a.at(i+1)-1 << endl;
      return 0;
    }
  }
  cout << a.at(3)+1 << endl;
  return 0;

}

Measured memory_bytes: 3596
H,W=map(int,input().split())
s=[]
for i in range(H):
    si=[]
    Si=input()
    for j in range(W):
        si.append(Si[j]=='.')
    s.append(si)

# 左に照らした場合 行ごとに見てゆく
L=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and s[i][j]:
            L[i][j]=1
        elif s[i][j]:
            L[i][j]=L[i][j-1]+1

# 右に照らした場合 行ごとに見てゆく
R=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in reversed(range(W)):
        if j==W-1 and s[i][j]:
            R[i][j]=1
        elif s[i][j]:
            R[i][j]=R[i][j+1]+1

# 上に照らした場合 列ごとに見てゆく
U=[[0 for j in range(W)] for i in range(H)]
for j in range(W):
    for i in range(H):
        if i==0 and s[i][j]:
            U[i][j]=1
        elif s[i][j]:
            U[i][j]=U[i-1][j]+1

# 下に照らした場合 列ごとに見てゆく
D=[[0 for j in range(W)] for i in range(H)]
for j in range(W):
    for i in reversed(range(H)):
        if i==H-1 and s[i][j]:
            D[i][j]=1
        elif s[i][j]:
            D[i][j]=D[i+1][j]+1

ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)

Measured memory_bytes: 201224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, double> pdd;
const double eps = 1e-10;
const double pi = acos(-1);
inline int sgn(double d){if(fabs(d) < eps) return 0;if(d > 0) return 1;return -1;}
inline double rad(double _deg){return _deg / 180.0 * pi;}
inline double deg(double _rad){return _rad / pi * 180.0;}
struct Point{
	double x, y;
	void read(){scanf("%lf%lf", &x, &y);}
	Point():x(0.0), y(0.0){}
	Point(double a, double b = 0.0): x(a), y(b){}
	Point(const Point& p): x(p.x), y(p.y){}
	Point operator + (const Point& a){return {x + a.x, y + a.y};}
	Point operator - (const Point& a){return {x - a.x, y - a.y};}
	double operator * (const Point& a){return x * a.x + y * a.y;}
	double operator ^ (const Point& a){return x * a.y - y * a.x;}
	bool operator == (const Point& p){return sgn(x - p.x) == 0 && sgn(y - p.y) == 0;}
	bool operator < (const Point &p) const{
		if(sgn(x - p.x) == 0) 
			return sgn(y - p.y) == -1;
		return sgn(x - p.x) == -1;
	}
	double length(){return sqrt(x * x + y * y);}
}typedef Vector;
struct Line{
	Point a, b;
	void read(){a.read(); b.read();}
	Line() : a(0.0, 0.0) , b(0.0, 0.0){}
};
struct Segment{
	Point a, b;
	void read(){a.read(); b.read();}
	Segment() : a(0.0, 0.0) , b(0.0, 0.0){}
	Segment(Point _a, Point _b) : a(_a), b(_b){}
};
double Distance(const Point &a, const Point &b) 
{
	double x = a.x - b.x;
	double y = a.y - b.y;
	return sqrt(x * x + y * y);
}
Point Projection(Point p, Line l)
{ 
	// 点在直线上的投影点
	Vector v1 = l.b - l.a;
	Vector v2 = p - l.a;
	double k1 = v1 * v2;
	double k2 = v1.length();
	k1 /= k2 * k2;
	return {l.a.x + v1.x * k1, l.a.y+ v1.y * k1};
}
Point Reflection(Point p, Line l)
{
	// 点关于直线对称
	Point p0 = Projection(p, l);
	Vector v0 = p0 - p;
	return p0 + v0;
}
int ccw(Point p, Segment sg)
{	// Counter_Clockwise
	// p 关于(sg.a -> sg.b)的位置关系
	Vector v0 = sg.b - sg.a;
	Vector v1 = p - sg.a;
	
	int fcross = sgn(v0 ^ v1);
	
	if(fcross == 1) return 1; // 逆时针方向
	if(fcross == -1) return -1; // 顺时针方向
	
	int fdot = sgn(v0 * v1);
	
	if(fdot == -1) return 2; // 反向线段外共线
	if(v0.length() < v1.length()) return -2; //正向线段外共线
	return 0; //点在线段上
}
bool isParallel(Line l1, Line l2)
{
	//没有判断重合
	return sgn((l1.b - l1.a) ^ (l2.b - l2.a)) == 0;
}
bool isOrthogonal(Line l1, Line l2)
{
	//正交
	return sgn((l1.b - l1.a) * (l2.b - l2.a)) == 0;
}
bool isIntersection(Segment sg1, Segment sg2)
{
	// 判断线段是否有交点
	return ccw(sg2.a, sg1) * ccw(sg2.b, sg1) <= 0 && ccw(sg1.a, sg2) * ccw(sg1.b, sg2) <= 0;
}
bool isConvex(vector<Point> p)
{
	if(p.size() < 3) return 0;
	bool flag1 = 1, flag2 = 1;
	int n = p.size();
	for(int i = 0; i < p.size(); ++i)
	{
		if(ccw(p[i], {p[(i + 1) % n], p[(i + 2) % n]}) == -1) flag1 = 0; //逆时针方向
		if(ccw(p[i], {p[(i + 1) % n], p[(i + 2) % n]}) == 1) flag2 = 0; //顺时针方向
	}
	return flag1 || flag2;
}
int main()
{
	int n;
	vector<Point> p;
	scanf("%d", &n);
	while(n --)
	{
		Point _p;
		_p.read();
		p.push_back(_p);
	}
	bool ans = isConvex(p);
	printf("%d\n", ans);
	return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	vector<double> x(n);
	VS u(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> u[i];
	}
	double ans = 0;
	for (int i = 0; i < n; i++) {
		if (u[i] == "JPY") {
			ans += x[i];
		}
		else {
			ans += x[i] * 380000;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(L: int):
    print((L/3)**3)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::min;
using std::max;
using std::fill;
using std::max_element;
using std::min_element;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const long long MOD = 1e9 + 7;
const long long inf = 1e18;
const long long infsmart = 1e12;

int getint()
{
    int x = 0;
    char c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    return x;
}

int n, k;
S s;
vector<pair<int, int> > kek;
int pref[600000];

long long KEK = 2e5;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < KEK; i++) kek.push_back({0, 0});
    for (int i = 0; i < s.size(); i++)
    {
        cnt++;
        if (i + 1 == s.size() || s[i + 1] != s[i])
        {
            kek.push_back({s[i], cnt});
            cnt = 0;
        }
    }
    ll ans = 0;
    for (int i = 0; i < KEK; i++) kek.push_back({0, 0});
    pref[0] = kek[0].second;
    for (int i = 1; i < kek.size(); i++)
        pref[i] = pref[i - 1] + kek[i].second;
    for (int i = KEK; i < kek.size() - KEK; i++)
    {
        int l = i;
        int r = i + 2 * k;
        if (kek[i].first == '0')
        {
            r -= 2;
            l--, r++;
        }
        //cout << l << " " << r << endl;
        //cout << pref[r] - pref[l - 1] << endl;
        ans = max(ans, (ll)pref[r] - pref[l - 1]);
    }
    cout << ans;
}


Measured memory_bytes: 6592
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
    cin>>a>>b;
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    sort(a.begin(),a.end());
    
    if(a<b)
        cout<<"Yes";
    else 
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 入力
		String s = sc.next();
		String t = sc.next();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

#define NUM 2147483647

int N = 1;
int* data;

void init(int first_N){
	while(N < first_N)N *= 2;
}

void update(int update_left,int update_right,int new_value,int node_id,int node_left,int node_right){
	if(update_right < node_left || update_left > node_right)return;
	else if(update_left <= node_left && update_right >= node_right){
		data[node_id] = new_value;
	}else{
		if(data[node_id] >= 0){
			update(node_left,node_right,data[node_id],2*node_id+1,node_left,(node_left+node_right)/2);
			update(node_left,node_right,data[node_id],2*node_id+2,(node_left+node_right)/2+1,node_right);
			data[node_id] = -1;
		}
		update(update_left,update_right,new_value,2*node_id+1,node_left,(node_left+node_right)/2);
		update(update_left,update_right,new_value,2*node_id+2,(node_left+node_right)/2+1,node_right);
	}
}

int query(int search_left,int search_right,int node_id,int node_left,int node_right){
	if(search_right < node_left || search_left > node_right){
		return NUM;
	}else{
		if(data[node_id] != -1)return data[node_id];
		else{
			int left = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
			int right = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);
			return min(left,right);
		}
	}
}

int main(){
	int first_N,Q;
	scanf("%d %d",&first_N,&Q);

	init(first_N);

	data = new int[270000];

	for(int i = 0; i <= 2*N-2; i++)data[i] = NUM;

	int command,left,right,value;

	for(int i = 0; i < Q; i++){
		scanf("%d",&command);

		if(command == 0){
			scanf("%d %d %d",&left,&right,&value);
			update(left,right,value,0,0,N-1);
		}else{
			scanf("%d %d",&left,&right);
			printf("%d\n",query(left,right,0,0,N-1));
		}
	}

}

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

int main(){
	int a,b;
	cin >> a >> b;
	for(int i=1;i<=100000;i++){
		if((i*8)/100 == a && i/10 == b){
			cout << i << endl;
			return 0;
		}
	}
	cout << "-1\n";
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())

P = list(map(int, input().split()))

exp = [(p + 1) / 2 for p in P]

exp_val = sum(exp[:K])

max_ = exp_val
for i in range(K, N):
    exp_val += exp[i]
    exp_val -= exp[i - K]

    max_ = max(max_, exp_val)

print(max_)


Measured memory_bytes: 25060
local status=0
local split=0
local n=io.read("*n")
local a=io.read("*n")
for i=1,n-1 do
    b=io.read("*n")
    if a>b then
        if status==1 then
            split=split+1
            status=0
        elseif status==0 then
            status=-1
        end
    elseif a<b then
        if status==-1 then
            split=split+1
            status=0
        elseif status==0 then
            status=1
        end
    end
    a=b
end
print(split+1)

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
const int MAX=500005;
int n,q;
int d,a[MAX],query[MAX],dp[MAX],pos[MAX];
bool ans[MAX];
int main()
{
	scanf("%d%d",&n,&d);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
	}
	scanf("%d",&q);
	for(int i=1;i<=q;++i){
		scanf("%d",&query[i]);
	}
	dp[n]=1;
	for(int i=n-1;i>=1;--i){
		if(dp[i+1]<=(a[i+1]/2)) dp[i]=dp[i+1];
		else dp[i]=dp[i+1]+a[i+1];
	}
	pos[0]=d;
	for(int i=1;i<=n;++i){	
		if(d>abs(d-a[i])){
			d=abs(d-a[i]);
		}
		pos[i]=d;
	}
	for(int i=1;i<=q;++i){
		if(pos[query[i]-1]>=dp[query[i]]) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 9728
#include<iostream>
using namespace std;
int main(){
  int w,h,n,x,y,a,min_x,max_x=0,min_y,max_y=0;
  int ans=0;
  bool tile[100][100]={{},{}};;
  cin >> w >> h >> n;
  min_x = w;
  min_y = h;
  for(int i=0;i<n;i++){
    cin >> x >> y >> a;
    switch(a){
      case 1:
        max_x = (max_x>x)?max_x:x;
        break;
      case 2:
        min_x = (min_x<x)?min_x:x;
        break;
      case 3:
        max_y = (max_y>y)?max_y:y;
        break;
      case 4:
        min_y = (min_y<y)?min_y:y;
    }
  }
  if(max_x>=min_x||max_y>=min_y){
    ans = 0;
  }else{
    ans += (max_x+(w-min_x))*h;
    ans += (max_y+(h-min_y))*w - (max_x+(w-min_x))*(max_y+(h-min_y));
    ans = h*w - ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        if (k == 1){
            System.out.println(0);
        } else {
            System.out.println(n - k);
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  double p = 0;
  double pi;
  long long now;
  for (int i=1;i<n+1;i++){
    now = i;
    pi = 1.0/n;
    while(now < k){
      now = 2*now;
      pi = pi/2;
    }
    p += pi;
  }
  cout << setprecision(12) <<p << endl;
  return 0;
}

Measured memory_bytes: 256
// Apna Time Aayega :)
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define MOD 1000000007
#define vpi vector<pair<int, int>>
#define ll long long int
#define MAX 1000000
#define inf 1000000000
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#include <chrono>

vector< pair<int, int> > findSubArrays(int arr[], int n) 
{ 
    // create an empty map 
    unordered_map<int, vector<int> > map; 
   
    // create an empty vector of pairs to store 
    // subarray starting and ending index 
    vector <pair<int, int>> out; 
   
    // Maintains sum of elements so far 
    int sum = 0; 
   
    for (int i = 0; i < n; i++) 
    { 
        // add current element to sum 
        sum += arr[i]; 
   
        // if sum is 0, we found a subarray starting 
        // from index 0 and ending at index i 
        if (sum == 0) 
            out.push_back(make_pair(0, i)); 
   
        // If sum already exists in the map there exists 
        // at-least one subarray ending at index i with 
        // 0 sum 
        if (map.find(sum) != map.end()) 
        { 
            // map[sum] stores starting index of all subarrays 
            vector<int> vc = map[sum]; 
            for (auto it = vc.begin(); it != vc.end(); it++) 
                out.push_back(make_pair(*it + 1, i)); 
        } 
   
        // Important - no else 
        map[sum].push_back(i); 
    } 
   
    // return output vector 
    return out; 
} 

int main() {
    FIO
    long long int sum = 0;
    int N; cin>>N;
    for(int i=1; i<=N; ++i){
        if(i%3==0 || i%5==0);
        else sum = sum + i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;

int main(void) {
    int64_t X;
    cin >> X;

    int64_t a = 100;
    for(int64_t i=1;;i++) {
        a += a/100;
        if(a >= X) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int N,K; cin >> N >> K;
int R,S,P; cin >> R >> S >> P;
map<char, int> mp;
mp['r'] = P; mp['p'] = S; mp['s'] = R;
string T; cin >> T;

int ans = 0;
rep(i,N) {
    if(i >= K && T[i] == T[i-K]) {
        T[i] = 't';
        continue;
    }
    ans += mp[T[i]];
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 512
a=input().split(' ')
a[0]=int(a[0])
a[1]=int(a[1])
a[2]=int(a[2])
c=a[0]
m=0
while c<a[1]+1:
    if c%a[2]==0:
        m=m+1
    c=c+1
print(m)


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

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

    int ans = 0;
    while (1) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 != 0)
            {
                cout << ans << endl;
                return 0;
            }
        }
        ans++;
        for (int i = 0; i < n; i++)
            a[i] = a[i] >> 1;
    }
}

Measured memory_bytes: 3608
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    var n = readLong()
    var res = ""
    while (n > 0) {
        n -= 1
        res += ('a'.toByte() + n % 26).toChar()
//        n = floor(n.toDouble()/26).toLong()
            n /= 26
    }
    println(res.reversed())
}


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

int main() {
    ll N,K;
    cin >> N >>K;
    ll sum[N+1] ={};
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        sum[i+1] = sum[i]+a;
    }
    vector<ll> candidates;
    for(int l=0;l<N;l++)for(int r =l;r<N;r++){
        candidates.push_back(sum[r+1]-sum[l]);
    }
    vector<ll> used(candidates.size(),false);
    ll ans =0;
    for(ll degree = 50;degree>=0;--degree){
        ll num =0;
        for(int i=0;i<candidates.size();i++){
            if(used[i]){
                continue;
            }
            if(candidates[i] & (1ll<<degree)){
                num++;
            }
        }
        if(num>=K){
            ans += (1ll<<degree);
            for(int i=0;i<candidates.size();i++){
                if(!(candidates[i] & (1ll<<degree))){
                    used[i] = true;
                } 
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11096
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

struct pl {
    bool operator()(const pll &a, const pll &b) {
        return a.first * a.second < b.first * b.second;
    }
};

int main(void)
{
    IOS
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n),f(n);
    REP(i,n) cin >> a[i];
    REP(i,n) cin >> f[i];
    sort(ALL(a));
    sort(RALL(f));
    ll ng = -1, ok = a.back() * f.front();
    ll jump = ok / 2;

    auto isok = [&](ll &x){
        bool ret = true;
        ll k2 = k;
        REP(i,a.size()) {
            ll c = a[i] * f[i] - x;
            if (c > 0) {
                if (c % f[i] == 0) k2 -= c / f[i];
                else k2 -= c / f[i] + 1;

                if (k2 < 0) {
                    ret = false;
                    break;
                }
            }
        }
        return ret;
    };

    ll cnt = ok - jump;
    while(ng +1 < ok) {
        jump /= 2;
        if (jump == 0) jump = 1;
        if (isok(cnt)) {
            ok = cnt;
            cnt -= jump;
        } else {
            ng = cnt;
            cnt += jump;
        }
        // cerr << ng << " " << ok << endl;
    }
    
    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include<map>
using namespace std;

long long sum;
int n;
string a;
map<string ,int> p;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		sort(a.begin(),a.end());
		sum+=p[a];
		p[a]++;
	}
	cout<<sum;
    return 0;
}

Measured memory_bytes: 11136
N, K = map(int, input().split())
# perm = list(map(int, input().split()))

# print(N)
# print(K)
# print(perm)

n = N
ret = 0

n = n - K
ret += 1

while n > 0:
    n = n - (K - 1)
    ret += 1

print(ret)
#    print(int((N - 1) / (K - 1)))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;

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

    int N;
    string s;
    cin >> N >> s;

    vector<bool> issheep(N);
    for (int i = 0; i < 4; ++i) {
        issheep[0] = i & 1, issheep[1] = i & 2;
        for (int j = 1; j < N - 1; ++j)
            issheep[j + 1] = issheep[j - 1] ^ (s[j] == 'x') ^ !issheep[j];
        if (issheep[0] != issheep[N - 2] ^ (s[N - 1] == 'x') ^ !issheep[N - 1])
            continue;
        if (issheep[1] != issheep[N - 1] ^ (s[0] == 'x') ^ !issheep[0])
            continue;
        for (int j = 0; j < N; ++j)
            cout << (issheep[j] ? 'S' : 'W');
        cout << endl;
        return 0;
    }

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


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

#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int n; cin >> n;
    bool can = false;
    vi p(n); rep(i,n) cin >> p[i];
    vi p_copy = p;
    sort(all(p_copy));
    
    for(int i = 0; i < n-1; i++){
        for(int j = i; j < n; j++){
            swap(p[i], p[j]);
            if(p==p_copy){
                can = true;
                break;
            }
            swap(p[i], p[j]);
        }
    }
    cout << (can? "YES" : "NO") << '\n';
}


Measured memory_bytes: 256
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

N = int(input())
x = []
u = []

for _ in range(N):
    li = input().split()
    x.append(float(li[0]))
    u.append(li[1])

ans = 0
for x_i, u_i in zip(x, u):
    if u_i == "JPY":
        ans += x_i
    else:
        ans += x_i*380000.0

print(ans)

Measured memory_bytes: 21008
import java.util.*;
import java.io.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] sa = br.readLine().split(" ");
        int[] array = new int[n];
        
        for(int i=0; i<n;i++) {
            array[i] = Integer.parseInt(sa[i]);
        }
        
        int q = Integer.parseInt(br.readLine());
        int[][] queryArray = new int[q][2];
        for(int i=0; i<q;i++) {
            String[] sa2 = br.readLine().split(" ");
            queryArray[i][0] = Integer.parseInt(sa2[0]);
            queryArray[i][1] = Integer.parseInt(sa2[1]);
        }
        
        int[] countArray = new int[100001];
        long ans = 0;
        
        for(int i=0; i<n;i++) {
            countArray[array[i]-1]+=1;
            ans+=(long)array[i];
        }
        
        for(int i=0; i<q;i++) {
            ans-=(long)countArray[queryArray[i][0]-1]*(long)queryArray[i][0];
            ans+=(long)countArray[queryArray[i][0]-1]*(long)queryArray[i][1];
            
            countArray[queryArray[i][1]-1]+=countArray[queryArray[i][0]-1];
            countArray[queryArray[i][0]-1]=0;
            
            System.out.println(ans);
        }
        
        
        
        
    }
}


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

int main() {
    int W, H, x, y, r;

    cin >> W >> H >> x >> y >> r;

    if (0 <= x-r && x+r <= W && 0 <= y-r && y+r <= H) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#define maxn 100010
using namespace std;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
priority_queue<int>q;
int a[maxn],b[maxn];
int n,ans;
int main()
{
    n=read();
    ll sum1=0,sum2=0;
    for(int i=1;i<=n;i++) a[i]=read();
    for(int i=1;i<=n;i++) sum1+=(ll)a[i];
    for(int i=1;i<=n;i++) b[i]=read();
    for(int i=1;i<=n;i++) sum2+=(ll)b[i];
    if(sum1<sum2){
        puts("-1");
        return 0;
    }    
    ll cha=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]<b[i])  cha+=(ll)(b[i]-a[i]),ans++;
        else if(a[i]>b[i]){
            q.push(a[i]-b[i]);
        }
    }
    while(cha)
    {
        ll now=q.top();
        q.pop();
        ans++;
        if(cha>now)  cha-=now;
        else{
            break;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1408
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<vector>
#include<queue>
#define ll long long
ll read()
{
	ll tmp=0;char c=getchar(),f=1;
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9'){tmp=tmp*10+c-48;c=getchar();}
	return tmp*f;
}
using namespace std;
char s[100010];
int main()
{
	int i;
	scanf("%s",s);
	int len=strlen(s);
	for(i=0;i*2<len;i++)
		printf("%c",s[i*2]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
const ll MODA=998244353;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
vector<ll> fac;
vector<ll> finv;
vector<ll> inv;
void COMinit(ll N,ll P){
    rep(i,N+1){
        if(i==0){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else if(i==1){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else{
            fac.push_back(fac.at(i-1)*i%P);
            inv.push_back(P-inv.at(P%i)*(P/i)%P);
            finv.push_back(finv.at(i-1)*inv.at(i)%P);
        }
    }
}

ll COM(ll n,ll k,ll P){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac.at(n)*(finv.at(k)*finv.at(n-k)%P)%P;
}
int main()
{
    ll N;
    cin>>N;
    vector<ll> A(N);
    rep(i,N){
        cin>>A.at(i);
    }
    vector<ll> dp(N+1);
    rep(i,N+1){
        if(i==0)dp.at(0)=1000;
        if(i==1)dp.at(1)=1000;
        if(i>=2){
            dp.at(i)=max(dp.at(i-1),(dp.at(i-1)/A.at(i-2))*A.at(i-1)+dp.at(i-1)%A.at(i-2));
        }
    }
    cout<<dp.at(N)<<endl;
}

Measured memory_bytes: 3632
n = int(input())
a = [0]
a.extend(list(map(int, input().split())))
max_a = max(a)
counter = [0]*(max_a+1)
combi_common = 0
for num in a:
    counter[num] += 1
for i in range(1, max_a+1):
    if counter[i] >= 2:
        combi_common += counter[i]*(counter[i]-1)//2
for j in range(1,n+1):
    cou = counter[a[j]]
    if cou >= 2:
        out = combi_common + ((cou-1)*(cou-2) - cou*(cou-1))//2
    else:
        out = combi_common
    print(out)

Measured memory_bytes: 26140
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 80005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
string s;
string tar = "keyence";
void Solve() {
	cin >> s;
	int p = 0;
	while(s[p] == tar[p]) ++p;
	int q = 0;
	while(s[s.length() - 1 - q] == tar[tar.length() - 1 - q]) ++q;
	if(p + q >= tar.length()) puts("YES");
	else puts("NO");
}
int main() {
	Solve();
}

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

#define ff first
#define ss second
#define mp make_pair
#define pb push_back

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int N;
    cin >> N;
    cout << 48 - N;
	
	
		
	
	return 0;
}


Measured memory_bytes: 256