akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
const int INF = 1001001001;
const ll MOD = 1e9+7;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll dp[3005][3005];

signed main(){
	string n; cin>>n;
	int ans = 0;
	if(n=="SUN") ans=7;
	if(n=="MON") ans=6;
	if(n=="TUE") ans=5;
	if(n=="WED") ans=4;
	if(n=="THU") ans=3;
	if(n=="FRI") ans=2;
	if(n=="SAT") ans=1;

	cout << ans << endl;


  return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = (int) s.length();
  if ((int) t.length() == n + 1 && t.substr(0, n) == s) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

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

#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;

int main()
{
    fio;
    ll t, a, n, q, k, i, m, c, u, f, j, p, r, x, y, s, b, d;


    cin>>n;
	cout<<(1000-(n%1000))%1000;
    return 0;
}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int x = sc.nextInt();

            int leftCount = 0;
            int rightCount = 0;
            for (int i = 0; i < m; i++) {
                int a = sc.nextInt();
                if (a < x) {
                    leftCount++;
                } else {
                    rightCount++;
                }
            }

            int ans = Math.min(leftCount, rightCount);
            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pl;

int main(){
    string t[4] = {"dream", "dreamer", "erase", "eraser"};
    string s;
    cin >> s;
    int pos = s.length()-1;
    bool flag;
    while(true){
        flag = false;
        for(int i = 0; i < 4; i++){
            for(int j = 0; j <= t[i].length(); j++){
                if(j == t[i].length()){
                    flag = true;
                    pos -= j;
                    break;
                }
                if(s[pos-j] != t[i][t[i].length()-1-j]) break;
            }
            if(flag)    break;
        }
        if(!flag){
            cout << "NO\n";
            return 0;
        }
        if(pos <= 0){
            cout << "YES\n";
            return 0;
        }
    }
}

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

namespace CSharpSample01
{
    
    class Program
    {

        static int[] cnt_ac_toend;

        static int AC_Cnt(string S, int start, int end)
        {
            int cnt_AC = 0;
            
            for(int i = end - 1; i >= start - 1; i--)
            {
                char now = S[i];
                
                if (now == 'A')
                {
                    if (i < end - 1)
                    {
                        if(S[i + 1] == 'C')
                        {
                            cnt_AC++;
                        }
                    }
                }

                cnt_ac_toend[i] = cnt_AC;
            }

            return cnt_AC;
        }


        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int N = int.Parse(input[0]);
            int Q = int.Parse(input[1]);

            string S = Console.ReadLine();
            cnt_ac_toend = new int[N];

            AC_Cnt(S, 1, N);
            

            for(int i = 0; i < Q; i++)
            {
                string[] input2 = Console.ReadLine().Split(' ');
                int start = int.Parse(input2[0]);
                int end = int.Parse(input2[1]);
                
                Console.WriteLine(cnt_ac_toend[start - 1] - cnt_ac_toend[end - 1]);
                
            }
            
        }
    }
}


Measured memory_bytes: 18616
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=9999999;

long long int H,W;
int res=0;
string str[25];

int main() {
	cout<<setprecision(10);
	cin>>H>>W;
	for(int i=0;i<H;i++){
		cin>>str[i];
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			for(int i2=0;i2<H;i2++){
				for(int j2=0;j2<W;j2++){
					if(str[i][j]=='#'||str[i2][j2]=='#'){continue;}
					bool used[22][22]={};
					int turn[22][22]={};
					
					queue<pair<int,int> >que;
					que.push({i,j});
					used[i][j]=true;
					while(!que.empty()){
						int h=que.front().first;
						int w=que.front().second;
						que.pop();
						if(h>0&&!used[h-1][w]&&str[h-1][w]=='.'){
							used[h-1][w]=true;
							turn[h-1][w]=turn[h][w]+1;
							que.push({h-1,w});
						}
						if(h<H-1&&!used[h+1][w]&&str[h+1][w]=='.'){
							used[h+1][w]=true;
							turn[h+1][w]=turn[h][w]+1;
							que.push({h+1,w});
						}
						if(w>0&&!used[h][w-1]&&str[h][w-1]=='.'){
							used[h][w-1]=true;
							turn[h][w-1]=turn[h][w]+1;
							que.push({h,w-1});
						}
						if(w<W-1&&!used[h][w+1]&&str[h][w+1]=='.'){
							used[h][w+1]=true;
							turn[h][w+1]=turn[h][w]+1;
							que.push({h,w+1});
						}

					}
					res=max(res,turn[i2][j2]);
					
				}
			}
		}
	}
	cout<<res<<endl;
} 


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
a = [i+1 for i in range(N)]
li = list(itertools.combinations(a,2))
n = len(li)
if N % 2 == 1:
    print(N*(N-1)//2-N//2)
else:
    print(N*(N-1)//2-N//2)
for i in range(n):
    a,b = li[i]
    if N % 2 == 1:
        if a+b != N:
            print(a,b)
    else:
        if a+b != N+1:
            print(a,b)


Measured memory_bytes: 10924
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	ans := 0

	for i := 1; i <= n; i++ {
		str := strconv.Itoa(i)
		sum := 0
		for _, c := range str {
			d, _ := strconv.Atoi(string(c))
			sum += d
		}
		if a <= sum && sum <= b {
			ans += i
		}
	}

	fmt.Printf("%v\n", ans)
}


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()         

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn 
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N+2];
set<string> st;

void getstr( int id,  string str, int cnt )
{
      if( id == n )
      {
            st.insert(str);
            return;
      }

      if( str[id] != '!' ) getstr(id+1, str, cnt+1);
      else
      {
            for(char ch = 'a'; ch <= 'a'+cnt; ch++)
            {
                  str[id] = ch;
                  getstr(id+1, str, cnt);
            }
      }


}
void get(int j, vector<int> &vec)
{     
      if( j == n )
      {
            char ch = 'a';
            string res(n, '!');
            for(auto i: vec)
            {
                  res[ i ] = ch;
                  ch++;
            }

            getstr(1, res, 1);
            return;

      }

      lop(i, j, n)
      {
            vec.pb(i);
            get(i+1, vec);
            vec.pop_back();
      }

      get(n, vec);
}

void solve()
{
      cin >> n;
      vector<int> vec;
      vec.pb(0);
      get(1, vec);

      for(auto i: st) cout << i << endl;

      
}


int32_t main()
{
      
      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
     // INP(); 
      int t = 1;
      //cin >> t;
      while(t--) solve();

}











inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //






Measured memory_bytes: 12416
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let numbers: Vec<i32> = read_vec();
    let a = numbers[0];
    let b = numbers[1];

    if (b - a) % 2 != 0 {
        println!("IMPOSSIBLE");
        return;
    }

    if a < b {
        let k = (b - a).abs() / 2 + a;
        println!("{}", k);
    } else {
        let k = (b - a).abs() / 2 + b;
        println!("{}", k);
    }
}

Measured memory_bytes: 4352
import java.util.*;
import java.io.PrintWriter;
import java.math.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int s=sc.nextInt();
		long mod=998244353;
		long[][] dp=new long[n+1][s+1];
		dp[0][0]=1;
		for(int i=1; i<=n; i++){
			int a=sc.nextInt();
			for(int j=s; j>=0; j--){
				dp[i][j]=(2*dp[i-1][j])%mod;
				if(j+a<=s && dp[i-1][j]>0){
					dp[i][j+a]=(dp[i][j+a]+dp[i-1][j])%mod;
				}
			}
		}
		System.out.println(dp[n][s]);
	}
}


Measured memory_bytes: 111284
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
 
int main() {
    int N, X;
    cin >> N >> X;
    //ll m[N];
    ll minM = X;
    REP(i, N){
        ll m;
        cin >> m;
        X-=m;
        minM = min(minM, m);
    }
    cout << (int)X/(int)minM + N << endl;
    return 0;
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

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

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll x; cin >> x;
    ll q = x / 11;
    ll r = x % 11;
    ll ans = q * 2;
    if (r >= 1 & r <= 6) ans++;
    else if (r >= 7) ans += 2;
    cout << ans << "\n";
}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t W, H, x, y;
  cin >> W >> H >> x >> y;
  if (x * 2 == W && y * 2 == H) {
    std::cout << std::setprecision(20) << static_cast<double>(W * H) / 2.0 << " " << 1 << endl;
  } else {
    std::cout << std::setprecision(20) << static_cast<double>(W * H) / 2.0 << " " << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 3752
#include "iostream"
#include "vector"
#include "cmath"

using namespace std;

#define sq(x) ((x)*(x))

int main(void) {
    long long a, b, c;
    
    cin >> a >> b >> c;
        
    if (c - a - b > 0 && 4 * a * b < sq(c - a - b)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int N, X; std::cin >> N >> X;
  std::vector<int> m(N); for(int i=0; i<N; i++) std::cin >> m[i];

  int sums = std::accumulate(m.begin(), m.end(), 0);
  X -= sums;
  std::cout << X / *std::min_element(m.begin(), m.end()) + N << std::endl;
  return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : m
// Date        : Thu Feb 21 10:19:17 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//============================================================================
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define mst(x, y) memset(x, y, sizeof(x))
#define pvar(x) cout << #x << ": "
#define fora(e, c) for (auto &e : c)
#define fori(i, a, b) for (int i = a; i < b; ++i)
#define ford(i, a, b) for (int i = a; i > b; --i)
#define output(v) cout << (v) << '\n'
#define prt(x, a, n) { cout << x[a]; if (a < n - 1) cout << " "; }
#define pvi(x, v) if(v) pvar(x); fora(a, x) cout << a << " "; cout << "\n"
#define par(x, s, n, v) if(v) pvar(x); fori(y, s, n) prt(x, y, n) cout << "\n"

#ifndef __has_trace
#define trace(...)
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int mod = (int) 1e9 + 7;

void add(ll &a, ll b) {
    a += b;
    if (a >= mod) {
        a -= mod;
    }
}

void sub(ll &a, ll b) {
    a -= b;
    if (a < 0) {
        a += mod;
    }
}

void solve() {
    int n, k; cin >> n >> k;
    vi aa(n + 1);
    fori (i, 1, n + 1) {
        cin >> aa[i];
    }

    vector<vl> dp(n + 1, vl(k + 1, 0));
    // dp[i][j]: the number of ways such that there are j candies for i childs.
    dp[0][0] = 1;
    fori (i, 1, n + 1) {
        // Compute prefix sum
        vl sum(k + 2, 0);
        fori (j, 1, k + 2) {
            sum[j] = (sum[j - 1] % mod + dp[i - 1][j - 1] % mod) % mod;
        }

        fori (j, 0, k + 1) {
            // dp[i][j] <- dp[i - 1][j - aa[i] + aa[i]]
            // dp[i][j] <- dp[i - 1][j - aa[i] - 1 + (aa[i] - 1)]

            ll pre = sum[j + 1];
            if (j - aa[i] >= 0) {
                sub(pre, sum[j - aa[i]]);
            }
            add(dp[i][j], pre);

            // Navie way of computing
            // fori (h, 0, aa[i] + 1) {
            //     if (j - h >= 0) {
            //         add(dp[i][j], dp[i - 1][j - h]);
            //     }
            // }
        }
    }
    // trace(dp);
    output(dp[n][k]);
}

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



Measured memory_bytes: 80256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

internal static class ConsoleReader
{
    public static string Get() { return Console.ReadLine(); }
    public static int GetInteger() { return int.Parse(Console.ReadLine()); }
    public static IEnumerable<int> GetIntegers() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)); }
}

namespace AtCoderBeginnerContest
{
    internal class Program
    {
        private static void Main() { var result = GetResult(); Debug.WriteLine(result); Console.WriteLine(result); }

        private static object GetResult()
        {
            var input = ConsoleReader.Get();
            switch (input)
            {
                case "SUN": return 7;
                case "MON": return 6;
                case "TUE": return 5;
                case "WED": return 4;
                case "THU": return 3;
                case "FRI": return 2;
                case "SAT": return 1;
            }
            return null;
        }
    }
}


Measured memory_bytes: 13268
# -*- coding: utf-8 -*-

n = int(input())

a = list()
for i in range(n):
    a.append(int(input()))

a_sorted = sorted(a, reverse=True)

for i in range(n):
    if a[i] == a_sorted[0]:
        print(a_sorted[1])
        continue

    print(a_sorted[0])


Measured memory_bytes: 14112
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		ArrayList<Double> x_list = new ArrayList<Double>();
		ArrayList<Double> y_list = new ArrayList<Double>();
		
		while (true) {
			
			String s = br.readLine();
			if(s == null) break;
			StringTokenizer st = new StringTokenizer(s," ");
			double a = Double.parseDouble(st.nextToken());
			double b = Double.parseDouble(st.nextToken());
			double c = Double.parseDouble(st.nextToken());
			double d = Double.parseDouble(st.nextToken());
			double e = Double.parseDouble(st.nextToken());
			double f = Double.parseDouble(st.nextToken());
			double x = (c * e - b * f) / (a * e - b * d);
			double y = (f * a - c * d) / (a * e - d * b);
			if(x == -0) x = 0;
			if(y == -0) y = 0;
			x_list.add(x);
			y_list.add(y);
		}
		for (int i = 0; i < x_list.size(); i++) {
			System.out.printf("%.3f %.3f", x_list.get(i), y_list.get(i));
			System.out.println();
		}
	}
	
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int cnt[100];

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

    int N;
    std::cin >> N;

    int cnt2 = 0;
    for(int i=0;i<N;++i){
        int A;
        std::cin >> A;

        if(A < 3200){
            ++cnt[A / 400];
        }else{
            ++cnt2;
        }
    }

    int res = 0;
    for(int i=0;i<100;++i){
        if(cnt[i] > 0){++res;}
    }

    std::cout << (res > 0 ? res : res + 1) << " " << (res + cnt2) << std::endl;
}


Measured memory_bytes: 256
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o D.exe D.cpp 
Execute: ./D
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <limits> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h>
#include <string>  
using namespace std;


int main() { 	
	long long n, 
		a[80] = {0}, 
		money = 1000, 
		num_stocks = 0; 
	
	// Input 
	cin >> n; 
	for(int i = 0; i < n; i++) {
		cin >> a[i]; 
	}
	
	// Loop through stocks 
	for(int i = 0; i+1 < n; i++) {
		num_stocks = money / a[i]; 
		money += num_stocks * max(a[i+1]-a[i],0LL); 
	}
	
	cout << money << endl; 
	
	return 0; 
} 


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int main()
{
    int N,i,M,a[100][100],j,p,sum=0,q,t;
    cin>>N;
    for(i=1;i<=N;i++)
    {
        cin>>t;
        mp[i]=t;
    }
    cin>>M;
    for(i=1;i<=M;i++)
        for(j=1;j<=2;j++)cin>>a[i][j];
    for(i=1;i<=M;i++)
    {
        p=a[i][1];
        q= mp[p];
        mp[p]=a[i][2];
        for(j=1;j<=N;j++)sum=sum+mp[j];
        cout<<sum<<endl;
        sum=0;
        mp[p]=q;
    }
    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);



using namespace std;

template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline long long nod(T num){string str = toString(num);return str.length();}

long long pow(long long x){long long num=1;rep(i,x) num*=10;return num;}

//ある桁x1以上x2以下の区間のfizzbuzz文字数を求める
long long fbStr(long long x1,long long x2){
	long long fb=(x2/15)-((x1-1)/15);
	long long f=(x2/3)-((x1-1)/3);
	long long b=(x2/5)-((x1-1)/5);
	long long numStr=nod(x1);
	return (fb*8)+(f+b-fb*2)*4+(((x2-(x1-1))-(f+b-fb))*numStr);
}

//ある値の区間のfizzbuzz文字数を求める
long long fbStrs(long long x){
	long long sum=0;
	long long num=pow(nod(x)-1);
	sum+=fbStr(num,x); 
//	cout << num << "~" << x << endl;
	for(long long i=num-1;i>0;i=pow(nod(i)-1)-1){
//		cout << pow(nod(i)-1) << "~" << i<< endl;
		sum+=fbStr(pow(nod(i)-1),i); 
	}
	return sum;
}

int main(){

	long long s;
	cin >> s;


	
	long long highid,lowid=1;

	rep(i,18){
		if(fbStrs(pow(i))>=s){
			highid=pow(i);
			break;
		}
	}


	long long start=1;

	long long midid=0,midfbs=0;

	while (lowid <= highid) {
		midid = (lowid + highid) / 2;
		midfbs = fbStrs(midid);
		start = midid;
		if (midfbs == s) {
			break;
		} else if (midfbs < s) {
			lowid = midid + 1;
		} else if (midfbs > s){
			highid = midid - 1;
		}
	}
		
	string fbs;


	//cout << highid << " " << lowid << " " << fbStrs(start) << " " << s << endl;

	for(long long i=start;i<start+50;i++){
		if(i%15==0){ fbs.append("FizzBuzz");}
		else if(i%5==0){ fbs.append("Buzz");}
		else if(i%3==0){ fbs.append("Fizz");}
		else{ fbs.append(toString(i));} 	
	}

	
	//cout << "元文字列: " << fbs << endl;


	for(long long i=s-fbStrs(start)+fbStr(start,start)-1;i<s-fbStrs(start)+fbStr(start,start)+19;i++){	
		cout << fbs[i];
	}

	cout << endl;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int ans=0;
    ans=(n-1)*(n-2)/2-k;
    if(ans<0){
        printf("-1");
        return 0;
    }
    printf("%d\n",ans+n-1);
    for(int i=2;i<=n;++i)
        printf("1 %d\n",i);
    for(int i=2;i<n&&ans;++i){
        for(int j=i+1;j<=n&&ans;++j){
            printf("%d %d\n",i,j);
            ans--;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], u, v, fa[100005], cnt = 0;
int getfa(int x) {return fa[x] == x? x : fa[x] = getfa(fa[x]);}
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	for (int i = 1; i <= n; i++) fa[i] = i;
	for (int i = 1; i <= m; i++)
	{
		scanf("%d%d", &u, &v);
		if (getfa(u) != getfa(v)) fa[fa[u]] = fa[v];
	}
	for (int i = 1; i <= n; i++) cnt += getfa(i) == getfa(a[i]);
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int aa=ceil((double)(c)/b);
    int cc=ceil((double)(a)/d);
    if(cc>=aa)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3652
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,LL m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
//typedef struct fac { LL n, exp; }F;
//LL fact(LL n,F*a){LL x=n,i,j,c=0;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
LL nibtan(LL* a,LL n,LL x){LL p=0,q=n/2,r=n-1;while(r-p>1){if(x>=a[q])p=q;if(x<=a[q])r=q;q=(p+r)/2;}return a[p]==x?p:r;}
//snippet

#define N 1000009

void run(void) {
	LL n, ans = 0;
	in("%lld", &n);
	if (n > 1) ans = modpow(10, n, MOD) + modpow(8, n, MOD) + 2 * (MOD - modpow(9, n, MOD));
	printf("%lld\n", ans % MOD);
}

int main(void) {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
		fflush(stdout);
	}
	return 0;
}

Measured memory_bytes: 1732
//stringray

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

/*#ifndef __LOCAL__ 
#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif*/ 

using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ost;

typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<set<int>> vsi;

#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define F first
#define S second
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0)


const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T>
istream& operator >> (istream& is,vector<T>& vec){
  for(T &x:vec)is>>x;
  //for(int i=0;i<vec.size();++i)is>>x[i];
  return is;
}

template<typename T>
ostream& operator << (ostream& os,vector<T>& vec){
  for(int i=0;i<vec.size();++i){
    os<<vec[i]<<(i+1==vec.size()?"":" ");
  }
  return os;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int getRand(int l, int r)
{
	uniform_int_distribution<int> uid(l, r);
	return uid(rng);
}

ll mpow(ll a, ll b){
  ll ret=1;
  while(b>0){
    if(b&1)ret=(ret*a)%mod;
    (a=a*a)%=mod;
    b>>=1LL;
  }
  return ret;
}

#define int int64_t
//int a[N+2];
void solve(){
  int n;cin>>n;
  cout<<(n*(n-1))/2<<endl;  
}
int32_t  main(){
  IOS;
  solve();
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>

using namespace std;

#define PI 3.141592653589793
#define FOR(i,a,b) for(int i=int(a);i<int(b);++i)
#define RFOR(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)

class Dice{
public:
    Dice()
    {
        face = new int[6];
        move = new int[6];
    }
    ~Dice()
    {
        delete[] face;
        delete[] move;
    }
    void roll(char c)
    {
        REP(i,6) move[i]=face[i];
	if (c == 'L') setLabel(move[0],move[2],move[4],move[1],move[3],move[5]);
	else if (c=='E') setLabel(move[3],move[1],move[0],move[5],move[4],move[2]);
        else if (c=='N') setLabel(move[1],move[5],move[2],move[3],move[0],move[4]);
        else if (c=='S') setLabel(move[4],move[0],move[2],move[3],move[5],move[1]);
        else setLabel(move[2],move[1],move[5],move[0],move[4],move[3]);
    }
    void setLabel(int i,int n) {face[i] = n;}
    void setLabel(int f0,int f1,int f2,int f3,int f4,int f5)
    {
        face[0] = f0;
        face[1] = f1;
        face[2] = f2;
        face[3] = f3;
        face[4] = f4;
        face[5] = f5;
    }
    int getAns() {return face[2];}
  void setDice(int s1,int s2)
  {
    REP(i,4) {
      //cout << "s1/" << face[0] << ":" << face[1] << endl;
      if (face[0]==s1) {
	break;
      } else if (i==3) {
	roll('L');
	i=-1;
      }
      roll('N');
    }
    REP(i,4) {
      //cout << "s2/" << face[0] << ":" << face[1] << endl;
      if (face[1]==s2) break;
      roll('L');
    }
  }
private:
    int *face;
    int *move;
};

int main() {
    Dice d;
    int n,l,f1,f2;
    string str;
    REP(i,6) {
        cin >> n;
        d.setLabel(i,n);
    }
    cin >> n;
    while(n-- > 0) {
      cin >> f1 >> f2;
      d.setDice(f1,f2);
      cout << d.getAns() << endl;
    }
    return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define ALL(A) A.begin(),A.end()
const long long mod=1000000007;
bool IsPrime(int num)
{
    if(num<2) return false;
    else if(num==2) return true;
    else if(num%2==0) return false;
    double sqrtNum=sqrt(num);
    for(int i=3;i<=sqrtNum;i+=2)
    {
        if(num%i==0)
        return false;
    }
    return true;
}
int main(){
    int q;
    cin>>q;
    int l[q],r[q],M=-1;
    for(int i=0;i<q;i++){
        cin>>l[i]>>r[i];
        M=max(M,r[i]);
    }
    int s[M+1];s[0]=0;s[1]=0;s[2]=0;
    for(int i=3;i<=M;i+=2)
    {
        if(IsPrime(i)&&IsPrime((i+1)/2))
        {
            s[i]=s[i-2]+1;
        }
        else
        s[i]=s[i-2];
    }
    for(int i=0;i<q;i++)
    cout<<s[r[i]]-s[l[i]-2]<<endl;
    return 0;  
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N; cin >> N;
    string ans = "APPROVED";
    for (int i=0;i<N;i++){
        int a; cin >> a;
        if (a%2==0 && a%3!=0 && a%5!=0) ans = "DENIED"; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
          
        int c = scan.nextInt();
          int d = scan.nextInt();
          
          while(true) {
              c -= b;
              if(c<=0){
                  System.out.println("Yes");
                    break;
              }

              a -= d;

              if(a<=0){
                System.out.println("No");
                  break;
            }
          }
      
        scan.close();
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> b(n-1);
    rep(i, n-1) cin >> b[i];
    vector<int> a(n);
    a[0] = b[0];
    for (int i = 1; i <= n-2; i++) {
        a[i] = min(b[i], b[i-1]);
    }
    a[n-1] = b[n-2];
    int ans = 0;
    rep(i, n) ans += a[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const ll mod =1000000007;
vector<ll> inv(200001);
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
void maketable(ll n){
  for(ll i=1; i<n+1; i++){
    inv.at(i)=modinv(i,mod);
  }
  return;
}
ll combi(ll n, ll k){
  ll ans=1;
  if(k<n-k) k=n-k;
  for(ll i=n; i>k; i--){
    ans = ans*i%mod;
  }
  for(ll i=n-k; i>1; i--){
    ans = ans *inv.at(i)%mod;
  }
  return ans;
}
int main(){
    long long n,a,b;
    cin>>n>>a>>b;
    maketable(max(a,b));
    ll ans=modpow(2,n,mod);
    ans = ( (mod+ans -  combi(n,a))%mod +mod -combi(n,b) -1 )%mod;
    cout<<ans<<endl;
}

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

#p = n * (n-1) * (n-1) // 2
p = n / 2

d = 0
for i in range(n-1):
    for j in range(i+1, n):
        d += (((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** 0.5 )/ p

print(d)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

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

	int a[5];
	FOR(i,0,5)
	{
		cin >> a[i];
	}
	int k;
	cin >> k;

	if (a[4] - a[0] > k) {
		cout << ":(\n";
		return 0;
	}

	cout << "Yay!\n";

}


Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int[] R = {1,2,3};
		int result = 0;

		if(a == 1) {
			if(b == 2) {
				System.out.println(3);
			}else {
				System.out.println(2);
			}
		}else if(a == 2) {
			if(b == 1) {
				System.out.println(3);
			}else {
				System.out.println(1);
			}
		}else {
			if(b == 1) {
				System.out.println(2);
			}else {
				System.out.println(1);
			}
		}

	}

}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) {

        solve_149_A();
      
        return;
    }

    private static void solve_149_A() {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();

        System.out.println(T+S);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long 
#define ff first
#define ss second

using namespace std;

int main()
{
    FAST;
    
    int n,m,x;
    cin>>n>>m>>x;
    
    vector<int> cost(n);
    
    vector<vector<int> > sk(n,vector<int>(m));
    
    for(int i=0; i<n; i++)
    {
        cin>>cost[i];
        for(int j=0; j<m; j++)
        {
            cin>>sk[i][j];
        }
    }
    
    int fn=(1<<n)-1;
    int ans=INT_MAX;
    
    for(int nx=1; nx<=fn; nx++)
    {
        vector<int> cur(m);
        vector<bool> check(m);
        int valid=0;
        int curCost=0;
        
        for(int i=0; i<n; i++)
        {
            int tx=(nx>>i);
            if((1 & tx)==1)
            {
                for(int j=0; j<m; j++)
                {
                    cur[j]+=sk[i][j];
                    if(!check[j] && cur[j]>=x)
                    {
                        check[j]=true;
                        valid++;
                    }
                }
                
                curCost+=cost[i];
            }
        }
        
        if(valid==m && ans>curCost)
        {
            ans=curCost;
        }
    }
    
    if(ans==INT_MAX)
    {
        cout<<-1;
    }
    else
    {
        cout<<ans;
    }
    
}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    int r = 0, t = 0;
    int p = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;

        if (h <= p) t++; else t = 0;
        r = max(r, t);
        p = h;
    }

    cout << r << endl;

    return 0;
}

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

using namespace std;

int main()
{

	int N, K;
	int R, S, P;
	string T;
	unsigned long sum = 0;

	cin >> N >> K;
	cin >> R >> S >> P;
	cin >> T;

	bitset<100000> lose_or_even;

	for (int i = 0; i < N; i++) {
		char t = T.at(i);
		if (t == 'r') {
			if ((i - K < 0) || T.at(i-K) != 'r') {
				sum += P;
			}
			else if (lose_or_even[i - K] == 1) {
				sum += P;
			}
			else {
				lose_or_even[i] = 1;
			}
		}
		else if (t == 's') {
			if ((i - K < 0) || T.at(i-K) != 's') {
				sum += R;
			}
			else if (lose_or_even[i - K] == 1) {
				sum += R;
			}
			else {
				lose_or_even[i] = 1;
			}
		}
		else if (t == 'p') {
			if ((i - K < 0) || T.at(i-K) != 'p') {
				sum += S;
			}
			else if (lose_or_even[i - K] == 1) {
				sum += S;
			}
			else {
				lose_or_even[i] = 1;
			}
		}
	}
	cout << sum << endl;
	return 0;
}



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

int main() {
    int64_t A, B, s, i = 2, ans = 1;
    cin >> A >> B;
    s = __gcd(A,B);
    while (s > 1) {
        if (s % i == 0) {
            ans++;
        }
        while (s % i == 0) {
            s /= i; 
        }
        i++;
        if (i * i > __gcd(A,B)) {
            ans++;
            cout << ans << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);

	if(a%b == 0)return(b);

	else return(gcd(b, a%b));
}

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

    ll l, r;
    l = r = 0;
    rep(i, n){
        ll t, a;
        cin >> t >> a;

        if(t >= l && a >= r){
            l = t, r = a;
        }
        else {
            ll t_m = l / t;
            ll a_m = r / a;
            if(l % t > 0)t_m++; 
            if(r % a > 0)a_m++; 

            ll min_m = min(t_m, a_m);
            ll max_m = max(t_m, a_m);

            if(t * min_m >= l && a * min_m >= r){
                l = t * min_m, r = a * min_m;
            }
            else {
                l = t * max_m, r = a * max_m;
            }
        }
    }
    cout << l + r << endl;
}


Measured memory_bytes: 3596
#include <iostream>                                             
#include <string>                                               
using namespace std;                                            
                                                                
int main(void) {                                                
  while (true) {                                                
    string cards;                                               
    cin >> cards;                                               
    int m, h;                                                   
    if (cards == "-") {                                         
      break;                                                    
    }                                                           
    cin >> m;                                                   
    while (m--) {                                               
      cin >> h;                                                 
      string substr = cards.substr(0, h);                       
      cards.erase(0, h);                                        
      cards += substr;                                          
    }                                                           
    cout << cards << endl;                                      
  }                                                             
                                                                
  return 0;                                                     
}                                  

Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
Int B,C,H,W;
Int X,Y,Z;
vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}
vector<Int> dp;
bool VIS[MAXN];

void dfs(int u){
    VIS[u]=true;
        for(auto &v:adj[u]){
            if(!VIS[v])
                dfs(v);
            dp[u]=max(dp[u],1+dp[v]);
        }
}

int main()
{
     
     cin>>N>>K;
     A.resize(N);
     
     for(auto &x:A) cin>>x;
     
     vector<bool> dp(K+1,false);
     dp[0]=0;
     
        for(int i=1;i<K+1;++i){
            for(int j=0;j<N;++j){
                if(i<A[j]) continue;
                if(!dp[i-A[j]]){
                    dp[i]=true;
                    break;
                }
            }
        }
        cout<<(dp[K]==true ? "First\n":"Second\n");
}


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

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }
#define fi first
#define se second
#define mkp std::make_pair
typedef long long ll;
typedef double ff;
typedef std::pair <int, int> pii;
const int kN = 4e5 + 5, kInf = 0x3f3f3f3f;
const ll kMod = 998244353, kInfLL = 0x3f3f3f3f3f3f3f3fLL;

ll A, B, C;
int main() { 
#ifndef ONLINE_JUDGE
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
#endif
	int T = 1; //rd(T);
	while(T--) {
		rd(A, B, C);
		for(int i = 1; i <= 40; ++i) {
			if(A % 2 || B % 2 || C % 2) {
				printf("%d\n", i - 1);
				return 0;
			}
			ll tA = A, tB = B, tC = C;
			A = (tB + tC) / 2;
			B = (tA + tC) / 2;
			C = (tB + tA) / 2;
			//printf("%lld %lld %lld\n", A, B, C);
		}
		printf("-1\n");
	} return 0;
}

Measured memory_bytes: 3732
n = int(input())
a = list(map(int, input().split()))

a_sum = sum(a)
x = 0
y = 0
for i in range(n):
    x += a[i]

    if x * 2 >= a_sum:
        y = a[i]
        break

ans = min(abs(2 * x - a_sum), abs(a_sum - 2 * (x - y)))
print(ans)


Measured memory_bytes: 31528
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    if(n>=30){
        cout << "Yes" << "\n";
        return 0;
    }else{
        cout << "No" << "\n";
        return 0;
    }
}   

Measured memory_bytes: 3644