akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int main() {
    int n, l; cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    sort(s.begin(),s.end());
    rep(i,n) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i]; a[i]--;
    }
    
    ll M = 1;
    while((one<<M) < K) M++;
    
    vector<vector<int>> x(M, vector<int> (N));
    for (int i = 0; i < N; i++) {
        x[0][i] = a[i];
    }
    for (int m = 1; m < M; m++) {
        for (int i = 0; i < N; i++) {
            x[m][i] = x[m-1][x[m-1][i]];
        }
    }

    ll ans = 0;
    for (ll m = M-1; m >= 0; m--) {
        if(1 & (K>>m)){
            ans = x[m][ans];
        }
    }
    printf("%lld\n", ans+1);

}

Measured memory_bytes: 52536
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int n = stdIn.nextInt();
			if(n == 0)
			{
				break;
			}
			List<Integer> list = new ArrayList<Integer>();
			for(int i = 0; i < n; ++i)
			{
				int a = stdIn.nextInt();
				list.add(a);
			}
			int count = 0;
			for(int i = 0; i < n; ++i)
			{
				for(int j = 0; j < n - i - 1; ++j)
				{
					if(list.get(j) > list.get(j + 1))
					{
						int temp = list.get(j);
						list.set(j, list.get(j + 1));
						list.set(j + 1, temp);;
						++count;
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 12000
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
T = [int(input()) - 1 for _ in range(D)]

score = 0
last_day = [-1] * 26

for d, t in enumerate(T):
    score += S[d][t]
    last_day[t] = d
    for c, ld in zip(C, last_day):
        score -= c * (d - ld)
    print(score)


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


int main() {

    long long n;
    long long answer = 0;
    cin>>n;
    long long tmp_n = n;
    for(long long i=2;i*i<=n;i++) {
        long long tmp = i;
        while(tmp_n % tmp == 0) {
            tmp_n/=tmp;
            answer++;
            tmp*=i;
        }
        while(tmp_n % ((long long)i) == 0) {
            tmp_n/=i;
        }
    }
    cout<<answer + (tmp_n > 1)<<endl;
    return 0;
}



Measured memory_bytes: 3588
path = [[[] for i in range(5)] for i in range(5)]
for i in range(9):
    if i%2 == 0:
        a = [int(i) for i in list(input())]
        for j in range(4):
            if a[j] == 1:
                path[int(i/2)][j].append("R")
                path[int(i/2)][j+1].append("L")
    else:
        a = [int(i) for i in list(input())]
        for j in range(5):
            if a[j] == 1:
                path[int(i/2)][j].append("D")
                path[int(i/2)+1][j].append("U")

prev = "R"
p = "R"
x = 0
y = 0
while(1):
    if prev == "R":
        if "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
        elif "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
        elif "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
        elif "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
    elif prev == "L":
        if "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
        elif "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
        elif "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
        elif "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
    elif prev == "U":
        if "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
        elif "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
        elif "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
        elif "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
    elif prev == "D":
        if "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
        elif "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
        elif "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
        elif "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
    if x == 0 and y == 0:
        break
print(p[1:])


    



Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int ans = 0;
	cin >> n;

	ans+=n/25;n%=25;
	ans+=n/10;n%=10;
	ans+=n/5;n%=5;
	ans+=n/1;n%=1;
	cout << ans << endl;
}


Measured memory_bytes: 3124
#include <string>
#include <iostream>
void solve_D() {
	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;
	long long r_count = 0, g_count = 0, b_count = 0;
	for(int i = 0; i < n;i++) {
		if (s[i] == 'R') r_count++;
		else if (s[i] == 'G') g_count++;
		else b_count++;
	}
	long long ans = r_count * g_count * b_count;
	for (int i = 1; i < n + 1; i++) {
		for (int j = 0; j + 2 * i<n; ++j) {
			if (s[j] != s[j + i] && s[j + i] != s[j + 2 * i] && s[j] != s[j + 2 * i])
				ans -= 1;
		}
	}
	std::cout << ans << std::endl;
}

int main()
{
	std::ios::sync_with_stdio(false);
	//solve_A();
	//solve_B();
	//solve_C();
	solve_D();
    return 0;
}

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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0)
#define int long long int
#define endl "\n"
#define N 200009
#define all(a) a.begin(), a.end()

string s,t;

int32_t main()
{
	IOS;

	cin>>s>>t;
	int ans = 0;
	for(int i=0;i<s.length();i++)
	{
		ans  += (s[i]==t[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define N 201000
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
using namespace std;
struct node{
	int val,indx;
	node(){}
	node(int V,int I):val(V),indx(I){}
}A[N],B[N],C[N];
bool operator<(const node a,const node b){
	return a.val<b.val;
}
int sum[N];
signed main(){
	int n;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld%lld",&A[i].val,&B[i].val);
	int tota,totb;
	tota=totb=0;
	for(int i=1;i<=n;i++){
		C[2*i-1]=(node){A[i].val,2*i-1};
		C[2*i]=(node){B[i].val,2*i};
		tota+=A[i].val,totb+=B[i].val;
	}
	int ans=min(tota,totb);
	sort(C+1,C+2*n+1);
	for(int i=1;i<=2*n;i++){
		sum[i]=sum[i-1]+C[i].val;
		((C[i].indx%2)?A:B)[(C[i].indx+1)>>1].indx=i;
	}
	for(int i=1;i<=n;i++){
		int tmp;
		if(A[i].indx<=n&&B[i].indx<=n)
			tmp=sum[n];
		else if(A[i].indx<=n-1&&B[i].indx>n)
			tmp=sum[n-1]+C[B[i].indx].val;
		else if(A[i].indx>n&B[i].indx<=n-1)
			tmp=sum[n-1]+C[A[i].indx].val;
		else
			tmp=sum[n-2]+C[A[i].indx].val+C[B[i].indx].val;
		ans=min(ans,tmp);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll ans;
    if (A > B) ans = 0;
    else if (N == 1 && A == B) ans = 1;
    else if (N == 1) ans = 0;
    else if (N == 2) ans = 1;
    else ans = (N - 2) * (B - A) + 1;
    cout << ans << endl;
    return 0;
}

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

//#define DEBUG 1

//#define int long long
#define for0(i,n) for (int i=0; i<n; i++)
#define iter(c) for(auto it=c.begin(); it!=c.end(); it++)
#define iter2(c) for(auto it2=c.begin(); it2!=c.end(); it2++)
#define pb push_back
#define ms(a,z) memset(a,z,sizeof(a));
#define mp make_pair
#define X first
#define Y second
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define pmod(x,m) (((x)%(m)+m)%m)
#ifdef int
#define read(x) scanf("%lld",&x);
#else
#define read(x) scanf("%d",&x);
#endif

#ifdef DEBUG
#define nl cout<<"\n";
#define pr(x) cout<<(x)<<" ";
#define prl(x) cout<<#x " = "<<x<<endl;
#define prp(x) cout<<"("<<(x).first<<" "<<(x).second<<") ";
#define printv(v) {for(int _=0; _<sz(v); _++) cout<<v[_]<<" "; cout<<"\n";}
#define printa(a,s) {for (int _=0; _<s; _++) cout<<a[_]<<" "; cout<<"\n";}
#define print2D(a,m,n) {for (int _=0; _<m; _++) {for (int __=0; __<n; __++) cout<<a[_][__]<<" "; cout<<"\n";} cout<<"\n";}
#define priter(v) iter(v) {pr(*it)} nl
#define debug cout<<"ok at line "<<__LINE__<<endl;
#else
#define nl
#define pr(x)
#define prl(x)
#define prp(x)
#define printv(v)
#define printa(a,s)
#define print2D(a,m,n)
#define priter(v)
#define debug
#endif
#define MAXN 200000

using namespace std;

typedef long long ll;

const int INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;

int freq[MAXN+5];

int32_t main()
{
    #ifdef DEBUG
    //freopen("A.txt","r",stdin);
    //freopen("","w",stdout);
    #endif

    ms(freq,0);
    int n,k;
    cin >> n >> k;
    for0(i,n) {
        int x;
        read(x);
        freq[x]++;
    }
    vector<int> freqs;
    for0(i,n+1) {
        if (freq[i] != 0)
            freqs.push_back(freq[i]);
    }
    sort(all(freqs));
    if (sz(freqs) <= k)
        cout<<0<<endl;
    else {
        int ans = 0;
        for (int i=0; i<sz(freqs)-k; i++)
            ans += freqs[i];
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 2168
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


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

		Scanner sc = new Scanner(new InputStreamReader(System.in));
		int a = sc.nextInt();
		String op = sc.next();
		int b = sc.nextInt();

		if(op.equals("+")){
			System.out.println(a+b);
	    }else{
	    	System.out.println(a-b);
	    }
	}
}


Measured memory_bytes: 22612
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <numeric>
using namespace std;

int main() {
	int n1, n2, n3, n4;
	cin >> n1 >> n2 >> n3 >> n4;
	vector<int> vec = { n1,n2,n3,n4 };
	bool flag = true;
	if (find(vec.begin(), vec.end(), 1) == vec.end()) {
		flag = false;
	}
	if (find(vec.begin(), vec.end(), 9) == vec.end()) {
		flag = false;
	}
	if (find(vec.begin(), vec.end(), 7) == vec.end()) {
		flag = false;
	}
	if (find(vec.begin(), vec.end(), 4) == vec.end()) {
		flag = false;
	}
	if (flag) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
int main()
{
long int n,i,k,max=0,j,a[100];
scanf("%ld",&n);
scanf("%ld",&a[0]);
for(i=1;i<n;i++)
{
    scanf("%ld",&a[i]);
   
   for(j=0;j<i;j++)
   {
       if(max<abs(a[i]-a[j]))
       {
           max=abs(a[i]-a[j]);
       }
   }
}
printf("%ld",max);
    return 0;
}


Measured memory_bytes: 128
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)

N=l()[0]
D=l()
M=l()[0]
T=l()
d={}
t={}
for i in range(N):
    if(D[i] not in d):
        d[D[i]]=0
    d[D[i]]+=1

for i in range(M):
    if(T[i] not in t):
        t[T[i]]=0
    t[T[i]]+=1
ans="YES"
for ks  in  t:
    if(ks not in d or d[ks]<t[ks]):
        ans="NO"
        break
print(ans)






Measured memory_bytes: 58760
#include <stdio.h>
int main(void)
{
    int A;
    int B;
    int add;
    int sub;
    int mul;
    int ans;
    
    scanf( "%d", &A );
    scanf( "%d", &B );
    
    add = A + B;
    sub = A - B;
    mul = A * B;
    
    if( add > sub )
    {
        ans = add;
    }
    else
    {
        ans = sub;
    }
    if( mul > ans )
    {
        ans = mul;
    }
    
    printf( "%d", ans);
}
        


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define mset(a,x) memset(a,x,sizeof(a))
#define OUT(x) cout<<(x)<<"\n"
#define SZ(x) (int)(x).size()
#define FASTIO cin.tie(0),ios::sync_with_stdio(0)

ll x;

int main() {
    FASTIO;
    cin >> x;
    for(ll i = 1; ; ++i) {
        if(i*(i + 1) / 2 >= x) {
            OUT(i);
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
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; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

int h, a;

int main(){
    cin >> h >> a;
    cout << h / a + (h % a != 0) << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	// Value
	int a,b,c;
	int penki_num;

	// Input
	cin >> a >> b >> c;

	// Cal
	if(a==b && b==c){
		penki_num = 1;
	}else if(a != b && b != c && c != a){
		penki_num = 3;
	}else{
		penki_num = 2;
	}

	// Output
	cout << penki_num << endl;

	// Fin
	return 0;
}

Measured memory_bytes: 384
x,y,z,k = map(int,input().split())

a = list(map(int,input().split()))

b = list(map(int,input().split()))

c = list(map(int,input().split()))

ab = []
ans = []
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort(reverse=True)

if len(ab) < k:
    for i in range(len(ab)):
        for j in range(z):
            ans.append(ab[i]+c[j])
else:
    for i in range(k):
        for j in range(z):
            ans.append(ab[i]+c[j])

ans.sort(reverse=True)

for i in range(k):
    print(ans[i])

Measured memory_bytes: 148160
import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint

sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]

A, B, C, D = [int(x) for x in input().split()]


def gcb(a, b):
    # a, b = max([a, b]), min([a, b])
    return a if b == 0 else gcb(b, a % b)


def lcm(a, b):
    return a * b // gcb(a, b)


g = lcm(C, D)
c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
cd = B // g - (A - 1) // g

print(B - A + 1 - c - d + cd)


Measured memory_bytes: 3684
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(new InputStreamReader(System.in));
		int a = sc.nextInt();

		if(a<1200){
			System.out.println("ABC");
		}else {
			System.out.println("ARC");
		}

	}
}


Measured memory_bytes: 21716
S = input()
E = ["R","U","D"]
O = ["L","U","D"]
for i in range (len(S)):
  if i%2==0:
    if S[i] in E:
      continue
    else:
      print("No")
      quit()
  else:
    if S[i] in O:
      continue
    else:
      print("No")
      quit()
print("Yes")

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<climits>
#include<ctime>
#include<complex>
#include<sstream>
#include<cstring>
using namespace std;
typedef vector<string>vs;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef vector<double>vd;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef vector<ll>vl;
#define rrep(i,x,n) for(int i=(x);i<(n);++i)
#define rep(i,x) rrep(i,0,(x))
#define fi first
#define se second
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define maxs(a,b) (a)=max(a,b)
#define mins(a,b) (a)=min(a,b)

const double INF=114514;
const double EPS=1e-8;
int main(){
    string str;
    while(getline(cin,str)){
        stringstream ss(str);
        int W;ss>>W;
        vi r;int val;
        while(ss>>val){
            r.pb(val);
        }
        int N=r.size();
        double dist[20][20]={{0}};
        rep(i,N)dist[0][i+1]=r[i];
        rep(i,N)rep(j,N){
            dist[i+1][j+1]=sqrt((r[i]+r[j])*(r[i]+r[j])-(r[i]-r[j])*(r[i]-r[j]));
        }

        double dp[1<<12][13];
        rep(i,(1<<N))rep(j,13)dp[i][j]=INF;
        dp[0][0]=0;

        rep(i,(1<<N)){
            rep(j,N+1){

                rep(k,N){
                    if((i>>k)&1)continue;
                    dp[i|(1<<k)][k+1]=min(dp[i|(1<<k)][k+1],dp[i][j]+dist[j][k+1]);
                }
            }
        }

        double mi=INF;
        rep(i,N)mi=min(mi,dp[(1<<N)-1][i+1]+r[i]);

        if(mi>W+EPS)puts("NA");
        else puts("OK");

    }
    return 0;
}

Measured memory_bytes: 1644
#include<bits/stdc++.h>
using namespace std;
#define  mem(a,x) memset(a,x,sizeof(a));
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;
int main()
{
    ft
    int t,i,j,n,m,l,r;
    cin>>n>>m>>l;
    cout<<(n*m)/2<<"\n";
    return 0;
}



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

ans = M
for l in L:
    M = M + l[0] - l[1]
    if M < 0:
        print(0)
        exit()
    ans = max(ans, M)

print(ans)


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


int main() {

    int a, b;
    cin >> a >> b;
    int sum = 0;
    for (int i = 1; i <= b-a; ++i) {
        sum += i;
    }
    cout << sum - b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,n,a[100001],flg[100001],p,x,f,cnt;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	{
		scanf("%d",&a[i]);
		flg[i]=0;
	}
	f=0;	x=1;	flg[x]=1;	cnt=1;
	while(1)	{
		x=a[x];
		if(x==2)	break;
		else {
			if(flg[x]==1)	{
				f=1;
				break;
			}
			else {
				flg[x]=1;
				cnt++;
			}
		}
	}
	if(f==1)	printf("-1\n");
	else printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<cstdio>
#include<string.h>
using namespace std;

int main()
{
	double hosu, kaku, x=0, y=0, now=0;

	while (1)
	{
		scanf("%lf,%lf", &hosu, &kaku);
		if (hosu == kaku&&hosu==0)break;
		x += sin(now)*hosu;
		y += cos(now)*hosu;
		now += kaku / 180 * 3.1415;

	}
	int A = x;
	int B = y;
	cout << A<< endl << B << endl;
}

Measured memory_bytes: 1236
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	ll n, m,ml=0;
	cin >> n >> m;
	if (n >= m/2LL) {
		cout << min(n, m / 2LL) << endl;
	}
	else {
		ll ave = (n + m / 2LL)/2LL;
		cout << ave << endl;
	}
	return 0;
}



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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int a[N];
int n;
string s;
void P() {
    for (int k = 0; k < n; ++k) {
        cout << (a[k] == 0 ? 'S' : 'W');
    }
    cout << endl;
}
bool check(int x, int y) {
    a[0] = x;
    a[1] = y;
    for (int i = 1; i < n - 1; ++i) {
        if ((a[i] == 1) ^ (s[i] == 'o')) {
            a[i + 1] = a[i - 1];
        } else {
            a[i + 1] = 1 - a[i - 1];
        }
    }
    if ((a[n - 1] == 1) ^ (s[n - 1] == 'o') ^ (a[n - 2] == a[0])) {
        return false;
    }
    if ((a[0] == 1) ^ (s[0] == 'o') ^ (a[n - 1] == a[1])) {
        return false;
    }
    return true;
}

int main() {
    cin >> n >> s;
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            if (check(i, j)) {
                P();
                exit(0);
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 4088
from itertools import permutations

while 1:
    N = int(input())
    S = int(input())
    if N == 0:
        break
    l = [int(input()) for _ in range(N)]
    dic = {}
    for i in permutations(l,S):
        i = map(str,i)
        dic[("".join(i))] = 1
    print(len(dic))



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

int main() {
  int N;
  cin >> N;
  int K;
  cin >> K;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  vector<int> DP(N, 2e9);
  DP.at(0) = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      if (i + j < N) DP.at(i + j) = min(DP.at(i + j), DP.at(i) + abs(H.at(i) - H.at(i + j)));
    }
  }
  cout << DP.at(N - 1) << "\n";
}

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



int main() {
  int n,m;
  cin >> n >> m;
  int ans = 0;
  for(int i = 1; i * i <= m; i++) {
    if(m % i == 0) {
      if(i <= m / n) {
	ans = max(ans,i);
      }
      if((m / i) <= m / n) {
	ans = max(ans,m/i);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

typedef struct tagST {
	int NO;
	int P;
	int Y;
} ST;

static bool compareMyDataPredicate(ST& lst, ST& rst) {
	return (lst.Y < rst.Y);
}

static bool compareMyDataPredicate2(ST& lst, ST& rst) {
	return (lst.NO < rst.NO);
}

int main(void) {

	int N;	// ken
	int M;	// city
	cin >> N >> M;

	map<int, vector<ST>> ml;

	int P, Y;

	for (int i = 1; i <= M; i++) {
		cin >> P >> Y;
		ST st = { i, P, Y };
		if (ml.count(P) == 0) {
			vector<ST> vl;
			vl.push_back(st);
			ml[P] = vl;
		} else {
			ml[P].push_back(st);
		}
	}

	vector<ST> rv;
  	for (auto it = ml.begin(); it != ml.end() ; ++it) {
		vector<ST>& v = it->second;
		sort(v.begin(), v.end(), compareMyDataPredicate);
		// renumber
		int nv = 1;
  		for (auto it2 = v.begin(); it2 != v.end() ; ++it2) {
			it2->Y = nv++;

			rv.push_back(*it2);
		}
  	}

	sort(rv.begin(), rv.end(), compareMyDataPredicate2);
	for (auto it = rv.begin(); it != rv.end() ; ++it) {
		printf("%06d%06d\n", it->P, it->Y);
	}

	return 0;
}


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

int main(){
    int n;
    cin>>n;
    ll ans=1,x;
    vector<ll> a(n);
    for(int i=0;i<n;++i){
        cin>>a[i];
        ans*=a[i];
        if(a[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    x=ans;
    for(int i=n-1;i>=0;--i){
        if(x==0){
            cout<<-1<<endl;
            return 0;
        }
        x/=a[i];
    }
    if(x!=1||ans>1000000000000000000)
        cout<<-1<<endl;
    else
        cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3952
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    priority_queue<int> pq;
    map<int,int> mp;
    pair<ll,int>p[100010];

    int N,K;cin>>N>>K;
    int t;
    ll d;
    for(int i=0;i<N;i++){
        cin>>t>>d;
        p[i]={-d,t};
    }
    sort(p,p+N);
    ll sum=0,kind=0;
    for(int i=0;i<K;i++){
        sum-=p[i].first;
        mp[p[i].second]++;
        if(mp[p[i].second]==1)kind++; 
    }
    for(int i=0;i<K;i++)
        if(mp[p[i].second]>=2)pq.push(i);
    
    sum+=(ll)pow(kind,2);
    
    ll ans=sum;
    int i=K;
    while(!pq.empty() && i<N){
        if(mp[p[i].second]==0){
            int m=pq.top();
            ll k=kind;
            while(mp[p[m].second]==1){
                pq.pop();
                if(pq.empty()){
                    cout<<ans<<endl;
                    return 0;
                }
                m=pq.top();
            }
            kind++;
            sum+=(ll)pow(kind,2)-(ll)pow(k,2)+p[m].first-p[i].first;
            ans=max(ans,sum);
            mp[p[i].second]++;
            mp[p[m].second]--;
            pq.pop();
        }
        i++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;
template<typename T>
using vec2 = vector<vector<T>>;

void solve(int v, int c, const vec2<int>& w, const vector<int>& x, vector<int>& cnt, vector<bool>& visited) {
    visited[v] = true;
    c += x[v];
    cnt[v] = c;
    for (auto vi : w[v]) {
        if (visited[vi]) continue;
        solve(vi, c, w, x, cnt, visited);
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    vec2<int> w(n + 1);
    for (int i = 1; i <= n - 1; i++) {
        int ai, bi;
        cin >> ai >> bi;
        w[ai].push_back(bi);
        w[bi].push_back(ai);
    }
    vector<int> x(n + 1, 0);
    for (int i = 1; i <= q; i++) {
        int pq, xq;
        cin >> pq >> xq;
        x[pq] += xq;
    }
    vector<int> cnt(n + 1, 0);
    vector<bool> visited(n + 1, false);
    solve(1, 0, w, x, cnt, visited);
    for (int i = 1; i <= n; i++) cout << cnt[i] << " ";
    cout << endl;
}


Measured memory_bytes: 30592
N = int(input())
L= []
for _ in range(N):
    l = sorted(list(input()))
    tmp = ''
    for x in l:
        tmp += x
    L.append(tmp)
L = sorted(L)

def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)

def comb_cal(x):
    return x * (x - 1) / 2
ans = 0
for x in c:
    ans += comb_cal(x[1])
print(int(ans))


Measured memory_bytes: 24532
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		cs: Chars,
	}

	println!("{}", cs[0].to_digit(10).unwrap()+cs[1].to_digit(10).unwrap()+cs[2].to_digit(10).unwrap());
}



Measured memory_bytes: 2136
#include<stdio.h>
#define MAX 200
#define TRUE 1
#define FALSE 0
int solve(int,int);
int n,A[MAX];
int main(){
  int i,q,m[MAX];
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0; i<q; i++){
    scanf("%d",&m[i]);
  }

  for(i=0; i<q; i++){
    if(solve(0,m[i]) == TRUE) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i, int m){
  int res;
  if(m == 0) return TRUE;
  if(i >= n) return FALSE;
  res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(void) {
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=0;i<n;i++) cin>>a[i+1];
    vector<int> b(n+1);
    for(int i=n;i>=1;i--){
        int sum=0;
        for(int j=i+i;j<=n;j+=i){
            sum+=b[j];
        }
        if(sum%2==a[i]) b[i]=0;
        else b[i]=1;
    }
    vector<int> ans;
    for(int i=1;i<=n;i++){
        if(b[i]) ans.push_back(i);
    }
    cout<<ans.size()<<endl;
    for(int i=0;i<ans.size();i++){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    long n;
    cin>>n;
    long double a;
    long long ans=1;
    long double check=1;
    for(int i=0;i<n;i++){
        cin>>a;
        ans*=a;
        check*=a;
    }
    if(check>1000000000000000000)
        cout<<-1<<endl;
    else
        cout<<ans<<endl;
}

Measured memory_bytes: 3792
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;

const ll MOD = 1e9 + 7;


int main(int argc, char* argv[]) {
	
	int s, w;
	cin >> s >> w;
	cout << (s > w ? "safe" : "unsafe") << endl;
}

Measured memory_bytes: 3604
def main():
    n = int(input())
    a = [int(x) for x in input().split()]

    idx = 1
    cnt = 0
    for i in range(n):
        if idx == a[i]:
            idx += 1
        else:
            cnt += 1
    if cnt==n:
        print(-1)
    else:
        print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 24744
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <complex>
using namespace std;

int main()
{
	int N;
	cin>>N;
	vector<int> A(N);
	int signcount = 0;
	for(int i=0; i<N; i++)
	{
		cin>>A[i];
		if(A[i]<0)
		{
			signcount++;
		}
		A[i] = abs(A[i]);
	}
	sort(A.begin(),A.end());
	long long result = 0;

	if(signcount % 2 == 0)
	{
		for(int i=0; i<N; i++)
		{
			result += A[i];
		}
	}
	else
	{
		result -= A[0];
		for(int i=1; i<N; i++)
		{
			result += A[i];
		}
	}
	cout<<result<<endl;
	return 0;
}

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

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

using namespace std;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint fact(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		for(;k<=n;k++) memo[k]=memo[k-1]*k;
	}
	return memo[n];
}

mint fact_inverse(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		memo[n]=inverse(fact(n));
		for(int i=n;i>k;i--) memo[i-1]=memo[i]*i;
	}
	return memo[n];
}

mint choose(int n,int k,int type=0){
	if(k<0 || n<k) return 0;
	if(type==0){
		return fact(n)*fact_inverse(k)*fact_inverse(n-k);
	}
	else{
		if(k>n-k) k=n-k;
		mint res=fact_inverse(k);
		rep(i,k) res*=n-i;
		return res;
	}
}

int main(){
	int h,w,n; scanf("%d%d%d",&h,&w,&n);
	vector<pair<int,int>> P(n+1);
	rep(i,n) scanf("%d%d",&P[i].first,&P[i].second), P[i].first--, P[i].second--;
	P[n]={h-1,w-1};

	sort(P.begin(),P.end(),[](const pair<int,int>& a,const pair<int,int>& b){
		return a.first+a.second<b.first+b.second;
	});

	vector<mint> dp(n+1);
	rep(i,n+1){
		int y,x; tie(y,x)=P[i];
		dp[i]=choose(y+x,y);
		rep(j,i){
			int r,c; tie(r,c)=P[j];
			if(r<=y && c<=x) dp[i]-=dp[j]*choose(y-r+x-c,x-c);
		}
	}
	printf("%d\n",dp[n].to_int());

	return 0;
}


Measured memory_bytes: 2412
from collections import deque
N,M,*L,S,T = map(int,open(0).read().split())
G = [[] for _ in range(N)]
step = [[-1]*3 for _ in range(N)]
step[S-1][0] = 0
for u,v in zip(*[iter(L)]*2):
	G[u-1].append(v-1)
q = deque([(S-1,0)])
while q:
	cur,d = q.popleft()
	for nxt in G[cur]:
		if nxt==T-1 and (d+1)%3==0:
			print((d+1)//3)
			exit()
		if step[nxt][(d+1)%3] < 0:
			step[nxt][(d+1)%3] = d+1
			q.append((nxt,d+1))
print(-1)

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

#define xx first
#define yy second

const int N = 3001;

int dp[N][N];

void solve() {
    string s, t; cin >> s >> t;
    
    int ns = (int)(s.size());
    int nt = (int)(t.size());
    for (int i = 0; i <= ns; i++)
        fill(dp[i], dp[i] + nt + 1, 0);
    for (int i = 1; i <= ns; i++)
        for (int j =1; j <= nt; j++) {
            if (s[i - 1] == t[j - 1])
                dp[i][j] = 1 + dp[i - 1][j - 1];
            int el = max(dp[i - 1][j], dp[i][j - 1]);
            dp[i][j] = max(dp[i][j], el);
        }
    
    string ans = ""; 
    int x = ns, y = nt, it = dp[ns][nt];
    while (it) {
        if (dp[x][y] == dp[x - 1][y])
            x--;
        else if (dp[x][y] == dp[x][y - 1])
            y--;
        else if (dp[x][y] == 1 + dp[x - 1][y - 1])
            ans += s[x - 1], x--, y--, it--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << '\n';
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int _; cin >> _; while (_--)
    solve();
    return 0;
}


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

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


int H, W, K;

int main()
{
  cin >> H >> W >> K;
  FOREQ(a, 0, W) FOREQ(b, 0, H) {
    if (a * H + b * W - 2 * a * b == K) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Array
import           Data.Char

main = do
  [a, b, c] <- map (read :: String -> Int) . words <$> getLine
  putStrLn $ if b - a == c - b
    then "YES"
    else "NO"


Measured memory_bytes: 508
#include "bits/stdc++.h"
#include <random>
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  map<string, int> mp;
  int n; cin >> n;
  vi t(n);
  REP(i, n) {
    string s;
    cin >> s >> t[i];
    mp[s] = i;
  }
  string x;
  cin >> x;
  int j = mp[x];
  int ans = 0;
  FOR(i, j + 1, n) {
    ans += t[i];
  }
  cout << ans << endl;

}


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

int main()
{
   string s , t;
   cin>>s>>t;
   bool equal = false;
   for(int i=0;i<s.length();i++)
   {
       if( s== t)
       {
           equal = true;
           break;
       }
       s = s.back() + s.substr(0,s.length()-1 );

   }
   if( equal)
       cout<<"Yes";
   else cout<<"No";
}

Measured memory_bytes: 3596
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 int compare(int a,int b)
 {
   return a>b;    
 }

 int main()
 {
   int m,n;
   while(cin>>m>>n)
   {
     int sum=m+n;
     int count=0;
     while(sum)
     {
       count++;
       sum/=10;          
     }
     cout<<count<<endl;                
   }
   //while(1);      
   return 0;    
 }
 

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

int main() {
  int N,b=0;
  string s;
  cin >> N;
  for(int i=0;i<N;i++){
    cin>>s;
    if(s=="Y"){
      b=1;
    }
  }
  if(b){
   cout<<"Four"<<endl; 
  }else{
    cout<<"Three"<<endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    for (int i = 0; i < k; ++i)
        cout << "ACL";
}


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

int main()
{  
	long long N=1,ans=0;
	cin >>N;

	for(long long i=1;i<=N;i++){
		if(!(i%3==0||i%5==0)){ans+=i;}
	} 

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


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
double f[23];
int main() { _
int n,i;
f[0]=1.;
for(i=1;i<23;++i)f[i]=f[i-1]*(double)i;
while(~scanf("%d",&n))printf("%.0lf\n",f[n]);
    return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0; i<int(a); i++)
using namespace std;

const int N=100005;
int n;
vector<pair<int,bool>> adj[N];
int ans[N];

void dfs(int u, int e) {
    for(auto p:adj[u]) {
        int v=p.first;
        if(v==e) continue;
        ans[v]=(p.second? (!ans[u]):ans[u]);
        dfs(v,u);
    }
}

int main() {
    cin >> n;
    rep(i,n-1) {
        int a,b,w;
        cin>>a>>b>>w;
        a--;b--;
        adj[a].push_back({b,w%2});
        adj[b].push_back({a,w%2});
    }
    ans[0]=0;
    dfs(0,-1);
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 8320
#include<stdio.h>

int main(){

  int x = 1;
  int y = 0;
  int value = 0;
  int cnt = 3;

  scanf("%d",&value);

  for(x = 1; x <= value; x++){

	if(x % 3 == 0){
		printf(" %d",x);
	}else if(x % 10 == 3){
		printf(" %d",x);
	}else{
		y = x;
		while(y != 0){
			y /= 10 ;
			if(y % 10 == 3){
				printf(" %d",x);
				y = 0;
			}
		}
	}
  }

  printf("\n");

  return 0;
}

Measured memory_bytes: 2728
s = input()
i = 0
j = len(s) - 1
ans = 0
while j - i > 0:
	if s[i] == s[j]:
		i += 1
		j -= 1
		continue
	if s[i] == 'x':
		i += 1
		ans += 1
		continue
	if s[j] == 'x':
		j -= 1
		ans += 1
		continue
	ans = -1
	break
print(ans)

Measured memory_bytes: 3316
<?php
$stdin = trim(fgets(STDIN));

$lgh = strlen($stdin);

$wa = 0;

for ($i = 0; $i < $lgh; $i++) {
  $getstr = substr($stdin,$i,1);
  $int = (int) $getstr;
  $wa = $wa + $int;
}

$wa = $wa % 9;

if($wa === 0){
  echo "Yes";
} else{
  echo"No";
}


?>

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

static const int N=100;
static const int NIL=-1;

int n,M[N][N],d[N];

int main(){
    int i,j,u,k,v;
    cin>>n;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            M[i][j]=0;
        }
        d[i]=NIL;
    }
    for(i=0;i<n;i++){
        cin>>u>>k;
        u--;
        for(j=0;j<k;j++){
            cin>>v;
            M[u][--v]=1;
        }
    }

    queue<int> Q;
    Q.push(0);
    d[0]=0;
    while(!Q.empty()){
        int u=Q.front();Q.pop();
        for(int v=0;v<n;v++){
            if(M[u][v]&&d[v]==NIL){
                Q.push(v);
                d[v]=d[u]+1;
            }
        }
    }

    for(int i=0;i<n;i++){
        cout<<i+1<<' '<<d[i]<<endl;
    }
}


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


int main() {
	int Bluecard = 0;
  
	int Redcard = 0;
  
	int Max = 0;
  
	int Count = 0;
  
    string Word;
  
	cin >> Bluecard;  
  
    vector<string> Blueword(Bluecard);
  
	for (int Loop = 0; Loop < Bluecard; Loop++) {
      
    	cin >> Blueword.at(Loop);
      
    }
  
    cin >> Redcard;
  
    vector<string> Redword(Redcard);
  
    for (int Loop = 0; Loop < Redcard; Loop++) {
      
    	cin >> Redword.at(Loop);
      
        } 
  
    for (int LoopI = 0; LoopI < Bluecard; LoopI++) {
      
        Word = Blueword.at(LoopI);
      
		for (int LoopII = 0; LoopII < Bluecard; LoopII++) {
          
        	if (Word == Blueword.at(LoopII)) {
              
                Count++;
              
            }
          
        }
      
        for (int LoopII = 0; LoopII < Redcard; LoopII++) {
          
            if (Word == Redword.at(LoopII)) {
              
                Count--;
              
            }
          
        }
      
        if (Max < Count) {
          
            Max = Count;
          
        }
      
     Count = 0; 
      
    }
  
    cout << Max << endl;
  
}

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

int n, a[200233];
vector<pair<int, int>> b;
int main() {
  scanf("%d", &n);
  int ok1 = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ok1 &= a[i] > a[i - 1];
  }
  if (ok1) {
    puts("1");
    return 0;
  }
  int l = 2, r = 1000000000;
  while (l < r) {
    int m = (l + r) >> 1, ok = 1;
    b.clear();
    for (int i = 1; i <= n; i++) {
      if (a[i] <= a[i - 1]) {
        while (!b.empty() && b.back().first > a[i]) {
          b.pop_back();
        }
        int bit = a[i];
        while (!b.empty() && b.back().first == bit && b.back().second == m - 1) {
          b.pop_back();
          bit--;
        }
        if (bit <= 0) {
          ok = 0;
          break;
        }
        if (!b.empty() && b.back().first == bit) {
          b.back().second++;
        } else {
          b.emplace_back(bit, 1);
        }
      }
    }
    if (ok) {
      r = m;
    } else {
      l = m + 1;
    }
  }
  printf("%d\n", l);
}


Measured memory_bytes: 1024
/******* all required header files *******/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;

/*****All definitions*******/
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define mp make_pair
#define ll long long int
#define pb push_back
#define F first
#define S second
/***************************/

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);

	ll n;
	cin>>n;
	string str;
	cin>>str;
	ll cnt = 1;
	for(int i = 0; i < n-1; i++)
	{
	    if(str[i] != str[i+1])
	        cnt++;
	    else continue;
	}
	cout<<cnt;
	
	return 0;
}


Measured memory_bytes: 512
s1,s2,s3 = map(int, input().split())
s4,s5,s6 = map(int, input().split())
s7,s8,s9 = map(int, input().split())

if s1-s4==s2-s5==s3-s6 and s4-s7==s5-s8==s6-s9:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3068
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef unsigned long long ll;
const int maxn = 100005;

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

ll solve(ll x, ll y){
  return x/y;
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll tt = solve(b,c) + solve(b,d)-solve(b, c * d/gcd(c,d));
  ll tt2 = solve(a-1,c)+solve(a-1, d)-solve(a-1, c*d/gcd(c,d));
  ll ret = b - tt - (a-1-tt2);
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256