akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <iostream>
using namespace std;
int main(){
	int year, month, day;
	char c1, c2;
	cin >> year >> c1 >> month >> c2 >> day;
	if(year >= 2019 && month >= 5){
		cout << "TBD\n";
	}else{
		cout << "Heisei\n";
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node {
  int key;
  Node* prev;
  Node* next;
};

Node* nil;

void Init() {
  nil = (Node*)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void PrintList() {
  Node* cur = nil->next;
  int isf = 0;
  while (1) {
    if (cur == nil) break;
    if (isf++ > 0) printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void Insert(int key) {
  Node* x = (Node*)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

Node* SearchNode(int key) {
  Node* cur = nil->next;
  while (cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void DeleteNode(Node* n) {
  if (n == nil) return;
  n->prev->next = n->next;
  n->next->prev = n->prev;
  free(n);
}

void Delete(int key) {
  DeleteNode(SearchNode(key));
}

void DeleteFirst() {
  DeleteNode(nil->next);
}

void DeleteLast() {
  DeleteNode(nil->prev);
}

int main() {
  int n;
  scanf("%d", &n);

  char cmd[16];
  int key;

  Init();
  for (int i = 0; i < n; i++) {
    scanf("%s", cmd);
    if (strcmp(cmd, "insert") == 0) {
      scanf("%d", &key);
      Insert(key);
    } else if (strcmp(cmd, "delete") == 0) {
      scanf("%d", &key);
      Delete(key);
    } else if (strcmp(cmd, "deleteFirst") == 0) {
      DeleteFirst();
    } else if (strcmp(cmd, "deleteLast") == 0) {
      DeleteLast();
    }
  }
  PrintList();

  return 0;
}


Measured memory_bytes: 33816
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  ll N;
  cin >> N;
  vector<pair<ll,ll> >a;
  for(ll i=1;i*i<=N;i++){
    if(N%i==0){
      a.push_back(make_pair(i,N/i));
    }
  }
  ll sum=2*pow(10,12);
  for(ll j=0;j<a.size();j++){
    ll t = a[j].first-1 + a[j].second - 1;
    if(sum>t) sum=t;
  }
  cout << sum << endl;
}


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

using namespace std;

int main()
{
    int n, count{0}, get{0};
    cin >> n;
    for (int i{0}; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        if (a == b)
        {
            count++;
            if (count >= 3)
            {
                get++;
            }
        }
        else
            count = 0;
    }
    if (get >= 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
int main() {
	ll a, b;
	while(scanf("%lld %lld", &a, &b) != EOF) {
		if(a < b) swap(a, b);
		ll m = a, n = b;
		while(n) {
			ll t = m / n;
			swap(m -= t * n, n);
		}
		printf("%ld ", m);
		ll c = b / m;
		cout << a * c << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;
using System.Text.RegularExpressions;
using System.Runtime.Serialization.Formatters.Binary;

namespace atcorder2
{
    [Serializable]
    static class  Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long Gcd(long x,long y)
        {
            if (x < y) Gcd(y, x);
            while (y > 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long Lcm(long x,long y)
        {
            return x * y / Lcm(x, y);
        }

        public static bool IsLowercaseAlphabet(char target)
        {
            return new Regex("^[a-z]+$").IsMatch(target.ToString());
        }

        public static T DeepCopy<T>(this T src)
        {
            using (var memoryStream = new MemoryStream())
            {
                var binaryFormatter = new BinaryFormatter();
                binaryFormatter.Serialize(memoryStream, src);
                memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
                return (T)binaryFormatter.Deserialize(memoryStream);
            }
        }


        public static bool Prime(long n)
        {
            if (n < 2) return false;
            else if (n == 2) return true;
            else if (n % 2 == 0) return false;

            for (int i = 3; i <=Math.Sqrt(n); i++)
            {
                if (n % i == 0) return false;
            }
            return true;
        }
        


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var q = Reads();
            var n = q[0];
            var m = q[1];
            var x = Reads();
            Array.Sort(x);
            var y = new long[m - 1];
            for (int i = 0; i < m-1; i++)
            {
                y[i] = Math.Abs(x[i + 1] - x[i]);
            }
            Array.Sort(y);
            long ans = 0;

            for (int i = 0; i < m - n; i++)
            {
                ans += y[i];
            }
            WriteLine(ans);
            
            
            
           

           


            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 28212
n=int(input())
t,a=map(int,input().split())
for i in range(1,n):
  c,d=map(int,input().split())
  if(t/c>a/d):
    if(t%c==0):times=t//c
    else:times=t//c+1
  else:
    if(a%d==0):times=a//d
    else:times=a//d+1
  #print(times)
  t,a=c*times,d*times
  #print(t,a)
print(t+a)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
  string s;
  int p=0,d=0,a=0;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?') {
      cout << "D";
    }else{
      cout << s[i];
    }
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

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

    int n;

    cin >> n;

    if (n < 1200) cout << "ABC";
    else cout << "ARC";

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
drinks = [list(map(int, input().split())) for _ in range(n)]

drinks = sorted(drinks, key = lambda x: x[0])
ans = 0
for a, b in drinks:
    if b < m:
        ans += a*b
    elif b == m:
        ans += a*b
        break
    else:
        ans += a*m
        break
    m -= b
print(ans)


Measured memory_bytes: 29788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define agewari(a, b) ((ll)a + ((ll)b - 1)) / b
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    ll n;
    cin>>n;
    vector<ll> A(n);
    rep(i, n) cin >> A[i];
    ll now = 1000;
    rep(i, n - 1)
    {
        if (A[i] < A[i + 1])
        {
            ll tmp = (now / A[i]);
            now = now % A[i];
            now += tmp * A[i + 1];
        }
    }
    cout << now << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
long int frog_jump(vector<int>arr)
{
	int n=arr.size();
	vector<int>value(n);
	value[0]=0;
	value[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++)
	{
		value[i]=min(value[i-1]+abs(arr[i]-arr[i-1]),value[i-2]+abs(arr[i]-arr[i-2]));
	}
	return value[n-1];
}
int main()
{
	long int n;
	cin>>n;
	vector<int>arr(n);
	for(int i=0;i<n;i++)
	cin>>arr[i];
	cout<<frog_jump(arr);
	return 0;
}



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

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

int sort(const void *a ,const void *b){
  return *(int*)a - *(int*)b;
}

int main(){

  int n,sum = 0;
  scanf("%d",&n);

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

  qsort(p,n,sizeof(int),sort);

  for(int i = 0; i < n-1; ++i){
    sum += p[i];
  }
  sum += p[n-1] / 2;

  printf("%d",sum);


  return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> p;
const ll inf = ll(1e18)+1;


int main(){
  int n; ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep (i,n) cin >> a[i];
  sort(a.begin(),a.end());
  ll l = -inf, r = inf, c;
  
  while(l+1 < r){
    ll x = (l+r)/2;
    bool ok =[&]{
      ll tot = 0;
      rep(i,n){
        if(a[i] < 0){
          int l = -1, r = n;
          while(l+1<r){
            int c = (l+r)/2;
            if (a[c]*a[i] < x) r = c; else l = c;
          }
          tot += n-r;
        } else{
          int l = -1, r = n;
          while(l+1<r){
            int c = (l+r)/2;
            if(a[c]*a[i] < x) l = c; else r = c;
          }
          tot += r;
        }
        if(a[i]*a[i] < x) tot--;
      }
      tot /= 2;
      return tot < k;
    }();
    if (ok) l = x; else r =x;
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,v,p;
int m,a[100005];
bool cmp(int a,int b)
{
	return a>b;
}
int l,r,mid;
int ans;
bool check(int x)
{
	if(x<=p) return true;
	if(a[x]+m<a[p]) return false;
	int now=m*(p-1+n-x+1);
	for(int i=p+1;i<x;i++){
		now+=a[x]+m-a[i];
	}now+=a[x]+m-a[p];
	return now>=m*v;
}
signed main()
{
	cin>>n>>m>>v>>p;
	for(int i=1;i<=n;++i)
	cin>>a[i];
	sort(a+1,a+1+n,cmp);
	l=1,r=n;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid))
		{
			l=mid+1;
			ans=mid;
		}
		else
		r=mid-1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4532
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j]:
                if len(set([L[i], L[j], L[k]])) == 3:
                    ans += 1
print(ans)

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

using namespace std;

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

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

int main()
{
    int n, k;
    cin >> n >> k;
    vi v(n), dp(n, INT_MAX);
    for(auto &z : v)cin >> z;

    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        for(int j = i - 1; j >= max(0, i - k); j--)
        {
            //cout << dp[i] << '\n';
            //cout << dp[j] + abs(v[i] - v[j]) << '\n';
            dp[i] = min(dp[i], dp[j] + abs(v[i] - v[j]));
            //cout << dp[i] << '\n';
        }
    }

    cout << dp[n - 1] << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int N=2e5+4;
const ll MOD=1e9+7;
int n,k;
ll sum[N],ans;
inline int read() {
	int x=0;char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x;
}
int main() {
	n=read(),k=read();
	for (register int i=1;i<=n;++i)
		sum[i]=sum[i-1]+i;
	for (int i=k;i<=n+1;++i) {
		ll l=sum[i-1];
		ll r=sum[n]-sum[n-i];
		(ans+=r-l+1)%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 5148
package main

import (
  "fmt"
)

func main() {
  var s,t string

  fmt.Scanf("%s", &s)
  fmt.Scanf("%s", &t)

  tLen := len(t)
  x := t[:tLen-1]

  if x == s {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,p;cin>>n>>p;
  map<int64_t,int> m;
  for (int64_t i = 2; i*i <= p; i++) {
    while (p % i == 0) { m[i]++; p /= i;}
  }
  if (p != 1) m[p] = 1;
  ll least = 0;
  for (auto i=m.begin(); i != m.end(); ++i) {
    if (least<i->second) least=i->second;
  }
  if (least<n) print(1);
  else {
    ll ans = 1;
    for (auto i=m.begin(); i != m.end(); ++i) {
      if (i->second>=n) {
        ll pow = (i->second)/n, k=i->first; rep(i,pow) ans*=k;
      }
    }
    print(ans);
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define ull unsigned long long 

int main(){
  string s;cin>>s;
  if(s=="AAA" || s=="BBB")
    cout<<"No";
  else
    cout<<"Yes";
}
    
    
  

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

int stack[1000];
int top=-1;

void push(int v){
	top++;
	stack[top]=v;
}

int pop(){
	if (top < 0){
		return -1;
	}
	top--;
	return stack[top+1];
}

int main(){
	
	string str;
	while (cin >> str){
		if (str == "+"){
			push(pop()+pop());
		}else if(str == "*"){
			push(pop()*pop());
		}else if(str == "-"){
			int n1=pop();
			int n2=pop();
			push(n2-n1);
		}else{
			push(atoi(str.c_str()));
		}
	}
	cout << pop() << endl;
	return 0;
}




Measured memory_bytes: 3148
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>


#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

using namespace std;

ll modd = 1000 * 1000 * 1000 + 7;

template<class T>
T fastpower(T x, ll pw) {
    T w = x, res = 1;
    while (pw>0) {
        if (pw&1) {
            res *= w; res %= modd;
        }
        pw >>= 1;
        w *= w; w %= modd;
    }
    return res;
}


int main()   {


      ios_base::sync_with_stdio(false);

      cout.precision(17);
      mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no



//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(s);
        vector<ll> ans(s+1);
        ans[0] = 1;
        ans[1] = 0;
        ans[2] = 0;
        forr(i,3,s-2) {
            ans[i] = 0;
            forr(j,3,s) {
                if (i-j<0) {break;}
                ans[i] += ans[i-j]; ans[i] %= modd;
            }
        }
        cout << (ans[s] % modd) << endl;
    }
    return 0;
}


Measured memory_bytes: 3644
N = int(input())
H = []

h = input().split(" ")
for i in range(0,len(h)):
    H.append(int(h[i]))

dp = [0]

def chmin(a,b):
    if(a>b):
        return b
    return a

for i in range(0,N-1):
    dp.append(10**10)

for r in range(0,N):
    dp[r] = chmin(dp[r],dp[r-1] + abs(H[r]-H[r-1]))
    if(r>1):
        dp[r] = chmin(dp[r],dp[r-2] + abs(H[r]-H[r-2]))


print(dp[N-1])


Measured memory_bytes: 17952
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }


int main(void) {
    int N;
    cin>>N;
    string s;
    cin>>s;
    Int r = 0,g = 0,b = 0;

    for(int i = 0;i < N;i++) {
        if(s[i] == 'R')
            r++;
        else if(s[i] == 'G')
            g++;
        else
            b++;
    }

    Int ans = r*g*b;
    for(int i = 0;i < N-2;i++) {
        for(int j = i+1;j < N-1;j++) {
            int k = 2*j-i;
            if(k < N) {
                if(s[i] != s[j] && s[j] != s[k] && s[i] != s[k])
                    ans--;
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int main(){
    speed;
    ll a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(!a) cout<<1;
    if(!b) cout<<2;
    if(!c) cout<<3;
    if(!d) cout<<4;
    if(!e) cout<<5;
}


Measured memory_bytes: 3584
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef string str;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
	
	int n;
	cin >> n;
	string s;
	string t;
	cin >> s >> t;
	for(int i = 0; i < n+n; i++){
		if(i%2==0){
			cout << s[i/2]; 
		}
		else cout << t[i/2];
	}
}


Measured memory_bytes: 256
s = input()
n = len(s)
r_i = 0
odd, even = 0, 0
ans = [0] * n
for i in range(n):
    if i % 2 == 0: even += 1
    else: odd += 1
    if i == n - 1 or s[i] != s[i + 1]:
        if s[i] == 'R': r_i = i
        if r_i % 2 == 1: even, odd = odd, even
        ans[r_i] += even
        ans[r_i + 1] += odd
        odd, even = 0, 0
print(*ans, sep=' ')

Measured memory_bytes: 11592
import numpy as np

N, W = map(int, input().split())
WV = [[int(i) for i in input().split()] for i in range(N)]

max_value = np.sum(np.array(WV), axis=0)[1]

# dp[i]: 価値iを達成するのに必要な重さの最小値
dp = np.full(max_value+1, W+1, dtype='int64')

dp[0] = 0
for w, v in WV:
    # 価値i(0 <= i <= max_value-v)の時の重さの最小値に対し
    # 次の荷物を入れて、価値i+vの時の重さの最小値を更新
    np.minimum(dp[:-v]+w, dp[v:], out=dp[v:])

print(np.max(np.where(dp<=W)))

Measured memory_bytes: 13960
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

char path[100][100];
int m,hit,d,n;
int gFrom;

void dfs(int y,int from){
	if(y>=d+1){
		//cout << from << endl;
		gFrom = from;
		return;
	}

	bool isMove = false;

	for(int to=from-1;to<=from+1;to++){
		if(to == from) continue;

		if(to < 1 || to > n) continue;
		if(to > from && path[y][to-1] == '1'){
			dfs(y+1,to);
			isMove = true;
			break;
		}
		else if(to < from && path[y][to] == '1'){
			dfs(y+1,to);
			isMove = true;
			break;
		}
	}

	if(!isMove) dfs(y+1,from);
}

int main(){

	while(~scanf("%d",&n)){
		if(n==0) break;
		scanf("%d %d %d",&m,&hit,&d);
		for(int y=1;y<=d;y++){
			char buf[32];
			scanf("%s",buf);
			for(int x=1;x<=n-1;x++){
				path[y][x] = buf[x-1];
			}
		}

		gFrom = 0;
		dfs(1,m);
		if(gFrom == hit){
			printf("%d\n",0);
			continue;
		}

		for(int y=1;y<=d;y++){
			for(int x=1;x<n;x++){
				if(x==1){
					if(path[y][x] == '0'){
						if(path[y][x+1] == '1') continue;
						path[y][x] = '1';
						gFrom = 0;
						dfs(1,m);
						if(gFrom == hit){
							printf("%d %d\n",y,x);
							goto last;
						}
						path[y][x] = '0';
					}
				}
				else if(x==n-1){
					if(x-1 < 1) continue;
					if(path[y][x-1] == '0'){

						if(path[y][x] == '1') continue;
						path[y][x] = '1';
						gFrom = 0;
						dfs(1,m);
						if(gFrom == hit){
							printf("%d %d\n",y,x);
							goto last;
						}
						path[y][x] = '0';
					}
				}
				else{
					if(x-1 < 1 || x+1 > n-1) continue;
					if(path[y][x-1] != '1'
						&& path[y][x+1] != '1'){
							if(path[y][x] == '1') continue;
							path[y][x] = '1';
							gFrom = 0;
							dfs(1,m);
							if(gFrom == hit){
								printf("%d %d\n",y,x);
								goto last;
							}
							path[y][x] = '0';
					}
				}
			}
		}

		printf("%d\n",1);
last:;
		//cout << dfs(1,m) << endl;
		//cout << dfs(1,m) << " " <<"\n";
	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  int res = 0;
  for (int i = 0; i < N - 1; i++) {
    if (A[i] == A[i + 1]) {
      res++;
      A[i + 1] = -1;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979323846;

int main() {
  int K, T;
  cin >> K >> T;
  vector<int> a(T);
  for (int i=0; i<T; i++) cin >> a[i];
  sort(a.begin(), a.end());
  // 最大勢力がa[T-1]以外に存在するかどうか
  bool exist = false;
  for (int i=T-2; i>=0; i--) {
    if (a[i]==a[T-1]) {
      exist = true;
      break;
    }
  }
  if (exist) cout << 0 << endl;
  else {
    if (2*a[T-1]-1<=K) cout << 0 << endl;
    else cout << 2*a[T-1]-K-1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
def main():
    A, B = (int(x) for x in input().split())
    if (A % 2 == 0 and B % 2 == 0) or (A % 2 == 1 and B % 2 == 1):
        ans = int((A + B) / 2)
    else:
        ans = "IMPOSSIBLE"
    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
    int MOD = 1000000007;
    int n;
    cin >> n;
    vector<long long> vec(n);
    for (int i=0; i < n; i++) cin >> vec.at(i);

    vector<long long> rui(n+1);
    for (int i=0; i < n; i++) rui[i+1] = rui[i]+vec[i];

    long long ans = 0;
    long sum;
    for (int i=0; i < n; i++) {
        sum = (rui[n] - rui[i+1])%MOD;
        ans += vec[i]*sum;
        ans %= MOD;
    }

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



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

using namespace std;

int n, a[200005], f[200005];
long long k;

bool check(long long v) {
	long long tot = 0;
	for (int i = 0; i < n; i++) {
		//x * fi <= v
		long long x = v / f[i];
		tot += max(0LL, 1LL * a[i] - x);
	}
	
	return tot <= k;
}

int main() {
	scanf("%d%lld", &n, &k);
	
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	for (int i = 0; i < n; i++) scanf("%d", &f[i]);
	
	sort(a, a + n);
	sort(f, f + n, greater<int>());
	
	long long lb = -1;
	long long ub = 1e12 + 1;
	
	while (ub - lb > 1) {
		long long mid = (lb + ub) / 2;
		
		if (check(mid)) ub = mid;
		else lb = mid;
	}
	
	printf("%lld\n", ub);
}


Measured memory_bytes: 1792
S=input()

if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
else:
    print(1)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename flow_t >
struct Dinic {
  const flow_t INF;

  struct edge {
    int to;
    flow_t cap;
    int rev;
    bool isrev;
  };

  vector< vector< edge > > graph;
  vector< int > min_cost, iter;

  Dinic(int V) : INF(numeric_limits< flow_t >::max()), graph(V) {}

  void add_edge(int from, int to, flow_t cap) {
    graph[from].emplace_back((edge) {to, cap, (int) graph[to].size(), false});
    graph[to].emplace_back((edge) {from, 0, (int) graph[from].size() - 1, true});
  }

  bool bfs(int s, int t) {
    min_cost.assign(graph.size(), -1);
    queue< int > que;
    min_cost[s] = 0;
    que.push(s);
    while(!que.empty() && min_cost[t] == -1) {
      int p = que.front();
      que.pop();
      for(auto &e : graph[p]) {
        if(e.cap > 0 && min_cost[e.to] == -1) {
          min_cost[e.to] = min_cost[p] + 1;
          que.push(e.to);
        }
      }
    }
    return min_cost[t] != -1;
  }

  flow_t dfs(int idx, const int t, flow_t flow) {
    if(idx == t) return flow;
    for(int &i = iter[idx]; i < graph[idx].size(); i++) {
      edge &e = graph[idx][i];
      if(e.cap > 0 && min_cost[idx] < min_cost[e.to]) {
        flow_t d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  flow_t max_flow(int s, int t) {
    flow_t flow = 0;
    while(bfs(s, t)) {
      iter.assign(graph.size(), 0);
      flow_t f = 0;
      while((f = dfs(s, t, INF)) > 0) flow += f;
    }
    return flow;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      for(auto &e : graph[i]) {
        if(e.isrev) continue;
        auto &rev_e = graph[e.to][e.rev];
        cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << ")" << endl;
      }
    }
  }
};

int main() {
  int N;
  cin >> N;
  Dinic<int> g(2*N+2);
  pair<int,int> red[N];
  int a,b;
  rep(i,N){
    cin >> a >> b;
    red[i]=mp(a,b);
    g.add_edge(2*N,i,1);
  }


  rep(j,N){
    cin >> a >> b;
    rep(i,N){
      if(a > red[i].first && b > red[i].second){
	g.add_edge(i,j+N,1);
      }
    }
    g.add_edge(j+N,2*N+1,1);
  }
  //  cout << " "<< endl;
  cout << g.max_flow(2*N,2*N+1) << endl;
  
}


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

#define swap(type,x,y) do{type t=x; x=y; y=t;}while(0)

void sort(long a[][2],long left,long right, long num){
	long pl=left;
	long pr=right;
	long x=a[(pl+pr)/2][num];
	
	do{
		while(a[pl][num]<x) pl++;
		while(a[pr][num]>x) pr--;
		if(pl<=pr){
			swap(long,a[pl][0],a[pr][0]);
			swap(long,a[pl][1],a[pr][1]);
			pl++;
			pr--;
		}
	}while(pl<=pr);
	if(left<pr) sort(a,left,pr,num);
	if(pl<right) sort(a,pl,right,num);
}

int main(void){
	long i,j,time=0,ans=0;
	
	long n;
	scanf("%ld",&n);
	
	long t[n+1][2];
	
	for(i=1;i<=n;i++){
		scanf("%ld%ld",&t[i][0],&t[i][1]);
	}
	
	sort(t,1,n,1);
	
	for(i=1;i<=n;i++){
		time+=t[i][0];
		if(time>t[i][1]){
			ans=1;
			break;
		}
	}
	
	if(ans==0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 3328
package main
import(
  "fmt"
  "sort"
)
func main(){
  var n, i int
  var temp float64
  fmt.Scan(&n)
  a:=make([]float64, n)
  for i=0;i<n;i++{
    fmt.Scan(&a[i])
  }
  sort.Float64Slice(a).Sort()
  for i=0;i<n-1;i++{
    temp=(a[i]+a[i+1])/2
    a[i+1]=temp
  }
  fmt.Println(temp)
}


Measured memory_bytes: 512
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

int calc(int n, bool[][] adj) {

    bool isBridge() {
        auto uf = new UnionFind(n);
        int[] nodes = [0];
        bool[int] used;
        while (nodes.length > 0) {
            int node = nodes[0];
            nodes = nodes[1 .. $];

            if (node in used)
                continue;
            used[node] = true;

            for (int i = 0; i < n; i++) {
                if (adj[node][i]) {
                    uf.unite(node, i);
                    nodes ~= i;
                }
            }
        }

        for (int i = 1; i < n; i++) {
            if (!uf.isSame(0, i)) {
                return true;
            }
        }
        return false;
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (adj[i][j]) {
                adj[i][j] = adj[j][i] = false;
                ans += isBridge();
                adj[i][j] = adj[j][i] = true;
            }
        }
    }
    return ans;
}

void main() {
    auto nm = readints;
    int n = nm[0], m = nm[1];

    auto adj = new bool[][](n, n);
    for (int i = 0; i < m; i++) {
        auto ab = readints;
        int a = ab[0] - 1, b = ab[1] - 1;

        adj[a][b] = adj[b][a] = true;
    }

    writeln(calc(n, adj));
}

class UnionFind {
    private int[] _data;

    this(int n) {
        _data = new int[](n + 1);
        _data[] = -1;
    }

    int root(int a) {
        if (_data[a] < 0)
            return a;
        return _data[a] = root(_data[a]);
    }

    bool unite(int a, int b) {
        int rootA = root(a);
        int rootB = root(b);
        if (rootA == rootB)
            return false;
        _data[rootA] += _data[rootB];
        _data[rootB] = rootA;
        return true;
    }

    bool isSame(int a, int b) {
        return root(a) == root(b);
    }

    int size(int a) {
        return -_data[root(a)];
    }
}


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

int main(){
	int n;cin>>n;
	if(n==22)cout<<"Christmas Eve Eve Eve"<<endl;
  	else if(n==23)cout<<"Christmas Eve Eve"<<endl;
  	else if(n==24)cout<<"Christmas Eve"<<endl;
  	else cout<<"Christmas"<<endl;
  	return 0;
}

Measured memory_bytes: 256
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Math.pow;
import static java.lang.Math.sqrt;
import static java.lang.System.out;
import java.io.File;
import java.util.Scanner;


public class Main extends BaseExe {

    public static void main(String[] args) {
        new Main().exeSysIn();
    }

    @Override
    protected void execute(Scanner scan) {
        int dataCount = parseInt(scan.nextLine());
        for (int i = 0; i < dataCount; i++) {
            double[] vertexList = getVertexList(scan);
            double[] pXY = getXY(vertexList);
            out.printf("%.3f %.3f %.3f\n", pXY[0], pXY[1], getR(vertexList, pXY));
        }
    }

    private double[] getVertexList(Scanner scan) {
        String[] vertexStrList = scan.nextLine().split(" ");
        double[] vertexList = new double[6];
        for (int i = 0; i < 6; i++) {
            vertexList[i] = parseDouble(vertexStrList[i]);
        }
        return vertexList;
    }

    private double[] getIn(double[] vertexList) {
        double ax = vertexList[0];
        double ay = vertexList[1];
        double bx = vertexList[2];
        double by = vertexList[3];
        double cx = vertexList[4];
        double cy = vertexList[5];
        double abDX = bx - ax;
        double abDY = by - ay;
        double acDX = cx - ax;
        double acDY = cy - ay;
        double[] in = { abDX, abDY, getB(ax, ay, bx, by), acDX, acDY, getB(ax, ay, cx, cy) };
        return in;
    }

    private double getR(double[] vertexList, double[] pXY) {
        return sqrt(pow(vertexList[0] - pXY[0], 2) + pow(vertexList[1] - pXY[1], 2));
    }

    private double[] getXY(double[] vertexList) {
        double[] in = getIn(vertexList);
        double deno = (in[1] * in[3] - in[0] * in[4]);
        double[] xy = new double[2];
        xy[0] = judge((in[1] * in[5] - in[2] * in[4]) / deno);
        xy[1] = judge((in[0] * in[5] - in[2] * in[3]) / (deno * -1));
        return xy;
    }

    public double judge(double num) {
        return (num == -0.0) ? 0.0 : num;
    }

    private double getB(double ax, double ay, double bx, double by) {
        return (pow(by, 2) - pow(ay, 2) + pow(bx, 2) - pow(ax, 2)) / 2;
    }

}


abstract class BaseExe {

    public void exeSysIn() {
        try (Scanner scan = new Scanner(System.in)) {
            execute(scan);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void exeFileIn(String inDataPath) {
        try (Scanner scan = new Scanner(new File(inDataPath))) {
            execute(scan);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    protected abstract void execute(Scanner scan);
}

Measured memory_bytes: 26332
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int n,a[505],b[505];
cin>>n;
rep(i,0,n-1)cin>>a[i]>>b[i];

rep(i,0,n-3)
{
	if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2])
	{
		ol("Yes");return 0;
	}
}
ol("No");
return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  int m1, d1; cin >> m1 >> d1;
  int m2, d2; cin >> m2 >> d2;
  int result = m1 == m2 ? 0 : 1;
  cout << result << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define mod 1000000007
ll a[200000];
int main()
{
    ios_base::sync_with_stdio(false);//this works only
    cin.tie(NULL);// when first all inputs are from user
    cout.tie(NULL);//you will see all outputs afterwards
    ll n,m,v,p;
    cin>>n>>m>>v>>p;
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    }
    sort(a,a+n,greater<ll>());
    ll ans=p;
    //v--;
    ll tmp=max((ll)0,v-p);
    v=tmp;
    for (ll i = p; i <n; ++i)
    {
    	ll lef=n-i-1;
    	if(v>0)
    	{
    		tmp=max(v-lef,(ll)0);
    	}
    	else
    	tmp=0;
    	ll newval=a[i]+m;//giving m votes
    	if(newval<a[p-1])
    	{
    		break;
    	}
    	if(tmp==0)
    	{
    		if(newval>=a[p-1])
    			ans++;
    		else 
    			break;
    		continue;
    	}
    	ll votes=tmp*m;
    	int flag=0;
    	for(ll j=i-1;j>=(p-1);j--)
    	{
    		votes-=min(m,newval-a[j]);
    		if(votes<=0)
    		{
    			flag=1;
    			break;
    		}
    	}
    	if(flag==0) break;
    	else ans++;
    }
    cout<<ans;
    return 0;
}

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

int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << (a[0] == a[1] + a[2] || a[0] + a[1] == a[2] ? "Yes" : "No") << endl;
}

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

#define int long long

#define REP(i,n) for(int i=0;i<n;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 pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 999999999999

using namespace std;

int32_t main(){
	int n, p;
	vector<int> a;
	cin >> n >> p;

	bool flag=true;
	REP(i, n){
		int x;
		cin >> x;
		a.pb(x);
		
		if(x%2) flag=false;
	}
	
	if(flag){
		if(p==0) cout << (long long)pow(2, n) << endl;
		else cout << 0 << endl;
		return 0;
	}
	
	cout << (long long)pow(2, n-1) << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
XYC = [list(map(int,input().split())) for _ in [0]*N]
eps = 1e-7
def f(x,y,t):
    ret = 0
    for X,Y,C in XYC:
        if ((x-X)**2+(y-Y)**2)<=(t/C)**2+eps: ret += 1
    return ret

def get_cross_section(x1,y1,r1,x2,y2,r2):
    d = ((x1-x2)**2+(y1-y2)**2)**0.5
    X = (d*d+r1*r1-r2*r2)/(2*d)
    Y = max(0,(r1*r1-X*X))**0.5
    dx = (x2-x1)/d
    dy = (y2-y1)/d
    ret = [(x1+X*dx+Y*dy,y1+X*dy-Y*dx)]
    if Y>0 : ret.append((x1+X*dx-Y*dy,y1+X*dy+Y*dx))
    return ret
def check(t):
    kouho = []
    for i in range(N):
        x1,y1,c1 = XYC[i]
        kouho.append((x1,y1))
        for j in range(i+1,N):
            x2,y2,c2 = XYC[j]
            tmp = get_cross_section(x1,y1,t/c1,x2,y2,t/c2)
            for tmp2 in tmp:
                kouho.append(tmp2)
    for tmp in kouho:
        if f(tmp[0],tmp[1],t) >= K:return True
    return False

l=0
r=1000000
#for _ in range(100):
while abs(r-l)>1e-7:
    i = (l+r)/2
    if check(i):
        r = i
    else:
        l = i
print(r)

Measured memory_bytes: 58460
#include <bits/stdc++.h>
using namespace std;
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;
    string s;
    cin>>n>>s;
    set<int> st[26];
    for(int i=0;i<n;i++)st[s[i]-'a'].insert(i+1);
    cin>>q;
    for(int i=0;i<q;i++){
        int t;
        cin>>t;
        if(t==1){
            int idx;
            char c;
            cin>>idx>>c;
            st[s[idx-1]-'a'].erase(idx);
            st[c-'a'].insert(idx);
            s[idx-1]=c;
        }else{
            int res=0;
            int l,r;
            cin>>l>>r;
            for(int j=0;j<26;j++){
                auto it=st[j].lower_bound(l);
                if(it!=st[j].end()&&*it<=r)res++;
            }
            cout<<res<<endl;
        }
    }
}

Measured memory_bytes: 24220
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,a,b,L,ch[100000];
queue<ll> que;
vector<ll> v[100000],v1[100000];
int main(void){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a;
        for(int j=0;j<a;j++){
            cin>>b;
            v[b-1].push_back(i);
        }
    }
    for(int i=0;i<m;i++){
        L=1e9;
        for(auto x:v[i]){
            if(L==1e9)L=x;
            else {
                v1[x].push_back(L);
                v1[L].push_back(x);
            }
        }
    }
    que.push(0);
    ch[0]=1;
    while(!que.empty()){
        ll q=que.front();
        que.pop();
        for(auto x:v1[q]){
            if(ch[x]==0){
                ch[x]=1;
                que.push(x);
            }
        }
    }
    for(int i=0;i<n;i++){
        if(ch[i]==0){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}


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

using namespace std;

int main(){
    int N,c=0;
    cin>>N;
    for(int i=1;i<N;i++){
        for(int j=1;j<N;j++){
            if(N>i*j){
                c++;
            }else break;
        }
    }
    cout<<c<<"\n";
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(void)
{
  int N, M;

  scanf("%d %d",&N,&M);
  
  vector<long> table[100001];

  int A,B;
  rep(i,N){
    scanf("%d %d",&A,&B);
    table[A].push_back(B);
  }

  long ans = 0;
  priority_queue<long> job;
  for(int day=0;day<=M;day++){
    rep(i,table[day].size()){
      job.push(table[day][i]);
    }
    if(job.size()>0){
      ans += job.top();
      job.pop();
    }
  }
  printf("%ld\n",ans);

  return 0;
}

Measured memory_bytes: 5632
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	mp := map[int]bool{}
	turn := 1
	mp[N] = true
	for {
		if N%2 == 0 {
			N = N / 2
		} else {
			N = 3*N + 1
		}
		turn++
		if _, ok := mp[N]; ok {
			fmt.Println(turn)
			return
		}
		mp[N] = true
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

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

    cout<<s.substr(0,s.size()-8)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }

void _main() {
  string N;
  cin >> N;

  bool f = true;
  rep(i, 1, (int)N.size()) if (N[i] != '9') f = false;

  int ans = 9 * (N.size()-1);
  if (f) {
    ans += (N[0]-'0');
  } else {
    ans += (N[0]-'0') - 1;
  }

  cout << ans << endl;
}

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

typedef vector< vector<int> > vvi;
int main() 
{
    int n;
    cin >> n;
    vvi dataMatrix;
    vvi DP;
    dataMatrix.resize(n);
    DP.resize(n);

    for (int i = 0; i < n; i++)
    {
        dataMatrix[i].resize(3);
        DP[i].resize(3);

        for(int j = 0; j < 3; j++)
        {
            cin >> dataMatrix[i][j];
        }
    }

    for(int j = 0; j < 3; j++)
    {
        DP[0][j] = dataMatrix[0][j];
    }

    for(int i = 1; i < n; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            DP[i][j] = max(DP[i-1][(j+1)%3], DP[i-1][(j+2)%3]) + dataMatrix[i][j];
        }
    }
    int res = 0; 
    for(int j = 0; j < 3; j++)
    {
        res = max(res, DP[n-1][j]);
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;


int main(){
    int n, k;   cin >> n >> k;
    string s;   cin >> s;
    string res;
    for(int i = 0; i < n; i++){
        if(i != k-1){
            res += s[i];
        }
        else{
            res += (char)('a' - 'A' + s[i]);
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256