akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

struct BIT{
    int n;
    VL bit;

    BIT(){}
    BIT(int x){
        n = x;
        bit.assign(n+1, 0);
    }

    void init(int x){
        n = x;
        bit.assign(n+1, 0);
    }

    void add(int i, ll x){
        i++;
        while (i <= n){
            bit[i] += x;
            i += i & -i;
        }
    }

    // [0, i]
    ll sum(int i){
        i++;
        ll ret = 0;
        while (i > 0){
            ret += bit[i];
            i -= i & -i;
        }
        return ret;
    }

    // [l, r)
    ll sum(int l, int r){
        if (l >= r) return 0;
        return sum(r-1) - sum(l-1);
    }
};

int main() {
    string s;
    cin >> s;
    int n = s.length();
    VI cnt(26);
    for (char c : s){
        cnt[c - 'a']++;
    }
    int odd = 0;
    REP(i,26) odd += cnt[i] % 2;
    if (odd > 1){
        cout << -1 << endl;
        return 0;
    }

    VVI pos(26);
    REP(i,n){
        pos[s[i] - 'a'].push_back(i);
    }

    ll ans = 0;
    VI a(26);
    BIT bit(n);
    REP(i,n) bit.add(i,1);

    REP(i,n/2){
        ll mi = 1e18;
        int c;
        REP(j,26){
            if (a[j] == cnt[j]/2) continue;
            ll tmp = bit.sum(pos[j][a[j]]-1) + bit.sum(pos[j][cnt[j]-a[j]-1]+1, n);
            if (tmp < mi){
                mi = tmp;
                c = j;
            }
        }
        // cout << mi << " " << (char)('a' + c) << endl;
        ans += mi;
        bit.add(pos[c][a[c]], -1);
        bit.add(pos[c][cnt[c]-a[c]-1], -1);
        a[c]++;

        // REP(x,n) cout << bit.sum(x,x+1) << " ";
        // cout << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3068
#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;
int main(){
    int n;
    cin >> n;
    
    double array[n];
    vector<double> a;
    for(int i(0);i<n;i++){
        cin >> array[i];
        a.push_back(array[i]);
    }
    
    sort(a.begin(),a.end());
    double ans = a[0];
    for(int i(1);i<n;i++){
        ans = (a[i]+ans)/2;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
H,W = map(int,input().split())
row_list = ['' for i in range(W)]
for i in range(H):
    line = input()
    if line == '.'*W:
        continue
    else:
        for j in range(W):
            row_list[j] = row_list[j] + line[j]
line_list = []
for i in range(W):
    if row_list[i] == '.' * len(row_list[i]):
        continue
    else:
        if line_list == []:
            for j in row_list[i]:
                line_list.append(j)
        else:
            for j in range(len(row_list[i])):
                line_list[j] = line_list[j] + row_list[i][j]
for i in line_list:
    print(i)

Measured memory_bytes: 3064
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
for i in range(n-k):
    if t[i]==t[i+k]:
        t[i+k]="0"
rr=t.count("s")
ss=t.count("p")
pp=t.count("r")
print(rr*r+ss*s+pp*p)

Measured memory_bytes: 49392
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	int n, m;
	std::cin >> n >> m;
	
	std::vector<int> a(n);
	int total = 0;
	for (auto &e : a) {
		std::cin >> e;
		total += e;
	}
	
	std::sort(a.begin(), a.end());
	std::reverse(a.begin(), a.end());
	int i;
	double d = total / 4.0 / m;
	for (i = 0; i < m; i++) {
		if (a[i] < d) {
			break;
		}
	}
	
	std::cout << (i < m ? "No" : "Yes") << std::endl;
	
	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char s;
  cin >> s;
  if (s == 'a' || s == 'i'|| s == 'u' || s == 'e' || s == 'o'){
  cout << "vowel" << endl;
  }else{
  cout << "consonant" << endl;
  }
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y;
	cin>>x>>y;
	for(int i=0;i<=x&&i*4<=y;i++){
		if(i*4+(x-i)*2==y){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
} 


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD
#define MAX_N 101

using namespace std;

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

int main() {
  int N, s[MAX_N];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  bool flag = false;
  int m = 1000;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] % 10 != 0) {
      flag = true;
      m = min(m, s[i]);
    }
    sum += s[i];
  }
  
  if (flag) {
    printf("%d\n", (sum % 10 == 0) ? sum - m : sum);
  } else {
    printf("0\n");
  }
  return 0;
}


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

int main(){
	string str;
	int N,n;
	getline(cin,str);
	for(int i=0;i<str.size();i++){
		n=(int)str[i]-(int)'a';
		N=(int)str[i]-(int)'A';
		if(0<=n && n<=26){
			cout << (char)(n+(int)'A');
		}else if(0<=N && N<=26){
			cout << (char)(N+(int)'a');
		}else cout << str[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1172
//#define _XCODE_DEBUG

#include <iostream>
#include <vector>
#include <queue>

#ifdef _XCODE_DEBUG
    #include <fstream>
#endif

int main(int argc, const char * argv[]) {
    #ifdef _XCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    
    int N, X, Y;
    std::cin >> N >> X >> Y;
    
    std::vector<int> ans_vec(N+1,0);
    for (int i = 1; i < N; i++){
        for (int j = i+1; j <= N; j++){
            if(i <= X && Y <= j){
                ++ans_vec[(j-Y)+(X-i)+1];
            }else if(i <= X && Y >= j){
                ++ans_vec[std::min(j-i,(Y-j)+(X-i)+1)];
            }else if(X <= i && Y >= j){
                ++ans_vec[std::min(j-i,(Y-j)+(i-X)+1)];
            }else{
                ++ans_vec[std::min(j-i,(j-Y)+(i-X)+1)];
            }
        }
    }

    for (int i=1; i<N; ++i) std::cout << ans_vec[i] << "\n";
    return 0;
}

Measured memory_bytes: 888
import sys
n = int(sys.stdin.readline().rstrip())

s = [[0] * 10 for i in range(10)]

for i in range(1, n+1):
    first = int(str(i)[0])
    end = i % 10
    s[first][end] += 1

r = 0
for i in range(10):
    for j in range(10):
        r += s[i][j] * s[j][i]

print(r)


Measured memory_bytes: 3064
n=int(input())
l=[int(i) for i in input().split()]
if n%2==0:
  a=[l[2*i] for i in range(n//2)]
  b=[l[2*i+1] for i in range(n//2)]
  b=b[::-1]
  c=b+a
  for i in c:
    print(i,end=' ')
else:
  a=[l[2*i] for i in range(n//2+1)]
  b=[l[2*i+1] for i in range(n//2)]
  a=a[::-1]
  c=a+b
  for i in c:
    print(i,end=' ')
  


Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int maxn = 100005;
struct mat {
    ll a[100][100];
    int n;
    mat() {
        memset(a, 0, sizeof(a));
    }
    mat operator * ( const mat &b ) const {
        mat ret;
        ret.n =b.n;
        for( int i = 0; i < n; ++i )
            for( int j = 0; j < n; ++j )
                for( int k = 0; k < n; ++k )
                    ret.a[i][j] = ( ret.a[i][j] + a[i][k] * b.a[k][j] ) % mod;
        return ret;
    }
};
ll solve(ll n, ll k) {
	mat now;
	now.n = n;
	f(n) {
		fr(j,0,n) {
			cin >> now.a[i][j];
		}
	}
	mat ans;
	ans.n = n;
	f(n) {
		ans.a[i][0] = 1;
	}
	while (k) {
		if (k & 1) {
			ans = now * ans;
		}
		now = now * now;
		k >>= 1;
	}
	ll sum = 0;
	f(n) {
		sum += ans.a[i][0];
		sum %= mod;
	}
	return sum;
}
void go() {
	ll n, m, k;
	cin >> n >> k;
	cout << solve(n, k) << '\n';

}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int c = 0;
    int t;
    if (!c) {
        t = 1;
    }
    else {
        cin >> t;
    }
    while (t--) {
        go();
    }
    
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 2e9
#define EPS 1e-9
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define endl "\n"
#define FOR(i,a,b) for (long long i = a; i < b; i++)
#define REV(i,a,b) for (long long i = a; i > b; i--)
#define mset(a, v) memset(a, v, sizeof(a))
typedef std::pair<int, int> pii;
typedef std::vector<long long> vi;
typedef std::vector<vi> vvi;
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

ll solve(ll x,ull y,ll p) {
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
   
     string s;
     cin>>s;
     
     ll l=s.length(),i;
     ll x=(l-1)/2;
     ll flag=0;
     bool half=false;
     for(i=0;i<x/2;i++)
     {
     	if(s[i]==s[x-i-1])
     	 {
     	 	flag++;
		  }
     	
	 }
      if(flag==x/2)
         half=true;
	  
	  bool full =false;
	  ll blag=0;
	  for(i=0;i<l/2;i++)
	   {
	   	if(s[i]==s[l-i-1])
	   	  blag++;
	   }
	    
	    if(blag==l/2)
	     full = true;
     
    
    if(half and full)
      cout<<"Yes";
    else
    cout<<"No";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n,m; cin >> n >> m;
  int cost[10][10];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++) cost[i][j] = -1;
  }
  for(int i=0;i<m;i++){
    int a,b; cin >> a >> b;
    a--; b--;
    cost[a][b] = 1;
    cost[b][a] = 1;
  }

  int P[10];
  for(int i=0;i<n;i++) P[i] = i;

  int ans = 0;
  do{
    if(P[0] != 0) break;
    bool flag = true;
    for(int i=0;i<n-1;i++){
      if(cost[P[i]][P[i+1]] < 0) flag = false;
    }
    if(flag) ans++;
  }while(next_permutation(P,P+n));

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

Measured memory_bytes: 256
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	print( (N-1)*(1+N-1) // 2)


if __name__ == '__main__':
	main()

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const int MOD = 1e9 + 7;

void add(int &a, int b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}

void sub(int &a, int b) {
    a -= b;
    if (a < 0)
        a += MOD;
}

long long inverse(long long a) {
    long long ret = 1;
    for (int b=MOD-2; b>0; b/=2) {
        if (b % 2) ret = ret * a % MOD;
        a = a * a % MOD;
    }
    return ret;
}

long long fact[500005], inv[500005];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, m;
    cin >> n >> m;

    fact[0] = inv[0] = 1;
    for (int i=1; i<=m; i++) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = inverse(fact[i]);
    }

    int ret = 0;
    for (int i=0; i<=n; i++) {
        if (i % 2) sub(ret, fact[n] * inv[i] % MOD * inv[n-i] % MOD * fact[m-i] % MOD * inv[m-n] % MOD);
        else add(ret, fact[n] * inv[i] % MOD * inv[n-i] % MOD * fact[m-i] % MOD * inv[m-n] % MOD);
    }
    ret = ret * fact[m] % MOD * inv[m-n] % MOD;

    cout << ret << "\n";

    return 0;
}


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

using ll = long long;

const ll mod = 1e+9 + 7;

int main() {

    ll n, k;

    cin >> n >> k;

    ll answer = 0;

    for(ll i = k; i <= n + 1; ++i) {

        ll a = i * (i - 1) / 2;
        ll b = i * (2 * n - i + 1) / 2;

        answer += (b - a) + 1;
        answer %= mod;

    }

    cout << answer << endl;

    return 0;


}

Measured memory_bytes: 3628
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }

int a,b,c;

bool solve() {
	return a==b&&a==c;
}

void run() {
	scanf("%d%d%d",&a,&b,&c);
	printf("%s\n",solve()?"Yes":"No");
}

int main() {
	run();
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.List

readInt = fst . fromJust . BS.readInt
readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine
getNString n = map readString <$> replicateM n BS.getLine

elemCountOrd :: (Ord a) => [a] -> [(a, Int)]
elemCountOrd = map (\l -> (head l, length l) ) . group . sort

main = do
  n <- getInt
  ss <- getNString n
  let ss' = sort (map head ss)
  let ss'' = elemCountOrd ss'
  let maxCount = maximum (map (\x -> snd x) ss'')
  let elems = map (\x -> fst x) (filter (\x -> (snd x) == maxCount) ss'')
  mapM_ putStrLn elems


Measured memory_bytes: 147836
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    string s;
    cin >> s;
    repi(i, s){
        if(*i == 'A'){
            cout << 'T';
        }else if(*i == 'T'){
            cout << 'A';
        }else if(*i == 'C'){
            cout << 'G';
        }else{
            cout << 'C';
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define LL long long
#define INF 2000000000
#define maxn 1010
using namespace std;
int n,m;
int k[][2]={{-1,0},{1,0},{0,-1},{0,1}};
int border[maxn][maxn][4];
int vis[maxn][maxn],qx[maxn*maxn],qy[maxn*maxn];
LL ans;
struct node{
	int a,b,c;
}f[maxn],g[maxn];
int X[maxn],Y[maxn],XN,YN;
int findX(int v){
	return lower_bound(X,X+XN,v)-X;
}
int findY(int v){
	return lower_bound(Y,Y+YN,v)-Y;
}
void bfs(int xx,int yy){
	int i,h,t,nx,ny,x,y;
	h=t=0;
	qx[t]=xx,qy[t]=yy,t++,vis[xx][yy]=1;
	while(h<t){
		x=qx[h],y=qy[h],h++;
		ans+=(LL)(X[x+1]-X[x])*(Y[y+1]-Y[y]);
		for(i=0;i<4;i++){
			if(border[x][y][i])continue;
			nx=x+k[i][0],ny=y+k[i][1];
			if(nx==0||nx==XN-1||ny==0||ny==YN-1){
				ans=-1;
				return;
			}
			if(vis[nx][ny])continue;
			vis[nx][ny]=1,qx[t]=nx,qy[t]=ny,t++;
		}
	}
}
void init(){
	int i,x,y,r,j;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)scanf("%d%d%d",&f[i].a,&f[i].b,&f[i].c),X[XN++]=f[i].c;
	X[XN++]=-INF,X[XN++]=INF;
	sort(X,X+XN);
	XN=unique(X,X+XN)-X;
	for(i=0;i<m;i++)scanf("%d%d%d",&g[i].a,&g[i].b,&g[i].c),Y[YN++]=g[i].a;
	Y[YN++]=-INF,Y[YN++]=INF;
	sort(Y,Y+YN);
	YN=unique(Y,Y+YN)-Y;
	for(i=0;i<n;i++){
		x=findX(f[i].c);
		r=findY(f[i].b);
		if(Y[r]!=f[i].b)r--;
		for(j=findY(f[i].a);j<r;j++)
			border[x-1][j][1]=border[x][j][0]=1;
	}
	for(i=0;i<m;i++){
		y=findY(g[i].a);
		r=findX(g[i].c);
		if(X[r]!=g[i].c)r--;
		for(j=findX(g[i].b);j<r;j++)
			border[j][y-1][3]=border[j][y][2]=1;
	}
}
int main(){
	init();
	bfs(findX(0)-1,findY(0)-1);
	if(ans==-1)printf("INF\n");
	else printf("%lld\n",ans);
	return 0;
}


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

int main()
{
  int h1, h2;
  scanf("%d%d", &h1, &h2);
  int result = h1*h2;


  printf("%d\n", result);
  return 0;
}

Measured memory_bytes: 1736
k,n = [int(e) for e in input().split() ]
a = [int(e) for e in input().split() ]
dt = []
for i in range(n-1):
  dt.append(a[i+1] - a[i] )
dt.append(k+a[0]-a[n-1])
max_dst = max(dt)
print(k-max_dst)


Measured memory_bytes: 26092
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N,M;
    cin >> N >> M;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin >> A.at(i);
    int res = N;
    for(int i=0;i<N;i++) res -= A.at(i);
    if (res<0){
        cout << "-1" << endl;
    }else{
        cout <<  res << endl;
    }
}

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

int gcd(int n,int m){
  if(m==0){
    return n;
  }
  else{
    return gcd(m,n%m);
  }
}

int main(){
  int n,k;
  cin >> n >> k;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int check=a[0];
  for(int i=1;i<n;i++){
    check=gcd(check,a[i]);
  }
  sort(a,a+n);
  if(k%check==0&&k<=a[n-1]){
    cout << "POSSIBLE" << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
}
  

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int k, x;
    cin >> k >> x;
    if(x<=500*k)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
########関数部分##############
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
############################
 
 
#####関数をつかってみる．#####
######今回は二進数に変換######
num, k = input().split()
x2 = Base_10_to_n(int(num), int(k))
print( len(str(x2)) )

Measured memory_bytes: 3060
#include<stdio.h>
#define max 100
#define INF 10000000
int main(){

  int n, u, k,v, c, i, j, min;
  int d[max],node[max][max],jud[max];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      node[i][j] = -1;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      node[i][v] = c;
    }
  }
  
  for(i=0;i<n;i++){
    d[i] = INF;
    jud[i] = 1;
  }
  
  d[0] = 0;
  
  while(1){
    min = INF;
    for(i=0;i<n;i++){
      if(min > d[i] && jud[i] == 1){
        u = i;
        min = d[i];
      }
    }
    if(min == INF)
      break;
    jud[u] = 0;
    for(j=0;j<n;j++){
      if(node[u][j] == -1)
        continue;
      if(d[j] > d[u] + node[u][j]){
        d[j] = d[u] + node[u][j];
      }
    }
  }
  
  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]);
  }
  
  return 0;
}


Measured memory_bytes: 2104
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long K = sc.nextLong();
        long X = sc.nextLong();

        final Solver solver = new Solver();
        solver.solve(K, X);
    }
}

class Solver {
    public void solve(long K, long X) {
        System.out.println(500 * K >= X ? "Yes" : "No");
    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N;
    cin >> N;
    vi T(N);
    int sum = 0;
    rep(i, N) {
        cin >> T[i];
        sum += T[i];
    }

    int M;
    cin >> M;
    rep(i, M) {
        int p, x;
        cin >> p >> x;
        cout << sum+(x-T[p-1]) << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
////////////////

void solve(){
  inl(N , A , B);
  ll a = A , b = B;
  int shuki = 0;
  do{
    shuki++;
    if(shuki & 1) a = a - b;
    else b = a + b;
  }while(a != A || b != B);
  trc(shuki);
  N %= shuki;
  a = A , b = B;
  rep1(i , N){
    if(i & 1) a = a - b;
    else b = a + b;
  }
  out(a , b);
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll n, br;
vector<ll> del, del1;
ll podeli(ll y) {
    ll k=n;
    while(k%y==0) {
        k/=y;
    }
    return k;
}
int main() {
    IOS; cin >> n;
    for(ll i=1; i*i<=n; ++i) {
        if(n%i==0) {
            if(i!=1)
                del.push_back(i);
            if(i*i!=n)
                del.push_back(n/i);
        }
    }
    for(auto x:del) {
        ll m=podeli(x);
        if(m%x==1) ++br;
    }
    for(ll i=1; i*i<=n-1; ++i) {
        if((n-1)%i==0) {
            if(i!=1)
                del1.push_back(i);
            if(i*i!=n-1)
                del1.push_back((n-1)/i);
        }
    }
    cout << br+(ll)del1.size();
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 4000000000000000000;
ll a[100005];
ll b[100005];
ll c[100005];
ll mxbc[100005];
ll ans = 0;
int n;
int main(){
    scanf("%d",&n);
    for (int i = 0; i <= n; i++){
        scanf("%lld",&a[i]);
    }
    mxbc[0] = 1-a[0];
    for (int i = 1; i <= n; i++){
        mxbc[i] = min(2*mxbc[i-1] - a[i], INF);
        if (mxbc[i] < 0ll){
            printf("-1"); return 0;
        }
    }
    for (int i = n-1; i >= 0; i--){
        ///b + c <= mxbc
        ///b + 2*c = sum
        ///c >= sum - mxbc
        ll sum = a[i+1]+b[i+1]+c[i+1];
        ll C = max(0ll,sum-mxbc[i]);
        ll B = sum-2*C;
        b[i] = B, c[i] = C;
        if (B < 0ll || B + 2*C != sum){
            printf("-1\n");
            return 0;
        }
        ans += a[i] + B + C;
    }
    ans += a[n];
    if (n == 0 && a[0] != 1) printf("-1\n");
    else printf("%lld",ans);
}


Measured memory_bytes: 6844
N = int(input())
a = list(map(int, input().split()))

b = sum(a)
c = [0] * (N+1)

for i in range(N):
    c[i+1] = c[i] + a[i]

ans = int(3e9)
for i in range(1, N):
    score = abs(c[i]-(b-c[i]))
    if ans > score:
        ans = score

print(ans)

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

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

	cin >> A >> B >> K;

	rep(i, K) {
		if (i % 2 == 0) {
			if (A % 2 == 1) A--;
			B += A / 2;
			A /= 2;
		}
		else {
			if (B % 2 == 1) B--;
			A += B / 2;
			B /= 2;
		}
	}

	cout << A << ' ' << B << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int v[105];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&v[i]);
    int mmax=v[1],mmin=v[1];
    for(int i=2;i<=n;i++){
        mmax=(mmax<v[i]?v[i]:mmax);
        mmin=(mmin>v[i]?v[i]:mmin);
    }
    printf("%d\n",mmax-mmin);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n, tmp;
  cin >> n;
  for(int i=1; i<=9; i++){
    tmp = 100*i + 10*i + i;
    if(n <= tmp){
      break;
    }
  }
  cout << tmp << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>

int main() {
    int64_t n;
    std::cin >> n;

    int64_t root_n = static_cast<int64_t>(std::sqrt(n));
    
    int64_t min = 12;
    for (int64_t a = 1; a <= root_n; ++a) {
        if (n % a != 0) {
            continue;
        }
        int64_t b = n / a;
        int64_t max = std::max(a, b);
        int64_t c = 0;
        int64_t t = max;
        while (t > 0) {
            t /= 10;
            ++c;
        }
        min = std::min(min, c);
    }

    std::cout << min << std::endl;
    
    return 0;
}

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

using namespace std;

int main(){
	int n, a, cnt = 1;
	scanf("%d",&n);
	int order [n];
	for (int i = 0; i < n; i++){
		scanf("%d", &a);
		order[a-1] = cnt;
		cnt++;
	}
	for (int i = 0; i < n-1; i++){
		printf("%d ", order[i]);
	}
	printf("%d ", order[n-1]);
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[30][200000];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; ++i)
        a[s[i]-'a'][i]++;
    for (int j = 'a'; j <= 'z'; ++j)
        for (int i = 1; i < n; ++i)
            a[j-'a'][i] += a[j-'a'][i - 1];
    ll sol = 1;
    for (int i = 0; i < n; ++i)
        sol += n - i - 1 - (a[s[i]-'a'][n - 1] - a[s[i]-'a'][i]);
    cout << sol;
}


Measured memory_bytes: 21012
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll; 
using namespace std;

int main() {
  ll h;
  int n;
  cin >> h >> n;
  ll total = 0;
  rep(i,n){
    int j;
    cin >> j;
    total += j;
  }
  if(total >= h){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

bool f(int n) {
  int len = 0;
  do {
    len++;
    n /= 10;
  } while(n != 0);
  return len % 2 != 0;
}

int main() {
  int N; cin>>N;
  int ans = 0;
  for(int i = 1; i <= N; i++) {
    if(f(i)) ans++;
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
ll modpow(ll a,ll b){
    a%=mod;
    if(b==0)return 1;
    if(b&1)return a*modpow(a,b-1)%mod;
    ll k=modpow(a,b/2);
    return k*k%mod;
}
int main(){
    int n,r;cin>>n>>r;
    if(n>=10)out(r);
    else out(r+100*(10-n));
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

const ll N = 3*MAX5;
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, l;
string s, t, d, c;

ll par[N], sz[N], ans[N], vis[N];
vll v, adj[N];
// <------------- Implement Functions Here ----------> //

void make(ll n) {
	for(ll i=1;i<=n;i++) {
		par[i] = i;
		sz[i] = 1;
	}
}

ll find(ll x) {
	return x == par[x]?x:par[x] = find(par[x]);
}

void merge(ll x, ll y) {
	ll u = find(x);
	ll v = find(y);

	if(u == v) return;

	if(sz[u] < sz[v]) swap(u,v);
	sz[u] += sz[v];
	par[v] = u; 
}

void dfs(ll x) {
	vis[x] = 1;
	v.pb(x);
	for(auto it : adj[x]) {
		if(!vis[it])
			dfs(it);
	}
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n;
	make(n);
	cin >> k >> l;

	for(ll i=0;i<k;i++) {
		cin>>x>>y;
		merge(x,y);
	}

	for(ll i=0;i<l;i++) {
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}

	for(ll i=1;i<=n;i++) {
		if(!vis[i]) {
			v.clear();
			dfs(i);
			map<ll,ll> cnt;
			for(auto it : v) cnt[find(it)]++;
			for(auto it : v) ans[it] = cnt[find(it)]; 
		}
		cout<<ans[i]<<" ";
	}

	newl;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 23428
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    if(n==1){
        cout << "Hello World";
    }
    else{
        int a,b;
        cin >> a >> b;
        cout << a+b;
    }

    return 0;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define VECV(a,n,m) vector<vector<int>> a(n, vector<int>(m));
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}
vector<ll> calc(ll n){
  ll a = 2;
  cout<<"ok";
  vector<ll> v;
  while (n >= a) {
    if (n % a == 0) {
      cout<<a;
      n /= a;
      if(v.back()!=a)v.push_back(a); 
    }
      else a+=1;
  }
    return v;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll X;
  cin>>X;
  for(int i=-1000;i<1001;i++){
    for(int j=-1000;j<1001;j++){
      if(pow(i,5)-pow(j,5)==X){
        cout<<i<<" "<<j<<endl;
        return 0;
      }
    }
  }

}


Measured memory_bytes: 4100
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
totals=[0]*n


def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


for i in range(n-1,-1,-1):
    if totals[i]%2==a[i]:
        continue
    else:
        ans[i]+=1
        arr=make_divisors(i+1)

        for num in arr:
            totals[num-1]+=1

cnt=ans.count(1)

print(cnt)
if cnt!=0:
    b=[]
    for j in range(n):
        if ans[j]!=0:
            b.append(j+1)

    print(*b)
    


Measured memory_bytes: 99704
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int r;
  cin >> r;

  ll Ans = r * r;
  cout << Ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String[] w = new String[n];
		String msg = "Yes";

		for (int i = 0; i < n; i++) {
			w[i] = sc.next();
		}

		for (int i = 1; i < n; i++) {
			if (!(w[i-1].substring(w[i-1].length() - 1, w[i-1].length()).equals(w[i].substring(0, 1)))) {
				msg = "No";
				break;
			}

			for (int j = 0; j < i; j++) {
				if (w[j].equals(w[i])) {
					msg = "No";
					break;
				}
			}
		}

		System.out.println(msg);

	}
}

Measured memory_bytes: 23636
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<ctime>
#include<string>
#include<cstring>
#define ll long long
#define inf 0x7fffffff
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	printf("%d",(n-1)*(m-1));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
typedef struct{
  int A[1000];
  int begin;
  int end;
  bool c;
}node;
node T[105];
int times=0;
int n;
void function(int num){
  if(T[num].begin==0){
  times++;
    T[num].begin=times;
	T[num].c=true;
  }
  for(int j=1;j<=n;j++){
    if(T[num].A[j]==1){
      if(T[j].c==false){
	T[num].A[j]=0;

	function(j);
      }
    }
  }
  if(T[num].end==0){
      times++;
      T[num].end=times;
    }
}
int main(){
  int num;
  int son;
  int z;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>num;
    cin>>son;
    for(int j=0;j<son;j++){
      cin>>z;
      T[num].A[z]=1;
      }
  }
  for(int i=1;i<=n;i++){
    function(i);
  
  }
  for(int i=1;i<=n;i++){
      cout<<i<<" "<<T[i].begin<<" "<<T[i].end<<endl;
  }


  return 0;
}

Measured memory_bytes: 0
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)


Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    long long sum=0;
    vector<string> v;
    for(int i=0;i<n;i++){
        string s; cin>>s;
        v.pb(s);
    }
    for(int i=0;i<n;i++) sort(all(v[i]));

    sort(all(v));

    
    int cnt=1,pos=1;
    for(int i=1;i<n;i++){
        if(v[i]==v[i-1]) sum+=cnt, cnt++;
        else cnt=1;
    }

            cout<<sum<<endl;
}


Measured memory_bytes: 5748
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	}
	
	static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	}

}
class TempReaderCall{
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < line; i++)
			list.add(br.readLine());
		return list;
	}
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	static String getStdInRead(BufferedReader br) throws IOException {
		return (br.readLine());
	}
	
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
}

Measured memory_bytes: 24692
#include<iostream>
#include<vector>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
  char a,b,d;
  int in[3]={1};
  while(cin>>a>>d>>b){
    if(in[a-'A']||in[b-'A'])swap(in[a-'A'],in[b-'A']);
  }
  rep(i,3)if(in[i])cout<<(char)(i+'A')<<endl;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define mod 1000000007
#define mk make_pair
#define sz size

const ll MAXN = 13;
const ll MASMASK = (1<<12) + 1;
const ll MAXM = 1e3 + 10;
ll a[MAXM];
ll cost[MAXM];
ll n,m;
const ll INF = 1e15;
ll dp[MAXM][MASMASK];

ll rec(ll id, ll mask){
    if(id==m+1){
        if(mask==(1<<n)-1)return 0;
        else
            return INF;
    }
    ll &ans=dp[id][mask];
    if(ans!=-1)
        return ans;
    ans = INF;
    ans=min(ans,rec(id+1,mask));
    ans=min(ans,rec(id+1,mask|a[id])+cost[id]);
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll i,j;
    
    memset(dp,-1,sizeof(dp));
    cin>>n>>m;

    for(i=1;i<=m;i++){
        ll aa,b;
        cin>>aa>>b;
        cost[i]=aa;
        for(j=0;j<b;j++){
            ll x;
            cin>>x;
            a[i]|=(1<<(x-1));
        }
    }
    
    ll ans=rec(1,0);
    if(ans>=INF)cout<<"-1\n";
    else
        cout<<ans<<"\n";

    return 0;  
}

Measured memory_bytes: 32640
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	for(int d=1;d<=0x7f;d++)
	{
		if((a*d)%b==c)
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int main() {
    int N, K; cin >> N >> K;
    vector<ll> cnt(K+1);
    repi(i,1,K+1) {
        int c = K/i;
        cnt[i] = qp(c,N,MOD);
    }
    rrepi(i,1,K+1) {
        for(int p = 2; i*p <= K; p++) {
            ((cnt[i] -= cnt[i*p]) += MOD) %= MOD;
        }
    }
    ll ans = 0;
    repi(i,1,K+1) (ans += cnt[i]*i) %= MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4052