akhauriyash/Code-Regression huggingface dataset:
// abc102_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) {
        cin >> A[i];
        A[i] -= i+1;
    }

    sort(ALL(A));

    ll med1 = A[(N+1)/2-1];
    ll tmp1 = 0;
    REP(i, N) {
        tmp1 += abs(A[i] - med1);
    }

    ll med2 = A[(N+1)/2];
    ll tmp2 = 0;
    REP(i, N) {
        tmp2 += abs(A[i] - med2);
    }
    ll ans = min(tmp1, tmp2);
    print(ans);

    return 0;
}


Measured memory_bytes: 1792
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int digit(int n) {
  if(n < 10) return n;
  return digit(n/10) + n%10;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  bool flag = false;
  if(n % digit(n) == 0) flag = true;
  YesorNo(flag);
  return 0;
}
//templete by private_yusuke

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

int main() {
  ll a;
  double b;
  cin >> a >> b;
  ll ans1 = b * 100 + 0.5;
  ll ans2 = (a * ans1) / 100;
  cout << ans2 << endl;
  return 0;
}

Measured memory_bytes: 3732
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;
const int INF = 2147483647;
const int MAX = 200000;


int main() {
	int N, M;
	int D[MAX];
	int T[MAX];

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> D[i];
	}

	cin >> M;
	for (int i = 0; i < M; i++) {
		cin >> T[i];
	}

	sort(D, D + N);
	sort(T, T + M);

	int d = 0;
	int t = 0;
	while (d < N && t < M) {
		if (D[d] == T[t]) {
			d++;
			t++;
		}
		else {
			d++;
		}
	}

	if (t == M) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1792
while True:
    try:
        a,b,c,d,e,f = map(float,raw_input().split())
        x = ( e*c - b*f ) / ( e*a - b*d )
        y = ( c*d - a*f ) / ( b*d - e*a )
        if x == -0.000:
            x = 0.000
        if y == -0.000:
            y = 0.000
        print '%.3f %.3f' % (x,y)
    except EOFError:
        break

Measured memory_bytes: 6244
N = input()  #一応読むけど、ループ回せば不要では
aList=input().split()

opCnt = 0
isAllE = True  #奇数見つかるまでは見なしTrue

while isAllE:
  for a in aList:
    if int(a)%2 == 1:
      isAllE = False
      break
  else:
    opCnt = opCnt + 1
    for i,a in enumerate(aList):
      aList[i] = int(int(a)/2)

print(opCnt)

Measured memory_bytes: 3060
#include <stdio.h>
int main() 
{     int rect_w, rect_h, x, y, r;
       scanf("%d %d %d %d %d", &rect_w, &rect_h, &x, &y, &r);
              if (x >= r && x + r <= rect_w && y >= r && y + r <= rect_h)
              {        
				 printf("Yes\n");    
			  }
              else{        
				 printf("No\n");
				  }       
              return 0;
}

Measured memory_bytes: 584
K,N=map(int,input().split())

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

MAX=A.pop(N-1)
pre=MAX
counter=[]

for a in reversed(A):
    counter.append(pre - a)
    pre=a

counter.append(pre + K - MAX)
counter.sort()
print(sum(counter[:N-1]))


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

map<long long, long long> m;

int main()
{
    long long n;
    cin >> n;
    for (long long i = 0; i < n; i++)
    {
        long long x;
        cin >> x;

        if (m.find(x) == m.end())
        {
            m[x] = 1;
        }
        else
        {
            cout << "NO\n";
            return 0;
        }
        
    }

    cout << "YES\n";
}

Measured memory_bytes: 16048
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
 
struct node{
    int val;
    node *lch,*rch;
    node(int val):val(val){}
};
 
node *make(string s){
    int stk=0;
    rep(i,s.size()){
        if(s[i]=='(')stk++;
        else if(s[i]==')')stk--;
        else if(s[i]=='['){
            if(stk)continue;
            string l=s.substr(1,i-2);
            int cur=i+1,val=0;
            while(s[cur]!=']'){
                val=val*10+s[cur]-'0';
                cur++;
            }
            cur++;
            string r=s.substr(cur+1,s.size()-cur-1);
            node *t=new node(val);
            t->lch=make(l);
            t->rch=make(r);
            return t;
        }
    }
    return NULL;
}
 
string tostring(int a){
    stringstream ss;
    ss<<a;
    return ss.str();
}
 
string dfs(node *s,node *t){
    if(s==NULL||t==NULL)return "";
    return "("+dfs(s->lch,t->lch)+")["+tostring(s->val+t->val)+"]("+dfs(s->rch,t->rch)+")";
}
 
signed main(){
    string S,T;
    cin>>S>>T;
    node *s=make(S);
    node *t=make(T);
    cout<<dfs(s,t)<<endl;
    return 0;
}

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

#define ll long long int
#define N 1000001

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

int main() {
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);
    vector<bool> isprime(N, true);
    vector<ll> primes;
    for(ll i = 2; i <= N; i++) {
        if(isprime[i]) {
            primes.push_back(i);
            for(ll j = i * i; j <= N; j += i) {
                isprime[j] = false;       
            }
        }
    }
    ll cnt = 1;
    for(ll p : primes) {
        if(g % p == 0)
            cnt++;
        while(g % p == 0)
            g /= p;
    }
    if(g != 1)
        cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 1528
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int main(){
    int H,W,N;
    cin>>H>>W>>N;
    if(N != 0)cout<<(N-1)/max(H,W)+1<<endl;
    else cout<<0;
    return 0;
}

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

void solve(int n) {
	int a, b, c, d, ans = 0;
	for (a = 0; a <= 9; a++) {
		for (b = 0; b <= 9; b++) {
			for (c = 0; c <= 9; c++) {
				for (d = 0; d <= 9; d++) {
					if (a + b + c + d == n) ans++;
				}
			}
		}
	}
	printf("%d\n", ans);
}

int main() {
	int n;
	while (cin >> n) {
		solve(n);
	}
	return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'

// vi v(6);
// void allstr(string op,string s,int n){
// 	if(s.size() == 0){
// 		fo(i,0,op.size())
// 		if(op.size() >0)
// 		v[op[i]-'0']++;
// 		// cout << op << endl;
// 		return;
// 	}
	
// 		string temp;
// 		fo(i,1,s.size())temp += s[i];
		
// 		allstr(op,temp,n);
// 		allstr(op+s[0],temp,n);

	
// 	return;
// }

// int power(int a,int b){
// 	if(b == 0)return 1;
// 	int res = power(a,b/2);
// 	res = (res * res)%mod;
// 	if(b&1)res = (res*a)%mod;
// 	return res;
// }



// struct compare{
// bool operator() (pair<int,int> a,pair<int,int> b){
// 	if(a.first > b.first)return true;
// 	if(a.first == b.first){
// 		if(a.second < b.second)return true;
// 	}
// 	return false;
// }
// };

int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//      int t;
//      cin >> t;
//      while(t--){





// }
string s;
cin >> s;
int cr = 0;
int cs = 0;
int n = s.length();
for(int i=0;i<n;){
	int j = i;
	int r = 0;
	int su = 0;
	while(j < n && s[j] == s[i]){
		if(s[j] == 'R')r++;
		j++;
	}
	cr = max(r,cr);
	i = j;
}
cout << cr << endl;


return 0;
}



Measured memory_bytes: 3632
while 1:
    N = int(input())
    if N ==0:break
    max_h = 0
    min_h = 0
    max_w = 0
    min_w = 0
    data=[(0,0)]
    for _ in range(N-1):
        n,d = list(map(int,input().split()))
        if d ==0:current = (data[n][0]-1,data[n][1])
        if d ==1:current = (data[n][0],data[n][1]-1)
        if d ==2:current = (data[n][0]+1,data[n][1])
        if d ==3:current = (data[n][0],data[n][1]+1)
        if max_h < current[1]:max_h = current[1]
        if min_h > current[1]:min_h = current[1]
        if max_w < current[0]:max_w = current[0]
        if min_w > current[0]:min_w = current[0]
        data.append(current)
    print(abs(max_w-min_w)+1,abs(max_h-min_h)+1)

Measured memory_bytes: 5620
a = int(input())
b = int(input())
c = int(input())

x = int(input())

count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if ((i*500) + (j*100) + (k*50)) == x:
                count += 1
            else:
                continue

print(count)

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, A, B;

  std::cin >> N >> A >> B;

  std::cout << std::min(A, B) << ' ' << std::max(A + B - N, 0) << std::endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();

            var S = cin.next();

            var s = S.ToCharArray();

            var mae = int.Parse((s[0].ToString() + s[1].ToString()));
            var usiro = int.Parse((s[2].ToString() + s[3].ToString()));

            if (IsYY(mae) && IsYY(usiro))
            {
                Console.WriteLine("NA");
                return;
            }
            if (maybeMM(mae) && maybeMM(usiro))
            {
                Console.WriteLine("AMBIGUOUS");
                return;
            }
            if (IsYY(mae))
            {
                Console.WriteLine("YYMM");
                return;
            }                
            if (IsYY(usiro))
            {
                Console.WriteLine("MMYY");
                return;
            } 
        }

        static bool IsYY(int num)
        {
            if (num == 0) return true;
            if (13 <= num) return true;
            return false;
        }
        static bool maybeMM(int num)
        {
            if (1 <= num && num <= 12) return true;
            return false;
        }
    }
    
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}


Measured memory_bytes: 11092
N = int(input())

xl =[]
for i in range(0,N):
  x, l = map(int, input().split())
  xl.append((x+l,x-l))

xl = sorted(xl)

cur = -10**9
ans = 0
for r in xl:
    if cur <= r[1]:
        ans +=1
        cur = r[0]

print(ans)


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



int main(){
		
		int evenNum,oddNum;
		cin>>evenNum>>oddNum;
		
		int cnt=0;
		if(evenNum>1){
			for(int i=evenNum-1;i>0;i--){
				cnt=cnt+i;
			}
		}
		if(oddNum>1){
			for(int i=oddNum-1;i>0;i--){
				cnt=cnt+i;
			}
		}
		cout<<cnt<<endl;
		return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<time.h>
#include<cmath>
#include<functional>
#include<cassert>
#define rep(a,b) for(int a=0;a<b;++a)
#define REP(a,b,c,d) for(int a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
    int N,K;cin>>N>>K;
    vector<int> h(N);
    rep(i,N)cin>>h[i];
    sort(h.begin(),h.end());
    int ans=mod;
    for(int i=0;i<N-K+1;++i){
        ans=min(ans,h[i+K-1]-h[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <complex>
#include <fstream>
#include <cmath>

using namespace std;

int main(void){
    string atcoder;
    string s;
    string contest;
    cin >> atcoder >> s >> contest;
    cout << "A" << s[0] << "C" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
double D[80]; int d;

double pop_n(){
  return (D[--d]);}
void push_n(double a) {
  D[d]=a; d++;
}

int main() {
  char inbuf[99];
  while (gets(inbuf)) {
    char *tp = strtok(inbuf, " \n");
    while (tp != NULL) {
      double a,b;
      if ((tp[0] == '+') && (tp[1]==0)) {
        b = pop_n(); a = pop_n();
        push_n(a+b);
      }
      else if (tp[0] == '*') {
        b = pop_n(); a = pop_n();
        push_n(a*b);
      }
      else if ((tp[0] == '-') && (tp[1]==0)) {
        D[d-2]-=D[d-1];
        d--;
      }
      else if (tp[0] == '/') {
        D[d-2]=D[d-2]/D[d-1];
        d--;
      }
      else {
        D[d++]=atof(tp);
      }
      tp = strtok(NULL, " \n");
    }
    printf("%.6lf\n",pop_n());
  }
  return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
#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 RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define F first
#define S second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int Inf = 1e9;
const double EPS = 1e-9;



int main()
{
  vector<char> vec ;
  string s ;
  cin >> s ;
  int n = s.size() ;
  
  REP(i,n){
    if(s.at(i)=='1'){
      vec.push_back('1') ;
    }
    else if(s.at(i)=='0'){
      vec.push_back('0') ;
    }
    else{
      if(vec.size()!=0){
        vec.pop_back() ;
      }
    }
  }
  
 int m = vec.size() ;
  
  int i = 0 ;
  while(true){
    if(vec.at(i)!=' '){
      cout << vec.at(i) ;
      i++ ;
    }
    if(i==m){
      break ;
    }
  }

  return 0 ;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
#define pii pair<int, int>
#define fi first
#define se second
using namespace std;
typedef long long LL;
const int MAXN = 100005;

template <typename T> inline void read(T &AKNOI) {
    T x = 0, flag = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') flag = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    AKNOI = flag * x;
}

int n, p[MAXN];
pii a[MAXN], b[MAXN];

bool solve() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i].fi);
		a[i].se = i;
	}
	for (int i = 1; i <= n; ++i) {
		read(b[i].fi);
		b[i].se = i;
	}
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	
	for (int i = 1; i <= n; ++i) {
		if (a[i].fi > b[i].fi) return 0;
	}
	for (int i = 1; i < n; ++i) {
		if (a[i + 1].fi <= b[i].fi) return 1;
	}
	for (int i = 1; i <= n; ++i) {
		p[a[i].se] = b[i].se;
	}
	int u = p[1], len = 1;
	while (u != 1) {
		++len;
		u = p[u];
	}
	return (len < n);
}

int main() {
	puts(solve()? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		while(scan.hasNext()){
			long a = Long.parseLong(scan.next());
			long b = Long.parseLong(scan.next());
			long c = gcd(a,b);
			long d = a*b/c;
			System.out.println(c+" "+d);
		}
		System.exit(0);
	}
	static long gcd(long i ,long j){
		return j == 0 ? i : gcd(j, i % j);
	}
}

Measured memory_bytes: 12000
sx, sy, tx, ty = map(int, input().split())
y = abs(ty - sy)
x = abs(tx - sx)
r1 = y * 'U' + x * 'R'
r2 = y * 'D' + x * 'L'
r3 = 'L' + (y + 1) * 'U' + (x + 1) * 'R' + 'D'
r4 = 'R' + (y + 1) * 'D' + (x + 1) * 'L' + 'U'

print(r1 + r2 + r3 + r4)

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,a,b; cin>>n>>a>>b;
  ll rest=n%(a+b);
  cout<<(n/(a+b))*a+min(rest,a)<<endl;
}


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

int main(){
    ull A, B, K;
    cin >> A >> B >> K;
    if(A >= K) cout << A-K << " " << B << endl;
    else if(A < K && (A + B)>= K) cout << 0 << " " << B - (K-A) << endl;
    else cout << "0 0" << endl;
}

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

int main() {
    int N, sum;
    cin >> N;
    
    vector<string> S(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> S.at(i);
    }
    
    vector<int> count(N);
    for (int i = 0; i < N; i++) {
        if (S[i] == "G") {
            count[0]++;
        } else if (S[i] == "Y") {
            count[1]++;
        } else if (S[i] == "W") {
            count[2]++;
        } else if (S[i] == "P") {
            count[3]++;
        }
    }
    
    for (int i = 0; i < N; i++) {
        if (count[i] >= 2) {
            count[i] = 1;
        }
    }
    
    sum = 0;
    for (int i = 0; i < N; i++) {
        sum += count[i];
    }
    
    if (sum == 4) {
        cout << "Four" << endl;
    } else if (sum == 3) {
        cout << "Three" << endl;
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(0);
}

signed main(){
    init();
    run();
    return 0;
}

int n;
int ans;

void f(int m){
    if(m>n)return;
    int tmp=m;
    bool a=false,b=false,c=false;
    while(tmp){
        if(tmp%10==7)a=true;
        if(tmp%10==5)b=true;
        if(tmp%10==3)c=true;
        tmp/=10;
    }
    if(a&&b&&c)ans++;
    tmp=m*10;
    f(tmp+7);
    f(tmp+5);
    f(tmp+3);
}

void run(){
    cin>>n;
    f(0);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.14159265
int main()
{
    long double a, b, c;
    cin >> a >> b >> c;
    //long double aa = sqrt(a);
    //long double = sqrt(b);
    //long double cc = sqrt(c);
    long double ss = 1.0E-15;
    if(sqrt(a)+sqrt(b)+ss <  sqrt(c))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


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

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

typedef long long ll;

int main() {
    int n;cin>>n;
    
//    ll INF =100000007;
    ll a[n][n];
    ll b[n][n];
    ll c[n][n];
    ll d[n][n];
    rep(i,n){
        rep(j,n){
            cin>>a[i][j];
            b[i][j]=a[i][j];
            c[i][j]=0;
            d[i][j]=1;
        }
    }

    rep(k,n){
        rep(i,n){
            rep(j,n){
                b[i][j] = min(a[i][j], a[i][k] + a[k][j]);
                if(b[i][j]!=a[i][j]){
//                    cout<<i<<" "<<j<<" "<<b[i][j]<<endl;
                    cout<<-1<<endl;
                    return 0;
                }
                if(a[i][j] == a[i][k] + a[k][j]){
                    c[i][k]=a[i][k];
                    c[k][j]=a[k][j];
                    if(a[i][k] * a[k][j] !=0)d[i][j]=0;
                }
                
                }
            }
        }
    
    ll ans = 0;
    rep(i,n){
        rep(j,n){
            if(i>j)ans += c[i][j]*d[i][j];
        }
    }
    
    cout<<ans<<endl;
 	return 0;
}

Measured memory_bytes: 3200
h,w=map(int,input().split())

m=h//2
ans=0

if h==1 or w==1:
  print(1)
  exit()

num=w//2
ans+=num*h
if w%2==1:
  ans+=h-m
'''
for i in range(w):
  if i%2==0:
    ans+=h-m
  else:
    ans+=m
'''
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n =sc.nextInt();
			int x =sc.nextInt();
			int count = 0;
			if(n == 0 && x == 0)break;
			for(int i = 1; i <= n - 2; i++) {
				for(int j = i + 1; j <= n - 1; j++) {
					for(int k = j + 1; k <= n; k++) {
						if ( i + j + k == x) { count++; }
					}
				}
			}
			System.out.println(count);
		}
	}
}



Measured memory_bytes: 26632
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main()
{
    ll n;
    cin >> n;
    vector<vector<ll>> s(2, vector<ll>(n + 1));
    rep(i, 2)
    {
        rep(j, n)
        {
            cin >> s[i][j+1];
            s[i][j + 1] += s[i][j];
        }
    }

    ll max_num = 0;
    rep(i, n) {
        ll num = s[0][i+1] - s[1][i] + s[1][n];
        // cout << num << endl;
        max_num = max(max_num, num);
    }
    cout << max_num << endl;
    return 0;
}

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

const int mod = pow(10,9)+7;

int main() {
	
	int x, y;
	cin >> x >> y;
	int k=x+y;
	bool flg = 1;
	if(k%3!=0) flg=0;
	k/=3;
	if(x<k || y<k) flg=0;
	int d = x-k;
	int ans = 0;
	if(flg && (d!=0)){
		vector<long long> inv(d+1),finv(d+1),fac(d);
		inv.at(1)=1;
		finv.at(1)=1;
		fac.at(0) = k;
		for(int i=2; i<=d; i++) inv.at(i) = mod - inv.at(mod%i) * (mod/i) %mod;
		for(int i=2; i<=d; i++) finv.at(i) = finv.at(i-1) * inv.at(i) % mod;
		for(int i=1; i<d; i++) fac.at(i) = fac.at(i-1) * (k-i) % mod;
		ans = fac.at(d-1) * finv.at(d) % mod;
	}
	if(flg && (d==0)) ans = 1;
	cout << ans << endl;
	
}

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

using namespace std;

#define EPS 1e-10

struct point{
	double x;
	double y;
};

istream& operator >> ( istream& s , point& p );
double get_dot_product( const point& a , const point& b , const point& c , const point& d );

int main(void)
{
	point a, b, c, d;

	while(1)
	{
		cin >> a >> b >> c >> d;
		if( cin.eof() ) break;
		if( fabs( get_dot_product( a , b , c , d ) ) < EPS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

istream& operator >> ( istream& s , point& p )
{
	return s >> p.x >> p.y;
}

double get_dot_product( const point& a , const point& b , const point& c , const point& d )
{
	return (a.x - b.x)*(c.x - d.x) + (a.y - b.y)*(c.y - d.y);
}

Measured memory_bytes: 1216
import fractions
import math
A, B = map(int, input().split())
div_gcd = set()
gcd = fractions.gcd(A, B)
for i in range(1, math.ceil(math.sqrt(gcd))):
    if (gcd / i) % 1 == 0:
        div_gcd.add(i)
        div_gcd.add(gcd / i)
div_gcd.discard(1)
divlist = list(div_gcd)
divlist = sorted(divlist)
ansset = set()
for k in divlist:
    if len(ansset) == 0:
        ansset.add(k)
    else:
        flag = 1
        for j in ansset:
            if (k / j) % 1 == 0:
                flag = 0
                break
        if flag == 1:
            ansset.add(k)

ans = len(ansset)+1
print(ans)


Measured memory_bytes: 5856
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    cin>>n;
    vector<int> v(n);
    vector<int> p(n);
    vector<int> q(n);
    rep(i,n) v[i]=i+1;
    sort(v.begin(),v.end());
    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    int a,b;
    int now = 0;
    do{
        bool ok1 = 1;
        bool ok2 = 1;
        rep(i,n){
            if(v[i]!=p[i]) ok1 = 0;
            if(v[i]!=q[i]) ok2 = 0;
        }
        if(ok1) a = now;
        if(ok2) b = now;
        now++;
    }while(next_permutation(v.begin(),v.end()));
    //cout<<a<<" "<<b<<endl;
    cout<<abs(b-a)<<endl;
    return 0;
}

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

int main() {
  int x,y;
  cin >> x >> y;
  int count = 0;
  if(x==1) count += 300000;
  else if(x==2) count += 200000;
  else if(x==3) count += 100000;
  if(y==1) count += 300000;
  else if(y==2) count += 200000;
  else if(y==3) count += 100000;
  
  if(x==1&&y==1) count += 400000;
  
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

void print_int(int n)
{
    printf("%d\n",n);
}

void swap(int * a, int * b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

void sort(int a[], int n)
{
    for(int i = 1; i < n; i++)
    {
        int j = i-1;
        while(j >= 0 && a[j+1] > a[j])
        {
            swap(&a[j+1],&a[j]);
            j--;
        }
        
    }
    
}

int main(int argc, char * argv[])
{
    int count;
    scanf("%d", &count);
    int high[count];
    int result = 1;
    for(int i = 0; i < count; i++)
    {
        scanf("%d", &high[i]);
    }

    for(int i = 1; i < count; i++)
    {
        int j = i-1;
        while(j >= 0 && high[i] >= high[j])
        {
            j--;
        }

        if(j < 0)
        {
            result++;
        }
    }
    
    print_int(result);
    return 0;
}



Measured memory_bytes: 128
import math
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())


N=II()
res=INTMAX
for i in range(1, math.floor(math.sqrt(N))+1):
    if N % i == 0:
        res = min(res, i + (N // i) - 2)
print(res)


Measured memory_bytes: 3064
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
BC.sort(key=lambda x:x[1], reverse=True)

n=0
_A = []

for b,c in BC:
  if n>N:
    break
  _A += [c]*b
  n += b

D = _A + A
D.sort(reverse=True)
answer = sum(D[:N])
print(answer)

Measured memory_bytes: 36728
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    LL N, T;
    cin >> N >> T;
    LL s = -1e10;
    LL total = 0;
    REP(i, N)
    {
        LL t;
        cin >> t;
        LL diff = t - s;
        total += min(T, t - s);
        s = t;
    }
    cout << total << endl;
    return 0;
}


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N; cin >> N;
    map<string, int> mp;
    REP(i, N) {
        string tmp; cin >> tmp;
        mp[tmp]++;
    }

    int ma_value = 0;
    for(auto x: mp) {
        ma_value = max(x.second, ma_value);
    }
    for (auto x: mp) {
        if (x.second == ma_value) {
            cout << x.first << endl;
        }
    }
    
    return 0;
}


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

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

 int main(){
  int n, m;

  cin >> n >> m;
  int a[51],b[51];

  rep(i,m+1) cin >> a[i] >> b[i];

 int ansA[n],ansB[n];

  rep(i,n+1){

   ansA[i]= 0;
   rep(k,m+1){
    if(a[k] != i) continue;
    else ansA[i]++;
    }

    ansB[i]= 0;
    rep(k,m+1){
     if(b[k] != i) continue;
    else ansB[i]++;
    }
   }

   rep(i,n+1){ 
    cout << (ansA[i]) + (ansB[i]) << endl;
   }


 return 0;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;

lint ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	string s; cin>>s;
	REP(i,s.length()) s[i]='x';
	cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   string s;
   cin>>n>>s;
   int sw[1000000],se[1000000];
   sw[0]=0,se[0]=0;
   for (int i = 1; i <= n; i++)
   {
       /* code */
       if (s[i-1]=='E')
       {
           /* code */
           se[i]=se[i-1]+1;
           sw[i]=sw[i-1];
       }
       else
       {
            sw[i]=sw[i-1]+1;
            se[i]=se[i-1];
       }
   }
   long ans1=0,ans2=1000000000;
   for (int i = 1; i <= n; i++)
   {
       ans1=sw[i-1]+se[n]-se[i];
       ans2=min(ans1,ans2);
   }
   
   cout<<ans2<<endl;
    
}

Measured memory_bytes: 7684
import java.lang.*;
import java.util.*;
import java.io.*;

public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String line;
		StringTokenizer tokenizer1,tokenizer2;
		int a[] = new int[4];
		int b[] = new int[4];
		
		while ((line = input.readLine()) != null && !line.isEmpty()) {
			int blow=0,hit=0;
			tokenizer1 = new StringTokenizer(line);
			tokenizer2 = new StringTokenizer(input.readLine());
			for(int i=0;i<4;i++){
				a[i]=Integer.parseInt(tokenizer1.nextToken());
				b[i]=Integer.parseInt(tokenizer2.nextToken());
			}
			for(int j=0;j<4;j++){
				for(int k=0;k<4;k++){
					if(a[j]==b[k]){
						if(j==k){
							hit++;
						}else{
							blow++;
						}
					}
				}
			}
			System.out.println(hit+" "+blow);
		}
	}
}	

Measured memory_bytes: 16868
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
ll dpe[300010];
ll dpw[300010];
ll N;
string S;
/*==================================================*/
/*function*/

/*==================================================*/

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

    REP(i,0,N){
        if(S[i] == 'E') dpe[i+1]++;
        else dpw[i+1]++;
    }

    REP(i,2,N+1){
        dpe[i] += dpe[i-1];
        dpw[i] += dpw[i-1];
    }

    ll ans = LLINF;
    REP(i,1,N+1){
        ll cnt = dpw[i-1] + (dpe[N] - dpe[i]);
        ans = min(ans, cnt);
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 5380
import java.util.*;
public class Main {
    public static void main(String[] args) {
        /* 入力 */
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //aひとつひとつは10**9以下だが、足し合わせるとintの最大値を超えてしまうので、a自体longで宣言しておく
        long a[] = new long[N];
        for (int i = 0; i<N; i++) {
            a[i] = sc.nextLong();
        }
        /* 
        DP配列宣言 dp[i][1] = dp[i][+], dp[i][0] = dp[i][-] と定義する。
        dp[i]は、a[i]までの部分列に対する答えを表し、dp[0]は定義しない（使わない）ことにする。
         */
        long dp[][] = new long[N][2];
        //dp[1]を初期化する。
        if (a[1] >= 0) {
            dp[1][1] = a[0] + a[1];
            dp[1][0] = -(a[0] + a[1]);
        } else {
            dp[1][1] = -(a[0] + a[1]);
            dp[1][0] = a[0] + a[1];
        }
        //dp[2]以降を漸化式で求める。
        for (int i = 2; i < N; i++) {
            if (a[i] >= 0) {
                dp[i][1] = Math.max(dp[i-1][1] + a[i], dp[i-1][0] + a[i]);
                dp[i][0] = Math.max(dp[i-1][1] - 2*Math.abs(a[i-1]) - a[i],
                dp[i-1][0] + 2*Math.abs(a[i-1]) - a[i]);
            } else {
                dp[i][1] = Math.max(dp[i-1][1] - 2*Math.abs(a[i-1]) + Math.abs(a[i]),
                dp[i-1][0] + 2*Math.abs(a[i-1]) + Math.abs(a[i]));
                dp[i][0] = Math.max(dp[i-1][1] + a[i], dp[i-1][0] + a[i]);
            }
        }
        //最終的な解は、元の数列a全体を使って、右端が+になる最適解と、右端が-になる最適解のうちの、より大きいほう。
        long answer = Math.max(dp[N-1][1],dp[N-1][0]);
        System.out.println(answer);
    }
}

Measured memory_bytes: 60696
using System;
using System.Linq;

class C
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var s = new int[h[1]].Select(_ => Console.ReadLine().Split()).ToArray();
		var set = s.Where(x => x[1] == "AC").Select(x => x[0]).Distinct().ToHashSet();
		var sum = s.Where(x => set.Contains(x[0])).GroupBy(x => x[0], x => x[1]).Sum(g => g.TakeWhile(x => x == "WA").Count());
		Console.WriteLine($"{set.Count} {sum}");
	}
}


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

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


int main(){
    int n ;
    cin >> n ;
    vector<int64_t> a(n) ;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    int ans = 0 ;
    for (int i = 0; i < n; i++)
    {
        for (int j = i+1; j < n; j++)
        {
            for (int k = j+1; k < n; k++)
            {
                if (a.at(i) != a.at(j) && a.at(j) != a.at(k) && a.at(k) != a.at(i))
                {
                    bool ju = 1 ;
                    if (a.at(i) + a.at (j) <= a.at(k))
                    {
                        ju = 0 ;
                    }
                    if (a.at(j) + a.at (k) <= a.at(i))
                    {
                        ju = 0 ;
                    }
                    if (a.at(k) + a.at (i) <= a.at(j))
                    {
                        ju = 0 ;
                    }
                    ans += ju ;
                }
                
            }
            
        }
        
    }
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
	int N;
	int a[20][20];
	ll sa[1 << 16];
	ll dp[1 << 16];

	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> a[i][j];
		}
	}

	for (int mask = 0; mask < (1 << N); mask++) {
		for (int x = 0; x < N; x++) {
			for (int y = 0; y < x; y++) {
				if((mask & (1 << x)) && (mask & (1 << y))) {
					sa[mask] += a[x][y];
				}
			}
		}
		dp[mask] = -1LL << 60;
	}

	dp[0] = 0;
	for (int mask = 0; mask < (1 << N) - 1; mask++) {
		int first;
		for (first = 0; first < N; first++) {
			if ((mask & (1 << first)) == 0) {
				break;
			}
		}
		int submask = ((1 << N) - 1) ^ mask ^ (1 << first);
		for (int sm2 = submask; sm2 >= 0; sm2--) {
			sm2 &= submask;
			dp[mask | sm2 | (1 << first)] = max(dp[mask | sm2 | (1 << first)], dp[mask] + sa[sm2 | (1 << first)]);
		}
	}

	cout << dp[(1 << N) - 1] << endl;

	return 0;
}

Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

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

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

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 30;
const int N = (int)3e5 + 7;
const int MAXN = (int)3e6 + 7;
const int MOD = (int)998244353;
const int INF = (int)1e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e17;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////

void solve() {
	string s, t;
	cin >> s >> t;
	t.pop_back();
	cout << (s == t ? "Yes" : "No");
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif

	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 3680
import std.stdio, std.conv,std.string;

void main()
{
    while(true)
    {
        int sum=readln.chomp.to!int;
        if(sum==0)break;
        foreach(unused;0..9)
        {
            sum-=readln.chomp.to!int;
        }
        sum.writeln;
    }
}

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

int main(int argc, const char * argv[]) {
    int n;
    int i;
    string str1, str2;
    int point1, point2;

    cin >> n;
    
    point1=0;
    point2=0;
    
    for(i=0;i<n;i++){
        cin >> str1 >> str2;
        if(str1<str2){
            point2+=3;
        }else if(str1>str2){
            point1+=3;
        }else if(str1==str2){
            point1+=1;
            point2+=1;
        }
    }
    
    cout << point1 << " " << point2 << endl;
    
    return 0;
}


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

int main()
{
    double num[50];
    int N;
    int i, j, tmp,k;
	double Ans;
	k=1;
	
    cin >> N;
    for( i=0 ; i<N ; i=i+1 )
    {
        cin >> num[i];
    }

    for( i=0 ; i<N ; i=i+1 )
    {
        for( j=i+1 ; j<N ; j=j+1 )
        {
            if( num[i] > num[j] )
            {
                tmp = num[i];
                num[i] = num[j];
                num[j] = tmp;
            }
        }
    }
	Ans=num[0];
	while (k<N){
		Ans=(Ans+num[k])/2;
		k+=1;
	}
	cout << Ans;
    return 0;
}

Measured memory_bytes: 256
s  = input()

flag=1
if s[0] != "A":
    flag=0
    
if s[2:-1].count("C") !=1:
#     print(s[2:-1])
    flag = 0
    
b =[]
for _ in s:
    if _ not in ["A", "C"]:
        b.append(_)
    
c = "".join(b)
if c !=  c.lower():
    flag = 0
    
if flag==1:
    print("AC")
else:
    print("WA")

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

using namespace std;

typedef unsigned long long int ull;

int main() 
{
    int n, x, y, i;
    scanf("%d", &n);
    
    bitset<64> B(0);
    
    for(i = 0; i < n; i++)
    {
        scanf("%d", &x);
        
        switch(x)
        {
            case 0:
                scanf("%d", &y);
                printf("%d\n", B.test(y));
                break;
            case 1:
                scanf("%d", &y);
                B.set(y);
                break;
            case 2:
                scanf("%d", &y);
                B.reset(y);
                break;
            case 3:
                scanf("%d", &y);
                B.flip(y);
                break;
            case 4:
                printf("%d\n", B.all());
                break;
            case 5:
                printf("%d\n", B.any());
                break;
            case 6:
                printf("%d\n", B.none());
                break;
            case 7:
                printf("%d\n", B.count());
                break;
            case 8:
                printf("%llu\n", B.to_ulong());
                break;
        }
    }
    
    return 0;
}


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

ll solve() {
    ll N;
    cin >> N;
    ll ans = 0;
    vector<ll> A(N), B(N), C(N);
    for ( int i = 0; i < N; i++ ) cin >> A[i];
    for ( int i = 0; i < N; i++ ) cin >> B[i];
    for ( int i = 0; i < N-1; i++ ) cin >> C[i];
    for ( int i = 0; i < N; i++ ) {
        A[i]--;
        ans += B[i];
    }
    for ( int i = 0; i < N-1; i++ ) {
        if ( A[i+1] - A[i] == 1 ) ans += C[A[i]];
    }

    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    char c;
    int ans[26] = {}, i;

    while(scanf("%c", &c) != EOF) {
        if('a' <= c && c <= 'z') ans[c - 'a']++;
        else if('A' <= c && c <= 'Z') ans[c - 'A']++;
    }

    for(i = 0; i < 26; i++) {
        printf("%c : %d\n", 'a' + i, ans[i]);
    }
}



Measured memory_bytes: 2100