akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

int main(){
    string s;
    cin >> s;


    do{
        s.erase(sz(s)-1);
        if(sz(s)% 2 == 0){
            string a =s.substr(0,sz(s)/2) ,b = s.substr(sz(s)/2);

            if(a == b)break;
        }
    }while(1);

    P(sz(s));
    
	return  0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second

const int maxn = 100010;
#define all(x) x.begin(),x.end()

#define ld long double

int n;
vector <ld> v;

int main() {
	cin >> n;
	for (int i =0;i<n;i++) {
		int x; cin >> x;
		v.push_back(x);
	}
	
	sort(v.begin(),v.end());
	ld cur = (v[0] + v[1]) / 2;
	for (int i =2;i<n;i++) {
		cur = (cur + v[i]) / (ld) 2;
	}
	cout << setprecision(10) << cur;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
  int N; cin >> N;
  int Amax = 1e6;
  vector<int> A(N);
 
  vector<bool> P(Amax+1,true); //倍数テーブル
  map<int,int> mp;
  
  REP(i,N) cin >> A.at(i);
  sort(A.begin(),A.end());
  
  //エラトステネス的なやつ
  REP(i,N){
    mp[A.at(i)]++;
    if(mp[A.at(i)]>1) continue;
    if(!P.at(A.at(i))) continue;
    int t = 2;
    while(A.at(i)*t<=Amax){
      P.at(A.at(i)*t) = false;
      ++t;
    }
  }
 
  int ans=0;
 
  REP(i,N){
    if(mp[A.at(i)]>1)continue;
    if(P.at(A.at(i)))ans++;
  }
 
  cout << ans << endl;
 
  return 0;
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long Long;

const Long N = 1e5 + 10;

set<Long> ini[N];
set<Long> fin[N];

Long tree1[N];
Long tree2[N];

Long query1(Long i){
	Long sum=0;
	while(i>0){
		sum+=tree1[i];
		i-=(i&-i);
	}
	return sum;
}
Long query2(Long i){
	Long sum=0;
	while(i>0){
		sum+=tree2[i];
		i-=(i&-i);
	}
	return sum;
}

void update1(Long i, Long val){
	while(i<N){
		tree1[i]+=val;
		i+=(i&-i);
	}
	return;
}
void update2(Long i, Long val){
	while(i<N){
		tree2[i]+=val;
		i+=(i&-i);
	}
	return;
}

Long query(Long x){
	return query1(x)*x-query2(x);
}

void update(Long i, Long j, Long v){
	update1(i,v);
	update1(j+1,-v);
	update2(i,v*(i-1));
	update2(j+1,-j*v);
	return;
}

pair<Long,Long> cambia(Long l, Long r, Long n){
	pair<Long, Long> a,b;
	a = {l,r};
	b = {n-r-1,n-l-1};
	a = min(a,b);
	if(a.second >= n/2){
		Long aux = min(n/2 - 1,n-a.second-2);
		a = {a.first,aux};
	}
	return a;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(10);
	cout << fixed;
	
	Long m, l, r, n;
	string cad;
	cin >> cad >> m;
	n = cad.size();
	for(Long i = 0; i < m; i++){
		cin >> l >> r;
		l--;
		r--;
		if(l+r == n-1) continue;
		pair<Long,Long> nuevo = cambia(l,r,n);
		ini[nuevo.first].insert(nuevo.second);
	}
	
	for(Long i = 0; i < n/2; i++){
		Long sz = ini[i].size();
		auto it = ini[i].begin();
		if(sz == 1){
			fin[*it].insert(i);
		}else if(sz > 1){
			Long ant = i;
			while(it != ini[i].end()){
				if(ant != i){
					ini[ant].insert(*it);
				}
				fin[*it].insert(ant);
				ant = *it + 1;
				it++;
			}
		}
	}
	
	vector< pair<Long,Long> > rangos;
	
	for(Long i = 0; i < n/2; i++){
		Long sz = fin[i].size();
		auto it = fin[i].begin();
		if(sz == 1){
			rangos.push_back({*it,i});
		}else if(sz > 1){
			Long ant = *it;
			while(it != fin[i].end()){
				it++;
				if(it == fin[i].end()){
					rangos.push_back({ant,i});
				}else{
					rangos.push_back({ant,*it-1});
					ant = *it;
				}
			}
		}
	}
	
	sort(rangos.begin(),rangos.end());
	
	for(Long i = 0; i < rangos.size(); i++){
		l = rangos[i].first + 1;
		r = rangos[i].second + 1;
		Long auxi = (cad[n-l] - 'a') - (query(l) - query(l-1) + (cad[l-1] - 'a'));
		auxi %= 26;
		auxi += 26;
		auxi %= 26;
		update(l,r,auxi);
	}
	
	for(Long i = 0; i < n/2; i++){
		Long aux = query(i+1) - query(i);
		if(((cad[i] - 'a') + aux)%26 != (cad[n-i-1] - 'a')){
			cout << "NO\n";
			return 0;
		}
	}
//asd
	cout << "YES\n";
	return 0;
}

Measured memory_bytes: 67520
import copy
H,W,K=map(int,input().split())
C=[]
for h in range(H):
    c=list(input())
    C.append(c)
ans=0
for i in range(2**(H+W)):
    c=copy.deepcopy(C)
    cnt=0
    for w in range(W):
        if i%2==1:
            for h in range(H):
                c[h][w]="R"
        i//=2
    for h in range(H):
        if i%2==1:
            for w in range(W):
                c[h][w]="R"
        i//=2
    
    for h in range(H):
        for w in range(W):
            if c[h][w]=="#":
                cnt+=1
    if cnt==K:
        ans+=1
print(ans)

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

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

    int a[110];
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a, a + n, greater<int>());

    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0) {
            Alice += a[i];
        }
        else {
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

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

using namespace std;

#define UN unsigned
#define ll long long int
#define pb push_back
#define MOD 1000000007

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	int a[n];
	for(int i=0; i<n; i++)
		cin >> a[i];
	
	ll sum = 0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			sum += a[i]*a[j];
		}
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;

int main() {
	long long int N;
	cin >> N;
	string S1, S2;
	cin >> S1 >> S2;
	long long int Y;
	long long int X;

	if (S1[0] == S2[0]) {
		Y = 3;
		X = 0;
		for (long long int i = 1; i < N; i++) {
			if (S1[i] == S2[i]) {
				if (X == 0) {
					Y *= 2;
				}
				else {
				}
				X = 0;
			}
			else {
				if (X == 0) {
					Y *= 2;
				}
				else {
					Y *= 3;
				}
				X = 1;
				i++;
			}
			Y = Y % 1000000007;
		}
	}
	else {
		Y = 6;
		X = 1;
		for (long long int i = 2; i < N; i++) {
			if (S1[i] == S2[i]) {
				if (X == 0) {
					Y *= 2;
				}
				else {
				}
				X = 0;
			}
			else {
				if (X == 0) {
					Y *= 2;
				}
				else {
					Y *= 3;
				}
				X = 1;
				i++;
			}
			Y = Y % 1000000007;
		}
	}

	
	cout << Y << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    vector <float> v(N);
    for (int i=0;i<N;i++){
        cin >> v[i];
    }
   sort(v.begin(),v.end());
   
   
    float ave = (v[0] + v[1]) / 2 ;

    for (int i=2;i<N;i++){
        //cout << v[i] << endl ; 
        ave = (ave + v[i] ) / 2; 
    }
    cout << ave ;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;

namespace MinPro2019A
{
    public class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var K = ss.Next(int.Parse);
            sw.WriteLine((N + 1) / 2 >= K ? "YES" : "NO");
            //---------------------------------
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }

        static readonly Func<string, string> String = s => s;
    }

    public class StreamScanner
    {
        static readonly char[] Sep = {' '};
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
	init();
	ll n;cin>>n;
	ll ans=1;
	while(ans*2<=n)ans*=2;
	cout<<ans<<endl;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> h(N + 1), dp(N + 1);
  dp[0] = 1 << 30;
  cin >> h[1];
  for (int i = 2; i <= N; ++i) {
    cin >> h[i];
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
                dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 3956
from collections import Counter

n=int(input())
a=list(map(int,input().split()))

c=Counter(a)

q=0
for v in c.values():
  if v>=2:
    q+=v-1

ans=len(c.keys())
if q%2==0:
  print(ans)
else:
  print(ans-1)

Measured memory_bytes: 22020
#include <iostream>
using namespace std;
#include <stdio.h>
int main()
{
	int n,x,ans[100] = { 0 },i=0;
	while (1)
	{
		cin >> n >> x;
		if (n == 0 && x == 0) break;
		for (int j = 1; j <= n; j++){
			for (int k = j+1; k <= n; k++){
				for (int l = k+1; l <= n; l++){
					if (j+k+l==x){
						ans[i]++;
					}
				}
			}
		}
		i++;
	}
	for (int j = 0; j < i; j++) printf("%d\n",ans[j]);
}

Measured memory_bytes: 1144
#include<iostream>
 #include<string> 
#include<cmath> 
#include<cstdio>
 #include<algorithm>
 using namespace std; 
int n,m,a[100001],b[100001]; 
string s; 
int main() 
{ cin>>n>>m; cin>>s; if (s[n]=='-') { for (int i=0;i<s.size();i++) { if (i!=n) { if (int('9')<int(s[i]) || int(s[i])<int('0')) { cout<<"No"<<endl; return 0; } } } } else { cout<<"No"<<endl; return 0; } cout<<"Yes"<<endl; }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main()
{
    int n;
    ll m;
    cin >> n >> m;
    vl as;
    as.resize(n);
    for(int i=0; i<n; i++) cin >> as.at(i);

    vl halfas(n);
    for(int i=0; i<n; i++)
    {
        if(as.at(i)%2 == 0)
        {
            halfas.at(i) = as.at(i) / 2;
        }
        else
        {
            cout << 0 << endl;
            return 0;
        }
    }

    ll two = 1;
    ll cp0 = halfas.at(0);
    while(true)
    {
        if(cp0%2==0)
        {
            two *= 2;
            cp0 /= 2;
        }
        else break;
    }

    ll num = 1;
    for(int i=0; i<n; i++)
    {
        // cout << "---" << endl;
        // cout << halfas.at(0) % two << endl;
        // cout << (halfas.at(i)%two) % 2 << endl;
        if((halfas.at(0) % two != 0) || ((halfas.at(i)/two) % 2 == 0))
        {
            cout << 0 << endl;
            return 0;
        }
        num = lcm(num, halfas.at(i));
    }
    ll ans = m/num;
    if(ans%2) ans = (ans+1) / 2;
    else ans /= 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int n, m;
vector<int> adj[100001];
vector<pair<int, int>> edges;
vector<int> xr(100001);
vector<int> vis(100001);
set<pair<int, int>> flippy;
 
void input() {
      cin >> n >> m;
      flippy.clear(); edges.clear();
      for (int i = 1; i <= n; i++) {
            adj[i].clear();
            xr[i] = vis[i] = 0;
      }
 
      for (int i = 0; i < m; i++) {
            int x, y; cin >> x >> y;
            xr[y] ^= 1;
            adj[x].push_back(y);
            adj[y].push_back(x);
            edges.push_back({x, y});
      }
}
 
void dfs(int now, int prev) {
      vis[now] = 1;
 
      for (int u: adj[now]) {
            if (vis[u]) continue;
            dfs(u, now);
      }
 
      if (xr[now]) {
            xr[now] ^= 1; xr[prev] ^= 1;
            flippy.insert({now, prev});
            flippy.insert({prev, now});
      }
}
 
void solve() {
      if (m % 2) {cout << "-1\n"; return;}
 
      dfs(1, 0);
 
      for (auto u: edges) {
            if (flippy.find(u) != flippy.end()) {
                cout << u.first << ' ' << u.second << '\n';
            } else {
                cout << u.second << ' ' << u.first << '\n';
            }
      }
}
 
signed main() {
      ios::sync_with_stdio(0); cin.tie(0);
 
      int t = 1;
      while (t--) {
            input();
            solve();
      }
 
      return 0;
}

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

using namespace std;

int main(){
    long long n;
    cin>>n;
    long long ans=1;
    
    for(long long i=2;i<=n;i++){
        ans*=i;
        ans%=1000000007;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef double db;

const ll mod = 1e9+7;
const db eps = 1e-9;

#define mp make_pair
#define pb push_back
#define endl "\n"
#define deb(x) cout << #x << " " << x << endl

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

    ll x,k;
    cin >> x >> k;
    cout << min(x%k, k-x%k);

    return 0;
} 

Measured memory_bytes: 256
n, t = gets.split.map(&:to_i)
ct = []
n.times do
  ct.push gets.split.map(&:to_i)
end
valids = ct.select { |e| e.last <= t }
if valids.empty?
  puts 'TLE'
else
  puts valids.sort_by { |e| e.first }.first.first
end


Measured memory_bytes: 3836
result = []
ut = []
3.times do
  time = []
  8.times { time << gets.split.map(&:to_f) }
  time.sort_by!{ |t| t.last }
  result << time[0,2]
  ut << time[2,2]
end
result << ut.flatten(1).sort_by{ |t| t.last }[0,2]
result.flatten(1).each{ |t| puts "%d %.2f" % t }

Measured memory_bytes: 6144
import fractions
a,b,c,d = map(int,input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
x=b//c + b//d - b//(lcm(c, d))
y=(a-1)//c + (a-1)//d - (a-1)//(lcm(c, d))
print((b-a+1) - (x-y))

Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int d, t, s;
    cin >> d >> t >> s;
    cout << (d <= t * s?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define mod 1000000007
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static int buf[20],len; len=0;
	if(x<0)x=-x,putchar('-');
	for(;x;x/=10)buf[len++]=x%10;
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]+'0');
}
inline void writeln(ll x){write(x); putchar('\n');}
inline void writesp(ll x){write(x); putchar(' ');}
ll inv[maxn],sum[maxn];
int a[maxn];
int n;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	inv[1]=1; sum[1]=1;
	for(int i=2;i<=n;i++){
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		sum[i]=(sum[i-1]+inv[i])%mod;
	}
	ll ans=0;
	for(int i=1;i<n;i++)
		ans=(ans+(a[i+1]-a[i])*sum[i])%mod;
	for(int i=1;i<n;i++)
		ans=ans*i%mod;
	writeln(ans);
	return 0;
}

Measured memory_bytes: 2176
D = int(input())
C = list(map(int, input().split()))
S = []
con= 0
for _ in range(D):
    S.append(list(map(int, input().split())))
t = [-1]*D
best = [0]*D
last = [0]*26

for i in range(D):#1日ごと
    
    score = [-1]*26
    
    for x in range(26):#どの問題を選ぶか
        if i==0:
            con = 0
        else:
            con = best[i-1]
        
        con += S[i][x]
        #last[x] = i+1
        for j in range(26): #減少量の計算 #問題ごと
            if not j==x:
                con -= C[j]*(i-last[j]+1)

        score[x]=con
    m = -100000
    ii = 0
    for k in range(26):
        if m<score[k]:
            m=score[k]
            ii=k
    
    last[ii]=i+1
    best[i]=score[ii]
    t[i]=ii+1
            
for i in range(D):
    print(t[i])
#print(best)



Measured memory_bytes: 68516
n=int(input())
s=input()
a=[int(s[i])-1 for i in range(n)]

div=[0]*(n+1)
for i in range(1,n+1):
  div[i]+=div[i-1]
  x=i
  while not x&1:
    x>>=1
    div[i]+=1

XOR=0;one=False
for i in range(n):
  one|=a[i]==1
  if div[n-1]<=div[i]+div[n-1-i]:
    XOR^=a[i]
if XOR&1:print(1)
elif one:print(0)
elif XOR&2:print(2)
else:print(0)

Measured memory_bytes: 116132
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	char C;
	cin >> C;
	char D = C + 1;
	cout << D<< endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc121/tasks/abc121_d

a, b = map(int, input().split())

def func(n):
    if n % 2 == 1:
        if ((n + 1) // 2) % 2 == 1:
            return 1
        return 0
    else:
        if (n // 2) % 2 == 1:
            return n ^ 1
        return n

ans = func(a - 1) ^ func(b)
print(ans)


Measured memory_bytes: 61956
#include<iostream>
using namespace std;
typedef long long int ll;
static const int MAX_N = 200000;

int N;
ll A[MAX_N];

int main(){
	cin >> N;
	for(int i = 0; i < N; i++) cin >> A[i];
	
	ll res = 0LL;
	ll sum1 = 0LL, sum2 = 0LL;
	int j = 0;
	for(int i = 0; i < N; i++){
		sum1 ^= A[i];
		sum2 += A[i];
		while(sum1 < sum2){
			if(j >= i) break;
			sum1 ^= A[j];
			sum2 -= A[j];
			j++;
		}
		res += (ll)((i - j) + 1);
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a,b;
	int t;
	int n;
	cin>>a;
	if(a==25)
	cout<<"Christmas";
	if(a==24)
	cout<<"Christmas Eve";

	if(a==23)
	cout<<"Christmas Eve Eve";
		if(a==22)
	cout<<"Christmas Eve Eve Eve";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    LL a, b,c,d;
    cin >> a >> b >> c >> d;
    LL e = c*d / __gcd(c,d);
    LL ans = b - b/c - b/d + b/e;
    a--;
    ans -= (a - a/c - a/d + a/e);
    cout << ans << endl;

}

Measured memory_bytes: 256
/// In the name of God
#include <bits/stdc++.h>
//#define int long long
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

#define y1 def1
#define X first
#define Y second
#define endl '\n'
#define all(o) o.begin(), o.end()
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 1e5 + 10;
int a[maxn];
int main(){
    IOS;
    int n, m;
    cin >> n >> m;
    for(int i=0; i<m; i++){
        int u, v;
        cin >> u >> v;
        u--, v--;
        a[u] ^= 1, a[v] ^= 1;
    }
    for(int i=0; i<n; i++){
        if(a[i]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 768
n, k = map(int, input().split())
h = [0]*n
for i in range(n):
    h[i] = int(input())
h.sort()
ans = float("inf")
for i in range(n-k+1):
    res = abs(h[i] - h[i+k-1])
    ans = min(ans, res)
print(ans)

Measured memory_bytes: 45336
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define re register
#define ll long long
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int n,a[110];
int main(){
	n=gi();
	for(int i=1;i<=n;i++)a[i]=gi();int ans=1e9;
	for(int x=-100;x<=100;x++){
		int ret=0;
		for(int i=1;i<=n;i++)
			ret+=(a[i]-x)*(a[i]-x);
		ans=min(ans,ret);
	}
	printf("%d\n",ans);
	return 0;
}


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

using namespace std;

int main() {
    int n,x;
    cin>>n>>x;
    int sum=0;
    int c=0;
    int j=0;
    int a[n];
    for(int i=0;i<n;i++)
    {
    int  l;
    cin>>l;
    sum+=l;
    if(sum<=x)
    c++;
    
    }
    cout<<c+1;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;

bool ch(vi a,vi b,vvi &c){
    b[0]=c[0][0]-a[0];
    b[1]=c[0][1]-a[0];
    b[2]=c[0][2]-a[0];
    a[1]=c[1][0]-b[0];
    a[2]=c[2][0]-b[0];
    bool isok=true;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(a[i]+b[j]!=c[i][j]){
                isok=false;
            }
        }
    }
    if(isok){
        cout<<"Yes"<<endl;
        return 1;
    } else {
        return 0;
    }
}

int main(void) {

    vvi c(3,vi(3));
    int sum=0;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>c[i][j];
        }
    }
    vi b(3);
    vi a(3);
    for(int i=-1000;i<1000;i++){
        a[0]=i;
        if(ch(a,b,c)){
            return 0;
        }
    }
    cout<<"No"<<endl;


}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N, M;
    cin >> N >> M;

    vll A(N);
    REP(i, N) cin >> A[i];

    sort(ALL(A));

    vll S(N + 1);
    S[0] = 0;
    REP(i, N) S[i + 1] += S[i] + A[i];

    ll s = 2 * S[N] * N;

    ll ng = INF;
    ll ok = 0;

    ll cnt = 0, s_ignored = 0;
    while(ng - ok > 1) {
        ll mid = (ok + ng) / 2;

        cnt = 0;
        s_ignored = 0;
        REP(i, N) {
            int num = lower_bound(ALL(A), mid - A[i]) - A.begin();
            cnt += num;
            s_ignored += S[num] + num * A[i];
        }

        if (N * N - cnt < M) ng = mid;
        else ok = mid;
    }

    print(s - s_ignored + ok * (M -N * N + cnt));

    
}


Measured memory_bytes: 4788
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,k,i,cnt;
	scanf("%d %d %d",&a,&b,&k);
	cnt=0;
	for(i=a;i>=1;i--)	{
		if(a%i==0 && b%i==0)	cnt++;
		if(cnt==k)	break;
	}
	printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int N;
vector<string> g;
int used[128],x1[128],x2[128],y1[128],y2[128];
vector<int> p;

vector<char> v;
bool bt(){

	for(int k=0;k<p.size();k++){
		for(int i=y1[p[k]];i<=y2[p[k]];i++){
			for(int j=x1[p[k]];j<=x2[p[k]];j++){
				char c = g[i][j];
				if(c == '.')return false;
				if(find(p.begin(),p.end(),p[k]) > find(p.begin(),p.end(),c)){
					return false;
				}
			}			
		}
	}

	for(int k=0;k<v.size();k++){
		if(!used[v[k]]){
			used[v[k]] = true;
			p.push_back(v[k]);
			if( bt() ) return true;
			p.pop_back();
			used[v[k]] = false;
		}
	}
	return p.size() == v.size();
}
int main(){
	int T;
	
	cin >> T;
	while(T--){
		int W,H;
		cin >> H >> W;
		vector<string> data(H);
		for(int i=0;i<H;i++)
			cin >> data[i];
			
		g = data;
		
		int check[128];
		
		for(int i=0;i<128;i++)
			x1[i] = x2[i] = y1[i] = y2[i] = used[i] = check[i] = 0;

		for(int i=0;i<128;i++)
			x1[i] = y1[i] = 9999;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				char c = data[i][j];
				if(c != '.'){
					check[c] = true;
					x1[c] = min(j,x1[c]);
					x2[c] = max(j,x2[c]);
					y1[c] = min(i,y1[c]);
					y2[c] = max(i,y2[c]);
				}
			}
		}
		
		v.clear();
		p.clear();
		
		for(int i=0;i<128;i++)
			if(check[i])v.push_back(i);

			
		cout << ( bt() ? "SAFE" : "SUSPICIOUS") << endl;
	}
}

Measured memory_bytes: 936
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string S, T;
  cin >> S >> T;
  cout << T << S << endl;
}

Measured memory_bytes: 256
n = int(input())
MOD = 1000000007

def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

if(n == 1):
    print(0)
elif (n == 2):
    print(2)
else:
    kotae = 0
    a = power_func(10,n,MOD)
    b = power_func(9,n,MOD)
    c = power_func(8,n,MOD)

    kotae = a + c - ( 2 * b)
    kotae = kotae % MOD
    print(kotae)



Measured memory_bytes: 61780
from enum import Enum, auto
class Square(Enum):
    FREE = auto()
    NOT_FREE = auto()

row = [Square.FREE for i in range(8)]
col = [Square.FREE for i in range(8)]
dpos = [Square.FREE for i in range(2*8-1)]
dneg = [Square.FREE for i in range(2*8-1)]

board = [[False for j in range(8)] for i in range(8)]

def set_board(r, c, v=True):
    global board
    if v:
        board[r][c] = True
        row[r] = Square.NOT_FREE
        col[c] = Square.NOT_FREE
        dpos[r+c] = Square.NOT_FREE
        dneg[r-c+8-1] = Square.NOT_FREE
    else:
        board[r][c] = False
        row[r] = Square.FREE
        col[c] = Square.FREE
        dpos[r+c] = Square.FREE
        dneg[r-c+8-1] = Square.FREE

def print_board():
    for i in range(8):
        for j in range(8):
            if board[i][j]:
                print('Q', end='')
            else:
                print('.', end='')
        print('')

def recursive(i): # i はrow番号
    global board, row, col, dpos, dneg
    if i == 8:
        print_board()
        return None

    if row[i] == Square.NOT_FREE:
        recursive(i+1)
    else:
        for j in range(8):
            if col[j] == Square.NOT_FREE or dpos[i+j] == Square.NOT_FREE or dneg[i-j+8-1] == Square.NOT_FREE:
                continue
            set_board(i, j, True)
            recursive(i+1)
            set_board(i, j, False)

k = int(input())
for i in range(k):
    r, c = list(map(int, input().split(' ')))
    set_board(r, c, True)
recursive(0)



Measured memory_bytes: 6348
#include<cstdio>
#include<algorithm>
using namespace std;
char p[510][510];
int Up[510][510], Down[510][510];
int B[510][510], E[510][510], BB[510], EE[510], S[510];
int T[510][510], v[510];
int n, w[510][510], L[510], R[510];
long long res;
int main() {
	int i, j, k;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%s", p[i] + 1);
		for (j = 1; j <= n; j++) {
			if (p[i][j] >= '0' && p[i][j] <= '9')w[i][j] = p[i][j] - '0';
			else w[i][j] = -1;
		}
	}
	for (i = 0; i <= n + 1; i++)for (j = 0; j <= n + 1; j++)if (i == 0 || i > n || j == 0 || j > n)w[i][j] = -1;
	for (i = n; i >= 1; i--) {
		for (j = n; j >= 1; j--) {
			if (w[i][j] == -1)continue;
			Down[i][j] = i;
			Down[i][j] = max(Down[i][j], Down[i][j + 1]);
			Down[i][j] = max(Down[i][j], Down[i + 1][j]);
		}
	}
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (w[i][j] == -1) {
				Up[i][j] = n + 1;
				continue;
			}
			Up[i][j] = i;
			if (w[i][j - 1] != -1)Up[i][j] = min(Up[i][j], Up[i][j - 1]);
			if (w[i - 1][j] != -1)Up[i][j] = min(Up[i][j], Up[i - 1][j]);
		}
	}
	for (i = 1; i <= n; i++) {
		int pv = 0, s = 0;
		for (j = 1; j <= n; j++) {
			if (w[i][j] == -1) {
				pv = j;
				B[i][j] = 1e9, E[i][j] = -1e9;
				s = 0;
				continue;
			}
			T[i][j] = pv + 1;
			res += s*w[i][j];
			s += w[i][j];
			int b = T[i][j], e = j;
			if (i != 1) {
				B[i][j] = 1e9, E[i][j] = -1e9;
				for (k = b; k <= e; k++) {
					if (w[i - 1][k] != -1) {
						B[i][j] = min(B[i][j], T[i - 1][k]);
						E[i][j] = max(E[i][j], k);
					}
				}
			}
		}
		for (j = 1; j <= n; j++) BB[j] = B[i][j], EE[j] = E[i][j];
		for (j = i - 1; j >= 1; j--) {
			for (k = 1; k <= n; k++) {
				S[k] = S[k - 1];
				if (Down[j][k] >= i) {
					S[k] += w[j][k];
				}
				if (j > 1) {
					if (Up[j][k] <= j-1 && Down[j][k] >= i)v[k] = 1;
					else v[k] = 0;
				}
			}
			for (k = 1; k <= n; k++) {
				if (Up[i][k] <= j) {
					res += (S[EE[k]] - S[BB[k] - 1])*w[i][k];
				}
			}
			if (j == 1)break;
			for (k = 1; k <= n; k++) {
				L[k] = L[k - 1];
				if (v[k])L[k] = k;
			}
			R[n + 1] = n + 1;
			for (k = n; k >= 1; k--) {
				R[k] = R[k + 1];
				if (v[k])R[k] = k;
			}
			for (k = 1; k <= n; k++) {
				int b = BB[k], e = EE[k];
				if (Up[i][k] >= j) {
					BB[k] = 1e8, EE[k] = -1e8;
					continue;
				}
				BB[k] = B[j][R[b]], EE[k] = E[j][L[e]];
			}
		}
	}
	printf("%lld\n", res);
}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(),h.end());
    vector<int>ans(n-k+1);
    for(int i = 0;i < n-(k-1);i++){
        ans[i] = h[i+k-1] - h[i];
    }
    sort(ans.begin(),ans.end());
    cout << ans[0] << endl;
    return 0;
}

Measured memory_bytes: 1024
let n, a = Scanf.scanf "%d %d" (fun x y -> x, y)
let xs = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x-a))
let len = 2*(50*50+1)
let arr = Array.make_matrix (n+1) len 0
let () =
  arr.(0).(len / 2) <- 1;
  xs |> Array.iteri begin fun i e ->
    Array.init len begin fun j -> 
      arr.(i+1).(j) <- arr.(i+1).(j) + arr.(i).(j);
      if 0 <= j + e && j + e < len then
        arr.(i+1).(j+e) <- arr.(i+1).(j+e) + arr.(i).(j)
    end |> ignore
  end;
  Printf.printf "%d\n" (arr.(n).(len / 2) - 1)


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  FAST();

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int sum = 0;
  if(a >= k){
    sum += k * 1;
    k = 0; 
  }
  else{
    sum += a * 1;
    k -= a;
  }

  if(b >= k){
    sum += k * 0;
    k = 0; 
  }
  else{
    sum += b * 0;
    k -= b;
  }

  if(c >= k){
    sum += k * -1;
    k = 0; 
  }
  else{
    sum += c * -1;
    k -= c;
  }

  cout << sum << endl;


  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#define lli long long int
using namespace std;
int main()
{
   lli n, k, q;
   cin >> n >> k >> q;
   lli t = q;
   lli a[n];
   for(lli i = 0; i < n; i++)
   {
       a[i] = k;
   }
   while(q--)
   {
       lli b;
       cin >> b;
       a[b - 1]++;
   }
   for(lli i = 0; i < n ; i++)
   {
       a[i] = a[i] - t;
       if(a[i] >= 1)
        cout << "Yes" << endl;
        else
        cout << "No" << endl;
   }

    return 0;
}


Measured memory_bytes: 1408
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            
            var a = cin.nextInt();
            var s = cin.next();

            Console.WriteLine(3200 <= a? s:"red");
        }
    }

    class Scanner
    {
        string[] s;
        int i;

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

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

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

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

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

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

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


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


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

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    string s; cin >> s;
    if (s[s.size()-1] == '2' || s[s.size()-1] == '4' || s[s.size()-1] == '5' || s[s.size()-1] == '7' || s[s.size()-1] == '9' ) cout << "hon" << endl;
    else if (s[s.size()-1] == '0' || s[s.size()-1] == '1' || s[s.size()-1] == '6' || s[s.size()-1] == '8') cout << "pon" << endl;
    else cout << "bon" << endl;
    return 0;
}

Measured memory_bytes: 3612
import math

(a, b, h, m) = tuple(map(int, input().split()))
minutes = h * 60 + m
h_deg = (minutes  / (12 * 60)) * 2 * math.pi
m_deg = (minutes  / 60) * 2 * math.pi
h_x = a * math.cos(h_deg)
h_y = a * math.sin(h_deg)
m_x = b * math.cos(m_deg)
m_y = b * math.sin(m_deg)
print(math.sqrt((h_x - m_x) * (h_x - m_x) + (h_y - m_y) * (h_y - m_y)))


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

using namespace std;

typedef long long ll;

const ll inf=100000000000;
#define rep(i,m,n) for(ll i=m;i<n;i++)


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

 ll n,m,l;
  cin >> n >> m >> l;
 vector<vector<ll>> d(n,vector<ll>(n,inf)),c(n,vector<ll>(n,inf));
  rep(i,0,n) d[i][i]=0;
  
  rep(i,0,m){
   ll a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
   if(c<=l) {
     d[a][b]=c;
     d[b][a]=c;
   }
  }
  
   rep(k,0,n){
    rep(i,0,n){
     rep(j,0,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
    }
   } 
  
    rep(i,0,n){
      c[i][i]=0;
      rep(j,0,n) if(d[i][j]<=l&&i!=j) c[i][j]=1;
    }
  
     rep(k,0,n){
    rep(i,0,n){
     rep(j,0,n) c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
    }
   } 
  
  
  ll q;
  cin >> q;
  rep(i,0,q){
  ll s,t;
    cin >> s >> t;
    s--;
    t--;
    if(c[s][t]!=inf) cout << c[s][t]-1 << endl;
    else cout << -1 << endl;
  }
  
}


Measured memory_bytes: 1920
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

class Stack {
public:
	Stack(int n) : s_(n), top_(0){};

	bool isEmpty() { return top_ == 0; }
	bool isFull() { return top_ == s_.size(); }

	void push(int x) {
		if (isFull()) {
			return;
		}
		top_++;
		s_[top_] = x;
	}

	int pop() {
		if (isEmpty()) { return -1; }
		top_--;
		return s_[top_ + 1];
	}

private:
	vector<int> s_;
	size_t top_;
};


int main() {
	char s[1000];

	Stack stack(110);

	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			// 加算
			int rhs = stack.pop();
			int lhs = stack.pop();
			int t = lhs + rhs;
			stack.push(t);
		}
		else if (s[0] == '-') {
			// 減算
			int rhs = stack.pop();
			int lhs = stack.pop();
			int t = lhs - rhs;
			stack.push(t);
		}
		else if (s[0] == '*') {
			// 乗算
			int rhs = stack.pop();
			int lhs = stack.pop();
			int t = lhs * rhs;
			stack.push(t);
		}
		else {
			// スタックに値を追加
			stack.push(atoi(s));
		}
	}

	printf("%d\n", stack.pop());
	
	return 0;
}


Measured memory_bytes: 2736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define debug(x) cout << "debug: " << x << endl
#define MOD 1e9 + 7
#define INF 1e9

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

//const double pi = 3.1415926535;

int main(){
    int n, w;
    cin >> n >> w;
    int weight[n];
    int value[n];
    rep(i, n) cin >> weight[i] >> value[i];
    vector<vector<int>> dp(n + 1, vector<int>(100100, INF+1));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, 100100) {
            if (j - value[i] >= 0) 
                chmin(dp[i + 1][j], dp[i][j - value[i]] + weight[i]);
            chmin(dp[i + 1][j], dp[i][j]);
        }
    }
    //rep(i, n) cout << dp[n][i] << endl;
    ll res = 0;
    for (int i = 0; i<100100; i++){
        if (dp[n][i] <= w)
            res = i;
    }
    cout << res << endl;
}

Measured memory_bytes: 40192
import java.util.*;

class Main{
    //148b
    static final int DIV = 100000007;
    static final int MAX = 2000000000;
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] a = sc.next().toCharArray();
        char[] b = sc.next().toCharArray();
        char[] ans = new char[n*2];
        for(int i = 0;i < 2*n;i++){
            if(i%2==0){
                ans[i] = a[i/2];
            }else{
                ans[i] = b[i/2];
            }
        }
        String ansstr = String.valueOf(ans);
        System.out.println(ansstr);
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
int main(void){
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	int i;
	int count=0;
	for (i=a;i<=b;i++){
		if (c%i==0)
		count++;
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 2108
#include <stdio.h>

#define INF 1000000;
void matrixChainOrder(int *);
int min(int,int);
int n,m[100][100];
int main(){
  int i,p[100];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }
  matrixChainOrder(p);
  printf("%d\n",m[1][n]);
  return 0;
}
void matrixChainOrder(int *p){
  int i,q,j,k,l;
  for(i=1;i<=n;i++){
	  m[i][1] = 0;
    }
    for(l=2;l<=n;l++){
      for(i=1;i<=n-l+1;i++){
	j=i+l-1;
	m[i][j] = INF;
	for(k=i;k<=j;k++){
	  q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	  m[i][j] = min(m[i][j], q);
	  }
      }
    }
  }
  int min(int a,int b){
    if(a>b)return b;
    else return a;
  }



Measured memory_bytes: 2112
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  ll N,M;cin>>N>>M;
  ll ans;
  if(N==1 && M==1){
    ans=1;
  }else if(N==1 && M>=2){
    ans=M-2;
  }else if(N>=2 && M==1){
    ans=N-2;
  }else{
    ans=(M-2)*(N-2);
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 256
use std::io::BufRead;
use std::str::FromStr;

fn main() {
    let stdin = std::io::stdin();
    let mut t = Tokenizer::new(stdin.lock().lines().map(|x| x.unwrap()));

    let s = t.take::<String>().into_bytes();
    let mut pre = None;
    let mut result = false;
    for i in s.iter() {
        if let Some(c) = pre {
            if c == i {
                result = true;
                break;
            }
        }
        pre = Some(i);
    }
    if result {
        println!("Bad");
    }
    else {
        println!("Good");
    }
}

struct Tokenizer<S: Iterator<Item = String>> {
    input: S,
    items: Vec<String>,
}

impl<S: Iterator<Item = String>> Tokenizer<S> {
    pub fn new(input: S) -> Self {
        Tokenizer {
            input: input,
            items: Vec::new(),
        }
    }

    pub fn take<T: FromStr>(&mut self) -> T {
        loop {
            if let Some(r) = self.items.pop() {
                return r.parse().ok().expect("parse failed");
            }
            let mut items = self
                .input
                .next()
                .unwrap()
                .split_whitespace()
                .map(|x| x.to_string())
                .collect::<Vec<String>>();
            items.reverse();
            self.items = items;
        }
    }
}


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

int main() {
	int menseki,gaisyu,tate, yoko;

	cin >> tate >> yoko;
	
	menseki = tate * yoko;
	gaisyu = tate * 2 + yoko * 2;

	cout << menseki << " " << gaisyu << endl;

	return 0;
}


Measured memory_bytes: 3052
#include<bits/stdc++.h>
#define N 100005
#define llong long long
#define _pair  pair<int, int>
#define MP make_pair
#define fi first
#define se second
using namespace std;
int n;
int a[N], b[N];
int main()
{
    ios::sync_with_stdio(0);
    cin>>n;
    for (int i=1; i <= n+1; i++)
        cin>>a[i];
    for (int i=1; i <= n; i++)
        cin>>b[i];
    llong res=0;
    for (int i=n; i >= 1; i--){
        if (b[i] <= a[i+1]){
            res+=b[i];
            a[i+1]-=b[i];
        }
        else{
            res+=a[i+1];
            b[i]-=a[i+1];
            if (b[i] >= a[i]){
                res+=a[i];
                a[i]=0;
            }
            else{
                res+=b[i];
                a[i]-=b[i];
            }
        }
    }
    cout<<res;
    return 0;
}

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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;

    vector<int> a(n), b(n), c(n-1);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < n-1; i++)
    {
        cin >> c[i];
    }
    
    int ans = 0, pre = -1;
    

    for (int i = 0; i < n; i++)
    {
        if(i == 0) {
            ans += b[a[i]  - 1];
            pre = a[i];
        } else {
            ans += b[a[i] - 1];
            if(pre + 1 == a[i]){
                ans+= c[a[i] - 2];
            }
            pre = a[i];
        }
    }

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


Measured memory_bytes: 256