akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll cnt[4]={};
	ll n;
	cin>>n;
	string a[4]={"AC","WA","TLE","RE"};
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		for(int i=0;i<4;i++)if(s==a[i])cnt[i]++;
	}
	for(int i=0;i<4;i++){
		cout<<a[i]<<" x "<<cnt[i]<<endl;
	}
	return 0;
}

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

int main() {
	long long X, K, D;
	cin >> X >> K >> D;
	X = abs(X);
	if (X/D >= K) cout << (X - K * D) << endl;
	else {
		K -= X / D;
		X %= D;
		if (K % 2 == 1) X = D - X;
		cout << X << endl;
	}
}




Measured memory_bytes: 3648
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n = I()
    s = [input() for i in range(n)]
    print('AC x ' + str(s.count('AC')))
    print('WA x ' + str(s.count('WA')))
    print('TLE x ' + str(s.count('TLE')))
    print('RE x ' + str(s.count('RE')))
    return


if __name__ == "__main__":
    solve()


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

int main() {

	ll n, a, b; cin >> n >> a >> b;
	ll c = a + b;
	ll quo = n / c;
	ll mod = n % c;
	ll ans;
	if (mod == 0) {
		ans = quo * a;
	}
	else if (mod <= a) {
		ans = quo * a + mod;
	}
	else {
		ans =  (quo)*a+a;
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define sonic ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define fi first
#define se second
#define pb push_back
using namespace std;

const ll INF=1e18;
const int N=1e5+17;

void solve(){
	ll x,y,a,b;
	cin>>x>>y>>a>>b;
	cout<<max(max(x*a,x*b),max(y*a,y*b));
}

int main(){
	sonic
	int TEST=1;
	//cin>>TEST;
	while(TEST--){
		solve();
		cout<<'\n';
	}
}


Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <math.h>

#define ll long long
#define ull unsigned long long

using namespace std;

const int inf = 1000000000;
const double eps = 1e-7;

void solve() {
	int n;
	cin >> n;
	
	vector<int> ans(n);
	for (int i = 1; i < n; ++i) {
		int a;
		cin >> a;
		++ans[a - 1];
	}
	
	for (int i = 0; i < n; ++i)
		cout << ans[i] << endl;
}

int main() {
	int t = 1;
	//cin >> t;
	for (int i = 0; i < t; ++i)
		solve();
	return 0;
}

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

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

    int n;
    cin >> n;
    string s;
    cin >> s;

    unordered_map<char, int> mp1, mp2;

    int ans = -1e9;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < i; j++){
            mp1[s[j]]++;
        }
        for(int j = i; j < n; j++){
            mp2[s[j]]++;            
        }
        int cnt = 0;
        for(auto x : mp1){
            cnt += bool(mp2[x.first]);
        }
        ans = max(ans, cnt);
        mp1.clear();
        mp2.clear();
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import math

x1, y1, x2, y2 = map(int, input().split())

x_vec = x2 - x1
y_vex = y2 - y1

vec = [x_vec, y_vex]
p2 = [x2, y2]

p3 = [p2[0] + int(math.cos(math.pi / 2)) * vec[0] -int(math.sin(math.pi / 2)) * vec[1], 
         p2[1] + int(math.sin(math.pi / 2))* vec[0] + int(math.cos(math.pi / 2)) * vec[1]]
p4 = [p3[0] +int(math.cos(math.pi)) * vec[0] -int(math.sin(math.pi)) * vec[1], 
         p3[1] + int(math.sin(math.pi))* vec[0] + int(math.cos(math.pi)) * vec[1]]
print(p3[0], p3[1], p4[0], p4[1])

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
typedef long long int ll;
int main(void){
	int a, x; cin >> a >> x;
	for (int i = x - a + 1; i <= x + a - 1; i++) {
		cout << i;
		if (i != x + a - 1)cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	int k;
	cin >> k;
	int n = 7 % k;
	for (int i = 1; i <= k; i++) {
		if (n == 0) {
			cout << i;
			return 0;
		}
		n = (n * 10 + 7) % k;
	}
	cout << -1;
	return 0;
}

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

using namespace std;

bool c(int x, int M, vector<int> &a)
{
    int N = a.size();
    int cnt = 0, sum = 0;
    for (int i = 0; i < N; ) {
        if (a[i] > x) return 0;

        while (i < N && sum < x) {
            sum += a[i++];            
        }
        if (sum > x) {
            i--;
        }                 
        cnt++;
        sum = 0;
    }
    return (cnt <= M);
}

int main()
{
    int M, N;
    while (cin >> M >> N, M) {
        vector<int> a(N);
        for (int i = 0; i < N; i++) {
            cin >> a[i];
        }
        int l = 0, r = 1e9;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (c(mid, M, a)) {
                r = mid;
            } else {
                l = mid;
            }
        }
        cout << r << endl;
    }
    return 0;
}

Measured memory_bytes: 3076
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<char, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
char c[4010];
int a[4010];

int dp[2010][2010];
unordered_map<P, int, pairhash> pos;

int cntw[2010][2010];
int cntb[2010][2010];

int calc(int u, int v) {
    if (u == n && v == n) return 0;
    if (dp[u][v] < 0) {
        int uc = inf, vc = inf;
        if (u < n) {
            uc = calc(u+1, v) + cntw[u+1][v];
        }
        if (v < n) {
            vc = calc(u, v+1) + cntb[v+1][u];
        }
        dp[u][v] = min(uc, vc);
    }
    return dp[u][v];
}

int solve() {
    for (int i = 0; i < 2*n; i++) {
        pos[make_pair(c[i], a[i])] = i;
    }
    
    for (int i = 0; i < 2*n; i++) {
        int fix = 0;
        for (int j = 0; j < i; j++) {
            if (c[i] == c[j] && a[i] > a[j]) {
                fix++;
            }
        }
        if (c[i] == 'W') {
            cntw[a[i]][0] = i - fix;
            for (int j = 1; j <= n; j++) {
                cntw[a[i]][j] = cntw[a[i]][j-1];
                if (i > pos[make_pair('B', j)]) {
                    cntw[a[i]][j]--;
                }
            }
        } else {
            cntb[a[i]][0] = i - fix;
            for (int j = 1; j <= n; j++) {
                cntb[a[i]][j] = cntb[a[i]][j-1];
                if (i > pos[make_pair('W', j)]) {
                    cntb[a[i]][j]--;
                }
            }
        }
    }
    
    memset(dp, -1, sizeof(dp));

    return calc(0, 0);
}

void input() {
    cin >> n;
    for (int i = 0; i < 2*n; i++) cin >> c[i] >> a[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 51360
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
using namespace std;
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<int,int>

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

    int n;
    cin>>n;
    int f=0;
    for(int i=0;4*i<=n;++i)
    {
        ll ch=n-4*i;
        if((ch*1.0)/7==int((ch*1.0)/7))
        {
            f=1;
        }
    }
    if(f)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }

return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N; cin >> N;
  string S, T; cin >> S >> T;

  rep(i, N) cout << S[i] << T[i];
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    int a=0,b=0,c=0;
    int j=0;
    scanf("%d %d %d",&a,&b,&c);
 
    if(a+b==c||a+c==b||b+c==a)j=1;
 
    if(j==1)printf("Yes\n");
    else printf("No\n");
 
    return 0;
}

Measured memory_bytes: 128
while True:
    answer=''
    H,W=(int(x) for x in input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        if i%2==0:
            for j in range(W):
                if j%2==0:
                    answer+='#'
                else:
                    answer+='.'
        else:
            for j in range(W):
                if j%2==0:
                    answer+='.'
                else:
                    answer+='#'
        answer+='\n'
    print(answer)


Measured memory_bytes: 5640
import sys
input = sys.stdin.readline
h,w=map(int,input().split())
if h%3==0 or w%3==0:
    print(0)
    exit()
mn=float("inf")
for i in range(1,h):
    a=w*(h-i)
    b=i*-(-w//2)
    c=i*(w//2)
    dai=max(a,b,c)
    syo=min(a,b,c)
    #print(a,b,c,i)
    mn=min(mn,dai-syo)
for i in range(1,w):
    a=h*(w-i)
    b=i*-(-h//2)
    c=i*(h//2)
    dai=max(a,b,c)
    syo=min(a,b,c)
    #print(a,b,c,i)
    mn=min(mn,dai-syo)
mn=min(mn,h,w)
print(mn)


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

int main(){
  string s;
  cin>>s;
  if(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi"){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}
  

Measured memory_bytes: 256
/*
  #問題：
  


  #分析：
  #オブジェクト：
  
  #条件：
  

  #要求：
  

  #解法：
  
*/

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
#include <initializer_list>
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


const unsigned int BIT_FLAG_0 = (1<<0);
const unsigned int BIT_FLAG_1 = (1<<1);
const unsigned int BIT_FLAG_2 = (1<<2);
const unsigned int BIT_FLAG_3 = (1<<3);
const unsigned int BIT_FLAG_4 = (1<<4);
const unsigned int BIT_FLAG_5 = (1<<5);
const unsigned int BIT_FLAG_6 = (1<<6);
const unsigned int BIT_FLAG_7 = (1<<7);


#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

using Bint = mp::cpp_int;

int in_atcoder(char c){
  if(c=='A'||c=='T'||c=='C'||c=='G') return 1;
  else return 0;
}

int main(void){
  string S;
  cin>>S;

  int cnt=0,max=0;
  int continue_flag=0;
  
  FOR(i,0,S.length() ){
    if( in_atcoder(S[i]) == 1 ) {   // 走査していてATCG文字列を読み込んだとき
      if(continue_flag==1){     // ATCG文字が連続してたとき
        cnt++;
        if(cnt>=max){ max=cnt;}
        else {}
      }else{                    // ATCG文字，部分列で一つ目のとき
        cnt++; if(cnt>=max){max=cnt;}
        continue_flag=1;
      }
    }else{                          //走査していてATCG文字以外の文字を読み込んだとき 
      continue_flag=0;
      cnt=0;
    }
  }

  cout<<max<<endl;
  return 0;
}



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

const int INF = 10000000;
int c[10][1005];

int main() {
	int h,w,k;
	int ans = INF;
	cin >> h >> w >> k;
	vector<string> s(h);
	rep(i,h) cin >> s[i];
	rep(div,1<<(h-1)) {
		int g = 0;
		vector<int> id(h);
		rep(i,h) {
			id[i] = g;
			if (div>>i&1) ++g;
		}
		++g;
		rep(i,g)rep(j,w) c[i][j] = 0;
		rep(i,h)rep(j,w) c[id[i]][j] += (s[i][j] - '0');

		int num = g-1;
		vector<int> now(g);
		auto add = [&](int j) {
			rep(i,g) now[i] += c[i][j];
			rep(i,g) if (now[i] > k) return false;
			return true;
		};
		rep(j,w) {
			if(!add(j)) {
				num++;
				now = vector<int>(g);
				if (!add(j)) {
					num = INF;
					break;
				}
			}
		}
		ans = min(ans, num);
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

namespace FFT {
  const double PI = acos(double(-1));
  using cmplx = complex<double>;

  unsigned bitreverse32(unsigned x) {
    x = ((x & 0x55555555) << 1) | ((x >> 1) & 0x55555555);
    x = ((x & 0x33333333) << 2) | ((x >> 2) & 0x33333333);
    x = ((x & 0x0F0F0F0F) << 4) | ((x >> 4) & 0x0F0F0F0F);
    x = (x << 24) | ((x & 0xFF00) << 8) | ((x >> 8) & 0xFF00) | (x >> 24);
    return x;
  }
  void fft(vector<cmplx> &A, int k){
    if (k == 0) return;
    for (int i = 1; i < (1<<k); ++i) { 
      int ind = bitreverse32(i) >> (32-k);
      if (ind > i) {
        std::swap(A[i], A[ind]);
      }  
    }
    for (int i = 1; i <= k; ++i) { //N = (1<<i)
      for (int j = 0; j < (1<<(k-i)); ++j) { 
        for (int l = 0; l < (1<<(i-1)); ++l) { //l = 0,1...N/2-1
          cmplx temp = A[(1<<i)*j + l];
          cmplx temp1 = A[(1<<i)*j + l + (1<<(i-1))];
          A[(1<<i)*j + l] = temp + temp1 * polar(1.0, -2.0*PI*l/(1<<i));
          A[(1<<i)*j + l + (1<<(i-1))] = temp - temp1 * polar(1.0, -2.0*PI*l/(1<<i));
        }
      }
    }
  }
  vector<ll> convolve(const vector<int>& A, const vector<int>& B){
    int siz = A.size() + B.size() - 1;
    int k = 0;
    while (siz >= (1<<k)) k++;
    vector<cmplx> CA(1<<k,0), CB(1<<k,0);
    for (int i = 0; i < (int)A.size(); ++i) CA[i] = A[i];
    for (int i = 0; i < (int)B.size(); ++i) CB[i] = B[i];
    fft(CA, k);
    fft(CB, k);
    vector<cmplx> CC(1<<k);
    for (int i = 0; i < (1<<k); ++i) { //逆変換
      CC[i] = conj(CA[i] * CB[i]);
    }
    fft(CC, k);
    vector<ll> C(siz);
    for (int i = 0; i < siz; ++i) {
      C[i] = (ll)((real(conj(CC[i])) / (1<<k)) + 0.5);
    }
    return C;
  }
};

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n,m;
  cin >> n >> m;
  vector<int> f(100005, 0);
  rep(i,n) {
    int a;
    cin >> a;
    f[a]++;
  }
  auto c = FFT::convolve(f,f);
  ll ans = 0, cnt = m;
  for (ll x = 2*100000; x >= 0; --x) {
    if (c[x] > 0) {
      if (cnt - c[x] >= 0) {
        ans += x * c[x];
        cnt -= c[x];
      }
      else {
        ans += x * cnt;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define out(a) debg(a);
#define aout(a) for(auto&e:a)cout<<e<<" ";
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
// template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
#define popcount __builtin_popcount
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}




int main(){
    long long K;
    scanf("%lld",&K);
    string ret = "";
    for (long long i = 0; i < K; i++) {
        ret += "ACL";
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

long long MOD = 1e9+7;
int MAX_INT = 1e9;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int M_1, D_1, M_2, D_2;
  cin >> M_1 >> D_1 >> M_2 >> D_2;
  cout << (M_1 == M_2 ? 0 : 1) << endl;

  return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>

int main(void){
    int n,q,i,j,count,t;
    int s[10000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    scanf("%d",&q);
    count = 0;
    for(i=0;i<q;i++){
        scanf("%d",&t);
        for(j=0;j<n;j++){
            if(s[j]==t){
                count++;
                break;
            }
        }
    }
    printf("%d\n",count);
}



Measured memory_bytes: 2092
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;

void MAIN() {
    scanf("%d", &N);
    printf("%d\n", (N-2)*180);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
 
#define REP(i,n) for(i=0;i<(n);++i)
#define FOR(i,l,h) for(i=(l);i<=(h);++i)
#define FORD(i,h,l) for(i=(h);i>=(l);--i)
 
#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    map<string , ll int> mp;
    ll int n;
    cin>>n;
    string s[n+2];
    for(ll int i=0;i<n;i++){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
        mp[s[i]]++;
    }
    ll int sum =0,k;
    map<string ,ll int>:: iterator it ;
    for(it = mp.begin();it!=mp.end();it++){
         k = it->second;
         sum += k*(k-1)/2;
    }
    cout<<sum;
    return 0;
}

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

int main(){
	int n,i;
	deque<int> b;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		int x;
		scanf("%d",&x);
		if(i%2==0)b.push_back(x);
		else b.push_front(x);
	}
	if(n%2==0)for(i=0;i<n;i++){
		printf("%d ",b[i]);
	}
	else for(i=n-1;i>=0;i--)printf("%d ",b[i]);
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) ((int) x.size())
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;


int main() {sws;

    int x;
    cin >> x;

    vi kyu = {599, 799, 999, 1199, 1399, 1599, 1799, 1999};

    auto it = lower_bound(all(kyu), x);

    cout << 8 - (it - kyu.begin()) << endl;

    return 0;
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var a string
	fmt.Scan(&a)
	d := a[0:4] + a[5:7] + a[8:10]
	if d <= "20190430" {
		fmt.Println("Heisei")
		return
	}
	fmt.Println("TBD")
}


Measured memory_bytes: 512
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const S = stdin.split('\n')[0].split('').map(Number)

let blueCnt = redCnt = 0

S.forEach((e,i)=>{
  if(e === 1) blueCnt++
  if(e === 0) redCnt++
})

const min = Math.min(blueCnt, redCnt)

if(min === 0){
  console.log(0)
} else {
  console.log(min*2)
}

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

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


int main() {
    int n;
    double sum = 0.0;
    cin >> n;
    vector<double>v(n);
    rep(i, n)cin >> v[i];
    sort(all(v));
    sum =( v[0] + v[1] ) / 2;
    for (int i = 2; i < n;i++) {
        sum = (sum + v[i]) / 2;
    }
    cout << fixed << setprecision(8) << sum << endl;
    return 0;
}

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

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

	int N, M; ll pt[1000][3];
	cin >> N >> M;
	REP(i, N) REP(j, 3) cin >> pt[i][j];

	ll MAX = -1145141919810931931;
	REP(i, 8){
		ll sum[1000] = {0};
		REP(j, N){
			int bit = i;
			REP(k, 3){
				if(bit % 2) sum[j] += pt[j][k];
				else sum[j] -= pt[j][k];
				bit /= 2;
			}
		}
		sort(sum, sum+N, greater<ll>());
		ll tmp = 0;
		REP(j, M) tmp += sum[j];
		MAX = max(MAX, tmp);
	}
	cout << MAX << endl;

	return 0;
}


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

int A[1000];
int N;

void Show(int A[], int N) {
	for (int i = 0; i < N; ++i) {
		if (i) {
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;
}

void insertionSort(int A[], int N, int i, int j) {
	int v = A[i];
	while (j >= 0  && A[j] > v) {
		A[j + 1] = A[j];
		--j;
	}
		A[j + 1] = v;
	
}


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

	Show(A, N);
	for (int i = 1; i < N; ++i) {
		j = i - 1;
		insertionSort(A, N, i, j);
		Show(A, N);
	}

}


Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC146A
{
	class Program
	{
		static void Main(string[] args)
		{
	     string a;
			int b;
			a = Console.ReadLine();
			b = 0;
			if (a == "SUN")
				b = 7;
			if (a == "MON")
				b = 6;
			if (a == "TUE")
				b = 5;
			if (a == "WED")
				b = 4;
			if (a == "THU")
				b = 3;
			if (a == "FRI")
				b = 2;
			if (a == "SAT")
				b = 1;

			Console.WriteLine(b);
		


		}
	}
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int XYZ[3];
int K;
int ABC[3][1005];

vector<int> v1;
vector<int> v2;

signed main()
{
  REP(i,3) {
    cin >> XYZ[i];
  }
  cin >> K;
  REP(i,3) {
    REP(j,XYZ[i]) {
      cin >> ABC[i][j];
    }
  }

  REP(i,XYZ[0]) {
    REP(j,XYZ[1]) {
      v1.emplace_back(ABC[0][i] + ABC[1][j]);
    }
  }

  sort(begin(v1), end(v1), greater<int>());

  REP(i,min(K, (int)v1.size())) {
    REP(j,XYZ[2]) {
      v2.emplace_back(ABC[2][j] + v1[i]);
    }
  }

  sort(begin(v2), end(v2), greater<int>());

  REP(i,K) {
    cout << v2[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 43364
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
int f[4];
char a[3];
bool flag=true;
void dfs(int t,int p)
{
    if (flag)
        if (p==4)
        {
            if (t==7)
            {
                cout<<f[0]<<a[0]<<f[1]<<a[1]<<f[2]<<a[2]<<f[3]<<"=7";
                flag=false;
            }
        }
        else
        {
            a[p-1]='+';
            dfs(t+f[p],p+1);
            a[p-1]='-';
            dfs(t-f[p],p+1);
        }
}
int main()
{
    for (int i=0; i<=3; ++i)
        scanf("%1d",&f[i]);
    dfs(f[0],1);
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.stream.LongStream;

public class Main {
  Scanner sc = new Scanner(System.in);

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

  class Point implements Comparable<Point> {
    int x;
    int y;

    Point(int a, int b) {
      x = a;
      y = b;
    }

    @Override
    public int compareTo(Point o) {
      if (o.x == x) {
        return y - o.y;
      } else {
        return x - o.x;
      }
    }

    @Override
    public int hashCode() {
      return Integer.hashCode(x) ^ Integer.hashCode(y);
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o.getClass() != this.getClass()) {
        return false;
      }
      Point p = (Point) o;
      if (x == p.x) if (y == p.y) return true;
      return false;
    }
  }

  void run() {
    int h = ni();
    int w = ni();
    int n = ni();
    HashMap<Point, Integer> map = new HashMap<>();
    for (int i = 0; i < n; ++i) {
      int a = ni();
      int b = ni();
      for (int x = 0; x < 3; ++x) {
        for (int y = 0; y < 3; ++y) {
          int ny = a - y;
          int nx = b - x;
          if (nx < 1 || w - 2 < nx || ny < 1 || h - 2 < ny) {
            continue;
          }
          Point p = new Point(nx, ny);
          if (map.containsKey(p)) {
            map.put(p, map.get(p) + 1);
          } else {
            map.put(p, 1);
          }
        }
      }
    }
    long cnt = 0;
    long[] ans = new long[10];
    for (Point ite : map.keySet()) {
//      debug(ite.x, ite.y, map.get(ite));
      int sub = map.get(ite);
      ++cnt;
      ++ans[sub];
    }
    ans[0] = (long) (w - 2) * (long) (h - 2) - cnt;
    LongStream.of(ans).forEach(System.out::println);
  }

  int ni() {
    return Integer.parseInt(sc.next());
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

Measured memory_bytes: 166012
#include <iostream>

int main(){
    int G[]={-1,1,3,1,2,1,2,1,1,2,1,2,1};
    int x,y;
    std::cin>>x>>y;
    if(G[x]==G[y]) std::cout<<"Yes";
    else std::cout<<"No";
    std::cout<<std::endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, k;
	char str[11];
	scanf("%d%*c%s%*c%d%*c", &n, str, &k);
	char tmp = str[k-1];
	int i;
	for(i=0;i<n;i++) {
		if(str[i] != tmp) str[i] = '*';
	}
	printf("%s", str);
	
	return 0;
}


Measured memory_bytes: 128
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
using namespace std;

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

    bool ok = true;

    if (s[0] != 'A') {
        ok = false;
        cout << "WA" << endl;
        return 0;
    }

    int num = 0;
    int key;
    for (int i = 2; i < s.size() - 1; i++) {
        if (s[i] == 'C') {
            num++;
            key = i;
        }

    }
    if (num != 1) {
        ok = false;
        cout << "WA" << endl;
        return 0;
    }

    for (int i = 1; i < s.size(); i++) {
        if (i == key)continue;

        if (s[i] >= 'a' && s[i] <= 'z') {
            
        }
        else {
            ok = false;
            cout << "WA" << endl;
            return 0;
        }
    }

    cout << "AC" << endl;


}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3628
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>

using namespace std;
typedef long long ll;
const ll MAXN = 45;

int main(){
    int n; cin >> n;
    string s; cin >> s;
    if(n >= 3200){
        cout << s << endl;
    }
    else{
        cout << "red" << endl;
    }
    return 0;
}

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

using namespace std;


int main(){
  double L;
  cin >> L;
  
  double l = L/3.0;
  cout << fixed << pow(l,3) << endl;

  return 0;
}

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

using namespace std;

const int N = 200000;

int aa[N];

int main() {
	int k, n; cin >> k >> n;
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	int ans = aa[n - 1] - aa[0];
	for (int i = 1; i < n; i++)
		ans = min(ans, aa[i - 1] + k - aa[i]);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
#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;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)

const int L=102;
ll w[L], v[L], dp[L][100002], n, W;
ll solve(int i, int wt)
{
	if(i > n)return 0;
	if(dp[i][wt] != 0)return dp[i][wt];
	if(w[i] > wt)return dp[i][wt] = solve(i+1,wt);
	return dp[i][wt] = max(solve(i+1, wt), solve(i+1, wt- w[i]) + v[i]);
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	cin >> n >> W;
	 	FOR(i,1,n+1)cin >> w[i] >> v[i];
		cout<<solve(0, W);
		return 0;
}

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

int main(void){
  int a,b,c,d;
  
  cin >> a >> b >> c >> d;
//  cout << ((c+b-1)/b) << " " << ((a+d-1)/d) << endl;
  cout << ((c+b-1)/b<=(a+d-1)/d?"Yes":"No") << endl;
  
  return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,x,y;
    cin>>n;
    int a[n][3];
    for(int i=0;i<n;i++)
        for(int j=0;j<3;j++) cin>>a[i][j];
    for(int i=n-2;i>=0;i--)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0) x=1,y=2;
            else if(j==1) x=0,y=2;
            else if(j==2) x=0,y=1;
            a[i][j]=a[i][j]+max(a[i+1][x],a[i+1][y]);
        }
    }
    a[0][0]= *max_element(a[0],a[0]+3);
    cout<<a[0][0]<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
#define SIZE 200001

int main(void)
{
  int i, len, cnt;
  char s[SIZE], t[SIZE];
  scanf("%s", s);
  scanf("%s", t);
  cnt = 0;
  len = strlen(s);
  for ( i=0; i<len; ++i) {
    if ( s[i] != t[i])
      ++cnt;
  }
  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 2124
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
main(){
  int sum=0,a,b;
  int co=0,c=0;;
  while(~scanf("%d,%d",&a,&b)){
    sum+= a*b;
    co+=b;
    c++;
  }
  printf("%d\n%d\n",sum,(co*10/c+5)/10);
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int a,b,c; cin>>a>>b>>c;
    if(c>=a&&c<=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
K, A, B = (int(i) for i in input().split()) 

# 全部でK回
# 1枚からA枚に行くまでにA-1回
# 残りK-A+1回
# そこから2回でB-A枚増える
# 2で割り切れないときは、＋1する

if (K-A+1) % 2 == 0:
   b = A + (B - A) * ((K - A + 1) // 2)
else:
   b = A + (B - A) * ((K - A + 1) // 2) + 1

if b < K + 1:
    b = K + 1
print(b)


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>
#include <queue>
 
using namespace std;

int n, k;
vector<int> a(n);
bool dfs(int i, int sum){
    if(i==n) return sum == k;
    
    if(dfs(i+1, sum)) return true;
    
    if(dfs(i+1, sum+a[i])) return true;
    
    return false;
}

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    
    int res = s.length();
    string substr = t.substr(0,res);
    if(substr == s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
 }


Measured memory_bytes: 3632
#include <stdio.h>

int main(void) {
  char buf[6];
  int mountains[10];
  int i, j, tmp;

  for (i = 0; i < 10; i++) {
    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d", &mountains[i]);
  }

  for (i = 0; i < 10 - 1; i++) {
    for (j = i + 1; j < 10; j++) {
      if (mountains[i] < mountains[j]) {
        tmp = mountains[i];
        mountains[i] = mountains[j];
        mountains[j] = tmp;
      }
    }
  }

  for (i = 0; i < 3; i++)
    printf("%d\n", mountains[i]);

  return 0;
}

Measured memory_bytes: 612
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	sx, sy, tx, ty := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	rev := make(map[rune]string)
	rev['R'] = "L"
	rev['L'] = "R"
	rev['U'] = "D"
	rev['D'] = "U"
	ans := ""
	route := ""
	for i := 0; i < tx-sx; i++ {
		route += "R"
	}
	for i := 0; i < ty-sy; i++ {
		route += "U"
	}
	ans += route
	for i := 0; i < len(route); i++ {
		ans += rev[rune(route[i])]
	}
	route = ""
	route += "D"
	for i := 0; i < tx-sx+1; i++ {
		route += "R"
	}
	for i := 0; i < ty-sy+1; i++ {
		route += "U"
	}
	route += "L"
	ans += route
	for i := 0; i < len(route); i++ {
		ans += rev[rune(route[i])]
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 7680
use std::cmp;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let a: isize;
    let b: isize;
    let c: isize;
    let d: isize;
    let mut ans;
    input!(a, b, c, d);
    ans = cmp::min(b, d) - cmp::max(a, c);
    if ans < 0 {
        ans = 0;
    }
    println!("{}", ans);
}

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

int N,M,Q;
vector<int> a,b,c,d;
int res;

void dfs(vector<int> A) {
    if(A.size() == N + 1) {
        int tmp = 0;
        for(int i = 0; i<Q; i++) {
            if(A[b[i]] - A[a[i]] == c[i]) tmp += d[i];
        }
        res = max(tmp, res);
        return;
    }
    A.push_back(A.back());
    while (A.back() <= M) {
        dfs(A);
        A.back()++;
    }
}

int main(){
    scanf("%d %d %d", &N, &M, &Q);
    a = b = c = d = vector<int>(Q);
    for(int i = 0; i<Q; i++) {
        scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
    }
    dfs(vector<int>(1,1));
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 3784
def sieve(n):
  ass = []
  is_prime = [True]*(n+1)
  is_prime[0] = False
  is_prime[1] = False

  for i in range(2, int(n**0.5)+1):
    if not is_prime[i]:
      continue
    for j in range(i*2, n+1, i):
      is_prime[j] = False
  for i in range(n+1):
    if is_prime[i]:
      ass.append(i)
  return(ass)

l = sieve(55600)
l = [i for i in l if i%5 ==1]
n = int(input())
#print(*l[0:n])
print(*l[0:n])

Measured memory_bytes: 39792
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int d;
	cin >> d;
	
	if( d == 25 ) cout << "Christmas" << endl;
	else if( d == 24 ) cout << "Christmas Eve" << endl;
	else if( d == 23 ) cout << "Christmas Eve Eve" << endl;
	else if( d == 22 ) cout << "Christmas Eve Eve Eve" << endl;
	
	return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int dp[]={};
int main(){
    fast_io
    
    int n, m;
    cin>>n>>m;

    int ans = n*(n-1)/2 + m*(m-1)/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define debug(x) cerr<<#x<<" = "<<x<<endl
#define debug2(a, b) cerr<<#a<<" = "<<a<<" | "<<#b<<" = "<<b<<endl
#define debug3(a, b, c) cerr<<#a<<" = "<<a<<" | "<<#b<<" = "<<b<<" | "<<#c<<" = "<<c<<endl
#define debug4(a, b, c, d) cerr<<#a<<" = "<<a<<" | "<<#b<<" = "<<b<<" | "<<#c<<" = "<<c<<" | "<<#d<<" = "<<d<<endl
#define debug5(a, b, c, d, e) cerr<<#a<<" = "<<a<<" | "<<#b<<" = "<<b<<" | "<<#c<<" = "<<c<<" | "<<#d<<" = "<<d<<" | "<<#e<<" = "<<e<<endl
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll N = 100000 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 2e9;

int main() {
	ll n, m;
	cin>>n>>m;
	if(n&1 && m&1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
	int A,B;
	SCD2(A,B);
	getchar();
	char grid[102][102];
	
	FORq(i,1,49){
		FORq(j,1,100){
			grid[i][j] = '.';
		}
	}
	
	FORq(i,52,100){
		FORq(j,1,100){
			grid[i][j] = '#';
		}
	}
	
	FORq(j,1,100){
		grid[50][j] = '#';
	}
	
	FORq(j,1,100){
		grid[51][j] = '.';
	}
	//////////////////////////////
	FORq(b,1,B-2){
		int bt = 1 + 2*(b-1);
		int x = ((100 + bt) / 100)*2 - 1;
		int y = bt%100;
		grid[x][y] = '#';
		
	}
	
	FORq(a,1,A-2){
		int at = 1 + 2*(a-1);
		int x = 101 - ((100 + at) / 100)*2 + 1;
		int y = (at%100);
		grid[x][y] = '.';
		
	}
	
	if ((A==1) and (B==1)){
		printf("1 2\n");
		printf(".#");
		return 0;
	}else if (B==1) {
		grid[51][1] = '#';
	}else if (A==1) {
		FORq(j,1,100){
			grid[50][1] = '.';
		}
	}
		
		
	///output
	printf("100 100\n");
	FORq(i,1,100){
		FORq(j,1,100){
			printf("%c",grid[i][j]);
		}
		printf("\n");
	}
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double PI = acos(-1);

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i * i <= x; i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (is_prime(a)) ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
#define MAX 200001

ll rui(ll x,ll n)
{
	ll res = 1, i = 1, tmp = x;
	while (i <= n)
	{
		if (n & i) res = (res * tmp) % MOD;
		i <<= 1;
		tmp = (tmp * tmp) % MOD;
	}
	return res;
}

int main()
{
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	ll res = 0;
	vector<ll> kai(MAX), rkai(MAX);
	kai[0] = rkai[0] = 1;
	for (int i = 1; i < MAX; i++) {
		kai[i] = (kai[i - 1] * i) % MOD;
		rkai[i] = rui(kai[i], MOD - 2);
	}
	for (int i = 0; i < W - B; i++) {
		ll ans1 = kai[H - A + B + i - 1], ans2 = kai[W + A - B - i - 2];
		ans1 = (ans1 * rkai[B + i]) % MOD;
		ans1 = (ans1 * rkai[H - A - 1]) % MOD;
		ans2 = (ans2 * rkai[A - 1]) % MOD;
		ans2 = (ans2 * rkai[W - B - i - 1]) % MOD;
		res = (res + (ans1 * ans2) % MOD) % MOD;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main(){
	int n,a,b,p,aa=0,bb=0,cc=0;
	cin>>n>>a>>b;
	for(int i=0;i<n;++i){
		cin>>p;
		if(p<=a)
			++aa;
		else if(p<=b)
			++bb;
		else
			++cc;
	}
	if(aa<=bb&&aa<=cc)
		cout<<aa;
	else if(bb<=aa&&bb<=cc)
		cout<<bb;
	else if(cc<=aa&&cc<=bb)
		cout<<cc;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n;
    int a[100];
    int b[100];
    int c[100];
    int tensu=0;
    int i;

    scanf("%d", &n);

    for(i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }

    for(i = 0; i < n;i++){
        scanf("%d", &b[i]);
    }

    for(i = 0; i < n-1; i++){
        scanf("%d", &c[i]);
    }

    for(i = 0; i < n; i++){
        tensu += b[a[i]-1];
        if(a[i+1] == a[i]+1){
            tensu += c[a[i]-1];
        }
    }

    printf("%d", tensu);


    return 0;
}

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



 int main(){
    int n;
    cin>>n;
    vector<pair<int,int>>k;
    
    for(int i=0;i<n;i++){
      int x;
      cin>>x;
      k.push_back({x,(i+1)});
    }
    sort(k.begin(),k.end());

  for(int i=0;i<n;i++){
     cout<<k[i].second<<" ";
    }
   

     

       
 }

Measured memory_bytes: 1780
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int[] values = {111,222,333,444,555,666,777,888,999};
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < values.length; i++) {
			if(values[i] >= N) {
				System.out.println(values[i]);
				return;
			}
		}
	}
}


Measured memory_bytes: 21972
#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	scanf("%d",&n);
	int a=n/100;
	int b=(n-a*100)/10;
	int c=n-a*100-b*10;
	if(a==7||b==7||c==7)  printf("Yes");
	if(a!=7&&b!=7&&c!=7) printf("No");
}




Measured memory_bytes: 1732