akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,i=0,j=0,k=0,l;
    string ss;
    char s;
    cin>>a;
    for(l=1;l<=a;l++)
    {
        cin>>s;
      ss+=s;
    }
    for(l=0;l<a;l++)
    {
        if(ss[l]=='A'&&ss[l+1]=='B'&&ss[l+2]=='C'){k++;
        l=l+2;}
    }
    cout<<k<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var rp = new List<(long x, long y)>();
            for (var i = 0; i < N; ++i)
                rp.Add(Slice2<long>());
            var bp = new List<(long x, long y)>();
            for (var i = 0; i < N; ++i)
                bp.Add(Slice2<long>());
            bp.Sort();
            var pairs = 0L;
            foreach (var b in bp)
            {
                var up = (-1L, -1L);
                foreach (var r in rp)
                {
                    if (r.x < b.x && r.y < b.y && up.Item2 < r.y)
                        up = r;
                }
                if (up != (-1L, -1L))
                {
                    ++pairs;
                    rp.Remove(up);
                }
            }
            WriteLine(pairs);
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> X(N);
  for(int i=0; i<N; i++) {
    cin >> X[i];
  }
  sort(X.begin(), X.end());
  reverse(X.begin(), X.end());
  int ans=0;
  for(int i=0; i<K; i++) {
    ans+=X[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
using System;
class c
{
    static void Main()
    {
        int h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse)[0];
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine();
            Console.WriteLine(s+"\n"+s);
        }
    }
}

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

int main() {
	int n, W;
	cin >> n >> W;
	int w[n + 1];
	int v[n + 1];

	for (int i = 1; i <= n; i++) {
		int val, wei;
		cin >> w[i] >> v[i];
	}

	long long int pd[n + 1][W + 1];
	
	for (int i = 0; i <= n; i++)
		for (int j = 0; j <= W; j++)
			pd[i][j] = 0;

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= W; j++) {
			pd[i][j] = pd[i - 1][j];
			if (j <= W && j >= w[i])
				pd[i][j] = max(pd[i][j], pd[i - 1][j - w[i]] + v[i]);
		}
	}

	long long int r = -1e9 - 10;
	for (int i = 0; i <= W; i++)
		r = max(r, pd[n][i]);
	cout << r << endl;

	return 0;	
}

Measured memory_bytes: 79104
n = int(input())
A = list(map(int,input().split(" ")))


def fun(n,A):
    for i in range(n):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j-=1
        A[j+1] = v
        print(" ".join(["{0["+ str(i) + "]}" for i in range(n)]).format(A))

fun(n,A)


Measured memory_bytes: 5612
def solve():
    n, m = map(int, input().split())
    x = sorted(list(map(int, input().split())))
    diff = sorted([x[i + 1] - x[i] for i in range(m - 1)], reverse=True)
    return sum(diff[n - 1:])


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 13968
N=int(input())
m=0
x=[[0]*9 for i in range(9)]
for i in range(1,N+1):
    if i%10==0:
        continue
    b=int(str(i)[0])
    g=int(i%10)
    x[b-1][g-1]+=1
ans=0
for i in range(9):
    for j in range(9):
        ans+=x[i][j]*x[j][i]
        #print(i+1,j+1,x[i][j])
print(ans)

Measured memory_bytes: 9192
from collections import deque
N,M=map(int,input().split())
 
graph=[[]for _ in range(N+1)]
 
for _ in range(M):
    A,B=map(int,input().split())
    graph[A].append(B)
    graph[B].append(A)


dist=[-1]*(N+1)
dist[0]=0
dist[1]=0
 
D=deque()
D.append(1)

while D:
    V=D.popleft()
    for i in graph[V]:
        if dist[i]!=-1:
            continue
        dist[i]=V
        D.append(i)

print('Yes')
for j in dist[2:]:
    print(j)

Measured memory_bytes: 35068
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <chrono>
 
using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T>inline bool chmax(T &a, T b){return (a < b ? a = b, true : false);}
template<typename T>inline bool chmin(T &a, T b){return (a > b ? a = b, true : false);}
 
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
const long double EPS = 1e-9;
 
LL N;
 
int f(LL a, LL b) {
	int ca = 0, cb = 0;
	do {
		++ca;
	} while (a /= 10);
	do {
		++cb;
	} while (b /= 10);
	return max(ca, cb);
}
 
int main() {
	cin >> N;
	int ans = INF;
	for (LL i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			chmin<int>(ans, max(log10(N / i), log10(i)));
		}
	}
	cout << ans+1 << endl;
}

Measured memory_bytes: 256
//include
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

// conversion
inline int
toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

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

//math
template <class T>
inline T sqr(T x) { return x * x; }

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())

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

//constant
constexpr double EPS = 1e-10;
const double PI = acos(-1.0);
constexpr LL INF = 1e10;

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

LL my_gcd(LL a, LL b)
{
    LL tmp, r;
    if (a < b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }

    r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main()
{
    LL A, B, C, D;
    cin >> A >> B >> C >> D;
    LL sum = B - A + 1;
    //dump(sum);
    LL cnt_c = B / C - (A - 1) / C;
    //dump(cnt_c);
    LL cnt_d = B / D - (A - 1) / D;
    //dump(cnt_d);
    LL cd = (C * D) / my_gcd(C, D);
    LL cnt_cd = B / cd - (A - 1) / cd;
    //dump(cnt_cd);
    sum = sum - (cnt_c + cnt_d) + cnt_cd;
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <vector>
typedef std::vector<int> vin;
const int MAXN = 2e5+5;
vin  G[MAXN];
int up[MAXN]{ };
int M, N;
int A, B;

void bfs(int src) {
  std::queue<int> Q;
  up[src] = src;
  Q.push(src);
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int v: G[u]) {
      if (up[v]) continue;
      up[v] = u;
      Q.push(v);
    }
  }
}

int main() {
  scanf(" %d%d", &N, &M);
  for (int i = 0; i < M; ++i) {
    scanf(" %d%d", &A, &B);
    G[A].push_back(B);
    G[B].push_back(A);
  }
  bfs(1);
  puts("Yes");
  for (int i = 2; i <= N; ++i) {
    printf("%d\n", up[i]);
  }
  return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;
    int p = A + B;
    int m = A - B;
    int k = A * B;
    cout << max({p, m, k}) << endl;
    return 0;
}

Measured memory_bytes: 256
cnt = 0
H, W = map(int, input().split())
A = [input() for _ in range(H)]

def_cnt = 0
for h in range(H):
    for w in range(W):
        if A[h][w] == '#':
            def_cnt += 1

def dfs(h, w):
    global cnt
    cnt += 1
    if h+1 < H and A[h+1][w] == '#':
        dfs(h+1, w)
    elif w+1 < W and A[h][w+1] == '#':
        dfs(h, w+1)

cnt = 0

if A[0][0] == '.':
    print('Impossible')
    exit()

dfs(0, 0)
if def_cnt == cnt:
    print('Possible')
else:
    print('Impossible')


Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;

int n, s, j, skip, nextskip, lis;
vector<int> a, sz, top, p, nextp;

int PatienceSorting(int nexti){
    int r = -1, l = -1;
    if(p[0] == -1) r = 0;
    for(int i = 0; i < 2 * s; i++){
        top[i] = INF;
        sz[i] = 0;
    }
    for(int i = skip; i < n; i++){
        // filtering out irrelevant elements
        if(r + 1 < p.size() && a[i] == p[r + 1]){
            r++;
            continue;
        }else if(r == -1 || a[i] < p[r] || (l >= j && a[i] > top[j])) continue;
        // push a[i] to the appropriate pile
        int h;
        if(l == -1 || a[i] > top[l]){
            l++;
            h = l;
        }else{
            h = lower_bound(top.begin(), top.end(), a[i]) - top.begin();
        }
        top[h] = a[i];
        sz[h]++;
        if(h == nexti){
            if(nextskip == -1) nextskip = i;
            nextp.push_back(a[i]);
        }
    }
    return l;
}

int main(){
    cin >> n;
    s = sqrt(n);
    j = 2 * s - 1;
    a.resize(n); sz.resize(2 * s); top.resize(2 * s);
    for(int i = 0; i < n; i++) cin >> a[i];
    p.push_back(-1);
    while(1){
        int l = PatienceSorting(-1);
        if(l < 2 * s - 1){
            lis += l + 1;
            break;
        }
        int nexti = -1;
        for(int i = 2 * s - 1; i >= s; i--){
            if(sz[i] <= s && sz[i] > 0){
                nexti = i;
                break;
            }
        }
        nextp.clear();
        nextskip = -1;
        PatienceSorting(nexti);
        p = nextp;
        skip = nextskip;
        lis += nexti + 1;
    }
    cout << lis << endl;
}


Measured memory_bytes: 3364
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    int k; cin>>k;
    queue<ll> que;
    for (int i = 1; i <=9; i++)
    {
        que.push(i);
    }
    int cnt=0;
    while(cnt<=k-2){
        if(que.front()%10 == 0){
            que.push(que.front()*10LL + que.front()%10);
            que.push(que.front()*10LL + que.front()%10+1);
            que.pop();
            cnt++;
            continue;
        }
        if(que.front()%10 == 9){
            que.push(que.front()*10LL + que.front()%10-1);
            que.push(que.front()*10LL + que.front()%10);
            que.pop();
            cnt++;
            continue;
        }
        que.push(que.front()*10LL + que.front()%10-1);
        que.push(que.front()*10LL + que.front()%10);
        que.push(que.front()*10LL + que.front()%10+1);
        que.pop();
        cnt++;
    }
    cout<<que.front()<<endl;
    
}

Measured memory_bytes: 1792
package main

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

func main() {
	cs := make([][]int, 3)
	for i := range cs {
		cs[i] = make([]int, 3)
		for j := range cs[i] {
			cs[i][j] = getInt()
		}
	}

	as := make([]int, 3)
	bs := make([]int, 3)

	as[0] = 0
	for i := range bs {
		bs[i] = cs[0][i] - as[0]
	}
	for i := range as {
		as[i] = cs[i][0] - bs[0]
	}

	ans := "Yes"
	for i := range as {
		for j := range bs {
			if cs[i][j] != as[i]+bs[j] {
				ans = "No"
			}
		}
	}

	fmt.Println(ans)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
    int m,n;
    int sum;
    cin >> n >> m;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum+=a[i];
    }
    sort(a.begin(),a.end());
    if(a[n-m]<(sum/(4.0000000*m))){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int k = scn.nextInt();
      int a = (int)Math.pow(k-1,n-1);
      int ans = a*k;
      System.out.print(ans);
	}
}


Measured memory_bytes: 35672
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>

#define INFL (1LL << 62)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pl;

vector<ll> dijkstra(ll s, vector< vector<pl> > e) {
    ll n = e.size();
    vector<ll> minD(n, INFL);
    minD.at(s) = 0;
    priority_queue< pl, vector<pl>, greater<pl> > q;
    q.push(pl(0, s));
    while (!q.empty()) {
        pl now = q.top();
        q.pop();
        ll c = now.first, v = now.second;
        if (minD.at(v) < c) continue;
        for (ll i = 0; i < e.at(v).size(); ++i) {
            pl p = e.at(v).at(i);
            if (minD.at(p.first) > minD.at(v) + p.second) {
                minD.at(p.first) = minD.at(v) + p.second;
                q.push(pl(minD.at(p.first), p.first));
            }
        }
    }
    return minD;
}

ll solve(vector<bool> f, vector< vector<ll> > d, int prev) {
    if (count(f.begin(), f.end(), false) == 1) return 0;
    ll ans = INFL;
    for (int i = 1; i < f.size(); ++i) if (!f.at(i)) {
        auto g = f;
        g.at(i) = true;
        ans = min(ans, solve(g, d, i) + d.at(prev).at(i));
    }
    return ans;
}

int main() {
    int n, m, r;
    ll a, b, c;
    scanf("%d%d%d", &n, &m, &r);
    vector<ll> dr(r + 1);
    for (int i = 1; i <= r; ++i) scanf("%lld", &dr.at(i));
    vector< vector<ll> > d(r + 1, vector<ll>(r + 1));
    vector< vector<pl> > e(n + 1);
    for (int i = 0; i < m; ++i) {
        scanf("%lld%lld%lld", &a, &b, &c);
        e.at(a).push_back({b, c});
        e.at(b).push_back({a, c});
    }
    for (int i = 1; i <= r; ++i) {
        auto t = dijkstra(dr.at(i), e);
        for (int j = 1; j <= r; ++j) d.at(i).at(j) = t.at(dr.at(j));
    }
    ll ans = INFL;
    for (int i = 1; i <= r; ++i) {
        vector<bool> f(r + 1);
        f.at(i) = true;
        ans = min(ans, solve(f, d, i));
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1820
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
const double pi=3.14159265358979323846;
void solve()
{
    double n;
    cin>>n;
    double an=2.0*pi*n;
    cout<<fixed<<setprecision(10)<<an;
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //srand(time(0));
    //cin>>t;
    for(int _i=1;_i<=t;_i++){
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3796
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll N;

int main(){

    ll A, B, K;
    cin >> A >> B >> K;
    
    if(A - K < 0){
        B = max(0LL, B - abs(A - K) );
    }

    A = max(0LL, A - K);

    cout << A << " " << B << endl;
    

} 

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

int n,a,tmp;
int s[10],w[10];
string f[10],temp;
int t[10];
vector<int>ans;

int get_weight(int);
void swap_data(int);
void sort_data();

int main(){
  while(cin>>n&&n!=0){
    ans.clear();
    for(int i=0;i<n;i++){
      cin>>f[i];
      cin>>w[i]>>s[i];
    }

    
    sort_data();

    //for(int i=0;i<n;i++)cout<<f[i]<<' '<<w[i]<<' '<<s[i]<<endl;
    //cout<<'='<<endl;
    for(int k=0;k<n;k++){
      for(int i=0;i<n;i++){
	for(int j=0;j<n-1;j++){
	  if(w[j]<w[j+1]){
	    swap_data(j);
	    
	    a=get_weight(j+1);
	    if(a>s[j])swap_data(j);
	    

	  }
	
	}
      }
    }
    for(int i=0;i<n;i++)cout<<f[i]<<endl;
    
    
  }
  return 0;
}

int get_weight(int x){
  int res=0;
  for(int i=x;i<n;i++)res+=w[i];
  return res;
}

void swap_data(int x){
  
  tmp=w[x];
  w[x]=w[x+1];
  w[x+1]=tmp;

  tmp=s[x];
  s[x]=s[x+1];
  s[x+1]=tmp;

  temp=f[x];
  f[x]=f[x+1];
  f[x+1]=temp;
}

void sort_data(){
  for(int i=n-1;i>0;i--){
    for(int j=0;j<i;j++){
      if(s[j]<s[j+1])swap_data(j);
      else if(s[j]==s[j+1]&&w[j]<w[j+1])swap_data(j);
    }
  }
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, K;
VL a;
map<ll, ll> amemo;

int main() {
    cin >> N;
    REP(i, N) { amemo[IN()]++; }
    ll ans = 0;
    FOREACH(x, amemo) {
        if(x.second > x.first)
            ans += x.second - x.first;
        else if(x.second < x.first)
            ans += x.second;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 6272
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	cin>>n;
	while(n--){
		int in[4]={0};
		string s;
		int co=0;
		while(cin>>s){
			if(s=="OUT")co++;
			if(co==3)break;
			if(s=="HIT"){
				rep(i,3){
					in[3-i]+=in[2-i];
					in[2-i]=0;
				}
				in[0]++;
			}
			if(s=="HOMERUN"){
				rep(i,3){
					in[3]+=in[i];
					in[i]=0;
				}
				in[3]++;
			}
			//cout<<in[0]<<" "<<in[1]<<" "<<in[2]<<" "<<in[3]<<endl;
		}
		cout<<in[3]<<endl;
	}
}

Measured memory_bytes: 1212
x=int(input())
if(x>=1800):
  print(1)
elif(x>=1600):
  print(2)
elif(x>=1400):
  print(3)
elif(x>=1200):
  print(4)
elif(x>=1000):
  print(5)
elif(x>=800):
  print(6)
elif(x>=600):
  print(7)
else:
  print(8)

Measured memory_bytes: 9180
#include <iostream>

using namespace std;

int main() {
    long long int N, K;
    cin >> N >> K;
    
    long long int ans[2]={1, 1}, anss[2];
    if(K%2==0) {
        anss[0] = N/K;
        if(N>=(N/K)*K+(K/2)) {
            anss[1] = anss[0] + 1;
        } else {
            anss[1] = anss[0];
        }
         for(int i=0; i<3; i++) {
            ans[0] *= anss[0];
            ans[1] *= anss[1];
         }
         cout << ans[0]+ans[1] << endl;
    } else {
        anss[0] = N/K;
        for(int i=0; i<3; i++) {
            ans[0] *= anss[0];
        }
        cout << ans[0] << endl;
    }
    
    return 0;
    
}

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

int main()
{
    std::string first;
    std::string second;
    std::cin >> first;
    std::cin >> second;

    if (first[0] == second[2] && first[1] == second[1] && first[2] == second[0]) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = sc.nextInt();
        int inv[] = new int[N];
        for (int i = 0; i < N; i++) {
            inv[sc.nextInt()-1] = i;
        }

        for (int i = 0; i < N; i++) {
            if (i > 0) System.out.print(" ");
            System.out.print(N * (i + 1));
        }
        System.out.println("");

        for (int i = 0; i < N; i++) {
            if (i > 0) System.out.print(" ");
            System.out.print(N * (N - i) + inv[i]);
        }
        System.out.println("");
    }
}


Measured memory_bytes: 30528
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> state;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }
int ceil(int a,int b){
  // a/bの切り上げを考える
  return (a+b-1)/b;
}

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

  int cnt = 0;

  string c;
  cin >> c;

  int i = 0;int j = c.length()-1;
  while(1){
    while(c[i] == 'R' and i != c.length()-1){
      i++;
    }
    while(c[j] == 'W' and j != 0){
      j--;
    }
    if(i >= j){
      break;
    }
    else{
      cnt++;
      i++;j--;
    }
  }
  cout << cnt << endl;
}


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

using namespace std;

void __start__() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef MY
    freopen("/home/ainur/CLionProjects/wow/input.txt", "r", stdin);
    freopen("/home/ainur/CLionProjects/wow/output.txt", "w", stdout);
#else
    //freopen("search.in", "r", stdin);
   // freopen("search.out", "w", stdout);
#endif
}

#define sz(x) (int)x.size()
#define yes cout<<"Yes\n"
#define  no cout << "No\n"
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ft first
#define sd second
#define read(a) for(auto &qwqw:a)cin >> qwqw;
#define print(a) for(auto qwqw:a)cout<<qwqw<<' ';
#define print_plus(a) for(auto qwqw:a)cout<<qwqw+1<<' ';
//#define FOR(i, b, n) for(int i=b;i<n;i++) #define FOR(i, n) FOR(i, 0, n) #define FOR(n) FOR(i, 0, n)
mt19937_64 rnd(time(0));
using ll = long long;
using vi = vector<int>;
using ld = long double;
using vb = vector<bool>;
using pii = pair<int, int>;
using vd = vector<long double>;


int log2(int q) {
    int c = 0;
    while (q) {
        q >>= 1;
        c++;
    }
    return c;
}

#define int long long

void test_case() {
    string s;
    cin >> s;
    int c = 0, ans=0;
    for (int i = 0; i < sz(s); ++i) {
        if(s[i]=='R')
            c++, ans=max(ans, c);
        else
            c=0;
    }
    cout << ans;
}

signed main() {
    __start__();
    int Q = 1;
    //cin >> Q;
    while (Q--) {
        test_case();
    }
}





Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
  int c,n,m,p,s,sum;
  while(true){
    cin >> n >> m >> p;
    if (n==0)
      break;
    sum = 0;
    for (int i=0;i<n;i++){
      cin >>s;
      sum += s;
      if (i == m-1)
	c = s;
    }
    if (c)
      cout << sum*(100-p)/c << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}

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

int num_of_divisors(int x) {
    int count = 0;
    for (int y = 1; y <= x; y++) {
        if (x % y == 0) {
            count++;
        }
    }
    return count;
}

int main() {
    int N;
    cin >> N;
    int count = 0;
    for (int x = 1; x <= N; x++) {
        if (x % 2 == 1 && num_of_divisors(x) == 8) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,m,p=map(int,input().split())
    E=[[] for _ in range(n)]
    R=[[] for _ in range(n)]
    for _ in range(m):
        u,v,c=map(int,input().split())
        u-=1; v-=1
        E[u].append((v,p-c))
        R[v].append((u,p-c))

    # 0 から到達できる点、N-1 から逆辺で到達できる点を列挙
    state=[0]*n
    state[0]+=1
    state[-1]+=2

    Q=[0]
    while(Q):
        v=Q.pop()
        for nv,w in E[v]:
            if(state[nv]&1): continue
            state[nv]+=1
            Q.append(nv)

    Q=[n-1]
    while(Q):
        v=Q.pop()
        for nv,w in R[v]:
            if(state[nv]&2): continue
            state[nv]+=2
            Q.append(nv)

    # state が 3 の辺だけを用いて Bellman Ford
    dist=[INF]*n
    dist[0]=0
    for k in range(n):
        update=False
        for v in range(n):
            if(state[v]!=3): continue
            for nv,w in E[v]:
                if(state[nv]!=3): continue
                if(dist[nv]>dist[v]+w):
                    dist[nv]=dist[v]+w
                    update=True
        if(not update):
            break
        if(update and k==n-1):
            print(-1)
            return

    print(max(0,-dist[-1]) if(dist[-1]!=INF) else -1)
resolve()

Measured memory_bytes: 49516
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/

const int MOD=1000000007;/* 1,000,000,007 で割った余りを出力する　のとき使う*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int N;
int K;

int main(void) {
  cin >> N >> K;
  
  if(K!=1)  cout << N-K << endl;
  else cout << 0 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f(int n){
    if(n<6) return 0;
    int ans=0;
    for(int x=1;x*x<=n;x++){
         for(int y=x;x*x+y*y<=n;y++){
             for(int z=y;x*x+y*y+z*z<=n;z++){
                 if(x*x+y*y+z*z+x*y+x*z+y*z==n){
                 	if(x!=y and y!=z and x!=z) ans+=6;
                 	else if(x==y and y==z and x==z) ans++;
                 	else ans+=3;
                 }
             }
         }
    }
    return ans;
}

int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cout<<f(i)<<"\n";
    }
	return 0;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll, ll> pll;

ll adj[705][705];
ll n, m;
ll sz[777];
ll wh[777];
ll vis[777];
ll dp[777][777];
ll cc;
void dfs(ll s, ll c)
{
        sz[cc]++;
        vis[s] = c;
        if(c==0) wh[cc]++;
        for(ll i=1;i<=n;i++){
                if(adj[s][i] && i != s) {
                        if(vis[i] == -1) {
                                dfs(i, 1-c);
                        }else if(vis[i] == c){
                                cout << "-1\n"; exit(0);
                        }
                }
        }
}
inline ll f(ll x)
{
        return (x*(x-1))/2;
}
ll solve(ll id, ll W)
{
        if(id == cc+1){
                return f(W) + f(n-W);
        }
        ll &ret = dp[id][W];
        if(ret != -1) return ret;
        //ret = 0;
        ret = solve(id+1, W + wh[id]);
        ret = min(ret, solve(id+1, W + (sz[id] - wh[id])));
        return ret;
}
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); cout.tie(NULL);
        cin >> n >> m;
        for(ll i=1;i<=n;i++) {
                for(ll j=1;j<=n;j++) adj[i][j] = 1;
        }
        for(ll i=1;i<=m;i++) {
                ll a,b;
                cin >> a >> b;
                adj[a][b] = 0;
                adj[b][a] = 0;
        }
        memset(vis, -1, sizeof vis);
        for(ll i=1;i<=n;i++) {
                if(vis[i] == -1) {
                        cc++;
                        sz[cc] = 0;
                        dfs(i, 0);
                }
        }
        memset(dp,-1,sizeof dp);
        cout << solve(1, 0) << endl;
        return 0;
}


Measured memory_bytes: 8832
s = gets.chomp
t = gets.chomp

result = false
s.length.times do |i|
    s.length.times do |j|
        index = i+j
        index -= s.length if index >= s.length
        if s[j] != t[index]
            break
        elsif j == s.length - 1
            result = true
        end
    end
    break if result
end

puts result ? "Yes" : "No"

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
inline bool chmin (int& a, int b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
void dfs (
	int crr
,	int prt
,	int rt
, int& tmr
, vector<int>& ord
, vector<int>& low
, set<int>& atc
, set<pair<int, int>>& bdg
, vector<vector<int>>& grh
) {
	int cnt = 0;
	ord[crr] = low[crr] = tmr++;
	for (int nxt : grh[crr]) {
		if (ord[nxt] == -1) {
			cnt++;
			dfs(nxt, crr, rt, tmr, ord, low, atc, bdg, grh);
			chmin(low[crr], low[nxt]);
			if (crr != rt && ord[crr] <= low[nxt]) atc.insert(crr);
			if (ord[crr] < low[nxt]) bdg.emplace(crr, nxt);
		}
		if (nxt != prt) chmin(low[crr], ord[nxt]);
	}
	if (crr == rt && cnt > 1) atc.insert(crr);
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> grh(n);
	for (int i = 0; i < m; i++) {
		int s, t;
		cin >> s >> t;
		grh[s].push_back(t);
		grh[t].push_back(s);
	}
	int tmr = 0;
	vector<int> ord(n, -1), low(n, -1);
	set<int> atc;
	set<pair<int, int>> bdg;
	dfs(0, 0, 0, tmr, ord, low, atc, bdg, grh);
	for (auto it = atc.begin(); it != atc.end(); it++) {
		cout << *it << '\n';
	}
	cout << flush;
	return 0;
}


Measured memory_bytes: 5076
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

X = get_int

kouho = [1]

base = 2
loop do
  i = 2
  loop do
    break if base ** i > X
    kouho << base ** i
    i += 1
  end
  base += 1
  break if base ** 2 > X
end

puts kouho.max


Measured memory_bytes: 14336
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0; i<n;i++)

int main()
{
    int i=0,n,tmp,sum=0,a[9]={0};
    cin >> n;
    tmp = n;
    do
    {
        a[i] = tmp%10;
        tmp /= 10;
        i++;
    }while(tmp!=0);
    
    REP(i,9)
    {
        sum += a[i];
    }
    if(n%sum == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <map>
#include <cctype>
using namespace std;

int main()
{
  cout << setprecision(6);
  cout << setiosflags(ios::scientific);
  cout.flags(ios::fixed);

  int alNum[26];
  memset(alNum, 0, sizeof(alNum));
  char ch;
  while(cin >> ch){
    if(isalpha(ch)){
    ch = tolower(ch);
    alNum[ch-'a']++;
    }
  }

  for(int i=0; i<26; i++){
    cout << (char)('a'+i) << " : " << alNum[i] << endl;
  }
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    long long N;
    long long K;
    cin>>N>>K;
    vector<long long> A(N);
    //どこかでループが発生するはず。
    //ループの周期,発生までの手数がわかればツモ
    rep(i,N){
        cin>>A[i];
    } 
    long long tesu=0;
    long long syuuki=0;
    bool roopflag=false;
    set<long long> visited;
    long long tmp=1;
    visited.insert(1);
    tesu++;
    tmp=A[0];
    long long counts=0;
    while(!roopflag&&counts<K){
        if(!visited.count(tmp)){
            visited.insert(tmp);
            tesu++;
        
        }else{
            roopflag=true;
            
        }
        counts++;
        if(counts!=K){
        tmp=A[tmp-1];
        }
    }
    // cout << tesu << endl;
    if(counts==K){
         cout << tmp << endl;
        return 0;
    }
    //周期を求める
    //tesu=最初のだぶりまでにかかった手数
    bool roopflag2=false;
    set<long long> sys;

    while(!roopflag2){
        if(sys.count(tmp)){
            roopflag2=true;
        }else{
            sys.insert(tmp);
        tmp=A[tmp-1];
        syuuki++;
        }
    }
    long long snglte=tesu-syuuki;
    //ループに合流するまでの単独路=snglteより
    //ループからの手数=K-snglte
    long long roopte=(K-snglte)%syuuki;
    //スタートからroopte+snglte回して到達した場所が答え
    tmp=1;
    rep(i,roopte+snglte){
        tmp=A[tmp-1];
    }
    // cout << "syuuki:"<<syuuki << "snglte:" <<snglte<<"roopte:"<<roopte<<"tesu:"<<tesu<<endl;
    cout << tmp<< endl;
    return 0;
}

Measured memory_bytes: 17188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define mt make_tuple

ll n, k, ans=0;

int main(){
cin >> n >> k;
if(k==0)cout << 1LL*n*n << endl;
else {
rep(i, k+1, n){
    ll t = n/i;
ans+=1LL*(i-k)*(t);

if(n-t*i-k+1>0)ans+=n-t*i-k+1;

}
cout << ans << endl;

}

return 0;}


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

int main(){
	
		int t[31] = { 0 };
		int n;
		for (int i = 0; i < 28; i++){
			cin >> n;
			t[n] =  1 ;
		}
		
		for (int i = 1; i<31; i++){
			if  ( t[i] == 0 ){
				cout << i << endl;
			}
		}
	}

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

int main() {
	int a,c;
	cin >> a;
	c = a;
	if (a == 1) { cout << a << endl; return 0; }
	for (int i = 1; i<=a ; i++) {
		c = pow(i, 2);
		if (c > a) { c = pow(i - 1, 2); cout << c << endl; break; }
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
#define S second
#define F first
using namespace std;

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



void solve()
{
    ll x;
    cin >> x;
    if(x>=30)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    //cin >> t;
    t=1;
    while (t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n1,n2,gcd,lcm,c;
    while(scanf("%lld%lld",&n1,&n2)!=EOF)
    {

   c=__gcd(n1,n2);
    lcm=(n1*n2)/c;
        printf("%lld %lld\n",c,lcm);
        }
    return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define INF 10000000
#define limit 100010
 
queue<int> q;
ll V[limit];
vector< pair<int, ll> > L[limit];

void WFS(int k){
    q.push(k);
    V[k] = 0;
    while(!q.empty()){
        int p = q.front();
        q.pop();
        for(int i = 0; i < L[p].size(); i++){
            int v = L[p][i].first;
            if(V[v] != INF) continue;
            ll w = L[p][i].second;
            V[v] = V[p] + w;
            q.push(v);
        }
    }
}

int main(){
    int N;
    cin >> N;
    ll a,b,c;
    REP(i,N-1){
        cin >> a >> b >> c;
        L[a].push_back(make_pair(b, c));
        L[b].push_back(make_pair(a, c));
    }
    int Q,K;
    cin >> Q >> K;

    fill(V, V+limit, INF);
    WFS(K);

    int x,y;
    REP(i, Q){
        cin >> x >> y;
        cout << V[x] + V[y] << endl;
    }
    return 0;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define per(i,a,b) for(ll i=(a);i>=(b);i--)
using namespace std;
typedef long long ll;
const ll maxn=1e5+100;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f3f3f3f3f;
ll t,b[30];
string a;
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    ll n;
    cin>>a;
    ll res=0;
    rep(i,0,2){
        if(a[i]=='R'){
            res=0;
            while(i<3){
                if(a[i]=='R') res++;
                if(a[i]=='S') break;
                i++;
            }
        }
    }
    cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;
using LL = long long;
const int N = 200005;
int a[N];
LL b[N];
LL t[N];

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

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

	for (int i = 1; i <= n; ++i)
	{
		b[a[i]] = t[a[i]] * (t[a[i]] - 1) / 2;
	}

	LL sum = 0;
	for (int i = 1; i <= n; ++i) sum += b[i];

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



	return 0;
}


Measured memory_bytes: 5504
import java.math.BigInteger;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 10^18 */
	private static final BigInteger BIG = BigInteger.valueOf(1_000_000_000_000_000_000L);

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long[] a = new long[n];
			if (IntStream.range(0, n).mapToLong(i -> a[i] = scanner.nextLong()).filter(i -> i == 0L).count() > 0) {
				System.out.println(0);
				return;
			}
			BigInteger result = BigInteger.ONE;
			for (int i = 0; i < n; i++) {
				result = result.multiply(BigInteger.valueOf(a[i]));
				if (result.compareTo(BIG) > 0) {
					System.out.println(-1);
					return;
				}
			}
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 62648
x = int(input())

if(x >= 400 and x <= 599):
  print(8)
elif(x <= 799):
  print(7)
elif(x <= 999):
  print(6)
elif(x <= 1199):
  print(5)
elif(x <= 1399):
  print(4)
elif(x <= 1599):
  print(3)
elif(x <= 1799):
  print(2)
elif(x <= 1999):
  print(1)


Measured memory_bytes: 61836
import java.util.Scanner;

public class Main {
	// 2-100
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		String mString = in.next();
		if (mString.charAt(mString.length()-1)=='s') {
			System.out.println(mString+"es");
		}else {
			System.out.println(mString+"s");
		}
		
	}

}

Measured memory_bytes: 26916
#include<stdio.h>
int main(void){
  int A,B;
  int i;
  scanf("%d%d",&A,&B);
  if(1<=A && A<=9 && 1<=B && B<=9)
    i = A*B;
  else
    i = -1;
  printf("%d",i);
  return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

const string YES = "Yes";
const string NO = "No";

int main(){

    string s;
    cin >> s;
    if(s[0] == s[2]){
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int mod = 1e9 + 7;
int sum(int a, int b) { return (a + b) % mod; }
int mul(ll a, ll b) { return (a * b) % mod; }
void add(int &a, int b) { a += b; if (a >= mod) a -= mod; }
int sub(int a, int b) { return sum(a, mod - b); }

int rev2 = (mod + 1) / 2;

const int maxn = 5005;
int d[maxn][maxn];
int bs1[maxn][maxn];
int bs2[maxn][maxn];

int main() {
    #ifdef LOCAL
    assert(freopen("f.in", "r", stdin));
    #else
    #endif

    int n;
    string s;
    cin >> n >> s;
    int m = sz(s);

    bs1[0][0] = bs2[0][0] = 1;
    forn (i, n + 1) {
        forn (j, n + 1) {
            add(bs1[i + 1][j + 1], bs1[i][j]);
            add(bs1[i + 1][j + 1], bs1[i][j]);
            add(bs1[i + 1][max(0, j - 1)], bs1[i][j]);

            add(bs2[i + 1][j + 1], bs2[i][j]);
            add(bs2[i + 1][j + 1], bs2[i][j]);
            if (j > 0)
                add(bs2[i + 1][j - 1], bs2[i][j]);
        }
    }
    int res = bs1[n][m];
    forn (i, m)
        res = mul(res, rev2);
    cout << res << '\n';
}

Measured memory_bytes: 195840