akhauriyash/Code-Regression huggingface dataset:
H, W = map(int, input().split())
matrix = [list(input()) for j in range(H)]
#print(matrix)
A = []
for line in range(H):
    #print(matrix[line])
    if matrix[line].count('.') != W:
        A.append(matrix[line])
#print('after line:', A)
B = [] # extract rows
for row in range(W):
    flg = True
    for line in range(len(A)):
        if A[line][row] == '#':
            flg = False
    if flg == True:
        B.append(row)
#print(B)
C = []
for line in range(len(A)):
    for b in sorted(B, reverse=True):
        A[line].pop(b)
    C.append(A[line])
for c in C:
    print(''.join(c))

Measured memory_bytes: 3188
#!/usr/bin/env python3
# coding:utf-8

def main():
    stdIn1, stdIn2 = map(int, input().split())
    stdOut = solve(stdIn1, stdIn2)
    print(stdOut)


"""
方針
x,y,zそれぞれを3重ループで0からkまで回す
(O(N^3)だが、k<=2500なので気にならない)
x+y+zが等しければパターンを1追加

TLEになったので、もう少し節約するパターンを考える必要あり
ひとまずx,x+y,x+y+zがsより大きなった場合はbreakさせてループを抜ける処理にしてみる
まだTLEになるので、もう少し考える
実はzはループする必要はなく z = s - (x + y) <= k であれば +1, > k であれば continueでよい
これでO(N^2)に計算量を抑えられる

"""


def solve(k, s):
    pattern = 0
    for x in range(k+1):
        if x > s:
            break
        for y in range(k+1):
            if x + y > s:
                break
            z = s - x - y
            if z <= k:
                pattern += 1

    return pattern


if __name__ == "__main__":
    main()


Measured memory_bytes: 9120
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        string s;
        cin >> s;
        if (s == "ABC")
            cout << "ARC" << endl;
        else
            cout << "ABC" << endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


//a^(p-1) = 1 (mod p)(p->Prime numbers)
//a^(p-2) = a^(-1)
ll calc(ll a,ll b,ll p){//a^(b) mod p   
	if(b==0)return 1;
	ll y = calc(a,b/2,p);y=(y*y)%p;
	if(b & 1) y = (y * a) % p;
	return y;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N;
	cin >> N;
	vector<ll> A(N);
	FOR(i,0,N)cin >> A[i];
	vector<ll> p(N+2,0),pa(N+1);
	FOR(i,1,N+1)p[i]=(p[i-1]+calc(i,MOD-2,MOD))%MOD;
	FOR(i,0,N)pa[i]=p[i+1]+p[N-i]-1;
	ll K=1;
	FOR(i,1,N+1)K=K*i%MOD;
	ll ans = 0;
	FOR(i,0,N){
		ll x = K * pa[i] % MOD;
		ans += x * A[i] % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
}


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

using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
int inf_int=1e8;
ll inf_ll=4e18;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define siz(a) a.size()
#define sz size()



#define FILE "kebab"

const int MAXN = 1e5+100;
int a[MAXN];

template<typename T>
void print(vector<T>& a){
    for(int i=0;i<a.size();++i){
        if(i>0)
            cout <<" ";
        cout <<a[i];
    }
    cout <<"\n";
}


void solve(){
   string s;
   cin >> s;
   map<char,int> mp;
   ll ans = 0;
   for(int i=0;i<s.size();++i){
      mp[s[i]]++;
      for(int e='a';e<='z';++e){
        if(s[i]==e)
            continue;
        ans+=mp[e];
      }
   }
   cout << ans+1;

}
int main()
{
    #ifdef zxc
        freopen("input.txt","r",stdin);
      //  freopen("output1.txt","w",stdout);
    #else
       // freopen(FILE".in","r",stdin);
     //  freopen(FILE".out","w",stdout);
    #endif // zxc

    solve();
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
struct edge {int to,cap,rev;};
const int MAX_V=408,inf=1e8;
vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
void add_edge(int from, int to, int cap){
	edge e1={to,cap,G[to].size()},e2={from,0,G[from].size()};
	G[from].push_back(e1);
	G[to].push_back(e2);
}
void bfs(int s){
	memset(level,-1,sizeof(level));
	queue<int> que;
	level[s]=0;
	que.push(s);
	while(!que.empty()){
		int v=que.front();
		que.pop();
		for(int i=0;i<G[v].size();i++){
			edge &e=G[v][i];
			if(e.cap>0 && level[e.to]<0){
				level[e.to]=level[v]+1;
				que.push(e.to);
			}
		}
	}
}
int dfs(int v,int t,int f){
	if(v==t) return f;
	for(int &i=iter[v];i<G[v].size();i++){
		edge &e=G[v][i];
		if(e.cap>0 && level[v]<level[e.to]){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t){
	int flow=0;
	while(true){
		bfs(s);
		if(level[t]<0) return flow;
		memset(iter,0,sizeof(iter));
		int f;
		while( (f=dfs(s,t,inf))>0 ) flow+=f;
	}
}
int main(){
	while(true){
		int H,W,C,M,NW,NC,NM;
		scanf("%d%d%d%d%d%d%d",&H,&W,&C,&M,&NW,&NC,&NM);
		if(H<0) break;
		rep(i,MAX_V) G[i].clear();
		int al=H+W+C+M;
		int s=al*2,t=s+1,wi=t+1,wo=t+2,ci=t+3,co=t+4,mi=t+5,mo=t+6;
		rep(i,al) add_edge(i,i+al,1);
		rep(i,H) add_edge(s,i,1);
		rep(i,H) add_edge(i+al,wi,1);
		add_edge(wi,wo,NW);
		rep(i,W) add_edge(al+H+i,ci,1);
		rep(i,C) add_edge(wo,H+W+i,1);
		rep(i,C) add_edge(H+W+i+al,mi,1);
		add_edge(ci,co,NC);
		rep(i,M) add_edge(co,H+W+C+i,1);
		rep(i,M) add_edge(H+W+C+i+al,t,1);
		add_edge(mi,mo,NM);
		add_edge(mo,t,inf);
		rep(i,W){
			int ww;
			scanf("%d",&ww);
			rep(j,ww){
				int hh;
				scanf("%d",&hh);
				hh--;
				add_edge(hh+al,H+i,1);
			}
		}
		rep(i,C){
			int cc;
			scanf("%d",&cc);
			rep(j,cc){
				int ww;
				scanf("%d",&ww);
				ww--;
				add_edge(H+ww+al,H+W+i,1);
			}
		}
		rep(i,M){
			int mm;
			scanf("%d",&mm);
			rep(j,mm){
				int cc;
				scanf("%d",&cc);
				cc--;
				add_edge(H+W+cc+al,H+W+C+i,1);
			}
		}
		cout<<max_flow(s,t)<<endl;
	}
}

Measured memory_bytes: 1488
N = int(input())
A = [int(x) for x in input().split()]
sup = 10**9 + 7 
sumA = 0
total = 0

for i in range(0,N-1):
    sumA += A[i]
    if sumA > sup:
        sumA %= sup
    total += sumA*A[i+1]
    if total > sup:
        total %= sup

print(total)

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

const int MOD = int( 1e9 ) + 7;

const int MAXN = 300;
const int MAXM = 300;

int N, M;
int L[ MAXM ], R[ MAXM ], X[ MAXM ];
vector< pair< int, int > > r2lx[ MAXN + 1 ];

int dp[ MAXN + 1 ][ MAXN + 1 ][ MAXN + 1 ];

signed main() {
  ios::sync_with_stdio( 0 );
  cin >> N >> M;
  for( int i = 0; i < M; ++i ) {
    cin >> L[ i ] >> R[ i ] >> X[ i ];
    r2lx[ R[ i ] ].emplace_back( L[ i ], X[ i ] );
  }
  dp[ 0 ][ 0 ][ 0 ] = 1;
  for( int i = 0; i <= N; ++i ) {
    for( int j = 0; j <= N; ++j ) {
      for( int k = 0; k <= N; ++k ) {
        for( auto lx: r2lx[ max( { i, j, k } ) ] ) {
          int l, x; tie( l, x ) = lx;
          if( ( l <= i ) + ( l <= j ) + ( l <= k ) != x ) {
            dp[ i ][ j ][ k ] = 0;
          }
        }
        if( max( { i, j, k } ) == N ) continue;
        if( dp[ i ][ j ][ k ] == 0 ) continue;
        ( dp[ max( { i, j, k } ) + 1 ][ j ][ k ] += dp[ i ][ j ][ k ] ) %= MOD;
        ( dp[ i ][ max( { i, j, k } ) + 1 ][ k ] += dp[ i ][ j ][ k ] ) %= MOD;
        ( dp[ i ][ j ][ max( { i, j, k } ) + 1 ] += dp[ i ][ j ][ k ] ) %= MOD;
      }
    }
  }
  int ans = 0;
  for( int i = 0; i < N; ++i ) {
    for( int j = 0; j < N; ++j ) {
      ( ans += dp[ N ][ i ][ j ] ) %= MOD;
      ( ans += dp[ i ][ N ][ j ] ) %= MOD;
      ( ans += dp[ i ][ j ][ N ] ) %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define BOLT ios_base::sync_with_stdio(0)
#define newline cout << "\n"
#define eline cerr << "\n"
#define LL_MAX 9223372036854775807
#define LL_MIN -9223372036854775808
#define IN_FILE freopen("input.txt", "r", stdin)
#define OUT_FILE freopen("output.txt", "w", stdout)


// g++ -o contest contest.cpp
long long path[100000];
long long dp[100000];
int n, k;


void USEFILE(){
    IN_FILE;
    OUT_FILE;
}


void reset(){
    memset(path, 0, sizeof path);
    memset(dp, -1, sizeof dp);
}


long long process(int i){
    long long ans = LL_MAX;
    if(i>=n) return 0;
    if(dp[i] != -1) return dp[i];
    
    for(int m = 1 ; m <= k ; m++){
        if(i+m>=n){
            break;
        }
        else 
            ans = min( abs( path[i]-path[i+m]) + process(i+m), ans);
    }   
    if(ans == LL_MAX) {
        ans = 0;
    }
    dp[i] = ans;
    return ans;
}


void solve(int kase){
    reset();
    cin >> n >> k;
    for(int i = 0 ; i < n; i++){
        cin >> path[i];
    } 
    cout << process(0);newline;
}


int main(){
    BOLT;
    // USEFILE();
    int t, kase = 0;
    // cin >> t;
    // while(t--)
    //      solve(++kase);
    solve(0);

return 0;
}


Measured memory_bytes: 12980
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(s: String);

    let mut count = 0;
    for i in 0..s.len() / 2 {
        if s.chars().nth(i) != s.chars().nth(s.len() - 1 - i) {
            count += 1;
        }
    }

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


Measured memory_bytes: 2168
N = int(input())
K = list(str(input()))
R = 0
G = 0
B = 0
for i in range(N):
    if K[i] == 'R':
        R += 1
    if K[i] == 'G':
        G += 1
    if K[i] == 'B':
        B += 1

count = 0
for i in range(N-2):
    for j in range((N-3-i)//2 + 1):
        if K[i] != K[i+j+1]:
            if K[i+j+1] != K[i+j+j+2]:
                if K[i+j+j+2] != K[i]:
                    count += 1

print(R*G*B - count)

Measured memory_bytes: 9224
from operator import itemgetter
from collections import defaultdict

big = 10**10
N = int(input())
pt = [[int(x) for x in input().split()] for _ in range(N)]
pt.sort(key = itemgetter(1))
pt.sort(key = itemgetter(0))
di = defaultdict(int)
for i,p0 in enumerate(pt):
    for j,p1 in enumerate(pt):
        if(i>=j):continue
        p,q = p0[0]-p1[0],p0[1]-p1[1]
        di[p*big+q] += 1
maxd = 0
for i in di:
    if(i==0):continue
    maxd = max(di[i],maxd)
print(N-maxd)


Measured memory_bytes: 3444
//
// ~oisín~ C++ Template
//

#include                <bits/stdc++.h>
#define MX_N            5001
#define mp              make_pair
#define mod7            1000000007
#define modpi           314159
#define PI              3.141592653589793238
#define pb              push_back
#define FastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define All(a)          a.begin(),a.end()
#define fi              first
#define se              second
#define ll              long long int
#define ull             unsigned long long int

int kx[8]  =            {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8]  =            {+1, -1, +1, -1, +2, -2, +2, -2};
int d9x[9] =            {+1, +1, +1, +0, +0, +0, -1, -1, -1};
int d9y[9] =            {+1, +0, -1, +1, +0, -1, +1, +0, -1};
int dx4[4] =            {+0, +0, +1, -1};
int dy4[4] =            {+1, -1, +0, +0};

ll gcd(ull a, ull b){
    return (a==0)?b:gcd(b%a,a);
}

ll lcm(ull a, ull b){
    return a*(b/gcd(a,b));
}

const long long INF = 1e18;

using namespace std;

int main(){
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}


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

int main() {
    string s;
    int length;
    int ans = 0;
    int cnt = 0;
    
    cin >> s;
    length = s.length();
    
    for (int i = 0; i < length; i++) {
        if ((s[i] == 'A') || (s[i] == 'C') || (s[i] == 'G') || (s[i] == 'T')) {
            cnt++;
        }
        else {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    
    if (cnt) {
        ans = max(ans, cnt);
    }
    
    cout << ans << endl;
    return 0;
}

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

int main() {
  string str;
  cin >> str  ;
 int n = str.size();
  int a = 0;
  int b = (n-3)/2;
  int c = (n+1)/2;
  int d = n-1;

  
  for (int i =0 ; i<(n+1)/4 ;i++){
    if (str.at(a)==str.at(b)&&str.at(a)==str.at(c)&&str.at(a)==str.at(d)){
      a++;
      b--;
      c++;
      d--;
    }
   else{ cout<< "No" << endl;
        return 0;
       }
       
        }
        cout << "Yes" << endl;
        

  
}




Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a;
ll x[55];

ll memo[55][55][55*55];

ll calc(int k, int num, ll sum) {
    if (memo[k][num][sum] < 0) {
        if (k > n || sum < 0) return 0;
        if (num == 0 && sum == 0) memo[k][num][sum] = 1;
        else if (k < n) {
            memo[k][num][sum] = calc(k+1, num-1, sum-x[k]) + calc(k+1, num, sum);
        } else {
            return 0;
        }
    }
    return memo[k][num][sum];
}

ll solve() {
    ll res = 0;
    memset(memo, -1, sizeof(memo));
    for (int i = 1; i <= n; i++) {
        res += calc(0, i, a*i);
    }
    return res;
}

void input() {
    cin >> n >> a;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 71808
#include<bits/stdc++.h>
using namespace std;
int field[11][11];
int main() {
    while(true) {
        int H, W;
        cin >> H >> W;
        if(H == 0 && W == 0) break;
        for(int h = 1; h <= H; h++) {
            for(int w = 1; w <= W; w++) {
                cin >> field[h][w];
            }
        }
        int ans = 0;
        for(int h1 = 1; h1 <= H; h1++) {
            for(int h2 = h1 + 2; h2 <= H; h2++) {
                for(int w1 = 1; w1 <= W; w1++) {
                    for(int w2 = w1 + 2; w2 <= W; w2++) {
                        int innermaxi = 0;
                        int outermini = 15;
                        for(int h = h1; h <= h2; h++) {
                            outermini = min(outermini, field[h][w1]);
                            outermini = min(outermini, field[h][w2]);
                        }
                        for(int w = w1; w <= w2; w++) {
                            outermini = min(outermini, field[h1][w]);
                            outermini = min(outermini, field[h2][w]);
                        }
                        int now = 0;
                        for(int w = w1 + 1; w < w2; w++) {
                            for(int h = h1 + 1; h < h2; h++) {
                                innermaxi = max(innermaxi, field[h][w]); 
                                now += outermini - field[h][w];
                            }
                        }
                        if(innermaxi >= outermini) continue;
                        ans = max(ans, now);
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main () {
  int n;
  cin >> n;
  
  vector<int> prices(n, 0);
  
  for (int i = 0; i < n; i++) cin >> prices.at(i);
  
  sort(prices.begin(), prices.end());
  reverse(prices.begin(), prices.end());
  
  int sum = prices.at(0) / 2;
  
  for (int i = 1; i < n; i++) sum += prices.at(i);
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,popcnt")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<18, mod = 1e9 + 7, i2 = (mod+1)/2;
int n, owo = -1, f[maxn], vis[maxn];
vector<int> g[maxn], trail;
void cyc(int v, int p) {
	vis[v] = 1;
	trail.pb(v);
	for(auto i : g[v]) if(i != p) {
		if(vis[i] == 1) {
			owo = v;
			//cout << i << " : ";
			//for(auto i : trail) cout << i << " "; cout << endl;
			while(true) {
				f[trail.back()] = 1;
				if(trail.back() == i) break;
				else trail.pop_back();
			}
		} else cyc(i, v);
		if(owo != -1) return;
	}
	vis[v] = 2;
	trail.pop_back();
}

int val[maxn];
int get(int v) {
	if(val[v] != -1) return val[v];
	vector<int> t;
	for(auto i : g[v]) {
		t.pb(get(i));
	}
	sort(all(t));
	int mex = 0;
	for(auto i : t) {
		if(i > mex) break;
		mex += mex==i;
	}
	return val[v] = mex;
}
bool check(int v, int x) {
	memset(val, -1, sizeof val);
	val[v] = x;
	for(int i = 1; i <= n; i++) get(i);
	val[v] = -1;
	return get(v) == x;
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for(int t, i = 1; i <= n; i++) {
		cin >> t;
		g[t].pb(i);
	}
	for(int i = 1; owo == -1 && i <= n; i++) if(!vis[i])
	cyc(i, i);
	if(owo == -1) return cout << "POSSIBLE\n", 0;
	memset(val, -1, sizeof val);
	vector<int> t;
	int nxt = 0;
	for(auto i : g[owo]) if(!f[i]) {
		t.pb(get(i));
	} else nxt = i;
	sort(all(t));
	int mex = 0;
	for(auto i : t) {
		if(i > mex) break;
		mex += mex==i;
	}
	cout << (check(owo, mex)||check(nxt, mex)?"POSSIBLE":"IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 31092
# O(klog(k))解法 多分...
import sys
from heapq import heappush,heapify,heappop
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

def make_kth(A, B):
    n, m = len(A), len(B)
    A.sort(reverse=1)
    B.sort(reverse=1)
    q = [(-A[0] - B[0], 0, 0)]
    r=[]
    for _ in range(min(k, n * m)):
        v, s, t = heappop(q)
        r.append(-v)
        if t + 1 < m:
            heappush(q, (-A[s] - B[t + 1], s, t + 1))
        if t == 0 and s + 1 < n:
            heappush(q, (-A[s + 1] - B[0], s + 1, 0))
    return r

r = make_kth(a, b)
r = make_kth(c, r)
print(*r,sep="\n")

Measured memory_bytes: 76640
import sys
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = []
cnt = 0
for _ in range(n):
    b.append(int(input()))
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            cnt += 1
            a[i][j] = 0
if cnt < 3:
    print("No")
else:
    if a[0][0]==a[1][1]==a[2][2]:
        print("Yes")
        sys.exit()
    elif a[2][0]==a[1][1]==a[0][2]:
        print("Yes")
        sys.exit()
    else:
        for k in range(3):
            if a[k][0]==a[k][1]==a[k][2] or a[0][k]==a[1][k]==a[2][k]:
                print("Yes")
                sys.exit()
    print("No")

Measured memory_bytes: 38256
//for syt

#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	while(b<=a) {
		b*=2;
		k--;
	}
	while(c<=b) {
		c*=2;
		k--;
	}
	if(c>b&&b>a&&k>=0) {
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
	return 0;
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  int n, cap;
  cin >> n >> cap;
  vector <int> w (n + 1);
  vector <int> v (n + 1);
  int tot = 0;
  for (int i = 1; i <= n; i++) {
    cin >> w[i] >> v[i];
    tot += v[i];
  }
  vector <vector <int> > dp (n + 5, vector <int> (tot + 5, inf));
  /// dp[i][j] = minimum capacity for which we can make j for upto i'th items
  for (int i = 0; i <= n; i++) dp[i][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= tot; j++) {
      dp[i][j] = dp[i - 1][j];
      if (v[i] <= j) dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
    }
  }
  int mx = 0;
  for (int i = 0; i <= tot; i++) {
    if (dp[n][i] <= cap) mx = i;
  }
  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 41856
N,M,X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]

ans = float("inf")
for bit in range(1 << N):
    cost = 0
    point = [0] * M
    for i in range(N):
        if bit & (1 << i):
            cost += CA[i][0]
            for j in range(M):
                point[j] += CA[i][j+1]
    flag = True
    for i in range(M):
        if point[i] < X:
            flag = False
            break
    if flag:
        ans = min(cost, ans)


if ans != float("inf"):
    print(ans)
else:
    print(-1)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define debug cerr <<
#define ll long long
// #define int long long
#define FOR(i, x, y) for(int i = x; i <= y; ++i)
#define pb push_back
#define eb emplace_back
#define Size(v) (int)v.size()

using namespace std;
// using namespace __gnu_pbds;

// Always
const int nax = 1e5 + 5, INF = 1e9 + 7;
int n, m, s, t, dist[nax];
bool vis[nax][4], v[nax];
vector<int> g[nax], adj[nax];

void bfs() {
	queue<int> q;
	q.push(s);
	dist[s] = 0;
	v[s] = true;
	while (!q.empty()) {
		int u = q.front(); q.pop();
		for (auto &c : adj[u]) {
			if (v[c]) continue;
			v[c] = true;
			dist[c] = dist[u] + 1;
			q.push(c);
		}
	}
}

void solve() {
	fill(dist, dist + nax, INF);
	cin >> n >> m;
	FOR (i, 1, m) {
		int u, v; cin >> u >> v;
		g[u].pb(v);
	}
	cin >> s >> t;
	queue<int> que;
	que.push(s);
	dist[s] = 0;
	vis[s][0] = true;
	while (!que.empty()) {
		int i = que.front(); que.pop();
		// cerr << "i: " << i << '\n';
		queue<pair<int, int>> q;
		q.push({i, 0});
		while (!q.empty()) {
			auto p = q.front(); q.pop();
			if (p.second == 3) {
				dist[p.first] = min(dist[p.first], dist[i] + 1);
				que.push(p.first);
				continue;
			}
			else {
				for (auto &c : g[p.first]) {
					if (vis[c][p.second + 1]) {
						// cerr << "vis " << c << ' ' << p.second + 1 << '\n';
						continue;
					}
					vis[c][p.second + 1] = true;
					q.push({c, p.second + 1});
				}
			}
		}
	}
	// FOR (i, 1, n) cout << dist[i] << ' ';
	// cout << '\n';
	if (dist[t] == INF) cout << -1;
	else cout << dist[t];
}

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

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

int main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0 ; i<n ; i++)
    cin>>a[i];
    int dp[k+1];
    for(int i=0 ; i<=k ; i++){
        dp[i]=2;
        for(int j=0 ; j<n ; j++){
            if(i-a[j]>=0){
                if(dp[i-a[j]]==2){
                    dp[i]=1;
                    break;
                }
                    
            }
        }
    }
    if(dp[k]==1)
    cout<<"First"<<endl;
    else
    cout<<"Second"<<endl;
}

Measured memory_bytes: 3996
N = int(input())
a = list(range(1,N+1))
b = [i for i in range(1,N+1) if i % 3 == 0] ##3の倍数
c = [i for i in range(1,N+1) if i % 5 == 0] ##5の倍数
d = set(b+c)
A = sum(a)-sum(d)
print(A)

Measured memory_bytes: 98428
#coding:utf-8

N = int(input())

A = [int(y) for y in input().split()]

ans = 0

for i in range(N-1):
    if A[i + 1] < A[i]:
        ans += A[i] - A[i + 1]
        A[i + 1] = A[i]

print("{}".format(ans))

Measured memory_bytes: 32140
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {

            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            //var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var s = Console.ReadLine().Split();
            string ans = "=";
            if (s[0][0] > s[1][0]) { ans = ">"; }
            else if (s[0][0] < s[1][0]) { ans = "<"; }

            Console.WriteLine(ans);
            
                
            //Console.Out.Flush();

        }
    }



    public class Calculation
    {

    }

    public class Graph
    {

    }
}


Measured memory_bytes: 13140
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
	string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
	long n = long.Parse(input[0]);
	long k = long.Parse(input[1]);
	long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
  long answer = long.MaxValue;

    for(long i = 0; i < n+1-k; i++)
    {
      long c;
      if(nums[i]*nums[i+k-1]<0)
      {
      long a = Math.Abs(nums[i]);
      long b = Math.Abs(nums[i+k-1]);
      c = Math.Min(2*a+b, 2*b+a);
      }else
      {
      long a = Math.Abs(nums[i]);
      long b = Math.Abs(nums[i+k-1]);
      c = Math.Max(a, b);
      }
      answer = Math.Min(answer, c);
    }

  	Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

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

using namespace std;

int main(){
	int a, b;
	cin>>a>>b;
	if(b==1){
		cout<<0;
		return 0;
	}
	if(a>=b){
		cout<<1;
		return 0;
	}
	else{
		int sum=0;
		int rr=0;;
		while(sum<=b){
			sum+=a;rr++;
			if(sum>=b){
				break;
			}
			else{
				sum--;
			}
		}
		cout<<rr;
	}
}

Measured memory_bytes: 256
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
ans=10**18
for i in range(2**d):
  t_point,t_solved=0,0
  for j in range(d):
    if i&(1<<j):
      t_solved+=pc[j][0]
      t_point+=pc[j][0]*(j+1)*100+pc[j][1]
  if t_point>=g:
    ans=min(ans,t_solved)
    continue
  
  j=d-1
  while j>=0:
    if i&(1<<j):
      j-=1
      continue
    p,c=pc[j]
    point=(j+1)*100
    if t_point+(p-1)*point<g:
      t_point+=(p-1)*point
      t_solved+=p-1
    else:
      husoku=g-t_point
      count=-(-husoku//point)
      t_point+=count*point
      t_solved+=count
    if t_point>=g:
      break
    j-=1
  else:
    continue
  if t_point>=g:
    ans=min(ans,t_solved)
print(ans)





Measured memory_bytes: 3064
A,B,H,M=input().split()
a=int(A)
b=int(B)
h=int(H)
m=int(M)
import math
p=math.pi
x=(2*p*h/12)+(p*m/360)-(2*p*m/60)
y=2*p-x
z=min(x,y)
c=math.cos(z)
l2=a*a+b*b-2*a*b*c
l=math.sqrt(l2)
print(l)

Measured memory_bytes: 9580
// ABC085 B - Kagami Mochi

package main

import (
    "fmt"
)

var d []int

func main() {
  var N int
  var In int
  var max int
  var presize int
  var maxnum int
  var stage int

  fmt.Scan(&N)

  d = make([]int,N)

  for i := 0; i < N; i++ {
    fmt.Scan(&In)
    d[i] = In
  }

//  for i := 0; i < N; i++ {
//    fmt.Printf("init:d[%d]=%d\n",i,d[i])
//  }

  stage = 0
  presize = 101
  for i := 0; i < N; i++ {
    max   = 0
    for j := 0; j < N; j++ {
      if d[j] > max {
       max = d[j]
       maxnum = j
      }
    }


    if presize > max { 
      presize = max
      d[maxnum] = 0
      stage++
    } else if presize == max {
      d[maxnum] = 0
    }

//    fmt.Printf("max:%d ",max)
//    fmt.Printf("stage:%d\n",stage)



  }

//  for i := 0; i < N; i++ {
//    fmt.Printf("last:d[%d]=%d\n",i,d[i])
//  }

  fmt.Println(stage)
}


Measured memory_bytes: 512
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define loopinc(i, a, b, inc) for(int i = a; i < (b); i += inc)
#define loop(i, a, b) for(int i = a; i < (b); i++)
#define rep(i, n) loop(i, 0, n)
#define rrep(i, n) for (int i = n-1; i >= 0; i--)
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define lloopinc(i, a, b, inc) for(ll i = a; i < (b); i += inc)
#define lloop(i, a, b) for(ll i = a; i < (b); i++)
#define lrep(i, n) lloop(i, 0, n)
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tuple<int, int, int> tiii;
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

signed main() {
	// freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	
	ll n, m, k;
	cin >> n >> m >> k;
	vll a(n);
	vll b(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];
	vll pa(n+1);
	vll pb(m+1);
	rep(i, n) pa[i+1] = pa[i] + a[i];
	rep(i, m) pb[i+1] = pb[i] + b[i];

	int i = 0;
	while (i < n and pa[i] <= k) i++;
	int best = i;
	for (int j = i; j >= 0; j--) {
		best = max(best, j + (int)(upper_bound(all(pb), k-pa[j]) - pb.begin()));
		//debug(best, j, (int)(upper_bound(all(pb), k-pa[j]) - pb.begin()));
	}
	cout << best-1 << endl;
}


Measured memory_bytes: 9528
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
    scanf("%d",&n);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int x,k;scanf("%d%d",&x,&k);
        while(x%k) x-=((x%k-1)/(x/k+1)+1)*(x/k+1);
        ans^=x/k;
    }
    if(ans) puts("Takahashi");
    else puts("Aoki");
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
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; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始


int main(){
  int n;
  cin>>n;
  int sum;
  for(int i = 1; i < n+1; i++){
    sum+=i;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>

using namespace std;

int main(){
  int n;
  int a[100];
  int max=-100;
  int min=100;
  int sum_min=10000000;
  int sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(max<a[i])max=a[i];
    if(min>a[i])min=a[i];
  }

  for(int i=min;i<=max;i++){
    for(int j=0;j<n;j++){
      sum=sum+pow(i-a[j],2);
    }
      if(sum_min>sum)sum_min=sum;
    
    sum=0;
  }

  cout<<sum_min<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P = pair<int, int>;

template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    else {
        return false;
    }
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    else {
        return false;
    }
}
template<typename T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int a, b; string o;
    cin >> a >> o >> b;
    int ans;
    if (o == "+") ans = a + b;
    else ans = a - b;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <cstdint> // int64_t, int_fast64_t

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

typedef std::int_fast64_t ll; // at least int64 > 9*10^18
typedef std::uint_fast64_t ull; // at least uint64

struct City
{
  int y,i,n;
  City() {}
  City(int y, int i) : y(y),i(i),n(1) {}
  bool operator< (const City& c) {
    return y<c.y;
  }
};

struct Prefecture
{
  std::vector<City> cities;
  void sort() {
    std::sort(cities.begin(),cities.end());
    int i = 1;
    for(auto &c:cities) {
      c.n = i;
      i++;
    }
  }
  Prefecture() {}
};

int main() {
  int n,m;
  std::cin >> n >> m;
  std::vector<Prefecture> prefectures(n);
  rep(i,m) {
    int p,y;
    std::cin >> p >> y;
    p--;
    prefectures[p].cities.emplace_back(y,i);
  }
  rep(i,n) prefectures[i].sort();
  std::vector<std::string> id(m);
  rep(i,n) for(auto c:prefectures[i].cities) {
    id[c.i] = std::to_string(1e12+1e6*(i+1)+c.n).substr(1,12);
  }
  rep(i,m) std::cout << id[i] << ENDL;
  return 0;
}

Measured memory_bytes: 12416
#include<map>
#include<cctype>
#include<cstdio>
#include<vector>
#include<algorithm>

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

using namespace std;

struct point{
	int x,y,z;
	point operator+(const point &a)const{ return (point){x+a.x,y+a.y,z+a.z}; }
	point operator-(const point &a)const{ return (point){x-a.x,y-a.y,z-a.z}; }
	bool operator==(const point &a)const{ return x==a.x && y==a.y && z==a.z; }
};

struct edge{
	point u,v;
	bool operator==(const edge &e)const{ return u==e.u && v==e.v || u==e.v && v==e.u; }
};

struct key{
	int n;
	edge E[300];
};

key getkey(){
	key K={};
	point p={0,0,0};
	map<int,point> f;
	int n; scanf("%d",&n);
	while(n--){
		char s[8]; scanf("%s",s);

		if(isdigit(s[0])){
			int a; sscanf(s,"%d",&a);
			if(f.count(a)) p=f[a];
			else           f[a]=p;
		}
		else{
			point q=p;
			if(s[0]=='+' && s[1]=='x') q.x++;
			if(s[0]=='-' && s[1]=='x') q.x--;
			if(s[0]=='+' && s[1]=='y') q.y++;
			if(s[0]=='-' && s[1]=='y') q.y--;
			if(s[0]=='+' && s[1]=='z') q.z++;
			if(s[0]=='-' && s[1]=='z') q.z--;
			K.E[K.n++]=(edge){p,q};
			p=q;
		}
	}

	return K;
}

struct matrix{
	int a[3][3];

	point operator*(const point &p)const{
		int x=a[0][0]*p.x+a[0][1]*p.y+a[0][2]*p.z;
		int y=a[1][0]*p.x+a[1][1]*p.y+a[1][2]*p.z;
		int z=a[2][0]*p.x+a[2][1]*p.y+a[2][2]*p.z;
		return (point){x,y,z};
	}

	matrix operator*(const matrix &A)const{
		matrix B={};
		rep(i,3) rep(j,3) rep(k,3) B.a[i][j]+=a[i][k]*A.a[k][j];
		return B;
	}

	bool operator==(const matrix &A)const{
		rep(i,3) rep(j,3) if(a[i][j]!=A.a[i][j]) return false;
		return true;
	}
};

vector<matrix> R;

bool issame(const key &K1,const key &K2){
	if(K1.n!=K2.n) return false;

	point shift1=K1.E[0].u;
	point dir1=K1.E[0].v-shift1;
	rep(i,K2.n){
		point shift2,dir2;
		rep(t,2){
			if(t==0) shift2=K2.E[i].u, dir2=K2.E[i].v-shift2;
			if(t==1) shift2=K2.E[i].v, dir2=K2.E[i].u-shift2;

			rep(j,R.size()) if(R[j]*dir1==dir2) {
				bool ok=true;
				rep(k,K1.n){
					edge e=K1.E[k];
					e=(edge){e.u-shift1,e.v-shift1};
					e=(edge){R[j]*e.u,R[j]*e.v};
					e=(edge){e.u+shift2,e.v+shift2};
					if(count(K2.E,K2.E+K2.n,e)!=1){ ok=false; break; }
				}
				if(ok) return true;
			}
		}
	}
	return false;
}

int main(){
	matrix I,X,Y,Z;
	I.a[0][0]= 1; I.a[0][1]= 0; I.a[0][2]= 0;
	I.a[1][0]= 0; I.a[1][1]= 1; I.a[1][2]= 0;
	I.a[2][0]= 0; I.a[2][1]= 0; I.a[2][2]= 1;
	X.a[0][0]= 1; X.a[0][1]= 0; X.a[0][2]= 0;
	X.a[1][0]= 0; X.a[1][1]= 0; X.a[1][2]=-1;
	X.a[2][0]= 0; X.a[2][1]= 1; X.a[2][2]= 0;
	Y.a[0][0]= 0; Y.a[0][1]= 0; Y.a[0][2]=-1;
	Y.a[1][0]= 0; Y.a[1][1]= 1; Y.a[1][2]= 0;
	Y.a[2][0]= 1; Y.a[2][1]= 0; Y.a[2][2]= 0;
	Z.a[0][0]= 0; Z.a[0][1]=-1; Z.a[0][2]= 0;
	Z.a[1][0]= 1; Z.a[1][1]= 0; Z.a[1][2]= 0;
	Z.a[2][0]= 0; Z.a[2][1]= 0; Z.a[2][2]= 1;

	R.push_back(I);
	while(1){
		bool change=false;
		rep(i,R.size()){
			rep(j,3){
				matrix A=(j==0?X*R[i]:j==1?Y*R[i]:Z*R[i]);
				if(count(R.begin(),R.end(),A)==0){ R.push_back(A); change=true; }
			}
		}
		if(!change) break;
	}

	while(1){
		key K1=getkey(); if(K1.n==0) break;
		key K2=getkey();

		puts(issame(K1,K2)?"SAME":"DIFFERENT");
	}

	return 0;
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
const int dc[4] = {1, -1, 0,  0};
const int dr[4] = {0,  0, 1, -1};
//const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
//const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }

template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{  
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    map<char,int> mp; 
    irep(i,n) {
        mp[s[i]]++;
    }
    ll ans = 1;
    for(auto c : mp) {
        ans *= c.se+1;
        ans %= MOD;
    }
    cout << ans - 1 << endl;
    return 0;
}
/*atcoder*/


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

int main() {
    const ll mod = 1000000007;
    ll n, m;
    cin >> n >> m;
    if (abs(n - m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    auto factorial = [&](ll a) {
        ll ans = 1;
        for (ll i = 1; i <= a; ++i) {
            ans *= i;
            ans %= mod;
        }
        return ans;
    };
    ll ans = factorial(n) * factorial(m) % mod;
    if (n == m) ans = ans * 2 % mod;
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
tls = list(map(int,input().split()))
m = int(input())
pxls = []
for i in range(m):
    pxls.append(list(map(int,input().split())))
tsum = sum(tls)
for j in pxls:
    print(tsum - tls[j[0]-1] + j[1])

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int a, b, c; cin >> a >> b >> c;
  cout << a * b / 2 << endl;
}


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

int main(){
  int N,M,K;
  string S;
  
  cin>>K>>N>>M ;
  if(M%K==0||N%K==0)cout<<"OK"<<endl;
  else if(M/K-N/K>0)cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
}

//  cout<<"Yes"<<endl;
//  cout<<" No"<<endl;
//  cout<<" "<<endl;
//  if()  ;
//  for(int i=0; i < N; i++){}


Measured memory_bytes: 3636
import static java.util.Arrays.deepToString;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			int A = sc.nextInt();
			if (A == 0) break;
			double a = 0;
			
			int remain = 360;
			for (int i = 0; i < A - 1; i++) {
				int x = sc.nextInt();
				a += Math.sin(Math.PI * x / 180);
				remain -= x;
			}
			a += Math.sin(Math.PI * remain / 180);
			
			int B = sc.nextInt();
			remain = 360;
			for (int i = 0; i < B - 1; i++) {
				int x = sc.nextInt();
				a -= Math.sin(Math.PI * x / 180);
				remain -= x;
			}
			a -= Math.sin(Math.PI * remain / 180);

			final double EPS = 1e-10;
			int ans = a > EPS ? 1:
				a < -EPS ? 2 : 0;
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 20980
#include <bits/stdc++.h>
//#include <random>
//#include <chrono>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define MotoHaiyaku ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2*1e18;
const ld PI=3.14159265358979323846;
int main()
{
    MotoHaiyaku
    ll n,d,cnt=0;
    cin>>n>>d;
    rep(i,n)
    {
        ll x,y;
        cin>>x>>y;
        if(x*x+y*y<=d*d) cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 3572
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	int r=read();
	cout<<r*r<<endl;
	return 0;
}


Measured memory_bytes: 256