akhauriyash/Code-Regression huggingface dataset:
unittest
{
	assert( [ "3", "2 1 3" ].parse.expand.solve == 9 );
	assert( [ "4", "1 3 2 4" ].parse.expand.solve == 19 );
	assert( [ "8", "5 4 8 1 2 6 7 3" ].parse.expand.solve == 85 );
}



import std.container;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	// 添字と値を逆にした配列を作成
	auto ais = new long[ as.length ];
	foreach( i, a; as )
	{
		ais[ a - 1 ] = i;
	}
	
	// 値が小さい順に処理
	auto ans = 0L;
	auto rbt = redBlackTree( -1L, ais.length.signed );
	foreach( a, ai; ais.enumerate( 1L ) )
	{
		// aより小さい値が含まれない最大範囲を二分検索して、パターン数を計算
		auto li = rbt.lowerBound( ai ).back;
		auto ri = rbt.upperBound( ai ).front;
		ans += a * ( ri - ai ) * ( ai - li );
		rbt.insert( ai );
	}
	return ans;
}


Measured memory_bytes: 25744
#include<bits/stdc++.h>
using namespace std;
map<int,bool>mp;
int arr[12][12];
int d;
bool check(int i,int j)
{
    int sum=0;
    int tp;
    for(int k=0;k<d;++k)
    {
        tp=arr[i][k]-arr[j][k];
        sum+=tp*tp;
    }
    //cout<<sum<<endl;
    return mp[sum];
}
int main()
{
    for(int i=0;i<=1000;++i)
        mp[i*i]=true;
    int n;
    cin>>n>>d;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<d;++j)
        {
            cin>>arr[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<n;++i)
    {
        for(int j=i+1;j<n;++j)
        {
            if(check(i,j))
                ++ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
a, b = map(int,input().split())

if a*b <= 0:
    print("Zero")
else:
    if a > 0 and b > 0:
        print("Positive")
    else:
        memo = b-a
        if memo%2 == 0:
            print("Negative")
        else:
            print("Positive")

Measured memory_bytes: 2940
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    ad = [0] * n
    dq = collections.deque([[0, i + 1] for i in range(n)])
    for i in range(10 ** 15):
        fd = {}
        while True:
            if len(dq) != 0:
                d, q = dq.popleft()
                q -= 1
                if d <= i:
                    if ad[q] < n - 1:
                        qq = a[q][ad[q]] - 1
                        tq = a[qq][ad[qq]] - 1
                        if q == tq and qq not in fd and tq not in fd:
                            ad[qq] += 1
                            ad[tq] += 1
                            if ad[qq] < n - 1:
                                dq.append([d + 1, qq + 1])
                            if ad[tq] < n - 1:
                                dq.append([d + 1, tq + 1])
                            fd[qq] = 0
                            fd[tq] = 0
                else:
                    dq.append([d, q + 1])
                    break
            else:
                break
        if len(dq) == 0:
            b = True
            for v in ad:
                if v != n - 1:
                    b = False
                    break
            if b:
                print(i + 1)
                exit()
            else:
                print(-1)
                exit()


if __name__ == '__main__':
    slove()


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

int main() {
    int n, T; cin >>n >>T;
    vector<int> t(n);
    for (int i = 0; i < n; i++) cin >>t[i];
    long long ret = T; // t[n-1]さんの分は必ずT
    for (int i = 0; i < n-1; i++) {
        ret += min(t[i+1]-t[i], T);
    }
    cout << ret << endl;
    return 0;
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N ; i++)
  {
    cin >> d.at(i);
  }

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

  int count=1;
  for (int i = 1; i < N; i++)
  {
    if (d.at(i) != d.at(i - 1) && i != 0)
    {
      ++count;
    }
    
    //cout << d.at(i) << endl;
  }
  cout << count << endl;

}


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

int main() {
    string s,t,u;
    int a,b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(s == u){
        cout << a-1 << " " << b;
    }
    else{
        cout << a << " " << b-1;
    }
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
r=[0]*(n-1)
t=[0]*(n)
dr={}
dt={l[0]:[0]}
for i in range(1,n):
  x=i-l[i]
  y=i+l[i]
  if x in dr:
    dr[x].append(i)
  else:
    dr[x]=[i]
  if y in dt:
    dt[y].append(i)
  else:
    dt[y]=[i]
ans=0
for x in dr.keys():
  if x>0 and x in dt:
    y=dr[x]
    z=dt[x]
    ans+=len(z)*len(y)
print(ans)

Measured memory_bytes: 142184
#include<iostream>
#include<vector>

using namespace std;

vector<vector<char>> c;
int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

bool check(int y, int x){
    bool res = false;
    for(int i = 0; i < 4; i++){
        if(c[y + dy[i]][x + dx[i]] == '#'){
            res = true;
            break;
        }
    }
    return res;
}

int main(){
    int h, w;
    cin >> h >> w;
    c = vector<vector<char>>(h + 2, vector<char>(w + 2));
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> c[i][j];
        }
    }
    bool ans = true;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(c[i][j] == '#') ans = ans && check(i, j);
        }
    }
    cout << (ans? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ret = min(a) + min(b)
for m in range(M):
  x, y, c = map(int, input().split())
  ret = min(ret, a[x-1]+b[y-1]-c)
print(ret)

Measured memory_bytes: 18608
#include<iostream>
int main()
{
    int x,y,r;
    std::cin>>x;
    std::cin>>y;

    r=x%y;
    while(r>0){
      x=y;
      y=r;
      r=x%y;
    }
    std::cout<<y<<"\n";
    return 0;
}


Measured memory_bytes: 3096
/* kop Chy_Chy*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll , ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define si(x)   scanf("%d", &x)
#define sl(x)   scanf("%lld", &x)
#define pi(x)   printf("%d\n", x)
#define pl(x)   printf("%lld\n", x)
#define deb(x)  cout<< #x << " = " << x << endl // debugging kop 
#define mp      make_pair
#define pb      push_back
#define MOD     1000000007
#define PI      acos(-1)
#define ff      first
#define ss      second
#define newline printf("\n")
ll binpow(ll a, ll b); // binary exponentiation kop
void prime_factorization(ll n, vll &prime_factors); // prime factorization kop
ll gcd(ll a, ll b); // greatest common divisor kop. Use LONG LONG
void speedup() {
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}

int main(){
    speedup();
    int t = 1;
    // cin>> t;
    while(t--){
        // khela final Mamooo
        int n , d; cin>> n >> d;
        int x , y;
        int cnt = 0;
        for(int i = 0; i < n; i++){
            cin>> x >> y;
            double temp = sqrt(binpow(x, 2) + binpow(y, 2));
            // cout<< temp << endl;
            if(temp <= (double)d) cnt++;
        }
        cout<< cnt << "\n";
        
        
    }
    // kop kop return 
    return 0;
}


// kop kop functions:
ll binpow(ll a, ll b){
    a = a ; ll res = 1;
    while(b > 0){
        if(b & 1) res *= a ;
        a = a* a;b = b >> 1;}
    return res;
}
/*---------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}
/*---------------------------------------------------------------------------------------------------------------*/
void prime_factorization(ll n, vll &prime_factors){
    // first two step taking care of composite number
    // taking care of 2
    while(n%2 == 0){
        prime_factors.pb(2);
        n = n / 2;
    }
    // now n must be odd. And the remaining prime divisors are odd. so we start from 3 and increamenting 2
    for(ll i = 3; i <= sqrt(n); i = i + 2){
        while(n%i == 0){
            prime_factors.pb(i);
            n = n / i;
        }
    }
    // now we are taking care of  n is prime number and greater than 2
    if(n > 2){
        prime_factors.pb(n);
    }
}
/*---------------------------------------------------------------------------------------------------------------*/














Measured memory_bytes: 3700
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define MEM(x) memset(x,0,sizeof(x))
#define vc vector<int>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define inf 0x3f3f3f3f
#define t_case int tt; cin>>tt; while (tt--)
#define lnginf 9223372036854775807
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define For(i,j,k) for (int i=(int)(j);i<(int)(k);i++)
#define rFor(i,j,k) for (int i=(int)(k-1);i>=(int)(j);i--)
#define ins insert
#define in(x); { for (auto &i : x) cin >> i; }
#define out(x); { for (auto i : x) cout<<i<<' ' ; }
#define pi  pair<int,int>
#define ti tuple<int,int,int>
#define PI 3.14159265359
#define des(x) setprecision(x)
const long long LL_INF = (long long) 2e18 + 5;
using namespace std;
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
const int N=3e5+10;

void solve(){
  int a,b,c; cin>>a>>b>>c;
  b*c>=a? cout<<"Yes\n":cout<<"No\n";
  
}
int32_t main() {

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



}

Measured memory_bytes: 3640
n = gets.to_i
a = gets.split.map(&:to_i)

flag = false
a_sort = a.sort
n.times do |i|
  n.times do |ii|
    a[i], a[ii] = a[ii], a[i]
    flag = true if a_sort == a
    a[i], a[ii] = a[ii], a[i]
  end
end
puts flag ? 'YES' : 'NO'
# y n y


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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int i = 0;
	while (1) {
		if (i % 2 == 0) c -= b;
		else a -= d;
		if (c <= 0) {
			cout << "Yes" << endl;
			break;
		}
		else if (a <= 0) {
			cout << "No" << endl;
			break;
		}
		i++;
	}
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define INF 1e10
using namespace std;
const int maxn = 1e6+10;
int n,m,a[maxn],b[maxn];

int32_t main(){
    IOS;
    string k;
    cin>>k;
    int a=(k[0]-'0')*10+k[1]-'0';
    int b=(k[2]-'0')*10+k[3]-'0';
    int keyY=0,keyM=0;
    if(1<=a && a<=12)keyM=1;
    if(1<=b && b<=12)keyY=1;
    int m=min(a,b),w=max(a,b);
//    cout<<a<<" "<<b<<endl;
    if(a==2 && b>=30){
        cout<<"NA";
        return 0;
    }
    set<int>T;
    T.insert(1);
    T.insert(3);
    T.insert(5);
    T.insert(7);
    T.insert(8);
    T.insert(10);
    T.insert(12);
    if(!T.count(m) && w>=31){
        cout<<"NA";
        return 0;
    }
    if(keyY && keyM){
        cout<<"AMBIGUOUS";
        return 0;
    }else if(keyY && !keyM)
    {
        cout<<"YYMM";
        return 0;
    }else if(!keyY && keyM)
    {
        cout<<"MMYY";
        return 0;
    }else cout<<"NA";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/math/common_factor_rt.hpp>

#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(a) (a).begin(), (a).end()

using namespace std;

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

    int mod4 = 0, mod2 = 0;

    REP(i, N)
    {
        int n; cin >> n;

        if( n % 4 == 0 ) mod4++;
        else if( n % 2 == 0 ) mod2++;
    }

    N -= mod2;

    bool ok;
    if( mod2 != 0 )
    {
        ok = N - mod4 <= mod4;
    }
    else
    {
        ok = N - mod4 - 1 <= mod4;
    }

    cout << (ok?"Yes":"No") << endl;

    return 0;
}


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

int main(){
	ll n,Y;
	cin>>n>>Y;
	ll x=0,y=0,z=0;
	bool flag=false;
	for(x=0;x<=n;x++){
		for(y=0;y<=n;y++){
			ll tmp = Y-(x*1000+y*5000);
			if(tmp%10000==0&&(tmp/10000)+x+y==n&&tmp>=0){
				cout<<tmp/10000<<" "<<y<<" "<<x<<endl;
				flag = true;
				return 0;
			}
		}
	}
	if(!flag){
		cout<<"-1 -1 -1"<<endl;
	}
}


Measured memory_bytes: 256
N = int(input())
a = [int(i) for i in input().split()]
flg = 0
ct_2, ct_4 = 0, 0
for i in a:
    if i % 4 == 0:
        ct_2 += 1
        ct_4 += 1
    elif i % 2 == 0:
        ct_2 += 1

if ct_4 >= N//2:
    flg = 1
else:
    if ct_2 >= N-ct_4:
        flg = 1

if flg == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; long a, b; readV(n, a, b);
  long[] x; readA(n, x);

  auto ans = 0L;
  foreach (i; 1..n) ans += min((x[i]-x[i-1])*a, b);

  writeln(ans);
}


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



struct Node{
	int key;
	struct Node *l, *r, *p;
};

struct Node *root, *NIL;

void insert(int v){
struct Node *y = NIL;
struct Node *x = root;
struct Node *z;

z = (struct Node *)malloc(sizeof(struct Node));
z->key = v;
z->l = NIL;
z->r = NIL;

while(x != NIL){
y = x;
if( z->key < x->key ){
	x = x->l;
	}
else{
x = x->r;
	}
}
z->p = y;
if(y == NIL){
	root = z;
}
else if(z->key < y->key){
	y->l =z;
}
else{
	y->r =z;
}
}

void Iorder(struct Node *u){
	if(u == NIL){
		return;
	}
	Iorder(u->l);
	printf(" %d", u->key);
	Iorder(u->r);
}
void Porder(struct Node *u){
	if(u == NIL){
		return;
	}
	printf(" %d", u->key);
	Porder(u->l);
	Porder(u->r);
}
int main(){
	int n,i,v;
	char *sent = malloc(7);
char *s1 = "insert";
char *s2 = "print";

	scanf("%d",&n);

	for(i = 0;i <n;i++){

		scanf("%6s",sent);
   
		if(0==strcmp(sent,s1)){
			scanf("%d", &v);
			insert(v);
		}
		else if(0==strcmp(sent,s2)){
			Iorder(root);
			printf("\n");
			Porder(root);
			printf("\n");
		}
	}

return 0;
}

Measured memory_bytes: 24036
#include <bits/stdc++.h>
using namespace std;
int n, x = 0;

int main() {
    cin >> n;
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        int a; scanf("%d", &a);
        x += a;
        res += x/2;
        if (a == 0) x = 0;
        else x %= 2;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
from typing import List, Tuple


class RollingHash:
    """Rolling Hash"""

    __slots__ = ["_base", "_mod", "_hash", "_power"]

    def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7):
        self._base = base
        self._mod = mod
        self._hash, self._power = self._build(source)

    def _build(self, source: str) -> Tuple[List[int], List[int]]:
        """Compute "hash" and "mod of power of base" of interval [0, right)."""
        length = len(source)
        hash_, power = [0] * (length + 1), [0] * (length + 1)
        power[0] = 1
        for i, c in enumerate(source, 1):
            hash_[i] = (hash_[i - 1] * self._base + ord(c)) % self._mod
            power[i] = power[i - 1] * self._base % self._mod
        return hash_, power

    def get_hash(self, left: int, right: int):
        """Return hash of interval [left, right)."""
        return (
            self._hash[right] - self._hash[left] * self._power[right - left]
        ) % self._mod


def abc141_e():
    # https://atcoder.jp/contests/abc141/tasks/abc141_e
    N = int(input())
    S = input().rstrip()

    rh = RollingHash(S)
    ok, ng = 0, N // 2 + 1
    while ng - ok > 1:
        mid = (ok + ng) // 2
        flg = False
        memo = set()
        for i in range(N - 2 * mid + 1):
            memo.add(rh.get_hash(i, i + mid))
            if rh.get_hash(i + mid, i + 2 * mid) in memo:
                flg = True
                break
        if flg:
            ok = mid  # next mid will be longer
        else:
            ng = mid  # next mid will be shorter

    print(ok)  # max length of substrings appeared twice or more


if __name__ == "__main__":
    abc141_e()


Measured memory_bytes: 11192
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, Y;
  cin >> N >> Y;
  Y /= 1000;
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= N - i; j++) {
      for(int k = 0; k <= N - i - j; k++) {
        if (i * 10 + j * 5 + k == Y && i + j + k == N) {
          cout << i << ' ' << j << ' ' << k << endl;
          return 0;
        }
      }
    }
  }
  cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
// at coder beginner
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb2l(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const ll  maxx=1e10+5;
void solve(){
 ll n;
 cin>>n;
 vll v(n);
 fr(i,0,n)cin>>v[i];
 ll cnt=0;
 ll k=1;
 fr(i,0,n){
     if(v[i]==k){
    k++;
     }
     else cnt++;
     }

if(cnt==n)
cout<<-1;
else cout<<cnt<<endl; 
 }
int main(){
    ll t=1;
//cin>>t;
ll k=1;
    while(k<=t){

     solve();
     k++;
    }
    return 0;
}


Measured memory_bytes: 1792
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
	#n=int(input())
    #a=list(map(int,sys.stdin.readline().split(' ')))
    n,h,w= map(int, sys.stdin.readline().split(' '))
    ans=0
    for i in range(n):
    	a,b= map(int, sys.stdin.readline().split(' '))
    	if(a>=h and b>=w):
    		ans+=1
    print(ans)

    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5;
const int inf=1e9;
int main(){
	int X; cin>>X;
    cout<<360 / gcd(360, X)<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <array>
#include <iomanip>
#include <utility>
#include <string>
#include <map>
#include <algorithm> //using for swap()
#include <tr1/unordered_map>
using namespace std;
 
array<pair<char,int>,100001> A;

tr1::unordered_map<int,pair<string,int>> dat; 

int Partition(int p,int  r){
    int x = A[r].second;
    int i = p-1;
    for(int j=p;j<r;j++){
        if(A[j].second <= x){
            i++;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

void quick(int p,int r){
    if(p<r){
        int q = Partition(p,r);
        quick(p,q-1);
        quick(q+1,r);
    }
}
 
int main(){
    int n;
    char tmp1;
    int  tmp2;
    string s;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>tmp1>>tmp2;
        A[i].first =tmp1;
	A[i].second=tmp2;
        if(dat.count(tmp2)==0){
            s="";
            s+=tmp1;
            dat.insert(map<int,pair<string,int>>::value_type
                    (tmp2,pair<string,int>(s,0)));
        }else{
            dat[tmp2].first=dat[tmp2].first+tmp1;
        }
    }
    quick(0,n-1);
    bool isStable=true;
    for(int i=0;i<n;i++){
         if(dat[A[i].second].first[dat[A[i].second].second]!=
             A[i].first){
             isStable=false;
         }
         dat[A[i].second].second++;
    }
    if(isStable){
        cout<<"Stable"<<endl;
    }else{
        cout<<"Not stable"<<endl;
    }
    for(int i=0;i<n;i++){
	   cout<<A[i].first<<" "<<A[i].second<<endl;
    }
    return 0;
}

Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":"\n");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        #define endl "\n"
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin >> s;
    sort(ALL(s));
    if (s == "abc") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
//解説見てからといた

#include<bits/stdc++.h>
using namespace std;
#define ll long long int

ll K,b;
queue<ll> a;

int main(){
	cin>>K;

	for(int i=1;i<=9;++i){
		a.push(i);
	}
	for(int i=0;i<K;i++){
		b = a.front();
		//cout<<b<<" ";
		a.pop();
		if(b%10!=0)
			a.push(b*10+(b%10)-1);
		a.push(b*10+b%10);
		if(b%10!=9)
			a.push(b*10+(b%10)+1);
	}
	cout<<b<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  map<int,int>m;
  int n;
  cin>>n;
  rep(i,n){
    int x;
    cin>>x;
    m[x]++;
    m[x-1]++;
    m[x+1]++;
  }
  pi ans;ans.second=0;
  for(auto itr : m){
    if(itr.second > ans.second){
      ans.second=itr.second;
      ans.first=itr.first;
    }
    //cout<<itr.first<<" "<<itr.second<<endl;
  }
  cout<<ans.second<<endl;
  return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >>N;
  bool ans = false;
  for(int i = 0; i<=N/4; i++){
    for(int j =0; j<=N/7; j++){
      if(4*i + 7*j == N){
        ans = true;
      }
    }
  }
  if(ans){
  cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

    

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b, wa, sa, seki;
  int i;
  scanf("%d %d", &a, &b);
  
  wa = a + b;
  sa = a - b;
  seki = a * b;
  i = wa;
  
  if(wa < sa){
    i = sa;
    if(sa < seki){
      i = seki;
    }
  }
  else if(wa < seki){
    i = seki;
    if(seki < sa){
      i = sa;
    }
  }
  
  printf("%d", i);
  
  return 0;
}


Measured memory_bytes: 128
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n >= (p ** e) and n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n >= p and n % p == 0:
      n //= p
    p += 1
else:
  if n != 1:
    score += 1
print(score)

Measured memory_bytes: 9132
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	S, T := getString(), getString()

	out(T + S)
}


Measured memory_bytes: 640
import sys
import numpy as np
from numba import njit, void, i8
input = sys.stdin.buffer.readline

def main():
    R, C, K = map(int, input().split())
    cell = np.full((R+1, C+1), 0, dtype=np.int64)
    for i in range(K):
        x, y, c = map(int, input().split())
        cell[x-1, y-1] = c
    print(calc(cell, R, C))

@njit(i8(i8[:,:],i8,i8))
def calc(cell, R, C):
    L_INF = int(1e17)
    dp = np.full((R+1, C+1, 4), -L_INF, dtype=np.int64)
    dp[0, 1, 0] = dp[1, 0, 0] = 0
    for i in range(1, R + 1):
        for j in range(1, C + 1):
            for k in range(4):
                dp[i, j, k] = max(dp[i, j, k], dp[i, j-1, k])
                if k > 0:
                    dp[i, j, k] = max(dp[i, j, k], dp[i, j, k-1])
                    dp[i, j, k] = max(dp[i, j, k], dp[i, j-1, k-1] + cell[i-1, j-1])
                if k == 1:
                    dp[i, j, 1] = max(dp[i, j, 1], dp[i-1, j, 3] + cell[i-1, j-1])
    return dp[R, C, 3]

if __name__ == "__main__":
    main()


Measured memory_bytes: 465084
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    char c;
    while(cin>>a>>c>>b)
    {
        if(c=='+') cout<<a+b<<endl;
        else if(c=='-') cout<<a-b<<endl;
        else if(c=='*') cout<<a*b<<endl;
        else if(c=='/') cout<<a/b<<endl;
        else if(c=='?') continue;
    }
    return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>
//#include "MINE.h"

int main(){
	int r,c;
	int a[101][101]={};
	
	//??\???
	do{
		printf("");
		scanf("%d %d",&r,&c);
	}while(!(r>=1 && r<=100 && c>=1 && c<=100));
	
	int s,t;
	int b;
	for(s=0;s<r;s++){
		do{
			b=1;
			printf("");
			for(t=0;t<c;t++){
				scanf("%d ",&a[s][t]);
				if(!(a[s][t]>=0 && a[s][t]<=100))b=0;
			}
		}while(b==0);
	}
	
	//??????
	for(s=0;s<=r;s++){
		for(t=0;t<=c;t++){
			if(s==r){
				for(b=0;b<s;b++){
					a[s][t]+=a[b][t];
				}
			}else if(t==c){
				for(b=0;b<t;b++){
					a[s][t]+=a[s][b];
				}
			}
			if(t<c){
				printf("%d ",a[s][t]);
			}else if(t==c){
				printf("%d\n",a[s][t]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int a,b;
  cin>>a>>b;
  int s=-1;   
  for(double i=1.0;i<=1000;i+=1.0){
    if(int(floor(i*0.08))==a&&int(floor(i*0.1))==b){
      s=int(i);
      break;
    }
  }
  cout<<s<<endl;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    string str=to_string(n);
    int flag=0;
    for(int i=0;i<str.size();++i)
    {
        if(str[i]=='7')
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll N, M, R;
int r[9];
int res;
bool used[9];

// 最短経路問題
#define FROM 201
#define TO 201
#define COST INF
int d[FROM][TO];
void warshall_floyd(ll n) {
	rep1(k, n) {			// 経由する頂点
		rep1(i, n) {		// 始点
			rep1(j, n) {	// 終点
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

void dfs(int c, int las, int dist) {
	if (c == R + 1)
	{
		if (res > dist) res = dist;
		return;
	}
	for (int i = 1; i <= R; i++) if (!used[i])
	{
		used[i] = true;
		if (las == -1) dfs(c + 1, i, 0);
		else dfs(c + 1, i, dist + d[r[las]][r[i]]);
		used[i] = false;
	}
}

void solve_abc_d() {
	ll ans = 0;

	cin >> N >> M >> R;

	rep(i, FROM)rep(j, TO) {
		if (i != j) {
			d[i][j] = COST;
		}
	}

	rep1(i, R) {
		cin >> r[i];
	}

	ll a, b, c;
	rep(i, M) {
		cin >> a >> b >> c;
		if (d[a][b] > c) {
			d[a][b] = c;
			d[b][a] = c;
		}
	}

	warshall_floyd(N);

	res = INF;
	dfs(1, -1, 0);
	ans = res;

	cout << ans << "\n";
}

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

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
#define pff(a,b) printf("%d  %d\n",a,b);
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	int mx = 0;
	rep(i, n) {
		cin >> p[i];
		mx = max(mx, p[i]);
	}
	int sum = 0;
	rep(i, n) sum += p[i];
	cout << sum - mx / 2 << endl;


	return 0;
}

Measured memory_bytes: 3516
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  int q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> dp(SIZE(s), 0);
  bool flag = false;
  repz(i, 1, SIZE(s)) { dp[i] = dp[i - 1] + (s[i - 1] == 'A' and s[i] == 'C'); }
  rep(i, q) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    cout << dp[r] - dp[l] << endl;
  }
  ret;
}


Measured memory_bytes: 3868
#include <iostream>

using namespace std;

int		main(void)
{
	int a, b;
	cin >> a >> b;
	if (a > b)
		cout << "a > b" << endl;
	else if (a < b)
		cout << "a < b" << endl;
	else
		cout << "a == b" << endl;
	return (0);
}



Measured memory_bytes: 3100
using System;

namespace AtCoder
{
    class Program
    {
        static IO io = new IO();

        static void Main(string[] args)
        {
            //入力
            io.Read();
            string A = io.String();
            io.Read();
            string B = io.String();

            //計算
            string output = Compare(A, B);

            //出力
            io.WriteLine(output);
        }

        static string Compare(string s0, string s1)
        {
            if (s0.Length > s1.Length) { return "GREATER"; }
            else if (s0.Length < s1.Length) { return "LESS"; }
            else
            {
                for (int i = 0; i < s0.Length; ++i)
                {
                    int i0 = int.Parse(s0.Substring(i, 1));
                    int i1 = int.Parse(s1.Substring(i, 1));
                    if (i0 > i1) { return "GREATER"; }
                    else if (i0 < i1) { return "LESS"; }
                }
            }
            return "EQUAL";
        }
    }
    class IO
    {
        private string[] _Inputs;
        private int _Index;
        public void Read()
        {
            _Inputs = new string[1];
            _Inputs[0] = Console.ReadLine();
            _Index = 0;
        }
        public void ReadSplit()
        {
            _Inputs = Console.ReadLine().Split(' ');
            _Index = 0;
        }
        public string String()
        {
            return _Inputs[_Index++];
        }
        public string[] String(int xCount)
        {
            string[] rv = new string[xCount];
            Array.Copy(_Inputs, _Index, rv, 0, xCount);
            _Index += xCount;
            return rv;
        }
        public int Int()
        {
            return int.Parse(_Inputs[_Index++]);
        }
        public int[] Int(int xCount)
        {
            int[] rv = new int[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = int.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public long Long()
        {
            return long.Parse(_Inputs[_Index++]);
        }
        public long[] Long(int xCount)
        {
            long[] rv = new long[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = long.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public void Write(string xStr)
        {
            Console.Write(xStr);
        }
        public void WriteLine(string xStr)
        {
            Console.WriteLine(xStr);
        }
    }
}

Measured memory_bytes: 11092
# from fractions import gcd
gcd = __import__("fractions").gcd

N, X = map(int, input().split())
V = list(map(int, input().split()))
V.append(X)
V.sort()
vD = [V[i+1]-V[i] for i in range(len(V)-1)]
vD.sort()

res = vD[0]
for d in vD:
    res = gcd(res, d)
print(res)

Measured memory_bytes: 89236
#include <stdio.h>
#include <stdlib.h>


#define	ll_int	long long int


ll_int *WORK;

void Swap(ll_int *box, int b, int e, int t)
{
	ll_int tmp;
	int i;

	for(i = 0; i < e - b; i++){
		tmp = box[b + i];
		box[b + i] = box[t + i];
		box[t + i] = tmp;
	}
}


void Print_box(ll_int *box, int n)
{
	int i;

	for(i = 0; i < n; i++){
		printf("%lld", box[i]);
		if(i != n - 1)
			printf(" ");
	}
	printf("\n");
}


int main()
{
	int n, q;
	int b, e, t;
	ll_int *box;
	int i, j;


	scanf("%d", &n);

	box = (ll_int *)malloc(sizeof(ll_int) * n);
	WORK = (ll_int *)malloc(sizeof(ll_int) * n);

	for(i = 0; i < n; i++)
		scanf("%lld", &box[i]);

	scanf("%d", &q);

	for(i = 0; i < q; i++){
		scanf("%d %d %d", &b, &e ,&t);

		Swap(box, b, e, t);
	}


	Print_box(box, n);

	return 0;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define ll long long int
#define ss second
#define ff first
#define Mem(x,val) memset(x,val,sizeof x)
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
#define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "\n"
#define debug(a,b) cerr << #a<<" = "<<a<<"   |   "<<#b<<" = "<<b<<'\n'
#define endl '\n'
#define SZ(a) ((int)a.size())
using namespace std;
typedef pair<int, int> pi32;
typedef pair<ll, ll> pi64;
typedef vector<int> vi32;
typedef vector<ll> vi64;
typedef vector<pi32> vp32;
typedef vector<pi64> vp64;
const ll mod = 1e9 + 7;
const int MX = 2e5+7;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll n;cin>>n;
	string ans="";
	while(n>0){
		n-=1;
		ans+='a'+(n%26);
		n/=26;
	}
	reverse(all(ans));
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 3612
n = int(input())
h = list(map(int,input().split()))
for i in range(n-1):
         if h[i]  - h[i+1] >= 2:
                  print("No")
                  exit()
         elif h[i-1] != h[i] :
                  h[i] = max(1,h[i] - 1)
         elif h[i-1] == h[i] and  h[i] - h[i+1] >= 1:
                  print("No")
                  exit()
print("Yes")


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

#define rep(i,n) for(int i=0;i<(n);i++)

typedef long long ll;

#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--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


int main(){
    ll x;
    cin>>x;
    for(ll a=-120;a<=120;a++){
        for(ll b=-120;b<a;b++){
            ll c=pow(a,5)-pow(b,5);
            if(c==x){
                cout<<a<<" "<<b<<endl;
                return 0;
            }
        }
    }
    return 0;
}




Measured memory_bytes: 4100
import sys

def cumxor(n):
    q, r = divmod(n+1, 2)
    return q & 1 ^ (n * r)

a, b = map(int, sys.stdin.readline().split())

def main():
    return cumxor(b) ^ cumxor(a-1)

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	var i, e = strconv.Atoi(sc.Text())

	if e != nil {
		panic(e)
	}
	return i
}

func getFloat() float64 {
	sc.Scan()
	var i, e = strconv.ParseFloat(sc.Text(), 64)

	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	var N = getInt()

	var p = make([]float64, N)
	for i, _ := range p {
		p[i] = getFloat()
	}

	var dp = make([][]float64, N+1)
	for i, _ := range dp {
		dp[i] = make([]float64, N+1)
	}
	dp[0][0] = 1.0

	for i := 0; i < N; i++ {
		for j := 0; j <= i; j++ {
			dp[i+1][j+1] += dp[i][j] * p[i]
			dp[i+1][j] += dp[i][j] * (1.0 - p[i])
		}
	}

	var res float64
	for i := (N + 1) / 2; i <= N; i++ {
		res += dp[N][i]
	}
	fmt.Println(res)
}

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

class Main
{
    public static void main(String[] args)
    {
	Scanner sc = new Scanner(System.in);
	
	int a = sc.nextInt();
	int b = sc.nextInt();
	
	System.out.println(a*b + " " + ((a*2)+(b*2)));
    }
}


Measured memory_bytes: 26000
#include<cstdio>
#include<map>
#include<queue>
#include<utility>
#include<bitset>
#define N 100000
using namespace std;

map<pair<int,int>,int> red;
map<pair<int,int>,int> blue;

queue<int> Q;
queue<pair<int,int>> aux;

pair<int,int> mB[N+1];

int tata[N+1];
int cnt[N+1];

int viz[N+1];

int rad(int x){
    if (tata[x]==0) return x;
    tata[x]=rad(tata[x]);
    return tata[x];
}

int main(){
    //freopen ("date.in","r",stdin);
    //freopen ("date.out","w",stdout);
    int n,i;

    scanf ("%d",&n);
    for(i=1;i<n;i++){
        int x,y;
        scanf ("%d%d",&x,&y);

        mB[i].first=x;
        mB[i].second=y;

        blue[make_pair(x,y)]=i;
        blue[make_pair(y,x)]=i;

        cnt[x]++;
        cnt[y]++;
    }

    for(i=1;i<n;i++){
        int x,y;
        scanf ("%d%d",&x,&y);

        red[make_pair(x,y)]=i;
        red[make_pair(y,x)]=i;

        cnt[x]++;
        cnt[y]++;

        if (blue.find(make_pair(x,y))!=blue.end()){
            Q.push(blue[make_pair(x,y)]);
            viz[blue[make_pair(x,y)]]=1;
        }
    }

    while(!Q.empty()){
        int i=Q.front();
        viz[i]=2;
        Q.pop();

        int x=mB[i].first=rad(mB[i].first);
        int y=mB[i].second=rad(mB[i].second);

        if (x==y) continue;

        blue.erase(make_pair(x,y));
        blue.erase(make_pair(y,x));
        red.erase(make_pair(x,y));
        red.erase(make_pair(y,x));

        if (cnt[x]>cnt[y]) swap(x,y);

        tata[x]=y;

        map<pair<int,int>,int>::iterator it=blue.lower_bound(make_pair(x,0));
        map<pair<int,int>,int>::iterator stop=blue.upper_bound(make_pair(x,n));

        while(it!=stop){
            aux.push(it-> first);

            if (red.find(make_pair(y,it-> first.second))!=red.end() &&viz[it-> second]==0){
                Q.push(it-> second);
                viz[it-> second]=1;
            }

            it++;
        }

        while(!aux.empty()){
            pair<int,int> a=aux.front();
            aux.pop();

            blue[make_pair(y,a.second)]=blue[a];
            blue[make_pair(a.second,y)]=blue[a];

            blue.erase(a);
            blue.erase(make_pair(a.second,a.first));
        }

        it=red.lower_bound(make_pair(x,0));
        stop=red.upper_bound(make_pair(x,n));

        while(it!=stop){
            aux.push(it-> first);

            if (blue.find(make_pair(y,it-> first.second))!=blue.end() &&viz[blue[make_pair(y,it-> first.second)]]==0){
                Q.push(blue[make_pair(y,it-> first.second)]);
                viz[blue[make_pair(y,it-> first.second)]]=1;
            }

            it++;
        }

        while(!aux.empty()){
            pair<int,int> a=aux.front();
            aux.pop();

            red[make_pair(y,a.second)]=red[a];
            red[make_pair(a.second,y)]=red[a];

            red.erase(a);
            red.erase(make_pair(a.second,a.first));
        }

        cnt[y]+=cnt[x]-4;
    }

    int a=0;
    for(i=1;i<n;i++)
        a+=(viz[i]==2);

    if (a==n-1) printf ("YES");
    else printf ("NO");

    return 0;
}


Measured memory_bytes: 29440
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  ll ans = 0;
  if(s.size()==1) {
    cout<<s<<endl;
    return;
  }
  for(int i = 0; i< (1 << (s.size()-1));i++){
    ll cnt = s[0]-'0';
    // cout<<i<<endl;
    rep(j,s.size()-1){
      if(i>>j & 1) {
        ans += cnt;
        cnt = (s[j+1]-'0');
        if(j==s.size()-2) ans+=cnt;
      } else {
        cnt  = cnt*10+(s[j+1]-'0');
        if(j==s.size()-2) ans+=cnt;
      }
      // cout<<cnt<<endl;
  }
}
cout<<ans<<endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<int> v(n, 0);
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int j = 0; j < d; j++) {
			int t;
			cin >> t;
			v[t - 1]++;
		}
	}
	int res = 0;
	for (int i = 0; i < n; i++) {
		res += (v[i] == 0);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3652