akhauriyash/Code-Regression huggingface dataset:
// abc105_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, M;
    cin >> N >> M;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    vector<ll> cumsum(N+1);
    REP(i, N){
        cumsum[i+1] = (cumsum[i] + A[i]) % M;
    }

    map<ll, int> cnts;
    cnts[0] = 1;
    ll ans = 0;
    REPN(i, 1, N+1){
        ans += cnts[cumsum[i]];
        cnts[cumsum[i]]++;
    }

    print(ans);


    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
#define PAI 3.14159265358979
// ver1.6
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  int n;
  cin >> n;
  Vi vec(n);
  rep(i,0,n) cin >> vec[i];
  Vi L(n),R(n);
  
  L[0] = vec[0];
  R[n-1] = vec[n-1];
  
  rep(i,1,n){
    L[i] = gcd(L[i-1],vec[i]);
  }
  repreq(i,n-2,0){
    R[i] = gcd(R[i+1],vec[i]);
  }
  
  int ans = 0,memo = 0;
  rep(i,1,n-1){
    memo = gcd(L[i-1],R[i+1]);
    ans = max(ans,memo);
  }
  ans = max(ans,R[1]);
  ans = max(ans,L[n-2]);
  cout << ans << endl;
  return 0;
}


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

int main(){
  vector<int> square(400);
  for(int i=0;i<=320;i++){
    square[i] = i*i;
  }

  int a,b,s;
  cin >> a >> b;
  if(b < 10){
    s = 10 * a + b;
  }else if(b >= 10 && b < 100){
    s = 100 * a + b;
  }else if(b == 100){
    s = 1000 *a + b;
  }

  int check = 0;

  for(int i=0;i<320;i++){
    if(s == square[i]){
      check = 1;
      break;
    }
  }
  if(check == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <string>
#include <vector>
#include <iostream>
#include <cstring>
#include <map>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;

int n, m;
int dr[] = { -1, 0, 1, 0 }, dc[] = { 0, 1, 0, -1 };
int used[12][12];

bool done(const vector<string>& v)
{
	rep(i, n) rep(j, m) if (v[i][j] != v[0][0]) return false;
	return true;
}

void dfs(vector<string>& v, int r, int c, int x)
{
	int t = v[r][c];
	v[r][c] = x;
	used[r][c] = 1;
	rep(i, 4) {
		int nr = r + dr[i];
		int nc = c + dc[i];
		if (nr < 0 || nr >= n || nc < 0 || nc >= m) continue;
		if (used[nr][nc] || v[nr][nc] != t) continue;
		dfs(v, nr, nc, x);
	}
}

int main()
{
	ios_base::sync_with_stdio(0);

	while (cin >> m >> n) {
		if (!(n | m)) break;
		vector<string> v(n, string(m, ' '));
		rep(i, n) rep(j, m) cin >> v[i][j];

		queue<vector<string> > q;
		map<vector<string>, int> num;
		q.push(v);
		num[v] = 0;
		const string rgb = "RGB";
		int res = -1;
		while (!q.empty()) {
			vector<string> p = q.front(); q.pop();
			if (done(p)) { res = num[p]; break; }
			rep(i, rgb.size()) {
				vector<string> next = p;
				memset(used, 0, sizeof(used));
				dfs(next, 0, 0, rgb[i]);
				if (num.find(next) != num.end()) continue;
				q.push(next);
				num[next] = num[p] + 1;
			}
		}
		cout << res << endl;
	}
	return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> adj(2*n);
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        adj[a].push_back(n+b);
        adj[n+b].push_back(a);
        adj[b].push_back(n+a);
        adj[n+a].push_back(b);
    }

    vector<int> wait;
    wait.push_back(0);
    int turn = 0;
    int count[2] = {1, 0};
    vector<bool> used(2*n, false);
    used[0] = true;
    int ans = -1;
    while(!wait.empty()){
        turn++;
        vector<int> nwait;
        for(int v: wait){
            for(int next: adj[v]){
                if(!used[next]){
                    used[next] = true;
                    nwait.push_back(next);
                    count[next/n]++;
                }
            }
        }
        if(count[0]==n or count[1]==n){
            ans = turn;
            break;
        }
        swap(wait, nwait);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 15380
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    println!("{}",a*a*a)
}

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


int main() {
  int N,D;
  cin >> N >> D;
  vector<vector<long long>> A(N,vector<long long>(2));
  for(int i = 0; i < N; i++){
    cin >> A.at(i).at(0) >> A.at(i).at(1);
  }
  int count = 0;
  for(int i = 0; i < N; i++){
    if(sqrt( A.at(i).at(0)*A.at(i).at(0) +  A.at(i).at(1)*A.at(i).at(1) ) <= D ){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 14412
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

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

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
typedef vector<int> vi;

int main(){
  int N;
  while(cin>>N,N){
    vector<vi> pile(N);
    int place[101] = {};
    REP(i,N){
      pile[i].push_back(i+1);
      place[i+1] = i;
    }
    int x,y;
    while(cin>>x>>y, x){
      if(x == y) continue;
      int p1 = place[x];
      vector<int>& v = pile[p1];
      bool donothing = false;
      if(v[0] == x && y == 0) donothing = true;
      for(int i = 0; i < v.size(); i++){
        if(v[i] == y) donothing = true;
        if(v[i] == x) break;
      }
      if(donothing) continue;
      while(!v.empty()){
        int n = v.back();
        v.pop_back();
        if(n == x){
          int p2 = (y != 0)?(place[y]):(x-1);
          pile[p2].push_back(x);
          place[x] = p2;
          break;
        }
        assert(pile[n-1].size() == 0);
        pile[n-1].push_back(n);
        place[n] = n-1;
      }
    }
    vector<int> ans;
    REP(i,N)if(pile[i].size() > 0) ans.push_back(pile[i].size());
    sort(ans.begin(), ans.end());
    REP(i,ans.size())cout<<ans[i]<<endl;
    cout<<"end"<<endl;
  }
  return 0;
}

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

int main() {
  long long A,B,C,D;
  cin>>A>>B>>C>>D;
  int i=0;
  long long buff=B;
  long long CD[3];
  long long a, b, r, x, tmp;
  a=C;
  b=D;
  x = a * b;
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  
  CD[0]=C;
  CD[1]=x/b;
  CD[2]=D;
  int flag=0;
  int buff2=0;
  int Num[3];
  for(int i=0;i<3;i++){
    //Num[i]=(B/CD[i])-((A-1)/CD[i]);
  }
  buff=B-B/CD[0]-B/CD[2]+B/CD[1];
  buff-=(A-1)-(A-1)/CD[0]-(A-1)/CD[2]+(A-1)/CD[1];
  
  cout<<buff<<endl;
  return 0;
}



Measured memory_bytes: 256
n, m, k = [int(x) for x in input().split()]
fr = [i for i in range(n)]
dfr = [[] for i in range(n)]
bl = [[] for i in range(n)]
def deref(a):
    s = []
    while True:
        next = fr[a]
        if next == a:
            break
        s.append(a)
        a = next
    for i in s:
        fr[i] = a
    return a
def merge(a, b):
    ra, rb = deref(a), deref(b)
    fr[rb] = ra
for i in range(m):
    a, b = [int(x) - 1 for x in input().split()]
    dfr[a].append(b)
    dfr[b].append(a)
    a, b = min(a, b), max(a, b)
    merge(a, b)
for i in range(n):
    deref(i)
ss = [[] for i in range(n)]
for i in range(n):
    ss[fr[i]].append(i)
for i in range(k):
    c, d = [int(x) - 1 for x in input().split()]
    bl[c].append(d)
    bl[d].append(c)
for i in range(n):
    bl[i].sort()
r = []
for i in range(n):
    v = len(ss[fr[i]]) - len(dfr[i]) - 1
    v -= sum(fr[j] == fr[i] for j in bl[i])
    r.append(v)
print(' '.join(str(x) for x in r))

Measured memory_bytes: 62804
import sys

S = list(input())
ls = len(S)

if ls == 1:
    print(0)
    sys.exit()
elif len(set(S)) == 1:
    print(0)
    sys.exit()

tg = S[0]
n = 0
for i in range(ls):
    if i == 0:
        continue
    else:
        if S[i] != tg:
            n += 1
            tg = S[i]
print(n)

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll arr[2005][2005],vis[2003]={0},s;
queue<ll>q;
vector<ll>id[2003];
void bfs(ll node){
	vis[node]=1;
	q.push(node);
	while(!q.empty()){
		s=q.front();
		q.pop();
		for(int i=0;i<id[s].size();i++){
			if(vis[id[s][i]]==1) continue;
			vis[id[s][i]]=1;
			q.push(id[s][i]);
			arr[node][id[s][i]]=1+arr[node][s];
		}
	}
}
int main(){
	ll n,x,y;
	cin>>n>>x>>y;
	for(int i=1;i<n;i++){
		id[i].push_back(i+1);
		id[i+1].push_back(i);
	}
	id[x].push_back(y);
	id[y].push_back(x);
	for(int i=0;i<=n;i++){
		arr[i][i]=0;
	}
	for(int i=1;i<=n;i++){
		bfs(i);
		for(int i=0;i<=n;i++) vis[i]=0;
	}
	ll cnt[2003]={0};
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cnt[arr[i][j]]++;
		}
	}
	for(int i=1;i<n;i++) cout<<(cnt[i]/2)<<endl;
	return 0;
}

Measured memory_bytes: 31744
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc014.contest.atcoder.jp/tasks/agc014_a>
問題文============================================================
 高橋君と青木君とすぬけ君はそれぞれクッキーを A,B,C 個持っています。
 
 この 3 人はお互いにクッキーを交換することにしました。具体的には、以下の操作を繰り返します。
 
 3 人は同時に、各々が持っているクッキーを半分ずつに分けて、残りの 2 人にそれぞれ一方を渡す。
 ただし、誰かの持っているクッキーの個数が奇数個になったら、そこで操作を繰り返すのをやめます。
 
 さて、クッキーの交換は何回行うことができるでしょうか。 ただし、無限に続けられる場合もあることに注意してください。
=================================================================

解説=============================================================

 
 
================================================================
*/

bool check(ll A,ll B,ll C){
    return (A|B|C)&1;
}
void exchange(ll &A,ll& B,ll &C){
    ll tA = B/2 + C/2;
    ll tB = A/2 + C/2;
    ll tC = A/2 + B/2;
    A = tA;
    B = tB;
    C = tC;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll A,B,C; cin >> A >> B >> C;
    for(int i = 0; i < 10000000;i++){
        if(check(A,B,C)){
            cout << i << endl;
            return 0;
        }
        exchange(A,B,C);
    }
    cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;


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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
  cout << ((S == "AAA" || S=="BBB") ? NO : YES) <<endl;

}

int main(){ 
    cout << setprecision(10);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;
const int INF = 1e9;
const int MOD = 1e9+7;
const double PI = 2*acos(0.0);
#define int long long
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n,x;
	cin>>n>>x;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	int res = abs(a[0]-x);
	for(int i=1;i<n;i++) res = __gcd(res,abs(a[i]-x));
	cout<<res<<endl;	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int main()
{
	fastIO
//	inp_out();

	ll r,g,a,b,c;
	cin>>r>>g>>a>>b>>c;

	vll red(a),green(b),no_color(c);

	for(ll i=0;i<a;++i)
	{
		cin>>red[i];
	}

	for(ll i=0;i<b;++i)
	{
		cin>>green[i];
	}

	for(ll i=0;i<c;++i)
	{
		cin>>no_color[i];
	}

	sort(all(red));
	sort(all(green));
	sort(all(no_color),greater<ll>());

	vll st;
	ll ans=0;
	for(ll i=0;i<r;++i)
	{
		ans+=red[a-i-1];
		st.pb(red[a-i-1]);
	}

	for(ll i=0;i<g;++i)
	{
		ans+=green[b-i-1];
		st.pb(green[b-i-1]);
	}

	sort(all(st));

	ll val=0,val1=0,diff=0;
	for(ll i=0;i<min(c,g+r);++i)
	{
		val+=no_color[i];
		val1+=st[i];
		diff=max(diff,val-val1);
	}


	cout<<ans+diff;

	return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  int n, m; cin >> n >> m;
  vector<pair<int,int>> v(m);

  rep(i, m) cin >> v[i].fi >> v[i].se;
  rep(i, 10001) {
    string s = to_string(i);
    if (si(s) != n) continue;

    int cnt = 0;

    rep(j, m) if ((s[v[j].fi-1]-'0') == v[j].se) ++cnt;

    if (cnt == m) {
      cout << s << endl;
      return 0;
    }
  }

  cout << -1 << endl;
}


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

int main(){
	string S;
	cin >> S;
	bool flag=false;
	if(S[0]==S[1] && S[2]==S[3] && S[0]!=S[2])flag=true;
	if(S[0]==S[2] && S[1]==S[3] && S[0]!=S[1])flag=true;
	if(S[0]==S[3] && S[1]==S[2] && S[0]!=S[1])flag=true;
	if(flag)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
h=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]

n = int(input())

for i in range(n):
    b, f, r, v = [int(i) for i in input().split()]
    h[b-1][f-1][r-1] += v

for i, b in enumerate(h):
  for f in b:
    for r in f:
      print(" {}".format(r),end="")
    print()
  if i < 3:
    print("#"*20)


Measured memory_bytes: 5620
#include <bits/stdc++.h>
#include <algorithm>
#include <queue>
using namespace std;
int main() {
	string S; 
	cin >> S; 
	int ans = 0; 
	for(int i = 0; i <= 3; i++){
		if(S.at(i) == '2'){ans ++;}
	}
	cout << ans << endl; 
}

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

namespace Caddi2018
{
    class Program
    {
        static void Main(string[] args)
        {
            var obj = new Q1();
            obj.Solver();
        }
    }

    class Q1
    {
        public void Solver()
        {
            var str = Console.ReadLine();

            Console.WriteLine(str.Count(s => s == '2'));
            
        }
    }
}


Measured memory_bytes: 13268
<?php

$N = trim(fgets(STDIN));
$count = 0;
$result = [];
for($i=1; $i<=$N; $i++){
    if($i%2 !== 1){
        continue;
    }
    $result = [];
    for($n=1; $n*$n<=$i; $n++){
        if($i%$n == 0){
            $result[] = $n;
            if($i/$n != $n){
                $result[] = $i/$n;
            }
            if(count($result) == 8){
                $count += 1;
            }
        }
    }
    
}
echo $count;
?>

Measured memory_bytes: 16188
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define N 100010
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,a[N];
ll sum,p,k;
int main(){
	n=read(),p=1LL*n*(n+1)/2;
	for(int i=1;i<=n;++i){
		sum+=a[i]=read();
	}
	if(sum%p){
		puts("NO");
		return 0;
	}
	k=sum/p;
	a[n+1]=a[1];
	for(int i=1;i<=n;++i){
		ll g=a[i]+k-a[i+1];
		if(g%n||g/n>k||a[i]<k){
			puts("NO");return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 3920
#include <stdio.h>

int main(void)
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);
    if(a == b)
        printf("%d", c);
    else if(a == c)
        printf("%d", b);
    else if(b == c)
        printf("%d", a);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int n,m,l[200001],o[200001],x,y,i;
  scanf("%d%d",&n,&m);
  for(i=0;i<=n;i++)l[i]=o[i]=0;
  for(i=0;i<m;i++){scanf("%d%d",&x,&y);if(x==1)l[y]=1;if(y==n)o[x]=1;}
  for(i=2;i<n;i++)if(l[i]*o[i]){printf("POSSIBLE");return 0;}
  printf("IMPOSSIBLE");
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
#include <numeric>
#include<string_view>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(i) i.begin(),i.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;


void d(){
    ll N; cin >> N;
    auto t = map<ll,bool>();
    for(ll i=1;i*i<=N;i++){
        if(N%i==0){
            t[i]=true;
            if(i*i!=N)t[N/i]=true;
        }
    }
    ll ans = 0;
    for(auto i:t){
        if(t[i.first-1]) continue;
        if(N/(i.first)<i.first) ans+=i.first-1;
    }
    cout << ans << endl;
}

int main(void){
    d();
    return 0;
 }

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

static long long  gcd(long long  a, long long  b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
static long long lcm(long long  a, long long  b) {
	return a * b / gcd(a, b);
}

int main(void) {
	long long  N, M;
	cin >> N >> M;
	long long  Lcm = 1; // 公倍数
	vector <int> alist;
	bool overflow = false;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		alist.push_back(a);
		Lcm = lcm(Lcm, a);
		if (Lcm > M*2) overflow = true;
	}
	if (overflow) {
		cout << 0 << endl;
		return 0;
	}
	long long a0 =  alist[0];
	long long t = 1;
	while (a0 > 0) {
		if ((a0%2)==0) {
			t *= 2;
			a0 /= 2;
		} else {
			break;
		}
	}
	for (int i = 1; i < alist.size(); i++) {
		if ((alist[i]%t!=0) || (alist[i]%(t*2)==0)) {
			cout << 0 << endl;
			return 0;
		}
	}

	// aが偶数なので、公倍数は2で割れる
	long long  half_lcm = Lcm/2;
	long long  num = M / half_lcm;

	// 偶数部分を削る
	long long  ans = (num+1) / 2;
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#define fr first
#define sc second
#define MP make_pair
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lli long long int
#define y1 arayikhalatyan
using namespace std;

lli gcd(lli a, lli b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
lli cg(lli n) {
	return n ^ (n >> 1);
}
lli SUM(lli a)
{
	return (a * (a + 1) / 2);
}
bool CAN(int x, int y, int n, int m)
{
	if (x >= 0 && y >= 0 && x < n && y < m)
	{
		return true;
	}
	return false;
}
double her(double x1, double y1, double x2, double y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
string strsum(string a, string b)
{
	int p = 0;
	string c;
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	if (b.length() < a.length())
	{
		for (int i = b.length(); i < a.length(); i++)
		{
			b += "0";
		}
	}
	else
	{
		for (int i = a.length(); i < b.length(); i++)
		{
			a += "0";
		}
	}

	a += "0", b += "0";
	for (int i = 0; i < a.length(); i++)
	{
		c += (a[i] - '0' + b[i] - '0' + p) % 10 + '0';
		p = (a[i] + b[i] - '0' - '0' + p) / 10;
	}
	if (c[c.length() - 1] == '0') c.erase(c.length() - 1, 1);
	reverse(c.begin(), c.end());
	return c;
}
string strmin(string a, string b)
{
	if (a.length() > b.length()) return b;
	if (b.length() > a.length()) return a;
	for (int i = 0; i < a.length(); i++)
	{
		if (a[i] > b[i]) return b;
		if (b[i] > a[i]) return a;
	}
	return a;
}

char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0 };
int dy[] = { 0, 0, 1, -1 };



const int N = 1e6 + 30;
const lli mod = 1000000007;

int n, q;
vector <int> g[N];
int sum[N];
void dfs(int v, int q)
{
	for (auto p : g[v])
	{
		if (p != q)
		{
			sum[p] += sum[v];
			dfs(p, v);
		}
	}
}
int main()
{
	fastio;
	cin >> n >> q;
	for (int i = 0; i < n - 1; i++)
	{
		int a, b;
		cin >> a >> b;
		g[a].PB(b);
		g[b].PB(a);
	}
	for (int i = 0; i < q; i++)
	{
		int x, v;
		cin >> x >> v;
		sum[x] += v;
	}
	//cout << sum[1] << endl;
	dfs(1, 0);
	for (int i = 1; i <= n; i++)
	{
		cout << sum[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 44160
#include<stdio.h>

int main(void){
  int a,b,i;
  char s[11];
  char ch;
  scanf("%d %d",&a,&b);
  getchar();
  for(i=0;i<a+b+1;i++){
    s[i] = getchar();
    //printf("%c ",s[i]);
    if((i!=a) && !('0'<=s[i] && s[i]<='9')){
      printf("No\n");
      return 0;
    }
    if((i==a) && !(s[i]=='-')){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 	
		int N = sc.nextInt();

		int a[] = new int[N];
		long sum[] = new long[N];
		
		a[0] = sc.nextInt();
		sum[0] = a[0];

		for(int i=1;i<N;i++){
			a[i] = sc.nextInt();
			sum[i] = sum[i-1] + a[i];
		}

		int rcut1 = 0;
		int rcut3 = 2;
		long rdiff = Long.MAX_VALUE;

		for(int cut2=1;cut2 < N-2;cut2++){

			long dev1diff = Long.MAX_VALUE;

			for(int cut1 = rcut1;cut1 < cut2;cut1++){

				long diff = Math.abs(sum[cut1] - (sum[cut2] - sum[cut1]));

				if(dev1diff >= diff) {
					dev1diff = diff;
					rcut1 = cut1;
				} else {
					break;
				}
			}
			

			long dev2diff = Long.MAX_VALUE;
			
			for(int cut3 = cut2 + 1 < rcut3 ? rcut3 : cut2 + 1;cut3 < N-1;cut3++){

				long diff = Math.abs((sum[cut3] - sum[cut2]) - (sum[N-1] - sum[cut3]));

				if(dev2diff >= diff){
					dev2diff = diff;
					rcut3 = cut3;
				}else{
					break;
				}
			}
			long a1 = sum[rcut1];
			long a2 = sum[cut2] - sum[rcut1];
			long a3 = sum[rcut3] - sum[cut2];
			long a4 = sum[N-1] - sum[rcut3];

			long max = Math.max(Math.max(a1,a2),Math.max(a3,a4));
			long min = Math.min(Math.min(a1,a2),Math.min(a3,a4));
			rdiff = rdiff < max - min?rdiff:max-min;

		}

		System.out.println(rdiff);
	}
 
}

Measured memory_bytes: 81708
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define endl '\n'

int t=1,T;

void print2d(vector<vector<int>> &v){
    for(int i=0;i<v.size();i++){
        for(int x:v[i]){
            cout << x <<' ';
        }
        cout <<endl;
    }
}

void print(vector<int> &a){
    for(int x : a){
        cout << x <<' ';
    }
    cout << endl;
    return;
}

int fun(int x,int y){
    return x*x+y*y;
}

void solve(){
    int n,d;
    cin >> n >> d;
    int ans=0;
    int x,y;
    while(n--){
        cin >> x >> y;
        if(fun(x,y)<=d*d)ans++;
    }
    cout << ans <<endl;
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("/home/harsha/Desktop/code/input.txt","r",stdin);
    freopen("/home/harsha/Desktop/code/output.txt","w",stdout);
    #endif

    // cin >> t;
    T = t;
    while(t--){
        solve();   
    }

    return 0;
}

/*

*/

Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;


int main() {
    int n;
    cin>>n;
    cout<<24+(24-n)<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    r = II()
    print(r * 2 * math.pi)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 81480
MOD = 10 ** 9 + 7

S = input()

N = len(S)
dp = [[0] * 4 for _ in range(N + 1)]

for i in reversed(range(N + 1)):
    for j in reversed(range(4)):
        if i == N:
            dp[i][j] = int(j == 3)
        else:
            dp[i][j] = dp[i + 1][j] * (3 if S[i] == "?" else 1)
            if j < 3 and (S[i] == "?" or S[i] == "ABC"[j]):
                dp[i][j] += dp[i + 1][j + 1]
            dp[i][j] %= MOD

print(dp[0][0])


Measured memory_bytes: 27596
#include <iostream>
using namespace std;
int main(){

    int input,No;
    No=1;
	while(1){
		cin>>input;
		if(input==0){
			break;
		}else{
			cout<<"Case"<<" "<<No<<": "<<input<<endl;
			No+=1;
			input=0;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct abcd{int x,h;}b[200001];
bool cmp(abcd i,abcd j){return i.x<j.x;}
int n,d,a,qn[200001],qx[200001],q1,q2,qs,ans;
signed main()
{
	scanf("%lld%lld%lld",&n,&d,&a);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&b[i].x,&b[i].h);
		b[i].h=(b[i].h-1)/a+1;
	}
	sort(b+1,b+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		while(qx[q1]<b[i].x&&q1<q2)qs-=qn[q1++];
		if(b[i].h>qs)
		{
			ans+=(qn[q2]=b[i].h-qs);
			qx[q2++]=b[i].x+2*d;
			qs=b[i].h;
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<int> H(N);
    vector<bool> HH(N, true);
    rep(i, N) cin >> H[i];
    vector<int> a(M), b(M);
    rep(i, M)
    {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    rep(i, M)
    {
        if (H[a[i]] > H[b[i]])
        {
            HH[b[i]] = false;
        }
        else if (H[b[i]] > H[a[i]])
        {
            HH[a[i]] = false;
        }
        else
        {
            HH[a[i]] = false;
            HH[b[i]] = false;
        }
    }
    int cnt = 0;
    for (bool h : HH)
    {
        if (h)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 4580
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
#include<list>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//int型0~9を文字0~9に変換
char int_to_char(int c) {
	if (c == 0) return '0';
	if (c == 1) return '1';
	if (c == 2) return '2';
	if (c == 3) return '3';
	if (c == 4) return '4';
	if (c == 5) return '5';
	if (c == 6) return '6';
	if (c == 7) return '7';
	if (c == 8) return '8';
	if (c == 9) return '9';
	else return'x';
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c >= 22) cout << "bust" << endl;
	else cout << "win" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
    dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i))
print(dp[-1])


Measured memory_bytes: 53212
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	
	int n,m;
	while(cin>>n>>m&&n&&m){
	if(n==0&&m==0)break;
	vector<int>answers;
	int flist[2][10000];
			int count=0;
	vector<int>syoutai;

	int fr[501]={0},fr2[501]={0};

	for(int i=0;i<m;i++)cin>>flist[0][i]>>flist[1][i];//flist[0][0]=1,flist[0][1]=2;
	
	for(int i=0;i<m;i++){
		if(flist[0][i]==1){
			int tomo=flist[1][i];
			fr[tomo]=1;//frには出席番号で印をつける(一応0スタート
			//syoutai.push_back(flist[1][i]);//1が招待した人を追加
		}
		else if(flist[1][i]==1){
			int tomo=flist[0][i];
			fr[tomo]=1;
		}
	}
	for(int i=0;i<n+1;i++){
				/*if(fr[flist[0][i]]==1){
					int tomo=flist[1][i];
					fr2[tomo]=1;
		}*/
		if(fr[i]==1){//iはfrにチェックがついている人
			for(int j=0;j<m;j++){
				if(flist[0][j]==i){
					int tomo=flist[1][j];
					fr2[tomo]=1;
				}
				else if(flist[1][j]==i){
					int tomo=flist[0][j];
					fr2[tomo]=1;
				}
		}
	}
	}
	for(int i=0;i<n+1;i++){
		if(fr[i]==1||fr2[i]==1)count++;
	}
	
	cout<<count-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<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 chmin(ll a, ll b){if (a>b){a = b; return true;}return false;}
void chmax(ll a, ll b){if (a<b){a = b; return true;}return false;}
*/

const ll MOD = 1000000007;
const ll INF = 9999999999;

int main() {
  int N; ll W; cin >>N >>W;
  vector<ll> weight(N),value(N);
  rep (i,N) cin >>weight.at(i) >>value.at(i);

  vector<vector<ll>> dp(N+1, vector<ll>(100100, INF));
  // dp[i][j]...i-1番目までの品物から価値の和がj以上となるように
  // 選んだ時の重さの総和の最小値
  dp[0][0] = 0;
  for (int i=0; i<N; i++){
    for (int j=0; j<=100100; j++){
      if (j >= value[i]) chmin(dp[i+1][j], dp[i][j-value[i]] + weight[i]);
      chmin(dp[i+1][j], dp[i][j]);
    }
  }
  ll res = 0;
  for (int i=0; i<100100; i++){
    if (dp[N][i] <= W) res = i;
  }
  cout <<res <<endl;
  
}

Measured memory_bytes: 80256
#include<stdio.h>

int main(){
	
    int a,b;
    
    for(int i=0 ; ; i++){
        scanf("%d %d",&a,&b);
        if(a==0 & b==0){
            break;
        }
        else if(a>b){
            printf("%d %d\n",b,a);
        }
        else{
            printf("%d %d\n",a,b);
        }
    }
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 2024
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b)for(ll i=a;i<=b;i++)
#define loopr(i,a,b)for(ll i=b;i>=a;i--)
#define vll vector<ll> 
#define vvl vector<vll>
#define pii pair<ll,ll>
#define F first
#define S second
#define endl "\n"
#define M 1000000007
ll max(ll a,ll b){if (a>b) return a; else return b;}

ll po(ll x, ll y){
    if(y==0)
    return 1;
    if(y%2){
        return ((x)*(po(x,y/2)%M)*(po(x,y/2)%M))%M;
    }
   return ((po(x,y/2)%M)*(po(x,y/2)%M))%M;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
	//cin>>t;
    while(t--){
        string s;
        cin>>s;
        ll n=s.size();
        ll cons=0;
        ll mx=0;
        fo(i,n){
            if(s[i]=='R')
            cons++;
            else{
                mx=max(mx,cons);
                cons=0;
            }
        }
        mx=max(mx,cons);
        cout<<mx<<endl;
       
    }
return 0;
}

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

const int maxN = 1e5 + 10;

int n, a[maxN + 1], deg[maxN + 1];
int mx, mn1, mn2;
bool flag[maxN + 1];

set<int> s[maxN + 1];

inline int read()
{
	int num = 0, f = 1;
	char ch = getchar();
	while( !isdigit( ch ) ) { if(ch == '-') f = -1; ch = getchar(); }
	while( isdigit( ch ) ) num = (num << 3) + (num << 1) + (ch ^ 48), ch = getchar();
	return num * f;
}

inline void del(int x)
{
	int y = a[x];
	s[ deg[x] ].erase(x);
	if(!flag[y])
	{
		s[ deg[y] ].erase(y);
		deg[y] --;
		s[ deg[y] ].insert(y);
	}
	flag[x] = true;

	while(flag[mn1]) mn1 ++;
	mn2 = mn1 + 1;
	while(flag[mn2]) mn2 ++;
	while(mx >= 0 && !s[mx].size()) mx --;
}

inline void work()
{
	for(int i = 1; i <= n; i++) s[ deg[i] ].insert(i);
	
	mn1 = 1; mn2 = 2;
	mx = n - 1;
	while(mx >= 0 && !s[mx].size()) mx --;
	
	int last = 0;
	for(int i = n; i >= 4; i--)
	{
		int now;
		if(mx == i - 1) now = (*s[mx].begin());
		else if(mn1 != a[last]) now = mn1;
			else now = mn2;
		printf("%d ", now);
		del(now);
		last = now;
	}
	
	int t[4], c = 0;
	t[c] = last;
	for(int i = 1; i <= n; i++)
		if(!flag[i]) t[++ c] = i;
	do
	{
		bool fk = true;
		for(int i = 1; i <= 3; i++)
			if(t[i] == a[ t[i - 1] ]) fk = false;
		if(fk)
		{
			for(int i = 1; i <= 3; i++) printf("%d ", t[i]);
			puts("");
			return;
		}
	}while(next_permutation(t + 1, t + 4));

	puts("-1");
}

int main()
{
	n = read();
	for(int i = 1; i <= n; i++) a[i] = read(), deg[ a[i] ] ++;
	
	if(n <= 2) { puts("-1"); return 0; }	

	work();
	return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define sz() size()
#define fr first
#define sc second
#define int long long
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;

int n,m,k,cnt,ans;
char tab[7][7];
bitset<8>cols;
bitset<8>rows;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    cin >> n >> m >> k;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin >> tab[i][j];
            cnt += (tab[i][j] == '#' ? 1 : 0);
        }
    }
    for(int i=0;i<(1<<n);i++){
        rows.reset();
        for(int t=0;t<n;t++){
            if(i & (1<<t)) rows[t+1] = 1;
        }
        for(int j=0;j<(1<<m);j++){
            cols.reset();
            for(int t=0;t<m;t++){
                if(j & (1<<t)) cols[t+1] = 1;
            }
            int cntcurr =  cnt;
            for(int i=1;i<=n;i++){
                for(int j=1;j<=m;j++){
                    if((rows[i] == 1 || cols[j] == 1) && tab[i][j] == '#') cntcurr--;
                }
            }
            if(cntcurr == k) ans++;
        }
    }
    rc(ans);
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int r, g,a,b,c;
		cin>>r>>g>>a>>b>>c;
		multiset<pair<int,int>>mst;
		for(int i =0;i<a;i++){
			int x;
			cin>>x;
			mst.insert({x,1ll});
		}
		for(int i =0;i<b;i++){
			int x;
			cin>>x;
			mst.insert({x,2ll});
		}
		for(int i =0;i<c;i++){
			int x;
			cin>>x;
			mst.insert({x,3ll});
		}
		int ans=0,i=0,j=0;
		int req=r+g;
		while((int)mst.size() && req>0){
			auto it = mst.end();
			it--;
			mst.erase(it);
			int x =it->fi;
			int y =it->se;
			if(y==1){
				if(i==r)continue;
				ans+=x;
				i++;
				req--;
			}
			else if(y==2){
				if(j==g)continue;
				ans+=x;
				req--;
				j++;
			}
			else{
				ans+=x;
				req--;
			}
		}
		cout<<ans<<'\n';
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

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

#define llint long long int

using namespace std;

int main(){
    int A, B, K;

    cin >> K >> A >> B;

    if((double) A / K <= B / K){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#define OPEN 0
using namespace std;
int main() {
#if OPEN
	freopen("input.txt", "r", stdin);

#endif
	int T, A, B;
	while (cin >> A >> B >> T) {
		cout<<(int)((float)(T + 0.5) / (float)A) * B<<endl;
	}
	return 0;
}

Measured memory_bytes: 256