akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String[] num = str.split(" ",0);
        int w,h,x,y,r;

        w = Integer.valueOf(num[0]);
        h = Integer.valueOf(num[1]);
        x = Integer.valueOf(num[2]);
        y = Integer.valueOf(num[3]);
        r = Integer.valueOf(num[4]);
       if(x >= r && (x+r) <= w){
           if(y >= r && (y+r) <= h){
               System.out.println("Yes");
           }else{
               System.out.println("No");
           }
       }else{
           System.out.println("No");
       }


        scan.close();
    }
    
}



Measured memory_bytes: 26308
import math
a, b = map(int, input().split())
a_min = a / 0.08
a_max = (a + 1) / 0.08
b_min = b / 0.1
b_max = (b + 1) / 0.1
if a_min > b_min:
  min = a_min
else:
  min = b_min
if a_max < b_max:
  max = a_max
else:
  max = b_max
min = math.ceil(min)
if math.floor(max) == max:
  max = max - 1 
else:
  max = math.floor(max)
if min <= max:
  print(min)
else:
  print(-1)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		ArrayDeque<String> q = new ArrayDeque<String>();
		
		try {
			int lim = Integer.parseInt(in.readLine());
			
			for (int i = 0; i < lim; i++) {
				String[] str = in.readLine().split(" ");
				
				if (str[0].equals("insert")) {
					q.addFirst(str[1]);
				} else if (str[0].equals("delete")) {
					q.remove(str[1]);
				} else if (str[0].equals("deleteFirst")) {
					q.removeFirst();
				} else {
					q.removeLast();
				}
			}
			
			System.out.print(q.remove());
			while (q.isEmpty() == false) {
				System.out.print(" " + q.remove());
			}
			System.out.println();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 229696
#include <iostream>
inline int abs(int x){return (x<0)?-x:x;}
inline int min(int x, int y){return (x<y)?x:y;}
using namespace std;
int main(void){
    int n,x,y;
    cin >> n >> x >> y;
    int k1,k2,i,j;
    int c[n-1];
    for(i=0;i<n-1;i++) c[i]=0;
    for(i=1;i<n;i++){
        for(j=i+1;j<=n;j++){
            c[min(j-i,abs(i-x)+1+abs(j-y))-1]++;
        }
    }
    for(i=0;i<n-1;i++){
        cout << c[i] << endl;
    }
    return 0;
}

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

using ll = long long;

#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 ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  vi h(n); rep(i, n) std::cin >> h[i];
  vi dp(n, inf);
  dp[0] = 0;
  rep(i, n-1) {
    chmin(dp[i+1], dp[i]+abs(h[i]-h[i+1]));
    if (i+2 < n)
      chmin(dp[i+2], dp[i]+abs(h[i]-h[i+2]));
  }
  std::cout << dp[n-1] << "\n";
}


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

using namespace std;
std::vector<int> G;
int cnt;
int A[1000000];

void showArray(int A[], int N){
	for (int p = 0; p < N; p++){
		cout << A[p] << endl;
	}
}

void insertionSort(int A[], int N, int G){
	int key;

	for (int i = G; i < N; i++){
		key = A[i];
		int j = i - G;
		while (j >= 0 && A[j] > key){
			A[j + G] = A[j];
			j = j - G;
			cnt++;
		}
		A[j + G] = key;
	}
}

void shellSort(int A[], int N){
	cnt = 0;
	// make G
	for (int i = 1;;){
		if ( i > N){
			break;
		}
		G.push_back(i);
		i = 3 * i + 1;
	}

	for (int i = G.size(); i > 0; i--){
		insertionSort(A, N, G[i - 1]);
	}
}

int main(){
	int N;

	cin >> N;

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

	shellSort(A, N);

	// ?????????
	cout << G.size() << endl;

	// 2??????
	for (int i = G.size() - 1; i > 0; i--){
		cout << G[i] << " ";
	}
	cout << G[0] << endl;

	// ?????????
	cout << cnt << endl;

	// ?¶????N???
	showArray(A, N);

	return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int d_sum(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

int main(){
  int n;
  scanf("%d", &n);
  
  int ans = INF;
  FOR (i, 1, n / 2 + 1) {
    ans = min(ans, d_sum(i) + d_sum(n - i));
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
s_in = input()
s = []
for i in range(len(s_in)):
  s.append(s_in[i])
#print(s)
  
flg = False
for i in range(len(s)):
    if (i+1)%2 == 0:
        if (s[i] == "L" or s[i] == "U" or s[i]  == "D"):
            flg = True
        else:
            flg = False
            break
    else:
        if (s[i] == "R" or s[i] == "U" or s[i]  == "D"):
            flg = True
        else:
            flg = False
            break
if (flg):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 int n ;
 cin >> n;
 vector<ll> a(n);
 rep(i,n){
   cin >> a.at(i);
 }
  int count=0;
 rep(i,n){
   while(a.at(i)%2==0){
     count++;
     a.at(i)/=2;
     if(a.at(i)%2==1)break;
   }
 }
 cout << count <<endl; 
     
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"
int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	for(ll i=0;i<5;i++){
		cin>>n;
		sum+=(n+9)/10*10;
		ans=max(ans,(10-n%10)%10);
	}
	cout<<sum-ans;
}

Measured memory_bytes: 3508
#include <iostream>
#include <string>

using namespace std;

int main(){
    int A, B ,K;
    cin >> A >> B >> K;
    int th = 0;

    for(int i = min(A,B); i >= 1; i--){
        if(A%i == 0 and B%i == 0){
            th++;
            if(th == K){
                cout << i << "\n";
                break;
            }
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<time.h>
#include<vector>
#include<iomanip>
#define ll long long
using namespace std;


int main()
{
    int k;
    cin>>k;
    for(int i=0; i<k; ++i){
        cout<<"ACL";
    }
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
double doINF = 1.0/0.0 ;
ostream_iterator <int> outp(cout," ");
inline ll modadd(ll n,ll m,ll mod){
    ll sum = ((n+m)%mod+mod)%mod;
    return sum;
} 
inline ll modsub(ll n,ll m, ll mod){
    ll diff = ((n-m+mod)%mod+mod)%mod;
    return diff;
}
inline ll modpro(ll n,ll m,ll mod){
    ll pro = ((n*m)%mod+mod)%mod;
    return pro;
}
inline ll pow(int x,int y){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}
inline ll powmod(ll x,ll y,ll mod){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = modpro(res , x,mod);
        y = y >> 1;
        x = modpro(x , x,mod);
    }
    return res;
}
//ll min(ll a, ll b){
//    if(a>b){
//        return b;
//    }
//    return a;
//}
// 
//ll max(ll a, ll b){
//    if(a>b){
//        return a;
//    }
//    return b;
//}
bool pairdec(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 		if(a.fi!=b.fi)
       	return (a.fi> b.fi);
		else return a.se>b.se;  
} 
ll power(ll x, ll y, ll mod) 
{ 
    ll res = 1; 
    x = x%mod; 
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % mod; 
  
        y = y >> 1;
        x = (x * x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll a, ll mod) 
{ 
    return  powmod(a, mod - 2, mod); 
} 
ll modFact(ll n, ll mod) 
{ 
    if (n >=mod) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) %mod; 
  
    return result; 
} 
//cout<<setprecision(9)<<fixed<<sum<<endl; --- precision for double numbers
//copy(v.beg,v.en,outp);
const int N=1e9+7;
int main()
{	
	int h,w;
	cin>>h>>w;
	char arr[h][w];
	forl(i,0,h)forl(j,0,w) cin>>arr[i][j];
	int dp[h][w];
	dp[0][0]=1;
	forl(j,1,w)
	{
		if(arr[0][j]=='#') dp[0][j]=0;
		else dp[0][j]=dp[0][j-1];
	}
	
	forl(i,1,h)
	{
		if(arr[i][0]=='#') dp[i][0]=0;
		else dp[i][0]=dp[i-1][0];
	}
	
	forl(i,1,h)
	{
		forl(j,1,w)
		{
			if(arr[i][j]=='#') dp[i][j]=0;
			else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%N;
		}
	}
//	forl(i,0,h)
//	{
//		forl(j,0,w) cout<<dp[i][j]<<" ";
//		cout<<endl;
//	}
	cout<<dp[h-1][w-1]<<endl;
	
	
	
	
}

Measured memory_bytes: 5120
#include<stdio.h>

int partition(int A[], int p, int r)
{
	int x = A[r];
	int i = p - 1;
	for (int j = p; j < r; j++)
	{
		if (A[j] <= x)
		{
			i++;
			int t = A[j];
			A[j] = A[i];
			A[i] = t;
		}
	}
	int t = A[r];
	A[r] = A[i + 1];
	A[i + 1] = t;
	
	return i + 1;
}

int main()
{
	int A[100010];
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &A[i]);
	int k = partition(A, 0, n - 1);
	for (int i = 0; i < n; i++)
	{
		if (i)
			printf(" ");
		if (i == k)
			printf("[");
		printf("%d", A[i]);
		if (i == k)
			printf("]");
	}
	printf("\n");
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,m;
  cin >> n >> m;
  if(m%n==0){
    cout << m/n << endl;
  }
  else{
    vector<long long> a;
    for(long long i=1;i*i<=m;i++){
      if(m%i==0){
        a.push_back(i);
        if(i*i!=m){
          a.push_back(m/i);
        }
      }
    }
    sort(a.begin(),a.end(),greater<long long>());
    for(int i=0;i<a.size();i++){
      if(n*a[i]<=m){
        cout << a[i] << endl;
        return 0;
      }
    }
    cout << 1 << endl;
    return 0;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
LL a[maxn], n;

int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  sort(a, a + n);

  if (a[0] < 0 && a[n - 1] >= 0) {
    LL ans_fu = 0, ans_zheng = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] < 0) ans_fu += a[i];
      else ans_zheng += a[i];
    }
    printf("%lld\n", ans_zheng - ans_fu);

    LL ind = 0;
    while (a[ind] < 0) ind++;
    LL ans = a[ind - 1];
    for (int i = ind; i < n - 1; i++) {
      printf("%lld %lld\n", ans, a[i]);
      ans -= a[i];
    }
    printf("%lld %lld\n", a[n - 1], ans);
    ans = a[n - 1] - ans;
    for (int i = 0; i < ind - 1; i++) {
      printf("%lld %lld\n", ans, a[i]);
      ans = ans - a[i];
    }

  } else if (a[0] >= 0) {
    LL sum = 0;
    for (int i = 0; i < n; i++) {
      sum += a[i];
    }
    printf("%lld\n", sum - 2 * a[0]);
    LL ans = a[0];
    for (int i = 1; i < n - 1; i++) {
      printf("%lld %lld\n", ans, a[i]);
      ans -= a[i];
    }
    printf("%lld %lld\n", a[n - 1], ans);
  } else {
    LL sum = 0;
    for (int i = 0; i < n - 1; i++) {
      sum += a[i];
    }
    sum = a[n - 1] - sum;
    printf("%lld\n", sum);

    LL ans = a[n - 1];
    for (int i = 0; i < n - 1; i++) {
      printf("%lld %lld\n", ans, a[i]);
      ans -= a[i];
    }
  }

  return 0;
}


Measured memory_bytes: 2688
from collections import deque


def topological_sort(indeg, tonodes, v):
    nodes = deque([])
    visited = deque([])
    for i in range(v):
        if indeg[i] == 0:
            nodes.append(i)
    while len(nodes) > 0:
        i = nodes.popleft()
        visited.append(i)
        for j in tonodes[i]:
            indeg[j] -= 1
            if indeg[j] == 0:
                nodes.append(j)
    return visited


def main():
    ve = input().split()
    v, e = tuple(map(int, ve))
    indeg = [0 for _ in range(v)]
    tonodes = [[] for _ in range(v)]

    for _ in range(e):
        st = input().split()
        s, t = tuple(map(int, st))
        indeg[t] += 1
        tonodes[s].append(t)
    visited = topological_sort(indeg, tonodes, v)
    while len(visited) > 0:
        print(visited.popleft())


if __name__ == "__main__":
    main()



Measured memory_bytes: 9236
class UnionFind:
    def __init__(self, size):
        self.rank = [0] * size
        self.par = range(size)
        self.g_num = size

    def find(self, x):
        if x == self.par[x]: return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return

        self.g_num -= 1
        if (self.rank[x] > self.rank[y]):
            self.par[y] = x
        else:
            self.par[x] = y
            if (self.rank[x] == self.rank[y]): self.rank[y] += 1

    def group_num(self):
        return self.g_num



V, E = map(int, raw_input().split())
es = [map(int, raw_input().split()) for i in xrange(E)]
es.sort(key = lambda x: x[2])

uf = UnionFind(V)
ans = 0
for e in es:
    if not uf.same(e[0], e[1]):
        uf.unite(e[0], e[1])
        ans += e[2]
print ans

Measured memory_bytes: 26040
a, b, c, x, y = map(int, input().split())

cost = 0
a_count = 0
b_count = 0

while a_count < x and b_count < y:
    if a + b < 2 * c:
        cost += a + b
        a_count += 1
        b_count += 1
    else:
        cost += 2 * c
        a_count += 1
        b_count += 1

while a_count < x:
    if a < 2 * c:
        cost += a
        a_count += 1
    else:
        cost += 2 * c
        a_count += 1
        b_count += 1

while b_count < y:
    if b < 2 * c:
        cost += b
        b_count += 1
    else:
        cost += 2 * c
        a_count += 1
        b_count += 1

print(cost)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

bool graph[8][8] = { false };

bool is_all_visited(int n, bool visited[]) {
        for (int i = 0; i < n; i++)
                if (visited[i] == false)
                        return false;
        return true;
}

int dfs(int v, int n, bool visited[]) {
        if (is_all_visited(n, visited))
                return 1;

        int ret = 0;

        for (int i = 0; i < n; i++) {
                if (graph[v][i] == false)
                        continue;
                if (visited[i])
                        continue;

                visited[i] = true;
                ret += dfs(i, n, visited);
                visited[i] = false;
        }

        return ret;
}

int main() {
        int n, m, a, b;

        cin >> n >> m;
        for (int i = 0; i < m; i++) {
                cin >> a >> b;
                a--; b--;
                graph[a][b] = graph[b][a] = true;
        }

        bool visited[8] = { false };
        visited[0] = true;
        cout << dfs(0, n, visited) << endl;

        return 0;
}


Measured memory_bytes: 256
INF = 10_000_000
N = gets.to_i
H = gets.split.map(&:to_i)
ans = 0

(1 .. 10_000).find do
  l = nil
  r = nil
  w = INF
  
  H.each_with_index.find do |v,i|
    if l.nil?
      if v > 0
        w = v
        l = i
      end
      false
    else
      if v == 0
        r = i
      else
        w = v < w ? v : w
        false
      end
    end
  end
  
  r = N if r.nil?
  if l
    (l ... r).each{|i| H[i] -= w }
    ans += w
  end
  
  H.all?(&:zero?)
end
puts ans

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

const int MAX=60;
int N,ans=0;
vector<int> T[MAX],state(MAX);
stack<int> S;

void DFS(){
    S.push(0);
    state[0]=1;
    int cnt=0;
    while(S.size()){
        int a=S.top();
        bool flag=true;
        for(int i=0;i<T[a].size();i++){
            if(state[T[a][i]]==0){
                S.push(T[a][i]);
                state[T[a][i]]=1;
                flag = false;
                break;
            }
        }
        if(flag){
            state[a]=2;
            cnt++;
            S.pop();
        }
    }
    if(cnt!=N) ans++;
}

int main(){

  int M;
    cin>>N>>M;
    vector<int> A(M),B(M);
    for(int i=0;i<M;i++){
        cin>>A[i]>>B[i];
        A[i]--;B[i]--;
    }
    for(int j=0;j<M;j++){
    for(int i=0;i<N;i++){
        state[i]=0;
        T[i].clear();
    }
    for(int i=0;i<M;i++){
        if(i!=j){
        T[A[i]].push_back(B[i]);
        T[B[i]].push_back(A[i]);
        }
    }
    for(int i=0;i<N;i++){
        sort(T[i].begin(),T[i].end());
    }
        DFS();
}
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll k, ans = 0;
    cin >> k;
    rep(i, 2, k + 1){
        if(!(i % 2)){
            rep(j, 1, k + 1){
                if(j % 2){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}



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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(10)





void solve() {

	double n;		
	cin >> n;
	fix;
	n = n / 3.0;
	cout << pow(n, 3) << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <complex>

using namespace std;
using pii = pair<int, int>;
using ll = long long;

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

	int n;
	cin >> n;
	cout << n * n * n;

	return 0;
}


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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(v)     for(bool p=1;p;p=next_permutation(ALL(v)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<typename T>string join(const vector<T>& v, string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(d.length());}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{if(SZ(v))s<<join(v,", ");return s;}

const ll INF = 1e15;
const ll MOD = 1e9+7;
const double EPS = 1e-10;

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

int main() {
    ll N, x; cin >> N >> x;
    
    if (x == 1 or x == 2 * N - 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
        
        vector<ll> ans(2 * N, -1);
        vector<bool> used(2 * N, false);
        queue<ll> que;
        if (N != 2) {
            if (x != 2) {
                ans[N-1] = x - 1; used[x - 1] = true;
                ans[N]   = x    ; used[x]     = true;
                ans[N+1] = x + 1; used[x + 1] = true;
                ans[N+2] = x - 2; used[x - 2] = true;
            } else {
                ans[N-1] = x + 1; used[x + 1] = true;
                ans[N]   = x    ; used[x]     = true;
                ans[N+1] = x - 1; used[x - 1] = true;
                ans[N+2] = x + 2; used[x + 2] = true;
            }
        }
        
        FOR(i, 1, 2 * N) if (!used[i]) que.push(i);
        FOR(i, 1, 2 * N) if (ans[i] == -1) {
            ll x = que.front(); que.pop();
            ans[i] = x;
        }
        FOR(i, 1, 2*N) cout << ans[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<map>
#include<string>
#include<utility>
#include<vector>
#include<cmath>
#include<algorithm>
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rFOR(i, a, b) for(int i=b; i>=a; i--)
#define MAX 10
typedef long long ll;
using namespace std;

int main(void){
  int a, b, c;  cin >> a >> b >> c;
  cout <<((a<=c&&c<=b)? "Yes":"No") << endl; 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//A
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=0x3f,INF=0x3f3f3f3f; const ll LLINF=0x3f3f3f3f3f3f3f3f;
        ///memset   ///regular use
inline ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b);}
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b);}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a, p;
    cin>>a>>p;
    a*=3;
    a+=p;
    a/=2;
    cout<<a<<"\n";

}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int N,K,head[100010],num_edge,num[100010],val[100010],bj[100010],bbj[100010];
long long int ans=1;

struct edge
{
	int next;
	int to;
}E[200010];

void DFS(int now)
{
	bj[now]=1;
	int bj1=0;
	for(int i=head[now];i>0;i=E[i].next)
	{
		if(bbj[E[i].to]!=0)
		    bj1++;
	}
	if(bbj[now]!=0)
	    bj1++;
	else
	{
		val[now]=K-bj1;
		bbj[now]=1;
		bj1++;
	}
	for(int i=head[now];i>0;i=E[i].next)
	{
		if(bbj[E[i].to]==0)
		{
			val[E[i].to]=K-bj1;
			bbj[E[i].to]=1;
			bj1++;
		}
	}
	for(int i=head[now];i>0;i=E[i].next)
	{
		if(bj[E[i].to]==0)
		    DFS(E[i].to);
	}
	return;
}

int main()
{
	scanf("%d%d",&N,&K);
	if(N==1)
	{
		printf("%d\n",K);
		return 0;
	}
	for(int i=1;i<N;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		num_edge++;
		E[num_edge].next=head[a];
		E[num_edge].to=b;
		head[a]=num_edge;
		num[a]++;
		num_edge++;
		E[num_edge].next=head[b];
		E[num_edge].to=a;
		head[b]=num_edge;
		num[b]++;
	}
	int sum1=0,loc=0,bj2=1;
	for(int i=1;i<=N;i++)
	{
		if(num[i]>sum1)
		{
			sum1=num[i];
			loc=i;
		}
	}
	DFS(loc);    
	for(int i=1;i<=N;i++)
	{
		if(val[i]>0)
		    ans=(ans*val[i])%1000000007;
	    else
		{
			bj2=0;
			break;
		 } 
	}  
	if(bj2>0)
	    printf("%lld\n",ans);
	else
	    printf("0\n");
	return 0;
} 

Measured memory_bytes: 4864
#include<stdio.h>
#include<string.h>

int main( void ) 
{
	char str[1001];
	int q;
	char instruction[10];
	char reStr[1001];
	char tmp;
	int a, b;
	int i;

    scanf( "%s", str );
    scanf( "%d", &q );
	while( q-- ) {
		scanf( "%s", instruction );
		if( 0 == strcmp( instruction, "replace" ) ) {
			scanf( "%d%d%s" , &a, &b, reStr );	
			
			memmove( str+a, reStr, b-a+1 ); 
		} else if( 0 == strcmp( instruction, "reverse" ) ) {
			scanf( "%d%d" , &a, &b );
			for( i=a; i<a+(b-a+1)/2; i++ ) {
				tmp=str[b+a-i];
				str[b+a-i]=str[i];
				str[i]=tmp;
			}
		} else if( 0 == strcmp( instruction, "print" ) ) {
			scanf( "%d%d" , &a, &b );			

			for( i=a; i<=b; i++ ) {
				printf( "%c", str[i] );
			}
			printf( "\n" );
		}		
	}
	
	return 0;
}

Measured memory_bytes: 592
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, D, X; cin >> N >> D >> X;
    vi A(N); REP(i, N) cin >> A[i];

    vi c(D + MGN, 0);
    REP(i,N){
        int j = 0;
        while(true) {
            int day = j * A[i] + 1;
            if (day > D) break;
            else c[day]++;
            j++;
        }
    }

    int ans = 0;
    REP(i,D+1){
        ans += c[i];
    }
    ans += X;

    cout << ans << endl;

    return 0;
}

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

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

def f(n,r):
    res= 1
    for i in range(n-r+1 ,n+1):
        res *=  i
    for i in range(1,r+1):
        res //=i
    #print(n,r,res)
    return int(res)



odd= 0
for a in A:
    if a%2:
        odd+=1

even = N-odd

if P==1:
    if odd==0:
        print(0)
        exit()
    ans = 2**even
    tmp = 0
    for i in range(1, odd + 1, 2):
        tmp += f(odd, i)
        #print(tmp)
    print(ans * tmp)
else:
    ans = 2 ** even
    tmp=0
    for i in range(0, odd+1, 2):
        tmp += f(odd, i)
        #print(tmp)
    print(ans*tmp)


Measured memory_bytes: 3064
n,k=map(int,input().split())
a=list(map(int,input().split()))
check=[[] for i in range(n)]
c=0
g=1
tmp=[]
cy=[]
non=[]

while c<n:
    if check[g-1]==[]:
        c+=1
        tmp.append(g)
        check[g - 1].append(c)
        g=a[g-1]
    else:
        cy=tmp[(check[g-1][0]-1):]
        non=tmp[:(check[g-1][0]-1)]
        break
if k<len(non):
    print(non[k])
    exit()
k-=len(non)
k%=len(cy)


print(cy[k])

Measured memory_bytes: 108472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn =2005; 
const int inf = 0x3f3f3f3f;
ll dp[maxn][maxn];
pair<ll,int> a[maxn];
ll cal(pair<ll,int> a,int pos) {
	return a.fi*abs(a.se-pos);
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	rep(i,1,n) {
		cin>>a[i].fi;
		a[i].fi=-a[i].fi;
		a[i].se=i;
	}
	sort(a+1,a+1+n);
	rep(i,1,n) {
		a[i].fi=-a[i].fi;
		rep(j,0,i-1) {
			int l=j,r=i-1-j;
			dp[l+1][r]=max(dp[l+1][r],dp[l][r]+cal(a[i],l+1));
			dp[l][r+1]=max(dp[l][r+1],dp[l][r]+cal(a[i],n-r));
		}
	}
	ll ans=0;
	rep(i,0,n) ans=max(ans,dp[i][n-i]);
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 26376
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  string s;
  int a=0,sum=0;
  cin>>s;
  for(int i=0;i<4;i++){
    for(int j=0;j<4;j++){
      if(s[i]==s[j] && i!=j) a++;
    }
    if(a!=1){
      cout<<"No"<<'\n';
      return 0;
    }
    sum+=a;
    a=0;
  }
  if(sum!=4) cout<<"No"<<'\n';
  else cout<<"Yes"<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
//関数
const long INF=1000000000000000;
const long MOD=1000000007;
bool check=false;


int main(void){
    long N;
    cin>>N;
    vector<long> A(N),B(N),C(N);
    for(int i=0;i<N;i++) {
        cin>>A.at(i);
        A.at(i)--;
    }
    for(int i=0;i<N;i++) cin>>B.at(i);
    for(int i=0;i<N-1;i++) cin>>C.at(i);
    
    long pre=INF,ans=0;
    for(int i=0;i<N;i++){
        ans+=B.at(A.at(i));
        if(pre+1==A.at(i)) {
            ans+=C.at(pre);
        }
        pre=A.at(i);
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){

  int H[101],T[101];
  int hn,tr,ca,cb;
  int sumh,sumt,mins;
  int i,j;

  while(1){
    mins=100000;
    ca=0;
    cb=0;
    sumt=0;
    sumh=0;
    for(i=0;i<101;i++){
      H[i]=0;
      T[i]=0;
    }

    scanf("%d%d",&tr,&hn);
    if(tr==0 && hn==0)break;

    for(i=0;i<tr;i++){
      scanf("%d",&T[i]);
      sumt+=T[i];
    }
    for(i=0;i<hn;i++){
      scanf("%d",&H[i]);
      sumh+=H[i];
    }
    for(i=0;i<tr;i++){
      for(j=0;j<hn;j++){
	if(((sumt+H[j])-T[i]==(sumh+T[i])-H[j]) && mins>T[i]+H[i]){
	  ca=T[i];
	  cb=H[j];
	  mins=ca+cb;
	}
      }
    }
    if(ca==0 && cb==0){
      printf("-1\n");
    }else{
      printf("%d %d\n",ca,cb);
    }
  }
  return 0;
  }
    

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

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

using namespace std;

typedef long long ll;

const int MAX_N=1e5;
const ll INF=1e18;

int N;
ll C;
ll X[MAX_N+2],V[MAX_N+2];
ll vsum[MAX_N+2];

int main(){
	cin>>N>>C;
	vsum[0]=0;
	X[0]=0;
	V[0]=0;
	REP(i,N){
		cin>>X[i+1]>>V[i+1];
		vsum[i+1]=vsum[i]+V[i+1];
	}
	ll ans=-INF;
	int mx1,mx2;
	mx1=0;
	mx2=0;
	int y=0;
	REP(i,N){
		y++;
		ll ans2=-INF;
		if (vsum[mx1]-X[mx1]<vsum[i]-X[i]){
			mx1=i;
		}
		if (vsum[mx2]-2*X[mx2]<vsum[i]-2*X[i]){
			mx2=i;
		}
		if (X[mx1]>=C-X[y]){
			ans2=vsum[mx1]+(vsum[N]-vsum[y-1])-X[mx1]-(C-X[y])-min<ll>(X[mx1],C-X[y]);
		}
		ans2=max<ll>(ans2,vsum[mx2]+(vsum[N]-vsum[y-1])-X[mx2]-(C-X[y])-min<ll>(X[mx2],C-X[y]));
		ans=max<ll>(ans,ans2);
	}
	if (vsum[mx1]-X[mx1]<vsum[N]-X[N]){
		mx1=N;
	}
	ans=max<ll>(ans,vsum[mx1]-X[mx1]);
	mx1=0;
	mx2=0;
	y=0;
	REP(i,N){
		y++;
		ll ans2;
		if (vsum[mx1]-X[mx1]<=vsum[i]-X[i]){
			mx1=i;
		}
		if (vsum[mx2]-2*X[mx2]<=vsum[i]-2*X[i]){
			mx2=i;
		}
		if (X[mx1]>=C-X[y]){
			ans2=vsum[mx1]+(vsum[N]-vsum[y-1])-X[mx1]-(C-X[y])-min<ll>(X[mx1],C-X[y]);
		}else{
			ans2=vsum[mx2]+(vsum[N]-vsum[y-1])-X[mx2]-(C-X[y])-min<ll>(X[mx2],C-X[y]);
		}
		ans=max<ll>(ans,ans2);
	}
	if (vsum[mx1]-X[mx1]<vsum[N]-X[N]){
		mx1=N;
	}
	ans=max<ll>(ans,vsum[mx1]-X[mx1]);
	cout<<ans<<endl;
	return 0;
}

/*
int main(){
	cin>>N>>C;
	vsum[0]=0;
	X[0]=0;
	V[0]=0;
	REP(i,N){
		cin>>X[i+1]>>V[i+1];
		vsum[i+1]=vsum[i]+V[i+1];
	}
	X[N+1]=C;
	V[N+1]=0;
	vsum[N+1]=vsum[N];
	ll ans=0;
	REP(i,N+1){
		FOR(j,i+1,N+2){
			ans=max(ans,vsum[i]+(vsum[N]-vsum[j-1])-X[i]-(C-X[j])-min(X[i],C-X[j]));
		}
	}
	cout<<ans<<endl;
	return 0;
}
*/

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define read FILE *fp;\
fp=freopen("testcase.txt","r",stdin);
#define ll long long
#define ull unsigned long long
#define sf(n) scanf("%I64d",&n)
#define pf(n) printf("%I64d\n",n)
#define loop for(long long i=0;i<n;i++)
#define lp(b,n) for(long long i=b;i<=n;i++)
#define pb(n) push_back(n)
#define srt(v) sort(v.begin(),v.end())
#define rvs(v) sort(v.begin(), v.end(), greater<long long>());
#define F first
#define S second
#define mp(a,b) make_pair(a,b);
#define fio ios::sync_with_stdio(false); cin.tie(),cout.tie();
ll llmax = numeric_limits<long long>::max();
ll llmin= numeric_limits<long long>::min();
ll mark[5010];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(),cout.tie();
    ll n;
    cin>>n;
    ll a[n+10],b=0,c=0,d=0;
    loop
    {
        cin>>a[i];
    }
    sort(a,a+n);
    loop
    {
        c=__gcd(c,a[i]);
    }
    cout<<c<<endl;
}



Measured memory_bytes: 4424
#include <bits/stdc++.h>
#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;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int x, y, z;
  cin >> x >> y >> z;
  int ans = 0;
  while (z * 2 + y <= x) {
    ans++;
    x -= y + z;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3560
#include<stdio.h>
int main(void) {
	int a, b;
	scanf("%d", &a);
	scanf("%d", &b);

	int count = 0;

	if (a < b) {
		count = count + b;
		b = b - 1;

		if (a < b) {
			count = count + b;

		}
		else if (a == b) {
			count = count + b;
		}
		printf("%d\n", count);
	}else if (a > b) {
		count = count + a;
		a = a - 1;
		if (a > b) {
			count = count + a;
		}
		else if (a == b) {
			count = count + b;
		}
		printf("%d\n", count);
	}
	else if (a == b) {
		count = count + a;
		count = count + b;
		printf("%d\n", count);
	}

	
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;

class Program
{
    static int N;
    static long A;
    static long B;
    static int[] X;

    static void Main()
    {
        long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
        N = (int)input[0];
        A = input[1];
        B = input[2];
        X = Console.ReadLine().Split().Select(int.Parse).ToArray();

        long ans = 0;
        for (int i = 1; i < N; i++)
        {
            ans += Math.Min(B, A * (X[i] - X[i - 1]));
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 21728
A=int(input())
n_l= list(map(int,input().split()))
n_a = [i for i in n_l if i % 2 == 0 and i % 4 != 0]
n_b = [i for i in n_l if i % 4 == 0]
ans = len(n_b)*2+1
if len(n_a) > 0:
    ans+=len(n_a)-1
if A <= ans:
    print("Yes")
else:
    print("No")

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">:", debug_out(__VA_ARGS__)
#define INF LLONG_MAX

int main()
{
  ll n, l;
  cin >> n >> l;
  string str = "";
  vector <string> s(n);
  forll(i, 0, n)
	cin >> s[i];
  sort(s.begin(), s.end());
  forll(i, 0, n)
	str += s[i];
  cout << str;
  debug(str);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W;
cin>>H>>W;
 while(H!=0&&W!=0){
  for(int j=0; j<H; j++){
    for(int i=0; i<W; i++){
        cout<<"#";
    }
    cout<<endl;
  }
  
  cout<<endl;
  cin>>H>>W;
 }
 return 0;
}


Measured memory_bytes: 3084
#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define sqr(x) (x) * (x)
#define cube(x) (z) * (z) * (x)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define itn int

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

template <class T = int>
int in() {
  T x;
  cin >> x;
  return x;
}
int sum(int N) {
  int p = (N * (N + 1) / 2) % MOD;
  return (N * (N + 1) / 2);
}
signed main() {
  int N, K;
  cin >> N >> K;
  int ans = 0;
  FOR(i, K, N + 2) {
    ans -= sum(i - 1);
    ans += sum(N);
    ans -= sum(N - i);
    ans += 1;
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>

typedef long long ll;

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if (a == 1) a += 13;
    if (b == 1) b += 13;

    if (a > b) cout << "Alice";
    else if (a == b) cout << "Draw";
    else cout << "Bob";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int a, b, c, d, ab, cd;
  cin >> a >> b >> c >> d;
  ab = a + b;
  cd = c + d;
  if(ab < cd){
  	cout << "Right";
  }
  else if(ab > cd){
  	cout << "Left";
  }
  else cout << "Balanced";
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,m=0,a=0;
    cin>>N;
    int L[N];
    for(int i=0;i<N;i++) cin>>L[i];
    for(int i=0;i<N;i++){
        if(m<L[i]) m=L[i];
        a+=L[i];
    }
    a=a-m;
    if(m<a) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 256
import math

input_line=input()
num=input_line.split()

A=int(num[0])
B=int(num[1])
H=int(num[2])
M=int(num[3])

kakudo = abs(M*6 - (H*30+0.5*M))
if kakudo >= 180:
    kakudo = 360 - kakudo
kosainn = math.cos(math.radians(kakudo))
#print(kosainn)

c = math.sqrt(A**2+B**2-2*A*B*kosainn)
print(c)

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

int main(){
    int n,l;
    cin>>n>>l;
    vector<string> s(n);
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    sort(s.begin(),s.end());
    for(int i=0;i<n;i++){
        cout<<s[i];
    }
    cout<<endl;
}

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

int main()
{
  ll A; cin >> A;
  ll B; cin >> B;
  ll m; cin >> m;
  ll am = inf;
  vector<ll> a(A);
  for (int i=0; i<A; i++){
    cin >> a[i];
    am = min(am, a[i]);
  }
  ll bm = inf;
  vector<ll> b(B);
  for (int i=0; i<B; i++){
    cin >> b[i];
    bm = min(bm, b[i]);
  }
  ll ans = am + bm;
  vector<ll> x(m);
  vector<ll> y(m);
  vector<ll> c(m);
  for (int i=0; i<m; i++){
    cin >> x[i] >> y[i] >> c[i];
    ans = min(ans, a[x[i]-1]+b[y[i]-1]-c[i]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4224
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

use std::iter::Iterator;

fn main() {
    input! {
        N: usize,
        M: usize,
    }

    let mut  n = N;

    if N == 0 {
        n = 1
    }

    let mut m = M;

    if M == 0 {
        m = 1
    }

    println!("{}", (m* (m-1) + n*(n-1))/2);
  
    
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
   
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        ll n,m,k;cin>>n>>m>>k;
        ll a[n+1],b[1+m];rep(i,n)cin>>a[i];
        a[n]=0;
        rep(i,m)cin>>b[i];
        ll pre[m]={0};
        pre[0]=b[0];
        repA(i,1,m-1)pre[i]+=pre[i-1]+b[i];
        ll ans=0;
        ll s=0;
        for(ll x=0;x<=n;x++){
            if(s>k)break;
            ll r=k-s;
            ans=max(ans,x);
            if(pre[0]>r){
                s+=a[x];
                // break;?
                continue;
            }
            ll u=upper_bound(pre,pre+m,r)-pre;
            ans=max(ans,x+u);
            s+=a[x];
        }
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 8308
#include <stdio.h>
int main(void) {
    int h = 0;
    int w = 0;
    int isfinish = 0;

    while (isfinish != 1) {
        scanf("%d %d", &h, &w);

        if (h == 0 && w == 0) {
            break;
        } else {
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    printf("#");
                }
                printf("\n");
            }
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2084
n=int(input())
s=[]
t=[]
for i in range(n):
    a,b=map(str,input().split())
    s.append(a)
    t.append(int(b))
x=str(input())
for i in range(n):
    if s[i]==x:
        print(sum(t[i+1:]))

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
 
int a[3],b[3],c[3],i;
int main()
{ 
for(i=0;i<3;i++){
cin >> a[i];
}
for(i=0;i<3;i++){
cin >> b[i];
}
for(i=0;i<3;i++){
cin >> c[i];
}
if(a[1]-a[0]==b[1]-b[0] && c[1]-c[0]==b[1]-b[0] && a[2]-a[1]==b[2]-b[1] && c[2]-c[1]==b[2]-b[1] && a[1]-b[1]==a[2]-b[2] && a[0]-b[0]==a[2]-b[2] && c[1]-b[1]==c[2]-b[2] && c[0]-b[0]==c[2]-b[2]){printf("Yes");
}else{printf("No");
}
}

Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
        while(true){
        	String in=br.readLine();
			if(in.equals("0 0")) break;
            String[] a=in.split(" ");
            int n=Integer.parseInt(a[0]);
            int x=Integer.parseInt(a[1]);
            int count=0;
        	for(int i=n;i>0;i--){
            	for(int j=i-1;j>0;j--){
            		int k=x-i-j;
            		if(k<=n && k!=i && k!=j && 0<k && k<j){
            			count++;
            		}
            	}
        	}
        	sb.append(count+"\n");
        }
    	System.out.print(sb);
	}
}

Measured memory_bytes: 18728
import heapq
N,m,S,T = map(int,input().split())
S -= 1
T -= 1
adj_yen = [ [] for _ in range(N) ]
adj_snk = [ [] for _ in range(N) ]

for _ in range(m):
  u,v,y,sn = map(int,input().split())
  u -= 1
  v -= 1
  adj_yen[u].append((v,y))
  adj_yen[v].append((u,y))

  adj_snk[u].append((v,sn))
  adj_snk[v].append((u,sn))

def dijkstra(g,s):
  costs = [float("inf")] * N
  costs[s] = 0
  visited = [False] * N

  q = [(0,s)]
  while q:
    c,n = heapq.heappop(q)
    if visited[n]: continue
    visited[n] = True

    for nei, nc in g[n]:
      if nc+c < costs[nei]:
        costs[nei] = nc+c
        heapq.heappush(q, (nc+c,nei))
  return costs

costs_yen = dijkstra(adj_yen, S)
costs_snk = dijkstra(adj_snk, T)

cur_year = N-1
prev_cost = 10**15
res = [0] * N
while cur_year >= 0:
  tot = costs_yen[cur_year] + costs_snk[cur_year]
  res[cur_year] = 10**15 - min(prev_cost, tot)
  prev_cost = min(prev_cost, tot)
  cur_year -= 1

for r in res:
  print(r)


Measured memory_bytes: 125292