akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T> >;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }

    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    int N; cin >> N;
    vector<int> A(N);
    vector<pair<int, int> > B(N);
    rep(i, N){
        cin >> A[i];
        B[i] = {A[i], i};
    }
    sort(ALL(B));
    rep(i, N){
        A[i] = B[i].second+1;
        A[i] %= 2;
    }
    // print(A);

    int ans = 0;
    for(int i=0; i<N; i+=2){
        if(A[i] != 1){
            ans++;
        }
    }

    cout << ans << endl;
    
    
    return 0;
}


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

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

ll N;
ll A[200005];
ll X = 0;

int main(){
	cin>>N;
	for(int i=0; i<N; i++){
		cin>>A[i];
		X ^= A[i];
	}
	for(int i=0; i<N; i++){
		cout<<(X^A[i])<<" ";
	}
	cout<<endl;
    return 0;
}






Measured memory_bytes: 5192
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <random>
#include <iomanip>
#include <limits>

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 998244353;
// memset(a,0,sizeof(a)); →全部０にする

vector<int> G[100005];
std::vector<P> tree[100010];

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

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)

ll i,j,k,l,ii,jj;
ll n,m,a,b,c,d,ans,num,ddx,ddy,sum;
ll x[100005],y[100005];
char s[100005];
bool flag;

int main(){
    cin>>n>>s;
    for(i=0;i<n;i++){
        x[s[i]]++;
    }
    for(i=0;i<n;i++){
        //分割をずらす
        x[s[i]]--;
        y[s[i]]++;
        //種類数を数える
        num=0;
        for(j=0;j<26;j++){
            if(x[j+'a'] && y[j+'a']){
                num++;
            }
        }
        ans=max(num,ans);
    }
    p(ans);
    return 0;
}
/*
 cout<< fixed << setprecision(16) <<(double)cou[i]*1.00000000/2000000<<endl;
 */


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
/*void mayank()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}*/
#define ll long long
#define inf 1e9+1
const int mxN = 1e5;
ll a[mxN + 1], b[mxN + 1];

struct item
{
	int wt;
	int val;
};

int solve(vector<item> ar, int n, int W)
{
	int maxVal = n * 1000;
	ll dp[n + 1][maxVal + 1];

	for (int val = 0; val <= maxVal; val++)
		dp[1][val] = inf;
	dp[1][0] = 0;
	dp[1][ar[1].val] = ar[1].wt;

	for (int i = 2; i <= n; i++)
	{
		for (int v = 0; v <= maxVal; v++)
		{
			dp[i][v] = dp[i - 1][v];
			if (ar[i].val > v)
				continue;
			dp[i][v] = min(dp[i][v], ar[i].wt + dp[i - 1][v - ar[i].val]);
		}
	}

	int ans = 0;
	for (int x = 0; x <= maxVal; x++)
	{
		if (dp[n][x] <= W)
			ans = x;
	}

	return ans;
}

int main() {
	//mayank();
	int n, w;
	cin >> n >> w;
	vector<item> ar(n + 1);
	for (int i = 1; i <= n; i++)
	{
		cin >> ar[i].wt >> ar[i].val;
	}
	cout << solve(ar, n, w);
}

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

s = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        s[i].append((x - 1, y))

result = 0
for i in range(1, 2 ** N):
    consistent = True
    for j in range(N):
        if (i >> j) & 1 == 0:
            continue
        for x, y in s[j]:
            if (i >> x) & 1 != y:
                consistent = False
                break
    if consistent:
        result = max(result, bin(i)[2:].count('1'))
print(result)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589
int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int32_t main(){
    fast;
    int n;
    cin>>n;
    double dp[n+1][n+1];
    dp[0][0]=1.0;
    for(int i=1;i<=n;i++){
        double p;
        cin>>p;
        for(int j=0;j<=i+1;j++)
            dp[i][j]=0.0;
        for(int j=0;j<=i;j++){
            dp[i][j]+=dp[i-1][j]*(1-p);
            dp[i][j+1]+=dp[i-1][j]*p;
        }
    }
    double ans=0.0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[n][i];
    printf("%.10f",ans);
    return 0;
}

Measured memory_bytes: 49868
#include <cstdio>
#include <cmath>
int main()
{
	int n,k,m=1;
	scanf("%d",&n);
	scanf("%d",&k);
	for(int i=1;i<=n;i++)
	{
		if(m+k <= 2*m) m = m+k;
		else m=2*m;
    }
    printf("%d\n",m);
    return 0;

}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getrnd(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

template <typename T1, typename T2>
bool relax(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T1, typename T2>
bool strain(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

// :::::::::::::::::::::::::::::::

const int N = 2e5 + 3;
const ll INF = 1e17;

ll dp[N], cost[N], h[N], tree[4 * N];

void build(int n) {
    for (int i = 0; i < 4 * n; ++i)
        tree[i] = -INF;
}

ll get_mx(int v, int tl, int tr, int l, int r) {
    if (l > r) return -INF;
    if (l == tl && r == tr)
        return tree[v];
    else {
        int tm = (tl + tr) / 2;
        return max(get_mx(2 * v, tl, tm, l, min(r, tm)), get_mx(2 * v + 1, tm + 1, tr, max(l, tm + 1), r));
    }
}

void update(int v, int tl, int tr, int pos, ll val) {
    if (tl == tr)
        tree[v] = val;
    else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(2 * v, tl, tm, pos, val);
        else
            update(2 * v + 1, tm + 1, tr, pos, val);
        tree[v] = max(tree[2 * v], tree[2 * v + 1]);
    }
}

void solve() {
    int n;
    cin >> n;
    
    vector<int> pos(n + 1, 0);
    for (int i = 0; i < n; ++i)
        cin >> h[i], pos[h[i]] = i;
    for (int i = 0; i < n; ++i)
        cin >> cost[i];
    
    build(n);
    for (int i = 1; i <= n; ++i) {
        ll mx = max(0LL, get_mx(1, 0, n - 1, 0, pos[i]));
        dp[pos[i]] = cost[pos[i]] + mx;
        update(1, 0, n - 1, pos[i], dp[pos[i]]);
    }
    
    ll ans = 0;
    for (int i = 0; i < n; ++i)
        strain(ans, dp[i]);
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    srand(time(0));
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}


Measured memory_bytes: 12032
n = int(input())
time = [int(input()) for _ in range(5)]
count = 0
if all([i >= n for i in time]):
    print(5)
else:
    smallest = min(time)
    smallest_index = time.index(smallest)
    count += n // smallest
    if n % smallest != 0:
        count += 1
    print(count + 4) 


Measured memory_bytes: 9072
n = int(input())

l = list(map(int, input().split()))
l.sort()

count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] + l[j] > l[k] and len(set([l[i], l[j], l[k]])) == 3:
                # print(i+1, j+1, k+1)
                count += 1
                
print(count)

Measured memory_bytes: 9196
// Problem : B - ... (Triple Dots)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

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

int32_t main() {
  fastio;
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int k;
    string s;
    cin >> k >> s;
    int len = s.length();
    if (len <= k) {
      die(s);
    }
    die(s.substr(0, k) + "...");
  }

  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    ll n;
    cin >> n;
    // int tests = 1;
    // cin >> tests;
    for(ll test = 1; test <= n; ++test) {
        if(test * 1000 - n >= 0) {
            cout << test * 1000 - n;
            return 0;
        }
    }
    return 0;
}

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

int dp[100004]={0};
int h[100005]={0};
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	
	for(int i=1;i<=n;i++){
		int i1=i-1>0 ? i-1: 1,i2=i-2>0? i-2:1;
		dp[i]=min(dp[i1]+abs(h[i]-h[i1]),dp[i2]+abs(h[i]-h[i2]));
//		cout<<dp[i1]+abs(h[i]-h[i1])<<" "<<dp[i2]+abs(h[i]-h[i2])<<endl;
	}
//	for(int i=1;i<=n;i++) cout<<dp[i]<<" ";
	cout<<dp[n];
//	cout<<min(20 ,20);
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
int lps[N], dis[N], deg[N];
vector<int> g[N];
 
signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif
    string s, t;
    cin >> s >> t;
    int tl = t.length();
    for(int i = 1, l = 0; i < tl; i++){
        while(l > 0 && t[i] != t[l])
            l = lps[l-1];
        if(t[i] == t[l])
            lps[i] = l + 1, l++;
    }   
    string tmp = s;
    while(tmp.length() < tl)
        tmp += s;
    s = tmp + tmp;
    int sl = (s.length()), i = 0, l = 0;
    while(i < sl){
        if(s[i] == t[l])
            i++, l++;
        if(l == tl){
            int u = (i-l)%sl;
            int v = (i)%(sl>>1);
            g[u].push_back(v);
            deg[v]++;
            l = lps[l-1];
        }
        else if(i < sl && t[l] != s[i]){
            if(l != 0)
                l = lps[l-1];
            else
                i += 1;
        }
    }
    int ans = -1;
    queue<int> q;
    for(int i = 0; i < sl; i++){
        if(!deg[i])
            q.push(i);
        dis[i] = 0;
    }
    while(!q.empty()){
        int x = q.front();
        q.pop();
        ans = max(ans, dis[x]);
        for(auto i: g[x]){
            deg[i]--;
            if(!deg[i]){
                dis[i] = max(dis[x] + 1, dis[i]);
                q.push(i);
            }
        }
    }
    for(int i = 0; i < tl; i++){
        if(deg[i])
            return cout << -1, 0;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 118192
MM = int(input())
AA = input().split()
count = 0
for j in AA:
  i = int(j)
  if i%2 ==0:
    if i%3 !=0 and i%5 !=0:
      count +=1
if count == 0:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 9184
main(){
	int n,a=100000;	scanf("%d",&n);
	while(n--){
		a*=1.05;
		if(a%1000>0)	a=(a/1000+1)*1000;
		else		a=a/1000*1000;
	}
	printf("%d\n",a);
	exit(0);
}

Measured memory_bytes: 0
n = int(input())

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

l.sort()
ans = 0

if n < 2:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k] and l[i] < l[j] < l[k]:
          ans += 1
  print(ans)



Measured memory_bytes: 9132
#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
#include <stdlib.h>
using namespace std;

int pop(vector<int>& stk);  //--- prototype to pop stack

//============================================================= main
int main() {
    vector<int> opndStack; // vector used as operand stack
    string token;          // to read number or operator
	int result;
    while (cin >> token) {
        if (isdigit(token[0])) { // if first is digit, it's number.
            opndStack.push_back(atoi(token.c_str())); // convert, push
            
        } else { // If it's not a number, assume it's an operator
            int left, right;  //  used by some operators as temps

            switch (token[0]) {  // assume operators are one char
              case '+': opndStack.push_back(pop(opndStack) + pop(opndStack));
                        break;
              case '-': right = pop(opndStack); // get right operand
                        left  = pop(opndStack); // get left operand
                        opndStack.push_back(left - right);
                        break;
              case '*': opndStack.push_back(pop(opndStack) * pop(opndStack));
                        break;
              case '/': right = pop(opndStack); // get right operand
                        left  = pop(opndStack); // get left operand
                        opndStack.push_back(left / right);
                        break;
              default:  throw domain_error("Undefined operator");
            }
            result=  opndStack.back();
        }
    }
    cout<<result<<endl;
    return 0;
}
int pop(vector<int>& stk) {
    if (stk.empty()) {
        throw underflow_error("Stack underflow.");
    }
    int result = stk.back();
    stk.pop_back();
    return result;
}


Measured memory_bytes: 3188
#include<stdio.h>
int main()
{
  int n, q, i, cnt=0;
  int s[100000],t[50000];
  int mid, left, right;
  scanf("%d", &n);
  for(i=0; i<n; i++)
    {
      scanf("%d", &s[i]);
    }
  scanf("%d", &q);
  for(i=0; i<q; i++)
    {
      scanf("%d", &t[i]);
    }
  for(i=0; i<q; i++)
    {
      left = 0;
      right = n;
      while(left < right)
    {
      mid = (left+right)/2;
      if(t[i] == s[mid])
        {
          cnt++;
          break;
        }
      if(t[i] > s[mid])
        {
          left = mid+1;
        }
      else if(t[i] < s[mid])
        {
          right = mid;
        }
    }
    }
 
  printf("%d\n", cnt);
   
  return 0;
}



Measured memory_bytes: 2276
using System;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N,ans=0;
            N = int.Parse(Console.ReadLine());
            while (N >= 15)
            {
                N -= 15;
                ans += 11800;
            }
            ans += N * 800;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
from sys import stdin
import math
input = [int(x) for x in stdin.readline().rstrip().split()]

N=input[0]
D=input[1]
point_list=[]
for n in range(N):
    point_list.append([int(x) for x in stdin.readline().rstrip().split()])

output=0

for i in range(N):
    for j in range(N):
        if i<j:
            difflist=[x - y for (x, y) in zip(point_list[i], point_list[j])]
            diff2=[x**2 for x in difflist]
            dist=math.sqrt(sum(diff2))
            if dist==int(dist):
                output+=1
print(output)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/b;
	printf("%d %d %f\n",d,r,f);
	return 0;
}

Measured memory_bytes: 1064
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void){
	long long a,b,c,k,ans;
	cin>>a>>b>>c>>k;
	if(k%2==0)ans=a-b;
	else ans=b-a;
	if(abs(ans)>1000000000000000000)cout<<"Unfair"<<endl;
	else cout<<ans<<endl;
	return 0;
}

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


int main(){
    int n, k;
    cin >> n >> k;
    if (k % 2 != 0){
        cout << ll(pow(n / k, 3)) << endl;
    }
    else {
        int t = k / 2;
        int odd = (n / t + 1) / 2;
        cout << ll(pow(n / k, 3)) + ll(pow(odd, 3)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(X: int, A: int, B: int):
    if B-A <= 0:
        print("delicious")
    elif B-A <= X:
        print("safe")
    else:
        print("dangerous")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(X, A, B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        while (scanner.hasNext()) {
            int n =scanner.nextInt();
            int combination = 0;

            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    for(int k = 0; k < 10; k++) {
                        for(int l = 0; l < 10; l++) {
                            if (i+j+k+l == n) {
                                combination++;
                            }
                        }
                    }
                }
            }
            System.out.println(combination);
        }
    }
}

Measured memory_bytes: 18852
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main(){
int x;
cin>>x;
int h = x/3600;
int m = (x/60)%60;
int s = x % 60; 
 
 cout<<h<<":"<<m<<":"<<s<<endl;
 return 0; 
}


Measured memory_bytes: 3120
#include <iostream>
using namespace std;
int main(void){
    int n;
    int a[4];
    int cnt=0,f=1;
    cin >> n;
    for(int i=0;i<4;i++){
        a[i] = n%10;
        n= n/10;
    }
    
    for(int i=0;i<3;i++){
        if(a[i] == a[i+1]){
            cnt++;
            if(cnt == 2) { 
                cout << "Yes" << endl;   
                f=0;
                break;
            }
        } else{
            cnt = 0;
        } 
        
    }
    
    if(f==1) cout << "No" << endl;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  int n, k;
  cin >> n >> k;
  k = min(k, n-1);
  combination c(n);
  mint ans;
  for (int i = 0; i <= k; i++) {
    ans += c(n,i) * c((n-i-1)+i, i);
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    string u = t.substr(0,n);
    if(n == t.size()-1 && u == s)cout << "Yes" << endl;
    else cout << "No" << endl;
    //cout << u << endl;

    return 0;
}

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

vector<ll> par, sz;

ll root(ll x){
  if(par[x] == x) return x;
  return root(par[x]);
}

void unite(ll x, ll y){
  ll rx = root(x);
  ll ry = root(y);
  if(rx == ry) return;
  if(sz[rx] < sz[ry]){
    par[rx] = ry;
    sz[ry] += sz[rx];
  }else{
    par[ry] = rx;
    sz[rx] += sz[ry];
  }
}

bool same(ll x, ll y){
  return root(x) == root(y);
}


int main(){
  ll N, M; cin >> N >> M;
  vector<ll> A(M), B(M);
  
  for(ll i = 0; i < M; i++){
    cin >> A[i] >> B[i];
    A[i]--; B[i]--;
  }
  
  par.resize(N);
  sz.resize(N);
  for(ll i = 0; i < N; i++){
    par[i] = i;
    sz[i] = 1;
  }
  
  vector<ll> ans(M, 0);
  ans[M-1] = N * (N - 1) / 2;
  for(ll i = M - 2; i >= 0; i--){
    ll a = A[i + 1], b = B[i + 1];
    ll ra = root(a), rb = root(b);
    if(ra == rb) {
      ans[i] = ans[i+1]; continue;
    }
    ll sa = sz[ra], sb = sz[rb];
    ans[i] = ans[i + 1] - sa * sb;
    unite(ra, rb);
  }
  for(ll i = 0; i < M; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 5248
def resolve():
    N = int(input())
    add = list(map(int, input().split()))
    ans = []
    count = 0
    for i in add:
        if i%2 == 0:
            ans.append(i)
    for j in ans:
        if j%3 == 0 or j%5 == 0:
            count += 1
    print("DENIED" if count != len(ans) else "APPROVED")
resolve()

Measured memory_bytes: 3064
first = str(input()).split(' ')
second = str(input()).split(' ')

k = int(first[0]) #metri
n = int(first[1]) #case
A = [int(i) for i in second]

dif = 0
for i in range(0,n):
    dif = max(dif, (A[(i+1)%n]-A[i])%k)
print(k-dif)

Measured memory_bytes: 26704
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int unsigned long long
#define mod 1000000007
#define fi first
#define se second
#define be begin()
#define en end()
#define re reverse
#define Set setprecision
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define No cout<<"No\n"
#define Yes cout<<"Yes\n"
const int INFi=2147483647;
const long long INFl=9223372036854775807LL;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b;
    itn ans=0;
    cin>>n>>a>>b;
    if(n%(a+b)!=0){
	if(n%(a+b)>=a) ans=a;
	else ans=n%(a+b);
    }
    cout<<ans+a*(n/(a+b))<<"\n";
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
/* Type alias */
using ll = long long;
using ld = long double;

using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

using set_i = std::set<int>;
using set_ll = std::set<ll>;
using set_ld = std::set<ld>;

using uset_i = std::unordered_set<int>;
using uset_ll = std::unordered_set<ll>;
using uset_ld = std::unordered_set<ld>;

/* IO macros */
#define in(i)        int i; std::cin >> i
#define in2(i, j)    int i, j; std::cin >> i >> j
#define in3(i, j, k) int i, j, k; std::cin >> i >> j >> k
#define in_ll(i)        ll i; std::cin >> i
#define in2_ll(i, j)    ll i, j; std::cin >> i >> j
#define in3_ll(i, j, k) ll i, j, k; std::cin >> i >> j >> k
#define in_ld(i)        ld i; std::cin >> i
#define in2_ld(i, j)    ld i, j; std::cin >> i >> j
#define in3_ld(i, j, k) ld i, j, k; std::cin >> i >> j >> k
#define in_c(i)        char i; std::cin >> i
#define in2_c(i, j)    chari, j; std::cin >> i >> j
#define in3_c(i, j, k) char i, j, k; std::cin >> i >> j >> k
#define in_str(s) std::string s; std::cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){std::cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){std::cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){std::cin>>x;}

#define print(x)   std::cout << x
#define println(x) std::cout << x << "\n"
#define print_vec(v) for (auto &x:v) { std::cout << x << " ";}
#define println_vec(v) for (auto &x:v) { std::cout << x << " ";} std::cout << "\n";
#define print_long_vec(v) for (auto &x:v) { std::cout << x << "\n";}
#define println_long_vec(v) for (auto &x:v) { std::cout << x << "\n";} std::cout << "\n";

/* Loops */
#define rep(i, n) for (auto i = 0; i < n; ++i)

/* Vector manipulation */
#define vec_sort(v) std::sort(v.begin(), v.end())

using namespace std;
/* Code Starts Here*/
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in2(X, N);
    vec_in(p, N);
    uset_i s(p.begin(), p.end());
    int i = 0; int j = 0;
    while (true) {
        if (X - i >= 0) {
            if (s.count(X - i) == 0) {
                println(X - i);
                return 0;
            }
            i++;
        }
        if (s.count(X + j) == 0) {
            println(X + j);
            return 0;
        }
        j++;
    }
    return 0;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <vector>

long N;
std::vector<int> a;
std::vector<int> b;

int main() {
    long xor_ = 0;
    int tmp;
    std::cin >> N;

    for (int i = 1; i <= N; ++i) {
        std::cin >> tmp;
        a.push_back(tmp);
    }

    for (int i = 1; i <= N; ++i) {
        std::cin >> tmp;
        b.push_back(tmp);
    }

    for (int k = 0; k <= 29; ++k) {  // Consider the k-bit.
        long n_ones = 0;  // Number of standing bits (in k-bit).
        long T = 1 << k;
        std::vector<int> b_mod;

        for (int i = 0; i < N; ++i) {
            b_mod.push_back(b.at(i) % (2 * T));
        }

        std::sort(b_mod.begin(), b_mod.end());

        for (int i = 0; i < N; ++i) {  // For each a.
            long a_mod = a.at(i) % (2 * T);
            long T1 = std::lower_bound(b_mod.begin(), b_mod.end(), 1 * T - a_mod) - b_mod.begin();
            long T2 = std::lower_bound(b_mod.begin(), b_mod.end(), 2 * T - a_mod) - b_mod.begin();
            long T3 = std::lower_bound(b_mod.begin(), b_mod.end(), 3 * T - a_mod) - b_mod.begin();
            n_ones += (T2 - T1) + (N - T3);
        }

        if (n_ones % 2) {
            xor_ += T;
        }
    }

    std::cout << xor_ << std::endl;
}


Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}



// TODO: write
int main() { 
  int n;cin>>n;
  vector<pair<int,int>> a(n);
  rep(i,n){
    int b,c;cin>>b>>c;
    a[i].fi = b+c;
    a[i].se = b-c;
  }

  sort(all(a));
  int ans = 0;
  int last = -INF;
  rep(i,n){
    if(last <= a[i].se){
      last = a[i].fi;
      ans++;
    }
  }
  print(ans);
  return 0;
}



Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <list>
#include <bitset>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <climits>
#include <cmath>
#include <stack>
#include <queue>
#include <cfloat>
#include <initializer_list>
#include <iomanip>
#include <functional>
#include <unordered_map>
#include <regex>

using namespace std;

int N, M;
vector<int> adj[20];
bool visited[20];

int bfs(int v, int n)
{
  if (n == N) return 1;
  int res = 0;
  for (int nxt : adj[v])
    {
      if (!visited[nxt])
        {
          visited[nxt] = true;
          res += bfs(nxt, n + 1);
          visited[nxt] = false;
        }
    }
  return res;
}


int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(false);
  cin >> N >> M;
  for (int i = 0; i < M; ++i)
    {
      int a, b;
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
  visited[1] = true;
  cout << bfs(1, 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	long long a,b;
	cin>>a>>b;
	cout<<(a*b)/__gcd(a,b)<<"\n";
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

const int INF = 2e9;

int N;
int A[18][2];

int dp[1<<18][18];
int solve(int s, int l){
	if(s == (1<<N)-1) return 0;
	if(dp[s][l] != -1) return dp[s][l];
	int n = 0;
	rep(i, N) n += (s>>i)&1;
	int ret = INF;
	int tmp = 0;
	rep(i, N){
		if((s>>i)&1){
			tmp++;
			continue;
		}
		if(s != 0 && A[l][(l+n+1)&1] > A[i][(i+n)&1]) continue;
		ret = min(ret, solve(s+(1<<i), i) + i - tmp);
	}
	return dp[s][l] = ret;
}

signed main(){
	cin >> N;
	rep(i, N) cin >> A[i][0];
	rep(i, N) cin >> A[i][1];
	memset(dp, -1, sizeof(dp));
	if(solve(0, 0) >= INF) cout << -1 << endl;
	else cout << solve(0, 0) << endl;
}

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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
	string s, t;
	cin >> s >> t;
	int a = 0;
	for (int i = 0; i < 3; ++i) {
		a += s[i] == t[i];
	}
	cout << a;
	return 0;
}

Measured memory_bytes: 256
A,B,C,D = input().split()
A = int(A)
B = int(B)
C = int(C)
D = int(D)

while True:
    #青木が攻撃受けてHP減る
    C = C - B
    if C <= 0:
        print('Yes')
        break
    A = A - D

    if A <= 0:
        print('No')
        break

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<long long> vecll;
typedef vector<unsigned long long> vecull;

ll A, B, N;

int main(void) {

    cin >> A >> B >> N;

    // まずB以下で最大値
    ll x1 = min(B - 1, N);

    // B ~ 次のBまでの最大値
    ll x2 = min(B * 2 - 1, N);

    ll ans = (A * x1 / B) - (A * (x1 / B));
    ans = max(ans, (A * x2 / B) - (A * (x2 / B)));

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
using System;

namespace AOJ.ITP
{
    public class ABProblem
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split(' ');
            long a = long.Parse(input[0]);
            long b = long.Parse(input[1]);

            long div = (long)(a / b);
            long mod = a % b;
            double div_f = (double)a / (double)b;

            Console.WriteLine(string.Format("{0} {1} {2:0.00000}", div, mod, div_f));
        }
    }
}

Measured memory_bytes: 5780
nCr = {}
def cmb(n, r):
    if n < r:
        return 0
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
n, a, b = [int(_) for _ in input().split()]
values = [int(v) for v in input().split()]
values.sort(reverse=True)
maximum_mean = sum(values[:a]) / a
print(maximum_mean)

min_value = values[:a][-1]
accepted = values[:a].count(min_value)
full = values.count(min_value)

if min_value == maximum_mean:
    ans = 0
    for r in range(a, b+1):
        ans += cmb(full, r)
else:
    ans = cmb(full, accepted)

print(ans)


Measured memory_bytes: 3188
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int a[2000+10]; 
int dp1[2000+10],dp2[2000+10];
int n,k;
LL res=0;
int main(){
	cin>>n>>k;
	rb(i,1,n) scanf("%d",&a[i]);
	int MOD=1e9+7;
	rb(i,1,n){
		rb(j,i,n) if(a[i]>a[j]) dp1[i]++;
		rb(j,1,n) if(a[i]>a[j]) dp2[i]++;
	}
	LL res=0;
	rb(i,1,n){
		res+=(LL)(k)*dp1[i];
		res%=MOD;
		res+=((((LL)(k-1)*(LL)(k))/(LL)(2))%MOD)*dp2[i];
		res%=MOD;
	}
	cout<<res<<endl;
	return 0;
}

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

using namespace std;

const int mod = 998244353;

int add(int a, int b) {
  return a + b - mod * (a + b >= mod);
}

int mul(int a, int b) {
  return int(1ll * a * b % mod);
}

int power(int a, int x) {
  if (x == 0) {
    return 1;
  }
  return mul(power(mul(a, a), x >> 1), (x & 1 ? a : 1));
}

int divide(int a, int b) {
  return mul(a, power(b, mod - 2));
}

int sub(int a, int b) {
  return a - b + mod * (a < b);
}

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

  int n;
  cin >> n;
  int ans = power(3, n), p = 2, c = 1;
  for (int i = n; i > n / 2; --i) {
    ans = sub(ans, mul(p, c));
    c = mul(c, i);
    c = divide(c, n - i + 1);
    p = add(p, p);
  }
  cout << ans;

  return 0;
}

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

#define REP(A, H) for(int A = 0; A < H; A++)
#define REP1(A, H) for(int A = 1; A < H; A++)
#define ALL(c) c.begin(), c.end()
#define SHOWL(c) std::cout << c << std::endl
#define SHOW(c) std::cout << c
#define COUT std::cout
#define EL std::endl
#define CIN std::cin
#define VEC(T) std::vector< T >

typedef long long ll;

int main(void) {
  int n, m, c;
  CIN >> n >> m >> c;
  
  VEC(VEC(int)) as(n, VEC(int)(m));
  VEC(int) bs(m);
  
  REP(i, m) CIN >> bs[i];
  REP(i, n) REP(j, m) CIN >> as[i][j];

  // REP(i, m) COUT << bs[i] << EL;
  // REP(i, n) {
  //   REP(j, m) COUT << as[i][j];  
  //   COUT << EL;
  // }

  VEC(int) ts(n);
  REP(i, n) ts[i] = c;

  REP(i, n) REP(j, m) ts[i] += as[i][j] * bs[j];

  int sum = 0;
  REP(i, n) sum += ts[i] > 0 ? 1 : 0;

  SHOWL(sum);

  return 0;

}

Measured memory_bytes: 256
def solve():
    input()
    s = input()
    ans = 0
    for i in range(1000):
        t = str(i)
        while(len(t)<3):
            t = '0'+t
        it = 0
        for i in s:
            if it==3:
                break
            if i==t[it]:
                it+=1
        if it==3:
            ans+=1
    print(ans)
if __name__ == "__main__":
    solve()

Measured memory_bytes: 40812
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    bool odd = true;
    bool even = true;
    for(int i = 0; i < S.size(); i++){
        if(i % 2 == 0 && (S.at(i) != 'R' && S.at(i) != 'U' && S.at(i) != 'D'))
        {
            odd = false;
         }

        if(i % 2 != 0 && (S.at(i) != 'L' && S.at(i) != 'U' && S.at(i) != 'D'))
        {
        even = false;
        }
    }
    if(odd == true && even == true){
        cout << "Yes" << endl;
    }
    else if(odd != true || even != true)
    cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
const int mod = 1000000007;
//const int mod = 998244353;
 
 
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数
 
        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
 
        // その結果を push
        res.push_back({a, ex});
    }
 
    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}
 
int main(int argc, const char * argv[]) {

    ll N,K; cin >> N >> K;
    vector<ll> A(N);
    ll A_max = 0;
    rep(i,N){
        cin >> A[i];
        A_max = max(A_max,A[i]);
    }
    
    ll right = A_max;
    ll left = 0;
    
    while(abs(right - left)>1){
        ll mid = (right + left) / 2;
        
        ll sum = 0;
        for(ll i=0;i<N;i++){
            double f = (double)A[i] / (double)mid;
            sum += ceil(f)- 1;
        }
        
        if(sum > K){
            left = mid;
        }else{
            right = mid;
        }
    }
    
    cout << right << endl;
    
    return 0;
}


Measured memory_bytes: 8028
#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>;
using vv = vector<vector<ll>>;
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;}

const int INF = 2147483647;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int n;cin >> n;
    vector<int> a(n),ans(n);
    int bit;
    rep(i,n){ 
	cin >> a[i];
	if(i==0){
	    bit = a[i];
	}else{
	    bit = bit ^ a[i];
	}
    }
    for(int i=0;i<n;i++){
	ans[i] = bit ^ a[i];
	cout << ans[i]<<" ";
    }
    return 0;
}


Measured memory_bytes: 4732
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main(){
  int d,n;cin>>d>>n;
  cout << (n==100?101:n)*(int)pow(100,d)<<endl;
  return 0;
}


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

struct UF{
    vector<int> p;
    int n;

    UF(int siz){
        n = siz;
        p.resize(n, 0);
        for(int i = 0; i < n; i++)  p[i] = i;
    }

    int parent(int x){
        if(p[x] != x)   p[x] = parent(p[x]);
        return p[x];
    }

    bool same(int x, int y){
        return parent(x)==parent(y);
    }

    void unite(int x, int y){
        x = parent(x), y = parent(y);
        p[x] = y;
    }
};

// MSTやるだけ、は流石に無い？
int main(){
    int n, m;
    while(cin >> n >> m, n+m){
        priority_queue<pair<int,pair<int,int>>> pq;
        int s, t, c;
        for(int i = 0; i < m; i++){
            cin >> s >> t >> c;
            s--, t--;
            pq.push({-c, {s,t}});
        }
        UF uf(n);
        int cnt = 0;
        while(true){
            auto p = pq.top();    pq.pop();
            int i = p.second.first, j = p.second.second;
            if(!uf.same(i,j)){
                uf.unite(i,j);
                cnt++;
                if(cnt == n/2){
                    cout << -p.first << endl;
                    break;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  int rtm = sqrt(m), mx = 1;
  for (int i = 1; i <= rtm; i++) {
    if (m % i == 0) {
      int g = i;
      if (m / g >= n)
        mx = max(mx, g);
      g = m / i;
      if (m / g >= n)
        mx = max(mx, g);
    }
  }
  cout << mx;
  return 0;
}

Measured memory_bytes: 3688