akhauriyash/Code-Regression huggingface dataset:
fn main(){
  let n: usize = read();
  let inf: usize = 100000;
  let mut rv: Vec<Vec<usize>> = vec![vec![inf;n];n];
  
  for _ in 0 .. n {
    let rkt: Vec<usize> = read_vec();
    let r = rkt[0] - 1;
    for t in rkt.iter().skip(2) {
      rv[r][t-1] = 1;
    }
  }

  for k in 0 .. n {
    for i in 0 .. n {
      for j in 0 .. n {
        if rv[i][j] > rv[i][k] + rv[k][j] {
          rv[i][j] = rv[i][k] + rv[k][j];
        }
      }
    }
  }

  let p: usize = read();

  for _ in 0 .. p {
    let sdv: Vec<usize> = read_vec();
    let s = sdv[0] - 1;
    let d = sdv[1] - 1;
    let v = sdv[2];

    if v > rv[s][d] {
      println!("{}", rv[s][d] + 1);
    } else {
      println!("NA");
    }

  }
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}



Measured memory_bytes: 5044
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	vll b = a ;
	sort(all(b)) ;
	for(int i=0;i<n;i++){
		if(a.at(i)>=b.at(n/2)) cout << b.at(n/2-1) << endl ;
		else cout << b.at(n/2) << endl ;
	}
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int N,cnt=0;
  cin>>N;
  int a[N];
  for(int i=0;i<N;i++) cin>>a[i];
  for(int i=0;i<N;i++){
    if(i+1==a[a[i]-1]) cnt++;
  }
  cout<<cnt/2<<endl;
}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

long long pow_mod(long long n, long long p, long long mod) {
    if (p == 0) {
        return 1;
    } else if (p % 2 == 1) {
        return pow_mod(n, p - 1, mod) * n % mod;
    } else {
        long long s = pow_mod(n, p / 2, mod);
        return s * s % mod;
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(ALL(a));
    if (n % 2 != 0) {
        if (a[0] != 0) {
            cout << 0 << endl;
            return 0;
        }
        for (int i = 1; i < n; i++) {
            if (a[i] != ((i + 1) / 2) * 2) {
                cout << 0 << endl;
                return 0;
            }
        }
    } else {
        for (int i = 0; i < n; i++) {
            if (a[i] != ((i + 2) / 2) * 2 - 1) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << pow_mod(2, n / 2, MOD) << endl;
}


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

int main(){
  	int N;cin >> N;
  	vector<int> d(N);
  	for(int i=0; i<N; i++){
    	cin >> d[i];
    }
  
  	sort(d.begin(), d.end());
  	cout << d[N/2] - d[N/2-1] << endl;
	return 0;
}

Measured memory_bytes: 640
use::std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut it = buf.trim().split_whitespace();

    let n:usize = it.next().unwrap().parse().unwrap();
    let k:usize  = it.next().unwrap().parse().unwrap();
    let r:u64  = it.next().unwrap().parse().unwrap();
    let s:u64  = it.next().unwrap().parse().unwrap();
    let p:u64  = it.next().unwrap().parse().unwrap();
    let t:Vec<char> = it.next().unwrap().chars().collect();

    let mut point: u64 = 0;
    let mut flag:Vec<usize> = Vec::new();
    for i in 0..n {
        if i < k {
           point += match t[i] {
                'r' => p,
                's' => r,
                'p' => s,
                _=> 0,
            }
        } else if t[i] != t[i-k] || flag.contains(&(i-k)) {
            point += match t[i] {
                'r' => p,
                's' => r,
                'p' => s,
                _=> 0,
            }
        } else {
            flag.push(i);
        }
    }

    println!("{}", point);
}

Measured memory_bytes: 4476
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl


// aとbの最大公約数
ll gcd(ll a, ll b) {
	if (a < b) gcd(b, a);
	ll r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}



signed main(){

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

	set<int> even;
	for (int i = 0; i < N; i += 2){
		even.insert(B[i]);
	}
	int ans = 0;
	for (int i = 1; i < N; i += 2){
		if (even.find(A[i]) != even.end())
			ans++;
	}
	cout << ans << endl;

	return 0;
}

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

class Solution
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        var contain = n.ToString().Contains('9');

        if (contain)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

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

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;

int n, d;
string st;

vector<vector<ll>> dp;

ll add(ll a, ll b){
    return (a + b) % mod;
}

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

int main(){
    cin>>st>>d;
    n = st.length();
    dp.resize(d, vector<ll>(2));
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        vector<vector<ll>> ndp(d, vector<ll>(2));
        for(int s = 0; s < d; s++){
            for(int j = 0; j < 10; j++){
                // any < border
                ndp[(s + j)%d][1] = add(ndp[(s + j)%d][1], dp[s][1]);
            }
            for(int j = 0; j <= (int) (st[i] - '0'); j++){
                if(j < (int) (st[i] - '0')){
                    ndp[(s + j)%d][1] = add(ndp[(s + j)%d][1], dp[s][0]);
                }else{
                    ndp[(s + j)%d][0] = add(ndp[(s + j)%d][0], dp[s][0]);
                }
            }
        }
        dp = ndp;
    }
    ll res = (dp[0][0] + dp[0][1] - 1 + mod) % mod;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF (1e9)
#define N 5005
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
const double EPS=(1e-8);

double dot(P a,P b){
  return real(b*conj(a));
}

double cross(P a,P b){
  return imag(conj(a)*b);
}

double getDistanceSP(L s,P p){
  if(dot(s.second-s.first,p-s.first)<-EPS)return abs(p-s.first);
  if(dot(s.first-s.second,p-s.second)<-EPS)return abs(p-s.second);
  return abs(cross(s.second-s.first,p-s.first)/abs(s.second-s.first));
}

int n,m,x,y;
P p[N];
double d[N];
vector<P> v;
double ans=0;

int main(){
  cin>>n>>m>>x>>y;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    p[i]=P(a,b);
    d[i]=abs(P(x,y)-p[i]);
  }
  v.push_back(P(x,y));
  while(m--){
    int target=-1;
    double mina=INF;
    for(int i=0;i<n;i++){
      if(mina-EPS>d[i]){
	target=i;
	mina=d[i];
      }
    }
    d[target]=INF;
    
    int target2=-1;
    double minb=INF;
    for(int i=0;i<v.size();i++){
      if(minb-EPS>abs(v[i]-p[target])){
	target2=i;
	minb=abs(v[i]-p[target]);
      }
    }

    v.push_back(p[target]);
    
    //    cout<< p[target] <<' '<<v[target2]<<endl;
    
    L A(v[target2],p[target]);
    ans+=abs(A.first-A.second);
    
    for(int i=0;i<n;i++){
      if(d[i]==INF)continue;
      d[i]=min(d[i],getDistanceSP(A,p[i]));
    }
    
  }
  printf("%.8f\n",ans);
  return 0;
}

Measured memory_bytes: 3500
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        String result = "";
        PrintWriter out = new PrintWriter(System.out);
        char[] s = S.toCharArray();
        Arrays.sort(s);
        S = new String(s);

        for (int i = 0; i < alphabet.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (alphabet.charAt(i) == S.charAt(j)) {
                    break;
                }
                if (j == S.length() - 1) {
                    result = String.valueOf(alphabet.charAt(i));
                    out.println(result);
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

        if (result.equals("")) {
            result = "None";
        }

        out.println(result);
        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 40052
#include <cmath>
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>

using lli = long long;

int div(int l, int r, const std::vector<lli>& Ac_arr){
  int b=l, e=r;
  while(e-b > 1){
    int med=(b+e)/2;
    lli diff = Ac_arr[r]-Ac_arr[med]-Ac_arr[med]+Ac_arr[l];
    if(diff >= 0){
      b = med;
    }else{
      e = med;
    }
  }
  return b;
}

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

  std::vector<int> A_arr(N);
  std::vector<lli> Ac_arr(N+1);
  lli tmp = 0;
  for(int i = 0; i < N; i++){
    std::cin >> A_arr[i];
    tmp += A_arr[i];
    Ac_arr[i+1] = tmp;
  }

  lli ans = std::numeric_limits<lli>::max();
  for(int i = 2; i < N-1; i++){
    int ldiv = div(0, i, Ac_arr);
    int rdiv = div(i, N, Ac_arr);
    for(int ld = ldiv; ld < ldiv+2; ld++){
      for(int rd = rdiv; rd < rdiv+2; rd++){
        std::vector<lli> ABCD = {Ac_arr[ld], Ac_arr[i]-Ac_arr[ld], Ac_arr[rd]-Ac_arr[i], Ac_arr[N]-Ac_arr[rd]};
        std::sort(ABCD.begin(), ABCD.end());
        ans = std::min(ans, ABCD[3]-ABCD[0]);
      }
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
const int Mod=1000000007;
#define LL long long 
using namespace std;
LL ans=1,fac[100100],n,m;
int main(){
	cin>>n>>m;
	if(n>m) swap(n,m);
	if(m-n>=2){
		cout<<0;
		return 0;
	}
	fac[0]=1;
	for(int i=1;i<=m;i++){
		fac[i]=(fac[i-1]*i)%Mod;
	}
	if(m-n==0)
	ans=(2*fac[n]*fac[m])%Mod;
	else 
	ans=(fac[n]*fac[m])%Mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main() {
	int n, aa, bb, cc,aaa, a[111], b[111], ans,c[111];
	cin >> n;
	cin >> aa;
	for (int i = 1; i <= n; i++) {
		a[i] = 0;
		b[i] = 0;
		c[i] = 0;
	}
	for (int i = 1; i <= aa; i++) {
		cin >> aaa;
		a[aaa] = 1;
	}
	cin >> bb;
	for (int i = 1; i <= bb; i++) {
		cin >> aaa;
		b[aaa] = 1;
	}
	cin >> cc;
	for (int i = 1; i <= cc; i++) {
		cin >> aaa;
		c[aaa] = 1;
	}
	ans = 0;
	for (int i = 1; i <= n; i++) {
		if (c[i] == 1 && b[i] == 1 || c[i] == 1 && a[i] == 0) {
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3108
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = []
for i in range(q):
    bc.append(list(map(int, input().split())))

s = 0
for i in range(n):
    s += a[i]

import collections
cnt = dict(collections.Counter(a))

for i in range(q):
    b = bc[i][0]
    c = bc[i][1]
    if b in cnt:
        if c in cnt:
            num = cnt[b]
            s += (c - b) * num
            cnt[c] += cnt[b]
            del cnt[b]
        else:
            num = cnt[b]
            s += (c - b) * num
            cnt[c] = num
            del cnt[b]
        print(s)
    else:
        print(s)

Measured memory_bytes: 107936
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[200005][5]={0};
ll ear[200005]={0};
const ll inf=17441744174417;
int main(){
  ll n;
  cin>>n;
  for(int i=1;i<=n;i++) cin>>ear[i];
  for(int i=1;i<=n;i++){
    for(int j=0;j<5;j++) dp[i][j]=inf;
  }
  for(int i=1;i<=n;i++){
    for(int j=0;j<5;j++){
      for(int k=0;k<=j;k++) dp[i][j]=min(dp[i][j],dp[i-1][k]);
      if(j==0||j==4) dp[i][j]+=ear[i];
      else if(j==1||j==3){
        if(ear[i]<2) dp[i][j]+=2-ear[i];
        else if(ear[i]%2==1) dp[i][j]++;
      }
      else{
        if(ear[i]%2==0) dp[i][j]++;
      }
    }
  }
  ll ans=inf;
  for(int i=0;i<5;i++) ans=min(ans,dp[n][i]);
  cout<<ans<<endl;
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<unordered_map>
#include<queue>
#include<functional>

using namespace std;

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

int n, m;
struct Edge{
    ll cost, to;
    Edge(ll c, ll t) : cost(c), to(t){}
};
unordered_map<ll, vector<Edge>> g;
unordered_map<ll, ll> d;

ll get_id(ll p, ll c){
    return p + n * c;
}

void add_edge(ll p, ll q, ll c){
    g[get_id(p, c)].push_back({0, get_id(q, c)});
    g[get_id(q, c)].push_back({0, get_id(p, c)});
    g[get_id(p, c)].push_back({0, get_id(p, 0)});
    g[get_id(p, 0)].push_back({1, get_id(p, c)});
    g[get_id(q, c)].push_back({0, get_id(q, 0)});
    g[get_id(q, 0)].push_back({1, get_id(q, c)});
}

int main(){
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int p, q, c;
        cin >> p >> q >> c;
        add_edge(p, q, c);
    }
    priority_queue<pll, vector<pll>, greater<pll>> q;
    d[get_id(1, 0)] = 0;
    q.push({0, get_id(1, 0)});
    while(!q.empty()){
        auto from = q.top(); q.pop();
        for(auto&& t : g[from.second]){
            if(d.find(t.to) == d.end() || d[t.to] > d[from.second] + t.cost){
                d[t.to] = d[from.second] + t.cost;
                q.push({d[t.to], t.to});
            }
        }
    }
    if(d.find(get_id(n, 0)) == d.end()){
        cout << -1 << endl;
    }else{
        cout << d[get_id(n, 0)] << endl;
    }
    return 0;
}


Measured memory_bytes: 78192
#include <iostream>
using namespace std;
using int64 = int_fast64_t;

int64 memo[55];
int64 p_memo[55];

int64 f(int64 L) {
  if (memo[L] > 0) return memo[L];
  if (L == 0) return memo[0] = 1;
  return memo[L] = 2 * f(L-1) + 3;
}

int64 getP(int64 L) {
  if (p_memo[L] > 0) return p_memo[L];
  if (L == 0) return p_memo[0] = 1;
  return p_memo[L] = 2 * getP(L-1) + 1;
}

int64 solve(int64 L, int64 X) {
  if (X == 0) {
    return 0;
  } else if (L == 0) {
    return 1;
  } else if (X <= 1 + f(L-1)) {
    return solve(L-1, X-1);
  } else if (X <= 2 + f(L-1)) {
    return getP(L-1) + 1;
  } else if (X <= 2 + 2*f(L-1)) {
    return getP(L-1) + 1 + solve(L-1, X-f(L-1)-2);
  } else {
    return getP(L-1) + 1 + solve(L-1, X-f(L-1)-2);
  }
}

int main() {
  int64 N, X;
  cin >> N >> X;
  f(N);
  getP(N);
  
  int64 ans = solve(N, X);
  cout << ans << endl;
}


Measured memory_bytes: 256
//go:generate echo "https://atcoder.jp/contests/abc176/tasks/abc176_b"
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *scanner) StringSlice(l int) []string {
	if l == 0 {
		return []string{}
	}
	sl := make([]string, l, l)
	for i := range sl {
		sl[i] = s.String()
	}
	return sl
}

func solve(n string) bool {
	sum := 0
	for _, c := range n {
		n, _ := strconv.Atoi(string(c))
		sum += n
	}
	return sum%9 == 0
}

func main() {
	scan := newScanner(os.Stdin)
	n := scan.String()
	if solve(n) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 2452
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    ans = 0
    for a in range(1, N+1):
        for b in range(1, N+1):
            if a * b >= N:
                break
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68080
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    int count = 0;
    cin >> count;
    int t,a = 0;
    double h[count];
    double ans,tmp = 0;
    double cmp = 2147483640;
    int i = 0;
    cin >> t >> a;
    for(i = 0; i < count; ++i){
        cin >> tmp;
        h[i] = t - tmp * 0.006;
    }
    tmp = 0;
    for(i = 0; i < count; ++i){
        if(h[i] < a){
            tmp = abs(a-h[i]);
        }else{
            tmp = abs(h[i]-a);
        }
        if(cmp > tmp){
            cmp = tmp;
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int n,a[105],minn=1e9,maxx,cnt[105];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		maxx=max(maxx,a[i]);
		minn=min(minn,a[i]);
		++cnt[a[i]];
	}
	if(minn<(maxx+1)/2||cnt[maxx]<=1){
		puts("Impossible");
		return 0;
	}
	if(maxx&1&&cnt[minn]!=2){
		puts("Impossible");
		return 0;
	}
	if((maxx&1)==0&&cnt[minn]!=1){
		puts("Impossible");
		return 0;
	}
	for(int i=minn+1;i<maxx;++i)
		if(cnt[i]<2){
			puts("Impossible");
			return 0;
		}
	puts("Possible");
}

Measured memory_bytes: 256
//10
#include<iostream>
#include<algorithm>

using namespace std;

double dfs(int n,int m,int k,double p,int a){
  if(n==0){
    return max(a-k,1)*p;
  }else{
    double r=0;
    for(int i=1;i<=m;i++){
      r+=dfs(n-1,m,k,p/m,a+i);
    }
    return r;
  }
}

int main(){
  for(int n,m,k;cin>>n>>m>>k,n|m|k;){
    cout.precision(7);
    cout<<fixed<<dfs(n,m,k,1,0)<<endl;
  }
  return 0;
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define dep(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  string s; cin>>s;
  int cnt=0;
  rep(i,s.size())
  {
    if(s[i]=='o') cnt++;
  }
  print(700+cnt*100);

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace  std;
const int MAXN = 105;
int a[MAXN], sum;
int n, m;

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i], sum += a[i];
    
    int cnt = 0;
    for (int i = 0; i < n; i++)
        if (a[i] >= 0.25 * sum / m) cnt++;
    if (cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;
  std::vector<int> H(N);
  for(int i=0;i<N;i++) {
    std::cin >> H[i];
  }
  std::vector<int> height(N, 0);
  for(int i=0;i<N;i++){
    if(i==0) height[0]=H[0];
    else height[i]=max(height[i-1], H[i]);
    //std::cout << height[i] << " " <<H[i] << '\n';
    if(height[i]-H[i]>=2){
      std::cout << "No" << '\n';
      return 0;
    }
  }
  std::cout << "Yes" << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <map>
#define LL long long int
using namespace std;

int main()
{
    int a,b,c,d,i;
scanf("%d %d %d %d",&a,&b,&c,&d);
for( i=0;i<abs(d-b);i++)
    printf("U");
for( i=0;i<c-a;i++)
{
    printf("R");
}
for(i=0;i<abs(d-b);i++)
{
    printf("D");
}
for(i=0;i<c-a;i++)
{
    printf("L");
}
printf("L");
for(i=0;i<d-b+1;i++)
{
    printf("U");
}
for(i=0;i<c-a+1;i++)
{
    printf("R");
}
 printf("DR");
 for(i=0;i<d-b+1;i++)
{
    printf("D");
}
for(i=0;i<c-a+1;i++)
{
    printf("L");
}
 printf("U\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,x,n,c,i;
  cin>>k>>x;
  n=k*2-1;
  int a[n];
  c=x-(k-1);
  for(i=0;i<n;i++)
  {
      a[i]=c;
      c++;
  }
  for(i=0;i<n;i++)
  {
      cout<<a[i]<<" ";
  }
  cout<<endl;
}


Measured memory_bytes: 256
N = int(input())
l = [list(map(int,input().split())) for _ in range(N)]

ans = N
for i in l:
    x = 0 if i[0]-i[1] < 0 else i[0]-i[1]
    i[1] = i[0]+i[1]
    i[0] = x
    
l.sort(key=lambda x:x[1])

right = 0
for i in range(N):
    if right > l[i][0]:
        ans-=1
    else:
        right = l[i][1]

print(ans)

Measured memory_bytes: 29096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

vector<ll> num(45,0);

//繰り返し二乗法
ll EX(ll x,ll n){
    if(n == 0) return 1;
    else if(n%2 == 1) return EX(x,n-1)*x;
    else return EX(x*x,n/2);
};

vector<ll> to_k (ll n,ll k){
    vector<ll> memo(45);
    for(ll i = 44; i >= 0; i--){
        ll e = EX(k,i);
        if(e <= n){
            memo[i] = 1;
            n -= e;
        } else memo[i] = 0;
    }
    return memo;
}
vector<ll> x(45);
ll re_k (ll k){
    ll res = 0;
    for(ll i = 0; i < 45; i++){
        res += x[i]*EX(k,i);
    }
    return res;
}

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        vector<ll> vlu = to_k(a[i],2);
        for(ll j = 0; j < 45; j++){
            if(vlu[j]%2 == 1) num[j]++;
        }
    }
    for(ll i = 0; i < 45; i++){
        if(num[i] <= n/2) x[i] = 1;
        else x[i] = 0;
    }
    vector<ll> kd = to_k(k,2);
    bool flag = true;
    for(int i = 44; i >= 0; i--){
        if(flag && kd[i] == 1) flag = false;
        if(kd[i] == 1 && x[i] == 0) break;
        else if(kd[i] == 0 || flag) x[i] = 0;
        
    }
    ll X = re_k(2);
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        ans += X^a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3980
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val n = sc.nextInt()
    val a = Array(3 * n) { sc.nextLong() }

    a.sort()
    var ans = 0L

    for (i in 0 until n) {
        ans += a[3 * n - 2 * i - 2]
    }
    println(ans)
}


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

int x,y,d;

void extended(int a,int b)
{
if(b==0)
{
        x=1,y=0;
        d=a;
        return ;
}
extended(b,a%b);
int x1=y;
int y1=x-(a/b)*y;
x=x1;
y=y1;

}

int main()
{
        int a,b;
        while(cin>>a>>b)
        {extended(a,b);
        cout<<x<<" "<<y<<endl;
        }

}

Measured memory_bytes: 3092
#include <stdio.h>
#include <math.h>
int main(void){
	int leap[3001],i,a,b,k,d=0;
	for(a=0;a<3001;a++){
		if(a%400==0)leap[a]=1;
		else if(a%100==0)leap[a]=0;
		else if(a%4==0)leap[a]=1;
		else leap[a]=0;
	}
	while(scanf("%d %d",&a,&b)){
		if(a==0&&b==0)break;
		if(d>0)printf("\n");
		for(k=0,i=a;i<=b;i++){
			if(leap[i]==1){printf("%d\n",i);k++;}
		}
		if(k==0)printf("NA\n");
		d++;
	}
	return 0;
}

Measured memory_bytes: 624
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scn = new Scanner(System.in);

        int int1 = scn.nextInt();
        int int2 = scn.nextInt();

        if (int1*int2 %2 == 0) {
            System.out.println("Even");
        } else {
            System.out.println("Odd");
        }
    }
}



Measured memory_bytes: 21716
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
  int i,n,ans=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
    }
  i = 1;
  while(i<n)
    {
      if(i == n-1)
	{
	  if(a[i] == a[i-1])
	    {
	      ans++;
	      i++;
	    }
	  break;
	}
      if(a[i-1] == a[i] && a[i] == a[i+1])
	{
	  a[i] = a[i-1]+a[i+1];
	  ans++;
	  i += 2;
	}
      else if(a[i] == a[i-1])
	{
	  a[i] = a[i-1] + a[i+1];
	  i += 2;
	  ans++;
	}
      else if(a[i] == a[i+1])
	{
	  i++;
	}
      else
	{
	  i += 2;
	}
    }
  printf("%d\n",ans);
  return 0;
}
  


Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;

int main(){
	string s;
	int ans=700;

	cin >>s;
	if(s[0]=='o')ans+=100;
	if(s[1]=='o')ans+=100;
	if(s[2]=='o')ans+=100;
	cout<<ans<<endl;
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  long long H, W;
  cin >> H >> W;
  if (H == 1 || W == 1)
  {
    cout << 1 << endl;
    return 0;
  }
  long long ans = (H * W + 1) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

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

using namespace std;

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

const int INF = 1001001001;

signed main()
{
    int n;
    cin >> n;
    
    int a = 0;
    rep(i, n){
        a += i+1;
        
        if(a >= n){
            rep(j, i+1){
                if(j+1 != a-n){
                    cout << j+1 << endl;
                }
            }
            break;
        }
    }
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int k,a,b;
	cin >> k;
	cin >> a >> b;
	int ok = 0;
	for(int i = a;i <= b;i++){
		if(i % k == 0){
			ok = 1;
			break;
		}
	}
	if(ok) printf("OK\n");
	else printf("NG\n");
	return 0;
}

Measured memory_bytes: 3128
// INCLUDES
#include <bits/stdc++.h>
#include <assert.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define all(s) begin(s), end(s)
#define MIN3POS(a, b, c) (a) = < (b) ? ((a) = < (c) ? 1 : 3) : ((b) = < (c) ? 2 : 3)
#define MAX3POS(a, b, c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2 : 3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define error(args...)                           \
    {                                            \
        string _s = #args;                       \
        replace(_s.begin(), _s.end(), ',', ' '); \
        stringstream _ss(_s);                    \
        istream_iterator<string> _it(_ss);       \
        err(_it, args);                          \
    }
//NAMESPACES
using namespace __gnu_pbds;
using namespace std;
vector<string> vec_splitter(string s)
{
    s += ',';
    vector<string> res;
    while (!s.empty())
    {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
    vector<string> __attribute__((unused)) args,
    __attribute__((unused)) int idx,
    __attribute__((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T)
{
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32, 0);
void initialize()
{
    for (int i = 1; i < powers2.size(); i++)
        powers2[i] = powers2[i - 1] * 2;
}
int32_t main()
{
    IOS int h, w;
    int mod = (1e9 + 7);
    cin >> h >> w;
    char s[h][w];
    FOR(i, 0, h)
    {
        FOR(j, 0, w)
        cin >> s[i][j];
    }
    int dp[h][w];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    FOR(i, 0, h)
    {
        FOR(j, 0, w)
        {
            if(i==0 && j!=0 && s[i][j] == '.') dp[i][j] = (dp[i][j]  + dp[i][j-1])%mod;
            else if(j==0 && i!=0 && s[i][j] == '.') dp[i][j] = (dp[i][j] + dp[i-1][j])%mod;
            else if(i+j!=0 && s[i][j] == '.') dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
        // cout << endl;
    }
cout<<dp[h-1][w-1];
    return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 9088
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  int n;cin >> n;
  while(n--){
    int a,b;cin >> a >> b;
    if(d.left()==a) d.roll('E');
    if(d.right()==a) d.roll('W');
    while(d.top()!=a) d.roll('N');
    while(d.front()!=b) d.roll('R');
    cout << d.right() << endl;
  }
  return 0;
}




Measured memory_bytes: 3088
def main():
    from collections import Counter
    import sys

    input()
    a = list(map(int, sys.stdin.readline().split()))

    b = Counter(a)

    c = sum(v * (v - 1) // 2 for v in b.values())
    d = [str(c - (b[v] - 1)) for v in a]
    print('\n'.join(d))


if __name__ == '__main__':
    main()


Measured memory_bytes: 34152
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	_ = nextInt()
	a := nextIntArray()
	pos := make([]int, 100000+2)
	for _, v := range a {
		pos[v]++
		pos[v+1]++
		pos[v+2]++
	}
	m := 1
	for _, v := range pos {
		if v > m {
			m = v
		}
	}
	fmt.Println(m)
}

const size = 1000000

var reader = bufio.NewReaderSize(os.Stdin, size)

func nextLine() string {
	var line, buffer []byte
	isPrefix := true
	var err error
	for isPrefix {
		line, isPrefix, err = reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
	}
	return string(buffer)
}
func nextStringArray() []string {
	return strings.Split(nextLine(), " ")
}
func nextInt() int {
	n, _ := strconv.Atoi(nextLine())
	return n
}
func nextIntArray() []int {
	s := strings.Split(nextLine(), " ")
	n := len(s)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}

func min(i, j int) int {
	if i > j {
		return j
	}
	return i
}


Measured memory_bytes: 5632
eval"d,c={};f=->a,b{d[[c,b]]||=(#{'f[a+%d,b];'*2+'f[a,b+%d];'*2}a>0?b.quo(a):-1)if a*%d>=b&&%d>=c=a*100+b};f[0,0];p *d.invert.max[1]"%`dd`.split

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

#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int r,w,a,b;
    cin>>r>>w>>a>>b;
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if((i<=b)^ (j<=a))
                cout<<1;
            else
                cout<<0;
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];

int main() {
    int n,k;
    cin >> n >> k;
    vector<ll>su(n+1,0);
    vector<ll>sn(n);
    rep(i, 0, n) {
        cin >> sn[i];
    }
    rep(i, 0, n) {
        su[i+1] = su[i] + sn[i];
    }
    
    int index = 0;
    vector<ll>ans(n,0);
    for (int i = k; i < su.size(); i++) {
        ans[index] = su[i]-su[index];
        index++;
    }
    rep(i, 0, n-k) {
        if(ans[i] < ans[i+1])cout << "Yes" << endl;
        else cout << "No" << endl;
    }
   return 0;
}


Measured memory_bytes: 10364
#include<stdio.h>
#include<string.h>
#define N 100
int main(){
  int tmp;
  char s[N] = {'\0'};
  char t[N] = {'\0'};
  scanf("%s", s);
  scanf("%s", t);
  int i = 0, j = 0;

  for(i = 0; i < strlen(s); i++){
    for(j = i + 1; j < strlen(s); j++){
      if(s[i] > s[j]){
        tmp = s[i];
        s[i] = s[j];
        s[j] = tmp;
        i = 0;
      }
    }
  }
  for(i = 0; i < strlen(t); i++){
    for(j = i + 1; j < strlen(t); j++){
      if(t[i] < t[j]){
        tmp = t[i];
        t[i] = t[j];
        t[j] = tmp;
        i = 0;
      }
    }
  }
  for(i = 0; s[i] != '\0' && t[i] != '\0'; i++){
    if(s[i] != t[i]){
      if(s[i] > t[i]){
        printf("No\n");
        return 0;
      }else{
        printf("Yes\n");
        return 0;
      }
    }
  }
  if(strlen(s) > strlen(t)){
    printf("No\n");
  }else if(strlen(s) < strlen(t)){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
         double a,b,c,d,e,f,x,y;
		 while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!= EOF){
			y = (c*d-f*a)/(b*d-a*e);
			x = (c-b*y)/a;
			printf("%.3f %.3f\n",x ,y);
		 }
		 return 0;
}

Measured memory_bytes: 1080
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main()
{
    int a[3];
    for (int i=0; i<3; i++){
        cin>>a[i];   //taking inputs
    }
    sort(a, a+3); //sorting
    for (int j=0; j<2; j++){
        cout<<a[j]<<" "; //output
    }
    cout<<a[2]<<"\n";
    return 0;
}



Measured memory_bytes: 3128
import java.util.*;

public class Main {

    public static int sum(int n){
        return (1+n)*n/2;
    }

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		System.out.println(sum(a));
	}
}


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

int main() {
  int n;
  bool ans=true;
  cin>>n;
  if(n==2)cout<<2<<endl;
  else{
  for(int i=n;i<n*2;i++){
    ans=true;
    for(int j=2;j<i;j++){
      if(i%j==0){
        ans=false;
      break;
    }
    }
    if(ans){
      cout<<i<<endl;
    break;
    }
  }
  }
}


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

typedef pair<int,int> P;

struct Score{
	// problem[i] := 問題 i を解いたかどうか
	vector<bool> problem;
	// WA[i] := 問題 i のペナルティの数
	vector<int> WA;
	// submit[i] := i 番目の提出して正解した時刻
	vector<int> submit;
};


int main(){
	int t, p, r;
	while( cin >> t >> p >> r, t || p || r ){
		// data[i] := チーム i のスコア
		vector<Score> data(t);
		
		// 初期化
		vector<bool> problem_;
		vector<int> WA_;
		for(int i=0 ; i < p ; i++ ){
			problem_.push_back( false );
			WA_.push_back( 0 );
		}
		for(int i=0 ; i < t ; i++ ){
			data[i].problem = problem_;
			data[i].WA = WA_;
		}
		
		// 入力
		for(int i=0 ; i < r ; i++ ){
			int ID, pID, time;
			string message;
			cin >> ID >> pID >> time >> message;
			ID--; pID--;
			if( message == "CORRECT" ){
				data[ID].problem[pID] = true;
				data[ID].submit.push_back( time );
			}else{
				data[ID].WA[pID]++;
			}
		}
		
		// ( -solved , (time, ID) ) を保持する配列
		vector< pair<int,P> > ans;
		// 点数計算
		for(int i=0 ; i < t ; i++ ){
			// 解いた問題数 (ソートするときに解いた問題数が多い順になるように -1 をかけておく )
			int solved = -data[i].submit.size();
			
			// time の計算 (正解した問題の提出時刻の総和)
			int time=0;
			for(int j=0 ; j < data[i].submit.size() ; j++ ){
				time += data[i].submit[j];
			}
			// WA(ペナルティ) の加算
			for(int j=0 ; j < p ; j++ ){
				if( data[i].problem[j] ){
					time += data[i].WA[j] * 1200;
				}
			}
			P pp(time,i);
			ans.push_back( pair<int,P> ( solved , pp ) );
		}
		sort( ans.begin() , ans.end() );
		for(int i=0 ; i < ans.size() ; i++ ){
			int ID = (ans[i].second.second + 1); 
			int solved = -ans[i].first; // 解いた問題数に -1 をかけて元に戻すのを忘れない.
			int time = ans[i].second.first;
			cout << ID << " " << solved << " " << time << endl;
		}
	}
}

Measured memory_bytes: 944
#-*-coding:utf-8-*-

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    flag = [0 for i in range(8)]
    other_cnt = 0

    for i in a_list:
        if 1 <= i and i < 400:
            flag[0] = 1
        elif 400 <= i and i < 800:
            flag[1] = 1
        elif 800 <= i and i < 1200:
            flag[2] = 1
        elif 1200 <= i and i < 1600:
            flag[3] = 1
        elif 1600 <= i and i < 2000:
            flag[4] = 1
        elif 2000 <= i and i < 2400:
            flag[5] = 1
        elif 2400 <= i and i < 2800:
            flag[6] = 1
        elif 2800 <= i and i < 3200:
            flag[7] = 1
        elif i >= 3200:
            other_cnt += 1
    
    if all(x >= 3200 for x in a_list):
        print(1, other_cnt)
    else:
        print(sum(flag), sum(flag) + other_cnt)
        

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int a, b, c, n;
	scanf("%d %d %d", &a, &b, &c);
	if (a > b)
	{
		n = a, a = b, b = n;
	}
	if (b > c)
	{
		n = b, b = c, c = n;
	}
	if (a > b)
	{
		n = a, a = b, b = n;
	}
	printf("%d %d %d\n", a, b, c);


	return 0;
}

Measured memory_bytes: 596
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  vvi a(h, vi(w));
  rep(i, h){
    rep(j, w) cin >> a[i][j];
  }
  vvi ans;
  rep(i, h){
    rep(j, w - 1){
      if(a[i][j] & 1){
        a[i][j]--;
        a[i][j + 1]++;
        ans.push_back({i, j, i, j + 1});
      }
    }
    if(i != h - 1 && (a[i][w - 1] & 1)){
      a[i][w - 1]--;
      a[i + 1][w - 1]++;
      ans.push_back({i, w - 1, i + 1, w - 1});
    }
  }
  cout << ans.size() << endl;
  if(!ans.size()) return 0;
  for(vi res : ans) cout << res[0] + 1 << " " << res[1] + 1 << " " << res[2] + 1 << " " << res[3] + 1 << endl;
}

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

int main()
{
	int x;
	cin>>x;
	if(x>=400 && x<600)
		cout<<8<<endl;
	else if(x>=600 && x<800)
		cout<<7<<endl;
	else if(x>=800 && x<1000)
		cout<<6<<endl;
	else if(x>=1000 && x<1200)
		cout<<5<<endl;
	else if(x>=1200 && x<1400)
		cout<<4<<endl;
	else if(x>=1400 && x<1600)
		cout<<3<<endl;
	else if(x>=1600 && x<1800)
		cout<<2<<endl;
	else
		cout<<1<<endl;
	
}

Measured memory_bytes: 3620
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  puts InputLine.to_s.split('').map(&:to_i).count(2).to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
A = [int(i) for i in list(input())]
n = 3
for i in range(1 << n):
    a, b, c, d = A
    o = ["", "", ""]
    p = [1, 1, 1]
    ans = 0
    for j in range(n):
        if i >> j & 1:
            o[j] = "+"
            p[j] = 1
        else:
            o[j] = "-"
            p[j] = -1

    if a + (b*p[0]) + (c*p[1]) + (d*p[2]) == 7:
        print("{}{}{}{}{}{}{}=7".format(a, o[0], b, o[1], c, o[2], d))
        break


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n;
	cin >> n;
	cout << n * (n + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
//# pragma GCC optimize("Ofast")
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define forn(i, n) for (int i = 0; i < int(n); i++)
# define ford(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define fore(i, l, r) for (int i = int(l); i < int(r); i++)
# define in freopen("out.txt", "r", stdout)
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
 
using namespace std;
 
const ll INF = 1e18;
const int mod = 1e9 + 7;
const ll N = 2e6 + 7;
typedef vector < vector < ll > > matrix;

int main()
{   
    speed;
    int n;
    cin >> n;
    cout << n * n;
    time;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
int main()
{
  int n; cin >> n;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  int l; cin >> l;
  int q; cin >> q;
  vector<int> a(q), b(q);
  rep(i,q) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
  }

  int M = 20;
  vector<vector<int>> c(n, vector<int>(M));
  rep(i,n) {
    int lb = -1, ub = n;
    while(ub - lb > 1) {
      int mid = (ub + lb)/2;
      (x[mid] <= x[i] + l ? lb : ub) = mid;
    }
    c[i][0] = lb;
  }

  rep1(j,M-1) {
    rep(i,n) {
      c[i][j] = c[c[i][j-1]][j-1];
    }
  }

  vector<int> pow2(M+1);
  pow2[0] = 1;
  rep(i,M) {
    pow2[i+1] = pow2[i] * 2;
  }
  
  rep(i,q) {
    if(a[i] > b[i]) swap(a[i], b[i]);
    int res = 0;
    int v = a[i];
    while(1) {
      int idx = 0;
      while(c[v][idx] < b[i]) idx++;
      //      cout << v << ":" << idx << "\n";
      // if(c[v][idx] == b[i]) {
      // 	res += pow2[idx];
      // 	break;
      // }
      if(idx == 0) {
	res += pow2[idx];
	break;
      }
      else {
	res += pow2[idx-1];
      }
      //      cout << c[v][idx-1] << "\n";
      v = c[v][idx-1];
    }
    cout << res << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 13696