akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>

#define ll long long int

using namespace std;

const int INF = (1<<30) - 1;

struct Edge {
    int from, to, weight;
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, M, P, A, B;
    while(cin>>N>>M>>P>>A>>B, N|M|P|A|B){
        A--; B--;
        vector<int> tickets(N);
        for(auto &t: tickets)
            cin >> t;
        
        vector<Edge> edges(P*2);
        for(int i=0; i<P; i++){
            int x, y, c;
            cin >> x >> y >> c;
            x--; y--;
            edges[2*i].from = x; edges[2*i].to = y; edges[2*i].weight = c;
            edges[2*i+1].to = x; edges[2*i+1].from = y; edges[2*i+1].weight = c;
        }
        
        vector<vector<double>> d(M, vector<double>(1<<N, INF));
        d[A][0] = 0;
        bool updated = true;
        while(updated){
            updated = false;
            for(auto edge: edges){
                for(int i=0; i<1<<N; i++){
                    for(int j=0; j<N; j++){
                        if(!((i>>j)&1)){
                            if(d[edge.from][i] + edge.weight/double(tickets[j]) < d[edge.to][i|(1<<j)]){
                                d[edge.to][i|(1<<j)] = d[edge.from][i] + edge.weight/double(tickets[j]);
                                updated = true;
                            }
                        }
                    }
                }
            }
        }
        
        double ans = INF;
        for(int i=0; i<1<<N; i++){
            ans = min(ans, d[B][i]);
        }
        if(ans == INF){
            cout << "Impossible" << endl;
        }else{
            cout << ans << endl;
        }
    }
    
    return 0;
}

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

ll n,k;

bool isOK(vector<ll> &a, ll mid) {
  ll l = 0;
  rep(i,0,n) {
    if (a[i] % mid == 0) {
      l += a[i]/mid - 1;
    } else {
      l += a[i]/mid;
    }
  }
  if (l <= k) return true;
  else return false;
}

ll binary_search(vector<ll> &a, ll m) {
  ll left = 0;
  ll right = m;

  while (right - left > 1) {
    ll mid = (right + left) / 2;
    if (isOK(a, mid)) right = mid;
    else left = mid;
  }
  return right;
}

int main() {
  cin >> n >> k;
  vector<ll> a(n);
  ll m = 0;
  rep(i,0,n) {
    cin >> a[i];
    m = max(m,a[i]);
  }
  sort(a.begin(), a.end());
  int ans = binary_search(a,m);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4740
from collections import defaultdict

N ,M = map(int,input().split())
H = list(map(int,input().split()))
graph = defaultdict(list)
for _ in range(M):
    A, B = map(int,input().split())
    graph[A].append(H[B-1])
    graph[B].append(H[A-1])

cnt = 0
for i in range(1,N+1):
    t = H[i-1]
    a = -1
    if graph[i]:
        a = max(graph[i])
    if t >a:
        cnt += 1
print(cnt)


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

int main(void){
    int N; cin >> N;
    int A[2][N];
    for(int i=0; i<2; i++){
        for(int j=0; j<N; j++){
            cin >> A[i][j];
        }
    }

    int candy=0;
    for(int i=0; i<N; i++){
        int tmp=0;
        for(int j=0; j<=i; j++) tmp+=A[0][j];
        for(int j=i; j<N; j++) tmp+=A[1][j];
        candy=max(candy,tmp);
    }

    cout << candy << endl;
}

Measured memory_bytes: 256
N = int(input())
F, P = [], []
for _ in range(N):
    F.append(int(''.join(list(map(str, input().split()))), 2))
for _ in range(N):
    P.append(list(map(int, input().split())))

ans = -1e10
for i in range(1,2**10):
    temp = 0
    for j in range(N):
        temp += P[j][bin(i&F[j]).count("1")]
    if temp > ans:
        ans = temp
print(ans)

Measured memory_bytes: 3064
/* Insertion Sort */

#include <iostream>
using namespace std;

int nums[100];
int N;

void Disp() {
  for (int i = 0; i < N; i++) {
    cout << nums[i];
    if(i != (N - 1)) cout << " ";
  }
  cout << endl;
}

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> nums[i];
  }
  Disp();
  for (int i = 1; i < N; i++) {
    int v = nums[i];
    int j = i - 1;
    while (j >= 0 && nums[j] > v) {
      nums[j + 1] = nums[j];
      j--;
    }
    nums[j + 1] = v;
    Disp();
  }

  return 0;
}


Measured memory_bytes: 1164
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define ll long long
#define endl "\n"
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define hell 1000000007
#define ff first
#define ss second
#define pii pair<ll,ll>
#define upd upper_bound
#define lbd lower_bound
#define vi vector<ll>
#define vii vector<pii>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)

using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define N 200005

ll i=0,j=0;

ll powr(ll a,ll b)
{
    ll i=0;
    ll ans=1;
    for(i=1;i<=b;i++)
    {
        ans*=a;
    }
    return ans;
}


int main()
{
    IOS;
    ll n;
    cin>>n;
    double p[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>p[i];
    }
    double dp[n+1][n+1];
    memset(dp,0.0,sizeof(dp));
    dp[0][0]=1.0;
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=i;j++)
        {
            if(j==0)
            {
                dp[i][j]=dp[i-1][j]*(1.0-p[i]);
            }
            else
            {
                dp[i][j]=dp[i-1][j]*(1.0-p[i])+dp[i-1][j-1]*p[i];
            }
        }
    }
    double ans=0.0;
    for(i=(n+1)/2;i<=n;i++)
    {
        ans+=dp[n][i];
    }
    cout<<setprecision(10)<<ans<<endl;
}



Measured memory_bytes: 70656
// ABC139_C
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N, M;
    cin >> N >> M;
    
    // calculation
    if (M == 1) {
        cout << 0 << "\n";
    } else {
        // M が 2 以上
        if (N >= M) {
            cout << 1 << "\n";
        } else {
            // N < M
            ll res = 1;
            M -= N;
            if (N > M) {
                res++;
                cout << res << "\n";
            } else {
                ll n = N-1;
                res += (M + n - 1)/n;
                cout << res << "\n";
            }
        }
    }
    
    return 0;
}

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

int N, M, K;
int A[111111];
int B[111111];
int C[111111];
int D[111111];
vector<int> F[111111];
vector<int> bl[111111];
int label[111111];
map<int, int> label_cnt;

int dfs(int now, int l) {
	label[now] = l;

	int ret = 0;
	for (int child : F[now]) {
		if (label[child] != 0) continue;
		ret += dfs(child, l) + 1;
	}

	return ret;
}

int main() {
	cin >> N >> M >> K;
	for (int i = 0; i < M; i++) {
		cin >> A[i] >> B[i];
		A[i]--, B[i]--;
		F[A[i]].push_back(B[i]);
		F[B[i]].push_back(A[i]);
	}

	for (int i = 0; i < K; i++) {
		cin >> C[i] >> D[i];
		C[i]--, D[i]--;
		bl[C[i]].push_back(D[i]);
		bl[D[i]].push_back(C[i]);
	}

	int l = 1;
	for (int i = 0; i < N; i++) {
		if (label[i] != 0) continue;
		label_cnt[l] = dfs(i, l) + 1;
		l++;
	}

	for (int i = 0; i < N; i++) {
		int ans = label_cnt[label[i]] - 1 - F[i].size();
		for (int b : bl[i]) {
			if (label[b] == label[i]) {
				ans--;
			}
		}
		cout << ans << " ";
	}
	cout << endl;
}

Measured memory_bytes: 15488
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>

using namespace std;

int read()
{
	int x = 0, f = 1; char c = getchar();
	while(!isdigit(c)) { if(c == '-') f = 0; c = getchar(); }
	while(isdigit(c)) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); }
	return f ? x : -x;
}

const int maxn = 3010, maxm = maxn << 1;
int a[maxn], to[maxm], nxt[maxm], head[maxn], e, sg[maxn];

void add(int x, int y)
{
	to[++e] = y; nxt[e] = head[x]; head[x] = e;
}

void dfs(int u)
{
	sg[u] = 0;
	for(int i = head[u]; i; i = nxt[i])
	{
		int v = to[i];
		dfs(v);
		if(sg[v] == 0) sg[u] = 1;
	}
}

int main()
{

	int n = read();
	for(int i = 1; i <= n; ++i) a[i] = read();
	for(int i = 1; i < n; ++i) 
	{
		int x = read(), y = read();
		if(a[x] > a[y]) add(x, y);
		if(a[x] < a[y]) add(y, x);
	}

	for(int i = 1; i <= n; ++i)
	{
		memset(sg, -1, sizeof(sg));
		dfs(i);
		if(sg[i]) printf("%d ", i);
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N,M;
  cin>>N>>M;
  
  vector<vector<int>> A(N,vector<int>(M,0));
  rep(i,N) rep(j,M) cin>>A[i][j];

  int ans=N;
  vector<int> used(M+1,0);
  vector<int> pos(N+1,0);
  for(int i=0;i<M;i++){
    vector<int> num(M+1,0);
    for(int j=0;j<N;j++) num[A[j][pos[j]]]++;

    int ma=0,mat=0;
    for(int j=1;j<=M;j++){
      if(ma<num[j]){
        ma=num[j];
        mat=j;
      }
    }
    ans=min(ans,ma);
    used[mat]=1;

    for(int j=0;j<N;j++){
      while(pos[j]<M&&used[A[j][pos[j]]]==1) pos[j]++;
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    string s;
    cin>>s;
    ll c=0;
    for(int i=0;i<4;i++)
    {
        if(s[i]=='+')
            c++;
        else
            c--;
    }
    cout<<c<<endl;

    
    
}
return 0;
}

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

int main()
{
  int N,M,X,ans=-1,p=0,t=1;
  cin >> N >> M >> X;
  int C[N],A[N][M],P[M]={};
  for (int i = 0; i < N; i++)
  {
    cin >> C[i];
    for (int j = 0; j < M; j++)
    {
      cin >> A[i][j];
    }
    
  }
  for (int bit = 0; bit < (1 << N); ++bit)
  {
    for (int i = 0; i < N; i++)
    {
      if ((bit >> i) & 1)
      {
        p+=C[i];
        for (int j = 0; j < M; j++)
        {
          P[j]+=A[i][j];
        }
        
      }
      
    }
    for (int j = 0; j < M; j++)
    {
      if (P[j] < X)
        t = 0;
    }
    if(ans == -1 && t==1) ans=p;
    else if (t == 1 && ans > p)ans = p;

    p=0;
    t=1;
    for (int i = 0; i < M; i++)
    {
      P[i]=0;
    }
    
  }
  cout << ans;
}


Measured memory_bytes: 3624
import math
def Soinsu(a, b) :
    global soin
    while True :
        if a % b == 0 :
            soin.append(b)
            if a/b == 1 :
                break
            else :
                Soinsu(a/b, b)
                break
        else :
            b += 1
            if math.sqrt(a) < b :
                soin.append(int(a))
                break
    return soin

def calc(x) :
    x = list(set(x))
    x.sort(reverse=True)
    #print(x)
    if len(x) == 1 :
        return x[0]
    else :
        return x[0] - sum(x[1:])

while True :
    x, y = map(int, input().split())
    if x == 0 and y == 0 :
        break
    soin = []
    x_door = calc(Soinsu(x, 2))
    soin = []
    y_door = calc(Soinsu(y, 2))
    if x_door > y_door :
        print("a")
    else :
        print("b")


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

using namespace std;

char ch[100005];
int num[30];
int main()
{
    scanf("%s",ch);
    int l =strlen(ch);
    if(ch[0] == ch[l-1]) l--;
    if(l%2 == 0) printf("Second");
    else printf("First");
    return 0;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

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

#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main(){
  int n; cin >> n;
  vi a(n), b(n); rep(i, n) cin >> a[i] >> b[i];
  
  int ans = 0;
  ROF(i, n, 0)
    if((a[i] + ans) % b[i] != 0) ans += b[i] - (a[i] + ans) % b[i];

  cout << ans << endl;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
string st;
int K;
int dp[105][4][2];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	cin>>st>>K;
	dp[0][0][1]=1;
	for(int i=0;i<st.size();i++){
		for(int j=0;j<=3;j++){
			for(int k=0;k<=1;k++){
				int up=k?st[i]-'0':9;
				if(j==K) up=0;
				for(int h=0;h<=up;h++){
					dp[i+1][j+(h!=0)][k&&(h==up)]+=dp[i][j][k];
				}
			}
		}
	}
	cout<<dp[st.size()][K][0]+dp[st.size()][K][1];
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;cin>>s;
	int l=s.length(),ans=0;
	for(int i=0;i<l/2;i++)
	{if(s[i]!=s[l-i-1]) ans++;}
	cout<<ans;
	return 0;
}

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


vector<int> v(5);

int solve() {
  sort(v.begin(), v.end());
  int ans = 1 << 30;
  do {
    int sum{};
    int t;
    REP(i, 5) {
      sum += v[i];
      if (sum % 10 != 0 && i != 4) {
        t = 10 - (sum % 10);
        sum += t;
      }
    }
    // cout << sum << endl;
    ans = min(ans, sum);
  } while(next_permutation(v.begin(), v.end()));
  return ans;
}

int main() {
  REP(i, 5) cin >> v[i];
  cout << solve() << endl;
}


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

int main(){
    char a;
    cin>>a;
    if(a=='A'){
        cout<<'T'<<endl;
    }
    if(a=='T'){
        cout<<'A'<<endl;
    }
    if(a=='C'){
        cout<<'G'<<endl;
    }
    if(a=='G'){
        cout<<'C'<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys,os,io
input = sys.stdin.readline
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(N-1):
  a,b = list(map(int, input().split()))
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)

def dfs(start):
  stack = [start]
  parent = [N]*N
  parent[start] = -1
  while stack:
    v = stack[-1]
    marker = 0
    for u in edge[v]:
      if u==parent[v]:
        continue
      if parent[u]==N: #子へ降ろす
        marker = 1
        parent[u]=v
        stack.append(u)
      else: #子から吸い上げる
        ans[v] *= ans[u]+1
        ans[v] %=M
    if marker==0:
      stack.pop()
  return

def dfs2(start):
  stack = [start]
  parent = [N]*N
  parent[start] = -1
  p_value = [0]*N
  while stack:
    v = stack.pop()
    cum1 = [1]*(len(edge[v])+1)
    cum2 = [1]*(len(edge[v])+1)
    for i,u in enumerate(edge[v]):
      if u==parent[v]:
        cum1[i+1] = cum1[i]*(p_value[v]+1)%M
      else:
        cum1[i+1] = cum1[i]*(ans[u]+1)%M
    for i,u in enumerate(edge[v][::-1]):
      if u==parent[v]:
        cum2[-i-2] = cum2[-i-1]*(p_value[v]+1)%M
      else:
        cum2[-i-2] = cum2[-i-1]*(ans[u]+1)%M
    for i,u in enumerate(edge[v]):
      if u==parent[v]:
        continue
      parent[u]=v
      p_value[u] = cum1[i]*cum2[i+1]%M
      ans[u] *= (p_value[u]+1)
      ans[u] %= M
      stack.append(u)
    ans[v] %= M
  return

ans = [1]*N
dfs(0)
dfs2(0)
print(*ans, sep='\n')

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


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
 /* #ifndef ONLINE_JUDGE
  freopen ("input.txt", "r", stdin);
  freopen ("output.txt", "w", stdout);
  #endif */



bool prime[100000+10];
memset(prime,true,sizeof(prime));

prime[1]=false;
prime[0]=false;

for(int i=2;i*i<=(100000+10);i++)
{
    if(prime[i])
    {
        for(int j=2*i;j<=(100000+10);j+=i)
           prime[j]=false;
    }
}


int x;
cin>>x;


for(int k=x;k<=100000+10;k++)
{
    
    if(prime[k])
    {
        cout<<k<<endl;
        break;
    }
}


  
}

Measured memory_bytes: 384
let a, b, s = Scanf.scanf " %d %d %s" @@ fun a b c -> a, b, c
let f s x = let n = ref 0 in String.iter (fun c -> if c = x then incr n) s; !n
let _ = print_endline @@ if s.[a] = '-' && f s '-' = 1 then "Yes" else "No"

Measured memory_bytes: 384
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int ll
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define vi vector<int>
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
template <typename T>
void add(T &a, T b){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b){
	a *= b;
	if(a >= mod)a %= mod;
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int k;
	cin>>k;
	rep(i,k){
		cout<<"ACL";
	}	
	return 0;
}

Measured memory_bytes: 3544
n = int( input( ) )
nums = [ int( val ) for val in input( ).split( " " ) ]
print( " ".join( map( str, nums ) ) )

for i in range( 1, len( nums ) ):
	key = nums[i]
	j = i - 1
	while 0 <= j and key < nums[j]:
		nums[ j+1 ] = nums[j]
		j -= 1
	nums[ j+1 ] = key
	print( " ".join( map( str, nums ) ) )

Measured memory_bytes: 6724
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int n, m, total = 0;
	scanf("%d%d", &m, &n);
	vector<int> a(n), b(n - 1);
	for(int i = 0; i < n; scanf("%d", &a[i++])){}
	sort(a.begin(), a.end());
	for(int i = 0; i < n - 1; ++i)
	{
		b[i] = a[i + 1] - a[i];
		total += b[i];
	}
	sort(b.begin(), b.end());
	for(int i = 1; i < m; ++i)
	{
		if(n - 1 - i < 0)
		{
			break;
		}
		total -= b[n - 1 - i]; 
	}
	printf("%d\n", total);
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LLI;
int main()
{
	char arr[2][3];
	for(int i = 0; i < 2; i++)
		for(int j = 0; j < 3; j++)
			cin >> arr[i][j];
	if( arr[0][1] == arr[1][1] and arr[0][0] == arr[1][2] and arr[0][2] == arr[1][0] )
		cout << "YES";
	else
		cout << "NO";
}

Measured memory_bytes: 3584
program ABC_089_Grouping2
   implicit none
   integer N
   read(*, *) N
   if(mod(N, 3) == 0) then
      write(*, *) N / 3
   else if(mod(N, 3) == 1) then
      write(*, *) (N - 1) / 3
   else 
      write(*, *) (N - 2) / 3
   end if
end program ABC_089_Grouping2

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main()
{
    cin >> A >> B;
    cout << A*B-(A+B-1);
    return 0;
}

Measured memory_bytes: 3588
n = int(input())
alst = list(map(int, input().split()))
wlst = list(map(int, input().split()))
right = [w for a, w in zip(alst, wlst) if a == 0]
left = [w for a, w in zip(alst, wlst) if a == 1]
if right and left:
  print(min(right) + min(left))
else:
  print(0)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll cmb(ll n) {
    return (n * (n - 1)) / 2;
}

int main() {
    int n; cin >> n;
    vector<string> s(n); for (int i = 0; i < n; ++i) cin >> s[i];

    map<string, ll> mp;
    for (int i = 0; i < n; ++i) {
        string str = s[i];
        sort(str.begin(), str.end());
        
        if (mp.count(str) == 0) {
            mp[str] = 1;
        } else {
            mp[str] += 1;
        }
    }

    ll res = 0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if (itr->second >= 2) {
            res += cmb(itr->second);
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
#define int long long
#define uint unsigned lon1g long
#define double long double
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sett(c) (c).resize(unique(all(c))-(c).begin())
#define sz(a) (int)(a).size()
#define hell 1000000007
#define pi pair<int,int>
#define vi vector<int>
#define vb vector<bool>
#define vpi vector<pair<int,int>>
#define x first
#define y second
#define endl '\n'
#define forn(i,n) for(int i = 0 ; i < n ; i++ )
#define for1(i,n) for(int i = 1 ; i < n ; i++ )
#define fore(i,a,b) for(int i = a ; (a>b)?(i>=b):(i<=b) ; (a>b)?(i--):(i++) )

using namespace std;

bool comp(const pi& a , const pi& b ){
        return a.y < b.y;
}

long long binpow(long long a, long long b) {

    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a ;
        a = a * a ;
        b >>= 1;
    }
    return res;
}

void task_A(){
        int n ; cin >> n ; cout << n*n << endl;
}

void task_B(){

}

void task_C(){

}

void task_D(){

}

void task_E(){

}

int32_t main(){

        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);
        cout << fixed;
        cout.precision(10);

        int t = 1;
        //cin >> t ;
        while(t--){
                task_A();
                //task_B();
                //task_C();
                //task_D();
                //task_E();
        }

        return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        string s;
        cin >> s >> s;
        Int ans = 0;
        for (int i = 0; i + 3 <= s.size(); ++i) {
            string t = s.substr(i, 3);
            if (t == "ABC") {
                ans++;
            }
        }
        cout << ans << endl;
    }

};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
template <typename flow_t>
struct FordFulkerson
{
  struct edge
  {
    ll to;
    flow_t cap;
    ll rev;
    bool isrev;
  };

  vector<vector<edge>> graph;
  vector<ll> used;
  const flow_t INF;
  ll timestamp;

  FordFulkerson(ll n) : INF(numeric_limits<flow_t>::max()), timestamp(0)
  {
    graph.resize(n);
    used.assign(n, -1);
  }

  void add_edge(ll from, ll to, flow_t cap)
  {
    graph[from].emplace_back((edge){to, cap, (ll)graph[to].size(), false});
    graph[to].emplace_back((edge){from, 0, (ll)graph[from].size() - 1, true});
  }

  flow_t dfs(ll idx, const ll t, flow_t flow)
  {
    if (idx == t)
      return flow;
    used[idx] = timestamp;
    for (auto &e : graph[idx])
    {
      if (e.cap > 0 && used[e.to] != timestamp)
      {
        flow_t d = dfs(e.to, t, min(flow, e.cap));
        if (d > 0)
        {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  flow_t max_flow(ll s, ll t)
  {
    flow_t flow = 0;
    for (flow_t f; (f = dfs(s, t, INF)) > 0; timestamp++)
    {
      flow += f;
    }
    return flow;
  }

  void output()
  {
    for (ll i = 0; i < graph.size(); i++)
    {
      for (auto &e : graph[i])
      {
        if (e.isrev)
          continue;
        auto &rev_e = graph[e.to][e.rev];
        cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << ")" << endl;
      }
    }
  }
};
struct point
{
  double x, y, val;
  point() {}
  point(double x, double y, double val) : x(x), y(y), val(val){};
  point(double x, double y) : x(x), y(y), val(0){};
};
int main()
{
ll n ;
cin >> n ;
vector<point> r,b;
rep(i,n){
  ll l , k ;
  cin >> l >> k ;
  r.emplace_back(l,k);
}
rep(i,n){
  ll l , k ;
  cin >> l >> k ;
  b.emplace_back(l,k);
}
FordFulkerson< ll > g(202);
rep(i,n){
  g.add_edge(0,i+1,1);
  g.add_edge(i+101,201,1);
}
rep(i,n)rep(j,n){
  if(r[i].x<b[j].x && r[i].y<b[j].y)g.add_edge(i+1,j+101,1);
}

cout << g.max_flow(0,201) << endl;
return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

    int n;
    cin >> n;

    while (n < 2000) {
        string s = to_string(n);
        if (s[0] == s[1] && s[1] == s[2]) {
            cout << s << endl;
            return 0;
        }
        n++;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++){
            list.add(Integer.parseInt(sc.next()));
        }
        
        StringBuilder sb = new StringBuilder();
        
        for(int i=0; i < n; i++){
            sb.append(list.get((n-1)-i));
            if(i < n-1) sb.append(" ");
        }

        System.out.println(sb);
    }
}



Measured memory_bytes: 26112
using System;
using System.Text;


//Ari-Hon p322
namespace ALDS1_14_B
{
    class Program
    {
        static StringBuilder sb = new StringBuilder();
        static void Main(string[] args)
        {
            var T = Console.ReadLine();
            var P = Console.ReadLine();

            contain(P, T);

            Console.Write(sb);
        }

        //??????????????°???????????\???
        static void contain(string a, string b)
        {
            ulong B = 100000007; //???????????\????????°

            // a???b????????????????????????
            int al = a.Length, bl = b.Length;
            if (al > bl) return;

            //B???al???????¨????
            ulong t = 1;
            for (int i = 0; i < al; i++) t *= B;

            // a??¨b????????????al???????????¢?????????????????\???????¨????
            ulong ah = 0, bh = 0;
            for (int i = 0; i < al; i++) ah = ah * B + a[i];
            for (int i = 0; i < al; i++) bh = bh * B + b[i];

            //b????????????1???????????????????????????????????\???????????§??????
            for (int i = 0; i + al <= bl; i++)
            {
                if (ah == bh) sb.AppendLine(i.ToString());//b???i??????????????????al??????????????´
                if(i + al < bl) bh = bh * B + b[i + al] - b[i] * t;
            }
        }

    }
}

Measured memory_bytes: 50492
l=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
n=int(input())
s=input()
for i in list(s):
  print(l[(l.index(i)+n)%26],end="")

Measured memory_bytes: 4596
n = int(input())
a = tuple(map(int,input().split()))

ans = [0] * n
ans[0] = sum(a) - sum(a[1::2])*2

for i in range(1,n):
    ans[i] = (a[i-1] - ans[i-1]//2)*2

print(' '.join(map(str, ans)))

Measured memory_bytes: 86372
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography.X509Certificates;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            long A = cin.nextLong();
            long B = cin.nextLong();
            long N = cin.nextLong();

            long x;
            if (N >= B - 1)
            {
                x = B - 1;
            }
            else
            {
                x = N;
            }

            long ans = (long)Math.Floor((double)(A * (x % B) / B));
            Console.WriteLine(ans);
        }

    }
}


Measured memory_bytes: 27808
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <list>
#include <cmath>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const int INF = 1 << 29;
const LL MOD = 100000;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

struct edge{ LL to, cost; edge(int t, LL c) :to(t), cost(c){} };

int dxk[] = { 1, 1, 1, 0, -1, 0 };
int dxg[] = { 0, 1, 0, -1, -1, -1 };
int dy[] = { -1, 0, 1, 1, 0, -1 };

int bitcount(int a)
{
	int ret = 0;
	while (a != 0) { ret++; a = (a - 1) & a; }
	return ret;
}

int dp[2001][2001];//買った冊数, 同じ属性で買った冊数 := 値段//MLEしそう

int main()
{
	int n, k;
	while (cin >> n >> k && n)
	{
		memset(dp, 0, sizeof(dp));
		vector<P> books(n);
		rep(i, n) cin >> books[i].second >> books[i].first;
		sort(all(books));//同じ属性が並ぶようにソート

		int prevAttr = -1;
		int idx = 0;
		rep(i, n)
		{
			if (prevAttr != books[i].first)
			{
				rep(l, k) rep(j, k)
				{
					dp[l][0] = max(dp[l][0], dp[l][j]);
					if (j != 0) dp[l][j] = 0;
				}
				prevAttr = books[i].first;
				idx = 0;
			}

			for (int j = i; j >= 0; j--)
			{
				for (int l = min(idx, j); l >= 0; l--)
				{
					int money = dp[j][l];
					money += books[i].second + (money != 0 ? (l + 1) * l - l * (l - 1) : 0);
					dp[j + 1][l + 1] = max(dp[j + 1][l + 1], money);
				}
			}
			idx++;
		}

		int ans = 0;
		rep(i, n) ans = max(ans, dp[k][i]);
		cout << ans << endl;
	}

	return 0;
}

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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define fi first
#define se second
#define pb push_back
#define int long long

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

const int N = 1e5 + 10;
const int oo = 1e18;
const int mod = 1e9 + 7;

int n, suma, sumb;
int a[N], b[N];

signed main()  {
//    freopen("test.inp", "r", stdin);
//    freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false); cout.tie(0);

    cin >> n;

    bool flag = true;
    FOR(i, 1, n)   cin >> a[i], suma += a[i];
    FOR(i, 1, n)    {
        cin >> b[i], sumb += b[i];
        if(b[i] != a[i]) flag = false;
    }
    if(suma > sumb) return cout << "No", 0;
    if(suma == sumb)  return cout << ((flag) ? "Yes" : "No"), 0;

    int cnt = sumb - suma; //cout << cnt << '\n';
    FOR(i, 1, n) if(b[i] > a[i])   cnt -= (b[i] - a[i] + 1) / 2;
    return cout << ((cnt >= 0) ? "Yes" : "No"), 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#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 all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 100005;

int main() {
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    int x = a[n-1];
    int y;
    int now = x/2 - a[0];
    REP(i,n-1) {
        if (abs(x/2-a[i]) <= now) {
            y = a[i];
            now = abs(x/2-a[i]);
        }
    }
    cout << x << " " << y << endl;
}

Measured memory_bytes: 640
def c1 ( N , K ) :
	if N == K :
		x = 0 ;
	elif K > N : 
		x = min ( N , abs ( N - K ) ) ; 
	else :
		x = c1 ( N % K , K ) ;
	return x ;

N , K   = map( int , input().strip().split(" ") ) ;
print ( c1 ( N , K ) ) ;

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

int main(){
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  int min_c =1001;
  for(int i = 0; i < N; i++)
  {
    cin >> c.at(i) >> t.at(i);
    if (T >= t.at(i)) {
      if (min_c > c.at(i)) {
        min_c = c.at(i);
      }
    }
  }
  
  if (min_c != 1001) {
    cout << min_c << endl;
  }
  else
  {
    cout << "TLE" << endl;
  }
  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(void)
{
  int n;
  cin>>n;
  int l, r;
  int ans=0;
  for(int i=0; i<n; i++)
    {
      cin>>l>>r;
      ans+=r-l+1;
    }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
//import java.util.Random;

class Main{
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);

		int k=stdIn.nextInt();
		
		long ans=0;
		for(int i=1;i<=k;++i){
			for(int j=1;j<=k;++j){
				for(int l=1;l<=k;++l){
					ans+=gcd(i,gcd(j,l));
				}
			}
		}
		
		System.out.println(ans);
	}
	
	static int gcd(int x,int y){
		return (y==0)?x:gcd(y,x%y);
	}
}

Measured memory_bytes: 35620
#include <iostream>
#include <array>

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i]; 
  }
}

#include <cstdio>

static int binarySearch(int S[], int n, int T[], int q) {
  int found = 0;
  for (int i = 0; i < q; i++) {
    int left = 0;
    int right = n;
    while (left < right) {
      int mid = (left + right) / 2;
      if (T[i] == S[mid]) {
        found++;
        left = right;
      } else if (T[i] < S[mid]) {
        left = left;
        right = mid;
      } else {
        left = mid + 1;
        right = right;
      }      
    }    
  }
  return found;
}

int main() {
  int n, q;
  array<int, 100000> S;
  array<int, 50000> T;

  cin >> n;
  inputArray(S.data(), n);

  cin >> q;
  inputArray(T.data(), q);

  int found = binarySearch(S.data(), n, T.data(), q) ;
  
  cout << found << endl;
  
  return 0;
}



Measured memory_bytes: 3644
fun main(args: Array<String>) {

    val s = readLine()!!

    val se = s.contains('E') && s.contains('W') ||
        (!s.contains('E') && !s.contains('W'))
    val ns = s.contains('S') && s.contains('N') ||
        !s.contains('S') && !s.contains('N')

    if(se && ns){
        println("Yes")
    }else{
        println("No")
    }
}



Measured memory_bytes: 33632
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n, m;
    while(scanf("%d%d", &n, &m) == 2) {
        printf("%d %d\n", __gcd(n, m), m / __gcd(n, m)*n);
    }
    return 0;
}

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

int main(void){
	string s;
	bool f=false,b=false;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(!f&&s[i]=='A') f=!f;
		else if(f&&s[i]=='Z'){cout<<"AZ";b=true;f=!f;}
	}
	if(!b)cout<<-1;
	cout<<endl;
}

Measured memory_bytes: 3196
#include <iostream>
 
using namespace std;
int main() {
  int a, b;
  string A, B;
  string u;
  cin >> A >> B;
  cin >> a >> b;
  cin >> u;
  if(u == A)
    a--;
  else
    b--;
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
  string s;cin >> s;
  int n=s.size();
  ll dp[n+1][2]={};
  // dp[i][0] 和がsのi文字目までと同じ //
  dp[0][0]=1;
  for(int i=0;i<n;i++){
    if(s[i]=='1'){
      // 01,10 //
      dp[i+1][0]=2*dp[i][0];
      // 00,01,10 //
      dp[i+1][1]=3*dp[i][1];
      // 00 //
      dp[i+1][1]+=dp[i][0];
    }
    else{
      // 00 //
      dp[i+1][0]=dp[i][0];
      // 00,01,10 //
      dp[i+1][1]=dp[i][1]*3;
    }
    dp[i+1][0]%=mod;
    dp[i+1][1]%=mod;
  }
  cout << (dp[n][0]+dp[n][1])%mod;
}

Measured memory_bytes: 2048
public class Main {

	/**
	 * ????????????????????????
	 *
	 * @param args
	 */
	public static void main(String[] args) {
		for (int i = 1; i < 10; i++) {
			for (int j = 1; j < 10; j++) {
				System.out.println(i + "x" + j + "=" + i * j);
			}
		}
	}
}

Measured memory_bytes: 23920
#include<iostream>
using namespace std;
int main(void)
{
    int i,X[5],index;
    for(i=0; i<5; i++)
    {
        cin>>X[i];
    }
    for(i=0; i<5; i++)
    {
        if(X[i]==0) index = i;
    }
    cout<<index+1<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using ll=long long;



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

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    string a,b;
    cin>>a>>b;

    ll ans=0;

    if(a.size()>b.size()){
        ans=-1;
    }else if(a.size()<b.size()){
        ans=1;
    }else{
        for(ll i=0;i<a.size();i++){
            if(a[i]>b[i]){
                ans=-1;
                break;
            }
            else if(a[i]<b[i]){
                ans=1;
                break;
            }
        }
    }

    if(ans==-1) cout<<"GREATER"<<endl;
    else if(ans==0) cout<<"EQUAL"<<endl;
    else cout<<"LESS"<<endl;

}


Measured memory_bytes: 3564
import java.util.Scanner;

public final class Main {
        public static void main(String[] args) {
                Scanner s = new Scanner(System.in);
                int a = s.nextInt();
                int b = s.nextInt();
                int c = s.nextInt();
                
                if (c>=a && c<=b) System.out.println("Yes");
                else System.out.println("No");
        }
}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

vector<pair<char,int>> runLength(string s) {
  int n = sz(s);
  vector<pair<char,int>> res;
  rep(i,n) {
    int cnt = 1;
    while(i < n-1 && s[i] == s[i+1]) {
      cnt++;
      i++;
    }
    res.push_back(pair<char,int>(s[i],cnt));
  }
  return res;
}
  
int main() {
  string s;
  cin >> s;
  vector<pair<char,int>> ans = runLength(s);
  cout << sz(ans) - 1 << endl;
  return 0;
}

Measured memory_bytes: 1656
#include<iostream>
#include<string>
#include<algorithm>
 
using namespace std ;
int main () {
  int N;
  int tmp=0,cnt=0;
  int i,j,k=0;
  cin >> N;
  for(i=105;i<=N;i=i+2){
    for(j=1;j<=i;j++){
      if(i%j==0){
        tmp = tmp+1;
      }
      if(i==j) {
        if(tmp==8){
          cnt = cnt+1;
        }
        tmp = 0;
      }
    }
  }
  cout << cnt << endl;
  return(0);
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	res := make([][]int, h)
	for i, _ := range res {
		res[i] = make([]int, w)
	}
	for i := 0; i < h; i++ {
		var s string
		fmt.Scan(&s)
		for j := 0; j < w; j++ {
			if string(s[j]) == "#" {
				res[i][j] = -100
				if i > 0 {
					res[i-1][j]++
					if j > 0 {
						res[i-1][j-1]++
					}
					if j < w-1 {
						res[i-1][j+1]++
					}
				}
				if j > 0 {
					res[i][j-1]++
				}
				if j < w-1 {
					res[i][j+1]++
				}
				if i < h-1 {
					res[i+1][j]++
					if j > 0 {
						res[i+1][j-1]++
					}
					if j < w-1 {
						res[i+1][j+1]++
					}
				}
			}
		}
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if res[i][j] < 0 {
				fmt.Print("#")
			} else {
				fmt.Print(res[i][j])
			}
		}
		fmt.Println()
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" \
                              << "\n";

int main()
{
  int n, maxi = 0;
  cin >> n;
  map<string, int> cnt;
  REP(i, n)
  {
    string s;
    cin >> s;
    if (cnt.count(s))
      cnt.at(s)++;
    else
      cnt[s] = 1;
    maxi = max(maxi, cnt.at(s));
  }
  for (auto x : cnt)
  {
    if (x.second == maxi)
      cout << x.first << "\n";
  }

  return 0;
}


Measured memory_bytes: 27264