akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> H >> N;
	vector< int > A(N);
	M = 0;
	rep(i, N) cin >> A[i];
	rep(i, N) M += A[i];
	string ans;
	if (M >= H)
		ans = "Yes";
	else
		ans = "No";
	cout << ans << endl;
	return 0;
}

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

#define int long long
#define max(a,b) max((signed)a,(signed)b)
#define mn(a,b) min((signed)a,(signed)b)

using namespace std;

signed main(){
	int n,k,x=0;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	for(int i=0;i<n;i++) x ^=arr[i];
	for(int i=0;i<n;i++) cout<<(x^arr[i])<<" ";

}

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

typedef pair<long long, long long> P;

int main(){
    long long num[100100]; //i番目の数が何個入っているか
    map <long long, int> m; //数→iの対応
    set <long long> S;
    int cnt=0; //何種類の数が出てきているか
    long long sum=0;
    int N; long long M; cin >> N >> M;
    S.insert(0);
    m[0]=cnt;
    num[cnt]=1;
    cnt++;
    for(int i=0; i<N; i++){
        long long A; cin >> A;
        long long c = (A+sum)%M;
        sum =c;
        if(!S.erase(c)){ //cが入っていないとき
            S.insert(c);
            m[c]=cnt;
            num[cnt]++;
            cnt++;
        }
        else{
            S.insert(c);
            num[m[c]]++;
        }
    }
    long long ans=0;
    for(int i=0; i<cnt; i++){
        ans += num[i]*(num[i]-1) /2;
    }
    cout << ans <<endl;



/*
    //Mで割った余りとその数のペアを保持しておく
    map<long long, int> m;
    set<int> S; //使ったものを入れとく
    int N;
    long long M;
    long long A[100100];
    cin >> N >> M;
    for(int i=0; i<N; i++){
        int A; cin >> A;
        auto c = erase(A);
        if(c==0){
            m[A]=1;
            S.insert(A);
        }
        else{
            m[A]++;
            S.insert(A);
        }
    }
*/
}

Measured memory_bytes: 7680
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) { cout << ", "; first = false; }
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n);
  for (lli i=0; i<n; ++i) cin >> v[i];
}

lli n, p;
int main() {
  cin >> n >> p;
  if (n==1) { cout << p << endl; return 0; }
  lli lim = sqrt((long double)p);
  lli ans = 1;
  for (lli i=2; i<=lim; ++i) {
    lli cnt = 0;
    while (p%i==0) {
      p/=i;
      ++cnt;
    }
    while (cnt >= n) {
      ans = ans * i;
      cnt -= n;
    }
  } 
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=1000000000000;

//main関数
int main() {
    
    //入力
    
    
    //計算
    
    long sum=0;
    for(int i=0;i<3;i++){
        long A;
        cin>>A;
        if(A!=5 && A!=7){
            cout<<"NO"<<endl;
            return 0;
        }
        sum+=A;
    }
    
    if(sum!=5+7+5){
        cout<<"NO"<<endl;
        return 0;
    }
    
    //出力
    cout<<"YES"<<endl;
}



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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;



template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

int main() {
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N);
    rp(i, 0, N) cin >> A[i];
    sort(A.begin(), A.end());

    ll ok = -INF;
    ll ng = -ok;
    while(abs(ok - ng) != 1){
        ll x = (ok + ng) / 2;
        ll tot = 0;
        rp(i, 0, N) {
            int count = 0;
            if(A[i] < 0) {
                int left = N;
                int right = -1;
                int y = (left + right) /2;
                while(abs(left - right) > 1) {
                    int y = (left + right) / 2;
                    if(A[i] * A[y] < x) left = y;
                    else right = y;
                }
                count = N - left;
                if(A[i] * A[i] < x) count --;
            }
            else {
                int left = -1;
                int right = N;
                while(abs(left - right) > 1) {
                    int y = (left + right) / 2;
                    if(A[i] * A[y] < x) left = y;
                    else right = y;
                }
                count = left + 1;
                if(A[i] * A[i] < x) count--;

            }
            tot += count;
        }
        tot /= 2;
        // cout << x << ", " << tot << endl;
        if(tot < K) ok = x;
        else ng = x;
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4752
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int n,k; cin >>n >>k;
  vector<int> v(n);rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  int s=0;
  rep(i,k) s+=v[i];
  print(s);
}


Measured memory_bytes: 3624
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
#define MAX_N 100
using namespace std;

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

  int n;
  cin >> n;
  string s[MAX_N];
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }

  bool p, w, g, y;
  p = w = g = y = false;
  for(int i = 0; i < n; i++){
    if(s[i] == "P") p = true;
    else if(s[i] == "W") w = true;
    else if(s[i] == "G") g = true;
    else if(s[i] == "Y") y = true;
  }

  if(p & w & g & y) cout << "Four" << endl;
  else cout << "Three" << endl;

  return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

ll N, M;

int main() {
   cin >> N >> M;
   ll a = min(N, M / 2);
   ll b = (M - 2 * a) / 4;
   cout << a + b << endl;

   return 0;
}

Measured memory_bytes: 384
n = int(input())
lst = list(map(int, input().split()))

max_count = 0
count = 0
for i in range(n-1):
    if lst[i] >= lst[i+1]:
        count += 1
        max_count = max(max_count, count)
    else:
        count = 0
print(max_count)
    

Measured memory_bytes: 15020
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

setrecursionlimit(10000)

s = list(input())
K = read()

for i in range(len(s)):
  d = ord('z') - ord(s[i]) + 1
  if s[i] != 'a' and d <= K:
    s[i] = 'a'
    K -= d

K %= 26

s[-1] = chr(ord(s[-1]) + K)

print(''.join(s))


Measured memory_bytes: 4776
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {

            {
                

                while (true)
                {

                    var read = Console.ReadLine();
                    var temp_string = read.Split(' ');

                    int a = int.Parse(temp_string[0]), b = int.Parse(temp_string[2]), ans=0;
                    switch (temp_string[1])
                    {
                        case "+":
                            {
                                ans = a + b;
                                break;
                            }
                        case "-":
                            {
                                ans = a - b;
                                break;
                            }
                        case "*":
                            {
                                ans = a * b;
                                break;
                            }
                        case "/":
                            {
                                ans = a / b;
                                break;
                            }
                    }

                    if(temp_string[1]=="?")
                    { break; }
                    Console.WriteLine(ans);
                }

               
            }
        }
    }
}

Measured memory_bytes: 9248
def Is_cyc(x):
  s = str(x)
  for i in range(len(s)):
    if s[i] != s[-i-1]:
      return False
  return True

def main():
  a,b = map(int,input().split())
  ans = 0
  for i in range(a,b+1):
    if Is_cyc(i):
      ans += 1
  print(ans)
  return

if __name__ == "__main__":
  main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  vector<vector<int>> D(N, vector<int>(2));
  REP(i, N) REP(j, 2) cin >> D[i][j];
  int cnt = 0;
  REP(i, N) {
    if(D[i][0] == D[i][1]) cnt++;
    else cnt = 0;
    if(cnt == 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3652
import java.util.Arrays;
import java.util.Scanner;

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

        int[] a = new int[100005];
        Arrays.fill(a, 0);


        for (int i = 0; i < n; i++) {
            int l = scanner.nextInt();
            int d = scanner.nextInt();
            a[l]++;
            a[d + 1]--;
        }

        for (int i = 1; i < 100005; i++) {
            a[i] += a[i - 1];
        }

        int ans = 0;
        for (int i = 0; i < 100005; i++) {
            if (a[i] > 0) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 25612
#include <bits/stdc++.h>
using namespace std;
long long dp[1005][1005];
long long a[1005];
long long b[1005];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//	freopen("a.txt","r",stdin);
	int n;cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i];
	memset(dp,0xc,sizeof(dp));
	for(int i=1;i<=n;i++)dp[i][i]=0;
	for(int l=1;l<n;l++){
		for(int i=1;i<=n;i++){
			int j=i+l;
			if(j>n)continue;
			for(int k=i;k<j;k++)
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+a[i]*a[k+1]*b[j]);
		}
	}		
	cout<<dp[1][n]<<endl;
	return 0;
}


Measured memory_bytes: 11056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,mn=1000;
    string s;
    cin>>s;
    for(int i=0;i<s.size()-2;i++)
    {
        n=abs(((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0'))-753);
        mn=min(mn,n);
    }
    cout<<mn<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <algorithm>

using namespace std;

template <class T>
class segment_tree {
    public:
    segment_tree(int n, function<T(const T&, const T&)> func, const T& init = T());
    ~segment_tree();
    void add(int x, const T& value);
    void update(int x, const T& value);
    T get(int x, int y) const; // [x, y)
    
    private:
    int size;
    function<T(const T&, const T&)> func;
    T init;
    T* data;
};

template <class T> segment_tree<T>::segment_tree(int n, function<T(const T&, const T&)> func, const T& init) : size(1 << (32 - __builtin_clz(n - 1))), func(func), init(init) {
    data = (T *)malloc(sizeof(T) * size * 2);
    for (int i = 0; i < size * 2; i++) data[i] = init;
}

template <class T> segment_tree<T>::~segment_tree() {
    free(data);
}

template <class T> void segment_tree<T>::add(int x, const T& value) {
    update(x, data[x + size] + value);
}

template <class T> void segment_tree<T>::update(int x, const T& value) {
    data[x += size] = value;
    while (x >>= 1) data[x] = func(data[x * 2], data[x * 2 + 1]);
}

template <class T> T segment_tree<T>::get(int x, int y) const {
    T vl = init, vr = init;
    for (x += size, y += size; x < y; x >>= 1, y >>= 1) {
        if (x & 1) vl = func(vl, data[x++]);
        if (y & 1) vr = func(data[--y], vr);
    }
    return func(vl, vr);
}

int h[200000];
int a[200000];

int main() {
    int n, i;
    long long ans = 0;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &h[i]);
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    segment_tree <long long> s(n + 1, [](long long x, long long y) {return max(x, y);});
    
    for (i = 0; i < n; i++) {
        long long x = s.get(0, h[i]);
        
        ans = max(ans, x + a[i]);
        s.update(h[i], x + a[i]);
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
template <typename T> T max(T, T);
int gcd(int a, int b);

int main() {
    int n;
    cin >> n;
    vector<vector<pair<int, int>>> g(n);
    bool ans[n] = {};
    bool judge[n] = {};
    judge[0] = true;

    rep(i, n - 1) {
        int u, v, w;
        cin >> u >> v >> w;
        g[u - 1].push_back(make_pair(v - 1, w));
        g[v - 1].push_back(make_pair(u - 1, w));
    }

    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int now = q.front();
        q.pop();
        rep(i, g[now].size()) {
            int next = g[now][i].first;
            int len = g[now][i].second;
            if (judge[next]) {
                continue;
            }
            q.push(next);
            judge[next] = true;
            if (len % 2 == 0) {
                ans[next] = ans[now];
            } else {
                ans[next] = !ans[now];
            }
        }
    }

    rep(i, n) {
        if (ans[i]) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    }
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T max(T a, T b) {

    if (a > b) {
        return a;
    } else {
        return b;
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 6656
#include<iostream>
#include<algorithm>
using namespace std;
const int N=2e5;
int n,a[N];
int main(){
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	for(int i=1;i<n;i++) if(a[i]==a[i-1]) return cout<<"NO",0;
	cout<<"YES";
}


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

int main(){
    string S;
    string iS ;
    string fS ;
    string bS ;
    string fiS ;
    string biS ;
    cin >> S ;

    for (int i = 0; i < S.size(); ++i) {
        iS += S.at(S.size()-1-i);
    }
//    cout << iS << endl;
    for (int i = 0; i < (S.size()-1)/2; ++i) {
        fS += S.at(i);
    }
//    cout << fS << endl;
    for (int i = 0; i < fS.size(); ++i) {
        fiS += fS.at(fS.size()-1-i);
    }
    for (int i = (S.size()+3)/2-1; i < S.size(); ++i) {
        bS += S.at(i);
    }
//    cout << bS << endl;
    for (int i = 0; i < bS.size(); ++i) {
        biS += bS.at(bS.size()-1-i);
    }
    if((S==iS) &&(fS==fiS) && (bS==biS)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


}

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

int main()
{
	int n;
	string s1,s2;
	cin>>n;
	cin>>s1>>s2;
	for(int i=0;i<n;i++) cout<<s1[i]<<s2[i];
	cout<<endl;
	return 0;
} 

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

using namespace std;
#define next _next
#define y1 _y1
#define y2 _y2
#define lowbit(x) (x&(-x))
#define lc ((rt)<<1)
#define rc ((rt)<<1|1)
#define mid  ((l+r)>>1)
#define clr(a, b) memset(a,b,sizeof(a))

#ifdef __LOCAL_DEBUG__
#define _debug(fmt, ...)fprintf(stdout,"\033[94m%s: " fmt "\n\033[0m",__func__,##__VA_ARGS__)
#define debug(a) cerr <<"\033[94m" <<#a << "\033[0m = "<< a << endl;
#define debug_loop(v) {cerr <<#v;for(auto x:v) cerr <<"\033[94m " <<x<<"\033[0m";cerr<<endl;}
#else
#define _debug(...)((void)0)
#define debug(a)((void)0)
#define debug_loop(v)((void)0)
#endif

typedef long long ll;
const double pi = acos(-1);
const double eps = 1e-10;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = static_cast<int>(1e6 + 7);

int main() {
#ifndef __LOCAL_DEBUG__
    ios::sync_with_stdio(false), cin.tie(nullptr);
#endif
    int n, i;
    cin >> n >> i; // 1 2 3 4
    cout << n - i + 1 << endl;

}

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

using namespace std;

void solve() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    int ans;
    if(K <= A){
        ans = K;
    }
    else if (K <= A + B)
    {
        ans = A;
    }
    else{
        ans = A  - (K - A - B);
    }
    
    cout << ans << endl;
    
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
    int l,r,d;
    cin>>l>>r>>d;

    cout<<r/d-(l-1)/d<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int N, X, Y;
vector<int> a;

const int INF = 1e9+1;
int main () {
  cin >> N >> X >> Y;
  a.resize(N);

  rep(i,N) cin >> a[i];

  vector<vector<int>> dp({vector<int>(N, -INF), vector<int>(N, INF)});

  for(int i = N - 1; i >= 0; --i) {
    dp[0][i] = max(dp[0][i], abs((i - 1 >= 0 ? a[i-1] : Y) - a[N-1]));
    for(int j = i + 1; j < N; ++j) {
      dp[0][i] = max(dp[0][i], dp[1][j]);
    }
    dp[1][i] = min(dp[1][i], abs((i - 1 >= 0 ? a[i-1] : X) - a[N-1]));
    for(int j = i + 1; j < N; ++j) {
      dp[1][i] = min(dp[1][i], dp[0][j]);
    }
  }

  cout << dp[0][0] << endl;
  return 0;
}


Measured memory_bytes: 384
x1, x2, x3, x4, x5 = map(int, input().split())
if x1 == 0:
    print(1)
elif x2 == 0:
    print(2)
elif x3 == 0:
    print(3)
elif x4 == 0:
    print(4)
else:
    print(5)

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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var primeDict = new long[N + 1];

        // 素因数分解
        for (int i = N; i >= 2; i--)
        {
            var primes = PrimeFactors(i);
            foreach (var prime in primes)
            {
                primeDict[prime]++;
            }
        }

        var dp = new int[N + 1, 76];
        dp[0, 1] = 1;
        for (int i = 1; i < N + 1; i++)
        {
            for (int j = 1; j < 76; j++)
            {
                for (int k = 0; k < primeDict[i] + 1 && (k + 1) * j <= 75; k++)
                {
                    dp[i, (k + 1) * j] += dp[i - 1, j];
                }
            }
        }

        Console.WriteLine(dp[N, 75]);
    }


    /**
     * 素因数分解
     * <see cref="https://qiita.com/y_miyoshi/items/da814d96e8890224aad3"/>
     */
    public static IEnumerable<long> PrimeFactors(long n)
    {
        long i = 2;
        long tmp = n;

        while (i * i <= n) //※1
        {
            if (tmp % i == 0)
            {
                tmp /= i;
                yield return i;
            }
            else
            {
                i++;
            }
        }
        if (tmp != 1) yield return tmp;//最後の素数も返す
    }


}



Measured memory_bytes: 13116
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


N, K = mi()
A = lmi()
numcnt = [0]*(2*10**5)
for i in A:
    numcnt[i] += 1
numcnt.sort()
print(len(A)-sum(numcnt[-1:-K-1:-1]))

Measured memory_bytes: 24996
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<vector<ll>> g(N);
  vector<ll> a(M), b(M);
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  queue<pair<ll, ll>> q;
  q.push({0, 2});
  bool reachable = false;
  while (!q.empty()) {
    ll cur = q.front().first;
    ll cnt = q.front().second;
    q.pop();
    if (cur == N - 1) {
      reachable = true;
      break;
    }
    if (cnt == 0) {
      continue;
    }
    cnt--;
    for (int i = 0; i < g[cur].size(); i++) {
      q.push({g[cur][i], cnt});
    }
  }
  string ans = (reachable) ? "POSSIBLE" : "IMPOSSIBLE";
  cout << ans << endl;
  return 0;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<double, int> d_i;

int main() {
	int N; cin >> N;
	vector<int> a(N);
	rep(i, N) cin >> a[i];
	vector<i_i> ai(N);
	rep(i, N) ai[i] = {a[i], i};
	sort(ai.begin(), ai.end());
	vector<int> ans(N);
	rep(i, N)
		if (i < N / 2) ans[ai[i].second] = ai[N / 2].first;
		else ans[ai[i].second] = ai[N / 2 - 1].first;
	rep(i, N) printf("%d\n", ans[i]);
}


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

#define ll long long int
#define pb push_back
#define endl "\n"



int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans = max(a,b)*max(c,d);
    ans = max(ans,min(a,b)*min(c,d));
    ans = max(ans,max(a,b)*min(c,d));
    ans = max(ans,min(a,b)*max(c,d));
    cout<<ans<<endl;
}


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int h, w;
    cin >> h >> w;
    Int n;
    cin >> n;
    queue<Int> q;
    for (Int i = 0; i < n; i++) {
        Int x;
        cin >> x;
        for (Int j = 0; j < x; j++) {
            q.push(i + 1);
        }
    }
    for (Int i = 0; i < h; i++) {
        for (Int j = 0; j < w; j++) {
            cout << q.front() << " ";
            q.pop();
        }
        cout << endl;
        i++;
        if (i == h) break;
        vector<Int> res(w);
        for (Int j = 0; j < w; j++) {
            res[j] = q.front();
            q.pop();
        }
        reverse(all(res));
        for (Int j = 0; j < w; j++) {
            cout << res[j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod=1e9+7;
long long INF=1e7;
double EPS = 1e-12;
typedef long long int lld;
double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;}
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scd(a) scanf("%d",&a)
#define scd2(a,b) scanf("%d%d",&a,&b)
#define scd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scf(a) scanf("%lf",&a)
#define scf2(a,b) scanf("%lf%lf",&a,&b)
#define scf3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) c.begin(), c.end()
#define sz(a) ((int)a.size())
#define Error(x) cout<< #x << " = " << (x) <<endl;
#define Error2(a,b) cout<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define Error3(a,b,c) cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<")\n";
#define Error4(a,b,c,d) cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" , "<<#d<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<" , "<<(d)<<")\n";
#define errop(a) cout<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll
 
typedef pair<lld,lld> PA;
 
lld powP(lld a,lld b){
    if(b==0) return 1%mod;
    lld k;
    k=powP(a,b/2);
    k=k*k%mod;
    if(b%2==0) return k;
    else return a*k%mod;
}
 
bool bitSet(lld n,lld i){
    if((n&(1LL<<i))!=0) return true;
    else return false;
}
 
lld findGcd(lld a,lld b){
    if(a==0) return b;
    else return findGcd(b%a,a);
}
 
#define lim 300010
#define lim2 200010
#define qqqqqq 210
// Ab :)
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

// vector<lld> G[lim];
// string S[lim];
// lld A[lim],B[lim],C[lim];
// map<lld,lld> M;

int main(){
    lld T,i,p,j,l,n,e,r,b,c,k,m,q,a,d,w,x,y,u,v,z,t,curr,prev,sum,ans,pos,val,countA,indicator;
    string S;
    cin >> S;
    n = S.size();
    sc(k);
    rep(i,0,n-1) {
        t = S[i] - '0';
        if(t == 1) {
            k--;
            if(k == 0) {
                printf("1\n");
                return 0;
            }
        }
        else {
            prL(t);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
let p = 
  match (read_line ()) with
  | "SUN" -> 7
  | "MON" -> 6
  | "TUE" -> 5
  | "WED" -> 4
  | "THU" -> 3
  | "FRI" -> 2
  | _ -> 1

let _ = Printf.printf "%d\n" p


Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	map<int,int> x;
	for(int i=0;i!=n;++i){
		int k;
		cin>>k;
		++x[k];
	}
	int ans=0;
	for(auto i:x){
		if(i.second&1)
			++ans;
	}
	cout<<ans;
}

Measured memory_bytes: 4992
#include <utility>
#include <cstdio>
#include <cmath>
#include <climits>
#include <iostream>
using namespace std;


//---- Official House
int main(void){
    int n, b, f, r, v, Bdgs[4][3][10]={0};
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> b >> f >> r >> v;
        Bdgs[b-1][f-1][r-1]+=v;
    }
    for(int i=0; i<4; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<10; k++){
                cout << " " << Bdgs[i][j][k];
            }
            cout << endl;
        }
        if(i<3){cout << "####################" << endl;}
    }
    return 0;
}

Measured memory_bytes: 3064
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
  
int main(){
string N;
cin>>N;
for(int i=0;i<3;i++){
    if(N.at(i)=='1'){
        N.at(i)='9';
        
    }
    else{
        N.at(i)='1';
    }
  
}
cout<<N<<endl;
}


Measured memory_bytes: 256
R,G,B,N=map(int,input().split())

RL=(N+R-1)//R
if RL*R>N:
    RL=RL-1

cnt=0
for r in range(RL+1):
    GL=(N-r*R+G-1)//G
    if (r*R+GL*G)>N:
        GL=GL-1
    for g in range(GL+1):
        if (N-r*R-g*G)%B==0:
            cnt+=1

print(cnt)

Measured memory_bytes: 3060
import java.util.*;

class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	void solve(){
		int[] dat ={0, 6000, 4000, 3000, 2000};
		for(int i = 0; i < 4; i++) {
			int n = in.nextInt(), m = in.nextInt();
			System.out.println(dat[n] * m);
		}
	}

}

Measured memory_bytes: 26256
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const sigma = 60;

ll extract(ll mask, ll bit) {
  return (0 < (mask & (1LL << bit)));
}

ll lgpow(ll a, ll b) {
  if(b == 0)
    return 1;
  else if(b == 1)
    return a;
  else {
    ll result = lgpow(a, b / 2);
    if(b % 2 == 0)
      return result * result;
    else
      return result * result * a;
  }
}

int main() {
  ll a, b;
  std::cin >> a >> b;

  if(a == b) {
    std::cout << 1;
    return 0;
  } else {
    ll pos = 0;
    for(ll i = sigma - 1; 0 <= i; i--) {
      if(extract(b, i) == 1 && extract(a, i) == 0) {
        pos = i;
        break;
      }
    }
    ll pos2 = -1;
    for(ll i = pos - 1; 0 <= i; i--) {
      if(extract(b, i) == 1) {
        pos2 = i;
        break;
      }
    }
    ll new_a = (a & (lgpow(2, pos) - 1));
    ll result = lgpow(2, pos) - new_a;

    std::cout << result * 2 + std::min(new_a - 1, lgpow(2, pos2 + 1) - 1) + 1;
  }
  return 0;
}


Measured memory_bytes: 3644
#include<string>
#include<iostream>

using namespace std;

int main() {
	int n ;
	int ans = -1;
	int a[255];
	bool www=true;
	cin >>n;
	for (int i = 0; i < n; i++) cin >> a[i];


	while (www == true) {
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 == 0) {
				a[i] = a[i] / 2;
			}
			else {
				www = false;
			}
		}
		ans++;

	}
		cout << ans  << endl;

	return 0;
}

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

int main(){
	string s;
	cin>>s;
	int res=0;
	int cnt=0;
	int j=-1,k=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'){
			cnt++;
			if(cnt==1)
			j=i;
		}
		if(s[i]=='Z'){
			k=i;
		}
		res=max(res,k-j+1);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 640
function Main(input) {
  var data = input.split('\n');
  var sNum = parseInt(data.shift());
  var sArr = data.shift().split(' ').map(function(i) {
    return parseInt(i);
  });
  var tNum = parseInt(data.shift());
  var tArr = data.shift().split(' ').map(function(i) {
    return parseInt(i);
  });
  
  var cnt = 0;
  tArr.forEach(function(t){
    var start = 0, end = sArr.length - 1;
    while (start <= end) {
      var idx = parseInt((end - start) / 2) + start;
      var sCenter = sArr[idx];
      if (t === sCenter) {
        cnt++;
        break;
      } else if (start !== end) {
        if (t < sCenter) {
          end = idx;
        } else {
          start = idx + 1;
        }
      } else {
        break;
      }
    }
  });
  console.log(cnt);
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35264
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <iterator>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned                    ui;
typedef int                         si;
typedef long                        sl;
typedef long long                   ll;
typedef unsigned long long          ull;

#ifdef LOCALHOST
std::ifstream in("input.txt", std::ifstream::in);
#endif // LOCALHOST

#ifdef LOCALHOST
#define is in
#else
#define is cin
#endif // LOCALHOST

int main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    ll n;
    cin >> n;

    vector<ll> a(n, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<ll> pref_min(n, 1e10);
    for (int i = 0; i < n; ++i) {
        pref_min[i] = a[i];
        if (i > 0) {
            pref_min[i] = min(pref_min[i], pref_min[i - 1]);
        }
    }

    ll answer = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] <= pref_min[i]) {
            answer += 1;
        }
    }
    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <string>

using namespace std; 
int main(){
    int i=0,j=0;
    int m=1,h=1;
    do{
        cin >> m >> h;
        if(m !=0 && h != 0){
            for ( i = 0; i < m; i++){
                for ( j = 0; j < h; j++){
                    cout << "#";
                }
                cout << "\n";
            }
            cout << "\n";
        }
    }while(m !=0 && h != 0);
}


Measured memory_bytes: 3052
def sum_each(n):
    s = 0
    while n != 0:
        s += n % 10
        n = n//10
    return s


n, a, b = map(int, input().split())
s = 0
for i in range (1, n+1):
    if a <=sum_each(i) and sum_each(i) <= b:
        s = s + i
print(s)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    intmax_t N;
    cin >> N;

    intmax_t res = 0;
    for (intmax_t i = 1; i * i <= N; ++i) {
        if (N / i - 1 != 0 && N / (N / i - 1) == (N % (N / i - 1))) {
            res += (N / i - 1);
        }
    }

    cout << res << "\n";

    return 0;
}


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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int x,t;
    cin >> x >> t;
    if (x <=t) {
        cout << 0 << endl;
    }else{
        cout << x-t << endl;
    }

    return 0;
}

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

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
	while(ch>'9' || ch<'0'){
        if(ch=='-') f=-1;
	    ch=getchar();
	}
	while(ch>='0' && ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}

int main(){
	int n=read();
	if(n<1200){
		printf("ABC\n");
	}
	else if(n<2800){
		printf("ARC\n");
	}
	else printf("AGC\n");
	return 0;
}

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

int main(){

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

	int n;
	cin>>n;

	vector< pair<string,long long> > p(n);
	for(int i=0 ; i<n ; ++i)
		cin>>p[i].first>>p[i].second;

	string t;
	cin>>t;

	bool sl=0;
	long long ans=0;

	for(int i=0 ; i<n ; ++i){
		if(sl)	ans += p[i].second;
		if( p[i].first == t )
			sl = 1;
	}

	cout<< ans << '\n';
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a) memset((a),0,sizeof(a))
#define MCLR(a) memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
using namespace std;
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
typedef pair<int,string> PIS;
 
const int INF = 0x3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	string res[10][5] ={
		{"wa","","nn","","wo"},
		{"a","i","u","e","o"},
		{"ka","ki","ku","ke","ko"},
		{"sa","si","su","se","so"},
		{"ta","ti","tu","te","to"},
		{"na","ni","nu","ne","no"},
		{"ha","hi","hu","he","ho"},
		{"ma","mi","mu","me","mo"},
		{"ya","","yu","","yo"},
		{"ra","ri","ru","re","ro"}
	};

	string str;
	cin >> str;
	for(int i=0; i<str.size(); i += 2){
		int idx = str[i]-'0';
		switch(str[i+1]){
		case 'T':
			cout << res[idx][0];
			break;
		case 'L':
			cout << res[idx][1];
			break;
		case 'U':
			cout << res[idx][2];
			break;
		case 'R':
			cout << res[idx][3];
			break;
		case 'D':
			cout << res[idx][4];
			break;
		}
	}
	cout << endl;
}

Measured memory_bytes: 1196
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

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



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d",&a,&b);
	c=a+b;
	if(c>0){
		printf("1\n");
	}
	else if(c<0){
		printf("-1\n");
	}
	else{
		printf("0\n");
	}
	return 0;
}



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

using namespace std;

int main() {
    int n;
    cin>>n;
    vector<pair<int,int> > v;
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        v.push_back({x,y});
    }
    long double dist = 0.0;
    sort(v.begin(),v.end());
    do{
        for(int i=1;i<v.size();i++){
            dist += sqrt((abs(v[i].first-v[i-1].first)*abs(v[i].first-v[i-1].first))+(abs(v[i].second-v[i-1].second)*abs(v[i].second-v[i-1].second)));
        }
    }
    while(next_permutation(v.begin(),v.end()));
    int ans=1;
    for(int i=1;i<=n;i++)
        ans=ans*i;
    cout<<fixed<<setprecision(10)<<(dist/ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vi vector<int>
#define ll long long
#define pb push_back
#define ii pair<int, int>
#define qi queue<int>
#define si stack<int>
#define mii map<int, int>
#define msi map<string, int>
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
using namespace std;

const int MAX = 1e5+5;
const int mod = 1e9+7;

int r, g;

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

	//#ifndef ONLINE_JUDGE
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//#endif

	cin >> r >> g;

	cout << g*2-r << endl;
	

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[10][10];
bool flag[10][10];
bool flag2[10][10];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i = 1;i <= n;i += 2) {
		ll res = 0;
		for (ll j = 1;j <= i;++j) {
			if (i % j == 0)res++;
		}
		if (res == 8)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3524
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
 
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: 3600
#include <bits/stdc++.h>
using namespace std;
 
#define hell 1000000007
#define PI acos(-1.0)
#define S second
#define F first
#define lli long long int
#define li long int
#define ld long double
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
 
#define run(j, n) for(auto ii=j;ii!=n;ii++)
#define out(j, n) for(auto ii=j;ii!=n;ii++) cout<<(*ii)<<" ";


lli fnc(int x, int y, int z)
{
  return 1ll*x*x+1ll*y*y+1ll*z*z+1ll*x*y+1ll*y*z+1ll*z*x;
}

int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << showpoint;
cout << setprecision(11);
#ifndef ONLINE_JUDGE 
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif   

int n;cin>>n;
for(int nm=1;nm<=n;nm++)
{
  int ans = 0;
  for(int i=1;i<=n;i++)
  {
    if(fnc(i, 1, 1)>nm) break;
    for(int j=1;j<=n;j++)
    {
       if(fnc(i, j, 1)>nm) break;
      for(int k=1;k<=n;k++)
      {
          if(fnc(i, j, k)==nm) ans++;
          else if(fnc(i, j, k)>nm) break;
      }
    }
  }
  cout<<ans<<"\n";
}


return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int m;
	cin >> m;
	cout << (48 - m ) << endl;
	ret 0;
}


Measured memory_bytes: 256
from bisect import bisect
f = open(0)
readline = f.readline
N = int(readline())
*A, = map(int, readline().split())
ans = []
def query(Q):
    for k in map(int, f.read().split()):
        idx = bisect(A, k-1)
        if idx < N and A[idx] == k:
            yield "%d %d\n" % (idx, bisect(A, k))
        else:
            yield "%d %d\n" % (idx, idx)
open(1, 'w').writelines(list(query(int(readline()))))


Measured memory_bytes: 40364