akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 200000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  ll dp[2][MAX_N+5] = {0};
  int a,b;
  ll flg=0;
  // if(m == 1) {
    rep(i,m) {
      cin>>a>>b;
      a = (a>b)? b : a;
     if(a==1){
      dp[0][b] = 1; 
     } 
     if(b==n){
      dp[1][a] = 1; 
     }
    }
    repl(i,2,n){
      if(dp[0][i] == dp[1][i] && dp[0][i] == 1) flg = 1;
    }
  // }
  if(!flg) cout<<"IM";
  cout<<"POSSIBLE"<<endl; 
}

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


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;

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

  unordered_map<int, int> stock;
  for(int i = 0; i < N; i++){
    int d;
    cin >> d;
    stock[d]++;
  }

  bool ok = true;
  int M;
  cin >> M;
  for(int i = 0; i < M; i++){
    int t;
    cin >> t;
    if(stock[t] > 0){
      stock[t]--;
    }else{
      ok = false;
    }
  }

  cout << (ok? "YES": "NO") << endl;
}


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

int main() {
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  double A=(h*30)+(m*0.5);
  double B=m*6;
  long double kaku=A-B;
  if(kaku<0) kaku=kaku*(-1);
  if(kaku>=180) kaku=360-kaku;
  kaku=kaku*M_PI/180;
  kaku=cos(kaku);
  double ans=sqrt(a*a+b*b-2*a*b*kaku);
  cout << fixed << setprecision(20) << ans << endl;
}

Measured memory_bytes: 4164
#include <bits/stdc++.h>
#include <stdio.h>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a;
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputDoubleArray(a,N) double a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  string s;
  cin >> s;
  int N = s.length();
  
  int count = 0;
  fN(i,N){
    if(s[i] == 'B') count++;
  }
  
  long ans = 0;
  for(int i=0; i<N; i++){
    if(s[i] == 'B'){//i+1番目からN-count+1番目に移動。
      ans += N-count-i;
      count --;
    }
  }
  output(ans);
  
  return 0;
}

Measured memory_bytes: 640
N = int(input())
A1 = list((map(int, input().split())))
A2 = list((map(int, input().split())))
Cmax = 0
for i in range(N):
    C = sum(A1[:i + 1]) + sum(A2[i:])
    Cmax = max(Cmax, C)
print(Cmax)

Measured memory_bytes: 38512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,j,k,h,w,min,ans,mat[700][700],max[700][700];
char c;

int main(){
	while(scanf("%d %d",&h,&w)*h*w){
		for(i=0;i<h;i++){
			k=0;
			scanf("\n");
			for(j=0;j<w;j++){
				scanf("%c",&c);
				if(c=='.')k++; else k=0;
				mat[i][j]=k;
			}
		}

		ans=0;
		for(j=w-1;j>=0 && (j+1)*h>ans ;j--){
			for(k=h-1;k>=0;k--){
				min=mat[k][j];
				if(min==0 || min*(h-k)<=ans)continue;
				for(i=1;i+k<h;i++){
					if(min>mat[i+k][j])min=mat[i+k][j];
					if(min==0)break;
					if(min*(i+1)>ans)ans=min*(i+1);
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1972
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  map<int,int>m;
  for (int i = 0; i < n-1; ++i)
  {
    int a;
    cin >> a;
    m[a]++;
  }
  for (int i = 1; i <= n; ++i)
  {
    cout << m[i] << endl;
  }
  return 0;
}


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

int main(){
    int n,x,m;
    cin >> n >> x;
    int _min=10000,sum=0;

    for(int i=0; i<n; i++){
        cin >> m;
        _min = min(_min, m);
        sum += m;
    }
    cout << ((x-sum) / _min) + n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

template<int L>
struct GaussJordan_Binary {
    using Row = bitset<L>;
    vector<Row> B;
    void gauss_jordan() {
        int n = B.size();
        for (int i = 0, j = 0; i < n; ++i, ++j) {
            for (int k = 0; j < L; ++j) {
                for (k = i; k < n; ++k) if (B[k][j]) break;
                if (k == n) continue;
                else if (k != i) swap(B[i], B[k]);
                break;
            }
            if (j == L) break;
            for (int k = 0; k < n; ++k) if (k != i && B[k][j]) B[k] ^= B[i];
        }
    }
};

int main() {
    int T;
    cin >> T;
    vector<int> ans(T);

    vector<ll> A;
    GaussJordan_Binary<60> gj;

    rep(t, T) {
        int N;
        cin >> N;
        A.resize(N);
        rep(i, N) cin >> A[i];
        string S;
        cin >> S;

        for (int i = N - 1; i >= 0; --i) {
            if (S[i] == '0') continue;

            gj.B.clear();
            rep(j, i + 1, N) {
                if (S[j] == '0') gj.B.emplace_back(A[j]);
            }
            gj.gauss_jordan();

            GaussJordan_Binary<60>::Row a(A[i]), b(0);
            for (int j = 0, k = 0; k < 60; ++k) {
                if ((a ^ b)[k]) {
                    for (; j < (int)gj.B.size(); ++j) {
                        if (gj.B[j][k]) break;
                    }
                    if (j == (int)gj.B.size()) break;
                    b ^= gj.B[j];
                    ++j;
                }
            }
            ans[t] |= a != b;
        }
    }

    for (int x : ans) write(x);
}


Measured memory_bytes: 3604
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<Character> set  = new HashSet<>();
        for (char c  : s.toCharArray()) {
            set.add(c);
        }

        for (int i = 0; i < 26; i++) {
            char c = (char) ('a' + i);
            if (!set.contains(c)) {
                System.out.println(c);
                return;
            }
        }

        System.out.println("None");
    }
}

Measured memory_bytes: 26072
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 100000

int main(){
    int n, m;
    vector<int> a(6, 0);
    vector<int>cost(6, 0);
    cin >> n >> m;
    rep(i, m){
        int x;
        scanf("%d", &x);
        if(x == 1){
            a[0] = x;
            cost[0] = 2;
        }
        else if(x == 7){
            a[1] = x;
            cost[1] = 3;
        }
        else if(x == 8){
            a[5] = x;
            cost[5] = 7;
        }
        else if(x == 4){
            a[2] = x;
            cost[2] = 4;
        }
        else if(x == 6 || x == 9){
            a[4] = max(a[4], x);
            cost[4] = 6;
         }
         else {
             a[3] = max(a[3], x);
             cost[3] = 5;
         }

    }
    int no = 0;
    while(no < a.size()){
        if(a[no] == 0){
            a.erase(a.begin()+no);
            cost.erase(cost.begin()+no);
        }
        else no++;
    }
    
    ll dp[cost.size()+1][n+1];
    rep(i, n+1)dp[0][i] = -INF;
    rep(i, cost.size()+1)dp[i][0] = 0;
    rep(i, cost.size())rep(j, n){
        if(j+1 < cost[i])dp[i+1][j+1] = dp[i][j+1];
        else {
            dp[i+1][j+1] = max(dp[i+1][j+1-cost[i]]+1, dp[i][j+1]);

        }
    }
    vector<int> ord(cost.size());
    iota(ALL(ord), 0);
    sort(ALL(ord), [&](int x, int y){
        return a[x] > a[y];
    });
    vector<int> res;
    ll keta = dp[cost.size()][n];
    int pos = n;

    while(keta != 0){
        rep(i, cost .size()){
            if(pos < cost[ord[i]])continue;
            if(keta-1 == dp[cost.size()][pos - cost[ord[i]]]){
                res.push_back(a[ord[i]]);
                keta -= 1;
                pos -=  cost[ord[i]];
                break;
            }
        }
    }
    //sort(ALL(res), greater<int>());
    rep(i, res.size())cout << res[i];
    
    

}

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

typedef long long ll;

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

    int k,x;
    cin >> k >> x;
    if(500*k>=x) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long UL;
const int Mod=1e9+7;
const int INF=0x3f3f3f3f;

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
#endif
	string s="ACL";
	int n;
	cin>>n;
	while(n--)
		cout<<s;
	cout<<endl; 
    return 0;
}

Measured memory_bytes: 3548
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    int ans = 0;
    for(int B = 1; B < N; B++) {
        int t = N % B;
        int i = 0;
        while (1) {
            int C = B * i + t;
            if (N <= C) break;
            if (C > 0) {
                int A = (N - C) / B;
                if (A > 0) {
                    //if (A * B + C == N) {
                    //cout << A << " " << B << " " << C << " " << endl;
                    //cout << B << " " << A << " " << C << " " << endl;
                    //cout << A * B + C << endl;
                    ans++;
                    //}
                }
            }
            i++;
        }
    }
    //REP(C, 1, N) {
    //    for (int B = 1; B * B <= (N - C); B++) {
    //        if ((N - C) % B == 0) {
    //            if (B * B == N - C)
    //                ans += 1;
    //            else
    //                ans += 2;
    //        }
    //    }
    //}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define PI 3.141592653589793

ll x_power_y (int x, int y) {
	ll ans = 1ll;
	if (x == 1) return ans;
	while (y > 0) {
		if (y&1) {
			ans = (ans*x)%hell;
		}
		y>>=1;
		x = (1ll*x*x)%hell;
	}
	ans %= hell;
	return ans;
}

int main() 
{	ios;
	int t = 1;
	//cin>>t;
	while (t--) {
		int n, k;
		cin>>n>>k;
		ll dp[k+1];
		for (int h = k; h >= 1; --h) {
			int base = k/h;
			dp[h] = x_power_y(base, n);
			for (int mul = 2; h*mul <= k; mul++) {
				dp[h] = (dp[h] - dp[h*mul]+hell)%hell;
			}
		}
		ll sum = 0;
		for (int i = 1; i <= k; i++) {
			sum = (sum + i*dp[i])%hell;
		}
		cout<<sum;
		cout<<"\n";
	}
    return 0; 
} 


Measured memory_bytes: 4364
#39 C - When I hit my pocket...
K,A,B = map(int,input().split())

if B <= A:
    ans = K + 1
else:
    nock = A - 1 + 2
    lest = K - nock
    ans = B + (lest//2)*(B-A) + (lest%2)*1
    ans = max(K+1,ans)
print(ans)

Measured memory_bytes: 9100
// https://atcoder.jp/contests/abc147/tasks/abc147_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

template <int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod)
            x -= mod;
    }
    ModInt &operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0)
            x += mod;
        return *this;
    }
    ModInt &operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt &operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
    friend ostream &operator<<(ostream &s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream &operator>>(istream &s, ModInt<mod> &a) {
        s >> a.x;
        return s;
    }
};
using mint = ModInt<(int)1e9 + 7>;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> v(N);
    for (auto &x : v) {
        cin >> x;
    }

    mint res = 0;
    REP(d, 60) {
        int n0 = 0, n1 = 0;
        for (auto &x : v) {
            if (x >> d & 1) {
                n1++;
            } else {
                n0++;
            }
        }
        mint msk = (1LL << d);
        res += msk * n0 * n1;
    }
    cout << res << endl;
    return 0;
}


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

int n;
long double dp[4096][4096], p[4096];
int vis[4096][4096];

long double calc(int pos, int heads) {
    if(heads < 0) heads = 0;
    long double &y = dp[pos][heads];
    if(vis[pos][heads]) return y;
    vis[pos][heads] = 1;
    if(pos == 0) return y = (heads == 0);
    return y = p[pos] * calc(pos-1, heads-1) + (1-p[pos])*calc(pos-1, heads);
}

int main() {
	cin >> n;
	for(int i=1; i<=n; ++i) {
	    cin >> p[i];
	}
	printf("%.11Lf\n", calc(n, (n+1)/2));
	return 0;
}


Measured memory_bytes: 82736
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

ll A, B;
set<ll>a, b;

int main() {
	cin >> A >> B;
	a.insert(1);
	b.insert(1);
	for (ll i = 2; i*i <= A; ++i) {
		if (A%i == 0) {
			a.insert(i);
			while (A%i == 0) {
				A /= i;
			}
		}
	}
	a.insert(A);
	for (ll i = 2; i*i <= B; ++i) {
		if (B%i == 0) {
			b.insert(i);
			while (B%i == 0) {
				B /= i;
			}
		}
	}
	b.insert(B);
	int cnt = 0;
	for (ll i : a) {
		if (b.find(i) != b.end()) {
			++cnt;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
dp = [10**9 + 7] * n
dp[0] = 0
for i in range(n):
    for j in [i+1, i+2]:
        if j < n:
            dp[j] = min(dp[i] + abs(h[i] - h[j]), dp[j])
result = dp[n-1]
print(result)

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

int main(void){
    string S;
    cin >> S;
    ll sum = 0;
    for(int tmp = 0; tmp < (1 << (S.size()-1)); tmp++){
        bitset<9> b(tmp);
        ll h = S[0] - '0';
        for(int i=1;i<S.size(); i++){
            if(b.test(i-1)){
                sum += h;
                h = S[i] - '0';
            }else{
                h = h * 10 + S[i] - '0';
            }
        }
        sum += h;
    }
    cout << sum << endl;
    return 0;
}

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

void makeset(int n,vector<list <int> > &set){
    set.resize(n);
    for(int i=0;i<n;i++){
        set[i].push_back(i);
    }
}

void unite(vector<list<int> > &set,int x,int y,int n){
    list<int>::iterator itr;
    int idx1=-1,idx2=-1;
    for(int i=0;i<n;i++){
        if(set[i].empty())continue;
        for(itr=set[i].begin();itr!=set[i].end();itr++){
            if(*itr==x)idx1=i;
            if(*itr==y)idx2=i;
        }
        if(idx1!=-1&&idx2!=-1)break;
    }
    if(idx1==idx2)return;
    set[idx1].merge(set[idx2]);
    set[idx2].clear();
}

void same(vector<list<int> > &set,int x,int y,int n){
    list<int>::iterator itr;
    int idx1=-1,idx2=-1;
    for(int i=0;i<n;i++){
        if(set[i].empty())continue;
        for(itr=set[i].begin();itr!=set[i].end();itr++){
            if(*itr==x)idx1=i;
            if(*itr==y)idx2=i;
        }
        if(idx1!=-1&&idx2!=-1)break;
    }
    if(idx1==idx2)cout<<'1'<<endl;
    else cout<<'0'<<endl;
}


int main(void){
    int n,q,x,y,c;
    cin>>n>>q;
    vector<list <int> > set; 
    makeset(n,set);
    for(int i=0;i<q;i++){
        cin>>c>>x>>y;
        if(c==0)unite(set,x,y,n);
        else same(set,x,y,n);
    }
}


Measured memory_bytes: 3412
input = readlines()
n, d = input.shift.chomp.split("\s").map{|x| x.to_i}

cnt = 0
input.each do |l|
  x, y = l.chomp.split("\s").map{|x| x.to_i}
  dist = Math.sqrt(x*x + y*y)
  cnt += 1 if dist <= d
end

puts cnt


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

int main() {
  int n; cin >> n;
  int ans = 0;
  vector<int> l(n);
  for(int i=0; i<n; i++) cin >> l[i];
  // lを昇順でソート
  sort(l.begin(), l.end());
  // 最も長い辺と、2番目に長い辺を固定して考える
  for(int i=n-1; i>=2; i--){
    for(int j=i-1; j>=1; j--) {
      // 3番目に長い辺は、l[i]-l[j]より長くあればよい
      // それがいくつ存在するかを、二分探索法で求める
      int ng = -1;
      int ok = j;
      while(abs(ok-ng)>1) {
        int mid = (ok+ng)/2;
        if(l[mid]>l[i]-l[j]) ok = mid;
        else ng = mid;
      }
      ans+=j-ok;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
def solve(n):
    if n < 10:
        return n
    elif n >= 10 and n < 100:
        return 9
    elif n >= 1000 and n < 10000:
        return 909
    elif n == 10**5:
        return 90909

    aux =  n - (10**(len(str(n)) -1)) + 1
    return aux + solve(10**(len(str(n)) -1)-1)

n = int(input())

ans = solve(n)
print(ans)


Measured memory_bytes: 3060
/*
problem's name:
statue:
writer:Patrick_y
*/
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#include <cctype>
#include <sstream>
#include <math.h>
#include <stdio.h>
#include <time.h>
#define mp make_pair
typedef long long ll;
using namespace std;
const int INF=20050208;
/*------------main part------------*/



ll sum[2000005];
int main()
{
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>sum[i];
	}
	for(ll i=1;i<=n;i++)
	{
		sum[i]+=sum[i-1];
	}
	sort(sum,sum+n+1);
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		if(sum[i]==sum[i-1])
		{
			ll beg=i-1;
			while(sum[i]==sum[i-1] and i<=n)
			{
				i++;
			}
			ll end=i-1;
			//cout<<beg<<" "<<end<<endl;
			ll a=end-beg+1;
			//cout<<a<<endl;
			ans+=a*(a-1)/2;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            iN = 48 - iN;

            // 出力
            Console.WriteLine("{0}", iN.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 11220
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define BIT(n, m) (((n) >> (m)) & 1)

typedef long long ll;
typedef vector<ll> Vec;
typedef vector<Vec> Mat;
typedef pair<int, int> PI;

const ll inf = 1e15;
const ll mod = 1000 * 1000 * 1000 + 9;
const double eps = 1e-9;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}

Mat matmul(const Mat &A, const Mat &B){
  Mat C(A.size(), Vec(B[0].size(), 0));
  REP(i, A.size()) REP(k, A[i].size()) REP(j, B[k].size()){
    C[i][j] += A[i][k] * B[k][j];
    C[i][j] %= mod;
  }
  return C;
}

Mat matpow(Mat A, ll n){
  Mat B(A.size(), Vec(A[0].size(), 0));
  REP(i, A.size()) B[i][i] = 1;

  while (n){
    if (n & 1) B = matmul(B, A);
    n >>= 1;
    A = matmul(A, A);
  }
  return B;
}

void go(vector<ll> &curr, vector<ll> &next, ll diff){
  int w = curr.size();
  Mat m(w, Vec(w, 0));
  REP(i, w) REP(j, 3) if (0 <= i + j - 1 && i + j - 1 < w){
    m[i][i + j - 1] = 1;
  }
  m = matpow(m, diff);
  
  REP(i, w) REP(j, w){
    next[i] += m[i][j] * curr[j];
    next[i] %= mod;
  }
}

int main(){
  ll W, H, N, T = 0;
  while (cin >> W >> H >> N && W + H + N){
    T++;
    vector<ll> X(N), Y(N);
    REP(i, N) cin  >> X[i] >> Y[i];
    
    vector<ll> ys = Y;
    ys.push_back(1);
    ys.push_back(H);
    sort(ALL(ys));
    ys.erase(unique(ALL(ys)), ys.end());
    
    vector<vector<ll> > dp(ys.size(), vector<ll>(W));
    dp[0][0] = 1;
    REP(i, ys.size() - 1){
      go(dp[i], dp[i + 1], ys[i + 1] - ys[i]);
      REP(j, N){
        if (ys[i + 1] == Y[j]) dp[i + 1][X[j] - 1] = 0;
      }
    }
    cout << "Case " << T << ": " << dp[ys.size() - 1][W - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1416
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int d[1010];

int main(void){
	int i;

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

	int N,M,A,B;
	cin >> N >> M >> A >> B;
	for(i=1;i<=N;i++) cin >> d[i];

	vector<int>v;
	for(i=1;i<=N;i++){
		if(d[i]>=A) v.push_back(d[i]);
		else break;
	}

	int s=v.size();
	if(N-s>=M){
		cout << s << endl;
		return 0;
	}

	reverse(v.begin(),v.end());
	int x=s;
	for(i=0;i<s;i++){
		if(v[i]<=B) x--;
		else break;
	}

	cout << x << endl;

	return 0;
}

Measured memory_bytes: 1232
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
blue = []
red = []
for i in range(n):
    s = input()
    blue.append(s)
m = int(input())
for i in range(m):
    t = input()
    red.append(t)
for i in range(n):
    c = blue[i]
    chk = blue.count(c) - red.count(c)
    if chk > ans:
        ans = chk
print(ans)

Measured memory_bytes: 9380
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    L = list(map(int, input().split()))

    if N < 3:
        print(0)
        return

    ans = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            if L[i] == L[j]:
                continue
            for k in range(j + 1, N):
                if L[i] == L[k] or L[j] == L[k]:
                    continue
                a = sorted([L[i], L[j], L[k]])
                if a[0] + a[1] > a[2]:
                    ans += 1
    print(ans)


main()


Measured memory_bytes: 9212
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
using namespace std;

int main(void) {
	int A, B;
	cin >> A >> B;

	if (A == 1 || B == 1) {
		if (A == 1 && B == 1) {
			cout << "Draw" << endl;
		}
		else if (A == 1) {
			cout << "Alice" << endl;
		}
		else {
			cout << "Bob" << endl;
		}
	}
	else {
		if (A ==B) {
			cout << "Draw" << endl;
		}
		else if (A>B) {
			cout << "Alice" << endl;
		}
		else {
			cout << "Bob" << endl;
		}
	}
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define float long double 
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
signed main(){
	IOS;
	int n;
	cin >> n ;
	cout << (n+1)/2 << endl ;
	return 0;
}







Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			PriorityQueue<Robot> pq = new PriorityQueue<>((o1, o2) -> {
				return Integer.compare(o1.end, o2.end);
			});
			for(int i = 0 ; i < n ; i++) {
				int x = sc.nextInt();
				int l = sc.nextInt();
				pq.add(new Robot(x - l + 1, x + l));
			}
			int ans = n;
			Robot before = null;
			while(!pq.isEmpty()) {
				if(before == null) {
					before = pq.poll();
				} else {
					Robot current = pq.poll();
					if(before.end >= current.start) {
						ans--;
					} else {
						before = current;
					}
				}
			}

			System.out.println(ans);
		}

	}

	private static class Robot {
		int start;
		int end;
		private Robot(int start, int end) {
			this.start = start;
			this.end = end;
		}
	}

}


Measured memory_bytes: 92304
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

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

// constexpr inline ll mod = 1'000'000'007;
constexpr int max_n = 100'000 + 5;
int n;
vector<ll> as(max_n),bs(max_n),cs(max_n);
vector<ll> num_cs(max_n);
ll res;

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(10); // 浮動小数の表示の精度

    // 18:18
    // 18:21
    cin>>n;
    rep(i,n){
        cin>>as[i];
    }
    as.resize(n);
    sort(as.begin(),as.end());
    rep(i, n)
    {
        cin >> bs[i];
    }
    bs.resize(n);
    sort(bs.begin(), bs.end());
    rep(i, n)
    {
        cin >> cs[i];
    }
    cs.resize(n);
    sort(cs.begin(), cs.end());

    num_cs[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        int b = bs[i];
        auto lb = lower_bound(cs.begin(), cs.end(), b+1);
        num_cs[i] = num_cs[i+1] + (cs.end() - lb);
    }
    rep(i, n){
        int a = as[i];
        auto lb = lower_bound(bs.begin(),bs.end(),a+1);
        res += num_cs[lb - bs.begin()];
    }
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 6232
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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;}

vi edges[200200];
ll sum[200200];

void dfs(int i, int p){
    for(int j : edges[i]){
        if(j == p) continue;
        sum[j] += sum[i];
        dfs(j, i);
    }
}

int main(){
    int n, q;
    cin >> n >> q;
    int a, b;
    rep(i, n-1){
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }
    int p, x;
    rep(i, q){
        cin >> p >> x;
        sum[p-1] += x;
    }
    dfs(0, -1);
    rep(i, n){
        if(i != n-1)
        cout << sum[i] << " ";
        else
        cout << sum[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 24320
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

int[int][2000] MEMO;
int N, Z, W;

void main()
{
    auto nzw = readln.split.to!(int[]);
    N = nzw[0];
    Z = nzw[1];
    W = nzw[2];
    auto AS = readln.split.to!(int[]);

    int solve(int i, int t, int z, int w) {
        if (i == N) return abs(z - w).to!int;

        auto key = t > 0 ? w : z * t;
        if (key in MEMO[i]) return MEMO[i][key];

        auto ret = t > 0 ? 0 : int.max;
        foreach (j; i..N) {
            if (t > 0) {
                z = AS[j];
                ret = max(ret, solve(j+1, -t, z, w));
            } else {
                w = AS[j];
                ret = min(ret, solve(j+1, -t, z, w));
            }
        }
        return MEMO[i][key] = ret;
    }

    writeln(solve(0, 1, Z, W));
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,c=0;
	cin>>n;
	for(int i=1;i<=4;i++){
		if(n%10==2){
			c++;
		}
		n/=10;
	}
	cout<<c;
	return 0; 
} 
 


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int a, b;
    cin >> a >> b;
    cout << ((a*b)%2 == 0 ? "Even" : "Odd") << endl;
}

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

typedef long long ll; 
ll m=1e9+7;
ll dp[1002][1002];


int main(){
  ll n,k;
  cin>>n>>k;
  dp[0][0]=1;

  for(int i=0;i<=n;i++)
    for(int j=0;j<=k;j++){
      if(j)dp[i][j]+=dp[i][j-1];
      if((i||j)&&i-j>=0)dp[i][j]+=dp[i-j][j];
      dp[i][j]%=m;
    }
  
  cout<<dp[n][k]<<endl;
  return 0;
}




Measured memory_bytes: 10900
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<long long,bool> Pair;

int main(){

long long N,A;

cin >> N;

vector<ll> ANS(N+1);

for(int i = 1;i < N;++i){

    cin >> A;

    ANS[A]++;

}

for(int i = 1;i <= N;++i) cout << ANS[i] << endl;

return 0;

}   


Measured memory_bytes: 4844
#include<iostream>
#include<cstdio>
#define N 101
using namespace std;

int main(){

  int n,n2,data,u;
  int g[N][N]; 
 //load n
  cin >>n;

  //initialize
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=0;
    }
  }

  //load data
  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&n2);
    for(int j=0;j<n2;j++){
      scanf("%d",&data);
      g[u][data]=1;
    }
  }
  //print
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      printf("%d",g[i][j]);
      if(j!=n)printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=2000+10;
const int inf=1e18;
int n,a[maxn],b[maxn],x,sum,ans=inf;

signed main()
{
    scanf("%lld%lld",&n,&x);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    for(int i=0;i<n;i++) b[i]=inf;
    for(int i=0;i<n;i++){
        sum=0;
        for(int j=0;j<n;j++) b[j]=min(b[j],a[(j-i+n)%n]);
        for(int j=0;j<n;j++) sum+=b[j];
        ans=min(ans,sum+i*x); 
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC175
{
    class Program
    {
        static void Main(string[] args)
        {
            a();
        }

        public static void a()
        {
            string s = Console.ReadLine();
            int ans = 0;
            if (s[0] == 'R')
                ans = 1;
            if (s[1] == 'R')
                ans = 1;
            if (s[2] == 'R')
                ans = 1;
            if (s[0] == 'R' && s[1] == 'R')
                ans = 2;
            if (s[1] == 'R' && s[2] == 'R')
                ans = 2;
            if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R')
                ans = 3;
            Console.WriteLine(ans);
        }
    }
}


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

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> data(H,vector<char>(W)),ans(2*H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> data.at(i).at(j);
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ans.at(2*i).at(j) = data.at(i).at(j);
      ans.at(2*i+1).at(j) = data.at(i).at(j);
    }
  }
  for(int i=0;i<2*H;i++){
    for(int j=0;j<W;j++){
      cout<<ans.at(i).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	ll H,W; cin >> H >> W;
	
	ll ans = 0;
	if (H%2LL==0 && W%2LL==0) {
		ans = W/2LL*H;
	} else if (H%2LL==1 && W%2LL==0) {
		ans = W/2LL * H;
	} else if (H%2LL==0 && W%2LL==1) {
		ans = H/2LL * W;
	} else {
		ans = H/2LL*W + (W+1LL)/2LL;
	}
	if (H==1 || W==1) ans = 1;
	cout << ans << ln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
  while (true) {
    int h, w;
    cin >> h >> w;

    if (h == 0 && w == 0) break;

    REP(i, h) {
      REP(j, w) {
        cout << "#";
      }
      cout << "\n";
    }
    cout << "\n";
  }
}


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,P,x,sum,get;
  sum = 0;
  cin>>N>>P;

  for(int i = 0 ; i < P ; i++){
    cin>>x;
    sum += x;
  }
  get = sum / (N+1);

  if(sum % (N+1)!= 0 ){
    get = get + 1;
    cout<<get<<endl;
  }else{
    cout<<get<<endl;
  }
  return 0;
}
  



Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <string>
#include <climits>
using namespace std;

int a[5], ans = INT_MAX;

int check(string key)
{
    int time = 0;

    for (int i = 0; i < 5; i++)
    {
        //cout << (int)(key[i] - '0');

        if (time % 10 != 0)
            time = (time / 10 + 1) * 10;

        time += a[(int)(key[i] - '0')];
    }

    //cout << endl;

    return time;
}

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

    string key = "01234";

    for (int i = 0; i < 5; i++)
        cin >> a[i];

    do
    {
        int current = check(key);

        ans = min(ans, current);
    } while (next_permutation(key.begin(), key.end()));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,arr[1000];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll counter=0;
    //sort(arr,arr+n);
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if((arr[i]+arr[j]>arr[k])&&(arr[j]+arr[k]>arr[i])&&(arr[i]+arr[k]>arr[j])&&(arr[i]!=arr[j])&&(arr[j]!=arr[k])&&(arr[i]!=arr[k]))
                {
                    counter++;

                }
            }
        }
    }
    cout<<counter<<'\n';
    return 0;
}

Measured memory_bytes: 3640
using System;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int q = int.Parse(Console.ReadLine());
        var x = new long[100001];
        for (int i = 0; i < n; i++) x[a[i]]++;
        long ans = 0;
        for (int i = 0; i < 100001; i++) ans += i * x[i];
        for (int i = 0; i < q; i++)
        {
            var bc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            long b = bc[0], c = bc[1];
            ans += (c - b) * x[b];
            Console.WriteLine(ans);
            x[c] += x[b];
            x[b] = 0;
        }
    }
}

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

int main() {
    ll n;
    cin >> n;

    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> bin;

    while (n != 0) {
        if (n % 2 != 0) {
            bin.push_back(1);
            n--;
        } else {
            bin.push_back(0);
        }
        n /= -2;
    }

    for (int i = bin.size() - 1; i >= 0; i--) {
        cout << bin[i];
    }
    cout << endl;

    return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int l[252];

int main(){
  scanf("%d",&n);
  REP(i,2*n)scanf("%d",l+i);
  sort(l,l+2*n);
  int a=0;
  REP(i,n)a += l[2*i];
  printf("%d\n",a);
  return 0;
}


Measured memory_bytes: 256