akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod1 1000000007
#define ff first
#define ss second
#define INF 1e9
#define INFLL 1e18
typedef long long int ll;
// #define intLL unsigned long long int//used when x<2^64-1 && x>0
#define int long long//used when x<2^63-1
int fact[200005];
int power(int a, int b)
{
    int res=1;
    while(b)
    {
        if(b&1)
        {
            res*=a;
            res%=mod1;
        }
        a*=a;
        a%=mod1;
        b/=2;
    }
    return res;
}
int add(int a, int b)
{
    return (0LL+a+b)%mod1;
}
int sub(int a, int b)
{
    return add(a, mod1-b);
}
int mul(int a, int b)
{
    return (1LL*a*b)%mod1;
}
int inv(int x)
{
    return power(x, mod1-2);
}
int nCr(int n, int r)
{
    return mul(fact[n], inv(mul(fact[r], fact[n-r])));
}
int cmp(const pair<int, int> &a, const pair<int, int> &b)
{
    return (a.ff>b.ff);
}
int32_t main()
{

    IOS;
    int n, m, s;
    cin>>n>>m>>s;
    vector<pair<int, pair<int,int>>> gr[55];//{v, {cost, time}}
    for(int i=0;i<m;i++)
    {
        int u, v, a, b;
        cin>>u>>v>>a>>b;
        u--, v--;
        gr[u].pb({v, {a, b}});
        gr[v].pb({u, {a, b}});
    }
    int c[n+1], d[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>c[i]>>d[i];
        c[i]=min(c[i], 2500LL);
    }
    s=min(s, 2500LL);
    int dp[n+1][2501];
    for(int i=0;i<n;i++)
        for(int j=0;j<2501;j++)
            dp[i][j]=INFLL;
    dp[0][s]=0;//dp[i][j] means reached at vertex i with j coins left
    for(int lol=0;lol<n+1;lol++)
    {
        for(int i=0;i<n;i++)
        {
            for(auto it: gr[i])
            {
                for(int j=0;j<=2500;j++)
                {
                    if(j-it.ss.ff>=0)
                    {
                        dp[i][j-it.ss.ff]=min(dp[i][j-it.ss.ff], dp[it.ff][j]+it.ss.ss);
                    }
                }
            }
            for(int j=0;j<=2500;j++)
            {
                if(j-c[i]>=0)
                    dp[i][j]=min(dp[i][j], dp[i][j-c[i]]+d[i]);
            }
        }
    }
    for(int i=1;i<n;i++)
    {
        int ans=INFLL;
        for(int j=0;j<=2500;j++)
            ans=min(ans, dp[i][j]);
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4656
#include <bits/stdc++.h>
#define Mod 1000000007
#define INF 9999999999
#define INFL 99999999999
#define EPS 1e-9
#define pb push_back
#define mp make_pair
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define N 100005
#define fs first
#define sc second 
using namespace std;
typedef  long long int ll;
typedef pair<ll,ll> ii;
typedef vector <ii> vii;
typedef vector <ll> vi;

int gcd(int a, int b)
{
    // Everything divides 0 
    if (a == 0 || b == 0)
       return 0;
 
    // base case
    if (a == b)
        return a;
 
    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main()
{
//#ifndef ONLINE_JUDGE
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
//#endif
ios::sync_with_stdio(false);
 cin.tie(0);
string s;
cin>>s;
for(int i=0;i<s.size();i+=2)
{
    cout<<s[i];
}



return 0;

}


Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int k,n; cin >> k >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int ma=0;
	for(int i=0;i<n-1;i++){
		ma=max(ma,a[i+1]-a[i]);
	}
	ma=max(ma,a[0]+k-a[n-1]);
	cout << k-ma << endl;
}




Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

int main(void)
{
    ll n;
    string s;
    cin >> n >> s;

    ll dp[n + 1][10] = {};
    repm(i, n - 1, 0)
        rep(j, 0, 10)
            dp[i][j] = s[i] - '0' == j ? 1 : dp[i + 1][j];

    vector<vector<bool>> pass(10, vector<bool>(10));
    ll ans = 0;
    rep(i, 0, n)
    {
        rep(j, i + 1, n)
        {
            if (pass[s[i] - '0'][s[j] - '0'])
                continue;
            pass[s[i] - '0'][s[j] - '0'] = true;
            rep(k, 0, 10)
                ans += dp[j + 1][k];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,k;
  cin>>n>>k;
  int v[n],l[n],r[n];
  REP(i,n){
    cin>>v[i];
    if(i==0){
      l[i]=v[i];
    }else{
      l[i]=l[i-1]+v[i];
    }
  }
  for(int i=n-1;i>=0;i--){
    if(i==n-1){
      r[i]=v[i];
    }else{
      r[i]=r[i+1]+v[i];
    }
  }
  int ans=0;
  int res;
  vector<int> temp;
  REP(i,k+1){//取る個数
    if(i>n){
      continue;
    }
    for(int j=0;j<=i;j++){//左から取る個数
      res = 0;
      temp.clear();
      if(j!=0){
        res += l[j-1];
      }
      if(j!=i){
        res += r[n-(i-j)];
      }
      if(j!=0){
        REP(s,j){
          temp.push_back(v[s]);
        }
      }
      if(j!=i){
        for(int s=n-(i-j);s<=n-1;s++){
          temp.push_back(v[s]);
        }
      }
      sort(temp.begin(),temp.end());
      REP(s,k-i){
        if(s>=i){
          break;
        }
        if(temp[s]<0){
          res -= temp[s];
        }
      }
      ans = max(ans,res);
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        
        int gohyaku_mai = num1 / 500;
        int ichi_mai = num1 - 500 * gohyaku_mai;
      
        if(ichi_mai <= num2) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21332
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(M)]

g = {i:0 for i in range(N)}

for a,b in ab:
    g[a-1] += 1
    g[b-1] += 1
    
for i in g.values():
    print(i)

Measured memory_bytes: 9080
import sys

n = int(sys.stdin.readline())
p = [int(sys.stdin.readline()) for i in range(n)]
a = [0] * n
for i in range(n):
    a[p[i]-1] = i
prv = -1
mx = 1
nw = 0
for i in range(n):
    if prv < a[i]:
        nw += 1
        mx = max(mx, nw)
    else:
        nw = 1
    prv = a[i]
print(n-mx)


Measured memory_bytes: 18924
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;

int main(){
    int H,N;
    cin>>H>>N;
    vector<int> A(N),B(N);
    ll max_value=0;
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
        if(A[i]>max_value) max_value=A[i];
    }
    
    vll dp(H+max_value,-1);
    
    dp[0]=0;
    
    for(int i=0;i<dp.size();i++){
        if(dp[i]==-1) continue;
        for(int j=0;j<N;j++){
            if(i+A[j]<dp.size()){
                if(dp[i+A[j]]==-1) dp[i+A[j]]=dp[i]+B[j];
                else dp[i+A[j]]=min(dp[i+A[j]],dp[i]+B[j]);
            }
        }
    }
    
    //for(int i=0;i<dp.size();i++) printf("%d|",dp[i]);
    //printf("\n");
    
    ll min_value=10e+100;
    for(int i=H;i<H+max_value;i++){
        if(dp[i]<min_value && dp[i]!=-1){
            min_value=dp[i];
        }
    }
    
    cout<<min_value<<endl;
    return 0;
}


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

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

    if (s.size() > (unsigned int)k) {
        cout << s.substr(0, k) << "..." << endl;
    }
    else {
        cout << s << endl;
    }
}


Measured memory_bytes: 3632
def solve(hajime, ima, wa):
  for i in range(10):
    #print("hajime : "+str(hajime))
    #print("ima : "+str(ima))
    #print("wa : " + str(wa))
    if i == 1 and wa + c[ima][i] < toone[hajime]:
      toone[hajime] = wa + c[ima][i]
    elif wa + c[ima][i] < toone[hajime] and i != ima:
      solve(hajime, i, wa+c[ima][i])
  return
      
    


h,w = list(map(int, input().split()))
c = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(h)]
toone=[10**4]*10
toone[1]=0

for i in range(10):
  if i != 1:
    solve(i, i, 0)

#print(toone)
ans = 0
for i in range(h):
  for j in range(w):
    if a[i][j] != -1:
      ans += toone[a[i][j]]
print(ans)

Measured memory_bytes: 3444
//Waqt Ha Badal Jayega//

#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ld long double
using namespace std;

ll minSwaps(ll arr[], ll n)
{
	pair<ll, ll> arrPos[n];
	for (ll i = 0; i < n; i++)
	{
		arrPos[i].first = arr[i];
		arrPos[i].second = i;
	}
	sort(arrPos, arrPos + n);
	vector<bool> vis(n, false);
	ll ans = 0;
	for (ll i = 0; i < n; i++)
	{

		if (vis[i] || arrPos[i].second == i)
			continue;

		ll cycle_size = 0;
		ll j = i;
		while (!vis[j])
		{
			vis[j] = 1;
			j = arrPos[j].second;
			cycle_size++;
		}
		if (cycle_size > 0)
		{
			ans += (cycle_size - 1);
		}
	}
	return ans;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*
	ll t;
	cin >> t;
	while (t--)
	{
		ll n, m;
		cin >> n >> m;
		ll a[n];
		for (ll i = 1; i <= n; i++)
		{
			cin >> a[i];
		}
		ll x, y;
		ll count = 0;
		vector<pair<ll, ll> >f;
		while (m--)
		{
			cin >> x >> y;
			f.push_back(make_pair(x, y));
		}
		cout << f.size() << "\n";

	}*/
	string s;
	cin >> s;
	if (s == "ABC")
	{
		cout << "ARC" << "\n";
	}
	else
	{
		cout << "ABC" << "\n";
	}
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll a,b,c; cin>>a>>b>>c;
	ll mx_poison = (a+b+1);
	c=min(c,mx_poison);
	cout<<b+c<<'\n';
}


Measured memory_bytes: 256
#include<stdio.h>

int selectionSort(int data[],int n){
    int i,j,count = 0,minj,temp;
    for(i = 0;i <= n-1;i++){
        minj = i;
        for(j = i;j <= n-1;j++){
            if(data[j] < data[minj]){
                minj = j;
            }
        }
        temp = data[i];
        data[i] = data[minj];
        data[minj] = temp;
        if(i != minj)count++;
    }
    return count;
}
int main(){
   int n,i,data[100],count;
   scanf("%d",&n);
   for(i = 0;i < n;i++){
       scanf("%d",&data[i]);
   } 
count = selectionSort(data,n);
   for(i = 0;i < n-1;i++)printf("%d ",data[i]);
   printf("%d\n",data[i]);
   printf("%d\n",count);
   return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

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

	int N;
	cin >> N;
	double ans = 0;
	for(int i=0; i<N; i++){
		double tmp;
		string type;
		cin >> tmp >> type;
		if(type == "JPY"){
			ans += tmp;
		}
		else{
			ans += tmp * (double)380000;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int temp = 10000, ans = 0;
    for (int i = 1; i < N - 1; i++) {
        if (A[i - 1] == A[i + 1] && A[i - 1] == A[i]) {
            ++ans;
            A[i] = temp;
        }
    }
    for (int i = 0; i < N - 1; i++) {
        if (A[i] == A[i + 1]) {
            ++ans;
            A[i] = temp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def liner_search(r,key):
    for x in r:
        if x == key:
            return True
    return False


N = int(input())
S = list(map(int, input().split()))
q = int(input())
Key = list(map(int, input().split()))
cnt = 0
for i in range(q):
    if liner_search(S, Key[i]):
        cnt += 1

print(cnt)

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

int n;
string str;

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

	int cc=0;

	for(int i=0;i<n;i++){
		if(str[i]=='E')	cc++;
	}

	int mx=cc;

	for(int i=0;i<n;i++){
		if(str[i]=='E')	cc--;
		else	cc++;

		mx=min(mx,cc);
	}

	cout << mx << endl;

	return 0;
}

Measured memory_bytes: 900
using System;

class Program {
    static void Main() {
        int[] prices = {6000, 4000, 3000, 2000};

        for (var i = 0; i < 4; i++) {
            var l = Console.ReadLine().Split(' ');

            Console.WriteLine(prices[int.Parse(l[0]) - 1] * int.Parse(l[1]));
        }
    }
}

Measured memory_bytes: 9176
(defun app ()
    (let* ((n (read))
        (k (read))
        (p (make-array n :initial-element 0))
        (ans 0))

        (dotimes (i n)
        (setf (aref p i) (read)))

        (sort p #'<)
        (dotimes (i k)
            (incf ans (aref p i))
        )
    (format t "~D~%" ans)
    )
)
(app)


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

int main(void)
{
        char s[10] = {0};
        std::cin >> s;
        for(int i = 0; s[i]; i++){
                if(s[i] == 'A' && s[i+1] == 'C'){
                        std::cout << "Yes" << std::endl;
                        return 0;
                }
        }
        std::cout << "No" << std::endl;
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

int main()
{
    string s,t;
    int ans = 1e5,cnt = 0;
    cin >> s;
    nfor(i, 'a', 'z' + 1){
        t = s;
        cnt = 0;
        while (1) {
            bool f = false;
            rep0(j, t.size() - 1)if(t[j] != t[j + 1])f = true;
            if(!f)break;
            rep0(j, t.size()){
                if(t[j + 1] == i)t[j] = (char)i;
                if(j == t.size() - 1)t = t.substr(0,t.size() - 1);
            }
            ++cnt;
        }
        ans = min(cnt, ans);
    }
    pf(ans)
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const ll MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans=0;
    rep(i,10) {
        rep(j,10) {
            rep(k,10){
                vector<int> tmp={i,j,k};
                int cnt=0;
                rep(l,n) {
                    if (cnt>=3) continue;
                    if (s[l]-'0'==tmp[cnt]) ++cnt;
                }
                if (cnt==3) ++ans;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        StringBuilder res = new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='0') res.append(0);
            else if(s.charAt(i)=='1') res.append(1);
            else{
                if(res.length()>0) res.delete(res.length()-1,res.length());
            }
        }
        System.out.println(res.toString());
    }
}


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

int main(){
    string s;
    cin >> s;
    bool can = true;
    for(int i = 0;i < s.size();i++){
        if(i % 2 == 0){
            if(s[i] != 'R'&&s[i] !='U'&&s[i] !='D') can = false;
        }else if(i % 2 == 1){
            if(s[i] != 'L'&&s[i] !='U'&&s[i]!='D') can = false;
        }
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
int MOD = 1000000007;

using namespace std;

signed main(){
    
    int n;
    string s[2];
    cin >> n >> s[0] >> s[1];

    int ans = 1;
    REP(i,n){
        if(s[0][i] != s[1][i]){
            if(i == 0) ans *= 6;
            else if(s[0][i-1] == s[1][i-1]) ans *= 2;
            else ans *= 3;
            i++;
        }else{
            if(i == 0) ans *= 3;
            else if(s[0][i-1] == s[1][i-1]) ans *= 2;
            else ans *= 1;
        }
        ans %= MOD;
    }
  
    cout << ans << endl;

    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'


int x, y, z;
signed main()
{
    cin >> x >> y >> z;

    cout << z << " " << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
m=math.pi
print(2*n*m)


Measured memory_bytes: 69120
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	int n, w;
	cin >> n >> w;
	vector<pair<ll, ll>> r(n);
	rep(i, n) {
		ll ww, v;
		cin >> ww >> v;
		r[i] = pair<ll, ll>(ww, v);
	}
	vector<vector<ll>> dp(110, vector<ll>(100010, INF));
	dp[0][0] = 0;
	rep(i, n) {
		rep(j, 100010) {

			if (j - r[i].second >= 0) {
				chmin(dp[i + 1][j], dp[i][j - r[i].second] + r[i].first);
			}
			chmin(dp[i + 1][j], dp[i][j]);
		}
	}
	ll ans = 0;
	rep(i, 100010) {
		if (dp[n][i] <= w)
		{
			ans = i;
		}
	}
	cout << ans << endl;
	//cout << fixed << setprecision(10) << ans << endl;
	system("pause");
}

Measured memory_bytes: 90388
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

char in[N];
int n, k;

int main() {
    scanf("%d%d%s", &n, &k, in);
    int ans = 0;
    for (int i = 1; i < n; i++) {
        if (in[i] == in[i-1]) ans++; 
    }
    cout << min(n-1, ans + 2 * k);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(void){
    int N;
    cin >> N;
    string S;
    cin >> S;
    string ans;
    if(N % 2 == 0){
            if(S.substr(0,N/2) == S.substr(N/2,N/2)){
                ans = "Yes";
            }else{
                ans = "No";
            }
    }else{
        ans = "No";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define hell 1000000007
#define f first
#define s second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
const ll N = 800 ;
void solve()
{
    ll n , h , w , ans = 0 ;
    cin >> n >> h >> w ;
    rep( i , 1 , n + 1 ) 
    {
        rep( j , 1 , n + 1 )
        {
            if( j + w - 1 <= n && i + h - 1 <= n )
                ans++;
        }
    }
    cout << ans ;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <string.h>

using namespace std;

int H,W,N;

int main(){
    cin >> H >> W >> N;
    int cnt;
    while(N>0){
        if(H < W){
            N -= W;
            H--;
        }else{
            N -= H;
            W--;
        }
        cnt++;
    }

    cout << cnt << endl;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

    int H; cin >> H;
    int W; cin >> W;

    while (!(H == 0 && W == 0)) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if ((i + j) % 2 == 0) cout << '#';
                else cout << '.';
            }
            cout << '\n';
        }
        cout << '\n';
        cin >> H;
        cin >> W;
    }

    return 0;
}



Measured memory_bytes: 3016
import sys
import math


def input():
    return sys.stdin.readline().rstrip()


def main():
    S = list(input())

    count1 = 0
    count2 =0
    b ="1"
    w ="0"
    for i in range(len(S)):
        if int(S[i]) != i%2:
            count1 +=1
        if int(S[i]) != (i+1)%2:
            count2 +=1
    print(min(count1,count2))





if __name__ == "__main__":
    main()


Measured memory_bytes: 77920
#include <iostream>

using namespace std;



int main()
{
   int a,b;
   cin >> a >> b;
   
   if (a == b)
       cout << "a == b" << endl; 
   else if (a > b)
       cout << "a > b" << endl;
   else if (a < b)
       cout << "a < b" << endl;
   
   return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long double a;
	cin >> a;
	cout.precision(10);
	cout << (a / 3) * (a / 3) * (a / 3);
	return 0;
}
 

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll H,W,h,w;
ll s[505];

int main(){
  cin>>H>>W>>h>>w;
  if(H%h==0&&W%w==0){
    cout<<"No"<<endl;
    return 0;
  }
  bool swapped=false;
  if(W%w==0){
    swap(H,W); 
    swap(h,w);
    swapped=true;
  }

  s[W]=1;
  for(ll i=W-w;i>=0;i-=w){
    s[i]=s[i+w]+1;
  }
  rep(i,W+1){
    if(s[i]>0)continue;
    if(i-w>=0)s[i]=s[i-w]-1;
    else s[i]=0;
  }

  cout<<"Yes"<<endl;
  if(!swapped){
    rep(i,H){
      rep(j,W)cout<<s[j+1]-s[j]<<" ";
      cout<<endl;
    }
  }else{
    rep(i,W){
      rep(j,H)cout<<s[i+1]-s[i]<<" ";
      cout<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1408
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush =
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var K = cin.ReadInt;
			var table = new int[K, K];
			for(int i = 0; i < K; i++) {
				for(int j = 0; j < K; j++) {
					table[i, j] = gcd(i + 1, j + 1);
				}
			}
			var sum = 0L;
			for(int i = 0; i < K; i++) {
				for(int j = 0; j < K; j++) {
					for(int k = 0; k < K; k++) {
						sum += gcd(table[i, j], k + 1);
					}
				}
			}
			Console.WriteLine(sum);
		}
		public int gcd(int a, int b) {
			if(b == 0) {
				return a;
			}
			var q = a / b;
			var g = gcd(b, a - q * b);
			return g;
		}
	}
	static class ExtendClass {
		public static void Swap<T>(this T[] A, int x, int y) {
			var tmp = A[x];
			A[x] = A[y];
			A[y] = tmp;
		}
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek() == -1; }
		}
	}

}


Measured memory_bytes: 27940
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
ll N;
int main(){
    cin >> N;
    ll L[100];
    L[0] = 2;
    L[1] = 1;
    for(int i = 2; i <= N; i++){
        L[i] = L[i - 1] + L[i - 2];
    }
    cout << L[N] << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
MOD = 10 ** 9 + 7

# A: 0, G: 1, C: 2, T: 3
# NG: AGC, 1回入れ替えてAGC
# AGC, GAC, ACG, A?GC, AG?C
# 012, 102, 021, 0?12, 01?2

# dp: 文字数、最後から3,2,1文字目がいくつあるか
dp = Array.new(101) { Array.new(4) { Array.new(4) { Array.new(4, 0) } } }
dp[0][3][3][3] = 1 # ????

N.times do |i|
  4.times do |j| # 最後から1文字目の文字
    4.times do |k|
      4.times do |l|
        next if dp[i][j][k][l] == 0
        4.times do |c|
          next if c == 2 && j == 1 && k == 0
          next if c == 2 && j == 0 && k == 1
          next if c == 1 && j == 2 && k == 0
          next if c == 2 && j == 1 && l == 0
          next if c == 2 && k == 1 && l == 0
          dp[i + 1][c][j][k] += dp[i][j][k][l]
          dp[i + 1][c][j][k] %= MOD
        end
      end
    end
  end
end

ans = 0
4.times do |j|
  4.times do |k|
    4.times do |l|
      ans += dp[N][j][k][l]
      ans %= MOD
    end
  end
end

puts ans

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

struct segtree{
    int n;
    vector<pii> dat;
    segtree(int size,pii x){
        n=1;
        while(n<size) n*=2;
        dat.assign(2*n-1,x);
    }
    // update k th element
    void update(int k,pii a) {
        k+=n-1; // leaf
        dat[k]=a;
        while(k>0) {
            k=(k-1)/2;
            dat[k]=max(dat[k*2+1],dat[k*2+2]);
        }
    }
    // min [a, b)
    pii query(int a,int b) { return query(a,b,0,0,n); }
    pii query(int a,int b,int k,int l,int r) {
        if(r<=a or b<=l) return make_pair(-1,-1);
        if(a<=l and r<=b) return dat[k];
        int m=(l+r)/2;
        return max(query(a,b,k*2+1,l,m),query(a,b,k*2+2,m,r));
    }
};

void solve(){
    while(true){
        int n,q;
        cin >> n >> q;
        if(n==0 and q==0) break;

        vector<int> parent(n,-1);
        vector<vector<int>> children(n);
        vector<bool> is_leaf(n,true);
        rep(i,1,n){
            cin >> parent[i];
            --parent[i];
            children[parent[i]].emplace_back(i);
            is_leaf[parent[i]]=false;
        }

        vector<int> depth(n);
        vector<vector<int>> belong(n);
        vector<segtree> segs;
        function<void(int,int)> calc_depth=[&](const int v,const int d){
            depth[v]=d;
            for(const auto& u:children[v]) calc_depth(u,d+1);
        };
        calc_depth(0,0);
        rep(i,0,n) if(is_leaf[i]){
            segs.emplace_back(segtree(depth[i]+1,make_pair(-1,-1)));
            segs.back().update(0,make_pair(0,0));
            int v=i;
            while(v!=-1){
                belong[v].emplace_back(segs.size()-1);
                v=parent[v];
            }
        }

        ll ans=0;
        rep(i,0,q){
            char ch;
            int v;
            cin >> ch >> v;
            --v;
            if(ch=='M') for(const int tmp:belong[v]) segs[tmp].update(depth[v],make_pair(depth[v],v));
            else ans+=segs[belong[v][0]].query(0,depth[v]+1).second+1;
        }
        cout << ans << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    solve();
    return 0;
}

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

int main(){
    string s, t;
    cin >> s;
    cin >> t;
    vector<int> exchangeS(26, -1), exchangeG(26, -1);

    for(int i=0; i<s.size(); i++){
	char sc = s[i]-'a', tc=t[i]-'a';
	if(exchangeS[sc]!=-1 || exchangeG[tc]!=-1){
	    if(exchangeS[sc]!=tc || exchangeG[tc]!=sc){
		cout << "No" << endl;
		return 0;
	    }
	}
	else{
	    exchangeS[sc] = tc;
	    exchangeG[tc] = sc;
	}
    }
    cout << "Yes"<< endl;

}




Measured memory_bytes: 776
N, *S = open(0).read().split()
ss = set()
for i in range(0, len(S), 2):
    s = S[i]
    n = S[i+1]
    k = "{} {}".format(s, n)
    ss.add(k)

m = ["S", "H", "C", "D"]
for i in range(4):
    for j in range(13):
        k = "{} {}".format(m[i], j+1)
        if k not in ss:
            print(k)



Measured memory_bytes: 5564
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int gcd(int x,int y){
    if(y==0)
        return x;
    return gcd(y, x % y);
}

int main(){
    int N;
    cin >> N;
    vector<int> a(N), left(N+1), right(N+1);
    left[0] = 0;
    right[N - 1] = 0;
    for (int i = 0; i < N;i++){
        cin >> a[i];
        left[i + 1] = gcd(left[i], a[i]);
    }
    for (int j = N-1; j>0;j--){
        right[j - 1] = gcd(right[j], a[j]);
    }

    int res = 0;
    for (int i = 0; i < N;i++){
        res = max(res, gcd(left[i], right[i]));
    }
        cout << res << endl;
}

Measured memory_bytes: 1408
A = int(input())
B = int(input())
C = int(input())
X = int(input())
result = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            total = (a * 500) + (b * 100) + (c * 50)
            if X == total:
                result += 1
print(result)


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

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

  int c[3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
      cin >> c[i][j];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if (c[i][j+1] - c[i][j] != c[i+1][j+1] - c[i+1][j]) {
        cout << "No" << "\n";
        return 0;
      }
      if (c[j+1][i] - c[j][i] != c[j+1][i+1] - c[j][i+1]) {
        cout << "No" << "\n";
        return 0;
      }
    }
  }
  cout << "Yes" << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;



int main(){
  int n;
  cin >> n;
  vector<vector<P>> data(n);
  rep(i, n){
    int a;
    cin >> a;
    for (int j = 1; j <= a; j++){
      int x, y;
      cin >> x >> y;
      P tmp = make_pair(x, y);
      data[i].push_back(tmp);
    }
  }

  int ans = 0;
  for(int bit = 0; bit < (1<<n); bit++){
    vector<int> hon(n);
    rep(j, n) if (bit>>j & 1) hon[j] = 1;
    bool ok = true;
    rep(j, n){
      if (hon[j]){
        for (auto g : data[j]){
          int x = g.first - 1, y = g.second;
          if (hon[x] != y) ok = false;
        }
      }
    }
    if (ok) {
      int now = __builtin_popcount(bit);
      ans = max(ans, now);
    }
  }
  cout << ans << endl;
}

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

using namespace std;

long long N,Y;



int main(){
	cin>>N>>Y;

	for(int i=0;i<=N;i++){
		for(int j=0;j<=N;j++){
			long long t=N-i-j;
			if(t<=0)t=0;
			if(10000*i+5000*j+1000*t==Y && i+j+t==N){
				cout<<i<<" "<<j<<" "<<t<<endl;
				return 0;
			}
		}
	}

	cout<<"-1 -1 -1"<<endl;

}


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


// void solve(long long N){
//     string ans = "";
//     while (N > 0) {
//         ans = (char)('a' + ((N - 1) % 26)) + ans;
//         N /= 26;
//     }
//     cout << ans << endl;
// }

void solve(long long N){
    int i = 1;
    while (1) {
        if (N > pow(26, i)) {
            N -= pow(26, i);
            i++;
        } else {
            break;
        }
    }
    string ans = "";
    N--;
    for (int j = 0; j < i; j++) {
        ans = (char)('a' + (N % 26)) + ans;
        N /= 26;
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 4168
#include <bits/stdc++.h>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i=a;i<=b;i++)

void solve()
{
    ll n, a, b;
    cin >> n >> a >> b;

    ll count = (n/(a+b))*a + min(a, n%(a+b));

    cout << count;

    return;
}

int main() 
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    fastio

    ll t = 1;
    //cin >> t;

    while(t--){
        solve();
    }
    
    return 0;
}

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

//????????????
class Circle {
private:
	int x, y, r;
public:
	Circle(int x, int y, int r);
	void getRLTB(int rltb[]);
};

//?????????????????????
Circle::Circle(int x, int y, int r)
{
	this->x = x;
	this->y = y;
	this->r = r;
}

void Circle::getRLTB(int rltb[])
{
	rltb[0] = x + r;
	rltb[1] = x - r;
	rltb[2] = y + r;
	rltb[3] = y - r;
}


//????????¢?????????
class Rectangle {
private:
	int right, left = 0, top, bottom = 0;
public:
	Rectangle(int w, int h);
	bool judge(Circle cir);
};

//?????????????????????
Rectangle::Rectangle(int w, int h)
{
	this->right = w;
	this->top = h;
}

bool Rectangle::judge(Circle cir)
{
	int rltb[4];
	cir.getRLTB(rltb);
	
	if (rltb[0] > right) return false;
	if (rltb[1] < left) return false;
	if (rltb[2] > top) return false;
	if (rltb[3] < bottom) return false;
	
	return true;
}

//???????????¢??°
int main(void)
{		
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	
	Circle cir(x, y, r);
	Rectangle rec(w, h);
	
	if (rec.judge(cir)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3128
import sys

input = sys.stdin.readline


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    import itertools

    N = int(input())
    P = tuple(read_list())
    Q = tuple(read_list())

    T = list(itertools.permutations([i for i in range(1, N + 1)]))
    print(abs(T.index(Q) - T.index(P)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m,c,p,q,t,x,d,e,f;
    string s,ss;
    vector<ll>v1;
    deque<ll>dq;
    cin>>n>>m;
    t=x=0;
    ll mn=876476328765;
    for(int i=0;i<n;i++)
    {
        cin>>d>>e;
        if(e<=m)
        {
            mn=min(mn,d);
            x=1;
        }
    }

    if(x==1) cout<<mn<<endl;
    else cout<<"TLE"<<endl;
}







Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	}
}


Measured memory_bytes: 35816
// #pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma vector temporal
// #pragma simd
// #pragma GCC diagnostic ignored "-W"

#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<utility>
#include<functional>
#include<complex>
#include<climits>

// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vint vector<int>
#define SS stringstream
#define PQ priority_queue
#define MS(x,v) memset((x),(v),sizeof(x))
#define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin())
#define FLH fflush(stdout)
#define CPPinput ios_base::sync_with_stdio(0); cin.tie(0)
#define FIN(fname) freopen(fname,"r",stdin)
#define FOUT(fname) freopen(fname,"w",stdout)

#define tm Ovuvuevuevue
#define y1 Enyetuenwuevue
#define left Ugbemugbem
#define ws Osas
#define dec tetteterette
#define exp expexpexpexp
#define expl explexplexpl

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl

#ifdef WEAK
#include"/home/edison/Coding/cpp/template/debug.cpp"
#define DEB(...) printf(__VA_ARGS__),fflush(stdout)
#define WHR() printf("%s: Line %d",__PRETTY_FUNCTION__,__LINE__),fflush(stdout)
#define LOG(...) printf("%s: Line %d ",__PRETTY_FUNCTION__,__LINE__),printf(__VA_ARGS__),fflush(stdout)
#define DEBUG 1
#define exit(x) cout<<"exit code "<<x<<endl, exit(0)
#else
#define PDE(...) ;
#define DEB(...) ;
#define WHR() ;
#define LOG(...) ;
#define DEBUG 0
#endif

#define lowbit(x) ((x)&(-(x)))

#if __cplusplus >= 201103L
#include<unordered_map>
#include<unordered_set>
#include<tuple>
#endif

void JIZZ(string output=""){cout<<output; exit(0);}

const ld PI=3.14159265358979323846264338327950288;
const ld eps=1e-13;
const ll mod=1e9+7;

int main(){
    CPPinput;
    int a,b; cin>>a>>b;
    if(a+b==15)cout<<"+"<<endl;
    else if(a*b==15)cout<<"*"<<endl;
    else cout<<"x"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

void trace(int A[], int N){
    int i;
    for (i = 0; i < N; i++){
        if (i > 0){printf(" ");}
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N){
    int j, i, v;
    for(i = 1; i < N; i++){
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];
    
    scanf("%d",&N);
    for (i = 0; i < N; i++){scanf("%d", &A[i]);}
    
    trace(A, N);
    insertionSort(A, N);
    
    return 0;
}


Measured memory_bytes: 2096
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define all(a)      (a).begin(),(a).end()
#define si(x)       (int)((x).size())
#define debug(x)    cout<<#x<<" is "<<(x)<<endl;cout.flush();  
#define se second 
#define endl        '\n'
#define f(i,a,b)    for(int i=a;i<b;i++)
#define mem(a,x)          memset(a,x,sizeof(a))

// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
    os<<"["; 
    for(auto& x:v){os<<x<<", ";}
    return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
    return os<<"{"<<p.first<<", "<<p.second<<"}";
}

// === Debug macro ends here ===


// const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846
void inp(ll *arr,ll n)
{
  for(int i=0;i<n;i++)
    cin>>arr[i];
}
void inp_mat(ll *arr,ll n,ll m)
{
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        {
          ll x;cin>>x;
          *((arr+i*m) + j)=x;
        }
}
// syntax for inp_mat inp_mat((ll *)arr,n,m);
// int x2[]={+1,-1,+0,+0};
// int y2[]={+0,+0,+1,-1};

int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGEc
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif     
    int t=1;
    // cin>>t;
    while(t--)
    {
        ll n;cin>>n;ll arr[n];
        inp(arr,n);
        ll ans=0;
        ll ma=arr[0];
        f(i,1,n)
        {
          ma=max(ma,arr[i]);
          ans+=(ma-arr[i]);
        }
        cout<<ans;
        
    }
} 

Measured memory_bytes: 5172