akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <chrono>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#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 FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

llong pow(int x, int n) {
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

int min(int a, int b) {
    if (a > b) {
        return b;
    } else {
        return a;
    }
}

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a, b) + min(c, d) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
	int i,j;
	char a[2][3];
	for (i=0;i<2;i++){
		scanf ("%s",a[i]);
	}
	for (i=0,j=2;i<3;j--,i++){
		if (a[0][i]!=a[1][j]){
			printf ("NO\n");
			return 0;
		}
	}
	printf ("YES\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<ll>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N, M, L;
    cin >> N >> M >> L;
    Graph dist(N, vector<ll>(N, LLINF));
    for(int i = 0; i < N; ++i)
        dist[i][i] = 0;
    for(int i = 0; i < M; ++i) {
        int A, B, C;
        cin >> A >> B >> C;
        A--, B--;
        if(C <= L)
            dist[A][B] = dist[B][A] = C;
    }

    for(int k = 0; k < N; ++k) {
        for(int i = 0; i < N; ++i) {
            for(int j = 0; j < N; ++j) {
                dist[i][j] = min(dist[i][k] + dist[k][j], dist[i][j]);
            }
        }
    }

    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            if(i == j)
                continue;
            if(dist[i][j] <= L)
                dist[i][j] = 1;
            else
                dist[i][j] = INF;
        }
    }

    for(int k = 0; k < N; ++k) {
        for(int i = 0; i < N; ++i) {
            for(int j = 0; j < N; ++j) {
                dist[i][j] = min(dist[i][k] + dist[k][j], dist[i][j]);
            }
        }
    }

    int Q;
    cin >> Q;
    for(int i = 0; i < Q; ++i) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        cout << (dist[s][t] == INF ? -1 : dist[s][t] - 1) << endl;
    }
    return 0;
}


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

int di[4] = {0, -1, 0, 1};
int dj[4] = {1, 0, -1, 0};

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

typedef pair<int,int>P;

char direc[]={'U','R','D','L'};

bool used[1007][1007];

int AX,AY;

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

    int h, w; cin >> h >> w;
    vector<vector<bool> > g(h + 3, vector<bool> (w + 3, false));
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            char input; cin >> input;
            g[i][j] = (input == '#');
        }
    }

    int right = 0,p=0;     //初期位置からどれだけ右に進んだか
    while(true){
        cout << "? R" << endl;p++;
        string res; cin >> res;
        if(res == "YES") right++;
        else break;
    }

    //初期位置からの差分

    set<P>st,ans;
    int sub_i = 0, sub_j = 0;

    int x=504, y=504 , d=2;

    while(1){

        if( st.size() && x==504 && y==504 && d==2 ) break;

        st.insert(P(x,y));
       
        cout<<"? "<<direc[d]<<endl;p++;


        string res;
        cin>>res;
        if(res=="YES"){
            x += dx[d] ;
            y += dy[d] ;
            d=(d+3)%4;
        }
        else d=(d+1)%4;
    }


    for(int sx = 1; sx <= w; sx++){
        for(int sy = 1; sy <= h; sy++)if(!used[sx][sy])
        {

            ans.clear();
            
            if(!g[sy][sx] || g[sy][sx + 1]) continue;

            x = 504;
            y = 504;
            d = 2;
            int cnt=0;
            
            while(true){


                if( cnt && x==504 && y==504 && d==2 ){
                    if(st.size()!=ans.size())break;
                    int ax,ay;
                    int X=(*st.begin()).first-(*ans.begin()).first;
                    int Y=(*st.begin()).second-(*ans.begin()).second;
                    for(set<P>::iterator it=ans.begin(),it2=st.begin();it!=ans.end();it++,it2++){

                        if((*it2).first!=(*it).first+X)goto L;
                        if((*it2).second!=(*it).second+Y)goto L;

                        if((*it2).first==504&&(*it2).second==504) ax=(*it).first,ay=(*it).second;
                    }
                    
                        cout << "! " << ay - 1 -504+sy << " " << ax - 1 - right -504+sx << endl;
                        return 0;
                    
  

                        L:;
                        break;

                }

                cnt++;

                ans.insert(P(x,y));
                used[sx+x-504][sy+y-504]=1;
                
                int nx = x + dx[d];
                int ny = y + dy[d];
                
                if(g[ny + sy - 504][nx + sx- 504]){
                    x = nx ;
                    y = ny ; 
                    d=(d+3)%4; 
                }
                else{
                    d=(d+1)%4;
                }
            }       

        }
    }
    return 0;
}


Measured memory_bytes: 15400
N = gets.to_i
V = gets.chomp.split(" ").map(&:to_i)

ev = Hash.new{|h, k| h[k] = 0}
od = Hash.new{|h, k| h[k] = 0}
0.step(N-1, 2){|i|
  ev[V[i]] += 1
  od[V[i+1]] += 1
}
eva = ev.sort_by{|k, v| -v}
oda = od.sort_by{|k, v| -v}

if eva[0][0] == oda[0][0] then
  if ev.size == 1 && od.size == 1 then
    puts oda[0][1]
  elsif ev.size == 1 then
    puts N/2 - oda[1][1]
  elsif od.size == 1 then
    puts N/2 - eva[1][1]
  else
    puts [N - eva[0][1] - oda[1][1], N - eva[1][1] - oda[0][1]].min
  end
else
  puts N - eva[0][1] - oda[0][1]
end


Measured memory_bytes: 21120
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
bingo = False
for i in range(3):
    if (A[i][0] in B and A[i][1] in B and A[i][2] in B) or (A[0][i] in B and A[1][i] in B and A[2][i] in B):
        bingo = True
if (A[0][0] in B and A[1][1] in B and A[2][2] in B) or (A[0][2] in B and A[1][1] in B and A[2][0] in B):
    bingo = True
print("Yes" if bingo else "No")


Measured memory_bytes: 3064
using System;
using System.IO;
using System.Linq;

namespace ABC124A
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().Solve();
        }

        void Solve()
        {
            var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var A = temp[0];
            var B = temp[1];

            var ans = Math.Max(Math.Max(A + A - 1, A + B), B + B - 1);
            Console.WriteLine(ans);
        }
    }
}


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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int oo = 10000;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int X,N; cin >> X >> N;
	int diff = oo;
	int val = oo;
	set<int> S;
	forn(i,0,N){
		int x; cin >> x;
		S.insert(x);
	}
	forn(i,-10000,10000){
		if(S.count(i))continue;
		int act = abs(i-X);
		if(act < diff){
			diff = act;
			val = i;
		}
	}
	cout << val << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 3656
#include <stdio.h>
int main(void)
{
	char str[10];
	int a;
	int b;
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d %d", &a, &b);
	if(a < b){
		printf("a < b\n");
	} else if (a > b){
		printf("a > b\n");
	} else{
		printf("a == b\n");
	}
	return 0;
}

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

int main() {
  int N ;
  cin >> N ;
  if ((N % 1000) % 111 == 0 || (N / 10)  % 111 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}










Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N,M; cin>>N>>M;
  vector<string> grid(N); rep(i,N) cin>>grid[i];
  
  mf_graph<ll> graph(N*M+2);
  ll s=N*M,g=N*M+1;
  
  auto searchible=[&](ll i,ll j){
    if(i<0||i>=N||j<0||j>=M) return false;
    if(grid[i][j]=='#') return false;
    
    return true;
  };
  
  rep(i,N){
    rep(j,M){
      if(grid[i][j]=='#') continue;
      
      ll v=M*i+j;
      (i+j)%2==0?graph.add_edge(s,v,1):graph.add_edge(v,g,1);
      if((i+j)%2==1) continue;
      rep(k,4){
        if(searchible(i+dy[k],j+dx[k])){
          ll nv=M*(i+dy[k])+j+dx[k];
          graph.add_edge(v,nv,1);
        }
      }
    }
  }
  
  cout<<graph.flow(s,g)<<'\n';
  
  for(auto edge:graph.edges()){
    if(edge.from>=s||edge.to>=s) continue;
    if(!edge.flow) continue;
    ll f=edge.from,t=edge.to;
    ll fy=f/M,fx=f%M,ty=t/M,tx=t%M;
    if(fx<tx) {grid[fy][fx]='>'; grid[ty][tx]='<';}
    if(fx>tx) {grid[fy][fx]='<'; grid[ty][tx]='>';}
    if(fy<ty) {grid[fy][fx]='v'; grid[ty][tx]='^';}
    if(fy>ty) {grid[fy][fx]='^'; grid[ty][tx]='v';}
  }
  
  for(auto str:grid) cout<<str<<'\n';
  
  return 0;
}

Measured memory_bytes: 6436
import sys
f=lambda:map(int,sys.stdin.readline().split())
h,n=f()
INF=10**9
dp=[[INF]*(h+1) for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
  a,b=f()
  for j in range(h+1):
    dp[i+1][j]=min(dp[i][j],dp[i+1][max(j-a,0)]+b)
print(dp[n][h])

Measured memory_bytes: 120540
N = int(input())
S = [input() for i in range(N)]

C0, C1, C2, C3 = 0, 0, 0, 0

for i in range(N):
  if S[i]=='AC':
    C0 += 1
  elif S[i]=='WA':
    C1 += 1
  elif S[i]=='TLE':
    C2 += 1
  elif S[i]=='RE':
    C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))


Measured memory_bytes: 82560
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		char[] S=sc.next().toCharArray();
		char[] T=sc.next().toCharArray();
		int ans=0;
		for (int i=0;i<S.length;++i) {
			if (S[i]!=T[i]) ++ans;
		}
		System.out.println(ans);
	}

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

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
        	ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 36044
#include <iostream>
#include <bits/stdc++.h>
#include<string>
using namespace std;
 
int main() {
    string s,t;
    cin>>s>>t;
    int n,m;
    n=s.size();
    m=t.size();
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
           if(s[i-1]==t[j-1])
           {
           dp[i][j] = 1 + dp[i-1][j-1];
           }
           else
           dp[i][j]= max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int l= dp[n][m];
    char x[l+1];
    x[l]='\0';
    int i=n,j=m;
    while(i>0&&j>0)
    {
        if(s[i-1]==t[j-1])
        {
            x[l-1]=s[i-1];
            i--;
            j--;
            l--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
        i--;
        else
        j--;
    }
    cout<<x;
}

Measured memory_bytes: 35584
#include<stdio.h>
#include<math.h>
int main(){
    int n, x[101], y[101], d[101], i;
    double man, euc, p3, che;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    man = 0;
    che = -1000;
    euc = 0;
    p3 = 0;
    for(i=0;i<n;i++){
        scanf("%d",&y[i]);
        d[i] = abs(x[i] - y[i]);
        man += d[i];
        if(d[i] > che) che = d[i];
        euc += (d[i] * d[i]);
        p3 += (d[i] * d[i] * d[i]);
    }
    euc = sqrt(euc);
    p3 = cbrt(p3);
    printf("%lf\n%lf\n%lf\n%lf\n", man, euc, p3, che);
return 0;
}



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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

string s,t;
int main() {
    cin >> s >> t;

    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s < t){
        puts("Yes");
    }
    else{
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <cassert>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair


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

    vector<int> cs(m);
    REP(i,m) cin >> cs[i];

	  // ?????????
    // [????¨???????] = ????°??????°
	  int INF = 1e9;
    vector<int> dp(n+1, INF);
    dp[0] = 0;

	FOR(i, 1, m+1) {
        auto c = cs[i-1];
        FOR(j, c, n+1) {
            dp[j] = min(dp[j], dp[j - c] + 1);
        }

        // for(auto e : dp) cout << e << ",";
        // cout << endl;
    }

    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 1288
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
#define maxn 200000

using namespace std;

signed main()
{

 	FLASH

 	string s;
 	cin>>s;

 	map <char, int>m;
 	fr(i, 0, s.size()){
 		m[s[i]]++;
 	}


 	for(auto x: m){
 		if(x.second != 2){
 			return cout<<"No", 0;
 		}
 	}

 	cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    int mini=200003,res=0;
    rep(i,n){
        int p;cin>>p;
        if(p<=mini){
            res++;
            mini=p;
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse", "sse2", "avx", "avx2")

#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define int long long
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
const int mod = 1e9 + 7;
const int K = 120;
const int N = 2e5;
int dp[N][4];

signed main() {
    accell();
    int n;
    cin >> n;
    vector<int>a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 4; ++j) {
            dp[i][j] = -1e18;
        }
    }
    int cur = 0;
    if (n % 2 == 1)
        cur = 2;
    else
        cur = 1;
    for (int i = 0; i <= cur; ++i) {
        dp[i][i] = max(dp[i][i], a[i]);
    }
    for (int i = 0; i + 1 < n; ++i) {
        for (int k = 0; k <= cur; ++k) {
            if (dp[i][k] == -1e18)
                continue;
            for (int j = i + 2; j < n; ++j) {
                int del = j - i - 2;
                if (del > cur)
                    break;
                int c = k + del;
                if (c > cur) continue;
                dp[j][c] = max(dp[j][c], dp[i][k] + a[j]);
            }
        }
    }

    int ans = -1e18;
    for (int i = n - 1; i >= n - cur - 1; --i) {
        for (int j = 0; j <= cur - (n - i - 1); ++j) {
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	int l = a + b;
	int r = c + d;
	if(l > r){
		cout << "Left" << endl;
	}else if(l == r){
		cout << "Balanced" << endl;
	}else{
		cout << "Right" << endl;
	}
}

Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];
ll aa[N],bb[N],cc[N];

int solve() 
{
	//happy coding

	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;

	for(int i=0;i<a;i++)cin>>aa[i];
	for(int i=0;i<b;i++)cin>>bb[i];
	for(int i=0;i<c;i++)cin>>cc[i];


	sort(aa,aa+a);
	sort(bb,bb+b);
	sort(cc,cc+c);
	int h = x;
	vi v;
	for(int i=a-1;i>=0;i--){
		if(h-->0){
			v.pb(aa[i]);
		}
	}
	h = y;
	for(int i=b-1;i>=0;i--){
		if(h-->0){
			v.pb(bb[i]);
		}
	}
	sort(all(v));
	int x1 = v.size()-1;
	int c1 = c-1,v1 = x1;
	int d = x+y;
	ll sum = 0;
	while(d--){

		if(cc[c1]>v[v1]){
			sum += (ll)cc[c1];
			c1--;
		}else if(cc[c1]<=v[v1]){
			sum+=(ll)v[v1];
			v1--;
		}

	}




	//vout(v);
		cout<<sum<<endl;
	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 4728
import collections
N=int(input())
L=list(map(int,input().split()))
l=[]
L.sort()
lis=[0]*(max(L)+1)
cnt=0
ans=0
c=collections.Counter(L)
values=list(c.values())	#aのCollectionのvalue値のリスト(n_1こ、n_2こ…)
key=list(c.keys())	#先のvalue値に相当する要素のリスト(要素1,要素2,…)
l1=0
l2=0
mi=0
ma=0
le=0
for i in range(len(key)):
    l.append([key[i],values[i]])#lは[要素i,n_i]の情報を詰めたmatrix
l.sort(key=lambda x:x[0])
#print(lis,L)
for i in range(max(L)+1):
    #print(cnt)
    cnt=cnt+c[i]
    lis[i]=cnt
for i in range(len(L)-1):
    for j in range(i+1,len(L)):
        l1=L[i]
        l2=L[j]#l1<=l2
        ma=min(l1+l2-1,L[len(L)-1])
        mi=max(l2-l1+1,L[0])
        le=lis[ma]-lis[mi-1]
        if mi<=l1<=ma:
            le=le-1
        if mi<=l2<=ma:
            le=le-1
        #print(l1, l2,c[l1],c[l2],ma,mi,le)
        ans=ans+max(le,0)
print(ans//3)



Measured memory_bytes: 43996
from collections import defaultdict
wa_dict = defaultdict(lambda: 0)
n, m = map(int, input().split())
ac_set = set([])
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        if p not in ac_set:
            wa += wa_dict[p]
            ac_set.add(p)
    else:
        if p not in ac_set:
            wa_dict[p] += 1
print(len(ac_set), wa)

Measured memory_bytes: 20636
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	
	while(1)
	{
		if(a==1 && b==1 &&  c==1)
		break;
		 if(a%2!=0 || b%2!=0 || c%2!=0)
		{
			break;
		}
		if(a==b && b==c && a==c)
		{
		ans=-1;
		break;
		}
		
		int a1 = b+c;
		int b1 = a+c;
		int c1 = a+b;
		
			ans++;		
			
			a=a1/2;
			b=b1/2;
			c=c1/2;			
	}
	cout<<ans;	
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define rep(I, N) for (int I = 1; I <= (N); ++I)
#define repp(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORR(I, A, B) for (int I = (A); I >= (B); I--)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
const int N = 2e5 + 5;
const double eps = 1e-7;
const int mod = 1e9 + 7;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
LL gcd(LL a,LL b)
{
    if(a==b)
        return a;
    if(a>b)
        return gcd(a-b,b);
    if(a<b)
        return gcd(b-a,a);
}
LL a, b, c, d;
int main() {
    cin >> a >> b >> c >> d;
    LL __ = (LL)c * d / gcd(c,d);
    LL x = (a - 1) / __;
    LL y =  (b) / __;
    LL x1 = (a - 1)/ c;
    LL x2 = (b)/ c;
    LL x3 = (a - 1) / d;
    LL x4 = (b) / d;
    LL ans = x2 - x1 + x4 - x3;
    //cout << ans << endl;
    LL _ = b - a + 1;
    //cout << _ << endl;
    LL xx = _ - ans + y - x;
    cout << xx << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n, m;
  cin >> n >> m;
  int tr = 0;
  if (n > m) {
    swap(n, m);
    tr = 1;
  }
  int N = (1 << n) - 1, M = (1 << m) - 1;
  vvi s(N, vi(M));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      s[i][j] = __builtin_popcount((i + 1) & (j + 1)) % 2;
//      cerr << s[i][j];
    }
/*    cerr << endl;
    for (int i1 = 0; i1 < i; ++i1) {
      int c = 0;
      for (int j = 0; j < M; ++j) {
        c += s[i1][j] == s[i][j];
      }
      assert(c == M / 2);
    }*/
  }
  vvi res = s;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      if (i) res[i][j] ^= s[i - 1][j];
      if (j) res[i][j] ^= s[i][j - 1];
      if (i && j) res[i][j] ^= s[i - 1][j - 1];
    }
  }
  if (tr) {
    vvi res1(M, vi(N));
    for (int i = 0; i < res.size(); ++i) {
      for (int j = 0; j < res[0].size(); ++j) {
        res1[j][i] = res[i][j];
      }
    }
    res = res1;
  }
  for (int i = 0; i < res.size(); ++i) {
    for (int j = 0; j < res[0].size(); ++j) {
      cout << res[i][j];
    }
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 9600
import java.util.Scanner;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main{
    public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			int[] list = {sc.nextInt(), sc.nextInt(), sc.nextInt()};
			Arrays.sort(list);
			int times = 0;
			while(list[2]<=52){
				if(list[0]==list[2]&&list[0]==list[1]){
					break;
				}
				times++;
				if(list[1]!=list[2]){
					list[0]++;
					list[1]++;
				}else{
					list[0]=list[0]+2;
				}
				Arrays.sort(list);
			}
			System.out.println(times);
    }
}


Measured memory_bytes: 23764
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < (int)n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N, M;
int A[1000], B[1000], C[1000];
vector<PP> L[100];
int D[100][100];

void Dij(int s) {
	int* Dist = D[s];
	PriorityQ<PP> Q;
	Q.push(PP(0, s));
	while (!Q.empty()) {
		PP p = Q.top(); Q.pop();
		int dist = p.first;
		int from = p.second;
		if (Dist[from] <= dist) continue;
		Dist[from] = dist;
		for (PP l : L[from]) {
			int to = l.first;
			int cost = l.second;
			Q.push(PP(Dist[from] + l.second, to));
		}
	}

}

int main() {
	cin >> N >> M;
	REP(i, 0, M) {
		cin >> A[i] >> B[i] >> C[i];
		--A[i]; --B[i];
		L[A[i]].push_back(PP(B[i], C[i]));
		L[B[i]].push_back(PP(A[i], C[i]));
	}
	REP(i, 0, N) {
		REP(j, 0, N) {
			D[i][j] = INF;
		}
	}

	REP(i, 0, N) {
		Dij(i);
	}

	int ans = 0;
	REP(i, 0, M) {
		if (D[A[i]][B[i]] != C[i]) {
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      if(s.replaceAll("eraser","").replaceAll("erase","").replaceAll("dreamer","").replaceAll("dream","").equals(""))System.out.println("YES");
      else System.out.println("NO");
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 28716
use std::collections::VecDeque;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let s: String = read();
    let q: usize = read();

    let mut s: VecDeque<u8> = s.as_bytes().to_vec().iter().cloned().collect();
    let mut count = 0;

    for _ in 0..q {
        let t: i32 = read();

        if t == 1 {
            count += 1;
        }

        if t == 2 {
            let f: i32 = read();
            let c = read::<String>().as_bytes().to_vec()[0];

            if (count % 2 == 0 && f == 2) || (count % 2 == 1 && f == 1) {
                s.push_back(c);
            } else {
                s.push_front(c);
            }
        }
    }

    let mut s: Vec<u8> = s.iter().cloned().collect();
    if count % 2 == 1 {
        s.reverse();
    }

    println!("{}", std::str::from_utf8(&s).unwrap());
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4604
template<class T> void chmax(T & a, T b) { if (a < b) a = b; }
template<class T> void chmin(T & a, T b) { if (a > b) a = b; }

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

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

		vector<int> a(n);
		rep(i, n) scanf("%d", &a[i]);
		vector<int> s(n + 1, 0);
		rep(i, n) s[i + 1] = s[i] + a[i];

		int res = -(1 << 30);
		rep(i, n - k) {
			chmax(res, s[i + k] - s[i]);
		}
		cout << res << endl;
	}
}

int main(void) {
	solve();

	return 0;
}


Measured memory_bytes: 3700
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int N = 5;

        for (int i = 0; i < N; i++) {
            int x = scanner.nextInt();
            if (x == 0) {
                System.out.println(i + 1);
                return;
            }
        }
    }
}


Measured memory_bytes: 26996
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int[] arr_x = new int[100];
      	int[] arr_y = new int[100];
      	int war_x = 0;
      	int war_y = 0;
         
      for(int i = 0; i<n ; ++i){
        arr_x[i] = sc.nextInt();    
      }       
      for(int i = 0; i<m ; ++i){
       arr_y[i] = sc.nextInt(); 
      }
      if(x>y){
        System.out.println("War");
      } else{
        for(int Z = x+1; Z < y+1 ; Z++){
        	for(int i = 0; i<n ; i++){
               	if(arr_x[i] < Z){
            		war_x++;
                }
            }
          	if(war_x==n){
            	for(int j = 0; j<m ; j++){
                 if(arr_y[j]>=Z){
              		war_y++;
                 }
                }
              	if(war_y==m){
                  System.out.println("No War");
                  return;
                } else {
                  war_y = 0;
                }
            } else {
              	war_x=0;
         	}	
        }
        System.out.println("War");
      }
    }
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18

        signed main() {
 

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        
        int n,k;
        cin>>k;
        string s;
        cin>>s;
        n=s.length();
        if(k<n){
        s = s.substr(0,k);
        s+="...";
        }
        cout<<s;

        return 0;
    }

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define N 9


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


bool is_set(int a, int b, int c) {
  if (a == b && b == c) return true;
  int array[] = {a, b, c};
  qsort(array, 3, sizeof(int), cmpfunc);
  if (array[2] - array[1] == 1 && array[1] - array[0] == 1) return true;
  return false;
}

void array_remove3(int old_array[], int new_array[], int old_length, int a, int b, int c) {
  int i, new_index = 0;
  bool a_set = false, b_set = false, c_set = false;
  int old_array_copy[old_length];

  for (i = 0; i < old_length; i++) {
    old_array_copy[i] = old_array[i];
  }


  
  for (i = 0; i < old_length; i++) {
    if (!a_set && old_array_copy[i] == a) {
      old_array_copy[i] = -1;
      a_set = true;
    }
    if (!b_set && old_array_copy[i] == b) {
      old_array_copy[i] = -1;
      b_set = true;
    }
    if (!c_set && old_array_copy[i] == c) {
      old_array_copy[i] = -1;
      c_set = true;
    }
  }
  for (i = 0; i < old_length; i++) {
    if (old_array_copy[i] != -1) {
      new_array[new_index] = old_array_copy[i];
      new_index++;
    }
  }
 


}


  
  

bool solve_backtrack(int array[], int array_length, bool reset) {
  int i, j, k, l;
  static bool solved = false;
  if (reset) solved = false;
  
  if (array_length == 0) {
    solved = true;
    return true;
  }
  
  for (i = 0; i < array_length; i++) {
    for (j = i+1; j < array_length; j++) {
      for (k = j+1; k < array_length; k++) {
	
	if (is_set(array[i], array[j], array[k])) {
	  //printf("set: i is %d, j is %d, k is %d\n", array[i], array[j], array[k]);
	  int new_length = array_length - 3;
	  if (new_length == 0) {
	    //printf("new length is 0\n");
	    solved = true;
	    return true;
	  }
	  int new_array[new_length];
	  array_remove3(array, new_array, array_length, array[i], array[j], array[k]);
	  
	   
	  // printf("new index is %d\n", new_index);
	  solve_backtrack(new_array, new_length, false);
	  
	}
      }
    }
  }
  return solved;
}
	      




int main(int argc, char *argv[])
{

  int entries;
  int i, j;

  fscanf(stdin, "%d", &entries);
 

  
  for (i = 0; i < entries; i++) {
    int array[N], red[N], blue[N], green[N];
    int red_n = 0, blue_n = 0, green_n = 0;
    for (j = 0; j < N; j++) {
      fscanf(stdin, "%d", &array[j]);
    }
    char color;
    for (j = 0; j < N; j++) {
      fscanf(stdin, " %c", &color);
      if (color == 'R') {
	red[red_n] = array[j];
	red_n++;
      } else if (color == 'B') {
	blue[blue_n] = array[j];
	blue_n++;
      } else if (color == 'G') {
	green[green_n] = array[j];
	green_n++;
      }
    }
    
    if (red_n % 3 != 0 || blue_n % 3 != 0 || green_n % 3 != 0) {
      printf("0\n");
    } else if (solve_backtrack(red, red_n, true) && solve_backtrack(blue, blue_n, true) && solve_backtrack(green, green_n, true)) {
      printf("1\n");
    } else {
      printf("0\n");
    }
  }
  
  
 

  return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N, D, X;
    ll count;
    cin >> N >> D >> X;
    count = X;
    for(ll i = 0;i < N;i++) {
        ll j;
        ll temp;
        cin >> temp;
        for(j = 1;(temp * (j - 1)) + 1 <= D;j++);
        count += j - 1;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e17+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//  17:50-
bool solve(void){
	int n,i;cin>>n;
	if(n==0){return false;}
	vector<int>a(n);
	for(i=0;i<n;i++){cin>>a[i];}
	SO(a);
	int ans=9999999;
	for(i=0;i<n-1;i++){mineq(ans,a[i+1]-a[i]);}
	cout<<ans<<endl;
	return true;
}
int main(void){
	while(solve()){}
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>

using namespace std;
using pii = pair<int, int>;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> x(n);
	for(int i = 0; i < n; ++i){
		cin >> x[i];
		--x[i];
	}
	vector<int> a(n * n), b(n * n, -1), done(n);
	priority_queue<pii, vector<pii>, greater<pii>> pq;
	for(int i = 0; i < n; ++i){
		b[x[i]] = i;
		for(int j = 0; j < i; ++j){ pq.emplace(x[i], i); }
	}
	bool accept = true;
	for(int i = 0; i < n * n; ++i){
		if(b[i] >= 0){
			if(done[b[i]] != b[i]){
				accept = false;
				break;
			}
			a[i] = b[i];
			for(int j = b[i] + 1; j < n; ++j){
				pq.emplace(n * n, b[i]);
			}
		}else{
			if(pq.empty()){
				accept = false;
				break;
			}
			const auto t = pq.top();
			pq.pop();
			a[i] = t.second;
			++done[t.second];
		}
	}
	if(!accept){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
		for(int i = 0; i < n * n; ++i){
			cout << a[i] + 1 << " ";
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 4720
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;

int main()
{
  string s;
  cin >> s;
  int size = s.size();
  int check = 0;
  for (int i = 0; i < size; i++)
  {
    if (i % 2 == 0 && s[i] == '0')
    {
      check++;
    }
    if (i % 2 == 1 && s[i] == '1')
    {
      check++;
    }
  }
  cout << min(check, size - check) << "\n";
}


Measured memory_bytes: 512
def insertionSort(A, N):
    for i in range(len(A)):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(' '.join([str(s) for s in A]))

input_line = input()
N = int(input_line)
input_line = input()
A = [int(s) for s in input_line.split(' ') if s]
insertionSort(A, N)


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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;

template <ll mod> class modint
{
private:
    ll x;

public:
    modint(ll x = 0) : x(x >= 0 ? x % mod : (x % mod) + mod) {}
    modint &operator+=(const modint rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    modint &operator-=(const modint rhs) {
        if ((x += mod - rhs.x) >= mod) x -= mod;
        return *this;
    }
    modint &operator*=(const modint rhs) {
        (x *= rhs.x) %= mod;
        return *this;
    }
    modint &operator/=(const modint rhs) {
        *this *= rhs.inv();
        return *this;
    }
    modint operator+(const modint rhs) const { return modint(*this) += rhs; }
    modint operator-(const modint rhs) const { return modint(*this) -= rhs; }
    modint operator*(const modint rhs) const { return modint(*this) *= rhs; }
    modint operator/(const modint rhs) const { return modint(*this) /= rhs; }

    modint operator-() const { return modint(-x); }

    modint pow(ll n) const {
        modint e = *this, ret = modint(1);
        while (n) {
            if (n & 1) ret *= e;
            e *= e, n >>= 1;
        }
        return ret;
    }

    modint inv() const { return pow(mod - 2); }

    friend ostream &operator<<(ostream &os, const modint &m) {
        os << m.x;
        return os;
    }

    friend istream &operator>>(istream &is, modint &m) {
        ll in;
        is >> in;
        m = modint(in);
        return is;
    }
};
using mint = modint<1000000007>;

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

    string s; cin >> s;
    int n = s.length();

    mint dp[n + 1][13] = {};
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 13; j++) {
            if (s[i] == '?') {
                for (int d = 0; d <= 9; d++) {
                    dp[i + 1][(10 * j + d) % 13] += dp[i][j];
                }
            } else {
                int d = s[i] - '0';
                dp[i + 1][(10 * j + d) % 13] += dp[i][j];
            }
        }
    }
    cout << dp[n][5] << endl;
    return 0;
}

Measured memory_bytes: 10704
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a = nextInt(scanner);
        long v = nextInt(scanner);
        long b = nextInt(scanner);
        long w = nextInt(scanner);
        long t = nextInt(scanner);
        long d = Math.abs(a - b);
        if (d - (v * t) + (w * t) > 0) {
            System.out.println("NO");
        }else {
            System.out.println("YES");
        }
    }

    private static int nextInt(Scanner scanner) {
        return Integer.parseInt(scanner.next());
    }


}





Measured memory_bytes: 35700
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF 1LL<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
const int mod = 1e9 + 7;

int main(){
    ll n; cin >> n;
    string s; cin >> s;
    ll ans = 1;
    rep(i,n-1){
        if(s[i] != s[i+1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <string>
#define mod 1000000007
using namespace std; 

int main(){
	int a; cin >> a;
	if (a%10==3) cout << "bon" << "\n";
	else if (a%10==1) cout << "pon" << "\n";
	else if (a%10==0) cout << "pon" << "\n";
	else if (a%10==6) cout << "pon" << "\n";
	else if (a%10==8) cout << "pon" << "\n";
	else cout << "hon" << "\n";
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;
typedef long long  ll;
typedef long double ld;
typedef pair<ll,ll> pp;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> super_set;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> multi_set;
#define x1 dfds
#define y1 dsfdsfe
#define pb push_back
#define forn(i,n) for(ll i = 1;i<=n;++i)
#define fi first
#define sc second
#define endl '\n'
#define po(x) (1ll<<x)
const ll DIM = 1e5+7;
const ll INF = 1e9;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());


int main(){


    ld L;
    cin>>L;
    L/=3;
    cout<<fixed<<setprecision(10)<<L*L*L<<endl;
    return 0;
}



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

using namespace std;

class Position {
  private:
    double x;
    double y;
    double angle;
    double radian;
  public:
    Position();
    void Rotate(double);
    void Move(double);
    double GetX();
    double GetY();
};

Position::Position() {
  x = 0;
  y = 0;
  angle = 90;
  radian = angle / 180.0 * M_PI;
}

void Position::Rotate(double d_angle) {
  angle += d_angle;
  radian = angle / 180.0 * M_PI;
}

void Position::Move(double d_distance) {
  x += d_distance * cos(radian);
  y += d_distance * sin(radian);
}

double Position::GetX() {
  return x;
}

double Position::GetY() {
  return y;
}

int main() {
  Position pos;
  double distance, angle;

  while (1) {
    scanf("%lf,%lf", &distance, &angle);
    if (distance == 0 && angle == 0)
      break;
    angle *= -1;
    pos.Move(distance);
    pos.Rotate(angle);
  }

  cout << (int)pos.GetX() << endl;
  cout << (int)pos.GetY() << endl;
  
  return 0;
}

Measured memory_bytes: 1236
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
s = inp.shift().split('')
c = 0
for(i=0;i<s.length/2;i++) {
    if (s[i] !== s[s.length - i - 1]) {
        c++
    }
}
console.log(c)

Measured memory_bytes: 7372
N, L = map(int, input().split())

if L >= 0:
    print(int(L*(N-1)+N*(N-1)/2))
elif -L < N:
    print(int(L*N+N*(N-1)/2))
else :
    print(int(L*(N-1)+(N-2)*(N-1)/2))


Measured memory_bytes: 2940