akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(string,s);
  vector<int> a(s.size(),0);
  REP(i,s.size()){
    a[i] = s[i]-'A';
  }

  int ans = 0;
  int bc = 0;
  RREP(i,s.size()){
    if (a[i]==2&&a[i-1]==1) {
      ++bc;
      int j = i-2;
      while (true) {
        bool ok = false;
        // 121212...パターン
        while (j-1>=0 && a[j]==2 && a[j-1]==1) {
          j -= 2;
          ++bc;
          ok = true;
        }
        // 00000パターン
        while (j>=0 && a[j]==0) {
          --j;
          ans += bc;
          ok = true;
        }
        /*
        debug(j);
        debug(s[j]);
        debug(bc);
        debug(ans);
        */
        if (!ok) {
          //ans += bc;
          bc = 0;
          break;
        }
      }
      i = j;
    }
  }
  OUT(ans)BR;
  
  
  return 0;
}


Measured memory_bytes: 2196
#include<iostream>
#include<string>
  
using namespace std;
  
int main(){
    int n;
    int a[11000],b[11000],c[11000],d[11000];
    int t[11000],k[11000];
    cin>>n;
    for(int i=0;i<(n*(n-1))/2;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        t[i]=0;
    }
    for(int i=0;i<(n*(n-1))/2;i++){
        if(c[i]>d[i])
            t[a[i]]+=3;
        if(c[i]<d[i])
            t[b[i]]+=3;
        if(c[i]==d[i]){
            t[a[i]]++;
            t[b[i]]++;
        }
    }
    int j=1;
    int h=0;
    for(int g=n*3;g>=0;g--){
        for(int i=1;i<n+1;i++){
            if(g==t[i]){
                k[i]=j;
                h++;
            }
        }
        j+=h;
        h=0;
    }
    for(int i=1;i<n+1;i++){
        cout<<k[i]<<endl;
    }
    return 0;
}
 

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



int main(){
    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    a--; b--; c--; d--;

    bool no_passing = c < d, two_blocks = false, three_space = false;

    for(int i = 1; i < n; ++i){
        if(s.substr(i-1,2) == "##" && a < i && i <= max(c,d)){
            two_blocks = true;
        }
        if(b <= i && i <= d){
            if(s.substr(i-1,3) == "..."){
                three_space = true;
            }
        }
    }
    bool ans = false;
    if(!two_blocks){
        if(no_passing) ans = true;
        else if(three_space) ans = true;
    }
    cout << (ans ? "Yes\n" : "No\n");
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int N, A;
  cin >> N >> A;
  cout << N * N - A << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <string>
#include <unordered_map>

using namespace std;

int main(){
  int N;
  string tmp;
  cin >> N;
  unordered_map<string, int> C;
  for (int i=0; i<N; i++){
    cin >> tmp;
    C[tmp]++;
  }
  priority_queue<pair<int, string>> Q;
  for (auto e : C){
    Q.push(pair<int, string>(e.second, e.first));
  }
  
  int num = Q.top().first;
  pair<int, string> element;
  vector<string> buf;
  while (!Q.empty()){
    element = Q.top();
    if (element.first != num) break;
    Q.pop();
    buf.emplace_back(element.second);
  }
  
  for (int i=buf.size() - 1; i>=0; i--){
    cout << buf[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 32576
n=int(input())
a= list(map(int, input().split()))
li=[0 for _ in range(n)]
for i in range(n-1,-1,-1):
    check=0
    for j in range(n//(i+1)):
        check^=li[(i+1)*(j+1)-1]
    if check!=a[i]:
        li[i]+=1
ans=[i+1 for i, x in enumerate(li) if x == 1]
print(len(ans))
print(" ".join(map(str,ans)))

Measured memory_bytes: 80360
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<cstdio>
#include<algorithm>
#define LL long long
#define INF 1ll<<60
using namespace std;
const int N=2e5+100;
const int mod=1e9+7;
LL arr[N],sum[N];
int main(){
	int n;
	while(cin>>n){
		for(int i=1;i<=n;i++)cin>>arr[i];
		for(int i=1;i<=n;i++)sum[i]=sum[i-1]+arr[i];
		LL ans=INF;
		for(int i=1;i<n;i++){
			
			ans=min(ans,abs(sum[n]-sum[i]-sum[i]));
			
		}
		
		cout<<ans<<endl;
		
	}
	return 0;
	
}

Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<numeric>

using namespace std;

int main(){
    string a, b;
    cin >> a;
    b = a;
    reverse(a.begin(),a.end());
    int ans = 0;

    for(int i = 0; i < a.length(); i++){
        if(a[i] != b[i]) ans++;
    }

    cout << ans / 2 << endl;

}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    string s;
    cin >>s;
    bool ok=true;
    ll cnt=0,sum=0;
    rep(i,s.length())
    {
        if(s[i]=='B')cnt++;
        else sum+=cnt;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 640
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数 __builtin_popcount bitの個数

int main() {
  int N;
  st S;
  ci(N, S);
  int a = 0;
  rep(i, N){
    map<char, int> X, Y;
    rep(j, i){
      X[S.at(j)]++;
    }
    repi(j, i, N){
      Y[S.at(j)]++;
    }
    int c = 0;
    each(j, X){
      each(k, Y){
        if(j.ft == k.ft){
          c++;
        }
      }
    }
    a = max(a, c);
  }
  co(a);
}


Measured memory_bytes: 256
sl=list(input())
al="abcdefghijklmnopqrstuvwxyz"
l=list(al)
mydic={}
for st in l :
  mydic[st]=0 

for st in sl :
  mydic[st]=mydic[st]+1
ans=[]

for key in mydic.keys() :
  if mydic[key] ==0 :
    ans.append(key)
ans.sort()
if len(ans)==0 :
  print("None")
else :
  print(ans[0])

Measured memory_bytes: 3956
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <climits>
#include <math.h>
#include <utility>
#include <ctime>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) a.begin(),a.end()

int main() {
	int n, m;
	cin >> n >> m;
	vvi a(n, vi(2));
	rep(i, n) {
		rep(j, 2)
		cin >> a.at(i).at(j);
	}
	vvi c(m, vi(2));
	rep(i, m) {
		rep(j, 2) {
			cin >> c.at(i).at(j);
		}
	}
	rep(i, n) {
		int minDis = INT_MAX;
		int tmp;
		int ans;
		rep(j, m) {
			tmp = abs(a.at(i).at(0) - c.at(j).at(0)) + abs(a.at(i).at(1) - c.at(j).at(1));
			if (tmp < minDis) {
				minDis = tmp;
				ans = j + 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;

pi READ(){
    int s,t;
    int h,m;

    cin >>h >>m;
    s = h*60+m;
    cin >>h >>m;
    t = h*60+m;
    return {s,t};
}

const int N = 1450;

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

    vector<vector<pi>> v(n);
    rep(i,n){
        rep(j,3) v[i].pb(READ());
    }

    int ans = 0;
    rep(a,N)rep(h,N){

        auto IN = [&](pi p, int val){
            return p.fi<=val && val<=p.se;
        };

        auto OK = [&](int idx){
            return IN(v[idx][0], a) && IN(v[idx][1], h);
        };

        vector<int> ut;
        rep(i,n)if(OK(i)){
            ut.pb(v[i][2].fi);
            ut.pb(v[i][2].se);
        }
        sort(all(ut));
        ut.erase(unique(all(ut)), ut.end());

        int T = ut.size();
        vector<int> add(T), sub(T);
        rep(i,n)if(OK(i)){
            ++add[ lower_bound(all(ut),v[i][2].fi)-ut.begin() ];
            ++sub[ lower_bound(all(ut),v[i][2].se)-ut.begin() ];
        }

        int now = 0;
        rep(i,T){
            now += add[i];
            ans = max(ans, now);
            now -= sub[i];
        }
    }
    cout << ans << "\n";
    return 0;
}



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

int main(){
  int a, b;
  string op;
  while(true){
    cin >> a >> op >> b;
    if(op=="+"){
      cout << a+b << endl;
    }
    else{
      if(op=="-"){
        cout << a-b << endl;
      }
      else{
        if(op=="*"){
          cout << a*b << endl;
        }
        else{
          if(op=="/"){
            cout << a/b << endl;
           }
           else{
            break;
           }
        }
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3148
#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; typedef long long ll; 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;

int N, M;
vector<pair<int, int>> AB;
vector<int> L, R, S, T;
vv<pair<int, int>> graph;
vector<bool> visited;
vector<int> bcnt, ans;

void dfs(int v, int p) {
    bcnt[v] = AB[v].second ^ AB[v + 1].second;
    for (auto& u : graph[v]) {
        if (u.first == p || visited[u.first]) continue;
        visited[u.first] = true;
        dfs(u.first, v);
        if (bcnt[u.first] % 2 == 1) ans.push_back(u.second);
        bcnt[v] += bcnt[u.first];
    }
}

int main() {
    cin >> N >> M;
    AB.resize(N + 2);
    rep(i, N) {
        cin >> AB[i].first >> AB[i].second;
    }
    AB[N] = {0, 0}; AB[N + 1] = {1e9 + 1, 0};
    L.resize(M); R.resize(M);
    rep(i, M) cin >> L[i] >> R[i]; 

    sort(all(AB));
    S.resize(M); T.resize(M);
    rep(i, M) {
        auto l = lower_bound(all(AB), make_pair(L[i], 0));
        auto r = upper_bound(all(AB), make_pair(R[i], 1));
        S[i] = l - AB.begin();
        T[i] = r - AB.begin();
    }

    graph.resize(N + 1);
    rep(i, M) {
        if (S[i] == T[i]) continue;
        graph[S[i] - 1].emplace_back(T[i] - 1, i);
        graph[T[i] - 1].emplace_back(S[i] - 1, i);
    }
    visited.resize(N + 1);
    bcnt.resize(N + 1);
    rep(i, N + 1) {
        if (visited[i]) continue;
        visited[i] = true;
        dfs(i, -1);
        if (bcnt[i] % 2 == 1) {
            write(-1);
            return 0;
        }
    }
    sort(all(ans));
    write(ans.size());
    rep(i, ans.size()) cout << (ans[i] + 1) << (i == (int)ans.size() - 1 ? '\n' : ' ');
}

Measured memory_bytes: 18300
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

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

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

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let s = input_line_str().to_charvec();
    let table = String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZ").to_charvec();
    for c in s {
        print!(
            "{}",
            table[(table.iter().position(|&x| x == c).unwrap() + n) % 26]
        );
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(2000005);
// comb(n,k)ならcomb(n+k+5)とかにしておく

mint f(int n, int k) {
  if (n < 0) return 0;
  mint res = comb(n,k);
  // nPk = nCk * k!
  //res *= comb.fact[k]; // <- nPk求めたいときは必要
  return res;
}
// f(n,k).x で nCk か nPk が計算される

int main () {
  int x, y;
  cin >> x >> y;

  if ((x+y)%3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  if (min(x,y) < (x+y)/3) {
    cout << 0 << endl;
    return 0;
  }

  int n = (x+y)/3;
  int k = min(x,y)-n;
  mint ans = f(n,k);
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 31616
x = int(input())

if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

Measured memory_bytes: 61608
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = input[0];
            var D = input[1];

            var X = new int[N][];
            for (int i = 0; i < N; i++)
            {
                X[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }

            var result = 0;
            for (int i = 0; i < N; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    var dist = 0;
                    for (int k = 0; k < D; k++)
                    {
                        dist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
                    }
                    var t = (int)Math.Ceiling(Math.Sqrt(dist));
                    if (t * t == dist)
                    {
                        result++;
                    }
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

int main(){
  int N,W; cin >>N >>W;
  int w[110],v[110];
  for(int i=0;i<N;i++){
    cin >>w[i] >>v[i];
  }

  vector<vector<long int> > dp(110,vector<long int>(100010, 0));

  for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
      if(j>=w[i-1]){
        dp[i][j] = max(dp[i-1][j-w[i-1]]+v[i-1], dp[i-1][j]);
      } else {
        dp[i][j] = dp[i-1][j];
      }
    }
  }

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


Measured memory_bytes: 87296
#include <iostream>
#include <string>
#include <vector>

void print(std::vector<std::string> v) {
    for (size_t i = 0; i < v.size(); i++) {
        std::cout << v[i] << '\n';
    }
}

int main(int argc, char const *argv[]) {
    int H, W;
    std::cin >> H >> W;
    std::string white_row(W, '.');
    std::string input_str;
    std::vector<std::string> grid;
    for (size_t i = 0; i < H; i++) {
        std::cin >> input_str;
        if (input_str != white_row) {
            grid.push_back(input_str);
        }
    }

    for (int i = W - 1; i >= 0; i--) {
        bool flag = true;
        for (size_t j = 0; j < grid.size(); j++) {
            if (grid[j][i] == '#') {
                flag = false;
                break;
            }
        }
        if (flag) {
            for (size_t k = 0; k < grid.size(); k++) {
                grid[k].erase(i, 1);
            }
        }
    }
    print(grid);
    return 0;
}


Measured memory_bytes: 384
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
t_list = list(t)

for i in range(n-k):
    if t_list[i] == t_list[i+k]:
        t_list[i+k] = "_"
        
result = t_list.count('r')*p + t_list.count('p')*s + t_list.count('s')*r

print(result)
        

Measured memory_bytes: 4084
#include<iostream>
using namespace std;
int main() {
    int H=1, W=1;
    while (true) {
        cin >> H >> W;
        if (H == 0 && W == 0)break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
using System;

namespace P0019_Factorial
{
    class Program
    {
        static void Main(string[] args)
        {
            string readLine = Console.ReadLine();

            var n = long.Parse(readLine);

            if (n == 1) 
            {
                Console.WriteLine("1");
            }
            else
            {
                long f = 1;

                for (long i = 2; i <= n; i++)
                {
                    f *= i;
                }

                Console.WriteLine(f.ToString());

            }
            

        }
    }
}

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

int main() {
    vector<int> n(3);
    for(int i = 0;i<3;i++){
        cin >> n.at(i);
    }

    sort(n.begin(),n.end());

    for(int i = 0;i<3;i++){
        cout << n.at(i);
        if(i!=2){
            cout << " ";
        }else{
            cout << endl;
        }
    }
}


Measured memory_bytes: 3160
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0067
"""
import sys


def solve(map):
    num_of_land = 0
    work = []
    lmap = map[:]
    for i in range(1, len(map)):
        for j in range(1, len(map[0])):
            if lmap[i][j] == 1:
                num_of_land += 1
                work.append([i, j])
                lmap[i][j] = 0

                while work:
                    y, x = work.pop()
                    if lmap[y][x+1] == 1: #  ????????????
                        work.append([y, x+1])
                        lmap[y][x+1] = 0
                    if lmap[y+1][x] == 1: #  ????????????
                        work.append([y+1, x])
                        lmap[y+1][x] = 0
                    if lmap[y][x-1] == 1: #  ????????????
                        work.append([y, x-1])
                        lmap[y][x-1] = 0

    return num_of_land


def main(args):
    data = [
    [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0],
    [0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],

    [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0],
    [0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0],
    [0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0],
    [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0],
    [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
    [0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
    [0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
            ]
    data = []
    buff = []
    for line in sys.stdin:
        line = line.strip()
        if line:
            if len(buff) == 0:
                buff = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
            line = '0' + line + '0'
            buff.append([int(x) for x in line])
        else:
            if len(buff) > 0:
                buff.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
                data.append(buff)
                buff = []
    if len(buff) > 0:
        buff.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        data.append(buff)
        buff = []

    for map in data:
        result = solve(map)
        print(result)

if __name__ == '__main__':
    main(sys.argv[1:])

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


int req(int N,int M,vector<int> k,vector<vector<int>> s,vector<int> p,vector<bool> onoff) {
  if (N == 0) {
    int num;
    for (int i=0; i<M; i++) {
      num = 0;
      for (int j=0; j<k[i]; j++) {
        if (onoff[s[i][j]]) {
          num++;
        }
      }
      if (num % 2 != p[i]) {
        break;
      }
      if (i == M-1) {
        return 1;
      }
    }
    return 0;
  }
  int a,b;
  a = req(N-1,M,k,s,p,onoff);
  onoff[N-1] = true;
  b = req(N-1,M,k,s,p,onoff);
  return a+b;
}

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> k(M);
  vector<vector<int>> s(M,vector<int>(10,-1));
  vector<int> p(M);
  vector<bool> onoff(N,false);
  for (int i=0; i<M; i++) {
    cin >> k[i];
    for (int j=0; j<k[i]; j++) {
      cin >> s[i][j];
      s[i][j]--;
    }
  }
  for (int i=0; i<M; i++) {
    cin >> p[i];
  }
  
  cout << req(N,M,k,s,p,onoff) << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    ll n, x, m;
    cin >> n >> x >> m;
    map<ll, ll> mv;
    ll lb = inf, ls = inf;
    rep(i, n) {
        if (mv.count(x) > 0) {
            lb = mv[x];
            ls = i - mv[x];
            break;
        }
        mv[x] = i;
        x = x * x % m;
    }
    ll ans = 0;
    for(auto &v : mv) {
        if (v.second < lb) {
            ans += v.first;
        }
        else {
            ans += v.first * ((n - v.second - 1) / ls + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	// your code goes here
	int n, k, imax=1e9+7;
	cin>>n>>k;
	
	vector<int> h(n, 0), dp(n, imax);
	
	for(int i=0; i<n; i++) cin>>h[i];
	
	dp[0] = 0;
	for(int i=1; i<n; i++){
		for(int j=1; j<=k; j++){
			if(i-j >= 0)
				dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
		}
	}
	
	cout<<dp[n-1];
	
	return 0;
}

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

int main(){
  int n, b, f, r, v;
  cin >> n;
  std::vector<std::vector<std::vector<int>>> data(4, std::vector<std::vector<int>>(3, std::vector<int>(10, 0))); // 4棟、3階、10部屋
  for (int i = 0; i < n; ++i) {
    // b棟f階のr番目の部屋にv人が追加で入居した
    cin >> b >> f >> r >> v;
    data[b-1][f-1][r-1] += v;
  }
  for (int b = 0; b < 4; ++b) {
    if (b > 0) {
      cout << "####################" << endl;
    }
    for (int f = 0; f < 3; ++f) {
      for (int r = 0; r < 10; ++r) {
        cout << " " << data[b][f][r];
      }
      cout << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3152
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        int X = sc.nextInt();

        int[] A = new int[N + 1];
        for (int i = 1; i <= N; i++) {
            A[i] = sc.nextInt();
        }

        int ans = X;
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= D; j += A[i]) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 22996
//MVM
#include<iostream>
using namespace std;

int main()
{
	int n, m;
	int a[100][100], b[100], c[100];
	cin >> n >> m;
	
	for(int i = 0; i < 100; i++){
		for(int j = 0; j < 100; j++)
			a[i][j] = 0;
	b[i] = 0;
	c[i] = 0;
	}
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}
	
	for(int i = 0; i < m; i++)
		cin >> b[i];
		
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			c[i] += a[i][j] * b[j];
		}
	}
	
	for(int i = 0; i < n; i++){
		cout << c[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>
#include <random>
int D;
int c[26];
int l[26][367];
int s[366][26];
int t[366];
long long m = 10000000;
int  p, q, d, k, pp, dd, f;
int ans, bans, pa, pb;
unsigned long long a;
int main() {
	scanf("%d", &D);
	for (int i = 0; i < 26; i++) {
		scanf("%d", c + i);
	}
	for (int i = 1; i <= D; i++) {
		for (int j = 0; j < 26; j++) {
			scanf("%d", s[i] + j);
		}
	}
	std::mt19937_64 rd(468);
	for (int i = 1; i <= D; i++) {
		a = rd();
		t[i] = a % 26;
	}
	for (int i = 1; i <= D; i++) {
		ans += s[i][t[i]];
		for (int j = 0; j < 26; j++) {
			l[j][i] = l[j][i - 1] + 1;
		}
		l[t[i]][i] = 0;
		for (int j = 0; j < 26; j++) {
			ans -= c[j] * l[j][i];
		}
	}
	for (long long i = 0; i < m; i++) {
		a = rd();
		if (f) {
			d = dd;
			q = pp;
		}
		else {
			d = a % D + 1;
			q = a % 26;
		}
		p = t[d];
		if (p != q) {
			bans = ans;
			t[d] = q;
			ans -= s[d][p];
			ans += s[d][q];
			k = d;
			pa = 0;
			pb = 0;
			while (l[q][k]) {
				pa += k - d - l[q][k];
				l[q][k] = k - d;
				k++;
			}
			k = d;
			do {
				pb += (l[p][k] = l[p][k - 1] + 1) - (k - d);
				k++;
			} while (l[p][k]);
			ans -= (c[q] * pa + c[p] * pb);
			a = rd();
			f = 0;
			if (ans < bans && (a % (m * m)) < 2 * m * i - i * i) {
				f = 1;
				pp = p;
				dd = d;
			}
		}
	}
	for (int i = 1; i <= D; i++) {
		printf("%d\n", t[i] + 1);
	}
}

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

using namespace std;
using ll = long long;

#define int ll
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#define pb push_back
#define sz(x) int(x.size())

signed main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	if (n % 2) {
		cout << 0 << endl;
		return 0;
	}
	int ans = 0;
	n /= 2;
	while (n) {
		ans += n / 5;
		n /= 5;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))
a = []

for i in range(n):
    if i == 0:
        a.append(b[i])
    elif i == n-1:
        a.append(b[i-1])
    else:
        a.append(min(b[i-1], b[i]))

print(sum(a))


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

#define INF 100000000

int n,m,s,g1,g2;
int t[101][101];

int main(void){
	while(cin>>n>>m>>s>>g1>>g2, n){
		for(int i=0;i<=n;i++) for(int j=0;j<=n;j++) t[i][j] = INF;
		for(int i=1;i<=n;i++) t[i][i] = 0;

		for(int i=0;i<m;i++){
			int a,b,cost;
			cin>>a>>b>>cost;
			t[a][b] = cost;
		}

		for(int k=1;k<=n;k++){
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++){
					t[i][j] = min(t[i][j],t[i][k] + t[k][j]);
				}
			}
		}

		int ans = INF;
		for(int i=1;i<=n;i++){
			ans = min(ans,t[s][i]+t[i][g1]+t[i][g2]);
		}
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 904
import sys

n=int(input())
d=[]
cnt=0

for i in range(n):
  D=[int(x) for x in input().split()]
  d.append(D)

for d1,d2 in d:
  if d1==d2:
    cnt+=1
  else:
    cnt=0
  if 3<=cnt:
    print("Yes")
    sys.exit()

print("No")

Measured memory_bytes: 62432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll>mp;
const int N=1e5+7;
ll a[N];
int main()
{
	ll n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		mp[a[i]]++;
	}
	sort(a+1,a+1+n);
	ll flag=0;
	ll ans1=0,ans2=0;
	ll sum1=0;
	for(int i=n;i>=1;i--)
	{
		if(mp[a[i]]>=4)
		sum1=max(sum1,a[i]*a[i]);
	}
	for(int i=n;i>=1;i--)
	{
		if(mp[a[i]]>=2)
		{
			if(flag&&a[i]!=ans1)
			{
				ans2=a[i];
				break;
			}
			else
			{
				flag=1;
				ans1=a[i];
			}
		}
	}
	ll sum2=ans1*ans2;
	if(sum1>sum2)
	cout<<sum1<<endl;
	else cout<<sum2<<endl;
}

Measured memory_bytes: 7296
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    c1 = input()
    c2 = input()
    for i in range(3):
        if c1[i]!=c2[-1-i]:
            print('NO')
            return
    print('YES')
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38636
N, W = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(N)]
weights = list(map(lambda x: x[0], items))
values = list(map(lambda x: x[1], items))

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    for w in range(1, W+1):
        # もらう場合
        if w - weights[i] >= 0: # もらえるならもらった方がいい
            dp[i+1][w] = dp[i][w-weights[i]] + values[i]
        
        # もらわない場合と比較、別の入れ方をしてここに至った方がいいかもしれない
        dp[i+1][w] = max(dp[i+1][w], dp[i][w])
    
print(dp[N][W])


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

int main(){
  string S;
  cin >> S;
  int N=S.size();
  bool a=false;
  int A=-1,B=-1;
  for(int i=0;i<N-1;i++){
    if(S.at(i)==S.at(i+1)){
      A=i+1,B=i+2;
    }
  }
  for(int i=0;i<N-2;i++){
    if(S.at(i)==S.at(i+2)){
      A=i+1,B=i+3;
    }
  }
  cout << A << " " << B << endl;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  if(A==1) A+=13;
  if(B==1) B+=13;
  if(A>B) cout << "Alice" << endl;
  else if(B>A) cout << "Bob" << endl;
  else cout << "Draw" << endl;
} 

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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int a,b;
 	cin >> a >> b;
	if (a == b){
    	cout << 0 << endl;
  	}
  	else if (a + b == 0){
    	cout << 1 << endl;
  	}
  	else if (a >= 0 and b >= 0){
    	if (a < b) cout << b - a << endl;
    	else if(b == 0) cout << a + 1 << endl;
    	else cout << 1 + a - b + 1 << endl;
    }
  	else if (a < 0 and b < 0){
    	if (a < b) cout << b - a << endl;
    	else cout << 1 + a - b + 1 << endl;
	}
 	else if (a >= 0 and b < 0){
    	cout << 0 + abs(a+b) + 1 << endl;
	}
	else {
    	cout << min(abs(a+b) + 1, b - a) << endl;
	}
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i, j, k, n, tmp, v;
  int A[1000];

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

  for(k=0; k<n-1; k++){
    printf("%d ", A[k]);
  }
    
  printf("%d\n", A[n-1]);
    
  for(i=1; i<n; i++){
    tmp = A[i];
    j = i-1;
    
    while(j>=0){
      if(A[j]>tmp){
	v = A[j+1];
	A[j+1] = A[j];
	A[j] = v;
      }
      j--;
      /*A[j+1] = tmp;*/
    }
    
    
    for(k=0; k<n-1; k++){
      printf("%d ", A[k]);
    }
    
    printf("%d\n", A[n-1]);
    
  }
  
  
}



Measured memory_bytes: 2140
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

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

int main() {
  vector<int> table(1000000,1);
  table[0]=table[1]=0;
  for(int i=2; i*i<1000000; i++)
    if (table[i])
      for (int j=i*2; j<1000000; j+=i)
        table[j] = 0;
  vector<int> p;
  REP(i,table.size())
    if (table[i]) 
      p.push_back(i);
  vector<int> sp;
  sp.push_back(0);
  REP(i,10001) {
    sp.push_back(sp[i]+p[i]);
  }
  int n;
  while(cin>>n,n) {
    cout << sp[n] << endl;
  }
}

Measured memory_bytes: 0
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

ll t(ll x){
    ll mul=1;
    rep(i,x){
        mul*=2;
    }
    return mul;
}
int main(){
    ll n,p; cin>>n>>p;
    vector<ll>a(n);
    bool odd=false;
    rep(i,n){
        cin>>a[i];
        if(a[i]%2==1)odd=true;
    }
    ll ans;
    if(!odd){
        if(p==1)ans=0;
        else ans=t(n);
    }
    else{
        ans=t(n-1);
    }
    cout<<ans<<endl;

}








Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
#define chmax(x,y) x = max(x,y)
const ll mod = 1000000007;

int dp[3005][3005];

int main() {
    int n, t;
    cin >> n >> t;

    vector<pair<int, int>> p(n);
    rep(i,n) {
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(), p.end());

    int ans = 0;
    rep(i, n) {
        rep(j, t) {
            chmax(dp[i+1][j], dp[i][j]);
            int nj = j + p[i].first;
            if(nj < t) {    
                chmax(dp[i+1][nj], dp[i][j] + p[i].second);
            } 
        }
        int now = dp[i][t-1] + p[i].second;
        chmax(ans, now);
    }

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

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int A, B;
  cin >> A >> B;
  if((A + B) & 1) cout << "IMPOSSIBLE" << endl;
  else cout << (A + B) / 2 << endl;

}







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

int main(){
	string s;
	int p;
	map<string, vector<int> > index;
	while(cin >> s >> p){
		index[s].push_back(p);
	}
	for(auto a: index){
		cout << a.first << endl;
		sort(a.second.begin(), a.second.end());
		for(int i=0; i<(int)a.second.size()-1; i++){
			cout << a.second[i] << " ";
		}
		cout << a.second.back() << endl;
	}
	return 0;
}


Measured memory_bytes: 3132
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a <= b){
            for(int i=0; i<b; i++){
                System.out.print(a);
            }
        }
        else{
            for(int i=0; i<a; i++){
                System.out.print(b);
            }
        }
    }
}

Measured memory_bytes: 20692
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (sc.nextInt() >= k) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 48476
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,M;
vi g[100100];
int ans;
bool used[100100];
void dfs(int v,int d){
	used[v] = true;
	if(d==N)ans++;
	for(int i=0;i<g[v].size();i++){
		int u = g[v][i];
		if(!used[u])dfs(u,d+1);
	}
	used[v] = false;
}
int main(){
	cin >> N >> M;
	for(int i=0;i<M;i++){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	dfs(0,1);
	cout << ans << endl;
	return 0;
}



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

int qsort_compare_int(const void *a, const void *b)
{
    return *(int *) a - *(int *) b;
}

int main(int argc, char *argv[])
{
    int n[4]; // input

    scanf("%d %d %d %d", &n[0], &n[1], &n[2], &n[3]);

    qsort(n, 4, sizeof(int), qsort_compare_int);

    if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,c,i,tp=0;
    cin>>a>>b>>c;
    tp=a+1;
    for(i=0;i<c;i++){
        tp--;
        while(a%tp!=0 || b%tp!=0)
            tp--;
    }
    printf("%d",tp);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        vector<string> v = {"ABC", "ARC"};
        string s;
        cin >> s;
        if(s == v[0]){
            cout << v[1] << '\n';
        }else{
            cout << v[0] << '\n';
        }
    }
}


Measured memory_bytes: 34168