akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9;
const LL LINF = INF * INF;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("Out.txt", "w", stdout);
	
	string s;
	cin >> s;
	LL ans = 0, cnt = 0;
	FOR(i, 0, SZ(s))
		if (s[i] == 'W')
		{
			++cnt;
			ans += i;
		}
	
	ans -= cnt * (cnt - 1) / 2;	
	cout << ans << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(12)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define test int t; cin >> t; while(t--)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

void solve() {
	int n;
	cin >> n;
	vi b(n-1);
	rep(i, 0, n-2) cin >> b[i];
	int ans = 0;
	vi x(n);
	x[0]=b[0];
	x[n-1]=b[n-2];
	rep(i, 1, n-2){
		x[i]=min(b[i-1], b[i]);
	}
	rep(i, 0, n-1) ans += x[i];
	cout << ans;
}

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

	// test
	solve();

	return 0;
}

Measured memory_bytes: 3644
N, S = map(int, input().split())
mod = 998244353
A = list(map(int, input().split()))
dp1 = [[0]*(S+1) for _ in range(N+1)]
dp2 = [[0]*(S+1) for _ in range(N+1)]

for i in range(1, N+1):
    a = A[i-1]
    dp1[i][0] = 1
    for j in range(S+1):
        dp1[i][j] += dp1[i-1][j]
        dp2[i][j] = dp2[i-1][j]
        if j == a:
            dp1[i][j] += 1
        if j-a >= 0:
            dp1[i][j] += dp1[i-1][j-a]
        dp2[i][j] += dp1[i][j]
        dp1[i][j] %= mod
        dp2[i][j] %= mod

print(dp2[-1][S])
#print(dp[1])
#print(dp[2])
#print(dp[3])


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

int main()
{
    int a,b;
	cin>>a>>b;
    for(int i=0;i<=1e5;i++)
	{
        if(i*8/100!=a)
			continue;
        if(i*10/100!=b)
			continue;
        cout<<i;
        return 0;
    }
    cout<<-1;
    return 0;
}

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

using namespace std;

int main ()
{
    int n;
    int i;
    double ave=0;

    
    cin >> n;

    vector <double> guzai(n);

    for(i=0;i<n;i++)
    {
        cin >> guzai.at(i);
    }

    sort(guzai.begin(),guzai.end());


    for(i=0;i<n;i++)
    {
        if(i==0) continue;
        else if(i==1) ave=(guzai.at(i)+guzai.at(i-1))/2;
        else ave = (ave+guzai.at(i))/2;
        
    }
    

    cout << ave <<endl;
    
    return 0;
}


Measured memory_bytes: 256
n,k = map(int ,input().split())
s,p,r = map(int ,input().split())
t=list(input())
ans=0
for i in range(n):
    if i<k:
        if t[i]=="r":
            ans+=r
        elif t[i]=="s":
            ans+=s
        elif t[i]=="p":
            ans+=p
    else:
        if t[i]==t[i-k]:
            t[i]="a"
        else:
            if t[i]=="r":
                ans+=r
            elif t[i]=="s":
                ans+=s
            elif t[i]=="p":
                ans+=p
print(ans)

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

using namespace std;
typedef long long ll;
typedef long double ld;
using graph = vector<vector<int>>;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define all(x) (x).begin(),(x).end()
#define size(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000

#define pb push_back
#define mp make_pair
#define f first
#define s second

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

struct uf {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> rcount;

    uf(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

};

int main(){
	int n,m;cin>>n>>m;
	uf g(n);
	rep(i,m){
		int x,y,z;cin>>x>>y>>z;
		x--;
		y--;
		g.unite(x,y);
	}
	set<int> t;
	rep(i,n){
		t.insert(g.root(i));
	}

	cout<<endl<<size(t)<<endl;

}




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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 100000, mod = 998244353;
int n;
int mx, f[N];

void nope() {
    cout << 0 << endl;
    exit(0);
}

int pow(int a, int b) {
    if(b == 0) return 1;
    if(b%2) return a*pow(a, b-1)%mod;
    return pow(a*a%mod, b/2);
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n;
    for(int i = 0; i < n; ++i) {
        int x; cin >> x;
        if(i == 0 && x != 0) nope();
        f[x]++;
        mx = max(mx, x);
    }

    if(f[0] != 1) nope();

    int ans = 1;
    for(int i = 1; i <= mx; ++i) {
        ans = (ans*pow(f[i-1], f[i]))%mod;
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1024
import math


a, b, C = map(float, input().split())
theta = math.radians(C)
S = 0.5 * a * b * math.sin(theta)
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(theta))
h = b * math.sin(theta)
print("{:.9f}\n{:.9f}\n{:.9f}".format(S, a+b+c, h))



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

using namespace std;

#define N 100100
#define SIGMA 26

vector <int> a[N];
vector <int> b[N];
int cnt[N], c[N];
int x, y, n, m, k, i, nr, curr, j;
void df (int nod, int comp){
    c[nod] = comp;
    ++cnt[comp];
    for (int it = 0; it < a[nod].size(); ++it)
        if (!c[a[nod][it]])
            df (a[nod][it], comp);
}
int main()
{
    cin >> n >> m >> k;
    for (i = 0; i < m; ++i){
        cin >> x >> y;
        --x;--y;
        a[x].push_back (y);
        a[y].push_back (x);
    }
    for (i = 0; i < k; ++i){
        cin >> x >> y;
        --x;--y;
        b[x].push_back (y);
        b[y].push_back (x);
    }
    nr = 1;
    for (i = 0; i < n; ++i){
        if (!c[i]){
           df (i, nr);
           ++nr;
        }
    }
    for (i = 0; i < n; ++i){
        curr = cnt[c[i]] - a[i].size();
        for (j = 0; j < b[i].size(); ++j)
            if (c[b[i][j]] == c[i])
            --curr;
        cout << curr - 1<< " ";
    }
    return 0;
}


Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
int main() {
    int N;
    cin >> N;
    string s;
    set<string> S;
    rep(i, N) {
        cin >> s;
        S.insert(s);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 19112
#include<bits/stdc++.h>
#include<math.h>
#include<string>
using namespace std;
int main(void){
	int i,j,k,N,P,Q,R,mins = 10000;
	int s[3];
	cin >> s[0] >> s[1] >> s[2];
	mins = min(s[0]+s[1],mins);
	mins = min(s[1]+s[2],mins);
	mins = min(s[2]+s[0],mins);
	cout << mins;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
 
using namespace std;
 
 
// "#"は1 ","は0
int main() {
    int N, M;
    char tmp;
    bool flag = false;
    bool flag2 = false;
 
    cin >> N >> M;
    //vector <vector<int>> v1, v2;
    //
    //v1 = vector<vector<int>>(N, vector<int>(N, 0));
 
    //v2 = vector<vector<int>>(M, vector<int>(M, 0));
 
    int v1[50][50];
    int v2[50][50];
 
 
 
    for (size_t i = 0; i < N; i++)
    {
        for (size_t j = 0; j < N; j++)
        {
            cin >> tmp;
            if (tmp == '#')
            {
                v1[i][j] = 1;
            }
            else
            {
                v1[i][j] = 0;
            }
        }
    }
 
    for (size_t i = 0; i < M; i++)
    {
        for (size_t j = 0; j < M; j++)
        {
            cin >> tmp;
            if (tmp == '#')
            {
                v2[i][j] = 1;
            }
            else
            {
                v2[i][j] = 0;
            }
        }
    }
 
    // 探索
    for (size_t i = 0; i <= N - M; i++)
    {
        for (size_t j = 0; j <= N - M; j++)
        {
            for (size_t k = 0; k < M; k++)
            {
                for (size_t l = 0; l < M; l++)
                {
                    if (v1[i + k][j + l] == v2[k][l])
                    {
                        flag = true;
                    }
                    else
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag == false)
                {
                    break;
                }
                
            }
            if (flag == true)
            {
                flag2 = true;
                break;
            }
        }
        if (flag2 == true)
        {
            break;
        }
    }
 
 
    if (flag2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
int n,m;
char a[110][110];
bool b[110][110];
void dfs(int x,int y,char e)
{
    //cout<<x<<' '<<y<<"\n";
    int xx,yy;
    for(int i=0;i<4;i++)
    {
        xx=x+dx[i];
        yy=y+dy[i];
        if(xx<0 || yy<0||xx>=n ||yy>=m)continue;
        if(b[xx][yy]==1 || a[xx][yy]!=e)continue;
        b[xx][yy]=1;
        dfs(xx,yy,e);
    }
}
int main()
{
    //freopen("input.txt","r",stdin);
    while(cin>>n>>m)
    {
    if(n==0 && m==0)return 0;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        cin>>a[i][j];
    memset(b,0,sizeof(b));
    int ans(0);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        if(b[i][j]==0)
        {
            b[i][j]=1;
            dfs(i,j,a[i][j]);
       // cout<<i<<' '<<j<<"\n";
            ans++;
        }
    /*for(int i=0;i<n;i++)
      {

        for(int j=0;j<m;j++)
        cout<<b[i][j]<<' ';
    cout<<endl;}*/
    cout<<ans<<"\n";
    }
    return 0;
}





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

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  int x, n, p;
  cin >> x >> n;

  set<ll> v;
  REP(i, n) {
    cin >> p;
    v.insert(p);
  }

  int mx = 1000, xx = 1;

  FOR(i, 0, 102) {
    if (v.find(i) == v.end() && abs(x - i) < mx) {
      mx = min(abs(x - i), mx);
      xx = i;
    }
  }

  cout << xx << endl;

  return 0;
}

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

int strtoint(string s) {
    int n = 0;
    int digit = 1;
    for(int i=s.size()-1; i>=0; --i, digit*=10){
         n += digit * (s[i]-'0');
    }
    return n;
}
int main(void){
    int a, L;
    char s[10];
    int x, y;
    bool flag;
    vector<int> l;
    while(cin >> a >> L && (a || L)) {
        l.clear();
        l.push_back(a);
        flag = false;
        int i = 0;
        while(true) {
            for(int k=L-1; k>=0; --k) {
                s[k] = a%10 + '0';
                a /= 10;
            }
            s[L] = '\0';
            sort(s, s+L);
            x = strtoint(s);
            sort(s, s+L, greater<char>());
            y = strtoint(s);
            l.push_back(y-x);
            for(int j=0; j<i; ++j) {
                if(i > 0 && l[i] == l[j]) {
                    cout << j << " " << l[i] << " " << i-j << endl;
                    flag = true;
                }
            }
            if(flag) break;
            else {
                i++;
                a = y-x;
            }
        }
    }
}

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

long long N, k, l = -1, r = 1000000000000000000ll;

long long calc(long long n) {
	for (int i = 0; i < N - 1; i++) {
		n -= (n + k - 1) / k;
	}
	return n;
}

int main()
{
	cin >> N >> k;
	while (l < r - 1) {
		long long c = (l + r) / 2;
		if (calc(c) >= 1) {
			r = c;
		}
		else {
			l = c;
		}
	}
	cout << r - 1 << endl;
	return 0;
}

Measured memory_bytes: 3116
def main():
    import sys
    N = int(sys.stdin.readline())
    S = list(map(int, sys.stdin.readline().split()))
    Q = int(sys.stdin.readline())
    T = list(map(int, sys.stdin.readline().split()))
    #T.sort()
    
    def nibutan(x):
        left, right = 0, N-1
        if S[left]==x or S[right]==x:
            #print(x)
            return 1
        while True:
            mid = (left+right)//2
            if S[mid] < x:
                left = mid
            elif S[mid] > x:
                right = mid
            elif S[mid] == x:
                #print(x)
                return 1
            if right-left==1:
                return 0
                
            
    
    cnt = 0
    for t in T:
        cnt +=nibutan(t)
    print(cnt)
    



if __name__=='__main__':
    main()


Measured memory_bytes: 16180
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 2;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

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

  int n;
  cin >> n;
  int cnt[200010] = {};
  rep(i, n - 1)
  {
    int a;
    cin >> a;
    a--;
    cnt[a]++;
  }
  rep(i, n) cout << cnt[i] << "\n";
  return 0;
}


Measured memory_bytes: 4420
#include<iostream>
#include <algorithm>
#include<string>
using namespace std;
int main()
{
	//int h, w,   q, D, ax[90001], ay[90001], l[100000], r[100000];
	long long int  a, b, c, d, e=0, ans = 0,n,k;
	//string a, b, c;

	cin >> a >> b >> c;
	if (a+b>=c)
	{
		cout <<"Yes" << endl;

	}
	else
	{
		cout <<"No" << endl;

	}
	
	
	// 出力
	return 0;
}


Measured memory_bytes: 256
n,a_start,b_start,a_goal,b_goal = map(int,input().split())
s = input()
a_start -= 1
b_start -= 1
a_goal -= 1
b_goal -= 1

no_rock_double = True
for i in range(a_start, max(b_goal,a_goal)):
    if i+1 < n:
        if s[i] == '#' and s[i+1] == '#':
            no_rock_double = False
can_switch = False
if a_goal > b_goal:
    for i in range(b_start, b_goal+1):
        if i + 2 < n:
            if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
                can_switch = True
    if no_rock_double and can_switch:
        print('Yes')
    else:
        print('No')
else:
    if no_rock_double:
        print('Yes')
    else:
        print('No')



Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

signed main() {
  int L, R; cin >> L >> R;
  
  
  if(R-L > 2019) {
    cout << 0 << endl;
    return 0;
  }
  
  int ans = 20190;
  rep(i, R-L+1) {
    rep(j, R-L+1) {
      if(i == j) continue;
      ans = min(ans, ((L+i)%2019*(L+j)%2019)%2019);
    }
  }
  cout << ans << endl;


}

Measured memory_bytes: 256
#include <stdio.h>

#define MN 1000001

int main(void)
{
	int n;
	int i, j;
	int pn[MN];
	
	for (i = 0; i < MN; i++){
		pn[i] = 1;
	}
	
	pn[0] = pn[1] = 0;
	
	for (i = 2; i * i < MN; i++){
		if (pn[i] == 1){
			for (j = i * i; j < MN; j += i){
				pn[j] = 0;
			}
		}
	}
	
	for (i = 1; i < MN - 1; i++){
		pn[i + 1] += pn[i];
	}
	
	while (scanf("%d", &n) != EOF){
		printf("%d\n", pn[n]);
	}
	
	return (0);
}

Measured memory_bytes: 4500
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf = 1e9+123;
void yes()
{cout << "Yes" << endl;}
void no()
{cout <<  "No" << endl;}
void q()
{cout << -1 << endl;}

int a[200001];
int cnt[200001];
vector<int> v;
void solve()
{	
	ll n, k, pos=1, ans=1, mod, init;
	cin >> n >> k;
	for(int i=1; i<=n; i++)
		cin >> a[i];
	cnt[pos]=ans;
	v.push_back(pos);
	while(1)
	{
		pos = a[pos];
		ans++;
		v.push_back(pos);
		if(cnt[pos])
		{
			mod = ans - cnt[pos];
			init = cnt[pos]-1;
			break;
		}
		cnt[pos]=ans;
	}
	if(k<=init)
		cout << v[k] << endl;
	else
	{
		if(init>0)
		{
		k-=init;
		k%=mod;
		k+=init;
		}
		else
			k%=mod;
	//	if(mod==1)
	//		cout << v[1] << endl;
	//	else
			cout << v[k] << endl;
	}
}
int main()
{	
//	int t;
//	cin >> t;
//	while(t--)
		solve();
}

Measured memory_bytes: 5756
n=int(input())
L=list(map(int,input().split()))
M=[]
ans=0
for i in range(1,n-1):
    M.append(L[i-1])
    M.append(L[i])
    M.append(L[i+1])
    M.sort()
    if M[1]==L[i]:
        ans+=1
    M=[]
print(ans)

Measured memory_bytes: 3064
N = int(input())
H = list(map(int,input().split(' ')))
dp = [float('inf')]*N
dp[0] = 0
dp[1] = abs(H[1] - H[0])

for i in range(2,N):
  dp[i] = min(dp[i-2] + abs(H[i]-H[i-2]),dp[i-1] + abs(H[i]-H[i-1]))

print(dp[-1])


Measured memory_bytes: 13928
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

int n,ans;

main(){
	cin>>n;
	int a[n],b[n],c[n];
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)cin>>c[i];
	sort(a,a+n);
	sort(c,c+n);
	rep(i,n){
		ans+=(lower_bound(a,a+n,b[i])-a)*(n-(upper_bound(c,c+n,b[i])-c));
	}
	dans;
}

Measured memory_bytes: 2560
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        var split = input.Split(' ');
        int[] spliti = new int [10];
        for (int i = 0; i < 3; i++)
        {
            spliti[i] = int.Parse(split[i]);
        }
        //var input = int.Parse(Console.ReadLine());
        int buf;

        for (int j = 0; j < 2; j++)
        {
            for (int i = 0; i < 2; i++)
            {
                if (spliti[i] > spliti[i + 1])
                {
                    buf = spliti[i];
                    spliti[i] = spliti[i + 1];
                    spliti[i + 1] = buf;
                }
            }
        }
        Console.WriteLine(spliti[0] + " " + spliti[1] + " "+ spliti[2]);
    }
}

Measured memory_bytes: 9144
import java.util.Scanner;

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

        int[] H = new int[10000];
        int[] W = new int[10000];
        int a = 0;
        int b = 0;

        Scanner s = new Scanner(System.in);
        for (int i = 0; ; i++) {
            H[i] = s.nextInt();
            W[i] = s.nextInt();
            if ((H[i] == 0) && (W[i] == 0)) {
                break;
            }
        }
        for (int I = 0; H[I] != 0; I++) {
            b = H[I];
            while (b > 0) {
                a = W[I];
                while (a > 0) {
                    System.out.print('#');
                    a--;
                }
                System.out.println("");
                b--;
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 36664
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;

int main() {
    int H, N;
    cin >> H >> N;
    vector<int> a(N);
    vector<int> b(N);
    for (int i : irange(0, N)) {
        cin >> a[i] >> b[i];
    }

    constexpr int INF = 1 << 30;
    vector<vector<int>> dp(N + 1);
    dp[0].resize(H + 1, INF);
    dp[0][0] = 0;
    for (int i : irange(0, N)) {
        dp[i+1].resize(H + 1);
        for (int h : irange(0, H + 1)) {
            dp[i+1][h] = min(dp[i][h], dp[i+1][max(0, h - a[i])] + b[i]);
        }
    }
    cout << dp[N][H] << endl;
}


Measured memory_bytes: 39424
#include <bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define int long long
#define forn(i,a,b) for (int i=a; i<b; i++)
#define MOD 1000000000+7;

using namespace std;

void solve (){
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int i=0,j=0,cnt=0;
	while (i<n || j<n) {
		if (cnt & 1) cout<<t[j],j++;
		else cout<<s[i],i++;
		cnt++;
	}
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
    int t=1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 256
n=int(input())
l=[int(input()) for i in range(n)]

m=max(l)


if l.count(m)>1:
    for i in range(n):
        print(m)

else:
    for i in range(n):
        if l[i]==m:
            l.pop(i)
            print(max(l))
            l.append(0)
        else:
            print(m)
        


Measured memory_bytes: 12532
S = gets.strip
T = gets.strip 

hs = Hash.new {|h, x| h[x] = []}
ht = Hash.new {|h, x| h[x] = []}

S.each_char.with_index do |c, i|
  hs[c] << i   
end

T.each_char.with_index do |c, i|
  ht[c] << i   
end

if hs.values == ht.values
  puts 'Yes'
else  
  puts 'No'
end

Measured memory_bytes: 6848
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <utility>
#include <cstring>
using namespace std;
typedef long long ll;

int main() {
	int v;
	cin >> v;
	string op;
	int operand;
	while(true){
		cin >> op;
		if (op == "=") {
			cout << v << endl;
			break;
		}
		cin >> operand;
		if (op == "+") {
			v += operand;
		} else if (op == "-") {
			v -= operand;
		} else if (op == "*") {
			v *= operand;
		} else {
			v /= operand;
		}
	}
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,m;
  cin >> s;
  
  for (int i = 0; i < s.size(); i++) {
    if(s.at(i) == '0'){
      m.push_back('0');
    }
    if(s.at(i) == '1'){
      m.push_back('1');
    }
    if(s.at(i) == 'B'){
      if(m.size() > 0){
        m.pop_back();
      }
    }
  }
        
  cout << m << endl;
  
}
  

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
	int a,b,c;
  	cin >> a >> b >> c;
  	int a1 = abs(a-b) + abs(b-c);
  	int a2 = abs(a-b) + abs(a-c);
	int a3 = abs(a-c) + abs(b-c);
  	int ans = 0;
  	ans = a1 < a2 ? a1 : a2;
  	ans = ans < a3  ? ans : a3;
  	cout << ans << endl;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char in[120];
pair<pair<string,int>,int> p[110];
int main(){
int a;scanf("%d",&a);
for(int i=0;i<a;i++){
int t;scanf("%s%d",in,&t);
string tmp=in;
p[i]=make_pair(make_pair(in,-t),i);
}
std::sort(p,p+a);
for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        SccPuzzle solver = new SccPuzzle();
        solver.solve(1, in, out);
        out.close();
    }

    static class SccPuzzle {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();

            long result = 0;
            if (2 * n <= m) {
                // mが大きいので、nを全部使える
                result += n;
                m -= 2 * n;
            } else {
                // mが少ない
                result += m / 2;
                m = 0;
            }
            result += m / 4;

            out.println(result);
        }

    }
}



Measured memory_bytes: 35488
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n,x,a[105],ans=1,k=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> x;
	rep(n) cin >> a[i];
	rep(n){
		k+=a[i];
		ans+=(k<=x);
	}
	print1(ans);
	return 0;
}


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

using namespace std;

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

	int ans = N;
	while (ans > 0) {
		if (ans % 10 == 9) {
			cout << "Yes" << endl;
			return 0;
			break;
		}
		else {
			ans /= 10;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
<?php
$list = explode(" ",trim(fgets(STDIN)));
$list2 = $list;
$list3 = array();
for ($i = 0; $i < count($list); $i++) {
     $list3[$list[$i]]=0;
}
for ($i = 0; $i < count($list3); $i++) {
    $list3[$list[$i]]++;
}
$max= max($list3);

echo array_keys($list3,$max)[0] . " ";
array_multisort(array_map( "strlen", $list2 ), SORT_DESC,$list2);

echo $list2[0] . PHP_EOL;



Measured memory_bytes: 9320
S=input()
T=input()

ans=1010
for i in range(len(S)-len(T)+1):
    tes=S[i:i+len(T)]

    cnt=0
    for j in range(len(T)):
        if T[j]!=tes[j]:
            cnt+=1

    ans=min(ans,cnt)

print(ans)

Measured memory_bytes: 9056
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

#define MOD 1000000007
using ll = long long;
using namespace std;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = A; i <= B; i++)
    {
        if (i < A + K || B - K < i) {
            cout << i << endl;
        }
        else {
            i = B - K;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (C >= A && C <= B) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
        a.at(i) -= i+1;
    }
    sort(a.begin(), a.end());
    ll ans=pow(10,18);
    int s;
    s=a.at(n/2);
    ll cnt=0;
    for(int i=0; i<n; i++){
        cnt+=(ll)abs(s-a.at(i));
    }
    cout << cnt << endl;
}

Measured memory_bytes: 4032
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

    public class Program
    {
        public static void Main(string[] args)
        {
            new A().test();
        }
    }

    public class A
    {
        public void test()
        {
            // 普通の数値
            var yen = CommonRead.ReadInt();

            if (yen % 1000 == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(1000 - yen % 1000);
            }

        }
    }

    static class CommonRead
    {
        public static string ReadStr()
        {
            return Console.ReadLine();
        }
        public static string[] ReadStrA()
        {
            return ReadStr().Split(' ');
        }
        public static List<string> ReadStrL()
        {
            return ReadStrA().ToList();
        }
        public static int ReadInt()
        {
            return Convert.ToInt32(ReadStr());
        }
        public static int[] ReadIntA()
        {
            return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray();
        }
        public static List<int> ReadIntL()
        {
            return ReadStrA().Select(s => Convert.ToInt32(s)).ToList();
        }
        public static long ReadLong()
        {
            return Convert.ToInt64(ReadStr());
        }
        public static long[] ReadLongA()
        {
            return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray();
        }
        public static List<long> ReadLongL()
        {
            return ReadStrA().Select(s => Convert.ToInt64(s)).ToList();
        }

        public static decimal ReadDecimal()
        {
            return Convert.ToDecimal(ReadStr());
        }
        public static decimal[] ReadDecimalA()
        {
            return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray();
        }
        public static List<decimal> ReadDecimalL()
        {
            return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList();
        }

        public static double ReadDouble()
        {
            return Convert.ToDouble(ReadStr());
        }
        public static double[] ReadDoubleA()
        {
            return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray();
        }
        public static List<double> ReadDoubleL()
        {
            return ReadStrA().Select(s => Convert.ToDouble(s)).ToList();
        }

    }


Measured memory_bytes: 17736
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
    string al;
    cin>>al;
    if(al=="Sunny")
        cout<<"Cloudy"<<endl;
    else if(al=="Cloudy")
        cout<<"Rainy"<<endl;
    else if(al=="Rainy")
        cout<<"Sunny"<<endl;
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad

data YesNo = Yes | No deriving(Show)
type Pos = (Int, Int)
type Time = Int

myRead :: String -> (Time, Pos)
myRead s = (a, (b, c))
    where (a:b:c:_) = ((map read) . words) s

solver :: (Time, Pos) -> [(Time, Pos)] -> YesNo
solver _ [] = Yes
solver (t, (x, y)) (z:zs) =
    let d      = fst z
        (a, b) = snd z
        dt     = d - t
        dist   = abs (a - x) + abs (b - y)
        in if dist > dt then No
            else if (dist `mod` 2) /= (dt `mod` 2) then No
                else solver z zs

main :: IO ()
main = do
    n    <- read <$> getLine
    line <- map myRead <$> replicateM n getLine
    print $ solver (0, (0, 0)) line


Measured memory_bytes: 73084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
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; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



vector<pair<ll, int> > prime_factorize(ll n) {
    ll tmp = n;
    vector<pair<ll, int> > v;
    for (ll i = 2; i * i <= n; ++i) {
        int cnt = 0;
        while (tmp % i == 0) {
            tmp /= i;
            cnt++;
        }
        if (cnt) v.eb(i, cnt);
    }
    if (tmp != 1) v.eb(tmp, 1);
    return v;
}


int main() {
    ll n, p;
    cin >> n >> p;
    auto v = prime_factorize(p);
    // rep(i, sz(v)) cout << v[i].F << " " << v[i].S << endl;
    
    ll ans = 1;
    for (auto vi : v) {
        if (vi.S >= n) ans *= pow(vi.F, vi.S / n);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 384
use std::io;
use std::cmp;


fn main() {
    let (a, b, k) = {
        let i = read::<usize>();
        (i[0], i[1], i[2])
    };

    let mut cnt = 0;

    for i in (1..cmp::min(a, b) + 1).rev() {
        if a % i == 0 && b % i == 0 { cnt += 1; }
        if cnt == k {
            println!("{}", i);
            return;
        }
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  s=str(input())
  if s=="AC":
    ac=ac+1
  if s=="WA":
    wa=wa+1
  if s=="TLE":
    tle=tle+1
  if s=="RE":
    re=re+1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

Measured memory_bytes: 9208
n = int(input())
cs = {}
for i in range(n):
    si = input()
    if si in cs:
        cs[si] += 1
    else:
        cs[si] = 1
m = int(input())
ct = {}
for i in range(m):
    ti = input()
    if ti in ct:
        ct[ti] += 1
    else:
        ct[ti] = 1

res = 0
su = 0
for si in cs:
    su = cs[si]
    if si in ct:
        su -= ct[si]
    res = max(su, res)

print(res)


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

using namespace std;

typedef long long int ll;
typedef long long int lli;
typedef unsigned long long int ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define mp(p, q) make_pair(p, q)
//３つ以上の値をセットに(3より多いときはカッコ内を増やす)\
sort -> p -> q -> r
#define mt(p, q, r) make_tuple(p, q, r)
#define all(a) a.begin(), a.end()

template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

template <typename T, typename U>
void V2(T &n, U &m)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i];
  }
}

template <typename T>
void Sort(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b));
  }
}

//配列を反転
template <typename T>
void Reve(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (reverse(n.begin() + a, n.end()));
  }
  else
  {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void Down(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end(), greater<ll>()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b, greater<ll>()));
  }
}

  void Main()
  {
    str s; cin >> s;
    ll ans = 0, flag = 0;
    rep(i, s.size())
    {
      if(s[i] == 'A'||s[i] == 'C'||s[i] == 'G'||s[i] == 'T')
      {
        flag++;
        ans = max(ans, flag);
      }
      else
      {
        ans = max(ans, flag);
        flag = 0;
      }
    }
    fin(ans);
  }

  int main()
  {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20); //高精度少数表示
    Main();
    return 0;
  }

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, k, ans;

int main() {
    cin >> n;
    for (int i = 0; i < 100; ++i) {
        for (int j = 0; j < 100; ++j) {
            if (i * 4 + j * 7 == n) {
                cout << "Yes" << endl;
                exit(0);
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, a, b, c, d;
int t[101];

int main() {

	cin >> n;
	rep(i, n * (n - 1) / 2) {
		cin >> a >> b >> c >> d;
		if (c > d) {
			t[a] += 3;
		}
		else if (d > c) {
			t[b] += 3;
		}
		else {
			t[a]++;
			t[b]++;
		}
	}
	REP(i, 1, n + 1) {
		int cnt = 1;
		REP(j, 1, n + 1) {
			if (i != j) {
				if (t[i] < t[j])cnt++;
			}
		}
		cout << cnt << endl;
	}
	

	return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  string s;cin>>s;
  int ans=0;
  for(int i=1;i<n;i++){
    bool exist[26];
    bool used[26];
    fill(used,used+26,false);
    int sum=0;
    fill(exist,exist+26,false);
    for(int j=0;j<i;j++){
      int a=s[j]-'a';
      exist[a]=true;
    }
    for(int j=i;j<n;j++){
      int a=s[j]-'a';
      if(exist[a]&&!used[a]){
        sum++;
        used[a]=true;
      }
    }
    ans=max(sum,ans);
  }
  cout<<ans<<endl;
}

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

int main() {
  int k,x;
  cin >> k >> x;
  
  for(int i=x-k+1; i<x+k; i++) {
    cout << i;
    if(i!=x+k-1)
      cout << " ";
    else
      cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
vector<int> insertsort(vector<int> &a){
    for (int i=1; i<a.size(); i++){
        int v=a[i];//動かす値を持つ
        int j=i-1;//調べる上限を持つ
      	rep(i, a.size()){
      	    cout << a[i];
      	    if (i != a.size()-1) cout << " ";
            else cout << endl;
      	} 
        while (j>=0 && a[j] > v){
            a[j+1] = a[j];//動かす値が上限より小さい場合、挿入するので、
            j--;
        }
        a[j+1] = v;
        }
  	return a;
}
int main(){
    
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
  	insertsort(a);
  	rep(i, a.size()){
      cout << a[i];
      if (i != a.size()-1) cout << " ";
   	  else cout << endl;
    }
}


Measured memory_bytes: 3160
from collections import Counter
n=int(input())
A=[list(map(int,input().split())) for i in range(n)]
Per=[(a[0]-b[0],a[1]-b[1]) for a in A for b in A if a!=b]
print(n-Counter(Per).most_common(1)[0][1] if n!=1 else 1)

Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n, k;
llong h[100005];
llong cnt;

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> h[i];

        if (h[i] >= k) {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


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


//#define int long long 

int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string str; cin >> str;
	if(str.back() == 's') str += "es";
	else str += "s";
	cout << str << endl;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int n, m;

priority_queue<int> que;

ll ans = 0;

int main() {
  cin >> n >> m;
  rep(i, n) {
    int a;
    cin >> a;
    que.push(a);
  }

  rep(i, m) {
    int a = que.top() / 2;
    que.pop();
    que.push(a);
  }

  while (!que.empty()) {
    ans += que.top();
    que.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 892
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  auto n = readln.strip.to!int;
  auto s = readln.strip.splitter;
  auto a = s.front; s.popFront;
  auto b = s.front;
  foreach (i; 0 .. n) {
    write (a[i], b[i]);
  }
  writeln;
}



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

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(b>=c)
    {
        cout<<b+c<<endl;
    }
    else{
        if((c-b)>a)
        {
            cout<<b*2+a+1<<endl;
        }
        else
            {
                cout<<b*2+(c-b)<<endl;
            }
    }
    return 0;
}


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

int main(void){
  int i,N,n,a[200000],count;
  char str[10000000];
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  fgets(str,sizeof(str),stdin);
  a[0]=atoi(strtok(str," "));
  for(i=1;i<N;i++){
    a[i]=atoi(strtok(NULL," "));
  }
  
  n=1;
  count=0;
  for(i=0;i<N;i++){
    if(a[i]==n){
      n++;
    }else{
      count++;
    }
  }
  if(count==N){
    printf("-1\n");
  }else{
    printf("%d\n",count);
  }
  return 0;
}
    
  

Measured memory_bytes: 4224
// arock - 2019-03-09

#include <iostream>
#include <vector>

template <class T> std::vector<T> read(int n) {
    std::vector<T> res(n);
    for (auto& r : res) {
        std::cin >> r;
    }

    return res;
}

int main() {
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
    
    int N, M, C;
    std::cin >> N >> M >> C;
    auto B = read<int>(M);
    std::vector<std::vector<int>> A(N);
    for (auto& row : A) {
        row = read<int>(M);
    }
    
    int ans = 0;
    for (auto row : A) {
        int cur = C;
        for (int i = 0; i < M; i++) {
            cur += B[i] * row[i];
        }
    
        ans += cur > 0;
    }

    std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

int h,w,a,b;

int main() {
	scanf("%d%d%d%d",&h,&w,&a,&b);
	fo(i,1,b) {
		fo(j,1,w) putchar(j<=a?'1':'0');
		puts("");
	}
	fo(i,b+1,h) {
		fo(j,1,w) putchar(j<=a?'0':'1');
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1152
from collections import deque
from math import ceil
L1 = [int(input()) for _ in range(5)]
L2 = list(map(lambda x: x % 10 if x % 10 != 0 else 10, L1))
L3 = list(map(lambda x: ceil(x/10)*10 if x % 10 != 0 else x, L1))
print (sum(L3) + min(L2) -10)


Measured memory_bytes: 3316