akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){

	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);

	if(a <= b && b <= c){
		printf("%d %d %d\n", a, b, c);
  }else if(a <= c && c <= b){
	  printf("%d %d %d\n", a, c, b);
  }else if(b <= a && a <= c){
	  printf("%d %d %d\n", b, a, c);
  }else if(b <= c && c <= a){
	  printf("%d %d %d\n", b, c, a);
  }else if(c <= a && a <= b){
	  printf("%d %d %d\n",c , a, b);
  }else if(c <= b && b <= a){
	  printf("%d %d %d\n", c, b, a);
  }
	return 0;
}

Measured memory_bytes: 596
open System.Collections.Generic

let cnt = int(stdin.ReadLine())
let xs = Dictionary<string, int64>()

for i = 0 to cnt-1 do
    let str = new string (Array.sort (stdin.ReadLine().ToCharArray()))
    if (xs.ContainsKey str) then
        xs.[str] <- xs.[str] + 1L
    else
        xs.Add (str, 1L)

let mutable total = 0L
for x in xs do
    let N = x.Value
    total <- total +  N*(N-1L)/2L

printfn "%d" total

Measured memory_bytes: 30792
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int main(){
  int n,x;cin>>n>>x;
  if(n==2){
    if(x==2){
      puts("Yes");
      printf("%d\n%d\n%d\n",1,2,3);
    }else puts("No");
  }else{
    if(x==1 || x==2*n-1) puts("No");
    else{
      puts("Yes");
      deque<int> res;
      if(x<2*n-2){
        res.pb(x+2);
        res.pb(x-1);
        res.pb(x);
        res.pb(x+1);
        int cnt=0;
        for(int i=1;i<=2*n-1;++i) if(i<x-1 || x+2<i){
          if(cnt<n-2){
            ++cnt;
            res.pb(i);
          }else{
            res.push_front(i);
          }
        }
      }else{
        res.pb(2*n-1);
        REP(i,n-1){
          res.pb(2*n-2-i*2);
          res.push_front(2*n-3-i*2);
        }
      }
      for(auto e:res) printf("%d\n",e);
    }
  }
  return 0;
}





Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

typedef long long ll;

int n, mm;
int A[1000];
int B[1000];
ll dp[1000][1 << 12];

ll f(int i, int m) {
    if(i == mm) return (__builtin_popcount(m) == n ? 0 : 1e16);
    if(dp[i][m] > -1) return dp[i][m];
    return dp[i][m] = min(f(i + 1, m), A[i] + f(i + 1, m | B[i]));
}

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

    int u, v;
    for(int i = 0; i < mm; ++i) {
        cin >> A[i] >> u;
        while(u--) {
            cin >> v;
            v -= 1;
            B[i] |= 1 << v;
        }
    }
    
    memset(dp, -1, sizeof dp);
    cout << (f(0, 0) >= 1e16 ? -1 : f(0, 0));
    
    return 0;
}

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

int main(void){
	int a;
	char s[20];
	scanf("%d",&a);
	scanf("%s",s);
	
	if(a>=3200){
		printf("%s",s);
	}else{
		puts("red");
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807/5;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int d[55];
int ans=0;
int main(){
	cin>>n;
	REP(i,n){
		cin>>d[i];
	}
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			ans+=(d[i]*d[j]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<int>> d(10, vector<int>(10));
	rep(i,10) rep(j,10) cin >> d[i][j];
	vector<vector<int>> v(h, vector<int>(w));
	rep(i,h) rep(j,w) cin >> v[i][j];
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	int ans = 0;
	rep(i,h) rep(j,w) {
		if (v[i][j] == -1) continue;
		ans += d[v[i][j]][1];
	}
	cout << ans << endl;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
vector<int> r(4, 0);

int main() {
  int N; cin >> N;
  long long a[N];
  for(int i = 0; i < N; ++i) {
    cin >> a[i];
    r[a[i]%4]++;
  }
  if(r[2] == 0) {
    if(r[1] + r[3] <= r[0] + 1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    if(r[1] + r[3] <= r[0]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K; cin >> N >> K;
    if(K > (N - 1) * (N - 2) / 2){
        Out(-1);
        return 0;
    }
    pairs ans;
    REP(i, N - 1) ans.pb(Pii(i, N - 1));
    int now = (N - 1) * (N - 2) / 2;
    REP(i, N - 1) FOR(j, i + 1, N - 1) if(now > K){
        ans.pb(Pii(i, j));
        now--;
    }
    Out(SZ(ans));
    for(Pii p: ans) cout << p.f + 1 << " " << p.s + 1 << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a,b,c;
string s[100005];
string ans;

int main(void){
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for(int i=0;i<n;i++){
		cin >> s[i];
	}
	for(int i=0;i<n;i++){
		if(s[i]=="AB"){
			if(a==0 && b==0){
				printf("No\n");
				return 0;
			}else if(a==0){
				a++;
				b--;
				ans+='A';
			}else if(b==0){
				a--;
				b++;
				ans+='B';
			}else if(a<b || (a==b && i+1<n && s[i+1]=="AC")){
				a++;
				b--;
				ans+='A';
			}else{
				a--;
				b++;
				ans+='B';
			}
		}
		if(s[i]=="AC"){
			if(a==0 && c==0){
				printf("No\n");
				return 0;
			}else if(a==0){
				a++;
				c--;
				ans+='A';
			}else if(c==0){
				a--;
				c++;
				ans+='C';
			}else if(a<c|| (a==c && i+1<n && s[i+1]=="AB")){
				a++;
				c--;
				ans+='A';
			}else{
				a--;
				c++;
				ans+='C';
			}
		}
		if(s[i]=="BC"){
			if(b==0 && c==0){
				printf("No\n");
				return 0;
			}else if(b==0){
				b++;
				c--;
				ans+='B';
			}else if(c==0){
				b--;
				c++;
				ans+='C';
			}else if(b<c || (b==c && i+1<n && s[i+1]=="AB")){
				b++;
				c--;
				ans+='B';
			}else{
				b--;
				c++;
				ans+='C';
			}
		}
	}
	printf("Yes\n");
	for(int i=0;i<n;i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 7028
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
set<int> S[MAX_N];
vector<int> G[MAX_N];
int cnt[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		G[a].pb(b);
		G[b].pb(a);
		cnt[a]++;
		cnt[b]++;
	}
	queue<int> que;
	rep(i, 0, N) {
		if(cnt[i] == 1) que.push(i);
	}
	int ans = 0;
	while(!que.empty()) {
		int v = que.front(); que.pop();
		int at = 0;
		rep(i, 0, sz(G[v])) {
			int n = G[v][i];
			if(cnt[n] != 0) continue;
			if(sz(S[n]) > sz(S[v])) swap(S[n], S[v]);
			for(auto d : S[n]) {
				if(S[v].count(d)) MAX(at, d + 1);
				else S[v].insert(d);
			}
		}
		while(!S[v].empty() && (*(S[v].begin())) < at) S[v].erase(S[v].begin());
		while(!S[v].empty() && (*(S[v].begin())) == at) {
			S[v].erase(S[v].begin());
			at++;
		}
		S[v].insert(at);
		MAX(ans, at);

		// debug(v, vi(all(S[v])));

		rep(i, 0, sz(G[v])) {
			int n = G[v][i];
			if(cnt[n] == 0) continue;
			cnt[n]--;
			cnt[v]--;
			if(cnt[n] == 1) que.push(n);
		}
	}
	cout << ans << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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


int main(){
int x1,y1,x2,y2,x3,y3,x4,y4,i,p;
cin >> x1 >> y1 >> x2 >> y2;
i=x1-x2;
p=y1-y2;
x4=x1+p;
y4=y1-i;
x3=x4-i;
y3=y4-p;
cout << x3 << " " << y3 <<" " << x4 <<" " << y4 <<endl;
}


Measured memory_bytes: 256
a[20],m[9999],i,j;main(n,s){
for(scanf("%d",&n),i=0;i<n;i++)scanf("%d",a+i);
for(i=0;i<1<<n;s<9999?m[s]=1:0,i++)for(s=j=0;j<n;j++)if(i&(1<<j))s+=a[j];
for(scanf("%d",&n);n--;puts(m[s]?"yes":"no"))scanf("%d",&s);
exit(0);}

Measured memory_bytes: 580
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

struct UnionFind{
    vector<int> data;
    UnionFind(int size){
        data=vector<int>(size,-1);
    }
    bool union_set(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];
            data[y]=x;
        }
        return x!=y;
    }
    bool find(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI(N);
    string S=get_str();
    GI(K);
    char c=S[K-1];
    FOR(i,N){
        if(S[i]!=c)S[i]='*';
    }
    print(S);
    return 0;
}

Measured memory_bytes: 256
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].fe << " " << v[i].se << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <=================================================================================================================================
// <=================================================================================================================================


signed  main() {
    //op();
    lets_go
    int i, j, x, y, u, l;
    // int tt; cin >> tt; while (tt--)
    {
        i = j = x = y = u = l = 0;

        int n;
        cin >> n;
        string s[4] = {"AC", "WA", "TLE",  "RE"};
        map<string, int> m;
        for (i = 0; i < n; i++) {
            string a;
            cin >> a;
            m[a]++;
        }
        for (i = 0; i < 4; i++) {
            cout << s[i] << " x " << m[s[i]] << endl;
        }



        /* */
    }
    return 0;

}


Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>

using namespace std;

vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};

int main() {
    
    
    int h, w, n;
    cin >> h >> w >> n;
    int sr, sc;
    cin >> sr >> sc;
    string s, t;
    cin >> s >> t;
    
    sr--;
    sc--;
    
    vector<int> ml(n, 0);
    vector<int> mr(n, 0);
    vector<int> mu(n, 0);
    vector<int> md(n, 0);
    
    for (int i = 0; i < n; ++i)
    {
        if (i > 0)
        {
            ml[i] = ml[i - 1];
            mr[i] = mr[i - 1];
            mu[i] = mu[i - 1];
            md[i] = md[i - 1];
        }
        else
        {
            ml[i] = sc;
            mr[i] = sc;
            mu[i] = sr;
            md[i] = sr;
        }
        
        if (s[i] == 'L')
        {
            ml[i] -= 1;
        }
        if (s[i] == 'R')
        {
            mr[i] += 1;
        }
        if (s[i] == 'U')
        {
            mu[i] -= 1;
        }
        if (s[i] == 'D')
        {
            md[i] += 1;
        }
        
        if (ml[i] < 0 || mr[i] >= w || mu[i] < 0 || md[i] >= h)
        {
            cout << "NO" << endl;
            return 0;
        }
        
        if (t[i] == 'L')
        {
            mr[i] -= 1;
            if (mr[i] < 0)
            {
                mr[i] = 0;
            }
        }
        if (t[i] == 'R')
        {
            ml[i] += 1;
            if (mr[i] >= w)
            {
                mr[i] = w - 1;
            }
            
        }
        if (t[i] == 'U')
        {
            md[i] -= 1;
            if (md[i] < 0)
            {
                md[i] = 0;
            }
        }
        if (t[i] == 'D')
        {
            mu[i] += 1;
            if (mu[i] >= h)
            {
                mu[i] = h - 1;
            }
        }
        
        
    }
    
    cout << "YES" << endl;
    
    return 0;
}


Measured memory_bytes: 3848
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define si scanf
#define so printf
#define N 100100
#define M 
#define INF  
template<typename TP>inline bool rd(TP& r)
{
	r=0;
	char tmp=getchar();
	while(tmp<'0'||tmp>'9')
	{
		if(tmp==EOF)
			return 0;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		r=(r<<3)+(r<<1)+tmp-'0';
		tmp=getchar();
	}
	return 1;
	
} 
int n;
int a[N];
int main()
{
	rd(n);
	for(int i=1;i<=n;++i)
		rd(a[i]);
	sort(a+1,a+n+1);
	if(a[n]-a[1]>1)
	{
		so("No\n");
		return 0;
	}
	if(a[n]==a[1])
	{
		if(n/2>=a[1]||n-1==a[1])//分别对应着没有独苗和都是独苗 
			so("Yes\n");
		else
			so("No\n");
		return 0;
	}
	int ns;
	for(ns=1;ns+1<=n;++ns)
		if(a[ns+1]!=a[ns])
			break;
	if(ns+(n-ns)/2>=a[n]&&(n-ns)>=2&&ns<a[n])
		so("Yes\n");
	else
		so("No\n");
	return 0;
} 

Measured memory_bytes: 640
h, w = map(int, input().split())
sx, sy = 0, 0
gx, gy = h - 1, w - 1
A = [list(input()) for i in range(h)]

INF = 100000000
D = [[INF] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0 , -1]

def bfs():
    que = []
    que.append([sx, sy])
    D[sx][sy] = 0
    
    while que != []:
        p = que.pop(0)
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < h and 0 <= ny < w and A[nx][ny] != '#' and D[nx][ny] == INF:
                que.append([nx, ny])
                D[nx][ny] = D[p[0]][p[1]] + 1
            
    return D[gx][gy]

r = bfs()

cnt = 0
for i in range(h):
    for j in range(w):
        if A[i][j] == '.':
            cnt += 1
            
print(cnt - r - 1 if r != INF else -1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, Q, L, R;
ll A[200500];
ll q[205000], x[200500], s[200050], t[200050];

ll f(ll now) {
    for(int i = 1; i <= Q; i++) {
        if(q[i] == 1) {
            if(now >= x[i]) {
                now = t[i] * (now + s[i]);
            }
        } else {
            if(now <= x[i]) {
                now = (now - s[i]) / t[i];
            }
        }
    }
    return now;
}

int main() {
    cin >> N >> Q >> L >> R;
    for(int i = 1; i <= N; i++) cin >> A[i];
    for(int i = 1; i <= Q; i++) {
        cin >> q[i] >> x[i] >> s[i] >> t[i];
    }
    ll overok = 1e9+1;
    ll overng = -1e9-1;
    ll underok = -1e9-1;
    ll underng = 1e9+1;
    while(overok - overng > 1) {
        ll mid = (overok + overng) / 2;
        ll tmp = f(mid);
        if(tmp > R) overok = mid;
        else overng = mid;
    }
    while(underng - underok > 1) {
        ll mid = (underok + underng) / 2;
        ll tmp = f(mid);
        if(tmp < L) underok = mid;
        else underng = mid;
    }
    //cerr << overok << " " << underok << endl;
//    cerr << f(overok) << " " << f(overng) << endl;
//    cerr << f(underok) << " " << f(underng) << endl;
    ll ans = 0;
    for(int i = 1; i <= N; i++) {
        if(A[i] < overok && A[i] > underok) {
            ans++;
            //cerr << i << endl;
        }
        //cerr << f(A[i]) << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 10704
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  s = input()
  r = 0
  b = 0

  for c in s:
    if c == 'R':
      r += 1
    else:
      b += 1

  if r > b:
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()



Measured memory_bytes: 2940
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int main() {
  int n; cin >> n;
  vector<int> P(n);
  loop(i,0,n) cin >> P[i];
  int count = 0;
  loop(i,1,n+1) {
    count += P[i-1]!=i;
  }
  if (count<=2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 3576
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#define int long long
using namespace std;

signed main() {
	int N;
	cin >> N;
	map<string,int> ma;
	for(int i = 0;i < N;i++) {
		vector<char> vec(10);
		for(int j = 0;j < 10;j++) {
			cin >> vec.at(j);
		}
		sort(vec.begin(),vec.end());
      	string S = "";
      	for(int j = 0;j < 10;j++) {
          	S += vec.at(j);
        }
      	ma[S]++;
	}
	int answer = 0;
	for(auto x:ma) {
		int value = x.second;
		answer += value * (value - 1) / 2;
	}
	cout << answer << endl;
}

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

using namespace std;

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination(int, int);
};
int Combination::calculate(int n, int k) {
	return (memo[n].fact * (memo[k].fact_inv * memo[n - k].fact_inv) % m_module) % m_module;
}
Combination::Combination(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

void A_Strings(void) {

	string S, T;
	cin >> S >> T;
	cout << T << S << flush;
	return;
}

void B_Greedy_Takahashi(void) {

	long long A, B, K;
	cin >> A >> B >> K;

	if (K < A) {
		A -= K;
	}
	else if (K < A + B) {
		B -= (K - A);
		A = 0;
	}
	else {
		A = 0;
		B = 0;
	}
	cout << A << " " << B << flush;
	return;
}

void C_Next_Prime(void) {
	
	int X;
	cin >> X;

	for (int sample = X;; sample++) {
		for (int loop = 2; loop <= (int)pow(sample, 0.5); loop++) {
			if (sample % loop == 0) goto nextSample;
		}
		cout << sample << flush;
		return;
	nextSample:
		continue;
	}
}

void D_Prediction_and_Restriction(void) {

	int N, K;
	int point[3];
	cin >> N >> K >> point[0] >> point[1] >> point[2];
	vector<int> T(N);
	for (int& it : T) {
		char C;
		cin >> C;
		switch (C) {
		case 'r':
			it = 2;
			break;
		case 's':
			it = 0;
			break;
		case 'p':
			it = 1;
			break;
		}
	}

	for (int rem = 0; rem < K; rem++) {
		for (int loop = K + rem; loop < N; loop += K) {
			if (T[loop - K] == T[loop]) {
				T[loop] = -1;
			}
		}
	}

	int sum = 0;
	for (int it : T) if (it != -1) sum += point[it];
	cout << sum << flush;
	return;
}

int main(void) {

	//A_Strings();
	//B_Greedy_Takahashi();
	//C_Next_Prime();
	D_Prediction_and_Restriction();
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <cmath>
#define ll long long  
#define PI 3.14159265358979323846
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb emplace_back
#define watch5(a,b,c,d,e) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d << " | "<<#e<<": "<<e<<endl;
#define watch4(a,b,c,d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define watch3(a,b,c) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<endl;
#define watch2(a,b) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<< endl;
#define watch(a) cerr <<#a<<": "<<a<<endl;
#define F first
#define S second
#define mod 1000000007
using namespace std;

int min(int a, int b){
  return a<b?a:b;
}

int32_t main(){
	IOS;
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  int ans = 0, sum = 0;
  int b[n];
  for(int i = n-1; i >= 0; i--){
    sum = ((sum % mod) + (a[i] % mod)) % mod;
    b[i] = sum;
  }
  for(int i = 0; i < n-1; i++){
    ans = (((ans % mod) + (((a[i] % mod) *1LL* (b[i+1] % mod)) % mod)) % mod);
  }
  cout << ans;
}																				  

Measured memory_bytes: 5108
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

typedef boost::multiprecision::cpp_dec_float_100 lld;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;

  lld ra = boost::multiprecision::sqrt(lld(to_string(a)));
  lld rb = boost::multiprecision::sqrt(lld(to_string(b)));
  lld rc = boost::multiprecision::sqrt(lld(to_string(c)));

  if (ra+rb < rc) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class Main{
	public static void main(String[] args) throws IOException{
		Scanner stdIn=new Scanner(System.in);
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String suit[]={"S","H","C","D"};
		boolean card[][];
		card=new boolean[4][14]; //S:0 H:1 C:2 D 3
		for(int i=0;i<n;i++){
			String[] s=br.readLine().split(" ");
			int rank=Integer.parseInt(s[1]);
			int tmp=0;
			switch(s[0]){
			case "S":tmp=0;break;
			case "H":tmp=1;break;
			case "C":tmp=2;break;
			case "D":tmp=3;break;
			}
			card[tmp][rank]=true;
		}
		for(int i=0;i<4;i++){
			for(int j=1;j<=13;j++){
				if(card[i][j]==false)
					System.out.println(suit[i]+" "+j);
			}
		}
	}
}

Measured memory_bytes: 26044
import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto s = readln.strip;
	auto t = readln.strip;
	writeln( solve( s, t ) );
}

auto solve( in string s, in string t )
{
	foreach( i; 0 .. t.length )
	{
		auto ts = t[ i .. $ ] ~ t[ 0 .. i ];
		if( s == ts ) return "Yes";
	}

	return "No";
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	int input[3];
	int ans = 3;

	rep(i, 3) cin >> input[i];
	sort(input, input + 3);

	if (input[0] == input[1]) ans--;
	if (input[1] == input[2]) ans--;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll a,b,c;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>a>>b>>c;
    cout<<(a*min(b-1,c)/b)<<endl;
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int a,b[51],c = 0;
  scanf("%d",&a);
  for (int i = 0; i < a; i++) {
    scanf("%d",&b[i]);
  }
  for (int i = 0; i < a; i++) {
    for (int j = i+1; j < a; j++) {
      if (i!=j){
        c+=b[i]*b[j];
      }
    }
  }
  printf("%d\n",c);
  return 0;
}


Measured memory_bytes: 128
#AGC017-A
from math import factorial
def nCr(n,r):
    return factorial(n) / factorial(r) / factorial(n - r)
n,p = map(int,input().split())
a = list(map(int,input().split()))
even = 0
odd = 0
for i in a:
    if i % 2 == 0:
        even += 1
    else:
        odd += 1

#偶数
if p == 0:
    temp = 0
    for i in range(0,odd+1,2):
        temp += nCr(odd,i)
    print(int(2**even * temp))
#奇数
else:
    temp = 0
    for i in range(1,odd+1,2):
        temp += nCr(odd,i)
    print(int(2**even * temp))

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

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, m; cin >> n >> m;
	graph G(n+1);
	vector<int> ans(n+1);
	for(int i = 0; i < m; i++){
		int a, b; cin >> a >> b;
		G.at(a).push_back(b);
		G.at(b).push_back(a);
		if(a == 1) ans.at(b) = 1;
		if(b == 1) ans.at(a) = 1;
	}
	queue<int> que;
	for(int v: G.at(1)){
		que.push(v);
	}
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(auto nv: G.at(v)){
			if(ans.at(nv) != 0) continue;
			ans.at(nv) = v;
			que.push(nv);
		}
	}
	bool ok = true;
	for(int i = 1; i < n+1; i++){
		if(ans.at(i) == 0){
			ok = false;
			break;
		}
	}
	if(ok){
		cout << "Yes" << endl;
		for(int i = 2; i < n+1; i++){
			cout << ans.at(i) << endl;
		}
	}
} 


Measured memory_bytes: 10260
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define X first
#define Y second
#define clr(u,v); memset(u,v,sizeof(u));
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+10;
const int INF=0x3f3f3f3f;
char str[maxn];

int main()
{
    int p=0;
    scanf("%s",str);
    int len=strlen(str);
    for (int i=0;i<len;i++)
    if (str[i]=='p') p++;
    int P=len/2;
    printf("%d\n",abs(p-P));
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int x[] = new int[n];
		int y[] = new int[n];

		Integer list[] = new Integer[n];

		for (int i = 0; i < n; i++) {
			String str[] = br.readLine().split(" ");

			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);

			list[i] = i;
		}

		double sum = 0;
		int count = 0;

		Permutation<Integer> p = new Permutation<>(list);
		do {
			Integer[] a = p.getTarget();

			for (int i = 0; i < n - 1; i++) {
				int x1 = x[a[i]];
				int y1 = y[a[i]];
				int x2 = x[a[i + 1]];
				int y2 = y[a[i + 1]];

				double dist = Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));
				sum += dist;
			}
			count++;
		} while (p.next());

		System.out.println(sum / count);

	}
}

class Permutation<T extends Serializable> {

	private int baseIndex;
	private int index;
	private T[] objs;

	private Permutation<T> subPermutation;

	public Permutation(T[] objs) {
		this(0, 0, objs.clone());
	}

	private Permutation(int baseIndex, int index, T[] objs) {
		if (objs == null || objs.length == 0) {
			throw new IllegalArgumentException();
		}

		this.baseIndex = baseIndex;
		this.index = index;
		this.objs = objs;

		if (this.index < this.objs.length - 1) {
			this.subPermutation = new Permutation<T>(this.baseIndex + 1, this.index + 1, this.objs);
		}
	}

	public T[] getTarget() {
		return this.objs;
	}

	public boolean next() {
		if (this.subPermutation == null) {
			return false;
		}

		boolean result = this.subPermutation.next();
		if (result == true) {
			return true;
		}

		this.swap(this.baseIndex, this.index);

		++this.index;
		if (this.objs.length <= this.index) {
			this.index = this.baseIndex;
			return false;
		}

		this.swap(this.index, this.baseIndex);
		return true;
	}

	private void swap(int index1, int index2) {
		T tmp = this.objs[index1];
		this.objs[index1] = this.objs[index2];
		this.objs[index2] = tmp;
	}
}


Measured memory_bytes: 22484
fn common_divisor(n: usize, inputs: &Vec<i32>) -> () {
    let max: i32 = *inputs.iter().max_by(|x, y| x.cmp(y)).unwrap();
    for i in 1..max {
        let common = inputs
            .iter()
            .map(|&v| v % i == 0)
            .fold(true, |cum, v| cum && v);
        if common {
            println!("{}", i);
        }
    }
}
fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let n = line.trim().parse::<usize>().unwrap();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let inputs: Vec<i32> = line.split_whitespace()
        .map(|e| e.parse::<i32>().ok().unwrap())
        .collect();

    common_divisor(n, &inputs);
}



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

int kouyaku(int a,int b){
  if(a%b==0){return b;}
  return kouyaku(b,a%b);
}




int main(){

  int x,y;
  cin>>x>>y;
  int ans=1;  
  int a=kouyaku(x,y);
  int xd=x/a,yd=y/a;
  ans+=(xd+yd-1)*a;
  cout<<ans<<endl;
  
  
  return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>
int main(void){
  int min=0,i=0;
  int N[2];
  char S[100000];
  scanf("%s",S);
   N[0]=N[1]=0;
    /* S中の0の数をN[0]に、1の数をN[1]に格納 */
    while(S[i]){
    if(S[i]==49)
    N[1]++;
    if(S[i]==48)
    N[0]++;
    
    i++;
    }
  
  if(N[1]>N[0])
  min=N[0];
  else
  min=N[1];
  
  printf("%d",2*min);
  return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	int n,k;
	cin >> n >> k;
	int ans=0;
	rep(i,n){
		int x;
		cin >> x;
		if(x>=k) ans++;
	}
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
# A
S = input()

if (S == 'SUN'):
    print(7)
elif(S == 'MON'):
    print(6)
elif(S == 'TUE'):
    print(5)
elif(S == 'WED'):
    print(4)
elif(S == 'THU'):
    print(3)
elif(S == 'FRI'):
    print(2)
elif(S == 'SAT'):
    print(1)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define MOD (long long)(1e9+7)
using namespace std;
long long n,k,a,b,sum[2005][2005][2],arr[2005][2005][2];
string c;
int main()
{
	cin >> n >> k;
	int wh=0,bl=0;
	for(int i=0; i<n; i++)
	{
		cin >> a >> b >> c;
		a%=2*k; b%=2*k;
		if(c=="W") {arr[a][b][0]++; wh++;}
		else {arr[a][b][1]++; bl++;}
	}
	for(int i=0; i<2*k; i++)
		for(int j=0; j<2*k; j++)
		{
			sum[i][j][0]=arr[i][j][0]; sum[i][j][1]=arr[i][j][1]; 
			if(i) sum[i][j][0]+=sum[i-1][j][0];
			if(j) sum[i][j][0]+=sum[i][j-1][0];
			if(i&&j) sum[i][j][0]-=sum[i-1][j-1][0]; 
			if(i) sum[i][j][1]+=sum[i-1][j][1];
			if(j) sum[i][j][1]+=sum[i][j-1][1];
			if(i&&j) sum[i][j][1]-=sum[i-1][j-1][1];
			//cout<<sum[i][j][1]<<' ';
		}
	int ans=0;
	for(int i=0; i<k; i++)
		for(int j=0; j<k; j++)
		{
			int ur=i+k-1,uc=j+k-1;
			int cnt1=sum[ur][uc][0],cnt2=sum[ur][uc][1];
			if(i&&j) cnt1+=sum[i-1][j-1][0]*2;
			if(i) cnt1+=sum[i-1][2*k-1][0]-sum[i-1][uc][0];
			if(j) cnt1+=sum[2*k-1][j-1][0]-sum[ur][j-1][0];
			if(i) cnt1-=sum[i-1][uc][0];
			if(j) cnt1-=sum[ur][j-1][0];
			cnt1+=sum[2*k-1][2*k-1][0]-sum[2*k-1][uc][0]-sum[ur][2*k-1][0]+sum[ur][uc][0];
			
			if(i&&j) cnt2+=sum[i-1][j-1][1]*2;
			if(i) cnt2+=sum[i-1][2*k-1][1]-sum[i-1][uc][1];
			if(j) cnt2+=sum[2*k-1][j-1][1]-sum[ur][j-1][1];
			if(i) cnt2-=sum[i-1][uc][1];
			if(j) cnt2-=sum[ur][j-1][1];
			cnt2+=sum[2*k-1][2*k-1][1]-sum[2*k-1][uc][1]-sum[ur][2*k-1][1]+sum[ur][uc][1];
			
			ans=max({ans,cnt1+bl-cnt2,cnt2+wh-cnt1});
		}
	cout << ans;
	return 0;
}


Measured memory_bytes: 128744
#include <iostream>

using namespace std;

int main(){

   int w, h, x, y, r;

   cin >> w >> h >> x >> y >> r;

   if(x >= r && x + r <= w && y >= r && y + r <= h){
      cout << "Yes" << endl;
   }
   else{
      cout << "No" << endl;
   }

   return 0;
}


Measured memory_bytes: 3100
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let n: usize = read();
  let ds: Vec<u32> = read_vec();

  let mut ans = 0;

  for i in 0..n {
    for j in (i + 1)..n {
      ans += ds[i] * ds[j];
    }
  }

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


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

int main() {
  long long int X, Y ,A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<long long int> p(A), q(B), r(C);
  for (int i = 0; i < A; i++) cin >> p.at(i);
  for (int i = 0; i < B; i++) cin >> q.at(i);
  for (int i = 0; i < C; i++) cin >> r.at(i);
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  sort(q.begin(), q.end());
  reverse(q.begin(), q.end());
  sort(r.begin(), r.end());
  long long int sum = 0;
  vector<long long int> apple(X + Y + C);
  for (int i = 0; i < X; i++) apple.at(i) = p.at(i);
  for (int i = 0; i < Y; i++) apple.at(i+X) = q.at(i);
  for (int i = 0; i < C; i++) apple.at(i+X+Y) = r.at(i);
  sort(apple.begin(), apple.end()); 
  reverse(apple.begin(), apple.end());
  for (int i = 0; i < X + Y; i++) sum += apple.at(i);
  cout << sum;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll W,H,m,n;
  cin >> W >> H >> m >> n;
  double ans;
  ans = (double)W*H/2;
  cout << ans << " ";
  if(W == 2*m && H == 2*n){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
A = 0
B = 0
AB = 0
ans = 0
for i in range(n):
    s = input()
    for i in range(len(s)-1):
        if s[i] == "A" and s[i+1] == "B":
            ans += 1
    if s[0] == "B" and s[-1] == "A":
        AB += 1
    elif s[0] == "B":
        B += 1
    elif s[-1] == "A":
        A += 1
if AB > 0:
    if A + B > 0:
        ans += AB + min(A,B)
    elif A + B == 0:
        ans += AB - 1
else:
    ans += min(A,B)
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////

int main(){
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<int> box(n+1);
    for (int i = 1;i <= n;i++){
        cin >> a[i];
    }

    for (int i = n;i >= 1;i--){
        int count = 0;
        for (int j = i * 2;j <= n;j += i){
            count += box[j];
        }
        if (a[i] != count % 2){
            box[i] = 1;
        }
    }

    vector<int> ans;
    for(int i = 1;i <= n;i++){
        if (box[i] == 1){
            ans.push_back(i);
        }
    }

    cout << ans.size() << endl;
    for (int i = 0;i < ans.size();i++){
        cout << ans[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 5288
#!/usr/bin/env python3
import sys


def solve(K: int, A: int, B: int):
    for i in range(A, B+1):
        if not i % K:
            print('OK') 
            return
    print('NG')
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(K, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9192