akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int card[4][14] = { 0 };
	char pattern;
	int number, n, i=0, j;
	scanf("%d", &n);
	for (i = 0; i < n;i++) {
		scanf(" %c %d", &pattern, &number);
		if (pattern == 'S')
			card[0][number - 1] = 1;
		else if (pattern == 'H')
			card[1][number - 1] = 1;
		else if (pattern == 'C')
			card[2][number - 1] = 1;
		else
			card[3][number - 1] = 1;
	}
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 13; j++) {
			if (card[i][j] != 1) {
				if (i == 0)
					printf("S %d\n", j+1);
				else if (i == 1)
					printf("H %d\n", j+1);
				else if (i == 2)
					printf("C %d\n", j+1);
				else
					printf("D %d\n", j+1);
			}
		}
	}
}



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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int xa = min(a,k);
  k -= xa;
  int xb = min(b,k);
  k -= xb;
  int xc = k;
  int ans = xa - xc;
  cout << ans << endl;
  return 0;
}

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

int main() {
	int a, b, c;
	int rec = 0, rho = 0;

	while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
		if (a == b) {
			rho++;
		}
		if ((a * a) + (b * b) == (c * c)) {
			rec++;
		}
	}
	cout << rec << endl << rho << endl;
}

Measured memory_bytes: 3156
// This program compare given two integers
#include <iostream>
using namespace std;

int main(){

  // input two values
  int a, b;
  cin >> a >> b;

  // compare and print 
  if(a>b)
    cout << "a" << " > " << "b" << endl;
  else if(a<b)
    cout << "a" << " < " << "b" << endl;
  else
    cout << "a" << " == " << "b" << endl;
  
  return 0;
}

Measured memory_bytes: 3060
#include<iostream>
#include <algorithm>
#include<functional>//greaterの使用
using namespace std;
#define MAX_LIST 60000


bool find_list(int *list,int a,int b,int x){
	//cout<<list[a]<<" "<<list[b]<<" "<<list[(b+a)/2]<<" "<<x<<endl;
	if(b-a<2){
		if(list[b]==x){
			//cout<<"find"<<endl;
			return true;
		}
		if(find(list+a,list+b,x)!=list+b){
			//cout<<"find"<<endl;
			return true;
		}
		//cout<<"false"<<endl;
		return false;
	}
	if(list[(b+a)/2]>x){
		return find_list(list,a,(b+a)/2,x);
	}else if(list[(a+b)/2]<x){
		return find_list(list,(a+b)/2,b,x);
	}
	//cout<<"find "<<list[(b+a)/2]<<" "<<x<<endl;
	return true;
}

int main(){
	bool prime[MAX_LIST];
	for(int i=0;i<MAX_LIST;i++){
		prime[i]=1;
	}
	prime[0]=prime[1]=0;
	for(int i=0;i*i<MAX_LIST;i++){
		if(prime[i]==1){
			for(int j=i*2;j<MAX_LIST;j=j+i){
				prime[j]=0;
			}
		}
	}
	int primelist[60000];
	int j=0;
	for(int i=0;i<MAX_LIST;i++){
		if(prime[i]==1){
			primelist[j]=i;
			j++;
			if(j>60000){
				break;
			}
		}
	}
	int in;
	while(cin>>in,in){
		int ans=0;
		int t=0;
		int r;
		while(in>primelist[t])t++;
		if(in%2==1){
			r=2;
		}else{
			r=t;
		}
		for(int i=0;i<r;i++){
			if(find_list(primelist,i,t,in-primelist[i])){
			ans++;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-9
#define PI 2 * acos (0.0)
using namespace std;

const int mod = 1000000000 + 7;

int bs(int *st,int *en,int val,char c) // en = size+1
{
    int k;
    //first element not less than val,else returns last
    if(c=='l') k=lower_bound(st,en,val)-st;
    //first element greater than val,else returns last
    if(c=='u') k=upper_bound(st,en,val)-st;
    return k;
}

int prime[780500];
int sieve() // RETURNS ACTUAL SIZE!!! NOT SIZE+1!!!! REMEMBER WELL!! >_<
{
    int a,b,c;
    c=0; prime[c]=2;
    bool *m=(bool *)calloc(1000006,sizeof(bool));
    for(a=3;a<=1000000;a=a+2)
    {
        if(!m[a])
        {
            prime[++c]=a;
            for(b=2*a;b<=1000000;b=b+a) m[b]=true;
        }
    }
    free(m);
    return c;
}

string F,S;


int main()
{

    

	int a,b,c,d,e,x,y,z,N;

	cin>>N;

	cin>>F>>S;

	x=F.size();
	y=S.size();

	e=0;

	for(a=1;a<=min(x,y);a++)
    {
        for(b=0,c=x-a; b<a; b++,c++)
        {
            if(S[b]!=F[c]) break;
        }
        if(b==a) e=a;
    }

    cout<<max(x+y-e, N)<<endl;



    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {

	public static void main(String[] args) {
		Task task = new Task();
		task.solve();
	}

	static class Task {
		static final long MOD = (long) 1e9 + 7;

		public void solve() {
			Scan sc = new Scan();
			long n = sc.scanLong();
			if (n % 2 == 1) {
				System.out.println(0);
				return;
			}
			n /= 2;
			long res = 0;
			for (long i = 5; i <= n; i *= 5)
				res += n / i;
			System.out.println(res);
		}
	}

	static class Scan {
		private byte[] buf = new byte[1024];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				try {
					total = in.read(buf);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public long scanLong() {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public char scanChar() {
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			return (char) n;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}


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

int main(){
  int n,m,l;
  int A[100][100]={{0}},B[100][100]={{0}};
  cin>>n>>m>>l;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin>>A[i][j];
    }
  }
  for(int i=0;i<m;i++){
    for(int j=0;j<l;j++){
      cin>>B[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<l;j++){
      long long int sum = 0;
      for(int k=0;k<m;k++){
	sum += A[i][k] * B[k][j];
      }
      cout<<sum;
      if(j != l-1) cout<<" ";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1244
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int k,x;
	std::cin >> k >> x;
	if(k*500>=x) print("Yes");
	else print("No");
	return 0;
}


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

vector<int> vl,ans;
vector<char> c;

int main(){

    double n;

    cin >> n;
    int n1 = (int)floor(n/1.08);
    int n2 = (int)ceil(n/1.08);
    if(floor(n1*1.08)==n){
         cout << n1;
         return 0;
    }
    if(floor(n2*1.08)==n){
         cout << n2;
         return 0;
    }
    cout << ":(";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A, B;
  cin >> A >> B;
  if (A % 2 == 1 && B % 2 == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
S = input()
len_S = len(S)

for i in range(2, len_S+1, 2):
    check_S = S[:-i]
    len_check_S = len(check_S)
    half = len_check_S//2
    if check_S[:half] == check_S[half:]:
        print(len_check_S)
        break


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
vint dp(100005,-1);
vector<vector<int> > li(100005);
int dfs(int now,int count){
    if(dp[now]!=-1){
	return dp[now];
    }
    int si=li[now].size(),nx=0;
    rep(i,si){
	nx=max(nx,dfs(li[now][i],dp[now])+1);
    }
    dp[now]=nx;
    return dp[now];
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int x,y;
    rep(i,m){
	cin>>x>>y;
	li[x].push_back(y);
    }
    int max=-1,a;
    REP(i,1,n+1){
	a=dfs(i,dp[i]);
	if(max<a){
	    max=a;
	}
    }
    cout<<max<<'\n';
    return(0);
}


Measured memory_bytes: 8192
///
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define re_fr(i,a,b) for(int i=a;i>=b;i--)
#define frl(i,a,b) for(ll i=a;i<=b;i++)
#define re_frl(i,a,b) for(ll i=a;i>=b;i--)
#define mp make_pair
#define MX 1e18
#define eps 1e-9
#define mod 1000000007
#define mod2 100000000
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
void fil()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
vector<ll>V[200010];
ll vis[200010];
ll n,m;
ll an;
void dfs(ll source, ll cost)
{
    if(cost>2) return ;
    vis[source]=1;
    if(source==n)
    {an=cost; return;}
    if(V[source].size())
    frl(i,0,V[source].size()-1)
    {
        ll vp=V[source][i];
        if(!vis[vp])
        {
            dfs(vp,cost+1);
        }
    }

}
int main()
{
    fast();
    cin>>n>>m;
    frl(i,1,m)
    {
        ll x,y; cin>>x>>y;
        V[x].pb(y); V[y].pb(x);
    }
    dfs(1,0);
    if(an!=2)
        cout<<"IMPOSSIBLE"<<endl;
    else cout<<"POSSIBLE"<<endl;








    return 0;
}


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

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

using namespace std;
template<class T> struct edge{
	int to;
	T wt;
	edge(int to,const T& wt):to(to),wt(wt){}
};
template<class T> using weighted_graph=vector<vector<edge<T>>>;

weighted_graph<int> T;
vector<int> color;

void dfs(int u,int p,int c_pre){
	int idx=0;
	if(idx==c_pre) idx++;

	for(auto e:T[u]){
		int v=e.to,id=e.wt;
		if(v!=p){
			color[id]=idx++; if(idx==c_pre) idx++;
			dfs(v,u,color[id]);
		}
	}
}

int main(){
	int n; scanf("%d",&n);
	T.resize(n);
	rep(i,n-1){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		T[u].emplace_back(v,i);
		T[v].emplace_back(u,i);
	}

	color.resize(n-1,-1);
	dfs(0,-1,-1);

	printf("%d\n",*max_element(color.begin(),color.end())+1);
	rep(i,n-1) printf("%d\n",color[i]+1);

	return 0;
}


Measured memory_bytes: 7424
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <list>
using namespace std;

int main()
{
    int X, Y, Z;
    cin >> X >> Y >> Z;
    X -= Z;
    cout << X / (Y + Z) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
#include<cstring>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
int main()
{
	string S;
	cin >> S;
	int count=0;
	int N;
	int t;
	N = S.size();
	for (int j = 0;j < N;j++) {
		if (
			S.at(j) == 'A'||
			S.at(j) == 'B'||
			S.at(j) == 'C'||
			S.at(j) == 'D'||
			S.at(j) == 'E'||
			S.at(j) == 'F'||
			S.at(j) == 'G'||
			S.at(j) == 'H'||
			S.at(j) == 'I'||
			S.at(j) == 'J'||
			S.at(j) == 'K'||
		S.at(j) == 'L'||
		S.at(j) == 'M'||
		S.at(j) == 'N'||
		S.at(j) == 'O'||
		S.at(j) == 'P'||
		S.at(j) == 'Q'||
		S.at(j) == 'R'||
		S.at(j) == 'S'||
		S.at(j) == 'T'||
		S.at(j) == 'U'||
		S.at(j) == 'V'||
		S.at(j) == 'W'
		||S.at(j) == 'X'
		||S.at(j) == 'Y'
		||S.at(j) == 'Z'


			) {
			t++;
		}
	}if (t == 2) {
		if (S.at(0) == 'A') {
			for (int i = 2;i < N - 1;i++) {
				if (S.at(i) == 'C') { count++; }

			}
			if (count == 1) { cout << "AC" << endl; }
			else { cout << "WA" << endl; }
		}
		else { cout << "WA" << endl; }
	}
	else { cout << "WA" << endl; }
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    s = input()
    seg = 1
    for i in range(1, len(s)):
        if s[i] != s[i-1]:
            seg += 1
    print(seg - 1)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 9844
#include <iostream>
using namespace std;
int main(void)
{
    int num;
    cin >> num;
    if(num < 1200)
        cout << "ABC" << endl;
    else if(num >= 1200 && num < 2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" << endl;
}

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



ll solve(ll arr[] , int k , int n , int curr , ll dp[]){
	
	if(curr >= n){
		return INT_MAX;
	}
	
	if(curr == n-1)
		return 0;
	
	ll smallAns = LLONG_MAX;
	
	if(dp[curr] != -1)
	return dp[curr];
	
	for(int i=1;i<=k;i++){
		ll temp = solve(arr , k , n, curr+i , dp);
		if(curr+i < n){
		smallAns = min(smallAns ,  temp + abs(arr[curr] - arr[curr+i]));
		dp[curr] = smallAns;
		}
	}
	
	return dp[curr];
}

int main(){

	int n,k;
	cin>>n>>k;
	
	ll dp[n];
	memset(dp,-1,sizeof(dp));
	ll arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	
	cout<<solve(arr , k , n , 0 , dp)<<endl;

	return 0;
}

Measured memory_bytes: 11136
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)

	if logic(a, b, c) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func logic(a, b, c int) bool {
	nums := []int{a, b, c}
	sort.Ints(nums)
	if equal(nums,[]int{5, 5, 7}) {
		return true
	}
	return false
}

func equal(a, b []int) bool {
    if len(a) != len(b) {
        return false
    }
    for i, v := range a {
        if v != b[i] {
            return false
        }
    }
    return true
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cout << #v << " = "; array_out(v , ##__VA_ARGS__);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

random_device seed_gen; mt19937_64 mtrand(seed_gen());
constexpr int MOD = 1000000007;
using P = pair<int,int>;
//////////////////////////////////////////

int main(){
  inl(A , B , K);
  rep(i , K){
    if(i%2==0){
      B += A / 2;
      A = A / 2;
    }
    else{
      A += B / 2;
      B = B / 2;
    }
  }
  out(A , B);
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto N = readln.chomp.to!int;
    if (N == 3) {
        writeln("2 5 63");
        return;
    }

    int[] ths;
    foreach (i; 1..30001) {
        if (i%2 != 0 && i%3 == 0) ths ~= i;
    }
    int[] res;
    size_t t;
    while (t < ths.length && N > 3) {
        res ~= ths[t++];
        res ~= ths[t++];
        N -= 2;
    }
    int x = 1, s;
    foreach (_; 0..N) {
        res ~= 2*x;
        s += x;
        ++x;
    }
    if (s%3 != 0) {
        res ~= 2*x;
        s += x;
        switch (s%3) {
            case 1:
                res = res[0..t] ~ res[t+1..$];
                break;
            case 2:
                res = res[0..t+1] ~ res[t+2..$];
                break;
            default:
                res = res[0..t+2] ~ res[t+3..$];
        }
    }
    writeln(res.to!(string[]).join(" "));
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int max(int x, int y) {
	return x > y ? x : y;
}

int lcs(string x, string y) {
	int l1 = x.size(),l2 = y.size();
	vector<vector<int> > dp(l1 + 1, vector<int>(l2 + 1, 0));
	for (int i = 1;i <= l1;i++) {
		for (int j = 1;j <= l2;j++) {
			if (l1 == 0 || l2 == 0) {
				dp[i][j] = 0;
			}
			else if (x[i - 1] == y[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else {
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}
	return dp[l1][l2];
}


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

	for (int i = 1;i <= n;i++) {
		string x, y;
		cin >> x;
		cin >> y;
		cout << lcs(x, y) << endl;

	}
	return 0;
}




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

const int N=100100;
int fa[N],f[N],g[N],n,m,vis[N];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=0;i<=2*m;++i)fa[i]=i;
	for(int i=1;i<=n;++i){
		int a,b,c,d;cin>>a>>b>>c>>d;
		int u=c?m+c:m-a,v=d?m-d:m+b;
		fa[find(u)]=find(v);f[u]++;g[v]++;
	}
	for(int i=1;i<=m;++i)
		if(f[m-i]<g[m-i]||f[m+i]>g[m+i]){cout<<"NO\n";return 0;}
	for(int i=0;i<=2*m;++i)if(f[i]!=g[i])vis[find(i)]=1;
	for(int i=0;i<=2*m;++i)if(f[i]&&g[i]&&!vis[find(i)]){cout<<"NO\n";return 0;}
	cout<<"YES\n";
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int abs(int a){return a<0?-a:a;}
int min(int a, int b){return a>b?b:a;}

int N, H[100000], i;
int ans[100000];
int main(){
	scanf("%d", &N);
	for(i=0; i<N; i++){
		scanf("%d", H+i);
	}
	ans[0]=0;
	ans[1]=abs(H[0]-H[1]);
	for(i=2; i<N; i++){
		ans[i]=min(ans[i-1]+abs(H[i]-H[i-1]), ans[i-2]+abs(H[i]-H[i-2]));
	}
	printf("%d\n", ans[N-1]);
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
int n,l[N],r[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d%d",&l[i],&r[i]);
	sort(l,l+n+1);
	reverse(l,l+n+1);
	sort(r,r+n+1);
	ll ans=0;
	for (int i=0;i<n;i++){
		ll c=l[i]-r[i];
		if (c<=0)break;
		ans+=2*c;
	}
	printf("%lld\n",ans);
}


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

int main() {
  int N;
  cin >> N;
  vector<int> c(N);
  for(auto& i: c) cin >> i;

  vector<vector<vector<bool>>> dp(N, vector<vector<bool>>(N, vector<bool>(10)));
  for(auto i = 0; i < N; ++i) dp[i][i][c[i]] = true;

  for(auto w = 1; w < N; ++w) for(auto i = 0; i < N - w; ++i) for(auto k = 0; k < 10; ++k) {
    auto j = i + w;
    for(auto x = i; x < j; ++x) {
      if(dp[i][x][0] && dp[x + 1][j][0]) dp[i][j][0] = true;
      if(dp[i][x][k] && dp[x + 1][j][k]) dp[i][j][0] = true;
      if(!k) continue;
      if(dp[i][x][0] && dp[x + 1][j][k]) dp[i][j][k] = true;
      if(dp[i][x][k] && dp[x + 1][j][0]) dp[i][j][k] = true;
      if(dp[i][x][k] && dp[x + 1][j][k]) dp[i][j][k] = true;
    }
  }

  cout << (dp[0][N-1][0] ? "yes" : "no") << endl;
}

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

using namespace std;

// Prioridade
typedef long long   ll;
typedef pair<ll,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i = a; i < (b); i++)
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define endl '\n'
#define mdc(a, b) (__gcd((a), (b)))
#define mmc(a, b) (((a)*(b))/__gcd((a), (b)))

// fim da Prioridade
ll dp[1010][1010];
char matriz[1010][1010];
int n,m;
ll solve(int i, int j){
	if(i == n && j == m)
		return 1LL;
	if(dp[i][j] != -1)
		return dp[i][j];
	ll ans = 0LL;
	if(matriz[i+1][j] == '.'){
		ans = solve(i+1,j);
	}
	if(matriz[i][j+1] == '.'){
		ans = (ans + solve(i,j+1))%MOD;
	}
	return dp[i][j] = ans;
}
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	memset(dp,-1,sizeof dp);
	cin >> n >> m;
	memset(matriz,'#',sizeof matriz);
	REP(i,1,n+1){
		REP(j,1,m+1){
			cin >> matriz[i][j];
		}
	}
	cout << solve(1,1) << endl;
	return 0;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    int A,B,C;
    cin >>A>>B>>C;

    cout << max(0,C-(A-B)) <<endl;
    return (0);
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

const int N = 1000010;
bool NG[N];
int ct[N];

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        ++ct[a[i]];
    }
    sort(all(a));

    int ans = 0;
    for (int i : a) {
        if (NG[i]) continue;
        if (ct[i] < 2) ++ans;
        for (int j = i; j < N; j += i) NG[j] = true;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8772
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define F first
#define S second
#define INF 400000
struct SEG{
	int seg[1<<19];
	SEG(void){for(int i=0;i<1<<19;i++)seg[i]=INF;}
	void up(int a,int x){
		a+=(1<<18)-1;
		seg[a]=min(seg[a],x);
		while(a>0){
			a=(a-1)/2;
			seg[a]=min(seg[a*2+1],seg[a*2+2]);
		}
	}
	int que(int a,int b,int l,int r,int k){
		if(r<a||b<l)return INF;
		if(a<=l&&r<=b)return seg[k];
		return min(que(a,b,l,(l+r-1)/2,k*2+1),que(a,b,(l+r+1)/2,r,k*2+2));
	}
};
int n,q,s[200005];
P x[200005];
SEG d,p;
int main(void){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
		int a;
		scanf("%d",&a);
		if(a)s[i]--;
		else s[i]++;
		s[i]+=s[i-1];
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++)scanf("%d%d",&x[i].F,&x[i].S);
	sort(x,x+q);
	d.up(0,(n-s[n])/2);
	p.up(0,(n-s[n])/2);
	for(int i=0;i<q;i++){
		int l=x[i].F,r=x[i].S;
		int o=min(s[r]-s[l-1]+d.que(0,l-1,0,(1<<18)-1,0),s[r]+p.que(l,r,0,(1<<18)-1,0));
		d.up(r,o);
		p.up(r,o-s[r]);
	}
	printf("%d\n",d.que(0,n,0,(1<<18)-1,0));
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
 
#define rep for(int i = 0;i<n;i++)
const int MOD = 1000000007;
 
int main(){
    int a,b;cin >> a >> b;
    int ans= 0;
    int num = 1;
    while(num < b){
        num += a - 1;
        ans += 1;
    }
    cout << ans << endl;
}

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

int main(){
        int n,k,r,s,p,i,cnt,idx,ans=0;
        char pre;
        cin >> n >> k;
        cin >> r >> s >> p;
        vector<char> t(n);
        vector<int> v(n);
        map<char, int> pt;
        pt['r'] = p; pt['s'] = r; pt['p'] = s;
        for(i=0;i<n;++i){
                cin >> t.at(i);
                ans += pt[t.at(i)];
        }
        for(i=0;i<n;++i){
                if(v.at(i)==1) break;
                cnt = 1;
                pre = t.at(i);
                idx = i+k;
                while(idx<n){
                        v.at(idx) = 1;
                        if(t.at(idx)==pre) ++cnt;
                        else{
                                if(cnt>1){
                                        ans -= pt[pre]*(cnt/2);
                                        cnt = 1;
                                }
                        }
                        pre = t.at(idx);
                        idx += k;
                }
                if(cnt>1){
                        ans -= pt[pre]*(cnt/2);
                        cnt = 1;
                }
        }
        cout << ans << endl;
        return 0;
}

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

int main() {
    int t=1;
    //cin >> t;
    while(t--){
        string s;
        cin >> s;
        if(s[s.size()-1]=='s'){
            cout << s << "es";
        }else{
            cout << s << "s";
        }
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
    long int a,b;
    long int res;
    cin >> a >> b;
    if ((a%b) == 0) res = -1;
    //else if ((a*2) > 10^18) res = -1;
    else res = a*(b+1);
    cout << res << endl;
    return 0;
}


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

int main(){
  int s ; 
  cin >> s ; 
  map<int , int > M ; 
  M[s]++ ; 
  int cnt = 0 ; 
  
  while(M[s] != 2){
 
    
    
    if( s%2 == 0 ) {
      s = s/2 ; 
    }
    else if( s%2 != 0 ) {
      s = 3*s + 1 ; 
    }
    M[s]++ ; 
    cnt++ ;
  }
  cnt++ ; 
  cout << cnt << endl ;
  
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define int long long
#define double long double
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

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

    int h, w, k;
    cin >> h >> w >> k;
    char arr[h][w];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> arr[i][j];
        }
    }
    int cnt = 0;
    for (int ma = 0; ma < (1 << h); ma++) {
        for (int mb = 0; mb < (1 << w); mb++) {
            char ch[h][w];
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    ch[i][j] = arr[i][j];
                }
            }
            for (int i = 0; i < h; i++) {
                int p = (1 << i);
                if ((ma & p) != 0) {
                    for (int k = 0; k < w; k++) {
                        ch[i][k] = '*';
                    }
                }
            }
            for (int i = 0; i < w; i++) {
                int p = (1 << i);
                if ((mb & p) != 0) {
                    for (int k = 0; k < h; k++) {
                        ch[k][i] = '*';
                    }
                }
            }
            int res = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (ch[i][j] == '#') res++;
                }
            }
            if (res == k) {
                cnt++;
            }
        }
    }
    cout << cnt << '\n';

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 3648
s = input()

i = 0

if(len(s) % 2 != 0):
    ans = "No"
else:
    while i < len(s):
        if(s[i] == 'h' and s[i+1] == 'i'):
            ans = "Yes"
        else:
            ans = "No"
            break
        i += 2

print(ans)

Measured memory_bytes: 3060
//In The Name Of Allah// 
#include <bits/stdc++.h>
using namespace std;
const long long int mod=1e9+7;
const int maxn=505*1001;
const int Base=199;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define Right(x) (x*2+1)
#define Left(x) (2*x)
#define all(x) x.begin(),x.end()

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

ll a,b,c,sum,ans;
set<pair<int,pii> > states;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>a>>b>>c;
	while(!(a%2) && !(b%2) && !(c%2) && ans<200000)
	{
		if(states.find(mp(a,mp(b,c)))!=states.end())
			return cout<<-1,0;
		else
			states.insert(mp(a,mp(b,c)));
		sum=a+b+c;
		a=(sum-a)/2;
		b=(sum-b)/2;
		c=(sum-c)/2;
		ans++;
	}
	cout<<ans;

	return 0;
}

//I will succeed,
//Maybe not immediately,
//BUT DEFIANTLY.

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<cmath>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;


int dp[220][220];



int main()
{
	REP(i,220)REP(j,220)dp[i][j] = 1000000000;
	REP(i,220)dp[i][i] = 0;
	int n,m,r;
	
	cin >> n >> m >> r;
	
	iv mokuteki;
	
	REP(i,r)
	{
		int tmp;
		cin >> tmp;
		mokuteki.PB(tmp);
	}
	
	REP(i,m)
	{
		int a,b,c;
		cin >> a >> b >> c;
		dp[a][b] = min(c,dp[a][b]);
		dp[b][a] = min(c,dp[b][a]);
	}
	
	REP(k,n+2)REP(i,n+2)REP(j,n+2)
	dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k][j]);

	//SHOW2d(dp,n+1,n+1);
	
	ll ans = 1000000000000;
	
	sort(ALL(mokuteki));
	
	do
	{
		//SHOW1d(mokuteki,r);
		ll hikaku = 0;
		REP(i,r-1)
		{
			hikaku += dp[mokuteki[i]][mokuteki[i+1]];
		}
		
	//	cout << hikaku << endl;
		ans = min(ans,hikaku);
	}while(next_permutation(ALL(mokuteki)));
		
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	string S;
	cin>>S;
	int N =S.size();
	int ans1 = 0;
	rep(i,N){
		if(i%2 == 0){
			if(S[i] == '1')ans1++;
		}
		else{
			if(S[i] == '0')ans1++;
		}
	}
	int ans2 = 0;
	rep(i,N){
		if(i%2 == 0){
			if(S[i] == '0')ans2++;
		}
		else{
			if(S[i] == '1')ans2++;
		}
	}
	int ans = min(ans1,ans2);
	cout<<ans<<endl;
}

Measured memory_bytes: 512
import sys
input=sys.stdin.readline
n=int(input())
x_list=list(map(int,input().split()))
INF=10**9+7
def modinv(a,m):
    b=m
    (x,lastx)=(0,1)
    (y,lasty)=(1,0)
    while not b==0:
        q=a//b
        (a,b)=(b,a%b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx%m
ans=0
s=1
for i in range(n-1):
    s=s*(i+1)
    s=s%INF
for i in range(n-1):
    x=modinv(i+1,INF)
    ans=(ans+s*x*(x_list[n-1]-x_list[n-2-i]))%INF
sumx=[]
isumx=[]
sx=0
isx=0
for i in range(n-1):
    sx=(sx+x_list[i])%INF
    isx=(isx+x_list[n-2-i])%INF
    sumx.append(sx)
    isumx.append(isx)
for i in range(n-2):
    x=modinv(i+1,INF)
    y=modinv(i+2,INF)
    ans=(ans+s*x*y*(isumx[i]-sumx[i]))%INF
print(ans)
    


Measured memory_bytes: 68248
n, x = list(map(int, input().split()))
m=[]
for i in range(n):
    m += [int(input())]

#print(x,n)
#print(m)
    
mall1=sum(m)
rem=x-mall1
m_min=min(m)
#print(m_min)
ans = n+rem//m_min
print(ans)

Measured memory_bytes: 3060
ABC = list(map(int, input().split()))
cnt = 0
while len(set(ABC))!=1:
    A = sorted(ABC)[0]
    B = sorted(ABC)[1]
    C = sorted(ABC)[2]
    if ABC[0]%2==ABC[1]%2==ABC[2]%2:
        A += 2
        cnt += 1
    else:
        A += 1
        B += 1
        cnt += 1
    ABC = A,B,C
print(cnt)

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

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


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

using namespace std;

typedef long long int ll;

#define FOR(i,l,r) for(i=l;i<r;i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(x) x.begin(),x.end()

#define P pair<ll,ll>

#define F first

#define S second

signed main(){

  ll N,i;cin>>N>>i;

  cout<<N*i<<endl;

  return 0;

}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)

struct UnionFind{
    vector<int> nxt;
    void init(int x){
        nxt.clear();
        nxt.resize(x);
        for (int i = 0; i < x;i++){
            nxt[i] = i;
        }
    }
    int find(int x){
        if(nxt[x]==x)
            return x;
        return nxt[x] =find(nxt[x]);
    }
    inline void unite(int x,int y){
        nxt[find(y)] = find(x);
    }
};



ll N,H,W;
vector<pair<ll, pll>> arcs;
UnionFind uf;
ll vn[202020],en[202020];
ll i, j,k,ans;
int main(){
    scanf("%lld%lld%lld", &N,&H,&W);
    fornum(i,0,N){
        ll r, c, a;
        scanf("%lld%lld%lld", &r, &c, &a);
        arcs.push_back({a,{r, c}});
    }
    sort(arcs.begin(), arcs.end());
    uf.init(H + W);
    fornum(i,0,H+W){
        vn[i] = 1;
    }
    fornum(i,0,N){
        //printf("%lld:%lld\n", i, ans);
        auto arc = arcs[N - 1 - i];
        auto a = arc.first;
        auto r = arc.second.first-1;
        auto c = arc.second.second - 1 + H;
        ll vvn = vn[uf.find(r)];
        ll een = en[uf.find(r)] + 1;
        if(uf.find(r)!=uf.find(c)){
            vvn += vn[uf.find(c)];
            een += en[uf.find(c)];
        }
        if(vvn>=een){
            uf.unite(r, c);
            vn[uf.find(r)] = vvn;
            en[uf.find(r)] = een;
            ans += a;
        }
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint ans(4, 0);
    rep(i, n) {
        string s;
        cin >> s;
        if (s=="AC") ans[0]++;
        if (s=="WA") ans[1]++;
        if (s=="TLE") ans[2]++;
        if (s=="RE") ans[3]++;
    }

    cout << "AC x " << ans[0] << endl;
    cout << "WA x " << ans[1] << endl;
    cout << "TLE x " << ans[2] << endl;
    cout << "RE x " << ans[3] << endl;
    return 0;
}

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

int solve(std::vector<int> points)
{
    auto result = 0;
    for (auto i = 0u; i < points.size() - 1; ++i)
    {
        for (auto j = i + 1; j < points.size(); ++j)
        {
            result += points[i] * points[j];
        }
    }

    return result;
}

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> d(n);
    for (auto i = 0; i < n; ++i)
    {
        std::cin >> d[i];
    }
    std::cout << solve(d) << std::endl;

    return 0;
}


Measured memory_bytes: 256
from scipy.special import comb


N = int(input())
q, mod = divmod(N, 3)
total = 0
for i in range(q):
  row_num = q - i
  #print('列の数')
  #print(row_num)
  if not i == 0:
    mod += 3
  #print('あまり')
  #print(mod)
  l = mod + row_num - 1
  r = row_num - 1
  total += comb(l, r, exact=True)
  #print("トータルは")
  #print(total)
print(total % (10**9+7))

Measured memory_bytes: 42300
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int x;
   cin >> x;
   int ans = 10 - x / 200;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 3688
a,b,c=map(int,input().split())
if a%2!=0 or b%2!=0 or c%2!=0:
    print(0)
else:
    a1=0
    a2=0
    a3=0
    c1=0
    c2=0
    c3=0
    ans=0
    for i in range(2*10**5):
        if a%2!=0:
            c1=1        
        if b%2!=0:
            c2=1        
        if c%2!=0:
            c3=1
        if c1==1 or c3==1 or c2==1:
            ans=i
            break
        else:
            a3=(a+b)//2
            a2=(a+c)//2
            a1=(b+c)//2
            a=a1
            b=a2
            c=a3
        #print(a,b,c)
        if i==199999:
            ans=-1
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if (abs(a - c) <= d || (abs(b - c) <= d&& abs(b - a) <= d)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	 
	return 0;
}

Measured memory_bytes: 256
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    L = float(input())
    print((L/3)**3)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
from bisect import bisect_left, bisect_right

N = int(input())
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    ans += bisect_left(A, B[i])*(N - bisect_right(C, B[i]))
print(ans)

Measured memory_bytes: 23744
import Control.Monad
import Data.List

main=do
    [n,m]<-map read.words<$>getLine::IO[Int]
    print $  minimum $ map (liftM2 (-) maximum minimum) (sep n m ++ sep m n)

sep n m = map (\k -> (m*k:(d2 m (n-k)))) [1..n-1]

d2 a b
    | even a = [(b*a)`div`2]
    | even b = [(b*a)`div`2]
    | a > b = [(a`div`2)*b, (a`div`2+1)*b]
    | a <= b = [(b`div`2)*a, (b`div`2+1)*a]


Measured memory_bytes: 1916
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    ll a, b; cin >> a >> b;
    ll x[n];
    rep(i, n){
        cin >> x[i];
    }

    ll ans = 0;
    reps(i, 1, n){
        if((x[i] - x[i-1])*a > b){
            ans += b;
        }
        else{
            ans += (x[i] - x[i-1])*a;
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 1024
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 2000005;
#define endl '\n'
#define int ll
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
  IOS

  int n;
  cin>>n;
  vector<pair<int,int>> v;
  for(int i = 1;i<=n;i++){
    int x,l;
    cin>>x>>l;
    v.push_back({x+l,x-l});
  }
  sort(all(v));
  int cnt = 0,last = -1e15;
  for(int i = 0;i<n;i++){
    if(v[i].second>=last){
      cnt++;
      last = v[i].first;
    }
  }
  cout<<cnt<<endl;

  
  

}
 

Measured memory_bytes: 2420
import decimal

a, b, c = list(map(int, input().split()))
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)

# print('Yes' if a + b + 2 * ((a * b).sqrt()) < c else 'No')
print('Yes' if a.sqrt() + b.sqrt() < c.sqrt() else 'No')


Measured memory_bytes: 5844