akhauriyash/Code-Regression huggingface dataset:
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define mod 1000000007
#define ld long double
#define ll long long
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
ll n;
pll p[9];
vector < ll > v;
int main(){
    fast,cin>>n;
    for(int i=0;i<n;i++){
        cin>>p[i].F>>p[i].S;
        v.push_back(i);
    }
    ld curr = 0,sum = 0;
    do{
        ld cnt = 0;
        for(int i=0;i<n-1;i++){
            ll x = p[v[i]].F-p[v[i+1]].F;
            ll y = p[v[i]].S-p[v[i+1]].S;
            cnt += (ld)sqrt(x*x+y*y);
        }
        curr += cnt,sum++;
    }while(next_permutation(v.begin(),v.end()));
    cout<<fixed<<setprecision(10)<<curr/sum<<endl;
}


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

int main() {
	string s, t;
	cin >> s >> t;
	for (int i=0; i<s.size(); i++) {
		if (s[i] != t[i]) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int array[3];
    cin >> array[0] >> array[1] >> array[2];
    std::sort(array, array+3);
    cout << array[0] << " " << array[1] << " " << array[2] << endl;
    return 0;
}



Measured memory_bytes: 3144
import java.util.*;
class Main
{
    
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String str1 = sc.next();
        int n = str.length();
        int m = str1.length();
        int res[][] = new int[n+1][m+1];
        for(int i=0;i<=n;i++)
        {
            res[i][0]=0;
        }
        for(int i=0;i<=m;i++)
        {
            res[0][i]=0;
        }
        String rest="";
        int max = -1;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(str.charAt(i-1)!=str1.charAt(j-1))
                {
                    res[i][j]=Math.max(res[i-1][j],res[i][j-1]);
                }
                else
                {
                    res[i][j]=res[i-1][j-1]+1;
                }
            }
        }
        int index = res[n][m]; 
        int temp = index;
        char[] lcs = new char[index]; 
        int i = n; 
        int j = m; 
        while (i > 0 && j > 0) 
        { 
            if (str.charAt(i-1) == str1.charAt(j-1)) 
            { 
                lcs[index-1] = str.charAt(i-1);  
                i--;  
                j--;  
                index--;      
            } 
            else if (res[i-1][j] > res[i][j-1]) 
                i--; 
            else
                j--; 
        } 
        String stt = "";
        for(int k=0;k<temp;k++) 
            {
                stt+= Character.toString(lcs[k]);
            }
            System.out.println(stt);
    }
}

Measured memory_bytes: 88900
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#define f(i, n) for (int i = 0; i < n; i++)
#define fi(i, n) for (; i < n; i++)
#define d(i, n) for (int i = n; i >= 0; --i)
#define ff(i, m, n) for (int i = m; i < n; i++)
#define dd(i, m, n) for (int i = m; i > n; --i)
#define ull unsigned long long
#define mp(i, j) make_pair(i, j)
#define pb(v, a) v.push_back(a)
#define pdd pair<double, double>
#define EPS 1e-6
# define PI 3.14159265358979323846
#define MAXN 501
using namespace std;
int n, m, cnt;
double l, mid, h, d, t1, t2, tmp;
pdd a, b, c, ctr, p[MAXN];
vector< pair<double, int> > in;
double sq(double x) { return x*x; }
double dist(pdd x, pdd y) { return sqrt(sq(x.second-y.second)+sq(x.first-y.first)); }
double theta(pdd y, pdd x) { return atan2(y.second-x.second, y.first-x.first) * 180/PI; }
int overlap() {
  int ret = 0; cnt = 0;
  sort(in.begin(), in.end());
  f(i, in.size()) { cnt += 1-2*in[i].second; ret = cnt > ret ? cnt : ret; }
  return ret;
}
bool poss(double r) {
  f(i, n) {
    in.clear();
    f(j, n) {
      if (j == i || dist(p[i], p[j]) > 2*r) continue;
      a = p[i]; b = p[j]; d = dist(a, b);
      c = mp((a.first+b.first)/2, (a.second+b.second)/2);
      t1 = theta(
        mp(
          c.first + sqrt(sq(r)-sq(d/2))*(a.second-b.second)/d,
          c.second + sqrt(sq(r)-sq(d/2))*(b.first-a.first)/d
        ),
        p[i]
      );
      t2 = theta(
        mp(
          c.first - sqrt(sq(r)-sq(d/2))*(a.second-b.second)/d,
          c.second - sqrt(sq(r)-sq(d/2))*(b.first-a.first)/d
        ),
        p[i]
      );
      if (t1 < 0) t1 += 360;
      if (t2 < 0) t2 += 360;
      if (t1 > t2) { tmp = t1; t1 = t2; t2 = tmp; }
      if (t2 - t1 > 180) {
        pb(in, mp(t2, 0)); pb(in, mp(360, 1));
        pb(in, mp(0, 0)); pb(in, mp(t1, 1));
      } else pb(in, mp(t1, 0)); pb(in, mp(t2, 1));
    }
    if (overlap() + 1 >= m) return 1;
  }
  return 0;
}
int main() {
  cin >> n;
  m = n;
  f(i, n) { cin >> l >> h; p[i] = mp(l, h); }
  if (m == 1) { cout << 0 << endl; return 0; }
  l = 0; h = 2900;
  while(h-l >= EPS) {
    mid = (l+h)/2;
    if (poss(mid)) h = mid;
    else l = mid;
  }
  printf("%.6f\n", mid);
  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define MuhammedAly ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define popc(x) __builtin_popcount(x)
#define LLMX 1e18
#define NotinRange(n,m) i<0||i>=(n)||j<0||j>=(m)
#define mem(x,y) memset((x),(y),sizeof (x));
#define sz(a) (int)(a).size()
#define inFile(s) freopen((s),"r",stdin)
#define	outFile(s) freopen((s),"w",stdout)
#define biEdge(v, a, b) (v)[(a)].pb((b)), (v)[(b)].pb((a))
#define pi (2 * acos(0))
#define X real()
#define Y imag()
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define vec(a,b) ((b) - (a))
#define ll long long
typedef long double ld;
typedef complex<double>point;
typedef tuple<int, int, int> line;
typedef pair<point, point>segment;
typedef vector<point>polygon;
const int N = 18, M = 100 + 5, OO = 0x3f3f3f3f, mod = 1e9 + 7, base = 131, mod2 = 1000136437, mod3 = 998244353;
const double EPS = 1e-9;
ld ans[3005][3005],arr[3005];
ll n;
int main()
{
	MuhammedAly
	cin >> n;
	for(int i =1;i<=n;cin >> arr[i++]);
	ans[1][0] = 1-arr[1];
	ans[1][1] = arr[1];
	for(int i = 2;i<=n;i++)
	{
		for(int j = 0;j<=n;j++)
		{
			if(j<=i)
			{
				ans[i][j] = ans[i-1][j]*(1-arr[i]);
				if(j)
					ans[i][j]+=ans[i-1][j-1]*arr[i];
			} else
				ans[i][j] = 0;
		}
	}
	ld sum = 0;
	for(int i =ceil(n*1.0/2);i<=n;i++)
		sum+=ans[n][i];
	cout << fixed << setprecision(9) << sum;
	return 0;
}


Measured memory_bytes: 141056
#include <stdio.h>
#include <string.h>
int main(void){
    char s[100000];
    scanf("%s", s);

    int n = strlen(s);
    for (int i = 0; i < n - 2; i += 2){
        printf("%c",s[i]);
    }
    if (n % 2 == 1){
    printf("%c\n", s[n - 1]);
    }
    else {
        printf("%c\n", s[n - 2]);
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,a[7],b[7],sa[7]={};
  for(i = 0;i<7;i++){
    scanf("%d%d",&a[i],&b[i]);
    //   if(a[i]<=40 && a[i]>=-40 && b[i]<=40 && b[i]>=-40){
      sa[i] = a[i] - b[i];
      // }
      //  else break;
  }
  for(i = 0;i<7;i++){
    printf("%d\n",sa[i]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;


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

  cout << s.substr(0, 5) << ' '<< s.substr(6, 7) << ' ' << s.substr(14, 5) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int X,A,B;cin >> X >> A >> B;
  if(A-B>=0)cout << "delicious" << endl;
  else if(B-A<=X) cout << "safe" << endl;
  else cout << "dangerous" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <chrono>
#include <random>
#include <stack>
#include <ctime>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

const static int N = 1000;
int main() {
    int n, x;
    llong m[N];
    cin >> n >> x;
    llong sum = 0;
    rep(i, n) {
        cin >> m[i];
        sum += m[i];
    }

    sort(m, m + n);

    cout << n + (x - sum) / m[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n,k;cin>>n;
    string s;cin>>s>>k;
    rep(i,0,n){
        if(s[i]!=s[k-1])s[i]='*';
    }
    rep(i,0,n)cout<<s[i];
    cout<<endl;
}


Measured memory_bytes: 888
str = input()
x,y = map(int,input().split())
dx,dy = 0,0

fn = [len(n) for n in str.split("T")]
dir = [[],[]]

for i in range(len(fn)):
  dir[i%2].append(fn[i])

xdir = dir[0]
ydir = dir[1]

dx = xdir.pop(0)
xdir.sort()
while xdir != []:
  if dx < x:
    dx += xdir.pop()
  else:
    dx -= xdir.pop()
    
ydir.sort()
while ydir != []:
  if dy < y:
    dy += ydir.pop()
  else:
    dy -= ydir.pop()

if dx == x and dy == y:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include <cmath>

int main(){
  int N, M;
  std::cin >> N >> M;
  std::vector<std::vector<long>> s(N, std::vector<long>(2));
  std::vector<std::vector<long>> cP(M, std::vector<long>(2));  
  for(int i = 0; i < N; i++) std::cin >> s.at(i).at(0) >> s.at(i).at(1);
  for(int i = 0; i < M; i++) std::cin >> cP.at(i).at(0) >> cP.at(i).at(1);
  int goal;
  long distance, temp;
  for(int i = 0; i < N; i++){
    goal = 0;
    distance = 200000001;
    for(int j = 0; j < M; j++){
      temp = std::abs(s.at(i).at(0) - cP.at(j).at(0)) + std::abs(s.at(i).at(1) - cP.at(j).at(1));
      if(distance > temp){
        goal = j;
        distance = temp;
      }
    }//j
    std::cout << goal + 1 << std::endl;
  }//i
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 21
#define XMAX 50010


int min(int a,int b){
 if(a<b)return a;

return b;
}



void func(int A[],int n,int m){
int X[XMAX];
int Y[XMAX];
int i,j;

for(i=1;i<=n;i++)X[i]=i;

for(i=1;i<m;i++){/*たて*/



    for(j=1;j<=n;j++){/*よこ*/
       if(j%A[i]==0)X[j]=min(X[j],j/A[i]);
       else if(A[i]<j)X[j]=min(X[j],X[j-A[i]]+1);

      
    }





}


printf("%d\n",X[n]);


return;
}

void swap(int A[],int a,int b){
int temp;
temp=A[a];
A[a]=A[b];
A[b]=temp;

return;
}


void bubblesort(int A[],int m){
int i,j;

for(i=1;i<m;i++){
 for(j=0;j<m-i;j++){
   if(A[j]>A[j+1])swap(A,j,j+1);
 }
}


return;
}







int main(){
int n,m,i;
int A[MAX];

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


bubblesort(A,m);


func(A,n,m);

return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	long long n;cin>>n;
	vector<long long int> l(n+1);
	l[0]=2;l[1]=1;
	for(int i=2;i<=n;i++)l[i]=l[i-1]+l[i-2];
	cout<<l[n]<<endl;
}

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

using namespace std;

int main()
{
	string S, T;  int n, c = 0;

	cin >> S >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> T;

		T += T;

		if (T.find(S) != string::npos) { c++; }
	}

	cout << c << endl;

	return 0;
}

Measured memory_bytes: 1212
K = int(input())

def gcd(a, b):
    while b > 0:
        a,b = b, a%b
    return a

def gcd_3(a,b,c):
    g = gcd(a,b)
    g = gcd(g,c)
    return g

sm = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            sm += gcd_3(a,b,c)

print(sm)


Measured memory_bytes: 68764
#include <iostream>

using namespace std;

int main()
{
	int X, Y; cin >> X >> Y;
	int a, b;
	int cnt = 0;
	for (int a = 0; a <= X; ++a) {
		b = X - a;
		if (2 * a + 4 * b == Y) {
			++cnt;
		}
	}
	if (cnt) {
		cout << "Yes" << endl;;
	}
	else {
		cout << "No" << endl;;
	}
}


Measured memory_bytes: 3132
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Bishop
            var line = ReadLine();
            var H = line[0];
            var W = line[1];
            
            if(H == 1 | W == 1)
            {
                Console.WriteLine(1);
            }
            else if(H % 2 == 1 && W % 2 == 1)
            {
                Console.WriteLine(H * W / 2 + 1);
            }
            else
            {
                Console.WriteLine(H * W / 2);    
            }
        }

        static List<long> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => long.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13268
#include <stdio.h>

int main()
{
	int A, B, X;
	scanf("%d%d%d", &A, &B, &X);
	if(X >= A)
	{
		if(X-A <= B) printf("YES");
		else printf("NO");
	}
	else printf("NO");
	
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		int headIdx = 0;
		int tailIdx = s.length() - 1;
		int headSkip = 0;
		int tailSkip = 0;
		int ans = 0;
		while (true) {
			while (s.charAt(headIdx) == 'x' && headIdx < s.length() - 1) {
				headIdx++;
				headSkip++;
			}
			while (s.charAt(tailIdx) == 'x' && tailIdx > 0) {
				tailIdx--;
				tailSkip++;
			}
			if (s.charAt(headIdx) != s.charAt(tailIdx)) {
				System.out.print(-1);
				return;
			} else if (headIdx >= tailIdx) {
				ans += Math.abs(headSkip - tailSkip);
				break;
			} else {
				ans += Math.abs(headSkip - tailSkip);
				headSkip = 0;
				tailSkip = 0;
				headIdx++;
				tailIdx--;
			}
		}

		System.out.print(ans);
	}

}


Measured memory_bytes: 24832
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def calc(s, bit):
    split_list = [0]
    ans = 0
    for i in range(len(s)-1):
        if 2**i & bit:
            split_list.append(i+1)
    if split_list == [0]:
        return int(s)
    for j, i in enumerate(split_list):
        if j == len(split_list)-1:
            ans += int(s[i:])
            break
        ans += int(s[i:split_list[j+1]])
    return ans

def main(s):
    wa = 0
    for i in range(2**(len(s)-1)):
        wa += calc(s, i)
    return wa

s = input()
print(main(s))


Measured memory_bytes: 27060
#include<iostream>
using namespace std;
int main(void){
  int n, pre=-1, m=0, tmp;
  cin>>n;
  int a[n], b[n+1], c[n];
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=1;i<n+1;i++) cin >> b[i];
  for(int i=1;i<n;i++) cin >> c[i];
  for(int i=0;i<n;i++) {
     tmp = a[i];
     m+=b[tmp];
     if(tmp-pre==1) m+=c[pre];
     pre = tmp;
  }           
  cout << m << endl;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n,r;
    cin>>n>>r;
    
    int count = 0;
    int k = 1;
    while(n >= k) k*=r,count++;
    
    cout << count << endl;
    return 0;
}

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


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A):
    A.sort(reverse=True)
    ans = 0
    for k in range(1, N):
        parent = k // 2
        ans += A[parent]
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 31628
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

l = []
for i in range(3):
    l.append(iil())


f = True
for i in range(1,3):
    dif0 = l[i][0] - l[i-1][0]
    dif1 = l[i][1] - l[i-1][1]
    dif2 = l[i][2] - l[i-1][2]
    if dif0 == dif1 == dif2:
        continue
    f = False

for i in range(1,3):
    dif0 = l[0][i] - l[0][i-1]
    dif1 = l[1][i] - l[1][i-1]
    dif2 = l[2][i] - l[2][i-1]
    if dif0 == dif1 == dif2:
        continue
    f = False

print('Yes' if f else 'No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define fastIO                        \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
// g++ -std=c++11 -O2 -Wall *.cpp -o *
#define eps 1e-9
#define MAX 1000001
#define MOD 1000000007
#define PI 3.14159265358979323846
#define Fi first
#define Se second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(), a.end()
#define Rep(i, a, b) for (int i = a; i < b; ++i)
typedef long long ll;
typedef pair<int, int> pr_int;


int main()
{
	//freopen("input.txt", "r", stdin);
	int n, k;
	cin >> n >> k;
	vector<ll> h(n);
	ll s = 0;
	Rep(i, 0, n) 
		cin >> h[i];
	if (k >= n) {
		cout << 0;
		return 0;
	}
	int m = n - k;
	sort(h.begin(), h.end());
	Rep(i, 0, m)
		s += h[i];
	cout << s;

	return 0;
}



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

#define int long long int
#define ff first
#define ss second
#define pb push_back


int bexp(int a, int b)
{
	int res = 1;

	while (b)
	{
		if (b & 1) res = (res * a);

		a = (a * a); 
		b >>= 1;
	}
	return res;
}

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

#define N 500010
#define MOD 1000000007

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(10);

	int n, a, b;
	cin >> n >> a >> b;

	int ans = (n / (a + b)) * a + min(a, n % (a + b));
	cout << ans << endl;
	return 0;
}

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

signed main() {
	string s;
	cin >> s;
	int res = 10000;
	char c;
	int k;
	int tres;
	for (int i = 0; i < 26; i++) {
		c = 'a' + i;
		k = 0;
		tres = 0;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == c) {
				tres = max(tres, k);
				k = 0;
			}
			else {
				k++;
			}
		}
		tres = max(tres, k);
		res = min(res, tres);
	}
	cout << res << endl;
	return 0;
}

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

int a, b, c;

int dp[203][203][203];
bool use[203][203][203];

inline int dfs(int a, int b, int c) {
	if (a > 150 || b > 150 || c > 150) {
		return INT_MAX;
	}
	if (a == b&&b == c) {
		return 0;
	}
	if (use[a][b][c]) {
		return dp[a][b][c];
	}
	use[a][b][c] = true;
	dp[a][b][c] = dfs(a + 1, b + 1, c);
	dp[a][b][c] = min(dp[a][b][c], dfs(a + 1, b, c + 1));
	dp[a][b][c] = min(dp[a][b][c], dfs(a, b+1, c + 1));
	dp[a][b][c] = min(dp[a][b][c], dfs(a + 2, b, c));
	dp[a][b][c] = min(dp[a][b][c], dfs(a, b + 2, c));
	dp[a][b][c] = min(dp[a][b][c], dfs(a, b, c + 2));
	if (dp[a][b][c] != INT_MAX) {
		dp[a][b][c]++;
	}
	return dp[a][b][c];
}

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

Measured memory_bytes: 32768
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,aa[110000],cnt=0;
string s;
signed main()
{
	cin>>a>>b;
	rep(i,a){
		cin>>aa[i];
		cnt+=min(abs(aa[i]-b),aa[i])*2;
	}
	cout<<cnt;

}

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

#define MAXN (100010)

int n, fa[MAXN], sz[MAXN];
std::set<int> set[MAXN];
std::queue<std::pair<int, int> > queue;

int getfather(int x) { return x == fa[x] ? x : fa[x] = getfather(fa[x]); }

int main(){
	scanf("%d", &n);
	
	for(int i = 1; i <= n; ++ i){
		fa[i] = i;
		sz[i] = 1;
	}
	
	for(int i = 0; i < ((n - 1) << 1); ++ i){
		int u, v;
		scanf("%d%d", &u, &v);
		if(set[u].count(v)){
			queue.push({u, v});
		}
		else{
			set[u].insert(v);
			set[v].insert(u);
		}
	}
	
	while(!queue.empty()){
		int u = queue.front().first, v = queue.front().second;
		queue.pop(); 
		u = getfather(u); v = getfather(v);
		
		if(u == v) continue;
		
		if(sz[u] > sz[v]) std::swap(u, v);
		fa[u] = v;
		sz[v] += sz[u];
		getfather(u);
		
		for(auto w : set[u]){
			set[w].erase(u);
			if(w == v) continue;
			if(set[v].count(w)){
				queue.push({w, v});
			}
			else{
				set[v].insert(w);
				set[w].insert(v);
			}
		}
		
		set[u].clear();
	}
	
	printf(sz[getfather(1)] == n ? "YES\n" : "NO\n");
	return 0;
}

Measured memory_bytes: 24448
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>     // pow
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

// long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a;
// }

// int binary_search(int key) {
//     int ng = -1;
//     int ok = (int)a.size();
//     while(abs(ok - ng) > 1) {
//         int mid = (ok + ng) / 2;
//         if(isOK(mid, key))
//             ok = mid;
//         else
//             ng = mid;
//     }
//     return ok;
// }

// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W
// int MOD = 1000000007;

int main() {
    vector<int> V = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << V[k-1] << endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;int N,a,b,i,V[1<<20],f[1<<20];pair<int,int>R[1<<20];main(){for(cin>>N;i<N;cin>>a>>b,R[i]={a,a+b},i++);for(sort(R,R+N),V[N]=b=1;i--;b=V[i]=(b+V[f[i]=a])%998244353)for(a=i+1;a<N&&R[a].first<R[i].second;a=f[a]);cout<<*V;}

Measured memory_bytes: 5888
import java.util.Scanner

import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def conv(s: String): Seq[Int] = {
    val m = new mutable.HashMap[Char, Int]()
    var n = 0
    s.map { c =>
      if (!m.contains(c)) {
        m(c) = n
        n += 1
      }
      m(c)
    }
  }

  def solve(sc: Scanner): String = {
    val S = sc.next
    val T = sc.next

    if (conv(S) == conv(T)) "Yes" else "No"
  }
}


Measured memory_bytes: 34144
import java.util.Scanner
import scala.math._

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val N = sc.nextInt()
    val As = List.fill(N)(sc.nextLong())
    val minusNum = As.count(_ < 0)
    val result =
      if (minusNum == 0 || minusNum %2 == 0) As.map(abs).sum
      else {
        As.map(abs).sum - As.map(abs).min*2
      }

    println(s"$result")
  }
}

Measured memory_bytes: 69208
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,x;
	cin >> a>>b>>c;
	if (a > b){
		x = a;
		a = b;
		b = x;
	}
	if (a > c){
		x = a;
		a = c;
		c = x;
	}
	if (b > c){
		x = b;
		b = c;
		c = x;
	}
	cout << a << " " << b << " " << c << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;

/*******************************************************/

int main() {
  int n; cin >> n;
  vi a(n);
  int max_i = 0, min_i = 0;
  vector<P> record;
  Loop(i, n) {
    cin >> a[i];
    if (a[max_i] < a[i]) max_i = i;
    if (a[min_i] > a[i]) min_i = i;
  }
  if (a[max_i] >= 0 && a[min_i] < 0) {
    if (a[max_i] >= abs(a[min_i])) {
      Loop(i, n) {
        if (a[i] < 0) {
          a[i] += a[max_i];
          record.push_back({ max_i, i });
        }
      }
    }
    else {
      Loop(i, n) {
        if (a[i] >= 0) {
          a[i] += a[min_i];
          record.push_back({ min_i, i });
        }
      }
    }
  }
  if (a[0] >= 0) {
    Loop1(i, n - 1) {
      record.push_back({ i - 1, i });
    }
  }
  else {
    Loopr(i, n - 1) {
      record.push_back({ i + 1, i });
    }
  }
  cout << record.size() << endl;
  Loop(i, record.size()) {
    cout << record[i].first + 1 << " " << record[i].second + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
vector<int> a;
int dp[405][405];
int pf[405];
int solve(int l,int r){
    int &x = dp[l][r];
    if(x!=-1){
        return x;
    }
    if(r==l){
        return x = 0;
    }
    if(r-l==1){
        return x = a[r] + a[l];
    }
    x = (1LL<<60);
    for(int i=l;i<r;i++){
        int now = solve(l,i) + solve(i+1,r) + pf[r+1] - pf[l];
        x = min(x,now);
    }
    //cout << "dp[" << l << "][" << r << "] = " << x << endl;
    return x;
}
int32_t main(){
    fastio;
    int n;
    cin >> n;
    a.resize(n);
    pf[0] = 0;
    frr(i,n){
        cin >> a[i];
        pf[i+1] = pf[i] + a[i];
    }
    ms(dp,-1);
    cout << solve(0,n-1) << endl;
}

Measured memory_bytes: 1536
while True:
	str = input();
	if (str == '0'):
		break;
	
	scorea = 0;
	scoreb = 0;
	for i in range(1, len(str)):
		if (str[i] == 'A'):
			scorea += 1;
		else:
			scoreb += 1;
	
	if (scorea > scoreb):
		scorea += 1;
	else:
		scoreb += 1;
	
	print(scorea, scoreb);


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

const char nl = '\n';

void solve()
{
    int n, m, k; cin >> n >> m >> k;
    vector<ll> a{0}, b{0};
    int val;
    for (int i = 0; i < n; ++i) {
        cin >> val;
        a.push_back(a[i] + val);
    }
    for (int i = 0; i < m; ++i) {
        cin >> val;
        b.push_back(b[i] + val);
    }
    int ans = 0, j = m;
    for (int i = 0; i <= n; ++i) {
        if (a[i] > k) break;
        while (a[i] + b[j] > k) --j;
        ans = max(ans, i + j);
    }
    cout << ans << nl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 7892
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//CODE TONOY
	char c[6];
	for (int i=0;i<=5;i++){
		cin>>c[i];
	}
	
	if (c[5]==c[4] && c[3]==c[2])
	cout<<"Yes\n";
	
	else
	cout<<"No\n";
				
	return 0;
}

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

t_zero = [-1] * N

t = 0
a = 1

while t_zero[a-1] == -1:
  if t == K:
    break
  t_zero[a-1] = t
  t += 1
  a = A[a-1]
else:
  k = (K - t_zero[a-1]) % (t - t_zero[a-1])
  a = t_zero.index(t_zero[a-1] + k) + 1
print(a)

Measured memory_bytes: 32388
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);
static const int MN = (1<<19);
vector<int> sg_min(2*MN, INF);
vector<int> sg_max(2*MN, INF);

int q_max(int a, int b, int k, int l, int r) {
  if (r <= a || b <= l) return INF;

  if (a <= l && r <= b) {
    return sg_max[k];
  } else {
    int vl = q_max(a, b, k*2+1, l, (l+r)/2);
    int vr = q_max(a, b, k*2+2, (l+r)/2, r);
    return min(vl, vr);
  }
}

int q_min(int a, int b, int k, int l, int r) {
  if (r <= a || b <= l) return INF;

  if (a <= l && r <= b) {
    return sg_min[k];
  } else {
    int vl = q_min(a, b, k*2+1, l, (l+r)/2);
    int vr = q_min(a, b, k*2+2, (l+r)/2, r);
    return min(vl, vr);
  }
}

int main() {
  int N, K; cin >> N >> K;
  vector<int> p(N);
  rep(i, N) cin >> p[i];

  rep(i, N) {
    int k = (1<<18) - 1 + i;
    sg_min[k] = p[i];
    while (k > 0) {
      k = (k-1) / 2;
      sg_min[k] = min(sg_min[k*2+1], sg_min[k*2+2]);
    }
  }

  rep(i, N) {
    int k = (1<<18) - 1 + i;
    sg_max[k] = -p[i];
    while (k > 0) {
      k = (k-1) / 2;
      sg_max[k] = min(sg_max[k*2+1], sg_max[k*2+2]);
    }
  }


  int ans = 1;
  int cnt = 0;
  int cnt_up = 1;

  for (int i = 1; i < K; i++) {
    if (p[i] > p[i-1]) cnt_up = min(K, cnt_up+1);
    else cnt_up = 1;
  }
  if (cnt_up == K) cnt++;

  for (int i = K; i < N; i++) {
    if (p[i] > p[i-1]) cnt_up = min(K, cnt_up+1);
    else cnt_up = 1;

    if ( p[i] > (-q_max(i-K, i, 0, 0, (1<<18))) ) {
      if ( p[i-K] == q_min(i-K, i, 0, 0, (1<<18)) ) {
        continue;
      }
    }
    ans++;
    /*if ( p[i-K+1] == q_min(i-K+1, i+1, 0, 0, (1<<18)) ) {
      if ( p[i] == (-q_max(i-K+1, i+1, 0, 0, (1<<18))) ) cnt++;
    }*/
    if (cnt_up == K) cnt++;
  }

 
  ans -= max(0, cnt-1);

  cout << ans << endl;


  return 0;
}


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

using namespace std;

int main() {
    int N, K;   cin >> N >> K;
    int *a = new int[N];
    for (int i = 0; i < N; i++)
        cin >> a[i];
    vector<bool> dp1(K+1, false);   //今から先手側がひくときに残りi個だった場合の勝ち負け
    dp1[a[0]] = true;
    for (int i = 0; i <= K; i++) {
        for (int j = 0; j < N; j++) {
            if (i >= a[j] && !dp1[i-a[j]])
                dp1[i] = true;
        }
    }

    if (dp1[K])
        cout << "First" << endl;
    else 
        cout << "Second" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int a,b,c,answer,big;
int main() {
    // insert code here...
    cin>>a;
    cin>>b;
    big=b;
    answer=1;
    for (int i=1; i<a; i++) {
        cin>>c;
        if (c>=big) {
            answer++;
        }
        big=max(big,c);
    }
    cout<<answer<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c.at(i);
  int ans = 0;
  rep(bit1, 1 << h){
    rep(bit2, 1 << w){
      int x = 0;
      rep(i, h){
        if((bit1 & (1 << i)) == 0) continue;
        rep(j, w){
          if((bit2 & (1 << j)) == 0) continue;
          if(c.at(i).at(j) == '#')x++;
        }
      }
      if(x == k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
from collections import deque
n = int(input())
board = [0]*n
edge = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
q = deque()
q.append((0,1))
q.append((-1,-1))
while q:
    from_, color = q.popleft()
    if board[from_] != 0:
        continue
    board[from_] = color
    for i in edge[from_]:
        q.append((i,color))
if sum(board) > 0:
    print("Fennec")
else:
    print("Snuke")

Measured memory_bytes: 24980
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};
 
int main(){
  string s;
  cin>>s;
  int ans=0;
  int temp=0;
  REP(i,s.size()){
    if(i%2==0){
      if(s[i]=='0'){
        continue;
      }else{
        ans++;
      }
    }else{
      if(s[i]=='0'){
        ans++;
      }else{
        continue;
      }
    }
  }
  
  REP(i,s.size()){
    if(i%2==0){
      if(s[i]=='1'){
        continue;
      }else{
        temp++;
      }
    }else{
      if(s[i]=='1'){
        temp++;
      }else{
        continue;
      }
    }
  }
  
  ans = min(ans,temp);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for l in range(n)]
ans = 0
for i in range(n-1):
	for j in range(i+1,n):
		tmp = 0
		for l in range(d):
 			tmp += (x[i][l] - x[j][l]) ** 2
		if math.sqrt(tmp)==int(math.sqrt(tmp)):
			ans+=1
print(ans)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))

def f(A):
    for a in A:
        if a == 0:
            print(0)
            return
    v = 1
    for a in A:
        v *= a
        if v > int(1e+18):
            print(-1)
            return
    print(v)
    return

f(A)

Measured memory_bytes: 21472
#include <stdio.h>

int main(){
  int A[100],i,j,n,tmp,count=0;
  int flag = 1;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  while(flag == 1){
    flag = 0;
    for(i=n-1;i>=1;i--){
      if(A[i] < A[i-1]){
        tmp = A[i];
        A[i] = A[i-1];
        A[i-1] = tmp;
        flag = 1;
        count++;
      }
    }
  }
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n%d\n",A[n-1],count);
  return 0;
}



Measured memory_bytes: 2124
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		int i,flag=0;
		char s;
		for(i=0;i<S.length();i++){
			s=S.charAt(i);
			if(i%2==0&&s=='L'){
				flag=1;
			}
			if(i%2==1&&s=='R'){
				flag=1;
			}
		}
		if(flag==0)System.out.print("Yes");
		else System.out.print("No");
	}
	
}

Measured memory_bytes: 22484
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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 long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<double,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N,D,X;cin >> N >> D >> X;
    vector<int> retu(N);
    for(int i = 0;i<N;i++) cin >> retu.at(i);

    for(int i = 0;i<N;i++){
        int now = 1;
        while(now <= D){
            X++;
            now += retu.at(i);
        }
    }

    cout << X << endl;
}


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

const int MAX_N = 1e+5 + 1;

int h[MAX_N], dp[MAX_N];

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
    int h, w;
    cin >> h >> w;
    VI a(h), b(h);
    rep(i, h) {
        cin >> a[i] >> b[i];
        a[i]--;
    }
    multiset<int> nums;
    rep(i, w) nums.insert(0);
    VI dp(w);
    set<int> alive;
    rep(i, w) alive.insert(i);
    rep(i, h) {
        for(auto it = alive.lower_bound(a[i]); it != alive.end() && *it < b[i];) {
            int k = *it;
            it++;
            assert(nums.find(dp[k]) != nums.end());
            alive.erase(k);
            nums.erase(nums.find(dp[k]));
            if (b[i] == w) {
                ;
            } else if (alive.count(b[i]) == 0) {
                alive.insert(b[i]);
                dp[b[i]] = dp[k] + b[i] - k;
                nums.insert(dp[k] + b[i] - k);
            } else {
                if (dp[k] + b[i] - k < dp[b[i]]) {
                    nums.erase(nums.find(dp[b[i]]));
                    nums.insert(dp[k] + b[i] - k);
                    dp[b[i]] = dp[k] + b[i] - k;
                }
            }
        }
        if (nums.empty()) cout << -1 << endl;
        else cout << *nums.begin() + i + 1 << endl;
    }
}

Measured memory_bytes: 24276
using System;

public class Program {
    public static void Main(){
        // Your code here!
        var inputs = new int[5];
        for (var index = 0;index < 5;index++) {
            inputs[index] = int.Parse(Console.ReadLine());
        }
        
        var sum = 0;
        foreach (var input in inputs) {
            sum += input + GetWaitingTime(input);
        }
        
        var lastOrderIndex = 0;
        for (var index = 0;index < 5;index++) {
            if (inputs[index] % 10 == 0) {
                continue;
            }
            if (inputs[index] % 10 < inputs[lastOrderIndex] % 10) {
                lastOrderIndex = index;
            }
        }
        
        if (inputs[lastOrderIndex] % 10 != 0) {
            sum -= (10 - inputs[lastOrderIndex] % 10);
        }
        
        Console.WriteLine(sum);
    }
    
    public static int GetWaitingTime(int input) {
        if (input % 10 == 0) {
            return 0;
        }
        return 10 - input % 10;
    }
}


Measured memory_bytes: 13140
#include<cstdio>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int a[128] = {0};
        for(int i = 0; i <= n; i++) scanf("%d",&a[i]);

        for(int i = 0; i < n; i++){
            int d = i==0?a[2]-a[1]:i==1?a[3]-a[2]:a[1]-a[0];
            int cnt = 0;
            for(int j = 0; j < n; j++){
                if(i == 0){
                    if(j == 0){
                        if(a[2] - a[1] == d)cnt++;
                    }
                    else if(a[j+1] - a[j] == d) cnt++;
                }
                else if(a[j+1==i?j+2:j+1] - a[j==i?j-1:j] == d){
                    cnt++;
                }
            }
            if(cnt == n){
                printf("%d\n",a[i]);
                goto end;
            }
        }
        printf("%d\n",a[n]);
        end:;
    }
    return 0;
}

Measured memory_bytes: 1028
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T& a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector< T > &v) { rep(i, v.size()) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "a.cpp"

int main() {
  ll s, w;
  cin >> s >> w;
  if (w >= s) {
    cout << "unsafe" << el;
  } else {
    cout << "safe" << el;
  }
}


Measured memory_bytes: 3652
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    H, N = MI()
    N = LI()
    Nsum = sum(N)


    if H<=Nsum:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
	main()

Measured memory_bytes: 20512
#include <bits/stdc++.h>
#define int long long
#define all(c) (c).begin(),(c).end()
#define pii pair<long long,long long>
#define endl '\n'

using namespace std;

signed main(){
    std::ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool b=false;
    if(s[0]!=s[1] || s[1]!=s[2]){
        b=true;
    }
    if(b) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ss = Array.make 2 0
let _ = Array.sort (fun x y -> y - x) a_s;
  Array.iteri (fun i a -> ss.(i mod 2) <- ss.(i mod 2) + a) a_s;
  Printf.printf "%d\n" @@ ss.(0) - ss.(1)

Measured memory_bytes: 384