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

#define lli long long int
#define Sort(n) sort(n.begin(), n.end())
#define Reve(n) reverse(n.begin(), n.end())
#define YES puts("YES")
#define NO puts("NO")

//素数
bool IsPrime(lli num)
{
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)return false;
  }
  return true;
}
//各桁の和
lli sum(lli n)
{
  lli sum=0;
  if (n<0) return 0;
  while (n>0)
  {
    sum += n%10;
    n /= 10;
  }
  return sum;
}

int main(void)
{
  int n, flag=0;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++) {
    cin >> a.at(i);
    if(a.at(i) % 2 == 0) {
      if(a.at(i) % 3 != 0&&a.at(i) % 5 != 0) flag++;
    }
  }
  if(flag == 0) puts("APPROVED");
  else puts("DENIED");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;


int main(){
    int N, D, X;
    cin >> N >> D >> X;

    int ans = X;
    for (int i = 0; i < N; i++){
        int A; cin >> A;
        ans += D / A;
        if (D % A != 0){
            ans++;
        }
    }
      
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<int> w(n);
	int sum=0;
	for (int i=0; i<n; i++)
		cin>>w[i], sum+=w[i];
	int ret=INT_MAX, cur=0;
	for (int i=0; i<n-1; i++) {
		cur+=w[i];
		ret=min(ret,abs(sum-cur-cur));
	}
	cout<<ret<<"\n";
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int main(int argc, char **argv) {
	string s;
	cin >> s;
	ll res[2] = {0, 0};
	REP(i, s.length()) ++res[(i + s[i]) % 2];
	cout << min(res[0], res[1]) << endl;
	return 0;
}


Measured memory_bytes: 3784
/******************************************
* AUTHOR : SOMU KUMAR *
* INSTITUTION : IIT BHUBANESWAR *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
int p[2*N];
int s[2*N];
int find(int x){
	if(p[x]!=x)return p[x]=find(p[x]);
	return p[x];
}
void un(int a,int b){
	int x=find(a);
	int y=find(b);
    p[x]=y;
    s[y]+=s[x];
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//code here...............//
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
	s[i]=1;
	p[i]=i;
}
for(int i=0;i<m;i++){
	int a,b;
	cin>>a>>b;
	if(find(a)!=find(b)){
		un(a,b);
	}
}
int ans=0;
for(int i=1;i<=n;i++){
	ans=max(ans,s[find(i)]);
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 11296
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,m;
  char judge;
  while(1){
    cin >> n;
    if(n==0) break;
    char c1[n][2];
    for(int i=0;i<n;i++){
      cin >> c1[i][0] >> c1[i][1];
    }
    cin >> m;
    char data[m];
    for(int i=0;i<m;i++){
      cin >> judge;
      for(int j=0;j<n;j++){
	if(judge == c1[j][0]){
	  judge=c1[j][1];
	  break;
	}
      }
      data[i]=judge;
    }

    for(int i=0;i<m;i++){
      cout << data[i];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1248
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a,b,x;
    cin >> x >> a >> b;
    if (a >= b) cout << "delicious" << endl;
    else if(b-a <= x){
        cout << "safe" << endl;
    }
    else cout << "dangerous" << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
cam = []
for i in range(n):
    cam.extend([str(i+1)] * a[i])
for i in range(h):
    if i % 2 == 0:
        print(*cam[i*w:(i+1)*w])
    else: print(*cam[(i+1)*w-1:i*w-1:-1])

Measured memory_bytes: 4084
S = input()
cnt = 1
tf = False
a = S[0]

for i in range(1, len(S)):
    if tf:
        cnt += 1
        a = S[i-1] + S[i]
        tf = False
    else:
        if a == S[i]:
            tf = True
        else:
            cnt += 1
            a = S[i]

print(cnt)

Measured memory_bytes: 9320
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
signed main(){
	int n;
	cin>>n;
	vector<vector<int>> a(3,vector<int>(n));
	rep(i,3) rep(j,n) cin>>a[i][j];
	rep(i,3) sort(All(a[i]));
	int S;
	rep(i,n){
		int ka=lower_bound(All(a[0]),a[1][i])-a[0].begin();
		int kc=a[2].end()-upper_bound(All(a[2]),a[1][i]);
		S+=ka*kc;
	}
	cout<<S<<endl;
}

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

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3 << '\n';
	else if (s[0] == 'R' && s[1] == 'R' || s[1] == 'R' && s[2] == 'R') cout << 2 << '\n';
	else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1 << '\n';
	else cout << 0 << '\n';
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    int a,b;cin>>a>>b;
    co(max(max(a+b,a-b), a*b));
}




Measured memory_bytes: 256
using System;
using System.Collections;
using System.Linq;


public class Test
{
	public static double n = 0;
	public static double ans = 0;
	public static string str = "";
	public static void Main()
	{
		str = Console.ReadLine();
		string s = "";

		tansaku(0,s);
		Console.WriteLine(ans);
	}
	public static void tansaku (int i ,string s)
	{
		if(i == str.Length-1){
			keisan(s);
		}
		else
		{
			tansaku(i+1, s+"0");
			tansaku(i+1, s+"1");
		}
	}
	
	public static void keisan (string s)
	{
		string str2 = "";
		char[] nums = str.ToCharArray();	
		char[] c = s.ToCharArray();

		str2 += nums[0].ToString();

		for(int i = 0 ; i < c.Length ; i++)
		{
			if(c[i]== '1')
			{	

				ans += double.Parse(str2);
				str2 = "";
			}
			str2 += nums[i+1].ToString();
		}

		ans += double.Parse(str2);
	//	Console.WriteLine(ans);
	}
}

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

using namespace std;
int main(){
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int counter = 0;
    for (size_t i = 0; i <= a; i++)
    {
        for (size_t j = 0; j <= b; j++)
        {
            for (size_t k = 0; k <= c; k++)
            {
                if(i*500 + j*100 + k*50 == x) counter ++;
            }
        }
    }
    
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    string S;
    cin >>N>>S;
    int r=0,g=0,b=0;
    rep(i,N){
        if(S[i]=='R') r++;
        if(S[i]=='G') g++;
        if(S[i]=='B') b++;
    }
    int ans=r*g*b;
    for(int i=1;i<=N;i++){
        for(int j=i+1;j<=N;j++){
            int k=2*(j)-(i);
            if(k>N) break;
            if(S[i-1]!=S[j-1]&&S[j-1]!=S[k-1]&&S[i-1]!=S[k-1]) ans--;
        }
    }
    cout << ans << endl;



}


Measured memory_bytes: 3664
import sys

f_i = sys.stdin

n, q = map(int, f_i.readline().split())

S = set([frozenset([i]) for i in range(n)])

def unite(sets, v1, v2):
    s1 = None
    s2 = None
    for s in sets:
        if v1 in s and v2 in s:
            return None
        elif v1 in s:
            s1 = s
        elif v2 in s:
            s2 = s
        if s1 and s2:
            break
    sets.discard(s1)
    sets.discard(s2)
    s3 = s1.union(s2)
    sets.add(s3)

def same(sets, v1, v2):
    for s in sets:
        if v1 in s and v2 in s:
            print(1)
            break
        elif v1 in s or v2 in s:
            print(0)
            break

for l in f_i:
    com, x, y = map(int, l.split())
    if com == 0:
        unite(S, x, y)
    else:
        same(S, x, y)

Measured memory_bytes: 12448
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        Double b = Double.parseDouble(sc.next());
        Double n = Double.parseDouble(sc.next());
        sc.close();
        if (n >= b - 1) {
            System.out.println((int) (a - a / b));
        } else {
            System.out.println((int) (a * n / b) - a * (int) (n / b));
        }
        System.out.println();
    }
}

Measured memory_bytes: 35648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int N;
    cin >> N;
    if(N%1000 == 0){
    cout << 0 << "\n";        
    }else{
    cout << 1000-(N%1000) << "\n";

    }
    return 0;
}

Measured memory_bytes: 3592
import sys

def main():
    input = sys.stdin.readline
    A = list(map(str, input().strip()))
    alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
            'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
            'None']

    for a in alph:
        if a not in A:
            return a


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3956
import itertools
import numba
from numba import jit, i8
import decimal


def calc(x):
    return (x % (10 ** 9 + 7))


# map(lambda x: border(int(x)),

n = int(input())
#a = list(map(lambda x: calc(int(x)), input().split()))
a = list(map(int, input().split()))
rev_a = a[::-1]
#print(rev_a, 'rev')
acc_a = list(itertools.accumulate(rev_a))


MOD = 10**9 + 7
ans = 0
num = len(a)
# print(acc_a)

for i, val in enumerate(a):
    if (i == num - 1):
        break
    #temp = sum(a[i + 1:]) % MOD
    temp = acc_a[num - 1 - i - 1] % MOD
    # print(temp)
    # print(temp)
    # temp = val * sum(a[i + 1:])
    # ans += temp % MOD
    ans += (temp * val) % MOD

print(ans % MOD)

'''
@jit
def calc(lis):
    ans = 0
    num = len(lis)
    for i in range(num):
        for j in range(i + 1, num):
            temp = (lis[i] * lis[j]) % MOD
            ans += temp

    return ans


aa = calc(a)
print(aa)
'''

'''
for i in itertools.combinations(a, 2):
    temp = (i[0] * i[1]) % MOD
    ans += temp

print(ans)
'''


Measured memory_bytes: 113252
import numpy as np
a=int(input())
if a==2:
    print(2)
else:
    b = int(np.sqrt(a))
    strage = list(range(b))
    tf = False
    while tf == False:
        for n in strage:
            m = n + 2
            if a % m == 0:
                a = a + 1
                tf = False
                break
            else:
                tf = True
    print(a)

Measured memory_bytes: 14280
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    
    if ((a * b) % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
string s;
long mod=1e9+7,dp[3333][3333];
int n;
main()
{
	cin>>n>>s;
	dp[0][0]=1;
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<=i;j++)
		{
			if(s[i-1]=='<')dp[i][j]=(dp[i-1][0]-dp[i-1][j]+mod)%mod;
			else dp[i][j]=dp[i-1][j];
		}
		for(int j=i;j--;)dp[i][j]=(dp[i][j]+dp[i][j+1])%mod;
	}
	cout<<dp[n-1][0]<<endl;
}

Measured memory_bytes: 78464
#include <iostream>
using namespace std;
int main(void){
    int n, m;
    int a[55], b[55];
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    int ans[55];
    for(int i = 0; i < n; i++){
        ans[i] = 0;
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(a[j] == i || b[j] == i){
                ans[i]++;
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define Rall(a) (a).rbegin(), (a).rend()
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

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

class UnionFind{
private:
  vector<ll> data;
public:
  UnionFind(ll x){
    data.resize(x,-1);
  }
  //data[x]はxの根の値
  //xが根の場合data[x]は根がxの集合の要素の個数
  ll root(ll x){
    return (data[x]<0) ? x : data[x] = root(data[x]);
  }
  bool isParent(ll x){
  	if(data[x]<0) return true;
  	else return false;
  }
  void unite(ll x, ll y){
    x = root(x);
    y = root(y);
    if(x == y) return;
    //xにyを結合
    data[x] += data[y];
    data[y] = x;
  }
  bool same(ll x, ll y){
    return (root(x) == root(y));
  }
  ll size(ll x){
    return -data[root(x)];
  }
};


ll N,M;

int main(){
	cin >> N >> M;
	UnionFind u(N);
	for(ll i=0;i<M;i++){
		ll x,y,z;
		cin >> x >> y >> z;
		//0基準に
		x--,y--;
		u.unite(x,y);
	}
	ll cnt = 0;
	for(ll key=0;key<N;key++){
		if(u.isParent(key)) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1024
n = $stdin.gets.to_i
ary = $stdin.gets.split.map(&:to_i)

count = 0
result = 0
min = 1000000000

n.times do |i|
  if ary[i] < 0
    count += 1
  end
  if min > ary[i].abs
    min = ary[i].abs
  end
  result += ary[i].abs
end

if count % 2 != 0
  result -= min * 2
end

puts result

Measured memory_bytes: 8580
#include<stdio.h>
int main(){
  int a,b,d,r;
  double f;
  scanf("%d%d",&a,&b);
  d=a/b;
  printf("%d ",d);
  r=a%b;
  printf("%d ",r);
  f=(double)a/b;
  printf("%f\n",f);
  return 0;
}

Measured memory_bytes: 636
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (500006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
const ll MOD = 1e9+7;
ll n, A[MAXN], sum[MAXN], zero[MAXN];
vector<ll>zeros;
ll qexp(ll b, ll e) {
	if(e==0) return 1;
	ll half = qexp(b, e/2);
	half *= half;
	half %= MOD;
	if(e&1) half *= b;
	return half%MOD;
}
bool degug=1-1;
int main()
{
	FAST
	cin>>n;
	FOR(i,1,n+1)cin>>A[i];
	FOR(i,1,n+1)sum[i]=sum[i-1]^A[i]; FOR(i,1,n+1)zero[i]=zero[i-1]+(sum[i]==0);
	FOR(i,1,n+1)if(sum[i]==0)zeros.pb(i);
	if(sum[n]!=0){
		vector<ll>dp(n+1,0);
		ll X = sum[n];
		ll zeroways = 0, oneways = 0;
		// since sum[0] != 0, zeroways = 1;
		zeroways = 1; 
		for(ll i=n;i>=0;--i){ 
			if(sum[i]==X) {
				dp[i]=oneways;
				// update zeroways
				zeroways += dp[i];
				zeroways %= MOD;
			}else if(sum[i]==0){
				dp[i]=zeroways;
				//update oneways
				oneways+=dp[i];
				oneways%=MOD;
			}
		}
		cout<<dp[0]<<'\n';
	} else {
		vector<ll>val(2e6+5,0),f(2e6+5,0);
		ll ans = qexp(2,zero[n]-1);
		for(ll i=n;i>=1;i--)if(sum[i]!=0){
			ll x=sum[i];
			ll dp=1;
			/* */
			dp += (val[x] + MOD - (zero[i]*f[x])%MOD)%MOD; dp%=MOD;
			if(degug)cerr<<"i: "<<dp<<'\n';
			/* */
			val[x] += dp*zero[i]; val[x]%=MOD;
			f[x] += dp; f[x]%=MOD;
			ans+=dp;ans%=MOD;
		} // rbrr to modddd
		cout<<ans<<'\n';
	}
}


Measured memory_bytes: 47340
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    double xa,ya,xb,yb,xc,yc,xd,yd;
    double EPS=1e-10;
    while (cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd) {
        if (abs( (xd-xc)*(xb-xa)+(yd-yc)*(yb-ya) )<EPS) {
            cout<<"YES"<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
}


Measured memory_bytes: 3172
/*Given an array of n numbers find the largest difference in the 
starting and ending indexes of the elements of the all possible 
strictly decreasing sub-sequences in the array.

Input: 21, 13, 18, 10, 7, 3, 1

Output : 4

Input: 1, 18, 17, 14, 15, 32, 16 

Output: 2 */
#include<bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mod 1000000007
#define M 100001
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define lp(i,a,b) for(i=a;i<b;i++)
#define lpr(i,a,b) for(i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;

int main(){

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

	fast;  
  int i,n;
  cin>>n;
  int r=1000*floor(n/500);
  n-=500*(n/500);
  r+=5*(n/5);
  cout<<r<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007LL
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vll vector<ll>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
ll gcd(ll n1,ll n2){
    if(n2==0)
        return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
    if(exponent<0) exponent+=MOD-1;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%MOD;
        base=(base*base)%MOD;
        exponent/=2;
    }
    return ans;
}
int x[MAX],y[MAX];
int main()
{
	csl;
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);

    int a,b,c;
    cin>>a>>b>>c;
    cout<<max(10*a+b+c,max(10*b+a+c,10*c+a+b));

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int N;

int solve(vector<int> &v, vector<string> &g, vector<bool> &c){
    vector<int> net;
    for(int p=0; p<v.size(); ++p){
        for(int i=0; i<N; ++i){
            if(g[v[p]][i]=='1' && !c[i]){
                net.push_back(i);
                c[i]=1;
            }
        }
    }
    if(net.size()==0) return 1;
    for(int i=0; i<net.size(); ++i){
        for(int j=i+1; j<net.size(); ++j){
            if(g[net[i]][net[j]]=='1') return -1;
        }
    }
    int desc=solve(net, g, c);
    if(desc<0) return -1;
    return 1+desc;
}


int main() {
	cin >> N;
	vector<string> s(N);
	for(int i=0; i<N; ++i) cin >> s[i];
	int ans=-1;
	for(int i=0; i<N; ++i){
	    vector<bool> ch(N, 0);
	    ch[i]=1;
	    vector<int> t{i};
	    ans=max(ans, solve(t, s, ch));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
 
public class Main {
  void run() {
    Scanner sc = new Scanner(System.in);

    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    int x = 100*r + 10*g + b;

    if (x % 4 == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
 
  public static void main(String[] args) {
    new Main().run();
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;

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

    cin >> a >> b >> c >> d;

   int minv = min(b, d);
   int maxv = max(a, c);
   if(minv >= maxv){
       printf("%d\n", minv - maxv);
   }
   else{
       printf("0\n");
   }

   return 0;
}

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



int main(){
    bool flag=false;
    vector<vector<char>>a(3,vector<char>(2));
    rep(i,3){
        rep(j,2){
            cin >> a[i][j];
        }
    }
    if(a[0][0]==a[2][1]){
        if(a[1][0]==a[1][1]){
            if(a[2][0]==a[0][1]){
                flag=true;
            }
        }
    }
    if(flag) cout << "YES" <<endl;
    else cout << "NO" << endl;
    return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n;
    cin >> n;
    lint ans=0;

    vector<lint> p(n);
    REP(i, n) { cin >> p[i]; }

    FOR(i, 1, n - 1)
    {
        if (p[i - 1] < p[i] && p[i] < p[i + 1])
            ans += 1;
        if (p[i - 1] > p[i] && p[i] > p[i + 1])
            ans += 1;
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))




l  =readint()

ans = []

n = l.bit_length()
for i in range(1,n):
    ans.append([i,i+1,0])
    ans.append([i,i+1,1<<(i-1)])

for i in range(n-1):
    if l & 1<<i:
        ans.append([i+1,n,(l>>(i+1))<<(i+1)])

print(n,len(ans))
for i in range(len(ans)):
    printline(ans[i])



Measured memory_bytes: 62212
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

typedef unsigned long long ll;

ll num_string(ll n, ll d) {
    ll ret = 0, pow10 = 1, total = 0;
    for(int i=0;i<18;i++) {
        if(n >= pow10) {
            ll upper_lim = min(n, pow10*10-1);
            ret += (upper_lim/d - total) * (i+1);
            // cerr << n << " " << d << " " << ret << endl;
            total = upper_lim/d;
        }
        pow10 *= 10;
    }
    if(n == pow10) ret += 19;
    return ret;
}

ll fizzbuzz_string(ll n) {
    ll ret = num_string(n, 1) - num_string(n, 3) - num_string(n, 5) + num_string(n, 15);
    ret += 4 * (n/3) + 4 * (n/5);
    return ret;
}

string output(ll n, ll rest) {
    string ret = "";
    int count = 0;
    while(count < 20+rest) {
        n++;
        bool isnum = true;
        if(n % 3 == 0) {
            ret += "Fizz";
            count += 4;
            isnum = false;
        }
        if(n % 5 == 0) {
            ret += "Buzz";
            count += 4;
            isnum = false;
        }
        if(isnum) {
            string n_str = to_string(n);
            ret += n_str;
            count += n_str.length();
        }
    }
    // cerr << ret << " " << ret[rest] << endl;
    return ret.substr(rest, 20);
}

string solve(ll s) {
    ll ok = 0, ng = 1e18;
    while(ng-ok > 1) {
        ll mid = (ok+ng)/2;
        if(fizzbuzz_string(mid) < s) {
            ok = mid;
        }else{
            ng = mid;
        }
    }
    // cerr << ok << " " << fizzbuzz_string(ok) << endl;

    ll rest = s - 1 - fizzbuzz_string(ok);
    // cerr << "rest: " << rest << endl;
    return output(ok, rest);
}

int main() {
    ll s;
    cin >> s;
    cout << solve(s) << endl;
}


Measured memory_bytes: 3284
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		sc.close();
		long ans = n - 1;
		for (long i = 1; i*i <= n; i++) {
			if (n % i == 0) {
				ans = Math.min(ans, i + (n / i) - 2);
			}
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 23636
input_string = list(input())
# print(input_string)

flg = 0

for num, char in enumerate(input_string):
    if num%2 == 0:
#         print('odd', num, char)
        if (char != 'R') and (char != 'U') and (char != 'D'):
            flg = 1
    else:
#         print('even', num, char)
        if (char != 'L') and (char != 'U') and (char != 'D'):
            flg = 1

if flg == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
fun main(args:Array<String>){
    var x = readLine()!!.toInt()
    while(true){
        var ok = true
        for(i in 2 .. Math.sqrt(x.toDouble()).toInt()){
            if(x % i == 0) ok = false
        }
        if(ok) break
        x++
    }
    println(x)
}


Measured memory_bytes: 29812
#include <atcoder/convolution>
#include <atcoder/dsu>
#include <atcoder/fenwicktree>
#include <atcoder/lazysegtree>
#include <atcoder/math>
#include <atcoder/maxflow>
#include <atcoder/mincostflow>
#include <atcoder/modint>
#include <atcoder/scc>
#include <atcoder/segtree>
#include <atcoder/string>
#include <atcoder/twosat>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using namespace internal;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (int)(n);i++)
ll mod = 1000000007;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(m);
	rep(i, n) cin >> a[i];
	rep(j, m) cin >> b[j];
	vector<int> ans(n + m - 1);
	ans = convolution(a, b);
	rep(i, n + m - 1) cout << ans[i] << " ";
}

Measured memory_bytes: 21696
#include<stdio.h>
#include <string.h>
int main(){
  int len;
  char S[26];
  scanf("%s",S);
  len=strlen(S);
  int i,j;
  for(i=0;i<len;i++){
    for(j=i+1;j<len;j++){
      if(S[i]==S[j]){
        printf("no");
        j=len+1;i=len+1;
      }
    }
  }
  if(i==len){
    printf("yes");
  }
  return 0;
}


Measured memory_bytes: 128
N = int(input())
A = [int(input()) for _ in range(N)]
L = [0] * N
L[0] = A[0]
for i in range(1, N):
    L[i] = min(L[i - 1], A[i])
R = [0] * N
R[-1] = A[-1]
for i in range(N - 2, -1, -1):
    R[i] = max(R[i + 1], A[i])
ans = R[-1] - L[0]
for i in range(N - 1):
    ans = max(ans, R[i + 1] - L[i])
print(ans)



Measured memory_bytes: 16528
#include<stdio.h>

#define MAX 5000000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int A[MAX];
//int mid;
int cnt;

void merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++) L[i]=A[left+i];
  for(i=0;i<n2;i++) R[i]=A[mid+i];
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }
    else {
      A[k]=R[j];
      j++;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  //printf("%d %d\n",left,right);
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int main(){
  int n,i;
  cnt=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
 

  //for(i=0;i<n;i++) printf("%d ",A[i]); 
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }

  printf("\n%d\n",cnt);
  return 0;
}

Measured memory_bytes: 9776
#include<bits/stdc++.h>
#define inf 1000000000
#define ll long long
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    if(n%2==0)
        printf("%lf",0.5);
    else
        printf("%lf",(n/2+1)/(double)(n));
    return 0;
}


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

using namespace std;

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

  string a;
  cin >> a;
  for (int i = 0; i < 4; ++i) {
    a[i] -= '0';
  }
  for (int i = 0; i < 8; ++i) {
    int p = i;
    int sum = a[0];
    for (int j = 1; j < 4; ++j) {
      if (p & 1) {
        sum -= a[j];
      } else {
        sum += a[j];
      }
      p >>= 1;
    }
    if (sum == 7) {
      int p = i<<1;
      for (int j = 0; j < 4; ++j) {
        if (0 < j)
          cout << ((p & 1) ? "-" : "+");
        cout << int(a[j]);
        p >>= 1;
      }
      cout << "=7\n";
      return 0;
    }
  }
  cout << "not found\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int N;
	cin >> N;
	println((N%2==0)?N:2*N);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int N;
  cin >>N;
 vector<int> vec(N);
  
  rep(i,N) {
    cin >>vec.at(i);
  }
  sort(all(vec));
  double x=vec.at(0);
  repl(i,1,N) {
    x +=vec.at(i);
    x=(double)x/(double)2;
  }
  CST(7);
  
  cout<<x<<endl;
}
    
  


Measured memory_bytes: 256
h, w = map(int, raw_input().split())
a = [raw_input().strip() for _ in xrange(h)]
t = '.#'
k = 0
for i in xrange(h):
    c = ['#'] + ['#' if a[i][j] == '#' else t[k] for j in xrange(1, w - 1)] + ['.']
    print ''.join(c)
    k = 1 - k
print
k = 1
for i in xrange(h):
    c = ['.'] + ['#' if a[i][j] == '#' else t[k] for j in xrange(1, w - 1)] + ['#']
    print ''.join(c)
    k = 1 - k


Measured memory_bytes: 3460
#include<bits/stdc++.h>
using namespace std;
int main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
double d,t,s;cin>>d>>t>>s;
if(double(double(d)/double(s))<=t)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
return 0;}


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

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

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string a, b, c;
	cin >> a >> b >> c;
	cout << char(toupper(a[0])) << char(toupper(b[0])) <<char(toupper(c[0])) << endl;
	return 0;
}


Measured memory_bytes: 256
X = int(input())

if 400 <= X < 600:
    print("8")
elif X < 800:
    print("7")
elif X < 1000:
    print("6")
elif X < 1200:
    print("5")
elif X < 1400:
    print("4")
elif X < 1600:
    print("3")
elif X < 1800:
    print("2")
elif X < 2000:
    print("1")


Measured memory_bytes: 9176
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll x=in(),y=in(),z=in();
    cout<<z<<' '<<x<<' '<<y<<endl;
}



Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>a>>b>>c;
    if(a<=c&&c<=b) Yes;
    else No;

    return 0;
}


Measured memory_bytes: 3528
S=input()
s=[str(c) for c in(S)]
size=0
a=[]
for i in (s):
  if i=='1' or i=='0':
    a.append(i)
    size+=1
  else:
    if size!=0:
      a.pop(size-1)
      size-=1
for j in range(size):
  print(a[j],end="")

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

INF = float('inf')

N, u, v = map(int, input().split())
u, v = u-1, v-1
adjL = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    adjL[a].append(b)
    adjL[b].append(a)

def bfsMinCosts(adjList, vSt, INF):
    numV = len(adjList)
    costs = [INF] * numV
    costs[vSt] = cost = 0
    vs = [vSt]
    while vs:
        cost += 1
        v2s = []
        for v in vs:
            for v2 in adjList[v]:
                if costs[v2] == INF:
                    costs[v2] = cost
                    v2s.append(v2)
        vs = v2s
    return costs

costUs = bfsMinCosts(adjL, u, INF)
costVs = bfsMinCosts(adjL, v, INF)

ans = 0
for x in range(N):
    if costUs[x] < costVs[x]:
        if costVs[x] > ans:
            ans = costVs[x]

print(ans-1)


Measured memory_bytes: 31496
n = int(input())
c = input().split()
c = [int(n) for n in c]

s = dict.fromkeys([int(n) for n in range(1,n+1)], 0)

for i in c:
    s[i] = s[i] + 1

for i in range(1, n+1):
    print(s[i])


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

void solve()
{
  int n;
  cin >> n;
  string a;
  cin >> a;
  int red_num[200001];
    red_num[0]=(a[0]=='R'?1:0);
    for (int c=1;c<a.size();c++)
        if (a[c]=='R')
            red_num[c]=red_num[c-1]+1;
        else red_num[c]=red_num[c-1];
        
        int mini=red_num[n-1];
  for (int c=1;c<=n;c++)
    {
        int ans=0;
        if (c<=red_num[n-1])
            {
                ans+=red_num[n-1]-c+(c-red_num[c-1]);
            }
        else
        {
            ans+=c-red_num[n-1]+(c-(red_num[c-1]+c-red_num[n-1]));
        }
        
        mini=min(mini,ans);
    }
    cout << mini << endl;
}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);     
    int t;
    //cin >> t;
    t=1;
    for (int tt=0;tt<t;tt++)
        {
            solve();
        }    
        return 0;
}

Measured memory_bytes: 4556
#include <stdio.h>

struct dice {
    int nums[7];  // ラベルに対応する数値
};

int main()
{
    struct dice dice;
    char order[101];

    scanf("%d %d %d %d %d %d\n", &dice.nums[1], &dice.nums[2], &dice.nums[3], &dice.nums[4], &dice.nums[5], &dice.nums[6]);
    scanf("%s\n", order);    

    for (int i = 0; order[i] != '\0'; i++) {
        dice.nums[0] = dice.nums[1];

        switch (order[i]) { // ダイスの値をずらす
            case 'S':
                dice.nums[1] = dice.nums[5];
                dice.nums[5] = dice.nums[6];
                dice.nums[6] = dice.nums[2];
                dice.nums[2] = dice.nums[0];
                break;
            case 'E':
                dice.nums[1] = dice.nums[4];
                dice.nums[4] = dice.nums[6];
                dice.nums[6] = dice.nums[3];
                dice.nums[3] = dice.nums[0];
                break;
            case 'W':
                dice.nums[1] = dice.nums[3];
                dice.nums[3] = dice.nums[6];
                dice.nums[6] = dice.nums[4];
                dice.nums[4] = dice.nums[0];
                break;
            case 'N':
                dice.nums[1] = dice.nums[2];
                dice.nums[2] = dice.nums[6];
                dice.nums[6] = dice.nums[5];
                dice.nums[5] = dice.nums[0];
                break;
            default:
                break;
        }
    }

    printf("%d\n", dice.nums[1]);

    return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <math.h>
#include <set>
#include <map>
#include <stdio.h>
#include <queue>
#include <iomanip>
#include <cstring>
#include <stack>
#include <chrono>
#include <unordered_map>
#include <stdlib.h>
#include <ctime>
using namespace std;
typedef long long ll;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define fi first
#define se second
#define pll pair<ll,ll>
#define forn(i,e) for(ll i = 1; i<=e; i++)
#define forsn(i,s,e) for(ll i = s; i<=e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
// freopen("input.txt","r", stdin);
// freopen("out.txt","w", stdout);
// auto start = chrono::high_resolution_clock::now();
// auto end = chrono::high_resolution_clock::now();
// double time_taken =chrono::duration_cast<chrono::nanoseconds>(end - start).count();
// time_taken *= 1e-9;
// cout << "Time taken by program is : " << fixed << time_taken << setprecision(9);
// cout << " sec" << endl;
int main()
{
    ll x;
    cin>>x;
    if(x>=30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int flag=0;
    for(int i=1;i<=1250;i++)
    {
        int x=i*0.08;
        int y=i*0.1;
        if(x==a&&y==b)
        {
            cout<<i;
            flag++;
            break;
        }
    }
    if(flag==0)
        cout<<"-1";
    return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
def func(x,y):
    for i in range(x+1):
        for j in range(x+1):
            if i+j==x:
                if i*2 + j*4 == y:
                    print('Yes')
                    return
    print('No')
    return
func(x,y)

Measured memory_bytes: 9120
n,m,c=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n+1)]
count=0
for i in range(n):
  sum=c
  for j in range(m):
    sum+=a[i+1][j]*a[0][j]
  if sum>0:
    count+=1
print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back

#define N 101
#define M 1000100
#define MOD 1000000007

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

	int n, w;
	cin >> n >> w;

	pair<int, int> wv[n];

	for (int i = 0; i < n; ++i)
	{
		cin >> wv[i].ff >> wv[i].ss;
	}

	ll dp[2][w + 4];
	memset(dp, 0, sizeof(dp));
	for(int i = wv[0].ff; i <= w; ++i)
		dp[0][i] = wv[0].ss;

	// for (int i = 0; i <= w; ++i)
	// {
	// 	cout << dp[0][i] << " \n"[i == w];
	// }

	for(int i = 1; i < n; ++i)
	{
		int l = i & 1;
		for(int j = 0; j <= w; ++j)
		{
			dp[l][j] = max(dp[!l][j], (j > wv[i].ff ? wv[i].ss + dp[!l][j - wv[i].ff] : 0));
			// cout << dp[i][j] << " ";
		}
		// cout << "\n";
	}

	cout << dp[(n + 1) & 1][w];
	return 0;
}

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

int main () {
    int N,D;
    cin >> N >> D ;
    vector<vector<int>> data(N,vector<int>(D));
    for(int i=0;i<N;i++){
        for(int j=0;j<D;j++) {
            cin >> data[i][j];
        }
    }
    int count=0,k;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++) {
            int norm=0;
            for(k=0;k<D;k++){
                int dif=abs(data[i][k]-data[j][k]);
                norm+=dif*dif;
            }
            bool flag=false;
            for (int k=0;k<=norm;k++){
                if(k*k==norm) flag=true;
            }
            if(flag) count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 764
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAXN 300001
#define LL long long
using namespace std;
int a[MAXN+10],s[MAXN+10],cnt[MAXN+10];
int val[MAXN+10];
int n;
bool check(int x,int y)
{
    return val[x]<=(n-y*(LL)x);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",a+i);
        cnt[a[i]]++;
    }
    sort(cnt+1,cnt+MAXN);
    for(int i=MAXN-1;i>=0;i--)s[i]=s[i+1]+cnt[i];
    for(int i=n,j=MAXN-1;i>=0;i--)
    {
        while(cnt[j]>i)j--;
        val[i]=s[j+1]-i*(MAXN-1-j);
    }
    
    for(int i=1;i<=n;i++)
    {
        int L=0,R=n;
        while(L!=R)
        {
            int mid=(L+R+1)/2;
            if(check(mid,i))
            {
                L=mid;
            }
            else
            {
                R=mid-1;
            }
        }
        printf("%d\n",L);
    }
    
    
    return 0;
}


Measured memory_bytes: 5504
# coding: utf-8

n, m, c = map(int, input().split())
total = 0
count = 0
b_point = input().split()
b_table = [int(k) for k in b_point]
for i in range(n):
    total = 0
    a_point = input().split(" ")
    a_table = [int(m) for m in a_point]
    for j in range(m):
        total += b_table[j] * a_table[j]
        if j == m - 1:
            total += c
            if total > 0:
                count += 1
print(count)


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

int main() {
    long N;
    cin>>N;
    vector<long> A(N),B(N),C(N);
    for(int i=0;i<N;i++) cin>>A.at(i);
    for(int i=0;i<N;i++) cin>>B.at(i);
    for(int i=0;i<N;i++) cin>>C.at(i);
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    
    long ans=0,a=0,c=0;
    for(int b=0;b<N;b++){
        while(a<N && A.at(a)<B.at(b)) a++;
        while(c<N && C.at(c)<=B.at(b)) c++;
        
        ans+=a*(N-c);
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 2688
#include <iostream>
#include <vector>

uint32_t partition(std::vector<uint32_t>& A, uint32_t start, uint32_t end) {
  uint32_t pivot = end - 1, insert = start;
  for (size_t i = 0; i < end; i++) {
    if (A[i] <= A[pivot]) {
      std::swap(A[insert], A[i]);
      insert++;
    }
  }

  return insert - 1;
}

int main() {
  uint32_t n = 0;
  std::cin >> n;
  std::vector<uint32_t> A(n);
  for (auto&& a : A) std::cin >> a;

  uint32_t base = partition(A, 0, A.size());

  for (size_t i = 0; i < n; i++) {
    std::cout << (i == base ? "[" : "") << A[i] << (i == base ? "]" : "")
              << (i == n - 1 ? "" : " ");
  }
  std::cout << std::endl;

  return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner();
			int a = cin.Int();
			int b = cin.Int();
			int x = cin.Int();

			double vh = (double)a * a * b / 2;
			if (x <= vh) {
				double c = ((double)2 * x) / (a * b);
				double theta_degC = Math.Atan(c / b) * 360 / (2 * Math.PI);
				double ans = 90 - theta_degC;
				Console.WriteLine(ans);
			} else {
				double y = (a * a * b) - x;
				double d = ((double)2 * y) / (a * a);
				double theta_degC = Math.Atan(a / d) * 360 / (2 * Math.PI);
				double ans = 90 - theta_degC;
				Console.WriteLine(ans);
			}
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 11220