akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int SEG_LEN = 1<<19;

// 1-indexedのセグメント木
vector<bitset<26>> seg(2*SEG_LEN, bitset<26>(0));

// id番目(1-indexed)の値をxに更新
void update(int id, bitset<26> x){
    id += SEG_LEN; seg[id] = x;
    while(true){
        id /= 2;
        if(id == 0) break;
        seg[id] = seg[2*id] | seg[2*id+1];
    }
}

// 区間[l,r)に対するクエリ(総和)
bitset<26> query(int l, int r){
    l += SEG_LEN; r += SEG_LEN;

    bitset<26> res = 0;
    while(l < r){
        if(l % 2 == 1){ res |= seg[l]; l++; }
        l /= 2;
        if(r % 2 == 1){ res |= seg[r-1]; r--; }
        r /= 2;
    }
    return res;
}

int main(){
    int N, Q; string S;
    cin >> N >> S >> Q;

    for(int i=0; i<N; i++){
        update(i, bitset<26>(1 << (S[i]-'a')));
    }

    for(int q=0; q<Q; q++){
        int a; cin >> a;
        if(a == 1){
            int id; char ch; cin >> id >> ch; id--;
            update(id, bitset<26>(1 << (ch-'a')));
        }
        if(a == 2){
            int l, r; cin >> l >> r; l--; r--;
            bitset<26> res = query(l, r+1);

            cout << res.count() << endl;
        }
    }
}

Measured memory_bytes: 9092
#include <bits/stdc++.h> 
using namespace std;
bool a[100010];
int b[100010],sum=0,n,m,x,y;
int main(){
    a[1] = 1;
    scanf("%d %d",&n,&m);
    if(n == 0 || m == 0){
    	printf("0\n");
    	return 0;
	}
    for(int i=1;i<=n;i++) b[i]=1;
    for(int i=1;i<=m;i++){
        scanf("%d %d",&x,&y);
        if(a[x]==1){
            a[y]=1;
            if(b[x]==1) a[x]=0;
        }
        b[y]++,b[x]--;
    }
    for(int i=1;i<=n;i++) sum+=a[i];
    printf("%d\n",sum); 
    return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a[101];
	gets(a);
	for(int i=0;i<strlen(a);i++){
		if(a[i]=='C'){
			for(int j=i+1;j<strlen(a);j++){
				if(a[j]=='F'){
					cout<<"Yes\n";
					return 0;
				}
			}
		}
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
a = list(map(int, input().split()))
cnt = [0]*9

for ai in a:
    i = min(ai//400, 8)
    cnt[i] += 1

m = 0
M = 0

for i in range(8):
    if cnt[i]>0:
        m += 1
        M += 1

if cnt[-1]>0:
    if m==0:
        m = 1
    
    M += cnt[-1]

print(m, M)

Measured memory_bytes: 38384
#[allow(unused_imports)]
use std::cmp::{min,max};
use std::collections::BinaryHeap;

fn main() {
    let xs = read_vec_i64();
    let (v,e,r) = (xs[0] as usize, xs[1] as usize, xs[2] as usize);
    let mut adj = vec![];
    adj.resize(v,vec![]);
    for _ in 0..e {
        let ys = read_vec_i64();
        let (s,t,d) = (ys[0] as usize, ys[1] as usize, ys[2]);
        adj[s].push((t,d));
    }
    let mut dists = vec![];
    dists.resize(v, None);
    dists[r] = Some(0);
    let mut heap = BinaryHeap::new();
    heap.push((0,r));
    while let Some((md,s)) = heap.pop() {
        let d = -md;
        for t_dd in adj[s].iter() {
            let (t,dd) = *t_dd;
            let nd = d + dd;
            if dists[t].is_none() || nd < dists[t].unwrap() {
                dists[t] = Some(nd);
                heap.push((-nd,t));
            }
        }
    }
    for d in dists {
        match d {
            Some(x) => println!("{}", x),
            None => println!("INF"),
        }
    }
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    let mut ret :i64 = 0;
    for c in ss.chars() {
        if ! ('0' <= c && c <= '9') { break; }
        let t = c.to_digit(10).unwrap() as i64;
        ret = ret * 10 + t;
    }
    return ret;
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let ss = read_line();
    let mut res = Vec::new();
    let mut edited = false;
    let mut x:i64 = 0;
    for c in ss.chars() {
        if !('0' <= c && c <= '9') {
            if edited {
                edited = false;
                res.push(x);
                x = 0;
            }
        }
        else {
            let t = c.to_digit(10).unwrap() as i64;
            x = x * 10 + t;
            edited = true;
        }
    }
    if edited {
        res.push(x);
    }
    return res;
}



Measured memory_bytes: 23356
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t N, M;
	std::cin >> N >> M;

	std::map<int64_t, bool> is_question_solved;
	std::int64_t accepted_questions_num = 0;
	std::map<int64_t, int64_t> penalty;

	for (int64_t i = 1; i <= N; i++)
	{
		is_question_solved[i] = false;
		penalty[i] = 0;
	}

	int64_t p;
	std::string S;
	for (int64_t i = 0; i < M; i++)
	{
		std::cin >> p >> S;
		if (S == "AC")
		{
			if (is_question_solved[p]) continue;
			else
			{
				is_question_solved[p] = true;
				accepted_questions_num++;
			}
		}
		if (S == "WA")
		{
			if (is_question_solved[p]) continue;
			else penalty[p]++;
		}
	}

	int64_t penalty_sum = 0;
	for (int64_t i = 1; i <= N; i++)
	{
		if (is_question_solved[i])
		{
			penalty_sum += penalty[i];
		}
	}

	std::cout << accepted_questions_num << " " << penalty_sum << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}


Measured memory_bytes: 16112
/*
RAone00
Rohit sharma
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef vector < vector < ll > > matrix;
typedef vector < ll > vll;

#define pb push_back
#define debug(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll mod = 1e9 + 7;
const ll inf = LLONG_MAX;
const ll N = 1e5 + 10;

int main() {
    fast_io();
    int a, cnt = 1, min, num;
    cin >> a >> num;
    min = num;
    while (--a) {
      cin >> num;
      if (min >= num) {
        cnt++;
        min = num;
      }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int A = sc.nextInt();
		int B = sc.nextInt();
		int N = 0;
		
		if(A>B) {
			N = A;
		}else {
			N = B;
		}
		
		int wk = 0;
		
		for(int i = 0;i < N;i++){
			if(Math.abs(A-i)==Math.abs(B-i)) {
				System.out.println(i);
		   		sc.close();
		        return ;
			}
		}
		
		System.out.println("IMPOSSIBLE");

   		sc.close();
        return ;

    }
    
}



Measured memory_bytes: 23764
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "0"+sc.next();
		long numOne = 0;
		long powerThree[] = new long[str.length() + 10];
		powerThree[0] = 1;
		for(int i = 1; i < powerThree.length; i ++) {
			powerThree[i] = mod(powerThree[i - 1] * 3);
		}

		long ans = 1;
		for(int i = str.length() - 1; i >= 0; i --) {
			if(str.charAt(i) == '1') {
				ans = mod(powerThree[str.length() - i - 1] + mod(ans * 2));
			}
		}
		System.out.println(mod(ans));
	}

	static long MOD = (long)Math.pow(10, 9) + 7;
	public static long mod(long i) {
		return i % MOD + ((i % MOD) < 0 ? MOD : 0);
	}
	
	static long powerMod(long x, long y) {
		if (y == 0) {
			return 1;
		} else if (y == 1) {
			return x;
		} else if (y % 2 == 0) {
			long tmp = powerMod(x, y / 2);
			return mod(tmp * tmp);
		} else {
			long tmp = powerMod(x, y / 2);
			return mod(mod(tmp * tmp) * x);
		}
	}
	
	static long invMod(long x) {
		return powerMod(x, MOD - 2);
	}
	
	static int MAX_FACT = 200_100;
	static long factMod[] = new long[MAX_FACT];
	static void prepareFact() {
		factMod[0] = 1;
		for(int i = 1; i < MAX_FACT; i ++) {
			factMod[i] = mod(factMod[i - 1] * i);
		}
	}
	
	static long combiMod(int n, int r) {
		if(n < 0 || n < r) { return 0; }
		if(r == 0 || r == n) { return 1; }
		return mod(mod(factMod[n] * invMod(factMod[r])) * invMod(factMod[n - r]));
	}
}

Measured memory_bytes: 27768
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long X;
  scanf("%lld", &X);

  cout << (2200 - X - 1) / 200 << endl;

  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define MAX 1005
const ll MOD=1e9+7;
using namespace std;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(b>=c*a) cout << c << endl;
  else cout << b/a << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
  std::string a,b;
  std::cin >> a >> b;
  int result = 0;
  for (int i=0;i<a.length();++i)
    if (a[i] == b[i]) ++result;
  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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;
}

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

  int S = 0;
  int N_cp = N;
  while (N_cp) {
    S += N_cp % 10;
    N_cp /= 10;
  }
  if (N % S == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
// Problem : A - Takoyaki
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define vp vector<pair<ll,ll>>
#define mod 1000000007
#define M_PI 3.14159265358979323846
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,b,a) for(ll i=b; i>=a ;--i)
#define vin(a) for(auto &i:a) cin>>i
#define mms(a,n) memset(a,n,sizeof(a))
#define fill(a,value) fill(a.begin(),a.end(),value)
#define all(a) a.begin(),a.end()
#define n_ones(x) __builtin_popcountll(x)
#define n_trailzero(x) __builtin_ctzll(x)
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define see(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it){}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
template <typename T, typename U>inline void min_self(T &x, U y){if (y < x)x = y;}
template <typename T, typename U>inline void max_self(T &x, U y){if (x < y)x = y;}
template<class T1, class T2>ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<"["<<v.first<<", "<<v.second<<"]"; return out<<")"; }
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}

// cout << fixed << setprecision(10) << pi <<" "<<npi<<endl; 
// INT64_MAX
// transform(all(s), s.begin(), ::tolower);

ll XX[4] = {-1,0,1,0};
ll YY[4] = {0,-1,0,1};


void solve(){
    int n,x,t;
    cin>>n>>x>>t;
    cout<<((n+x-1)/x) *t<<endl;
    
    
    
	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define debug(x) cerr<<#x<<": "<<x<<'\n'

#define F first 
#define S second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

template <class T>
T in(){ T x; cin >> x; return (x);}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s = in<string>();
    char flag = ' ';
    int cnt =0;
    rep(i,s.size()){
        if(s[i]=='W'){
            if(flag =='B'){
                cnt++;
            }
            flag ='W';
        }else{
            if(flag == 'W'){
                cnt++;
            }
            flag = 'B';
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

// ARC 77-C
// http://arc077.contest.atcoder.jp/tasks/arc077_a

public class Main {
	
	public static void main (String[] args) throws InterruptedException {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		System.out.println(s.indexOf("YAKI") == 0 ? "Yes" : "No");
	}
	
}


Measured memory_bytes: 21972
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;
vector<vector<ll>> edge;
vector<bool> visit;

void dfs(ll v) {
	if (visit[v])return;
	visit[v] = true;
	rep(i, 0, edge[v].size()) {
		dfs(edge[v][i]);
	}
}

int main() {
	ll n, m; cin >> n >> m;
	ll k, l;

	edge.resize(n + m);
	rep(i, 0, n) {
		cin >> k;
		edge[i].resize(k);
		rep(j, 0, k) {
			cin >> l;
			l = n + l - 1;
			edge[i][j] = l;
			edge[l].push_back(i);
		}
	}
	visit.resize(n + m);
	dfs(0);

	rep(i, 0, n) {
		if (!visit[i]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

using namespace std;

#define int long long

const int inf = 1LL<<55;

struct SegmentTree {
  vector<int> data;
  int sz;
  SegmentTree(int n) {
    sz = 1; while(sz < n) sz *= 2;
    data.resize(2*sz-1, inf);
  }
  void update(int k, int x) {
    k += sz-1;
    data[k] = x;
    while(k > 0) {
      k = (k-1)/2;
      data[k] = min(data[2*k+1], data[2*k+2]);
    }
  }
  int query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return data[k];
    int vl = query(a, b, 2*k+1, l, (l+r)/2);
    int vr = query(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
  }
  int query(int a, int b) {
    return query(a, b, 0, 0, sz);
  }
};

signed main() {
  int n, m, k, d, s;
  cin >> n >> m >> k >> d >> s;
  if(n > m) {
    cout << d*k << endl;
    return 0;
  }
  vector<int> a(m), b(m), c(m);
  vector<int> cmpC;
  for(int i = 0; i < m; ++i) {
    cin >> a[i] >> b[i] >> c[i];
    --c[i];
    //cmpC.push_back(c[i]);
  }
  /*
  for(int i = 0; i < m; ++i) {
    c[i] = lower_bound(cmpC.begin(), cmpC.end(), c[i])-cmpC.begin();
  }
  */
  struct State {
    int t, a, b, c;
    State(){}
    State(int t, int a, int b, int c):t(t), a(a), b(b), c(c){}
    bool operator < (const State& s) const {
      return a == s.a ? t > s.t : a > s.a;
    }
  };
  priority_queue<State> que;
  for(int i = 0; i < m; ++i) que.emplace(1, a[i], b[i], c[i]);
  que.emplace(2, s+d, 0, 0);
  int sz = n;//max(n, (int)cmpC.size());
  SegmentTree seg(sz);
  for(int i = 0; i < sz; ++i) seg.update(i, 0);
  while(!que.empty()) {
    State st = que.top(); que.pop();
    //cout<<st.t<<" "<<st.a<<" "<<st.b<<" "<<st.c<<endl;
    if(st.t == 1) {
      int tmp = seg.query(st.c, st.c+1);
      //cout<<tmp<<endl;
      seg.update(st.c, max(st.a, tmp)+st.b);
    } else {
      int tmp = seg.query(0, sz);
      //cout<<sz<<endl;
      //cout<<tmp<<endl;
      --k;
      if(k == 0) {
	cout << max(st.a, tmp)-s << endl;
	return 0;
      }
      que.emplace(2, max(st.a, tmp)+d, 0, 0);
    }
  }
  return 0;
}



Measured memory_bytes: 10332
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

typedef unsigned long long ull;

const ull INF = ULLONG_MAX/3;

void latentEvaluation(int ss, vector<ull> &xList, vector<ull> &sxList){
    int sn = sxList.size();
    if(sxList[ss] != INF){
        for(int i=0;i<sn;i++){
            xList[sn*ss+i] = sxList[ss];
        }
        sxList[ss] = INF;
    }
}

void update(int s, int t, ull x, vector<ull> &xList, vector<ull> &sxList){
    int nn = xList.size();
    int sn = sxList.size();
    int ss = s/sn;
    int tt = t/sn;
    if(ss == tt){
        latentEvaluation(ss, xList, sxList);
        for (int i=0;i<t-s+1;i++){
            xList[s+i] = x;
        }
    }else{
        latentEvaluation(ss, xList, sxList);
        for(int i=s;i<(ss+1)*sn;i++){
            xList[i] = x;
        }

        latentEvaluation(tt, xList, sxList);
        for(int i=tt*sn;i<t+1;i++){
            xList[i] = x;
        }

        for(int i=ss+1;i<tt;i++){
            sxList[i] = x;
        }
    }
}

void find(int ind, vector<ull> &xList, vector<ull> &sxList){
    int nn = xList.size();
    int sn = sxList.size();
    latentEvaluation(ind/sn, xList, sxList);
    cout << xList[ind] << endl;
}

int main(){
    int n, q, qType, s, t,ind;
    ull x;
    cin >> n >> q;
    int sn = sqrt(n)+1;

    vector<ull> xList(sn*sn, (1ull << 31) -1);

    vector<ull> sxList(sn, INF);

    for (int i=0;i<q;i++){
        cin >> qType;
        if (qType == 0){
            cin >> s >> t >> x;
            update(s,t,x,xList,sxList);
        }else{
            cin >> ind;
            find(ind, xList, sxList);
        }
        /*
        for (int i=0;i<sn*sn;i++){
            cout << xList[i]  << " ";
        }
        cout << endl;
        for (int i=0;i<sn;i++){
            cout << sxList[i] << " ";
        }
        cout << endl;
        */
    }
    return 0;
}

Measured memory_bytes: 3612
N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
    cnt[A[i]-1] += 1
S = 0
for i in range(N):
    S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
    if cnt[A[i]-1] == 1:
        print(int(S))
    else:
        print(int(S+(3-2*cnt[A[i]-1])/2))


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

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

	int aji = 0;
	int delta = 0;
	int delta_min = INT_MAX;
	for (int i = 1; i <= n; i++)
	{
		aji += l + i - 1;
		int tmp = abs(l + i - 1);
		if (tmp < delta_min)
		{
			delta_min = tmp;
			delta = l + i - 1;
		}
	}

	cout << aji - delta << endl;
}


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

struct aa {
  ll l,r;  
};

int main() {
    ll n;
    std::cin >> n;
    vector<aa> a(n);

    ll maxl = -1;
    ll minr = 1e18;
    ll maxli;
    ll minri;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i].l >> a[i].r;
        a[i].r++;
        ans = max(ans,a[i].r-a[i].l);
        if(a[i].l>maxl){
            maxl = a[i].l;
            maxli=i;
        }
        if(a[i].r<minr){
            minr = a[i].r;
            minri=i;
        }
    }
    ans += max(0ll, minr-maxl);
    
    vector<aa> b(n);
    
    for (int i = 0; i < n; i++) {
        b[i].l = max(0ll, minr-a[i].l);
        b[i].r = max(0ll, a[i].r-maxl);
    }
    sort(b.begin(),b.end(),[](auto const& lhs, auto const& rhs) {
        if (lhs.l != rhs.l) return lhs.l < rhs.l;
        return lhs.r > rhs.r;
    });
    
    ll lmin = b[1].l;
    ll rmin = b[0].r;
    for (int i = 1; i < n; i++) {
        rmin = min(rmin,b[i-1].r);
        lmin = b[i].l;
        ans = max(ans, lmin+rmin);
    }
    std::cout << ans << std::endl;
}



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

    int x;
    cin>>x;
    int joy=0;
    joy += 1000 *( x / 500);
    x %= 500;
    x /= 5;
    joy += 5 * x;
    cout << joy << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>

using namespace std;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        string s,t;
        lli ans=0;
        cin>>s>>t;
        for(i=0;i<s.length();i++)
        {
            if(s[i]!=t[i])
                ans++;
        }
        cout<<ans<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3884
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		in.close();
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, Scanner in, PrintWriter out) {

			while (in.hasNext()) {
				int[] cnt = new int[101];
				while (true) {
					int s = in.nextInt();
					int t = in.nextInt();
					if ((s | t) == 0) break;
					cnt[s]++;
					cnt[t]++;
				}
				System.out.println(check(cnt) ? "OK" : "NG");
			}
		}

		boolean check(int[] cnt) {
			boolean ok = true;
			for (int i = 0; i < 101; i++) {
				if (i == 1 || i == 2) {
					if (cnt[i] % 2 != 1) ok = false;
				} else {
					if (cnt[i] % 2 == 1) ok = false;
				}
			}
			return ok;
		}
	}
}



Measured memory_bytes: 32132
#include<bits/stdc++.h>
#define pi 3.141592653897932384626
//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
using namespace std;
#define abs(a) ((a)<0?(-(a)):(a))
long a[200005];
pair<long,long>b[200005];
long c[200005];
int main()
{
    long n,m=0;
    cin>>n;
    for(long i=0;i<n;i++){
        scanf("%ld",&a[i]);
        if(a[i]>a[m])m=i;
    }
    cout<<a[m]<<' ';
    double f=(a[m]%2==0?a[m]:(a[m]+1))/2.0;
    long k=LONG_MAX;
    for(long i=0;i<n;i++){
        if(abs(a[i]-f)<abs(k-f)&&i!=m)
            k=a[i];
    }
    cout<<k<<endl;
	return 0;
}


Measured memory_bytes: 2304
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let s: u32 = sc.read();
    let hh = s /3600;
    let mm = s % 3600 /60;
    let ss = s % 60 ;
    println!("{}:{}:{}", hh, mm, ss);
}

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
 
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


Measured memory_bytes: 5024
#include <bits/stdc++.h>
#define ll long long 
#define ld long double
using namespace std;
const ll INF = 1e18;
const ll MOD = 998244353;


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 deb(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define deb(...) 42
#endif


int32_t main() {
	ios::sync_with_stdio(!cin.tie(NULL));

	int n;
	cin >> n;
	int u, v, x;
	vector<int> xxor(n + 10, 0);
	for(int i = 0; i < n - 1; i++) {
		cin >> u >> v;
		cin >> x;
		xxor[u] ^= x, xxor[v] ^= x;
	}
	
	int cnt[20 + 10];
	memset(cnt, 0, sizeof(cnt));
	for(int i = 0; i < n; i++) {
		cnt[xxor[i]]++;
		deb(i, xxor[i]);
	}
	int res = 0;
	int now = 0;
	vector<int> cur;
	for(int i = 1; i < 16; i++) {
		res += (cnt[i] / 2);
		cnt[i] &= 1;
		now += cnt[i];
		if(cnt[i])	cur.push_back(i);
	}

	vector<int> dp(1 << 17, 0);
	
	for(int i = 0; i < (1 << now); i++) {
		for(int j = 0; j < now; j++) {
			if(i&(1 << j))	dp[i] ^= cur[j];
		}
	}
	deb(dp[7], cnt[1], cnt[2], cnt[4]);
	vector<int> memo(1 << 16);

	for(int mask = 1; mask < (1 << now); mask++) {
		if(dp[mask])	continue;
		memo[mask] = 1;
		for(int sub = (mask - 1)&mask; sub;	sub = (sub - 1)&mask) {
			if(dp[sub] == 0)	memo[mask] = max(memo[mask], memo[mask^sub] + 1);
		}
		deb(mask, dp[mask]);
	}
	deb(now, dp[(1 << now)], res);
	cout << res + (now - memo[(1 << now) - 1]);
}



Measured memory_bytes: 4504
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
int main() {
  int INF=10000000; 
  int N,M; 
  cin>>N>>M;
  int ans=0;
  vector<vector<char>> maze(N, vector<char>(M));
  for(int i=0; i<N;i++){
    for(int j=0; j<M;j++){
      cin>>maze[i][j];
      if(maze[i][j]=='#'){
        ans++;
      }
    }
  }
  
  vector<vector<int>> d(N, vector<int>(M)); 
  int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
    queue<pair<int,int>> que;    
    for(int i=0; i<N;i++){
      for(int j=0; j<M;j++){
        d[i][j]=INF;
      }
    }

    que.push(pair<int,int>(0,0));
    d[0][0]=1;
    
    while(!que.empty()){
      pair<int,int> p=que.front();que.pop();
      if(p.first==N-1&&p.second==M-1){
        break;
      }
      
      for(int i=0; i<4;i++){
        int nx=p.first+dx[i],ny=p.second+dy[i];
        
        if (0<=nx&&nx<N&&0<=ny&&ny<M&&maze[nx][ny]!='#'&&d[nx][ny]==INF){
          que.push(pair<int,int>(nx,ny));
          d[nx][ny]=d[p.first][p.second]+1;
        }
      }
    }
  if(d[N-1][M-1]==INF){
    cout<<-1<<endl;
  }
  else{
    cout<<N*M-ans-d[N-1][M-1]<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, a, b, c, x;
int y[101];

int main(){
	while (cin >> n >> a >> b >> c >> x&&n + a + b + c + x){
		REP(i, n) cin >> y[i];
		int ans = -1, co = 0;
		REP(i, 10001){
			if (y[co] == x)co++;
			if (co == n){
				ans = i;
				break;
			}
			x = (a*x + b) % c;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   string s;
   cin >> s;
   int n = s.size();
   rep(i, 0, n) s[i] = 'x';
   rep(i, 0, n) cout << s[i];
   cout << endl;
   return 0;
}

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

int main() {
  int n;
  cin >> n;
  int b = n;
  int r = 0;

  while(n>0){
    r += n % 10;
    n /= 10;
  }
  if(b%r == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

const ll MOD = 1e9 + 7;

// 最大公約数
ll gcd(ll a, ll b)
{
   if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}

// 最小公倍数
ll lcm(ll a, ll b){
   return a / gcd(a, b) * b;
}

//素数判定
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された
    if(n % 2 == 0 || n % 3 == 0) return false;
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

void solve() {
    double pie = acos(-1.0);
    double r; cin >> r;
    cout << fixed << setprecision(10) << 2.0*r*pie << endl;
}

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

    solve();
    return 0;
}


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> p(n);
	vector<bool> ju(n,false);
	vector<pair<int, int>> da(n);
	for (int i = 0;i < n;i++) {
		cin >> p[i];
		da[i].first = p[i];
		da[i].second = i;
	}
	int ans = 0;
	//sort(da.begin(), da.end());
	for (int i = 1;i < min(m,n)+1;i++) {
		for (int j = 0;j < i + 1;j++) {
			int mo = 0;
			vector<int> me(i);
			for (int l = 0;l < j;l++){
				me[l] = p[l];
				mo += me[l];
			}
			for (int l = j;l < i;l++) {
				me[l] = p[n - l + j-1];
				mo += me[l];
			}
			sort(me.begin(), me.end());
			for (int l = 0;l < min(i, m - i);l++) {
				if (me[l] > 0)
					break;
				mo -= me[l];
			}
			ans = max(ans, mo);
            //cout << ans << endl;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
    input <- getContents
    let l1 : l2 : _ = lines input
    let [n, m]      = (map read . words) l1 :: [Int]
    let list        = (map read . words) l2 :: [Int]
    let mlist       = (map (`mod` m) . scanl1 (+)) list
    let zero        = (length . filter (== 0)) mlist
    let f n = (n * (n - 1)) `div` 2
    let x = zero + (sum . map f . map length . group . sort) mlist
    putStrLn $ show x


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

int main(){
  int r,g,b;
  int k;
  cin >> r >> g >> b;
  cin >> k;
  
  for(int i=0; i<k; i++){
   if(g <= r){
     g *= 2;
   }else if(b <= g){
	 b *= 2;
   }
  }
 if(b > g && g > r){
   cout << "Yes" << endl;
 }else{
   cout << "No" << endl;
 }
  return 0;
}

Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)
var rd = bufio.NewReaderSize(os.Stdin, 10000000)

func readLine() string {
  buf := make([]byte, 0, 10000000)
  for {
	l, p, _ := rd.ReadLine()
	buf = append(buf, l...)
	if !p {
	  break
	}
  }
  return string(buf)
}

func nextStr() string {
  sc.Scan()
  return sc.Text()
}

func nextInt() int {
  sc.Scan()
  i, _ := strconv.Atoi(sc.Text())
  return i
}

func main() {
  sc.Split(bufio.ScanWords)
  L, R, d := nextInt(), nextInt(), nextInt()
  for {
    if L % d == 0 {
      break
	} else {
	  L += 1
	}
  }
  cnt := 0
  for i := L; i <= R; i += d {
	cnt += 1
  }
  fmt.Println(cnt)
}


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


Measured memory_bytes: 2056
#coding:utf-8
#1_7_A
class Node():
    def __init__(self, node_id, degree, children):
        self.node_id    =   node_id
        self.parent     =   -1
        self.depth      =   0
        self.typ        =   "leaf"
        self.degree     =   degree
        self.children   =   children

    def set_attr(self, parent, depth):
        self.parent =   parent
        self.depth  =   depth
        for child_id in self.children:
            self.typ = "internal node"
            tree[child_id].set_attr(self.node_id, self.depth + 1)
        if self.parent == -1:
            self.typ = "root"

n = int(input())
tree = [None for i in range(n)]
root = set(range(n))

for i in range(n):
    info = list(map(int, input().split()))
    tree[info[0]] = Node(info[0], info[1], info[2:])
    root -= set(info[2:])

root_id = root.pop()
tree[root_id].set_attr(-1, 0)

for node in tree:
    print("node {}: parent = {}, depth = {}, {}, {}".format(node.node_id, node.parent, node.depth, node.typ, node.children))

Measured memory_bytes: 52104
#include <stdio.h>
int main()
{
	int i=1,x,n;

	scanf("%d",&n);
	while(1){
		x=i;
		
		if(x%3==0){
			printf(" %d",i);
		}
		else if(x%10==3){
			printf(" %d",i);
		}
		else if((x/10)%10==3){
			printf(" %d",i);
		}
		else if((x/100)%10==3){
			printf(" %d",i);
		}
		else if((x/1000)%10==3){
			printf(" %d",i);
		}
		if(++i>n) break;
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2056
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int ret=0;
            var s = Console.ReadLine().Split(' ');
            var s2 = Console.ReadLine().Split(' ');
            List<int> dates12=new List<int>(){31,28,31,30,31,30,31,31,30,31,30,31};
            int M1 = int.Parse(s.First());
            int M2 = int.Parse(s2.First());
            int D1 = int.Parse(s.Last());
            int D2 = int.Parse(s2.Last());
            if (M2 - M1 == 1&&D2==1)
            {
                ret = 1;
            }
            Console.WriteLine(ret);
            //Console.ReadLine();

        }
    }
}

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


int main() {
  int n;
  cin >> n;
  vector<int>a(n);

  rep(i,n){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  cout<<a.at(n-1)<<" ";
  int co=1001001001;
  int ans=0;
  rep(i,n-1){
    if(abs(a.at(i)*2-a.at(n-1))<co){
      co=abs(2*a.at(i)-a.at(n-1));
      ans=a.at(i);
      
    }
    
  }
  cout<<ans<<endl;
  
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin >> N;
  set<string> s;
  for(int i=0;i<N;i++){
    string str;
    cin >> str;
    s.insert(str);
  }

  cout << (int)s.size() << endl;
  
  return 0;
}


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

int main(){
    
    int q,x;
    char com[20];

    list<int> v;
    scanf("%d",&q);
    for (int i=0;i<q;i++){

        
        scanf("%s",com);
        if(com[0]=='i'){
            scanf("%d",&x);
            v.push_front(x);
        }else if(com[6]=='L'){
            v.pop_back();
        }else if(com[6]=='F'){
            v.pop_front();
        }else if(com[0]=='d'){
            scanf("%d",&x);     
            for(list<int>::iterator it=v.begin();it!=v.end();it++){
               
                if(*it==x){
                    v.erase(it);
                    break;
                }
             }
        }
    }

    int i=0;

    for(list<int>::iterator it=v.begin();it!=v.end();it++){
        if(i++) printf(" ");
        printf("%d",*it);
    }

    printf("\n");
    
    return 0;
}


Measured memory_bytes: 34392
# author:  Taichicchi
# created: 14.09.2020 22:18:44

import sys
from math import gcd

N = int(input())

A = list(map(int, input().split()))

ans = gcd(A[0], A[1])
for i in range(2, N):
    ans = gcd(ans, A[i])

print(ans)


Measured memory_bytes: 20144
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

a,b,c,d = LI()
while True:
    c -= b
    if c<=0:
        print('Yes')
        break
    a -= d
    if a<=0:
        print('No')
        break

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

int main(){
    int x;
    cin>>x;
    // string rohan;
    // map<int,string>rahul;
    map<string,int>rahul;
    
    for(int i=0;i<x;i++){
        string rohan;
        cin>>rohan;
        rahul[rohan]++;
    }
    int count=0,count1=0,count2=0,count3=0;
    for(auto x:rahul){
        if(x.first=="AC"){
            count=x.second;
            // cout<<x.first<<" "<<x.second<<endl;
        }
        else if(x.first=="WA"){
            count1=x.second;
        }
        else if(x.first=="TLE"){
            count2=x.second;
        }
        else
        count3=x.second;
    }
   
    cout<<"AC x "<<count<<endl;
    cout<<"WA x "<<count1<<endl;
    cout<<"TLE x "<<count2<<endl;
    cout<<"RE x "<<count3<<endl;
        
    
    
    
}

Measured memory_bytes: 3652
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
int c=scan.nextInt();
double d=0;
int ans=0;
double ans1=1000;
int j=0;
for(int i=0;i!=a;i++) {
d=scan.nextInt();
d=b-(d*0.006);
d-=c;
if(d<0) {d*=-1;}
if(d<ans1) {ans1=d;ans=i+1;}
}
System.out.println(ans);
	}
}

Measured memory_bytes: 23892
import collections

N, M = map(int, input().split())
miti = [[] for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    miti[A-1].append(B-1)
    miti[B-1].append(A-1)

ans = [0] * (N-1)
detekita = [0] * N
detekita[0] = 1
#bfs
queue = collections.deque()
queue.append(0)
while queue:
    current_node = queue.popleft()
    for x in miti[current_node]:
        if detekita[x] == 0:
            detekita[x] = 1
            ans[x-1] = current_node + 1
            queue.append(x)


print('Yes')
for i in range(N - 1):
    print(ans[i])


Measured memory_bytes: 94928
N,M = map(int,input().split())
img_a = [list(input()) for _ in range(N)]
img_b = [list(input()) for _ in range(M)]
ans = "No"

for i in range(N-M+1):
    for j in range(N-M+1):
        cnt = 0
        for row in range(M):
            for col in range(M):
                if img_b[row][col] == img_a[i+row][j+col]:
                    cnt += 1
        if cnt == M*M:
            ans ="Yes"

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j); i <= (int) (k); ++i)
#define Rep(i, j, k) for(R int i = (j); i >= (int) (k); --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 3000;
const ll INF = 5e16;

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

	#define dd ch = getchar()
	inline ll read() {
		R ll x = 0; R int f = 0; R char dd;
		for (; !isdigit(ch); dd) f ^= (ch == '-');
		for (; isdigit(ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write ( ll x ) {
		if (x < 0) x = -x, putchar('-');
		if (x > 9) write(x / 10); putchar(x % 10 | 48);
	}

	inline void wrn ( ll x ) { write(x), putchar(' '); }

	inline void wln ( ll x ) { write(x), putchar('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn(x), wln(y); }

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	/*
		设 f[i][j] 表示前 i 个 j 个在头部的概率。
		f[i][j] += f[i - 1][j] * (1.0 - p[i]) 
		f[i][j] += f[i - 1][j - 1] * p[i]
	*/
	
	ll n;
	double Ans, p[N], f[N][N];
	
	int main() {
		n = read(), f[0][0] = 1;
		For ( i, 1, n ) cin >> p[i];
		For ( i, 1, n ) For ( j, 0, i ) {
			if (j) f[i][j] = f[i - 1][j - 1] * p[i];
			f[i][j] += f[i - 1][j] * (1.0 - p[i]);
		}
		ll Lim = ceil(n / 2.0);
		For ( i, Lim, n ) Ans += f[n][i];
		return printf("%.9lf\n", Ans), 0;
	}
	
}

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);

	return Cesare :: main();
}

/*

*/






Measured memory_bytes: 68864
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')

n = iin()
a = sorted(iln(), reverse=True)

MAX = a[0]
diff = MAX
r = 0
for i in range(1,n):
    tmp_diff = abs(2*a[i]-MAX)
    if tmp_diff < diff:
        diff = tmp_diff
        r = a[i]
print(MAX, r)


Measured memory_bytes: 16748
// * It's time to PLAY !

#include <bits/stdc++.h>

using namespace std;

#ifdef EXILE
#include "prettyprint.hpp"
#define debug(args) cerr << #args << " = " << args << endl;
#else
#define debug(args) 20040119
#endif

#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define int long long

void OPEN(string str)
{
    freopen((str + ".inp").c_str(), "r", stdin);
    freopen((str + ".out").c_str(), "w", stdout);
}

const int N = 1e5 + 7;
int a[3][N], pre[N];

void PLAY()
{
    int n;
    cin >> n;
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cin >> a[i][j];
        }
        sort(a[i], a[i] + n);
    }
    for (int i = 0; i < n; ++i)
    {
        pre[i] = a[2] + n - upper_bound(a[2], a[2] + n, a[1][i]) + (i ? pre[i - 1] : 0);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        int ind = upper_bound(a[1], a[1] + n, a[0][i]) - a[1];
        if (ind < n)
        {
            ans += pre[n - 1] - (ind ? pre[ind - 1] : 0);
        }
    }
    cout << ans;
}

signed main()
{
    fastio;
    PLAY();
    return 0;
}

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

#define el '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back

typedef long long ll;

bool cmp(pair<string, pair<int,int>> a, pair<string, pair<int,int>> b){
  if(a.fi==b.fi){
    return a.se.fi > b.se.fi;
  }
  return a.fi < b.fi;
}
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int n;
  cin >> n;
  vector<pair<string, pair<int,int>>> v(n+1);
  for(int i = 1; i <= n; i++){
    cin >> v[i].fi >> v[i].se.fi;
    v[i].se.se = i;
  }
  sort(v.begin()+1, v.end(), cmp);
  for(int i = 1; i <= n; i++){
    cout << v[i].se.se << el;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define mod 1000000007
#define lol 200005
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=b;i>=a;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vp vector<pair<double,double>>
#define vpp vector<pair<int, pair<int,int>>>
#define pp pair<int,int>

int main()
{
  int n;
  cin>>n;
  int dp[n][3];
  ffor(i,0,n)
  {
  	 int a,b,c;
  	 cin>>a>>b>>c;
     if(i==0)
     {
     	dp[i][0]=a;
     	dp[i][1]=b;
     	dp[i][2]=c;
     }
     else
     {
     	dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a;
     	dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b;
     	dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c;
     }
  }
  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}

Measured memory_bytes: 4780