akhauriyash/Code-Regression huggingface dataset:
//AtCoder ABC077 A - Rotation
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    string c1,c2;
    cin>>c1>>c2;
    string n1=c2;
    reverse(n1.begin(),n1.end());
    string n2=c1;    
    reverse(n2.begin(),n2.end());
    cout<<(c1==n1&&c2==n2?"YES":"NO")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll K = 1E9 + 7.1;
ll N, M;

ll perm_mod(ll n, ll k, const ll m) {
  assert(m > 0);
  ll ret = 1;
  while (k--) {
    ret = (ret * (n--) % m) % m;
  }
  return ret;
}

ll calc() {
  cin >> N >> M;
  if (abs(M - N) > 1) return 0;

  if (abs(M - N) == 1) {
    ll ret = 1;
    ret *= perm_mod(M, M, K);
    ret %= K;

    ret *= perm_mod(N, N, K);
    ret %= K;
    return ret;
  }

  ll ret = perm_mod(M, M, K);
  ret = ret * ret;
  ret %= K;
  ret *= 2;
  ret %= K;
  return ret;
}
int main () {
  cout << calc() << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long N,sum=0;
    cin >> N;
    long A[N+1],B[N];
	for (int i = 0; i < N+1; i++)
	{
        cin >> A[i]; 
	}
	for (int i = 0; i < N; i++)
	{
        cin >> B[i];
	}
	for (int i = 0; i < N; i++)
	{
        long mons_sum = A[i] + A[i+1];
		long min_val = min(mons_sum, B[i]);
        sum += min_val;
        if ((A[i]<B[i])){
          A[i+1] = mons_sum - B[i];
          if(A[i+1]<0){
            A[i+1] = 0;
          }
        }
	}
    cout << sum;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
const int maxn =2e5;

int main()
{
    int a,b,c,d,e;cin>>a>>b>>c>>d>>e;
    int ans=(c*60+d)-(a*60+b);
    cout<<ans-e<<endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
#include <bitset>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
#define MP make_pair
#define PB push_back
const int N=10010;
const int INF=1<<30;
vector<pi> v[N];
int Prim(int n){
    int ans=0,dis[n];
    priority_queue<pi,vector<pi>,greater<pi> >pq;
    pi temp; 
    bitset<N>b;
    dis[0]=0;
    b.reset();
    b[0]=true;
    for(int i=1;i<n;i++)dis[i]=INF;
    for(int i=0;i<v[0].size();i++){
        dis[v[0][i].S]=v[0][i].F;
        pq.push(v[0][i]);
    }
    n--;
    while(n>0){
        temp=pq.top();
        pq.pop();
        if(b[temp.S])continue;
        b[temp.S]=true;
        ans+=dis[temp.S];
        for(int i=0;i<v[temp.S].size();i++)if(!b[v[temp.S][i].S]){
            if(dis[v[temp.S][i].S]>v[temp.S][i].F){
                dis[v[temp.S][i].S]=v[temp.S][i].F;
                pq.push(v[temp.S][i]);
            }
        }
        n--;
    }
    return ans;
}
int main(){
    int n,m,l,r,temp;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d%d%d",&l,&r,&temp);
        v[l].PB(MP(temp,r));
        v[r].PB(MP(temp,l));
    }
    printf("%d\n",Prim(n));
}


Measured memory_bytes: 5792
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define rep(i,n) for(int64_t i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr int64_t INF=(1ll<<60);
constexpr int64_t mod=1000000007;
constexpr double pi=3.14159265358979323846;
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; }

int main(){
    char c;cin>>c;
    cout<<(char)(c+1)<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define N 100050
using namespace std;
const int mod=1e9+7;
int n,m,ed[20],dp[N],cnt[N],bin[30];
inline void modd(int &x){x-=x>=mod?mod:0;}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<=20;++i)bin[i]=1<<i;
	for(int i=0;i<bin[n];++i)cnt[i]=cnt[i>>1]+(i&1);
	for(int i=1,x,y;i<=m;++i)
		scanf("%d%d",&x,&y),ed[x-1]|=bin[y-1];
	int ans=0;
	dp[bin[n]-1]=1;
	for(int i=bin[n]-1,fst;i;--i){
		fst=bin[n]-1-i;
		for(int j=fst;j;j=j-1&fst)if(j&3^3){
			int p=1;
			for(int k=0;k<n;++k)if(i>>k&1){
				p=1ll*p*(bin[cnt[ed[k]&j]]-1)%mod;
			}
			else if(j>>k&1){
				p=1ll*p*bin[cnt[ed[k]&i]]%mod;
			}
			dp[i]=(1ll*dp[i|j]*p+dp[i])%mod;
		}
//		printf("dp[%d]=%d\n",i,dp[i]);
		if(i&3^3)ans+=dp[i],modd(ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3988
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() 
	{
		int a = ni();
		String s = ns();
		out.println(a >= 3200 ? s : "red");
		
	}
	
	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private float nf() {
		return Float.parseFloat(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

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

int main(){
  string s, t;
  cin >> s >> t;
  int st=-1;
  for(int i=0; i<=int(s.length())-int(t.length()); i++){
    bool tflag=true;
    for(int j=0; j<t.length(); j++)if(!(s[i+j]=='?' || s[i+j]==t[j]))tflag=false;
    if(tflag)st=i;
  }
  if(st<0){
    cout << "UNRESTORABLE";
    return 0;
  }
  for(int i=0; i<s.length(); i++){
    if(s[i]=='?'){
      if(st<=i && i<st+t.length())s[i]=t[i-st];
      else s[i]='a';
    }
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 256
/*
h3110_fr13nd,
 
AUTHOR : @sam_jn
*/
 
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define in(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define ot1(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define ot2(a, n) for(int i = 0; i < n; i++) cout << a[i] << "\n";
ll pwr(ll a, ll b);
ll pwr(ll a, ll b, ll m);
int baap[200002];
int find(int i);  
bool Union(int x, int y);
ll inv(ll x) {return pwr(x, MOD - 2, MOD);}

//----------------------------------SOLUTION-BELOW-------------------------------------------// 

void solve(){   
    long double r;
    cin >> r;
    cout << fixed << setprecision(12);
    long double ans = 2.0 * 3.14159265359 * r;
    cout << ans;
}
int main(){


                                                            // #ifndef ONLINE_JUDGE    
                                                            // freopen("../../input", "r", stdin);
                                                            // freopen("../../output", "w", stdout);
                                                            // #else
                                                            // // online submission
                                                            // #endif


    boost
    int _ = 1;
    // cout << 0 << endl;
    // cin >> _;
    while(_--){
        solve();
        cout << endl;
    }
}
 
 
//--------------------------------------DEFININTIONS---------------------------------------
ll pwr(ll a, ll b){
    if(b == 0)
        return 1 ;
    ll c = pwr(a, b/2) ;
    c = c * c;
    if(b % 2)
        return c*a;
    return c ;
}
ll pwr(ll a, ll b, ll m){
    if(b == 0)
        return 1;
    ll c = pwr(a, b/2, m) % m ;
    c = (c * c) % m;    
    if(b % 2)
        return (c * a%m) % m;
    return c ;
}
int find(int i)  
{  
    if (baap[i] != i)  
        baap[i] = find(baap[i]);  
  
    return baap[i];  
}
 
bool Union(int x, int y)
{
    x = find(x);
    y = find(y);
    if(x == y) return false;
    baap[x] = y;
    return true;
}

Measured memory_bytes: 3816
Q, H, S, D = map(int, input().split())
N = int(input())

LITTER = [0.25, 0.5, 1, 2]
cost = [Q, H, S, D]

# update cost
for i in range(3):
    if cost[i] * 2 < cost[i + 1]:
        cost[i + 1] = cost[i] * 2

result = 0
bought = 0
for i in reversed(range(4)):
    quantity = int((N - bought) / LITTER[i])
    bought += quantity * LITTER[i]
    result += quantity * cost[i]

print(int(result))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200200;
const int M=1001001;
const int X=1000000;
const int MOD=998244353;
int c[M]={0};
bool np[M];
int ps[M];
int pc=0;
int u[M];
int add(int a,int b){
	return (a+b)%MOD;
}
int sub(int a,int b){
	return (a-b+MOD)%MOD;
}
int mul(int a,int b){
	return (LL)a*b%MOD;
}
int mul(int a,int b,int c){
	return mul(mul(a,b),c);
}
int ksm(int a,int b){
	if(b==0){
		return 1;
	}
	int x=ksm(a,b>>1);
	return mul(x,x,b&1?a:1);
}
int inv(int a){
	return ksm(a,MOD-2);
}
const int INV2=inv(2);
int s(int x){
	return mul(x,add(x,1),INV2);
}
int h(int x){
	/**
	 * sum d=>[i<=n/d<i+1]*d
	 * sum d=>[i*d<=n<(i+1)*d]*d
	 * sum d=>[i*d<=n&&n<(i+1)*d]*d
	 * sum d=>[d<=n/i&&n/(i+1)<d]*d
	 * sum d=>[d<=floor(n,i)&&d>=floor(n,i+1)+1]*d
	 */
	int l=X/(x+1);
	int r=X/x;
	if(l>=r){
		return 0;
	}
	else{
		// cerr<<x<<" "<<l<<" "<<r<<endl;
		return sub(s(r),s(l));
	}
}
int tc[M];
int f(int n,int x){
	// cerr<<"f "<<n<<" "<<x<<endl;
	int ans=0;
	for(int i=x;i<=n;i+=x){
		ans=add(ans,mul(i,tc[i]));
	}
	// cerr<<mul(ans,ans)<<endl;
	return mul(ans,ans);
}
int g(int n,int d){
	// cerr<<n<<" "<<d<<endl;
	for(int i=1;i<=n;i++){
		tc[i]=c[d*i];
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(u[i]!=0){
			ans=add(ans,mul(u[i],f(n,i)));
		}
	}
	// if(ans!=0){
	// 	cerr<<d<<" "<<ans<<endl;
	// }
	return ans;
}
int main(){
	np[1]=true;
	u[1]=1;
	for(int i=2;i<=X;i++){
		if(!np[i]){
			// cerr<<i<<endl;
			ps[pc++]=i;
			u[i]=MOD-1;
		}
		for(int j=0;j<pc;j++){
			int x=i*ps[j];
			if(x>X){
				break;
			}
			np[x]=true;
			if(i%ps[j]==0){
				u[x]=0;
				break;
			}
			else{
				u[x]=mul(u[i],MOD-1);
			}
		}
	}
	// cerr<<"w"<<endl;
	int n;
	scanf("%d",&n);
	while(n--){
		int a;
		scanf("%d",&a);
		c[a]++;
		// cerr<<a<<endl;
	}
	// g(6);
	// return 0;
	// cerr<<"w"<<endl;
	int ans=0;
	for(int d=1;d<=X;d++){
		ans=add(ans,mul(d,g(X/d,d)));
	}
	// cerr<<"w"<<endl;
	for(int i=1;i<=X;i++){
		ans=sub(ans,mul(i,c[i]));
	}
	ans=mul(ans,INV2);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 14848
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
const double pi=acos(-1);

int main(){
  int r,c;
  cin >> r >> c;
  vector<int>vec(c+1);
  rep(i,r){
    int sum=0;
    rep(j,c){
      int d;
      cin >> d;
      cout << d << " ";
      sum+=d;
      vec[j]+=d;
    }
    cout << sum << endl;
  }
  int ans=0;
  rep(i,c){
    cout << vec[i]<<" ";
    ans+=vec[i];
  }
  cout << ans << endl;
  return 0;

      
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N;
    cin >> N;
    vector<vector<ll>> D(N, vector<ll>(2));
    rep(i, N){
        rep(j, 2){
            cin >> D.at(i).at(j);
        }
    }
    ll zoro = 0;
    rep(i, N){
        if(D.at(i).at(0) == D.at(i).at(1)){
            zoro++;
            if(zoro == 3){
                cout << "Yes" << endl;
                return 0;
            }
        }
        else{
            zoro = 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<queue>
using namespace std;
#define INFTY -1
#define MAX 100

void InitializeBoolMatrix(int nmbr_of_rows, int nmbr_of_columns, bool mtrx[][MAX]) {
	for (int row = 0; row < nmbr_of_rows; ++row) {
		for (int column = 0; column < nmbr_of_columns; ++column)
			mtrx[row][column] = false;
	}
}

void ListToMatrix(int number_of_vertices, bool mtrx[][MAX]) {
	int vertex_from, vertex_to, degree_out;	
	for (int vertex_i = 0; vertex_i < number_of_vertices; ++vertex_i) {
		scanf("%d %d", &vertex_from, &degree_out);
		vertex_from--; //0?????????????????????
		for (int vertex_out_i = 0; vertex_out_i < degree_out; ++vertex_out_i) {
			scanf("%d", &vertex_to);
			vertex_to--; //0?????????????????????
			mtrx[vertex_from][vertex_to] = true;
		}
	}
}

void BuildAdjacencyMatrix(int n, bool adjmtrx[][MAX]) {
	InitializeBoolMatrix(n, n, adjmtrx);
	ListToMatrix(n, adjmtrx);
}

void Bfs(int n, int depth[], bool adjmtrx[][MAX]) {
	bool yet_to_be_visited[n];
	for (int i = 0; i < n; ++i) {
		yet_to_be_visited[i] = true;
		depth[i] = INFTY;
	}

	depth[0] = 0;
	queue<int> next_vertex_to_visit;
	next_vertex_to_visit.push(0);

	while( !next_vertex_to_visit.empty() ) {
		int u = next_vertex_to_visit.front();
		next_vertex_to_visit.pop();
		for (int v = 0; v < n; ++v)	{
			if( adjmtrx[u][v] && yet_to_be_visited[v]){
				yet_to_be_visited[v] = false;
				depth[v] = depth[u] + 1;
				next_vertex_to_visit.push(v);
			}
		}
		yet_to_be_visited[u] = false;
	}
}

int main(){
	int n;
	scanf("%d", &n);
	bool adjmtrx[MAX][MAX];
	BuildAdjacencyMatrix(n, adjmtrx);
	int depth[n];
	Bfs(n, depth, adjmtrx);
	for (int id = 0; id < n; ++id)
		printf("%d %d\n", id + 1, depth[id]);
	return 0;
}

Measured memory_bytes: 2772
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#define min(x, y) (x < y ? x : y)

int main()
{
   int A , B;
 scanf("%d %d",&A,&B);

 int area1 = 1*A;
 int area2 = 1*B;
 
 printf("%d",A*B-(area1+area2-1));
 


  return 0;
}


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
  return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
  return a / gcd(a, b) * b;
}

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

int main()
{
  llint x;
  ci >> x;

  llint ans = 0;
  if(x % 11 == 0)
    ans = x / 11 * 2;
  else if(x % 11 > 6)
    ans = x / 11 * 2 + 2;
  else
    ans = x / 11 * 2 + 1;

  co << ans << en;
  
  return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    long long int max = 10000000000;
    long long int sum = 0;
    long long int a[n];
    for(int i=0 ;i<n;i++){
        cin >> a[i];
    }
    sort(a, a + n, greater<>());
    int p = n;
    sum = a[0];
    n--;
    for(int i=1; i<p;i++){
        long long int x = a[i];
        if(n==1)
            break;
        if(n>2){
            sum = sum + 2 * x;
            n-=2;
        }else{
            sum = sum + x;
            break;
        }
    }
    cout << sum;
    return 0; 
}

Measured memory_bytes: 5200
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

struct st{
	int from,to,cost;
};

int main(){
	int n,m;
	cin>>n>>m;
	
	int dp[101][101];
	rep(i,101)rep(j,101)dp[i][j] = INF;
	rep(i,101)dp[i][i] = 0;
	
	vector<st> edge;
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		dp[a][b] = dp[b][a] = c;
		edge.pb(st{a,b,c});
	}
	
	
	rep(k,n){
		rep(i,n){
			rep(j,n){
				dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j]);
			}
		}
	}
	
	int count=0;
	for(auto &e:edge){
		bool f = false;
		rep(i,n){
			rep(j,n){
				if(dp[i][e.from]+e.cost+dp[e.to][j]==dp[i][j] || dp[j][e.from]+e.cost+dp[e.to][i]==dp[j][i])f=true;
			}
		}
		if(!f)count++;
	}
	cout<<count<<endl;
}

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

int main() {
	int N, A, B, maxA = 0, maxB = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A >> B;
		if (maxA < A) {
			maxA = A;
			maxB = B;
		}
	}
	cout << maxA + maxB;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <cstdint>

using i64 = std::int64_t;

int main() {
	int x, y, a, b, c;
	std::cin >> x >> y >> a >> b >> c;

	std::priority_queue<i64, std::vector<i64>, std::greater<>> pq1, pq2;
	for (i64 i = 0; i < a; ++i) {
		i64 p;
		std::cin >> p;
		
		pq1.push(p);
	}
	while (pq1.size() > x)
		pq1.pop();

	for (i64 i = 0; i < b; ++i) {
		i64 q;
		std::cin >> q;

		pq2.push(q);
	}
	while (pq2.size() > y)
		pq2.pop();

	for (i64 i = 0; i < c; ++i) {
		i64 p = pq1.top();
		i64 q = pq2.top();

		i64 c;
		std::cin >> c;

		if (p <= q && p < c)
			pq1.pop(), pq1.push(c);
		else if (q <= p && q < c)
			pq2.pop(), pq2.push(c);
	}

	i64 ans = 0;
	while (!pq1.empty())
		ans += pq1.top(), pq1.pop();
	while (!pq2.empty())
		ans += pq2.top(), pq2.pop();

	std::cout << ans << std::endl;
}


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

int main() {
	int n;
	cin >> n;
	vector<pair<ll,ll>>xy(n);
	set<pair<ll, ll>>xys;
	for (int i = 0; i < n; i++) {
		cin >> xy.at(i).first >> xy.at(i).second;
		xys.insert(xy.at(i));
	}
	sort(xy.begin(), xy.end());
	if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	ll ans = 1000;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			pair<ll, ll>v;
			v.first = xy.at(j).first - xy.at(i).first;
			v.second = xy.at(j).second - xy.at(i).second;
			ll res = n;
			for (int k = 0; k < n; k++) {
				pair<ll, ll> opt1 = { xy.at(k).first + v.first, xy.at(k).second + v.second };
				if (xys.count(opt1))res--;
			}
			ans = min(ans, res);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys

n, q = map(int, sys.stdin.readline().split())
s = '$' + sys.stdin.readline().rstrip()
lr = zip(*[map(int, sys.stdin.read().split())] * 2)

def main():
    res = [None] * (n + 1); res[0] = 0
    prev = '$'
    for i in range(1, n+1):
        res[i] = res[i-1]
        cur = s[i]
        res[i] += (prev == 'A' and cur == 'C') & 1
        prev = cur
    
    for l, r in lr:
        yield res[r] - res[l]

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

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

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

	int ans = -1;
	int X = 0;
	while( 1 ) {
		int a = X * 8 / 100;
		int b = X * 10 / 100;
		if( a == A && b == B ) {
			ans = X;
			break;
		}
		if( b > B ) break;
		X++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3640
n = int(input())
a = list(map(int, input().split()))
p = []
q = []
if n%2 == 0:
	for i in range(n):
		if i%2 == 0:
			p.append(a[i])
		else:
			q.append(a[i])
	q.reverse()
	q.extend(p)
	print (" ".join(map(str,q)))
else:
	for i in range(n):
		if i%2 == 0:
			p.append(a[i])
		else:
			q.append(a[i])
	p.reverse()
	p.extend(q)
	print (" ".join(map(str,p)))


Measured memory_bytes: 30992
<?php
$n = (int)trim(fgets(STDIN));
$ary = explode(' ', trim(fgets(STDIN)));
foreach ($ary as &$v) {
	$v = (int)$v;
}

partition($ary, 0, $n-1);

function partition($ary, $p, $r){
	$x = $ary[$r];
	$i = $p-1;
	for ($j=$p; $j < $r; $j++) { 
		if ($ary[$j] <= $x) {
			$i += 1;
			$buf = $ary[$j];
			$ary[$j] = $ary[$i];
			$ary[$i] = $buf;
		}
	}
	$buf = $ary[$r];
	$ary[$r] = $ary[$i+1];
	$ary[$i+1] = '[' . $buf . ']';
	printIntArray($ary);
	return $i+1;
}

function printIntArray($ary){
	echo implode(' ', $ary) . PHP_EOL;
}


Measured memory_bytes: 37208
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N; cin >> N;
  ll s = 0;
  REP(i, N) {
    int a; cin >> a;
    s += a;
  }

  if (s%2==0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int to, T cost) {
        emplace_back(to, cost);
    }

    int size() {
        return n;
    }
};


int main() {

    int N,K;

    cin >> N >> K;

    vector<double> p(N);

    REP(i,N)cin >> p[i];

    vector<double> e(N);

    double sum = 0;

    REP(i,N){
        e[i] = (p[i]+1)/2;
        if(i<K)sum += e[i];
    }

    double max = sum;

    REP(i,N-K){
        sum = sum - e[i] + e[i+K];
        if(max < sum)max = sum;
    }

    cout << fixed << setprecision(15) << max << endl;

    return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;
class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int T = sc.nextInt();
        int ans;
        if(N%X != 0) {
            ans = (N/X + 1)*T;
        }else{
            ans = (N/X)*T;
        }
            
        System.out.println(ans);
    }
}

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

int main(void){
	char **pp;
	int i, j;
	int answers[20];
	int a, c;
	char *b;
	
	pp = (char **)malloc(sizeof(char *) * 30);
	for (i = 0; i< 30; i++){
		pp[i] = (char *)malloc(sizeof(char) * 20);
		fgets(pp[i], sizeof(char) * 20, stdin);
		a = atof(strtok(pp[i], " "));
		b = strtok(NULL, " ");
		c = atof(strtok(NULL, " "));
	
		switch((int)*b){
			case 42:
				answers[i] = (a * c);
				break;
			case 43:
				answers[i] = (a + c);
				break;
			case 45:
				answers[i] = (a - c);
				break;
			case 47:
				answers[i] = (a / c);
				break;
			case 63:
				goto prin;
			default:
				i--;
				break;
		}
	
	}
	
	prin:
	for (j = 0; j < i; j++){
	printf("%d\n", answers[j]);
	}
	
	return 0;
}

Measured memory_bytes: 584
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
$A[] = trim(fgets(STDIN));
$A[] = trim(fgets(STDIN));
$A[] = trim(fgets(STDIN));
//list($N,$A,$B) = explode(" ",trim(fgets(STDIN)));
//$h = explode(" ",trim(fgets(STDIN)));

$res = 0;
for($i=0;$i<$N;$i++) {
  $res += chk($i);
}
printf("%d\n",$res);

function chk($N) {
  global $A;
  $p = array();
  $p[]=$A[0][$N];
  $p[]=$A[1][$N];
  $p[]=$A[2][$N];
  $r = array_count_values($p);
  switch(count($r)) {
  case 1:
    return 0;
  case 2:
    return 1;
  case 3:
    return 2;
  }
}


Measured memory_bytes: 4856
/* Coached by rainboy */
#include <stdio.h>

#define N 1000000
#define MD 1000000007

long long power(int a, int b) {
	long long p;

	if (b == 0)
		return 1;
	p = power(a, b / 2);
	p = p * p % MD;
	if (b % 2)
		p = p * a % MD;
	return p;
}

int ff[N + 1], gg[N + 1];

int choose(int n, int k) {
	return (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;
}

int main() {
	int x, y, a, b, i;
	long long f;

	scanf("%d%d", &x, &y);
	if ((x + y) % 3 || x * 2 < y || y * 2 < x) {
		printf("0\n");
		return 0;
	}
	f = 1;
	for (i = 0; i <= N; i++) {
		gg[i] = power(ff[i] = f, MD - 2);
		f = f * (i + 1) % MD;
	}
	a = (y * 2 - x) / 3, b = (x * 2 - y) / 3;
	printf("%d\n", choose(a + b, a));
	return 0;
}

Measured memory_bytes: 7936
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int W , a , b ;
	scanf("%d %d %d",&W , &a , &b );
	if(b==(a+W) || a==b ||(b>a && (b<(a+W))) || (a>b && (a<(b+W))) )
    {
     printf("0");
    }
    else if(b>a)
    {
     printf("%d",b-(a+W));
    }
    else if(a>b)
    {
     printf("%d",a-(b+W));
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
//#include <bits/stdc++.h>
using namespace std;
class card
{
private:
  char suit;
  int number;
  int check;
public:
  void setcard(char card_suit,int number,int status);
  void set_check(int status);
  void show_card();
  int card_check();
};
void card::setcard(char input_suit,int input_sub,int status)
{
  suit = input_suit;
  number=input_sub;
  check = status;
}
void card::set_check(int status)
{
  check = status;
}
void card::show_card()
{
  cout<< suit <<' '<< number <<endl;
}

int card::card_check()
{
  return check;
}
int main()
{
  card trump[53];
  char card_suit;
  int cnt = 0;
  for(int j = 0;j<4;j++)
  {

    for(int i = 0;i < 13;i++)
    {
      if(j==0)card_suit = 'S';
      else if(j==1)card_suit = 'H';
      else if(j==2)card_suit = 'C';
      else if(j==3)card_suit = 'D';
      trump[cnt].setcard(card_suit,i + 1,0);
      cnt ++;
    }
  }
  int temp;
  char input_s;
  int input_id;
  int input_num;
  cin >> input_num;
  for(int i = 0; i<input_num;i++)
  {
    cin >> input_s>>input_id;
    if(input_s =='S')
    {
      trump[input_id - 1].set_check(1);
    }
    else if(input_s =='H')
    {
      trump[input_id + 12].set_check(1);
    }
    else if(input_s =='C')
    {
      trump[input_id + 25].set_check(1);
    }
    else if(input_s =='D')
    {
      trump[input_id + 38].set_check(1);
    }

  }
  for(int i = 0; i < 53;i++)
  {
    if(trump[i].card_check() == 0)
    {
      trump[i].show_card();
    }
  }

  return 0;
}


Measured memory_bytes: 3076
using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
int main()
{
	int a,b,c;
	char t;
	int cho=0,hishi=0;
	while(cin>>a>>t>>b>>t>>c){
		if(a*a+b*b==c*c)cho++;
		if(a==b)hishi++;
	}
	printf("%d\n%d\n",cho,hishi);
    return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 10000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
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;
}
void allcout(auto V) {
    for(auto x : V) cout << x << ' ';
    cout << endl;
}

signed main() {
    int N, K;
    cin >> N >> K;
    cout << min(N % K, K - (N % K)) << endl;
}


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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <utility>
#include <vector>
using namespace std;
using pint = pair<int ,int>;

int N; 
vector<vector<pint>> v;

bool judge(int bit){
    
    for (int i = 0; i < N; ++i) {
        if ( !(bit & (1 << i)) ) continue;

        for (pint xy : v[i]) {
            int x = xy.first; 
            int y = xy.second; 

            if (y == 1 && !(bit & (1 << x))) return false;
            if (y == 0 && (bit & (1 << x))) return false;
        }
    }
    return true;
}


int main(){
    cin >> N;
    v.resize(N);
    for(int i=0; i<N; ++i){
        int a; cin >> a;
        v[i].resize(a);
        for(int j=0; j<a; ++j){
            cin >> v[i][j].first >> v[i][j].second;
            --v[i][j].first;
        }
    }

    int res = 0;
    for(int bit=0; bit<(1<<N); ++bit){
        if(judge(bit)){
            int cnt = 0;
            for(int i=0; i<N; ++i){
                if(bit&(1<<i)){cnt++;}
            }
            res = max(res, cnt);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

class Main
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args)
    {
        FastReader sc = new FastReader();
        long n = sc.nextLong();
        StringBuilder stringBuilder = new StringBuilder("");

        while(n > 0){
            n = n - 1;
            long rem = n % 26;
            stringBuilder.append((char)('a' + rem));
            n = n / 26;
        }
        System.out.println(stringBuilder.reverse().toString());
    }
}

Measured memory_bytes: 32928
read A B K
C=$((A+B))
    if [ $C -le $K ]; then
       echo 0 0
	elif [ $A -lt $K ] ; then
       echo 0 $((B-(K-A)))
    elif [ $A -ge $K ]; then
       echo $((A-K)) $B
     else
       : # 何もしない
    fi

Measured memory_bytes: 376
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

N = int(input())

print(A[N-1])

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

int main() {
  int n;
  std::cin >> n;
  std::vector<int> numbers;
  for (int i = 0; i < n; i++) {
    int input_value;
    std::cin >> input_value;
    numbers.push_back(input_value);
  }
  int cnt = 0;
  bool flag = true;
  while( flag ) {
    for (auto &e: numbers) {
      if (e % 2 == 1) {
        flag = false;
        break;
      }
      e /= 2;
    }
    if (flag) {
      ++cnt;
    }
  }
  std::cout << cnt;
}

Measured memory_bytes: 256
// #include "testlib.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<ll,ll>
#define se second
#define double long double
#define mod 1000000007
#define popcount __builtin_popcountll
const double PI = acos(-1.0);
using namespace std;
#define MXN 3005
int n, m;
int a[88][88];
int b[88][88];
int dp[80][80][6401];
int cal(int i, int j, int s){
    if(i==n || j==m || s>=6401)return 1e8;
    if(i==n-1 && j==m-1){
        int d = a[i][j]-b[i][j];
        return min(abs(s+d), abs(s-d));
    }
    int &ret = dp[i][j][s];
    if(ret!=-1)return ret;
    ret = 1e8;
    int d = a[i][j]-b[i][j];
    ret = cal(i+1, j, abs(s+d));
    ret = min(ret, cal(i+1, j, abs(s-d)));
    ret = min(ret, cal(i, j+1, abs(s+d)));
    ret = min(ret, cal(i, j+1, abs(s-d)));
    return ret;
}
int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            scanf("%d", &a[i][j]);
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            scanf("%d", &b[i][j]);
        }
    }
    memset(dp,-1,sizeof dp);
    cout<<cal(0,0, 0)<<endl;
}


Measured memory_bytes: 160384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
int f(int a,int b){
    int res=0;
    while(a>0){
        ++res;a/=10;
    }
    int buf=0;
    while(b>0){
        ++buf;b/=10;
    }
    return max(res,buf);
}
signed main(){
  lint n;cin>>n;
  lint res=inf;
  rep1(i,100000){
      if(n%i==0){
          lint buf=f(i,n/i);
          res=min(res,buf);
      }
  }
  cout<<res<<"\n";
  return 0;
}

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

int main() {
    int N, d[32], x[32], X, i, OUT, t, cur[128], last_t, last;
    char tmp;

    while (cin >> N >> X && (N || X)) {
        for (i=1; i<=N; i++) {
            cin >> tmp >> x[i];
            d[i] = ( tmp=='L' ? -1 : 1);
        }
    
        OUT = t = last_t = last = 0;
        while (OUT < N) {
            memset(cur, 0, sizeof(cur));
            for (i=1; i<=N; i++) if (x[i] > 0 && x[i] < X) {
                x[i] += d[i];
                if (cur[x[i]]) { d[cur[x[i]]] *= -1; d[i] *= -1; }
                cur[x[i]] = i;
                if (x[i] == 0 || x[i] == X) {
                    OUT++;
                    if ( last_t < t+1 || (last_t == t+1 && d[i] == -1) ) { last_t = t+1; last = i; }
                }
            }
            t++;
        }
        cout << t << ' ' << last << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;



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

	cin >> N;
	vector<int>num(N - 1);
	for (int i = 0; i < N - 1; i++) {
		cin >> num[i];
	}
	vector<vector<vector<int>>>dp(2, vector<vector<int>>(N, vector<int>(2, 100000001)));
	dp[0][0][0] = 0;
	dp[0][1][1] = 0;
	for (int i = 1; i < N; i++) {
		dp[i % 2][0][0] = dp[(i + 1) % 2][0][0];
		for (int j = 1; j <= min(i, (int)N / 2); j++) {
			dp[i % 2][j][0] = min(dp[(i + 1) % 2][j][0], dp[(i + 1) % 2][j][1] + num[i - 1]);
			dp[i % 2][j][1] = min(dp[(i + 1) % 2][j - 1][1], dp[(i + 1) % 2][j - 1][0] + num[i - 1]);
		}
	}
	cout << min(dp[1][N / 2][1], dp[1][N / 2][0]) << endl;
	return 0;
}

Measured memory_bytes: 4464
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var n = IO.RInt;
            var a = IO.RSInt;

            var dis = new int[100000];

            for (int i = 0; i < a.Length; i++)
            {
                dis[a[i]]++;
            }

            var ans = dis[0];
            ans = Max(ans, dis[0] + dis[1]);
            for (int i = 1; i < 99999; i++)
            {
                ans = Max(ans, dis[i - 1] + dis[i] + dis[i + 1]);
            }
            ans = Max(ans, dis[99997] + dis[99998]);
            ans = Max(ans, dis[99999]);
            WriteLine(ans);
        }
    }
    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 18528
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

const int INF = 1e6 + 239;

int n;
vector<vector<int>> g;
vector<int> d;

void bfs(int s) {
	d.resize(3 * n, INF);
	d[s] = 0;
	queue<int> q;
	q.push(s);
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (auto t : g[v]) {
			if (d[t] > d[v] + 1) {
				d[t] = d[v] + 1;
				q.push(t);
			}
		}
	}
}

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

	int m;
	cin >> n >> m;
	// n *= 3;
	g.resize(n * 3);
	while (m--) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		for (int fm = 0; fm < 3; fm++) {
			int sm = (fm + 1) % 3;
			g[u + n * fm].push_back(v + n * sm);
			// g[v + n * fm].push_back(u + n * sm);
		}
	}
	int s, t;
	cin >> s >> t;
	s--;
	t--;
	bfs(s);
	if (d[t] == INF) cout << -1 << endl;
	else cout << d[t] / 3 << endl;
}


Measured memory_bytes: 17792
#include<stdio.h>
int main(void)
{
   int x,y,i;
	while(1){
	scanf("%d %d",&x,&y);
	if(x==0&&y==0){
	    return 0;
	}
	 if(x<y){
		printf("%d %d\n",x,y);
	}else{
		printf("%d %d\n",y,x);
	}
}
	
	return 0;
}
		

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

bool p[100005],a[100005];
int b[100005];
int main()
{
	p[1]=true;
	for(int i=2;i<=sqrt(100000);i++)
	{
		if(p[i]==false)
		{
			for(int j=i*i;j<=100000;j+=i)
				p[j]=true;
		}
	}
	for(int i=2;i<=100000;i++)
	{
		if(i!=2&&p[i]==false&&p[(i+1)/2]==false)
				a[i]=true;
	}
	for(int i=2;i<=100000;i++)
		b[i]=b[i-1]+a[i];
	int q,l,r;
	cin>>q;
	for(int i=1;i<=q;i++)
	{
		cin>>l>>r;
		cout<<b[r]-b[l-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	
	string s;
	cin>>s;
	int ans=0;
	REP(i,s.size()-1){
		if(s[i]!=s[i+1])
			ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}

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

int main()
{
    vector<int> A(5);
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
    }
    
    vector<int> nextTime(5);
    for (int i = 0; i < 5; i++) {
        if (A[i] % 10 == 0) {
            nextTime[i] = A[i];
        }else{
            nextTime[i] = A[i] - A[i] % 10 + 10;
        }
    }
    
    int result = 1e9;
    for (int i = 0; i < 5; i++) {
        int sum = 0;
        for (int j = 0; j < 5; j++) {
            if (i == j) {
                sum += A[j];
            }else{
                sum += nextTime[j];
            }
        }
        result = min(result, sum);
    }
    cout << result << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include <fstream>
using namespace std;
typedef long long ll;
const ll INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9+7;
const int maxn = 200005;
ll T,n,m;
int main() {
	cin>>n>>m;
	for(int i=m-n+1;i<m+n;i++)
		cout<<i<<" ";
}



Measured memory_bytes: 256
//A smoothe sea never made a skilled sailor.
//KEEP IT SIMPLE STUPID
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define print(o) for(auto it=(o).begin();it!=(o).end();it++) cout<<*it<<" ";
#define vll vector<ll>
#define pb push_back
#define FOR(n) for(ll i=0;i<n;i++)
#define FORr(a,b) for(ll i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()

bool palin(string s)
{
    string t=s;
    reverse(all(t));
    return t==s;
}

int main()
{
    string s;
    cin>>s;
    if(s.length()%2==0)
    {
        cout<<"No\n";
    }
    else
    {
        int n=s.length();
        string s1=s.substr(0,(n-1)/2);
        string s2=s.substr((n+1)/2,n);
        //cout<<s1<<" "<<s2;
        if(palin(s)&&palin(s1)&&palin(s2))
        {
            cout<<"Yes\n";
        }
        else
        {
            cout<<"No\n";
        }
    }
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


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

int main(){
  int N;
  cin >> N;
  vector<float> a(N);
  vector<string> b(N);
  float y=0;
  
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    cin >> b.at(i);
    if(b.at(i) == "BTC"){
      a.at(i) *= 380000;
    }
    y += a.at(i);
  }
  
  cout << y << endl;
  return 0;
}

      

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >>b >> c;

    int ans = 0;
    if(a % 2 == 0)
    {
        if(b % 2 == 0)
        {
            if(c % 2 == 0)
            {
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
            else
            {
                ans++;a++;b++;
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
        }
        else
        {
            if(c % 2 == 0)
            {
                ans++;a++;c++;
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
            else
            {
                ans++;c++;b++;
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
        }
    }
    else
    {
        if(b % 2 == 0)
        {
            if(c % 2 == 0)
            {
                ans++;c++;b++;
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
            else
            {
                ans++;a++;c++;
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
        }
        else
        {
            if(c % 2 == 0)
            {
                ans++;a++;b++;
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
            else
            {
                ans += (max(a,max(b,c)) - a) / 2;
                ans += (max(a,max(b,c)) - b) / 2;
                ans += (max(a,max(b,c)) - c) / 2;
            }
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	char st[200001];
	int s=0,c=0,i;
	scanf("%s",st);
	for(i=0;i<strlen(st);i++){
		if(st[i]=='S'){
			c++;
		}
		else if(c){
			c--;
		}
		else{
			s++;
		}
	}
	printf("%d\n",s+c);
	return 0;
}

Measured memory_bytes: 384
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n%2 ==0)
	{
		cout << n << endl;
	}
	else
	{
		cout << 2 * n << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,k,x,y;
  scanf("%d%d%d%d",&n,&k,&x,&y);
  if(n<=k){
    printf("%d",n*x);
  }
  else{
    printf("%d",k*x+(n-k)*y);
  }
  return 0;
}

Measured memory_bytes: 128