akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n>>1;
    }
    return result;
}



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

    int x,n;
    cin>>x>>n;
    int a[n];
    unordered_map<int,int> mp;
    for(int i=0;i<n;i++)
    {
    	cin>>a[i];
    	mp[a[i]]++;
    }

    int p=0;
    while(true)
    {
    	if(mp[x-p]==0)
    	{
    		cout<<x-p<<endl;
    		return 0;
    	}

    	if(mp[x+p]==0)
    	{
    		cout<<x+p<<endl;
    		return 0;
    	}

    	p++;
    }
    
    return 0;
}

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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)
#define REP(i, n, m) for (long long i = (long long)(n); i < (long long)(m); i++)

namespace solver {
  using namespace std;
  typedef long long ll;

  ll N, buffer[10];
  string alphabet = "abcdefghijklmnopqrstuvwxyz";

  void init() {
    scanf("%lld", &N);
  }

  void rec(ll cur, ll maxv) {
    if(cur == N) {
      rep(i, N) cout << alphabet[buffer[i]];
      cout << endl;
      return;
    }
    rep0c(i, maxv) {
      buffer[cur] = i;
      rec(cur+1, max(maxv, i+1));
    }
  }

  void solve() {
    buffer[0] = 0;
    rec(1, 1);
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 1536
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {//階乗、その逆元も存在する。
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n,int k){
  return fact[n]*ifact[n-k];
  }
}comb(100005);//100005まで計算（どこまで必要かで変更）

int main(){

int N;
string S;
cin>>N>>S;
map<char,int> m;
rep(i,N){
    m[S[i]]++;
}
mint ans=1;
for(char i = 'a';i<='z';i++){
    ans*=m[(char)(i)]+1;
}
cout<<ans-1<<endl;


return 0;
}

Measured memory_bytes: 5064
#include <bits/stdc++.h>
using namespace std;
using P=pair<int,int>;
int main(){
    int N,a=0,b=0,A,B;
    string S;
    vector<P> Bracketfirst(0),Bracketsecond(0);
    cin>>N;
    for(int i=0;i<N;i++){
        A=0,B=0;
        cin>>S;
        for(int j=0;j<(int)S.size();j++){
            if(S.at(j)=='('){A++;}
            else{
                if(A>0){A--;}
                else{B++;}
            }
        }
        if(A>=B){Bracketfirst.push_back(make_pair(B,A));}
        else{Bracketsecond.push_back(make_pair(A,B));}
    }
    sort(Bracketfirst.begin(),Bracketfirst.end());
    sort(Bracketsecond.begin(),Bracketsecond.end());
    reverse(Bracketsecond.begin(),Bracketsecond.end());
    for(int i=0;i<(int)Bracketfirst.size();i++){
        for(int j=0;j<Bracketfirst.at(i).first;j++){b++;}
        if(a<b){cout<<"No"<<endl;return 0;}
        for(int j=0;j<Bracketfirst.at(i).second;j++){a++;}
    }
    for(int i=0;i<(int)Bracketsecond.size();i++){
        for(int j=0;j<Bracketsecond.at(i).second;j++){b++;}
        if(a<b){cout<<"No"<<endl;return 0;}
        for(int j=0;j<Bracketsecond.at(i).first;j++){a++;}
    }
    if(a==b){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
}

Measured memory_bytes: 11244
// #define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector<lint> a(n); std::cin>>a;
  std::partial_sum(all(a), a.begin());
  a.insert(a.begin(), 0);
  lint sum = a.back();

  lint ans = std::numeric_limits<lint>::max();
  rep(i,1,n) {
    lint x = a.at(i);
    lint y = sum - x;
    lint d = x - y;
    if (d < 0) d = -d;
    cmn(ans, d);
  }
  std::cout << ans << std::endl;
  return 0;
}

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

int main(){

  string INPUT; // input string
  cin >> INPUT; 

  int A, B, C, D;
  A = INPUT[0] - '0';
  B = INPUT[1] - '0';
  C = INPUT[2] - '0';
  D = INPUT[3] - '0';

  vector<int> num = {A, B, C, D};
  vector<char> op = {'+', '-'};

  // loop 2^3 = 8
  for (int i = 0; i < (1 << 3); i++) {
    int sum = A;
    // bit search
    for (int j = 0; j < 3; j++) {
      if (i >> j & 1) {
        sum -= num[j + 1];
      }
      else {
        sum += num[j + 1];
      }
    }
    if (sum == 7) {
      cout << A;
      for (int k = 0; k < 3; k++) {
        cout << op[(i >> k) & 1] << num[k + 1];
        if (k == 2) {
          cout << "=7" << endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 256
# coding: utf-8

# ????´¢????±? W
target_word = input()
# ??????
words = []
while (1):
    input_text = input().strip()
    if (input_text == 'END_OF_TEXT'):
        break
    words.extend(input_text.split())

counter = 0
for w in words:
    if (w.lower() == target_word.lower()):
        counter += 1

print(counter)

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

using ll = long long;
using pii = pair<int, int>;

int main() {
    int x;
    double p;
    cin >> x >> p;
    p /= 100;
    double res = 0;
    if(x & 1) {
        res = 1 + (x - 1.0) / 2 + (1 - p) * (x + 1.0) / 2 / p;
    } else {
        res = x / 2.0 / p;
    }
    cout << fixed << setprecision(10) << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    if(k==1){
        cout << 0 << endl;
    }
    else{
        cout << n-k << endl;
    }
}

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

using namespace std;

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define INF 1e18
#define eps 0.00001
#define le length
#define debug(n1) cout << n1 << endl
#define rep(i , j , n) for(ll i = j ; i <= n ; i++)
#define per(i , j , n) for(ll i = j ; i >= n ; i--)
const ll N = 2e3 + 5;
const ll M = 1e7 + 5;
const ll mod = 1e18 + 7;
ll MODULAR_POWER(ll a , ll b , ll MOD) {
    if(b == 0) return 1LL;
    ll d = MODULAR_POWER(a , b / 2 , MOD);
    d *= d;
    d %= MOD;
    if(b % 2) d *= a;
    d %= MOD;
    return d;
}
ll BINARY_SEARCH(ll dp[] , ll n , ll key) {
    ll s = 1;
    ll e = n;
    while(s <= e) {
        ll mid = (s + e) / 2;
        if(dp[mid] == key) return mid;
        else if (dp[mid] > key) e = mid - 1;
        else s = mid + 1;
    }
    return -1;
}
string CONVERT_TO_BINARY(ll s) {
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}
bool PALIN(string s) {
    int i = 0;
    int j = s.le() - 1;
    while(i <= j) {
        if(s[i] != s[j]) return false;
        j-- , i++;
    }
    return true;
}
ll n , z , w;
ll a[N];
int main() {
    SPEED;
    cout.precision(8);
    cout << fixed;
    ll r , g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
    return 0;
}

Measured memory_bytes: 256
#define SUBMIT

#include <bits/stdc++.h>

using namespace std;

template <typename T>
size_t count_n_digits(T x) {
    string str = to_string(x);
    return str.length();
}

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(9876543210
)");
#endif
    int64_t N;
    in >> N;

    auto ans = count_n_digits(N);
    for (int64_t A = 1; A * A <= N; ++A) {
        if (N % A != 0) continue;
        const int64_t B = N / A;
        ans = min(ans, max(count_n_digits(A), count_n_digits(B)));
    }

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

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int a,b;
int i=1;
while(1){
scanf("%d %d",&a,&b);
if(a==0&&b==0) break;
if(b<a){
printf("%d %d\n",b,a);
}
else{printf("%d %d\n",a,b);}
}
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll ans = 0;
    string s1 = "CODEFESTIVAL2016";
    rep(i,0,16){
        if(s[i] != s1[i]) ans++;
    }
    print(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;
 
const int N = 100000;
 
signed main() {
 
    int n, k; cin >> n >> k;
    int a[n + 1];
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    
    vector<int> dp(n + 1, (1LL << 40));
    dp[1] = 0LL;
    for(int i = 2; i <= n; i++) {
        for(int j = 1; j <= k; j++) {
            if(i - j >= 1) dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
        }
    }
    
    cout << dp[n] << endl;
 
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

int main(){
	int H,W;
	while(1){
		std::cin >> H >> W;
		
		if(H == 0 && W ==0){break;}

		for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			std::cout << "#";
		}
		std::cout << std::endl;
		}
		std::cout << std::endl;
	}
}

Measured memory_bytes: 1152
n, m = gets.chomp.split.map(&:to_i)
arr = Array.new(n)
n.times do |i|
	arr[i] = gets.chomp.split.map(&:to_i)
end

arr = arr.sort{|a,b| a[0] <=> b[0]}
mon = 0
cnt = 0
n.times do |i|
	if arr[i][1] + cnt >= m
		mon += arr[i][0] * (m - cnt)
		break
	else
		mon += arr[i][0] * arr[i][1]
		cnt += arr[i][1]
	end
end
puts mon



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl

typedef long long LL;
typedef long double LD;

bool ism(int x){
  return (1<=x&&x<=12);
}

int main(){
  string s;
  cin >> s;
  int a=stoi(s.substr(0,2)),b=stoi(s.substr(2,2));
  if(ism(a)){
    if(ism(b)){
      cout << "AMBIGUOUS" << endl;
    }else{
      cout << "MMYY" << endl;
    }
  }else{
    if(ism(b)){
      cout << "YYMM" << endl;
    }else{
      cout << "NA" << endl;
    }
  }
  return 0;
}


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 FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF 1000000000
    #define MOD 1000000007
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;

    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 dy[]={0, 0, 1, -1, 0};
    int dx[]={1, -1, 0, 0, 0};


    int main()
    {
        int n;
        cin>>n;
        vector<llong> X(n,0);
        vector<llong> a;
        REP(i,n)
        {
            cin>>X[i];
            a.push_back(X[i]);
        }
        sort(a.begin(),a.end());
        for(int i=0; i<n; i++)
        {
            if(X[i]<=a[n/2-1]) cout<<a[n/2]<<endl;
            else cout<<a[n/2-1]<<endl;
        }
    }

Measured memory_bytes: 5488
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<usize> = (0..n).map(|_| read::<usize>() - 1).collect();
    let mut ans = 0;
    for i in 0..n {
        if i < a[i] && a[a[i]] == i {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
K = int(input())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(gcd(i, j), k)

print(ans)

Measured memory_bytes: 68840
a=[list(map(int,input().split())) for j in range(3)]
for i in range(int(input())):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
              a[j][k]=0
ans="No"

for i in range(3):
    if a[0][i]==a[1][i]==a[2][i]==0:
      ans="Yes"
    if a[i][0]==a[i][1]==a[i][2]==0:
      ans="Yes"
    if a[0][0]==a[1][1]==a[2][2]==0:
      ans="Yes"
    if a[2][0]==a[1][1]==a[0][2]==0:
      ans="Yes"
print(ans)

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

using namespace std;

int main()
{
    int n, k;
    cin >> k >> n;
    vector<int>v(n);
    long long sum = 0;
    long long mx = 0;
    for(int& x:v){
        cin >> x;
    }
    for(int i = 0; i < n; i++){
        int gap = 0;
        if(v[i] < v[(i+1)%n])
            gap = v[(i+1)%n]-v[i];
        else{
            gap = v[(i+1)%n]+k-v[i];
        }
        sum += gap;
        mx = max(mx, (long long )gap);
    }
    cout << sum - mx;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<math.h>
using namespace std;
int main(){
  int n;
  std::cin >> n;
  int a[200005]={};
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
    // std::cout << a[i] << '\n';
  }

  int i=0;
  int ans=0;
  int num=1;
  bool flag=false;
  while (a[i]!=0) {
    if(a[i]!=num)ans++;
    else {num++;flag=true;}
    i++;
  }

  if(flag==true) std::cout << ans << '\n';
  else std::cout << -1 << '\n';




  return 0;
}


Measured memory_bytes: 1152
n=int(input())
li = [input().split() for i in range(n)]
for i in range(n):
  li[i].append(i+1)
  li[i][1]=int(li[i][1])


li=sorted(li, key=lambda x:(x[0],-x[1]))

for i in range(n):
  print(li[i][2])


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

int dp[2][5005];
int good[5005];

int main()
{
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    sort(a.begin(), a.end());
    
    ll cumsum[n + 1];
    cumsum[0] = 0;
    rep(i, n) cumsum[i + 1] = cumsum[i] + a[i];

    vector<ll> threshold(n);
    rep(i, n) threshold[i] = max((ll)0, (ll)k - cumsum[i]);

    reverse(a.begin(), a.end());
    reverse(threshold.begin(), threshold.end());
    
    int now, prev;
    dp [0][0] = dp[1][0] = 1;
    rep(i, n)
    {
        now = i % 2;
        prev = (i + 1) % 2;
        rep(j, k)
        {
            if (dp[prev][j] == 0) 
                continue;
            
            dp[now][j] = dp[prev][j];
            if (j + a[i] < k)
                dp[now][j + a[i]] = 1;

            if (j + a[i] >= threshold[i]) 
                good[i] = 1;

            // cout << i << ' ' << j << ' ' << threshold[i] << ' ' << j + a[i] << ' ' << k << endl;
        }
    }

    int ans = n;
    rep(i, n)
        if (good[i] == 1) 
            ans --;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = ~(1<<31);
#define fs first
#define sc second
#define pb push_back

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
    return (a % b + b) % b;
}

int main() {
    cin.sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    rep(i,0,m) {
        int x;
        cin >> x;
        n -= x;
    }
    cout << max(-1,n) << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x,long long int y) 
{ 
    long long int res = 1;     // Initialize result 
  // x=x;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x); 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x);  // Change x to x^2 
    } 
    return res; 
}
long long int power(long long int x,long long int y,long long int m) 
{ 
    long long int res = 1;     // Initialize result 
   x=x%m;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x)%m; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x)%m;  // Change x to x^2 
    } 
    return res; 
}

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
 long long int lcm(long long int a, long long int b)  
 { 
     long long int temp;
    
    return (a*b)/gcd(a, b);  
 }
 
int main() {
        long long int t=0;
        string c;
        string s;
       long long int n,m,o=0,l,d=0,i,j,p=0,k,f;
       double pie=3.141592653589793238;
    long long int MOD=1000000007;
    cin>>n>>k;
    long long int a[k];
    for(i=0;i<k;i++)
    {
        cin>>a[i];
        p=p+a[i];
       // b[a[i]-1]=i;
    }
    if(p>=n)
    cout<<"Yes";
    else
    cout<<"No";
 return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    int K, S;
    cin >> K >> S;

    ll ans = 0;
    for (int x = 0; x <= K; ++x) {
        for (int y = 0; y <= K; ++y) {
            int z = S - (x + y);
            if (0 <= z && z <= K) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;

int main(){
    int N; cin >> N;
    vector<int> A(N), B(N);
    rep(i,N) cin >> A[i] >> B[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    int ans;
    int min, max;
    if (N % 2 == 1){
        min = A[N/2];
        max = B[N/2];
    }
    else{
        min = A[N/2-1] + A[N/2];
        max = B[N/2-1] + B[N/2];
    }
    ans = max - min + 1;
    cout << ans << endl;
}

Measured memory_bytes: 4812
import java.util.Scanner;

 class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 1;
		int x;
		while(true){
			x = scan.nextInt();
			if(x == 0)break;
			System.out.println("Case " + i + ": " + x);
			i++;
		}
	}
}

Measured memory_bytes: 43820
#include <stdio.h>
const int N=1e5+10;
const int MOD=998244353;
long long int POW(long long int a,long long int b){
	if(a==0)return 0;
  long long int ans=1;
  while(b){
  	if(b&1)ans=(ans*a)%MOD;
    a=(a*a)%MOD;
    b>>=1;
  }
  return ans;
}
int main(){
	int n,temp,cnt[N],tot=0;
  long long int ans=1;
  scanf("%d",&n);
  for(int i=0;i<=n;i++)cnt[i]=0;
  for(int i=1;i<=n;i++){
  	scanf("%d",&temp);
    if(i==1&&temp!=0)ans=0;
    cnt[temp]++;
  }
  if(cnt[0]!=1)ans=0;
  tot=cnt[0];
  if(n>1)
  for(int i=1;i<=n;i++){
    if(cnt[i]==0)ans=0;
    ans=(ans*POW(cnt[i-1],cnt[i]))%MOD;
	tot+=cnt[i];
    if(tot==n)break;
  }
  printf("%lld\n",ans%MOD);
}

Measured memory_bytes: 512
fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var m = Int.MAX_VALUE
    var mm = 0
    var s = 0L
    val ab = (1..n).map {
        val x = readLine()!!.split(" ").map { it.toInt() }
        if (x[0] > x[1]) {
            println("No")
            return
        }
        m = Math.min(m, x[1])
        mm = Math.max(mm, x[1])
        s += x[0]
        Triple(x[0], x[1], x[1] - x[0])
    }.sortedBy { it.first }.sortedBy { it.third }.sortedBy { it.second }
    if (ab[0].first > m || s > mm) {
        println("No")
        return
    }
    var now = 0
    for (i in ab) {
        now += i.first
        if (now > i.second) {
            println("No")
            return
        }
    }
    println("Yes")
}

Measured memory_bytes: 138600
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n;

int main() {
    fast_io;

    cin >> n;
    cout << n * n * n << endl;

    return 0;
}
/*

*/


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

ans = (n+1) * n // 2

a = n // 3
b = n // 5
c = n // 15

ans -= (a+1) * a // 2 * 3
ans -= (b+1) * b // 2 * 5
ans += (c+1) * c // 2 * 15

print(ans)

Measured memory_bytes: 9208
//============================================================================
// Name        : TopCoderCompetition.cpp
// Author      : taguchi
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <bitset>
#include <algorithm>
#include <map>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <numeric>
#include <list>
using namespace std;
//#define P pair<int,int>
#define max (ull)1000005
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(ull i = 0;i<n;i++)
#define pb(n) push_back(n)

typedef vector<int> vi;
typedef vector<string> vs;
struct edge{int cost,to;};

vector<string> split(string &in,char delimiter){
	vector<string> re; uint cur = 0,next;
	while((next = in.find_first_of(delimiter,cur)) != string::npos){
		re.pb(string(in,cur,next-cur));
		cur = next + 1;
	}
	re.pb(string(in,cur,in.size()-cur));
	return re;
}
vector<int> split_int(string &in, char delimiter){
	vector<string> str = split(in,delimiter);
	vector<int> re;
	rep(i,str.size()){
		re.pb(strtol(str[i].c_str(),NULL,10));
	}
	return re;
}

class Range{
public:
	int a,b;
	Range(int an,int bn) : a(an),b(bn){}

	bool operator()(int n){
		return a<=n&&n<=b;
	}
	bool isCross(Range x){
		return x(a) || x(b);
	}
	bool contains(Range x){
		return this->a <= x.a && x.b <= this->b;
	}
};

class RangeHandler{
public:
	list<Range> Ranges;

	bool insert(Range x){
		if(Ranges.empty()){
			Ranges.push_back(x);
			return true;
		}

		if(x.b <= Ranges.front().a){
			Ranges.push_front(x);
			return true;
		}
		if(Ranges.back().b <= x.a){
			Ranges.push_back(x);
			return true;
		}
		for(list<Range>::iterator i = Ranges.begin();i != Ranges.end();i++){
			list<Range>::iterator l = i;
			l++;
			//cout << "dbg" << i->b << " " << i->a << endl;
			if(Range(i->b,l->a).contains(x)){
				Ranges.insert(l,x);
				return true;
			}
		}
		return false;
	}
};
int main(){
	bitset<max> primeTable;
	primeTable.set();
	for(uint i = 2;i<max;i++){
		if(primeTable[i])
		for(uint j = i;j*i<max;j++){
			primeTable[i*j] = false;
		}
	}
	while(true){
		ull n,x;
		ull foods[30];
		cin >> n >> x;
		if(n == 0 && x == 0) break;
		rep(i,n){
			cin >> foods[i];
		}

		bitset<max> makeable;
		makeable.reset();
		makeable[0] = true;
		rep(k,n)
		rep(i,max){
			if(makeable[i] && i + foods[k] <= x){
				makeable[i + foods[k]] = true;
			}
		}
		int result = 0;
		for(uint i = x;i>=0;i--){
			if(makeable[i] && primeTable[i]){
				result = i;break;
			}
		}
		if(result != 0)
			cout << result << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for j in range(D)]

total = 0
last = [0] * 26
for i in range(1, D+1):
    t = int(input())
    total += S[i-1][t-1]
    last[t-1] = i
    for j in range(26):
        total -= C[j] * (i - last[j])
    print(total)

Measured memory_bytes: 9388
#include <stdio.h>

int main(){
  int n,k;
  int sum=0;
  scanf("%d %d",&n,&k);
  int buf[n];
  int i,tmp;
  for(i=0;i<n;i++){
    scanf("%d",&tmp);
    buf[i]=tmp;
    if(tmp>=k){
      sum++;
    }
  }
printf("%d",sum);
return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

ll ans = 0;
ll f(ll x) {
	ll cnt = 0;
	for (int i = 1; i < N; i ++) {
		if (x < i) return cnt;
		x -= i;
		cnt ++;
	}
}
int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	ll n;
	cin >> n;
	vector<ll> vec;
	ll m = n;
	for (ll i = 2; i * i <= m - 1; i ++) {
		if (n % i) continue;
		ll cnt = 0;
		while (n % i == 0) {
			n /= i;
			cnt ++;
		}
		ans += f(cnt);
	}
	if (n > 1) ans ++;
	cout << ans;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    ll n,m;
    cin >> n >> m;
    cout << min(n,m/2) + ( m - 2*min(n,m/2) ) / 4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int  a,b,c=0,tmp;
  scanf("%d%d",&a,&b);
  if(3>a){
    return 1;
  }else if(b>20){
    return 1;
  }

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  c = a;
  a =a-1;

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  printf("%d\n",c+a);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	
	int n, m, s1_sum, s2_sum, ans_s1, ans_s2, ans_sum;
	
	int s1[200], s2[200];
	
	while(true){
		cin >> n >> m;
		if(n == 0 || m == 0){
			break;
		}
		s1_sum = 0;
		s2_sum = 0;
		for(int i = 0; i < n; i++){
			cin >> s1[i];
			s1_sum += s1[i];
		}
		for(int i = 0; i < m; i++){
			cin >> s2[i];
			s2_sum += s2[i];
		}
		ans_sum = 1 << 30;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				if(s1_sum + 2 * s2[j] == s2_sum + 2 * s1[i]){
					if(ans_sum > s1[i] + s2[j]){
						ans_sum = s1[i] + s2[j];
						ans_s1 = s1[i];
						ans_s2 = s2[j];
					}
				}
			}
		}
		if(ans_sum == 1 << 30){
			printf("-1\n");
		}else{
			printf("%d %d\n", ans_s1, ans_s2);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

ll inv[200005], fac[200005], finv[200005];

void settable(){
    fac[0] = fac[1] = 1;
    inv[1] = 1;
    finv[0] = finv[1] = 1;
    for(int i = 2; i <= 200000; i++){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = mod-inv[mod%i]*(mod/i)%mod;
        finv[i] = finv[i-1]*inv[i] % mod;
    }
}

ll factorial(ll n, ll k){
    ll rtn = n;
    for(int i = n-1; i >= n-k+1; i--){
        rtn = rtn * i % mod;
    }
    return rtn;
}


ll choose(ll n, ll k){
    return factorial(n, k) * finv[k] % mod;
}

ll modpow(ll n, ll k){
    ll rtn = 1;
    while(k > 0){
        if(k&1) rtn = rtn * n % mod;
        n = n * n % mod;
        k = k >> 1;
    }
    return rtn;
}

int main(){
    settable();
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = modpow(2,n)+(mod-choose(n,a))+(mod-choose(n,b))-1;
    cout << ans%mod;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define frr(j,i,n) for(int i=j;i<=n;++i)
using namespace std;
vector<int> g[100005];
int vis[100005];
void dfs(int node)
{
    vis[node]++;
    for(int child : g[node])
    {
        if(!vis[child])
            dfs(child);
    }
}
void solve() 
{
	int n,m;
    cin>>n>>m;
    int u,v;
    frr(1,i,m)
    {
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    int cnt=0;
    frr(1,i,n)
    {
        if(!vis[i])
        {
            cnt++;
            dfs(i);
        }
    }
    cout<<cnt-1;

}
int main() 
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("output.txt","w",stdout);
	// #endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t=1;
	// cin>>t;
	while(t--)
	solve();
	return 0;
}



Measured memory_bytes: 9980
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const int mod=1e9+7;
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
//LL powmod(LL a,LL b) {LL res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int a[555][555];
int main(){
//    freopen("B-small-attempt1.in","r",stdin);
//    freopen("output.txt","w",stdout);
    int n,m,h,w;
    cin>>n>>m>>h>>w;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            a[i][j]=2333;
        }
    }
    int sum=n*m*2333;
    for(int i=h;i<=n;i+=h){
        for(int j=w;j<=m;j+=w){
            a[i][j]=-w*h*2333+2332;
            sum-=(w*h*2333+1);
        }
    }
    if(sum<=0) return 0*puts("No");
    puts("Yes");
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cout<<a[i][j]<<" ";
        }
        puts("");
    }
	return 0;
}
/*
*/


Measured memory_bytes: 2688
sx,sy,tx,ty = map(int,input().split())

dx = abs(tx - sx)
dy = abs(ty - sy)

move_x = "R" * dx
move_y = "U" * dy

f_move = move_y + move_x

if "R" in f_move:
  s_move = f_move.replace("R","L")
if "U" in s_move:
  s_move = s_move.replace("U","D")

t_move = "L" + "U" + f_move + "R" + "D"

ff_move = "R" + "D" + s_move + "L" + "U"

total = f_move + s_move + t_move + ff_move  
  
print(total)

Measured memory_bytes: 3064
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
//#define int long long
#define rep(i, a, b) for (ll i = (a); i <= (b); i++)
#define per(i, a, b) for (ll i = (a); i >= (b); i--)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = e[i].nxt)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, sum) memset(a, sum, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define SC(t,x) static_cast<t>(x)
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 1e6 + 5 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const int rev2 = ( mod + 1 ) >> 1;
const double eps = 1e-7 ;
void douout(double x){ printf("%lf\n", x + 0.0000000001) ; }
template <class T> void print(T a) { cout << a << endl ; exit(0) ; }
template <class T> void chmin(T &a, T b) { if (a > b) a = b ; }
template <class T> void chmax(T &a, T b) { if (a < b) a = b ; }
template <class T> T read()
{
    int f = 1 ; T x = 0 ;
    char ch = getchar() ;
    while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
    while (isdigit(ch)) { x = x * 10 + ch -'0' ; ch = getchar() ; }
    return x * f ;
}

int n, l, r;
char c;

int main()
{
	scanf("%d", &n);
	rep(i, 1, n)
	{
		cin>>c;
		if(c == '>')
		{
			if(!l) l = i;
		}
		else r = i;
	}
//	cout<<l<<' '<<r<<endl;
	printf("%d\n", max(r,n - l + 1));
	return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;    
    return 0;
}

Measured memory_bytes: 764
# A
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
def db(x): 
    global debug
    if debug: print(x)
debug = False
T,X = [float(x) for x in input().split()]
db((T,X))
print(T/X)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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);
    int i, j;
    ll n;
    cin >> n;
    ll a[n], b[n];
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++) cin >> b[i];
    map<ll, ll> ma, mb;
    for (i = 0; i < n; i++) {
        ma[a[i]]++;
        mb[b[i]]++;
    }
    for (auto it = ma.begin(); it != ma.end(); ++it) {
        if (it->second + mb[it->first] > n) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    ll poa = 0;
    ll pob = 0;
    ll p = 0;
    for (auto it = ma.begin(); it != ma.end(); ++it) {
        poa += it->second;
        chmax(p, poa - pob);
        pob += mb[it->first];
    }
    VI v(n, -1);
    ll r = p%n;
    for (auto it = ma.begin(); it != ma.end(); ++it) {
        for (j = 0; j < mb[it->first]; j++) {
            v[r] = it->first;
            r++;
            r %= n;
        }
    }
    r = 0;
    for (auto it = mb.begin(); it != mb.end(); ++it) {
        if (ma[it->first] > 0) continue;
        for (j = 0; j < it->second; j++) {
            while (v[r] > 0) r++;
            v[r] = it->first;
        }
    }
    for (i = 0; i < n; i++) {
        cout << v[i];
        if (i != n - 1)
            cout << " ";
        else
            cout << endl;
    }
}

Measured memory_bytes: 32964
S[1<<20],Q[1<<20],q;b,u,x,i,n;main(c){for(;c=~getchar();)if(c+11)b=b*4-c%6,u=u*4+1;else{for(S[q=b]=0;b%u;b=Q[b])for(x=b^b/4,i=0;x>3;i+=2,x/=4)(n=x&3)&&!Q[n=b&~(15<<i)^n*5<<i]?S[q=Q[q]=n]=S[b]+1:0;b-1?b?printf("%d\n",S[b]):puts("NA"):0;memset(Q,b=u=0,4<<20);}exit(0);}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  	int H,A;
    scanf("%d %d",&H,&A);
	int num;
  	if(H%A ==0) printf("%d\n",H/A);
  	else printf("%d\n",H/A+1);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll > P;
typedef pair<P,ll>Q;


int main(void){
    int x;
    int ans = 1;
    cin>>x;
    for(int i=2;i<=x;i++){
        int p=i;
        bool flag = false;
        while(p*i<=x){
            p=p*i;
            flag = true;
        }
        if(flag)ans = max(ans,p);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(int N, std::vector<int> h){
    VI dp(N);
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2; i <N; i++){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[N-1]<<endl;
}

int main(){
    int N;
    scanf("%d",&N);
    std::vector<int> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%d",&h[i]);
    }
    solve(N, std::move(h));
    return 0;
}


Measured memory_bytes: 1024