akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
//#include <numeric> //iota
//#include <sstream>
#include <cstring>
//#include <tuple>
//#include <random>
//#include <string>
//#include <unordered_set>
//#include <bitset>
//#include <unordered_map>
//#include <stack>
#include <cmath>
//#include <deque>
#include <queue>
//#include <list>
#include <array>
using namespace std;
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define vec vector
#define pb push_back
#define pp pop_back
#define fi first
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define se second
#define un_map unordered_map
#define rep(i,a,n) for (int i = a; i < n; ++i) 
#define inc_rep(i,a,n,inc) for (int i = a; i < n; i += inc) 
#define couts(x) cout << x << "\n" 
#define watch(x) cout << #x << " : " << x << endl;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<long long, long long>  PLII;
template<typename T>
void print(vector<T>& v) {rep(i, 0, (int)v.size()) cout << v[i] << " ";cout << endl;}
int nxt() {int x;cin >> x;return x;}
ll nxtl() {ll x;cin >> x;return x;}
string nxts() {string x;cin >> x;return x;}
double nxtd() {double x; cin >> x; return x;}

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int main() {
	IOS;
	double d, s, t;
	cin >> d >> s >> t;
	double T = d/s;
	if (t >= T) {
		cout << "Yes";
	}else {
		cout << "No";
	}
}















	



Measured memory_bytes: 3796
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stdlib.h>
#include<utility>
#include<unordered_map>
using namespace std;
#define ll long long
#define pb push_back
#define PI acos(-1)
#define INF 0x3f3f3f3f
inline int re()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*f;
}
/*int a[22];
int vis[22];
int n,m;

void print(int num)
{
    for(int i=1;i<=m;i++)
    {
        if(vis[i]==1){
            num--;
            printf("%d",a[i]);
            if(num==0) puts("");
            else printf("+");
        }
    }
}
void dfs(int pos,int sum,int num)
{
    if(sum>n) return;
    if(sum==n)
    {
        print(num);
        return;
    }
    if(pos==m+1) return;
    vis[pos]=1;
    dfs(pos+1,sum+a[pos],num+1);
    vis[pos]=0;
    dfs(pos+1,sum,num);
}



int main()
{
    while(1)
    {
        cin>>n>>m;
        if(n==0&&m==0) break;
        for(int i=1;i<=m;i++)
        {
            cin>>a[i];
        }
        dfs(1,0,0);
    }
}

*/
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<' '<<b<<' '<<c;
}


Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, p = map(int, input().strip().split())
  s = input().strip()
  ans = 0
  if 10 % p == 0:
    for r in range(n):
      if int(s[r]) % p == 0:
        ans += r+1
    print(ans)
    return
  
  remains = [0] * (n+1)
  counts = [0] * p
  counts[0] += 1
  x = 1
  for r in range(n):
    remain = (int(s[-(r+1)]) * x) % p
    remains[-(r+1)] = (remains[-r] + remain) % p
    counts[remains[-(r+1)]] += 1
    x = (x * 10) % p
  for count in counts:
    ans += (count * (count - 1)) // 2
  print(ans)

if __name__=='__main__':
  main()



Measured memory_bytes: 11048
n = int(input())
a = [int(x) for x in input().split()]

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

ans = "APPROVED"
for a_eveni in a_even:
    if a_eveni%3 != 0 and a_eveni%5 != 0:
        ans = "DENIED"
        break

print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, b) for (ll i = 0; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;
string umeru(int x)
{
    string res;
    rep(i, 6 - to_string(x).length())
        res += "0";
    return res + to_string(x);
}
int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<int> p(m), y(m);
    rep(i, m) cin >> p[i] >> y[i];
    vector<int> ken(m), shi(m);
    map<int, set<pair<int, int>>> mp;
    rep(i, m)
    {
        ken[i] = p[i];
        mp[p[i]].insert({y[i], i});
    }
    for (auto i : mp)
    {
        int cta = 1;
        for (auto j : i.second)
            shi[j.second] = cta++;
    }
    rep(i, m) cout << umeru(ken[i]) << umeru(shi[i]) << endl;
}

Measured memory_bytes: 18656
import java.util.*;

class Main{
	public static void main(String[] args){
	  Scanner scn = new Scanner(System.in);
      int n = scn.nextInt() % 10;
      if(n == 3){
        System.out.println("bon");
        return;
      }else if(n ==0){
        System.out.println("pon");
        return;
      }else if(n ==1){
        System.out.println("pon");
        return;
      }else if(n ==6){
        System.out.println("pon");
        return;
      }else if(n ==8){
        System.out.println("pon");
        return;
      }else{
        System.out.println("hon");
      }
	}
}


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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  int64_t b = 1;
  int64_t total = 0;
  int64_t G = 1000000007;
  rep(i,61){
    int64_t cnt = 0;
    rep(j,n){
      cnt += ((a.at(j) & b) >> i);
    }
    //cout << cnt << endl;
    //cout << b << endl;
    //cout << b*(n-cnt)*cnt << endl;
    total = (total + (((b%G)*(n-cnt))%G)*cnt)%G;
    b = b << 1;
  }
  cout << total << endl;
      
    
    
  
}

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

int main()
{
    string s;
    cin >> s;
    string keyence = "keyence";

    if (s == keyence){
        puts("YES");
        return 0;
    }

    ll n = s.size();
    rep(i, n){
        rep(j, n){
            string tmp;
            rep(k, n){
                if (i <= k && k <= j){
                    continue;
                }
                tmp.push_back(s[k]);
            }
            if (tmp == keyence){
                puts("YES");
                return 0;
            }
        }
    }

    puts("NO");
    return 0;
}


Measured memory_bytes: 3628
N=int(input())
A=list(map(int,input().split()))
cost=[]
tmp=0
for i in A:
    cost.append(abs(i-tmp))
    tmp=i
cost.append(abs(A[-1]))
sm=sum(cost)
A.append(0)
for i in range(N):
    print(sm-cost[i]-cost[i+1]+abs(A[i-1]-A[i+1]))

Measured memory_bytes: 14048
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <cmath>
using namespace std;
typedef long long int ll;
int main() {
	ll N, T, Q;
	cin >> N >> T >> Q;
	vector<ll> pos(N), direction(N), person(Q), ans(Q);
	for (int i = 0; i < N; i++) cin >> pos[i] >> direction[i];
	for (int i = 0; i < Q; i++) {
		cin >> person[i];
		person[i]--;
	}

	
	for (int i = 0; i < Q; i++) {
		ll pair_point = 0;
		if (direction[person[i]] == 1) {
			int pair = -1;

			for (int j = person[i] + 1; j < N; j++) {
				if (direction[j] == 2) {
					pair = j;
					break;
				}
			}

			if (pair == -1) {
				ans[i] = pos[person[i]] + T;
				continue;
			}

			pair_point = (pos[pair] + pos[pair - 1]) / 2;
			if (abs(pair_point - pos[person[i]]) < T) ans[i] = pair_point;
			else ans[i] = pos[person[i]] + T;
		}
		else {
			int pair = -1;
			for (int j = person[i] - 1; j >= 0; j--) {
				if (direction[j] == 1) {
					pair = j;
					break;
				}
			}
			if (pair == -1) {
				ans[i] = pos[person[i]] + -T;
				continue;
			}

			pair_point = (pos[pair] + pos[pair + 1]) / 2;
			if (abs(pair_point - pos[person[i]]) < T) ans[i] = pair_point;
			else ans[i] = pos[person[i]] + -T;
		}
	}
	for (int i = 0; i < Q; i++)cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 4380
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include<unordered_map>
#include <cassert>
#include <string>
#include <cstring>
#include<stack>
#include<list>
#include<queue>
using namespace std;
typedef long long int ll;
# define INF 0x3f3f3f3f
long long dp[3000][3000];
long long findVal(ll* arr, int st, int en, int n)
{
	if(st>en)
	{
		return 0;
	}
	if(dp[st][en]!=0) return dp[st][en];
	int moves = n-(en-st);
	if(moves%2==1)
	{
		dp[st][en] = max(findVal(arr,st+1,en,n)+arr[st],findVal(arr,st,en-1,n)+arr[en]);
	}else
	{
		dp[st][en] = min(findVal(arr,st+1,en,n)-arr[st],findVal(arr,st,en-1,n)-arr[en]);
	}
	return dp[st][en];
}
int main()
{
	memset(dp,0,sizeof(dp[0][0]*3000*3000));
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	ll* arr = new ll[n]();
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	cout<<findVal(arr,0,n-1,n)<<endl;
}

Measured memory_bytes: 70272
#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
  int n,m,l;
  cin >> n >> m >> l;
  vector<vector<int> > A(n,vector<int>(m,0));
  vector<vector<int> > B(m,vector<int>(l,0));
  for(int i=0; i<n; i++) for(int j=0; j<m; j++) cin >> A[i][j];
  for(int j=0; j<m; j++) for(int k=0; k<l; k++) cin >> B[j][k];
  for(int i=0; i<n; i++){
    for(int k=0; k<l; k++){
      long long sum = 0;
      for(int j=0; j<m; j++) sum += A[i][j] * B[j][k];
      if(k != 0) cout << " ";
      cout << sum;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1296
def ispalindrome(s, b, e):
    i = b; j = e
    while i < j :
        if s[i] != s[j] :
            return False
        i += 1
        j -= 1
    return True
    
    
s = input()
n = len(s)
if ispalindrome(s,0,(n-3)//2) and ispalindrome(s,0,n-1) :
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> pll;
const lli inf = 1e18;

int main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 
// ========================================================
signed main(){
  #ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  #endif
  fio;
    string s;
    cin>>s;

    int rcnt = 0,mx = 0;
    for(auto x : s){
        if(x == 'S'){
            if(rcnt > 0){
                mx = max(rcnt,mx);
                rcnt = 0;
            }
        }
        else{
            rcnt++;
        }
    }
    mx = max(rcnt,mx);
    cout<<mx<<endl;
  rr;
}



Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static final int N = 100;
    static int n, c;
    static int[][] Mat = new int[N][N];
    static int[] dp = new int[N];
    static int[] visited = new int[N];
    static int[] done = new int[N];

    static final int NOT_FOUND_YET = 0;
    static final int VISITED = 1;
    static final int DONE = 2;

    public static void main(String[] args) {
        read();
        for (int i = 0; i < n; i++) {
            dfs(i);
        }
        out();
    }

    static void read() {
        n = sc.nextInt();
        int u, k, v;
        for (int i = 0; i < n; i++) {
            u = sc.nextInt();
            k = sc.nextInt();
            for (int j = 0; j < k; j++) {
                v = sc.nextInt();
                Mat[u - 1][v - 1] = 1;
            }
        }
    }

    static void out() {
        for (int i = 0; i < n; i++) {
            System.out.println(String.format("%d %d %d", i + 1, visited[i], done[i]));
        }
    }

    static void dfs(int i) {
        if (dp[i] != NOT_FOUND_YET) {
            return;
        }

        c++;
        dp[i] = VISITED;
        visited[i] = c;

        for (int j = 0; j < n; j++) {
            if (Mat[i][j] == 1) {
                dfs(j);
            }
        }

        c++;
        dp[i] = DONE;
        done[i] = c;
    }
}

Measured memory_bytes: 29668
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 300005
#define endl "\n"
#define mod 1000000007
ll n,k,ar[N],dp[N];
ll minval(ll i){
	if(i==n){
		return 0;
	}
	if(dp[i]!=-1){
		return dp[i];
	}

	ll j,mn=1e18;
	for(j=1;j<=k&&i+j<=n;j++){
		mn=min(mn,minval(i+j)+abs(ar[i+j]-ar[i]));
	}
	return dp[i]=mn;
}
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,l;
	cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}
	
	l=minval(1);
	cout<<l;
	return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
	int len = s.size();
	int ans = 0;
	for(int i = 0; i < len / 2; i++){
		ans += s[i] != s[len - i - 1];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String string = sc.next();
		int ans = 0;
		char p = string.charAt(0);
		for(int i = 1;i < string.length();i++){
			if(p != string.charAt(i)){
				ans++;
				p = string.charAt(i);
			}
		}
		System.out.println(ans);
		
				
	}
}

Measured memory_bytes: 24788
#include <stdio.h>
int min(int x, int y){return x<y?x:y;}
int main(void){
	int a,b,c,ans;
	scanf("%d%d%d",&a,&b,&c);
	ans = min(a+b,a+c);
	ans = min(ans,b+c);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
N,K = map(int,input().split())
tmp = K/N
q = 1
p = 2 ** 20
while p/q >2:
    qp = q*2
    if qp > tmp:
        p = qp
    else:
        q = qp
res = 0
for i in range(N,0,-1):
    ans = i*q
    if ans < K:
        q*=2
    res+= float(1)/q
print(res/N)

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	char c;
	cin>>c;
	c+=1;

	if(c<='z')
	{	
		cout<<c<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
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; }
 
// 階乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
//int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


 

 
int main() {
    int A, B, M;
    cin >> A >> B >> M;
    vector<int>a(A);
  	REP(i, A) cin >> a.at(i);
    vector<int>b(B);
    	REP(i, B) cin >> b.at(i);
    int ans = INF;
    REP(i, M){
        int x, y, c;
        cin >> x >> y >> c;
        x--;
        y--;
        chmin(ans, a.at(x) + b.at(y) - c);
    }
    sort(all(a));
    sort(all(b));
    chmin(ans, a.at(0) + b.at(0));
    print(ans);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

vector<vector<int>> g;
map<pair<int, int>, int> mp;
int k = -1;
void dfs(int now, int pre) {
    int color = 1;
    int ng = -1;
    if (pre >= 0) ng = mp[make_pair(min(now, pre), max(now, pre))];
    for (int nxt : g[now]) {
        if (nxt == pre) continue;
        if (color == ng) color++;
        mp[make_pair(min(now, nxt), max(now, nxt))] = color;
        // cout << min(now, nxt) << " " << max(now, nxt) << " " << color <<
        // endl;
        chmax(k, color);
        color++;
        dfs(nxt, now);
    }
}
int main() {
    int n;
    cin >> n;
    g.resize(n);
    vector<pair<int, int>> edges(n - 1);
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        edges[i]=make_pair(a, b);
    }
    dfs(0, -1);
    cout << k << endl;
    rep(i, n - 1) cout << mp[edges[i]] << endl;
}

Measured memory_bytes: 14976
import math
a,b,h,m = map(int,input().split())

y = (a * math.sin(math.radians(360 * (h + m/60) / 12))) - (b * math.sin(math.radians(360 * m / 60)))
x = (a * math.cos(math.radians(360 * (h + m/60) / 12))) - (b * math.cos(math.radians(360 * m / 60)))
ans = math.sqrt(x**2+y**2)
print(ans)

Measured memory_bytes: 9404
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using i64 = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const i64 INFL = (1LL << 62);
const i64 MOD = 1000000007;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
i64 mod_pow(i64 a, i64 n, T mod) {
  mod = (i64)mod;
  i64 res = 1, p = a % mod;
  while (n) {
    if (n & 1) res = res * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return res;
}
void print() { std::cout << std::endl; }
template <typename T, typename... A>
void print(const T& first, const A&... rest) {
  cout << sizeof...(rest) << endl;
  std::cout << first;
  if (sizeof...(rest)) std::cout << " ";
  print(rest...);
}
template <typename... A>
void print(const A&... rest) {
  print(rest...);
}
template <typename A>
void print(const std::vector<A>& v) {
  std::for_each(v.begin(), v.end(), [](A x) { std::cout << x << " "; });
  std::cout << std::endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  string even;
  cout << 0 << endl;
  cin >> s;
  if (s == "Vacant") {
    return 0;
  } else {
    even = s;
  }
  int left = -1, right = n;
  while (abs(right - left) > 1) {
    int mid = (right + left) / 2;
    cout << mid << endl;
    cin >> s;
    if (s == "Vacant") {
      return 0;
    } else if ((!(mid & 1) && s == even) || ((mid & 1) && s != even)) {
      left = mid;
    } else {
      right = mid;
    }
  }

  return 0;
}

Measured memory_bytes: 852
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <unordered_set>
#include <unordered_map>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/multi_array.hpp>

using namespace std;

#if 0
// memo
abs()

start_with(str, "hoge");
ends_with(str, "hoge");

std::sort(d.begin(), d.end());
d.erase(std::unique(d.begin(), d.end()), d.end());
#endif

using namespace boost;
using namespace boost::algorithm;


void dfs(const boost::multi_array<bool, 2>& mat,
         int u, int N, int& count,
         std::bitset<8>& not_visited)
{
    if (not_visited.none()) {
        ++count;
        return;
    }
    for (size_t v = 0; v < N; ++v) {
        if (mat[u][v]) {
            if (!not_visited[v]) {
                continue;
            }
            not_visited[v] = false;
            dfs(mat, v, N, count, not_visited);
            not_visited[v] = true;
        }
    }
}


int main()
{
    int N, M;

    std::cin >> N >> M;

    boost::multi_array<bool, 2> mat(boost::extents[N][N]);

    for (size_t i = 0; i < M; ++i) {
        int a, b;
        std::cin >> a >> b;
        --a;
        --b;
        mat[a][b] = mat[b][a] = true;
    }

    int count = 0;
    std::bitset<8> not_visited;
    for (size_t i = 0; i < N; ++i) {
        not_visited[i] = true;
    }
    not_visited[0] = false;
    dfs(mat, 0, N, count, not_visited);

    std::cout << count << endl;

    return 0;
}


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

#define max 100

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    int n, m, a[max], i, sum=0, cnt=0;
    double j;
    
    scanf("%d %d", &n, &m);
    for (i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    
    for (i=0; i<n; i++) {
        sum=sum+a[i];
    }
    
    qsort(a, n, sizeof(int), down_comp);
    
    j=(double)sum/(4*m);
    
    for (i=0; i<n; i++) {
        if (a[i]>=j) {
            cnt++;
        } else {
            break;
        }
    }
    
    if (cnt>=m)
        printf("Yes");
     else
        printf("No");
    
    return 0;
}




Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <climits>
#include <cstdlib>
using namespace std;
long int cnt;
void insertionSort(vector<long int> &vec,long int n,long int g)
{
    for(long int i = g;i < n;i++)
    {
        long int v = vec.at(i);
        long int j = i - g;
        while(j >= 0 && vec.at(j) > v)
        {
            vec.at(j + g) = vec.at(j);
            j = j - g;
            cnt++;
        }
        vec.at(j + g) = v;
    }
}
int main()
{
    long int n;
    cin >> n;
    vector<long int> v;
    for(long int i = 0;i < n;i++)
    {
        long int t;
        cin >> t;
        v.push_back(t);
    }
    cnt = 0;
    int m = 13;
    long int g[13] = {797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1};
    int ind = 0;
    for(int i = 0;i < 13;i++)
    {
        if(n >= g[i])
        {
            ind = i;
            break;
        }
    }
    cout << 13 - ind << endl;
    for(int i = ind;i < 13;i++)
    {
        cout << g[i];
        if(i + 1 != 13)
        {
            cout << " ";
        }
        else
        {
            cout << endl;
        }
    }
    for(int i = ind;i < m;i++)
    {
        insertionSort(v,n,g[i]);
    }
    cout << cnt << endl;
    for(long int i  = 0;i < n;i++)
    {
        cout << v.at(i) << endl;
    }
}

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

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

  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(i) cout << " ";
    cout << a[i];
  }
  cout << endl;

  for(int i = 1; i < n; i++){
    int v = a[i];
    int j = i-1;

    while(j>=0 && a[j]>v){
      a[j+1] = a[j];
      j--;
      a[j+1] = v;
    }

      for(int k = 0; k < n; k++){
	if(k) cout << " ";
	cout << a[k];
      }
      cout << endl;

  }

  return 0;

}



Measured memory_bytes: 3072
#include <cstdio>

const int N = 100001;

int cnt[N], has[N];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    has[1] = true;
    for (int i = 1; i <= n; ++ i) {
        cnt[i] = 1;
    }
    while (m --) {
        int x, y;
        scanf("%d%d", &x, &y);
        if (has[x]) {
            if (cnt[x] == 1) {
                has[x] = false;
                has[y] = true;
            } else {
                has[y] = true;
            }
        }
        cnt[x] --;
        cnt[y] ++;
    }
    int res = 0;
    for (int i = 1; i <= n; ++ i) {
        res += has[i];
    }
    printf("%d\n", res);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
const int mod = 1000000007;

void Main(){
  int n;
  int m;
  cin>>n>>m;
  vi s(m);
  vi c(m);
  rep(i,m) cin>>s[i]>>c[i];
  vi ans(n,-1);
  rep(i,m){
    if(s[i]>n){
      cout<<-1<<endl;
      return;
    }
    if(ans[s[i]-1]==-1){
      ans[s[i]-1]=c[i];
    }else{
      if(ans[s[i]-1]!=c[i]){
        cout<<-1<<endl;
        return;
      }
    }
  }
  rep(i,n){
    if(n>1 and i==0 and ans[i]==-1){
      ans[i]=1;
    }else{
      if(ans[i]==-1){
        ans[i]=0;
      }
    }
  }

  if(n>1 and ans[0]==0){
    cout<<-1<<endl;
    return;
  }

  rep(i,n){
    cout<<ans[i];
  }
  cout<<endl;

} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    cin>>n;
    for(int i=0;i<n.length();i++){
        if(n[i]=='1') cout<<9;
        else if(n[i]=='9') cout<<1;
        else cout<<n[i];
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <unordered_map>
#define maxn 100005
#define mod 998244353
using namespace std;
typedef long long LL;
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    printf("%d",n*(n-1)/2+m*(m-1)/2);
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
char l[200001];
ll add(ll a, ll b){return (a+b)%mod;}
ll dp[200001][2][3];
int main(void){
    cin >> l;
    int len=strlen(l);
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            if(((i^j))!=(i+j)%2) continue;
            int has=(i+j)/2;
            int exc;
            if((i^j)<(l[len-1]-'0')) exc=0;
            if((i^j)==(l[len-1]-'0')) exc=1;
            if((i^j)>(l[len-1]-'0'))  exc=2;
            dp[len-1][has][exc]++;
        }
    }
    for(int t=len-1;t>=1;t--){
        for(int a=0;a<2;a++){
            for(int b=0;b<3;b++){
                for(int i=0;i<2;i++){
                    for(int j=0;j<2;j++){
                        if(((i^j))!=(i+j+a)%2) continue;
                        int has=(i+j)/2;
                        int exc;
                        if((i^j)<(l[t-1]-'0')) exc=0;
                        if((i^j)==(l[t-1]-'0')) exc=b;
                        if((i^j)>(l[t-1]-'0'))  exc=2;
                        dp[t-1][has][exc]=add(dp[t-1][has][exc],dp[t][a][b]);
                    }
                }                
            }
        }
    }
    cout << add(dp[0][0][0],dp[0][0][1]) << endl;
}

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

using namespace std;



typedef long long ll;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	ll n,k;
  cin >> n >> k;

  ll a[n];
  ll sum=0;
  for(ll i=0; i<n;i++){
  		cin >> a[i];

}
sort(a,a+n);
for (ll i=0; i<n-k; i++){
  sum+=a[i];
}
cout<<sum<<endl;
}


Measured memory_bytes: 1792
import math

def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


x=int(input())
while True:
    if is_prime(x):
        print(x)
        break
    x+=1

Measured memory_bytes: 39024
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(0<=a&&a<=100&&0<=b&&b<=100&&0<=c&&c<=100){
if(a<b&&b<c)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';
#define mod 1000000007

using namespace std;

int main(void){
    ll N, K, count=0;
    cin>>N>>K;
    reps(i, K, N+2){
        count+=(i*((N+1-i)%mod)+1)%mod;
        count%=mod;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    int x,y;
    for(int i=0;i<3000;++i){
    cin >> x >> y;
    if(x>y)swap(x,y);
    if(x==0 && y==0) break;
    cout << x << " " << y << endl;
    }
    return 0;
}



Measured memory_bytes: 2984
#include <bits/stdc++.h>
using namespace std;
int ans[3003][3003];
int main(){
	string s, t;
	cin>>s>>t;
	int n = s.size();
	int m = t.size();
	for(int i = 0; i <= n; ++i){
		for(int j = 0; j <= m; ++j){
			if(i == 0 || j == 0){
				ans[i][j] = 0;
			}
			else if(s[i - 1] == t[j - 1]){
				ans[i][j] = ans[i - 1][j - 1] + 1;
			}
			else{
				ans[i][j] = max(ans[i - 1][j], ans[i][j - 1]);
			}
		}
	}
	int l = ans[n][m];
	vector<char> res(l);
	int i = n;
	int j = m;
	while(i > 0 && j > 0){
		if(s[i - 1] == t[j - 1]){
			res[l - 1] = s[i - 1];
			i--, j--, l--;
		}
		else if(ans[i - 1][j] > ans[i][j - 1])i--;
		else j--;
	}
	string Res = "";
	for(auto x : res)Res += x;
	cout<<Res<<endl;
	return 0;
}


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


int main(){
    int R;
    double cir;
    cin >> R;
    cir = 2*R*M_PI;
    printf("%.2f\n", cir);
}

Measured memory_bytes: 3760
<?php

function gcd($a, $b) {
    if ($b === 0) {
        return $a;
    }

    return gcd($b, $a % $b);
}

function lcm($a, $b) {
    return $a * $b / gcd($a, $b);
}

fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);

--$a;

// a以下でcで割り切れる数
$a_c = intdiv($a, $c);
// a以下でdで割り切れる数
$a_d = intdiv($a, $d);
// a以下でcでもdでも割り切れる数
$a_cd = intdiv($a, lcm($c, $d));
$x = (int) ($a - (int) ($a_c + $a_d - $a_cd));

// a以下でcで割り切れる数
$b_c = intdiv($b, $c);
// b以下でdで割り切れる数
$b_d = intdiv($b, $d);
// b以下でcでもdでも割り切れる数
$b_cd = intdiv($b, lcm($c, $d));
$y = (int) ($b - (int) ($b_c + $b_d - $b_cd));

echo (int) ($y - $x);


Measured memory_bytes: 16136
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
using namespace std;
//vector<int> Edge[30];
array<array<bool, 9>, 9> Edge;
// 行ったことがなければtrue
array<bool, 9> check;
//array<array<bool, 9>, 9> Edge;
int N, M;

int Func(int n, array<array<bool, 9>, 9> e, array<bool, 9> c){
    bool check0 = true;
    for(int i = 0; i < N; ++i){
        if(c[i]){
            check0 = false;
            break;
        }
    }
    if(check0) return 1;
    int res = 0;
    for(int i = 0; i < N; ++i){
        if(e[n][i] && c[i]){
            c[i] = false;
            e[n][i] = false;
            e[i][n] = false;
            res += Func(i, e, c);
            c[i] = true;
            e[n][i] = true;
            e[i][n] = false;
        }
    }
    return res;
}

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

    cin >> N >> M;

    for(int i = 0; i < M; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        Edge[a][b] = true;
        Edge[b][a] = true;
        /*
        Edge[a].push_back(b);
        Edge[b].push_back(a);*/
    }
    for(int i = 0; i < N; ++i){
        check[i] = true;
    }
    check[0] = false;
    cout << Func(0, Edge, check) << endl;

    return 0;
};

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


int main() {
	std::string s;

	std::cin >> s;

	if (s == "Sunny") {
		std::cout << "Cloudy";
	}
	else if (s == "Cloudy") {
		std::cout << "Rainy";
	}
	else {
		std::cout << "Sunny";
	}

	return 0;
}

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

 
int main(){
  long long int N,K;
  cin >> N >> K;
  vector<long long int> vec(N,0);


  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end(), greater<long long int>());

  long long int s = 0;
  for(long long int i=0;i<N;i++){
    if(i<K){
      vec.at(i) = 0;
    }
    s += vec.at(i);
  }

  cout << s << endl;

}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline

n=int(input())
s=input()

r=s.count('R')
g=s.count('G')
b=s.count('B')

ans=r*g*b

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>=n: break
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            ans-=1

print(ans)

Measured memory_bytes: 9208
num = input()
num = int(num)

#2の2乗から順番に見ていく
#入力を超えたらその時点の値をマックスとして保持
#更新していく
max = 1

for i in range(2,num):
    beki = 2
    cou = i**beki
    while i**beki <= num:
        beki += 1
    if max < i ** (beki-1):
        if beki > 2:
            max = i ** (beki-1)
print(max)

Measured memory_bytes: 3060
sx,sy,tx,ty=map(int,input().split())
for i in range(sy,ty):
    print('U',end='')
for i in range(sx,tx):
    print('R',end='')
for i in range(sy,ty):
    print('D',end='')
for i in range(sx,tx):
    print('L',end='')
print('L',end='')
for i in range(sy,ty+1):
    print('U',end='')
for i in range(sx,tx+1):
    print('R',end='')
print('D',end='')
print('R',end='')
for i in range(sy,ty+1):
    print('D',end='')
for i in range(sx,tx+1):
    print('L',end='')
print('U',end='')

Measured memory_bytes: 9212
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000009
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
#define top(i,j) val[i*m+j]
typedef long long lli;
typedef unsigned short int usi;

lli nPr(int n, int r) {
    int i;
    lli val=1;
    for(i=0; i<r; i++) {
        val = val*(n-i);
        val = val % MOD;
    }
    printf("nPr(%d,%d)=%d\n",n,r,val);
    return val;
}

lli nCr(int n, int r) {
    int i;
    lli val=1;
    r = MIN(r, n-r);
    for(i=0; i<r; i++) {
        val = val*(n-i)/(i+1);
    }
    val = val % MOD;
    printf("nCr(%d,%d)=%d\n",n,r,val);
    return val;
}

int main()
{
    int n, i, h[100];
    int count = 0;

    scanf("%d",&n);
    int gcnt=0;
    for(i=0; i<n; i++) {
        scanf("%d",h+i);
    }
    int l;
    int r;
    while(1) {
        for(l=0; l<n&&h[l]==0; l++);
        if(l==n)break;
        count++;
        for(r=l; r<n&&h[r]!=0; r++) {
            //printf("l=%d, r=%d, count=%d, h[r]=%d\n",l,r,count,h[r]);
            h[r]--;
        }
    }
    printf("%d",count);

    return 0;
}


Measured memory_bytes: 128
def main():
    N = int(input())
    a = list(map(int, input().split()))
    avg = sum(a) / N
    min_abs = float("inf")
    min_frame = 0
    for i in range(N):
        score = abs(a[i] - avg)
        if score < min_abs:
            min_abs = score
            min_frame = i
    print(min_frame)


if __name__ == "__main__":
    main()


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

int main()
{
    long long a,b,k;
    cin>>k>>a>>b;
    if(k<=a)
    {
        printf("1");
        return 0; 
    }
    else if(a<=b)
    {
        printf("-1");
        return 0;  
    }
    else 
    {
        printf("%lld\n",((k-a)/(a-b)+bool((k-a)%(a-b)))<<1|1);
    }
}

Measured memory_bytes: 256
import itertools
n = int(input())
lists = set(range(1, n+1))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
cnt = 0
for i in itertools.permutations(lists, n):
    cnt += 1
    if i == p:
        p_num = cnt
    if i == q:
        q_num = cnt
print(abs(p_num-q_num))


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int A[10][10000];
int cnt[10000];

signed main()
{
    omajinai;

    int R, C;
    while (cin >> R >> C, R || C) {
        rep(i, R) rep(j, C) {
            cin >> A[i][j];
        }

        int ma = 0;

        rep(i, 1 << R) {
            memset(cnt, 0, sizeof(cnt));

            rep(j, C) rep(k, R) {
                if (i & 1 << k) {
                    cnt[j] += A[k][j] ^ 1;
                } else {
                    cnt[j] += A[k][j];
                }
            }

            int t = 0;

            rep(j, C) {
                t += max(cnt[j], R - cnt[j]);
            }

            chmax(ma, t);
        }

        cout << ma << endl;
    }
}

Measured memory_bytes: 1632
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>

using namespace std;

int main() {
  int n;
  cin >> n;
  deque<long long> values(n);

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

  sort(values.begin(), values.end(), greater<long long>());

  queue<long long> seats;
  long long sum = 0;

  seats.push(values[0]);

  for (int i = 1; i < n; i++) {
    sum += seats.front();
    seats.pop();

    seats.push(values[i]);
    seats.push(values[i]);
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 6280
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair

//ユークリッドの互除法 O(log a)
int gcd(int a, int b){
	if(b > a) swap(a, b);
	int tmp;
	while(b != 0){
		tmp = a % b;
		a = b;
		b = tmp;
	}
	return a;
}

int N, A[100000], l[100000], r[100000];
int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];
	l[0] = 0;
	for(int i=1; i<N; i++) l[i] = gcd(l[i-1], A[i-1]);
	r[N-1] = 0;
	for(int i=N-2; i>=0; i--) r[i] = gcd(r[i+1], A[i+1]);
	int ans = 0;
	for(int i=0; i<N; i++) ans = max(ans, gcd(l[i], r[i]));
	cout << ans << endl;
}

Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std;


int main(){
	int N, T, A, H[1000], ans;
	double min = 10000;
	cin >> N >> T >> A;

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

	for (int i = 0; i < N; ++i){
		double tmp = fabs(A - (T - 0.006 * H[i]));
		if (tmp < min){
			ans = i;
			min = tmp;
		}
	}

	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 256