akhauriyash/Code-Regression huggingface dataset:
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                               c > 0 ? i < b : i > b; \
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#else
const bool test = false;
#define dump(x) 
#endif

#else
const bool test = false;
#define dump(x) 
#endif

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while (getline(ss, buffer, sep))
    {
        v.push_back(buffer);
    }
    return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
    return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

void solve();

class Solver {
public:
    int Q, H, S, D;
    int N;
    int N2;

    void solve() {
        cin >> Q >> H >> S >> D;
        cin >> N;
        chmin(H, Q*2);
        chmin(S, H*2);
        chmin(D, S*2);
        int ans = D * (N / 2) + S * (N % 2);        
        cout << ans << endl;
    }
};

signed main()
{
    srand(time(NULL));
    cout << fixed << setprecision(20);
    auto ptr = new Solver();
    ptr->solve();
    delete ptr;
    // while (true) {    
    //     auto ptr = new Solver();
    //     ptr->solve();
    //     delete ptr;
    // }
    return 0;
}

// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'

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

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

int main(void){
	int n, i;
	long l[100000][2];
	scanf("%d", &n);
	for(i=0; i<n; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		l[i][0] = a+b;
		l[i][1] = a-b;
	}
	qsort(l, n, sizeof(long)*2, comp);
	int ans=0;
	long now=INT_MIN;
	for(i=0; i<n; i++){
		if(l[i][1]>=now){
			now = l[i][0];
			ans++;
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int dp[101][4][4][4];
// ACGT 0123

int solution(int x, int n, int m, int p) {
    if (x == 3) {
        if ((n == 0 && m == 2 && p == 1) || (n == 0 && m == 1 && p == 2) || (n == 2 && m == 0 && p == 1)) return 0;
        return 1;
    }
    
    int& ret = dp[x][n][m][p];
    if (ret != -1) return ret;
    else {
        int res = 0;
        
        for (int i = 0; i < 4; i++) {
            if (i == 0 && m == 2 && p == 1) continue;
            if (i == 0 && n == 2 && p == 1) continue;
            if ((n == 0 && m == 2 && p == 1) || (n == 0 && m == 1 && p == 2) || (n == 2 && m == 0 && p == 1)) continue;
            
            res += solution(x - 1, i, n, m);
            res %= MOD;
        }
        
        return ret = res;
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    memset(dp, -1, sizeof(dp));
    int n; cin >> n;
    int res = 0;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                res += solution(n, i, j, k);
                res %= MOD;
            }
        }
    }
    
    cout << res << '\n';
    
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
#define repi(n) for (long long i = 0; i < (n); ++i)
#define repj(n) for (long long j = 0; j < (n); ++j)
#define repk(n) for (long long k = 0; k < (n); ++k)
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = std::max(t, (v)))
#define updatemin(t, v) (t = std::min(t, (v)))

int main() {
  int a,b;
  cin>>a>>b;
  cout << (a - 1) * (b - 1) << endl;
}


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

int main()
{
	std::string S = "";
	std::cin >> S;

	for (int i = 0; i < S.size(); ++i)
	{
		if (i % 2 != 0)
		{
			if (S.at(i) == 'L' || S.at(i) == 'U' || S.at(i) == 'D')
			{
				continue;
			}
		}
		else
		{
			if (S.at(i) == 'R' || S.at(i) == 'U' || S.at(i) == 'D')
			{
				continue;
			}
		}

		std::cout << "No\n";
		return 0;
	}

	std::cout << "Yes\n";
	return 0;
}

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

using namespace std ;
typedef  long long ll;

ll min( ll a , ll b )
{
    return (a<b)?a:b;
}

int main()
{
    ll arr[100005] ;
    ll n,K;
    ll result[100005];
    while( cin >> n >> K ){
        for( int i = 0; i < n; i++ ){
            result[i] = 1000000000;
            cin >> arr[i];
        }
        result[0] = 0;
        for( int i = 0; i < n-1; i++ ){
            for( int j = 1; j <= K; j++ ){
                if(  i+j >= n ){
                    break;
                }
                ll curetnr = result[i] ;
                ll dif = abs( arr[i]-arr[i+j] );
                result[i+j] =  min( result[i+j] , dif+curetnr );
            }
        }
        cout << result[n-1] << endl;
    }
}


Measured memory_bytes: 1792
import math
from collections import defaultdict
# 0以上整数x「未満」の素数をリストに格納して返す
n = int(input())
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0  # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
pr = primes(100)
q = math.factorial(n)
di = {}
di = defaultdict(int)
for i in pr:
    while q % i == 0:
        q = q // i
        di[i] += 1
co = 0
do1 = 0
eo1= 0
do2 = 0
eo2= 0
do3 = 0
eo3= 0
for k in di:
    if di[k] >= 24:
        do1 += 1
    if di[k] >= 2:
        eo1 += 1
if do1 >= 1 and eo1 >= 2:
    co += do1 * (eo1 - 1)
for k in di:
    if di[k] >= 14:
        do2 += 1
    if di[k] >= 4:
        eo2 += 1
if do2 >= 1 and eo2 >= 2:
    co += do2 * (eo2 - 1)
for k in di:
    if di[k] >= 4:
        do3 += 1
    if di[k] >= 2:
        eo3 += 1
if do3 >= 2 and eo3 >= 3:
    co += comb(do3,2) * (eo3 - 2)
for k in di:
    if di[k] >= 74:
        co += 1
print(co)

Measured memory_bytes: 3568
#include <bits/stdc++.h>
 
using namespace std;
          
#define endl        "\n"
#define int         long long
#define all(v)      v.begin(),v.end()
#define sz(v)       (int)v.size()
#define pii         pair<int,int>
#define fi          first
#define se          second
#define mod         1e9+7
#define forn(i,a,b) for(int i=a;i<b;i++)
#define deb(x)      cout << #x << ' ' << x << endl
#define clock       cerr << 1000 * (double)clock() / (double)CLOCKS_PER_SEC << "ms" << endl;

const int N=1e5+5;
int n,m;
vector <int> v[N];
int vis[N],ans[N];

void bfs(int src){
    queue<int> q;
    q.push(src);
    while(sz(q)){
        int t=q.front();
        q.pop();
        vis[t]=1;
        for(auto i:v[t]){
            if(vis[i]==0){
                q.push(i);
                if(ans[i]==-1) ans[i]=t;
                vis[i]=1;
            }
        }
    }
}
void solve(){
    cin>>n>>m;
    forn(i,0,m){
        int a,b;
        cin>>a>>b;
        a--; b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    memset(ans,-1,sizeof(ans));
    bfs(0);
    if(count(ans+1,ans+n,-1)) cout<<"No"<<endl;
    else {
        cout<<"Yes"<<endl;
        forn(i,1,n) cout<<ans[i]+1<<endl;
    }
}
 
int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 13812
#include<stdio.h>
int main(void)
{
	int a,s[102],x,i;
	for(i=1;i<101;i++){
		s[i]=0;
	}
	while((scanf("%d",&a))!=EOF){
			s[a]++;
	}
	x=-1;
	for(i=1;i<101;i++){
		if(x<s[i]){
			x=s[i];
		}
	}
	for(i=1;i<101;i++){
		if(x==s[i]){
			printf("%d\n",i);
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main()
{
    string s;
    cin >> s;
    int a = s.size();
    bool f = true;
    rep(i, a)
    {
        if (i % 2 == 0)
        {
            if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
            {
                continue;
            }
            f = false;
            break;
        }
        else
        {
            if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
            {
                continue;
            }
            f = false;
            break;
        }
    }
    if (f)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010;

typedef long long ll;
const int mod = 1e9+7;

ll fast_pow(ll m,ll n){
    ll base = m;
    ll ret = 1;
    while(n){
        if(n&1){
            ret = ret * base % mod; 
        }
        base = base * base %mod;    
        n = n >> 1;
    }
    return ret;
}
//A(N,2) 10^(N-2)
// = N*(N-1) * pow(10,N-2)
int main(){
    ll N;
    cin>>N;
    if(N < 2){
        cout<<0<<endl;
        return 0;
    }
    ll p = N * (N-1) % mod;
    p = fast_pow(10,N) - 2 * fast_pow(9,N) + fast_pow(8,N);
    p = p %mod; 
    if(p < 0){
        p = p + mod;
    }
    cout<<p<<endl;
    
    return 0;
}



Measured memory_bytes: 3632
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

#define P 998244353

int dp[3001][3001];
int main(void){
	int a=nextint();
	int b=nextint();
	int c=nextint();
	int d=nextint();
	dp[a][b]=1;
	for(int i=a; i<=c; i++){
		for(int j=b; j<=d; j++){
			if(i==a&&j==b) continue;
			dp[i][j] = ((long)dp[i][j-1]*i + (long)dp[i-1][j]*j - (long)dp[i-1][j-1]*(i-1)*(j-1) + (long)P*P) %P;
		}
	}
	printf("%d\n", dp[c][d]);
}


Measured memory_bytes: 36776
#include<cstdio>
#include<algorithm>
#define P 1000000007

using namespace std;

typedef long long LL;
int n;
char s1[60], s2[60];
LL ans;

int main(){
	int i;
	scanf("%d", &n);
	scanf("%s", s1 + 1);
	scanf("%s", s2 + 1);
	if(s1[1] == s2[1]){ans = 3; i = 2;} else {ans = 6; i = 3;}
	while(i <= n){
		if(s1[i] == s2[i]){
			if(s1[i-1] == s2[i-1]) ans = ans * 2 % P;
			++i;
		} else {
			if(s1[i-1] == s2[i-1]) ans = ans * 2 % P;
			else ans = ans * 3 % P;
			i += 2;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		List<Integer> a = new ArrayList<>(N);
		for (int i = 0; i < N; ++i) {
			a.add(in.nextInt());
		}
		in.close();

		double ave = 0.0;
		for (Integer val : a) {
			ave += (double) val;
		}
		ave /= (double) (a.size());
		int index = -1;
		double diff = Double.MAX_VALUE;
		for (int i = 0; i < N; ++i) {
			if (diff > Math.abs((double) a.get(i) - ave)) {
				index = i;
				diff = Math.abs((double) a.get(i) - ave);
			}
		}
		System.out.println(index);
	}

}

Measured memory_bytes: 22740
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=100000+19;

int vis[N],stk[N];
vector<pii> A;
int R,C,n,x,y,top;

int cal(int y,int x){
	if (y==0) return x;
	if (x==R) return R+y;
	if (y==C) return R+C+R-x;
	if (x==0) return R+C+R+C-y;
	return -1;
}

int main(){
	R=IN(),C=IN(),n=IN();
	For(i,1,n+1){
		x=cal(IN(),IN());
		y=cal(IN(),IN());
		if (~x&&~y){
			A.pb(mp(x,i));
			A.pb(mp(y,i));
		}
	}
	sort(A.begin(),A.end());
	top=0;
	For(i,0,A.size()){
		int x=A[i].se;
		if (!vis[x]) vis[x]=1,stk[++top]=x;
		lf (stk[top]!=x){
			puts("NO");
			return 0;
		} else{
			top--;
		}
	}
	puts("YES");
}

Measured memory_bytes: 2544
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main() {
	long int n; cin >> n;
	for(long int i=1;i<=n;i++){
		if(i*i<n){
			continue;
		}
		if(i*i==n){
			cout << i*i << endl;
			return 0;
		}
		if(i*i>n){
			cout << (i-1)*(i-1) << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;

int main(){
    int H,W,h,w;
    cin >> H >> W >> h >> w;
    cout << (H - h) * (W- w) << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func inputIntSlice(size int) []int {
	slice := make([]int, size)
	for i := range slice {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := inputIntSlice(n)

	cnt := make([]int, n)
	for i := range a {
		if a[i]%2 == n%2 {
			fmt.Println(0)
			return
		}
		cnt[a[i]]++
	}
	// fmt.Println(cnt)

	if n%2 == 0 && cnt[0] != 0 {
		fmt.Println(0)
		return
	} else if n%2 == 1 && cnt[0] != 1 {
		fmt.Println(0)
		return
	}
	for i := n - 1; i > 0; i -= 2 {
		if cnt[i] != 2 {
			fmt.Println(0)
			return
		}
	}

	ans := 1
	for i := 0; i < n/2; i++ {
		ans = (ans * 2) % 1000000007
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int a[5];
  for(int i=0;i<5;i++) {
    cin>>a[i];
  }
  for(int i=0;i<5;i++) {
    if(a[i]==0) {
      cout<<++i;
    }
  }
  return 0;
}

Measured memory_bytes: 3588
import math
import sys
isPrime=[False, False]
for i in range(2,1000000):
    isPrime.append(True)
for i in range(2,int(math.sqrt(1000000))):
    if isPrime[i]:
        for j in range(i*i, 1000000, i):
            isPrime[j]=False
nPrime=[]
cnt=0
for i in range(0,1000000):
    if isPrime[i]:
        cnt=cnt+1
    nPrime.append(cnt)
for l in sys.stdin:
    print(nPrime[int(l)])



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

int main() {
    ll n,m;
    std::cin >> n>>m;
    vector<ll> a(n);
    priority_queue<ll> q;
    for (int i = 0; i < n; i++) {
        ll tmp;
        std::cin >> tmp;
        q.push(tmp);
    }
    for (int i = 0; i < m; i++) {
        ll a = q.top();q.pop();
        q.push(a/2);
    }
    ll res = 0;
    while(!q.empty()){
        res += q.top();
        q.pop();
    }
    std::cout << res << std::endl;
}


Measured memory_bytes: 2168
package main

import (
	"fmt"
	"sort"
)

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	seq := []string{}

	for i := 0; len(t)+i <= len(s); i++ {
		var flgNG bool
		for j := 0; j < len(t); j++ {
			if s[i+j] != '?' && s[i+j] != t[j] {
				flgNG = true
				break
			}
		}
		if !flgNG {
			str := s[:i] + t + s[i+len(t):]
			for k, v := range str {
				if v == '?' {
					str = str[:k] + "a" + str[k+1:]
				}
			}
			seq = append(seq, str)
		}
	}
	sort.Strings(seq)

	if len(seq) > 0 {
		fmt.Println(seq[0])
	} else {
		fmt.Println("UNRESTORABLE")
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
    int n,s,t;
    cin>>n>>s>>t;
    int a,b;
    a=abs(n-s);
    b=abs(n-t);
    (a<b)?cout<<"A":cout<<"B";
}


Measured memory_bytes: 3568
W, H, N = map(int, input().split())
x_a , x_b , y_c , y_d = 0 , W , 0 , H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        x_a = max(x,x_a)
    elif a == 2:
        x_b = min(x,x_b)
    elif a == 3:
        y_c = max(y,y_c)
    else :
        y_d = min(y,y_d)
ans = max(x_b - x_a, 0) * max(y_d - y_c, 0)
print(ans)

Measured memory_bytes: 3064
N, M = list(map(int, input().split()))
G = {}
for i in range(0,M):
    a, b = list(map(int, input().split()))
    if a in G:
        G[a] += [b]
    else:
        G[a] = [b]
    if b in G:
        G[b] += [a]
    else:
        G[b] = [a]

from itertools import permutations
import copy
paths = list(map(lambda x: [1] + list(x),list(permutations(range(2,1+N),N-1))))
cnt = 0

for path in paths:
    _G = copy.deepcopy(G)
    flg = 1
    for i in range(1,N):
        if path[i] in _G[path[i-1]]:
            _G[path[i-1]].remove(path[i])
            _G[path[i]].remove(path[i-1])
        else:
            flg = 0
            break
    cnt += flg

print(cnt)

Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  int n;
  cin>>n;
  string s;
  int a=0,b=0,c=0,d=0;
  while(n--){
   cin>>s;
    if(s=="AC"){a++;}
    else if(s=="WA"){b++;}
    else if(s=="RE"){d++;}
    else{c++;}
  }
  cout<<"AC x "<<a<<endl;
  cout<<"WA x "<<b<<endl;
  cout<<"TLE x "<<c<<endl;
  cout<<"RE x "<<d<<endl;
 
 return 0;
}

Measured memory_bytes: 3632
import math
for i in range(int(input())):
    x1,y1,x2,y2,x3,y3 = map(float,input().split())
    
    a = 2*(x2 - x1)
    b = 2*(y2 - y1)
    c = x1**2 - x2**2 + y1**2 - y2**2
    
    aa = 2*(x3 - x1)
    bb = 2*(y3 - y1)
    cc = x1**2 - x3**2 + y1**2 - y3**2

    x = (b*cc - bb*c) / (a*bb - aa*b)
    y = (c*aa - cc*a) / (a*bb - aa*b)
    
    r = math.hypot(x1 - x,y1 - y)
            
    print(f'{x:.03f} {y:.03f} {r:.03f}')


Measured memory_bytes: 5696
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);
using ll = long long;
using namespace std;
using ld = long double;
typedef pair<int,int> ii;
const ll mod = 1e9 + 7;

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    int n,k;
    cin >> n >> k;
    int candy;
    vector<ll> dp(k+1);
    dp[0]=1;
    for(int i=0; i<n; ++i)
    {
        cin >> candy;
        vector<ll> sum(k+1);
        for(int most=k; most>=0; --most)
        {
            int prefix = dp[most];
            int L= most +1;
            int R = most + min (candy, k-most);
            if (L<=R)
            {
                if (R<k)
                {
                    sum[R+1]-= prefix;
                }
                sum[L] += prefix;
            }
        }
        sum[0]=0;
        for(int j=1; j<=k; ++j)
        {
            sum[j]+=sum[j-1];
            dp[j]=(dp[j]+sum[j])%mod;
            if (dp[j]<0) dp[j]+=mod;
        }
    }
    cout << dp[k]%mod;
    return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
int main() {
    ll now  = 0 ; 
    ll N ; 
    cin >> N ;
    ll a[N] ;
    for(ll i = 0 ; i < N ; i++){
        cin >> a[i] ;
    }
    now = a[0] ;
    //cout << a[0] << endl;
    ll ans = 0 ;
    for(ll j = 0 ; j < N -1 ; j++){
        if(now > a[j+1]){
            ans += now - a[j+1] ;
        }else{
            now = a[j+1] ;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 5192
#include <stdio.h>
#include <math.h>

int main()
{
	int n, t;
	double x1, y1, r1, x2, y2, r2;
	double d;

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &r1, &x2, &y2, &r2);

		d = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);

		if (d > (r1 + r2)*(r1 + r2)) t = 0;
		else if (d < (r2-r1)*(r2-r1)){
			if (r2 < r1) t = 2;
			else if (r2 > r1) t = -2;
		}else t = 1;

		printf("%d\n", t);
	}

	return 0;
}

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

int main()
{
bool chk=true;
double N;
cin >> N;
vector <double> A(N);
for(int i=0; i<N; i++)
{
  cin >> A.at(i);
}
sort(A.begin(),A.end());

for(int i=0; i<N-1; i++)
{
  if(A.at(i)==A.at(i+1))
  {
    chk=false;
  }
}
if(chk)
{
  cout << "YES" << endl;
}
else
{
  cout << "NO" << endl;
}
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int n;
    long long ans,mod=1000000007;
    scanf("%d",&n);
    char s1[n+2],s2[n+2];
    scanf("%s%s",s1,s2);
    if (s1[0]==s2[0]){
        ans=3;
    } else {
        ans=6;
    }
    for (int i=1; i<n; i++){
        if (s1[i-1]==s2[i-1] && s1[i]==s2[i]){
            ans=(ans*2)%mod;
        } else if (s1[i-1]==s2[i-1] && s1[i]!=s2[i]){
            ans=(ans*2)%mod;
        } else if (s1[i-1]!=s2[i-1] && s1[i-1]!=s1[i]){
            if (s1[i]==s2[i]){
                ans=ans%mod;
            } else {
                ans=(ans*3)%mod;
            }
        } else {
            ans=ans%mod;
        }
    }
    printf("%lld\n",ans%mod);
	return 0 ;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        if((a < c && c < b) ||(b < c && c < a)) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

    }
}


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

#define INF 100000000001


int main() {
    char S[4];
    cin >> S;
    if(S[0]=='R' && S[1]=='R' && S[2]=='R') cout << "3" << endl;
    else if((S[0]=='R'&&S[1]=='R') || (S[1]=='R'&&S[2]=='R')) cout << "2" << endl;
    else if(!(S[0]=='S' && S[1]=='S' && S[2]=='S')) cout << "1" << endl;
    else cout << "0" << endl;
    
    
}

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

using namespace std;

// Header files, namespaces,
// macros as defined above
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

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


#define f first
#define s second
#define db long double
#define pb push_back
#define sz(c) (c).size()
#define all(c) (c).begin(),(c).end()

typedef long long ll;
typedef pair <int , int> ii;
typedef pair <ii , int> iii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <vi> vvi;
typedef vector <vii> vvii;

const ll mod = 998244353;
const int MAX = 1e7+7;
const db eps = 1e-13;


ll f[MAX];
ll invf[MAX];
ll ans;

ll exp( ll a , ll b ) {
    ll res = 1;
    while( b ) {

        if( b%2 ) {
            res = ( res * a ) % mod;
        }
        a = ( a * a ) % mod;
        b /= 2ll;

    }

    return res;
}

void initFact() {
    f[0] = 1;
    for( int i = 1 ; i < MAX ; i++ )
        f[i] = f[i-1] * i % mod;

    invf[MAX-1] = exp( f[MAX-1] , mod-2 );
    for( int i = MAX-2 ; i >= 0 ; i-- ) {

        invf[i] = invf[i+1] * (i+1) % mod;

    }
}

ll combination( ll a , ll b ) {
    return f[a] * invf[a-b] % mod * invf[b] % mod;
}


int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    cout<<setprecision(0)<<fixed;

    initFact();

    int n;cin>>n;

    ans = exp(3 , n);

    vi p2(n+1,1);
    for( int i = 1 ; i <= n ; i++ )
        p2[i] = p2[i-1] * 2 % mod;

    for( int i = (n/2+1) ; i <= n ; i++ ) {
        ans -= ( combination(n , i) * p2[n-i] * 2 ) % mod;
        ans += mod;
        ans %= mod;
    }

    cout<<ans<<"\n";

}


Measured memory_bytes: 234624
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  string s; in(s);
  print(700 + 100*((s[0]=='o') + (s[1] == 'o') + (s[2] == 'o')));
  return 0;
}


Measured memory_bytes: 3576
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type.Int

const val P = 1000000007L

// Find (x, y, r) such that r = gcd(a,b) and ax + by = r.
fun extendedGCD(a: Long, b: Long): Triple<Long, Long, Long> {
  var x0 = 1L
  var y0 = 0L
  var z0 = a
  var x1 = 0L
  var y1 = 1L
  var z1 = b
  while (true) {
    if (z1 == 0L) return Triple(x0, y0, z0)
    val q = z0 / z1
    val x2 = x0 - q * x1
    val y2 = y0 - q * y1
    val z2 = z0 - q * z1
    x0 = x1
    x1 = x2
    y0 = y1
    y1 = y2
    z0 = z1
    z1 = z2
  }
}

fun inverseMod(a: Long, m: Long): Long {
  val (x, y, r) = extendedGCD(a, m)
  if (r != 1L) return 0  // No inverse.

  return (x + m) % m
}

fun timesMod(x: Long, y: Long): Long {
  return x * y % P
}

fun plusMod(x: Long, y: Long): Long {
  return (x + y) % P
}

fun minusMod(x: Long, y: Long): Long {
  return (x - y + P) % P
}

class FiniteField(xRaw: Long) {
  val x = if (xRaw >= 0) xRaw % P else (P - ((-xRaw) % P)) % P
  constructor(xi: Int): this(xi.toLong())
  operator fun plus(o: FiniteField) = FiniteField((x + o.x) % P)
  operator fun plus(o: Int) = this + FiniteField(o)
  operator fun minus(o: FiniteField) = FiniteField((x + P - o.x) % P)
  operator fun minus(o: Int) = this - FiniteField(o)
  operator fun times(o: FiniteField) = FiniteField((x * o.x) % P)
  operator fun times(o: Int) = this * FiniteField(o)
  operator fun div(o: FiniteField) = this * inverseMod(o.x, P).toInt()
  operator fun div(o: Int) = this * FiniteField(o)
  override fun toString() = x.toString()
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val factorialTable = Array(n, { FiniteField(0L) })
  factorialTable[0] = FiniteField(1)
  for (k in 1..(n - 1)) {
    factorialTable[k] = factorialTable[k - 1] * k
  }
  val inverseFactorialTable = factorialTable.map { FiniteField(1) / it }.toTypedArray()

  val fTable = Array(n, { k ->
    if (2 * k < n) FiniteField(0)
    else factorialTable[k] * factorialTable[k - 1] / factorialTable[2 * k - n]
  })

  var ans = FiniteField(0)
  for (k in 1..(n - 1)) {
    val count = fTable[k] - fTable[k - 1]
    ans += count * k
  }
  println(ans)
}

Measured memory_bytes: 196332
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
using namespace std;

int main() {
  double t, x;
  cin >> t >> x;
  cout << std::setprecision(10) << t / x << endl;
}

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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a >= 13)
		cout << b;
	else if (a >= 6 && a <= 12)
		cout << b / 2;
	else
		cout << 0;
	
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  int a[n];
  int b[100000];

  REP(i,100000){
    b[i] = 0;
  }
  REP(i,n){
    cin>>a[i];
    b[a[i]]++;
  }
  int ans = 0;
  for(int i=1;i<99999;i++){
	ans = max(ans,b[i-1]+b[i]+b[i+1]);
  }
  cout<<ans<<endl;
  return 0;
              

  
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 N;
  cin >> N;
  vector<int64> x(N);
  REP(i, N) cin >> x[i];
  vector<int64> res(N*N, -1);
  REP(i, N) res[x[i]-1] = i+1;
  queue<int64> put;
  REP(i, N*N) {
    if (res[i] == -1) put.push(i);
    else {
      REP(j, res[i]-1) {
        if (put.size()) {
          res[put.front()] = res[i]; put.pop();
        } else {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  put = queue<int64>();
  vector<int> used(N+1, 0);
  for (int64 i = N*N-1; i >= 0; i--) {
    if (res[i] == -1) {
      put.push(i);
    } else {
      if (used[res[i]]) continue;
      used[res[i]] = 1;
      REP(j, N-res[i]) {
        if (put.size()) {
          res[put.front()] = res[i]; put.pop();
        } else {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
  REP(i, res.size()) {
    cout << res[i] << " ";
  }
  cout << endl;
}


Measured memory_bytes: 4224
length = int(input())
targ = [int(n) for n in input().split(' ')]
for l in range(length):
    for m in range(l):
        if targ[l - m] < targ[l - m - 1]:
            disp = targ[l-m -1]
            targ[l-m-1] = targ[l-m]
            targ[l-m] = disp
    print(" ".join([str(n) for n in targ]))

Measured memory_bytes: 7680
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    int H,W;
    cin >> H >> W;
    char S[H][W];
    rep(i,H) cin >> S[i];
    rep(i,H) rep(j,W){
        if(S[i][j]=='#') continue;
        char bomb='0';
        if(i!=0) if(S[i-1][j]=='#') bomb++;
        if(i!=H-1) if(S[i+1][j]=='#') bomb++;
        if(j!=0) if(S[i][j-1]=='#') bomb++;
        if(j!=W-1) if(S[i][j+1]=='#') bomb++;
        if(i!=0 && j!=0) if(S[i-1][j-1]=='#') bomb++;
        if(i!=0 && j!=W-1) if(S[i-1][j+1]=='#') bomb++;
        if(i!=H-1 && j!=0) if(S[i+1][j-1]=='#') bomb++;
        if(i!=H-1 && j!=W-1) if(S[i+1][j+1]=='#') bomb++;
        S[i][j]=bomb;
    }
    rep(i,H){
        rep(j,W) cout << S[i][j];
        cout << endl;
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,i,j,ans,nr[105];
pair<int,int>p,tmp,a[105],b[105],ers;
set<pair<int,int> >c,c1,s1,s[105];
set<pair<int,int> >::iterator it;
int main()
{
    //freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)cin>>a[i].fr>>a[i].sc;
	for(i=1;i<=n;i++)cin>>b[i].fr>>b[i].sc;
	for(i=1;i<=n;i++)for(j=1;j<=n;j++)if(a[i].fr<b[j].fr && a[i].sc<b[j].sc)s[j].in({1,i}),nr[i]++;
	for(i=1;i<=n;i++)
	{
		s1=s[i];
		for(it=s1.begin();it!=s1.end();it++)
		{
			p=(*it);
			s[i].er(s[i].fd(p));
			s[i].in({nr[p.sc],p.sc});
		}
	}
	for(i=1;i<=n;i++)if(!s[i].empty())c.in({(int)s[i].size(),i});
	while(!c.empty())
	{
		p=(*c.begin());
		ers=(*s[p.sc].begin());
		ans++;
		c1=c;
		for(it=c1.begin();it!=c1.end();it++)
		{
			tmp=(*it);
			if(s[tmp.sc].fd(ers)!=s[tmp.sc].end())
			{
				s[tmp.sc].er(s[tmp.sc].fd(ers));
				c.er(c.fd(tmp));
				if(tmp.fr>1 && tmp.sc!=p.sc)c.in({tmp.fr-1,tmp.sc});
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int gcd(int a, int b) {
	while (b != 0) {
		int tmp = b;
		b = a%b;
		a = tmp;
	}
	return a;
}

int lcm(int a, int b) {
	return (a*b)/gcd(a, b);
}

int main(){
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) cin >> nums[i]; 
	int res = 1;
	for (int i = 0; i < nums.size(); i++) {
		res = lcm(res, nums[i]);
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using ll = int_fast64_t;

struct UnionFind {
  std::vector<ll> data;

  UnionFind(ll sz) {
    data.assign(sz, -1);
  }

  bool unite(ll x, ll y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) std::swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  ll find(ll k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  ll size(ll k) {
    return (-data[find(k)]);
  }
};

int main(){
        ll n, m, k;
        scanf("%ld %ld %ld", &n, &m, &k);

        std::vector<ll> frndcnt(n, 0);
        UnionFind tree(n);
        for(ll i=0; i<m; i++){
                ll a, b;
                scanf("%ld %ld", &a, &b);
                frndcnt[a-1]++;
                frndcnt[b-1]++;
                tree.unite(a-1, b-1);
        }

        std::vector<ll> ans(n);
        for(ll i=0; i<n; i++) ans[i] = tree.size(i) - frndcnt[i] - 1;

        for(ll i=0; i<k; i++){
                ll c, d;
                scanf("%ld %ld", &c, &d);
                if(tree.find(c-1)==tree.find(d-1)){
                        ans[c-1]--;
                        ans[d-1]--;
                }
        }

        for(ll i=0; i<n; i++) printf("%ld ", ans[i]);
        puts("");
        return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
	return 0;
}

Measured memory_bytes: 256
a = [ int(input()) for _ in range(5) ]
k = int(input())
 
t = True
for i in range(5):
  for j in range(i+1,5):
    t = abs(a[i]-a[j]) <= k
    if not t:
      break
  if not t:
    break
      
print( "Yay!" if t else ":(" )

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

int main(){
    int n;
    
    cin >> n;
    while(n--){
        int s,g;
        vector<int> v;
        
        cin >> s >> g;
        if(s < g){
            for(int i = s ; i <= g ; i++) v.push_back(i);
        }
        else if(s > g){
            if(s > 5){
                for(int i = s ; i <= 9 ; i++) v.push_back(i);
                if(g > 5){
                    for(int i = 5 ; i >= 0 ; i--) v.push_back(i);
                    for(int i = 1 ; i <= g ; i++) v.push_back(i);
                }
                else{
                    for(int i = 5 ; i >= g ; i--) v.push_back(i);
                }
            }
            else if(s <= 5){
                for(int i = s ; i >= g ; i--) v.push_back(i);
            }
        }
        
        for(int i = 0 ; i < v.size() ; i++){
            if(!i) cout << v[i];
            else cout << ' ' << v[i];
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1216
import java.io.*
import java.util.*

fun solve(A: LongArray){
    A.sort()
    println(A[2] - A[0])
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val A = LongArray(3.toInt())
    for (i in 0 until 3.toInt()) {
        A[i] = sc.next().toLong()
    }
    solve(A)
}



Measured memory_bytes: 33824
import math
from itertools import combinations_with_replacement

K = int(input())

ans = 0


for i, j, k in combinations_with_replacement(list(range(1,K+1)), 3):
    lstset = {i, j, k}
    if len(lstset)==3: ans += math.gcd(math.gcd(i,j), k) * 6
    elif len(lstset)==2: ans += math.gcd(math.gcd(i,j), k) * 3
    else: ans +=  math.gcd(math.gcd(i,j), k)
    
print(ans)

Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string S,T;
  cin >> S >> T;
  int n=2*S.size();
  S=S+S+S;
  bool flag=false;
  for(int i=0;i<n;i++){
    if(T[0]==S[i]){
      for(int j=0;j<T.size();j++){
        if(T[j]==S[i+j]){
          if(j==T.size()-1){
            flag=true;
            break;
          }
          continue;
        }else{
          break;
        }
      }
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main()
{
	string a,b;
	cin>>a>>b;
	int dp[1001][1001]={};
	for(int i=0;i<=a.length();i++)dp[i][0]=i;
	for(int j=0;j<=b.length();j++)dp[0][j]=j;
	for(int i=0;i<a.length();i++)
	{
		for(int j=0;j<b.length();j++)
		{
			dp[i+1][j+1]=min(dp[i][j]+(a[i]!=b[j]),min(dp[i+1][j]+1,dp[i][j+1]+1));
		}
	}
	cout<<dp[a.length()][b.length()]<<endl;
	return 0;
}

Measured memory_bytes: 7120
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <deque>
using namespace std;

int main() {
    //input
    long l,r; cin >> l >> r;
    int M = 2019;

    //compute
    if(r - l >= 2018){
        cout << 0 << endl;
        return 0;             
    }
  
    long long rmin;
    rmin = ((l % M) * (r % M)) % M;
  
    l = l % M;
    r = r % M;

    for(int i = 0;i < r - l + 1; i++) {
        for(int j = i + 1; j < r - l + 1 ; j++){
            long long tmp;
            tmp = ((l + i) % M) * ((l + j) % M) % M;
            if(tmp < rmin){
                rmin = tmp;         
            }
        } 
    }

    //output
    cout << rmin << endl;
}


Measured memory_bytes: 3604
x,k,d = map(int,input().split())
x = abs(x)
div,mod = divmod(x,d)
# print(div,mod)
if div >= k:
    print(x-d*k)
else:
    if (k-div)%2==0:
        print(mod)
    else:
        print(abs(mod-d))

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	string s;
	cin>>s;
	int cnt = 0;
	for(int i = 1; i < s.size(); i++){
		if(s[i] != s[i - 1])cnt++;
	}
	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
// #define N 1000005
#define ull unsigned long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define ull unsigned long long 
#define sc second
#define pb push_back
#define mp make_pair
#define sp <<" "
#define all(a) (a).begin(),(a).end()
#define fi(i,a,n) for(int i=a ; i<n ; i++)
#define fd(i,n,a) for(int i=n-1 ; i>=a ; i--)
#define r0 return 0;
#define ln "\n"
#define INF (int)1e15
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
	// fast
    // int t;cin>>t;
    // while(t--){

    // }
    ll a,b,c;cin>>a>>b>>c;
    ll ans=a/b;
    if(a%b!=0) ans++;
    cout<<ans*c<<"\n";
	r0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int n,f[1000010],add;
int main()
{
    scanf("%d",&n);
    f[n]=n;
    f[n-1]=(long long)n*n%mod;
    for(int i=n-2;i>=1;--i)
    {
        add=(add+f[i+3])%mod;
        f[i]=f[i+1],f[i]=(f[i]+(long long)(n-1)*(n-1)%mod)%mod,f[i]=(f[i]+add)%mod,f[i]=(f[i]+i+1)%mod;
    }
    cout<<f[1]<<endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <time.h>
#include <stdlib.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define clr(x) x.clear()
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(),a.end()
#define ign cin.ignore();

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//to delete an element
//s.erase(s.find_by_order(s.order_of_key(ele)));
//where s is the name of the ordered_set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

using namespace std;
using namespace __gnu_pbds;

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 << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef MY_PROJECT
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main()
{
    IOS
    ll n;
    cin>>n;
    vll v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    ll ele=n/2;
    map<pll,ll> m;
    m[mp(0,1)]=v[0];
    for(ll i=1;i<=n+1ll-2ll*ele;i++)
    {
        m[mp(i,1)]=max(m[mp(i-1,1)],v[i]);
    }
    for(ll i=2;i<=ele;i++)
    {
        ll first=(i-1)*2ll;
        ll last=n+1ll-2ll*ele+(i-1)*2ll;
        for(ll j=first;j<=last;j++)
        {
            if(j==first){
                m[mp(j,i)]=v[j]+m[mp(j-2,i-1)];
            }
            else{
                m[mp(j,i)]=max(m[mp(j-1,i)],v[j]+m[mp(j-2,i-1)]);
            }
        }
    }
    cout<<m[mp(n-1,ele)];
    return 0;
}


Measured memory_bytes: 23460