akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;
#define MAX 52
bool dfs(char map[MAX][MAX], int i, int j, int h, int w, char &c){
  const int di[] = {-1,0,1,0};
  const int dj[] = {0,1,0,-1};

  if( i < 1 || i > h || j < 1 || j > w )
    return true;

  if( map[i][j] == 'V' )
    return true;

  //cout << '(' << i << ',' << j << ')' << ' ';

  if( map[i][j] == 'B' || map[i][j] == 'W' ){
    if( (c == 'B' || c == 'W') && map[i][j] != c ){
      return false;
    }else{
      c = map[i][j];
      //cout << c << endl;
      return true;
    }
  }

  map[i][j] = 'V';
  for(int k = 0; k < sizeof(di)/sizeof(*di); ++k){
    if( !dfs( map, i + di[k], j + dj[k], h, w, c ) )
      return false;
  }
  return true;
}
int main(){
  while(true){
    int w,h;
    int numBlack = 0, numWhite = 0;
    char o_map[MAX][MAX], map[MAX][MAX];
    cin>>w>>h;
    if(w==0&&h==0)break;
    for(int i = 0; i < h; ++i){
      string s;
      cin >> s;
      for(unsigned int j = 0; j < w; ++j){
	o_map[i+1][j+1] = map[i+1][j+1] = s[j];
      }
    }
    for(int i = 1; i <= h; ++i){
      for(int j = 1; j <= w; ++j){
	char c = 'V';
	if( map[i][j] == '.' ){
	  if( dfs( map, i, j, h, w, c ) ){
	    if( c == 'B' )
	      ++numBlack;
	    if( c == 'W' )
	      ++numWhite;
	  }
	  for(int y = 1; y <= h; ++y){
	    for(int x = 1; x <= w; ++x){
	      //cout << map[y][x];
	      map[y][x] = o_map[y][x];
	    }
	    //cout << endl;
	  }
	}
      }
    }
    cout << numBlack << ' ' << numWhite << endl;
  }
  return 0;
}

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

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int N, M, K;

bool c[1000004];

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);
	
	cin>>N>>M>>K;
	
	rep(i, N+1) {
		rep(j, M+1) {
			//cout<<i<<' '<<j<<' '<<(i*M+j*N-2*i*j)<<endl;
			c[i*M+j*N-2*i*j] = true;
		}
	}
	
	cout<<(c[K] ? "Yes" : "No")<<endl;
	
	return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

 #define rep(i, a, b) for (int i = a; i <= b; i++)
 #define fill(a, x) memset(a, x, sizeof(a))

 const int N = 100000 + 5;

 int n, m, u, v;
 int sum[N];

int main()
{
	scanf("%d%d", &n, &m);
	fill(sum, 0);
	rep(i, 1, m) {
		scanf("%d%d", &u, &v);
		sum[u] ^= 1, sum[v] ^= 1;
	}
	bool flag = true;
	rep(i, 1, n) if (sum[i]) { flag = false; break; }
	if (flag) puts("YES"); else puts("NO"); 
	return 0;
}


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

int main()
{
  string s;
  int n;
  cin >> n >> s;
  rep(i,s.size()){
    if(s[i] + n > 'Z'){
      s[i] = ((s[i] - 'A' + n) % 26) + 'A';
    }
    else s[i] = s[i] + n;
  }
  cout << s << endl;
  return 0;
}

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

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

int main() {
  long long A, B, C, K;
  cin >> A >> B >> C >> K;
  long long ans;
  if(K < A) {
    ans = K;
  } else if(K < A + B) {
    ans = A;
  } else if(K < A + B + C) {
    ans = 2 * A - K + B;
  } else {
    ans = A - C;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define I 900000
int x[99],z[99],y[99][20],h[99],a,b,c,d,e,f,i,j,k;string S;
main(){
while(true){
for(i=0;i<99;i++){x[i]=I;h[i]=0;}
memset(y,0,sizeof(y));
cin>>a>>b>>c;
if(!a){break;}
for(i=0;i<c;i++){
cin>>d>>e>>f>>S;
if(S[0]=='W'){
y[d][e]++;
}
else{
x[d]+=I;
x[d]-=f+1200*y[d][e];
}
}
for(i=1;i<=a;i++){z[i]=x[i];}
sort(x+1,x+a+1);
for(i=a;i>0;i--){
for(j=1;j<=a;j++){
if(z[j]==x[i]&&!h[j]){
printf("%d %d %d\n",j,(x[i]+I-1)/I-1,(99*I-x[i])%I);
h[j]=1;
}
}
}
}
}

Measured memory_bytes: 1224
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = (int)s.size();

    int ans = 110;
    for (int i = 0; i < 26; ++i) {
        int cnt = 0, tmp = 0;
        char c = (char)('a' + i);
        for (int j = 0; j < n; ++j) {
            if (s[j] == c){
                cnt = max(cnt, tmp);
                tmp = 0;
            }else{
                ++tmp;
            }
        }
        cnt = max(cnt, tmp);
        ans = min(ans, cnt);
    }

    cout << ans << endl;
}

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

/* 値を入れ替える関数 */
void swap(int *x, int *y) {
	int temp;    // 値を一時保存する変数

	temp = *x;
	*x = *y;
	*y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition(int array[], int left, int right) {
	int i, j, pivot;
	i = left;
	j = right + 1;
	pivot = left;   // 先頭要素をpivotとする

	do {
		do { i++; } while (array[i] < array[pivot]);
		do { j--; } while (array[pivot] < array[j]);
		// pivotより小さいものを左へ、大きいものを右へ
		if (i < j) { swap(&array[i], &array[j]); }
	} while (i < j);

	swap(&array[pivot], &array[j]);   //pivotを更新

	return j;
}

/* クイックソート */
void quick_sort(int array[], int left, int right) {
	int pivot;

	if (left < right) {
		pivot = partition(array, left, right);
		quick_sort(array, left, pivot - 1);   // pivotを境に再帰的にクイックソート
		quick_sort(array, pivot + 1, right);
	}
}

int main()
{
	int n;
	int d[100000] = {1000000};
	int i, j;

	cin >> n;

	for (i = 0; i < n; i++){
		cin >> d[i];
	}

	quick_sort(d, 0, n - 1);

	int a, b;
	a = (n - 1) / 2;
	b = a + 1;

	cout << d[b] - d[a] << endl;

	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

long long fibodp(int n) {
  long long fibodp[200] = {0};
  fibodp[1] = 1;
  fibodp[2] = 2;
  for(int i = 3; i <= n; i++) {
    fibodp[i] = fibodp[i-1] + fibodp[i-2];
  }
   return fibodp[n];
}
int a;
int main(void){
  scanf("%d", &a);
  printf("%lld\n", fibodp(a));
  return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int N, K, h;
  cin >> N >> K;
  int cnt = 0;
  rep(i, N) {
    cin >> h;
    if(h >= K) ++cnt;
  }
  
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

class Edge{
public:
	ll from,to,cost;
};
	
int main(){
	init();
	ll N,M;
	cin>>N>>M;
	vector<Edge>v;
	for(int i=0;i<M;i++){
		ll a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		Edge e;
		e.from=a;
		e.to=b;
		c=c*-1;
		e.cost=c;
		v.push_back(e);
	}
	
	vector<ll>d(N,INF);
	d[0]=0;
	for(int i=0;i<2*N;i++){
		for(int j=0;j<M;j++){
			Edge e=v[j];
			if(d[e.from]+e.cost<d[e.to]){
				d[e.to]=d[e.from]+e.cost;
				if (i >= N-1 && e.to==N-1) {
					cout<<"inf"<<endl;
					return 0;
                } 
			}
		}
	}
	cout<<-1*d[N-1]<<endl;
}


Measured memory_bytes: 384
n, m = map(int, input().split())
l = set()
r = set()
for _ in range(m):
    a, b = map(int, input().split())
    if a == 1:
        l.add(b)
    if b == n:
        r.add(a)
if len(l & r) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE ")

Measured memory_bytes: 18892
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int left = A + B;
  int right = C + D;
  if (left > right){
    cout << "Left" << endl;
  }else if (left < right){
    cout << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 3604
#include <iostream>

int main() {
    unsigned long long h, w;
    std::cin >> h >> w;
    unsigned long long d = h * w / 2;
    if (h == 1 || w == 1) {
        std::cout << 1 << std::endl;
        return 0;
    }
    if ((h % 2 == 1) && (w % 2 == 1) && ((h+w) %2 == 0)) {
        d++;
    }
    std::cout << d << std::endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    let stdin = std::io::stdin();
    stdin.lock().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut claims: Vec<Vec<(usize, usize)>> = vec![vec![]; n];
    for i in 0..n {
        let a_i: usize = iter.next().unwrap().parse().unwrap();
        for _ in 0..a_i {
            let xj = iter.next().unwrap().parse::<usize>().unwrap() - 1;
            let yj = iter.next().unwrap().parse::<usize>().unwrap();
            claims[i].push((xj, yj));
        }
    }

    let mut result = 0;
    let mut pattern = vec![0; n];
    let m = 2usize.pow(n as u32);
    'outer: for x in 0..m {
        let mut x = x;
        let mut count = 0;
        for i in 0..n {
            pattern[i] = x % 2;
            if pattern[i] == 1 {
                count += 1;
            }
            x /= 2;
        }
        if count < result {
            continue;
        }
        // println!("{:?}", pattern);
        for i in 0..n {
            if pattern[i] == 1 {
                for &(a, b) in &claims[i] {
                    if pattern[a] != b {
                        continue 'outer;
                    }
                }
            }
        }
        result = count;
    }
    println!("{}", result);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
ll INF = 6001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
   ll N,K;
   cin >> N >> K;
   vector<pair<ll,ll>> P(N);
   rep(i,N) cin >> P[i].first >> P[i].second;
   sort(ALL(P));
   ll ans = INF;
   rep(i,N) FOR(j,i,N) FOR(k,j,N) FOR(l,k,N){
      ll x1 = min({P[i].first,P[j].first,P[k].first,P[l].first});
      ll x2 = max({P[i].first,P[j].first,P[k].first,P[l].first});
      ll y1 = min({P[i].second,P[j].second,P[k].second,P[l].second});
      ll y2 = max({P[i].second,P[j].second,P[k].second,P[l].second});
      ll cnt = 0;
      rep(j,N){
         if(x1 <= P[j].first && P[j].first <= x2 && y1 <= P[j].second && P[j].second <= y2) cnt++;
      }
      if(cnt >= K){
         if(x1 == x1 && y1 == y2) ans = min(ans,(ll)1);
         else if(x1 == x2) ans = min(ans,abs(y2-y1));
         else if(y1 == y2) ans = min(ans,abs(x2-x1));
         else ans = min(ans,abs((x2-x1)*(y2-y1)));
      }
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

int main() {
    ll x;
    cin >> x;
    ll ans = 0;
    ans += x / 11 * 2;
    int n = x % 11;
    if(n > 6) ans += 2;
    else if(n > 0) ans++;

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

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll x,y;
  cin>>x>>y;

  bool flag=false;
  for(ll a=0; a<=x; a++){
    ll b=x-a;
    if(a*2+b*4==y)
      flag=true;
  }
  if(flag)
    yes;
  else
    no;
}




Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

// int f(int n) {
//   int a = 0;
//   while(n) {
//     a = n;
//     n /= 10;
//   }
//   return a;
// }

int f(int x) {
  while(x >= 10) x /= 10;
  return x;
}

int main()
{
  int n;
  cin >> n;
  vector<vector<int>> vec(10, vector<int>(10, 0));

  for (int i = 1; i <= n; i++) {
    int a = i % 10;
    int b = f(i);
    vec.at(a).at(b)++;
  }
  ll ans = 0;
  reps(i, 1, 10) {
    reps(j, 1, 10) {
      ans += vec.at(i).at(j) * vec.at(j).at(i);
    }
  }
  cout << ans << endl;
  return 0;
}

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

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

	ll n;
	string s;
	cin >> n >> s;
	ll white_num=0, black_num=0;
	for (ll i = 0; i < n; i++) {
		if (s[i] == '.')
			white_num++;
	}

	ll ret = white_num;
	for (ll i = 0; i < n; i++) {
		if (s[i] == '.') {
			white_num--;
		}
		if (s[i] == '#') {
			black_num++;
		}
		ret = min(ret, white_num + black_num);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 720
#include<iostream>

using namespace std;

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

int h,m,s;
h = S / 3600;
m = (S - h * 3600) / 60;
s = S - h * 3600 - m * 60;

cout << h << ':' << m << ':' << s << '\n';
 
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    int ans = 6 - a - b;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define BLACK '.'
#define RED '#'
#define PEOPLE '@'
#define N 25

char room[N][N];
int h,w;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int count(int x, int y){
  if( x<1 || x>w || y<1 || y>h )
    return 0;

  if( room[y][x] == RED )
    return 0;
  room[y][x] = RED;

  int r=1;
  for( int i=0;i<4;i++ )
    r += count(x+dx[i], y+dy[i]);
  return r;
}


int main(){
  int st_x, st_y;
  while( cin >> w >> h,(w|h) ){
    for( int i=1;i<=h;i++ ){
      for( int j=1;j<=w;j++ ){
	cin >> room[i][j];
	if( room[i][j] == PEOPLE ){
	  st_x=j;st_y=i;
	  room[i][j] = BLACK;
	}
      }
    }
    cout << count(st_x, st_y) << endl;
  }
}

Measured memory_bytes: 1176
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const int INF=1e6;
const ll int MOD=998244353;

main(){
    int a=in(),b=in(),c=in();
    cout<<(b-a == c-b ? "YES" : "NO");
}

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

#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

const int MAX_A = 1000005;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> C(MAX_A);
    rep(i, N) {
        cin >> A[i];
        C[A[i]]++;  // A[i]の個数
    }

    bool pairwise = true;
    for (int i = 2; i < MAX_A; i++) {  // 素因数(以外も含むが)に対して
        int cnt = 0;
        for (int j = i; j < MAX_A; j += i) {  // その素因数の倍数に対して
            cnt += C[j];                      // その素因数の倍数がA[i]に何個含まれているか数える
        }
        // 1個ならその素因数で割る事が出来るペアはない
        // 2個以上ならその素因数で割る事が出来るペアがある GCD(i,j) > 1となるi,jがある
        if (cnt > 1) {
            pairwise = false;
        }
    }
    if (pairwise) {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    int g = 0;  // GCD(0,i) == iになるので、初期値は0にしておくと良い
    rep(i, N) {
        g = gcd(g, A[i]);
    }
    if (g == 1) {
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;
    return 0;
}


Measured memory_bytes: 11180
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int aa = a * a;
		int b = sc.nextInt();
		int ans = aa - b;
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const ll mod=1000000007;
int n,m,q;
int a[100],b[100],c[100],d[100],A[100],ans=0;
void dfs(int x,int y){
    if(x==n){
        int now=0;
        for(int i=0;i<q;i++){
            if(A[b[i]]-A[a[i]]==c[i]) now+=d[i];
        }
        ans=max(ans,now);
    }
    else{
        for(int i=y;i<=m;i++){
        A[x]=i;
        dfs(x+1,i);
        }
    }
}
int main(void){
    cin>>n>>m>>q;
    for(int i=0;i<q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--,b[i]--;
    }
    dfs(0,1);
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x;cin>>x;
	int cc=0,a[20],s=0;
	long long t=x;
	while(t)
	{
		a[cc]=t%10;
		s+=a[cc++];
		t/=10;
	}
	bool f=0;
	for(int i=0;i<cc-1;i++)if(a[i]!=9)f=1;
	if(f)printf("%d\n",a[cc-1]+(cc-1)*9-1);else printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
#include <set>

using namespace std;
using ll = long long;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
void printVec(std::vector<char> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
 
int main() {
    int x;
    cin >> x;
    int ma =0;
    if (x == 1) {
        ma = max(ma, 1);
    }
    for(int i =2; i *i < x;i++) {
        int a =i;
        while(1) {
            if (a > x) break;
            ma = max(ma, a);
            a *= i;
        }
    }
    cout << ma << endl;
}

Measured memory_bytes: 3120
import java.util.Scanner;
public class  Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		
		if(a - b < c) {
			System.out.println(c-(a-b));
		}else {
			System.out.println(0);
		}
		
		
		
		
	}

}


Measured memory_bytes: 23892
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
#include <numeric>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int gcd(int a,int b){
    int r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    LL int n,x;
    LL int a,ans;

    cin >> n >> x;
    FOR(i,0,n){
        cin >> a;
        a = abs(a-x);
        if(i == 0)ans = a;
        else ans = gcd(ans,a);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

X,N = map(int,input().split())
p = [str(i) for i in input().split()]
ans = 0
flag = 1


for i in range(100):
  if(str(X-i) in p):
    pass
  else:
    ans = X-i
    break
  if(str(X+i) in p):
    pass
  else:
    ans = X+i
    break

print(ans)



Measured memory_bytes: 68676
#include<bits/stdc++.h>
int n,k,a,b,c,ds,fa[200010],L[200010],R[200010],d;
int ask(int x){return x==fa[x]?x:fa[x]=ask(fa[x]);}
long long m;
int main(){
    scanf("%d%lld%d",&n,&m,&k);ds=n;
    for(int i=0;i<n;i++)fa[i]=i;
    while(k--){
        scanf("%d%d%d",&a,&b,&c);
        int p=ask(a),q=ask(b);
        if(c==0&&p!=q)ds--,fa[q]=p;
        if(c==1)L[++d]=a,R[d]=b;
    }
    for(int i=1;i<=d;i++)if(ask(L[i])==ask(R[i]))return puts("No"),0;
    puts((m+ds-n>1ll*ds*(ds-1)/2)||(d&&(ds==2||m<n))?"No":"Yes");
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

ll suu(int n)
{
	if (n < 2) {
		return 101LL;
	} else {
		return (ll)floor(suu(n - 1) * 1.01);
	}
}

int main()
{
	int n, m, q;
	ll x;
	cin >> x;
	int left, right;
	left = 1;
	right = 3800;



	while (left + 1 != right) {
		int bet = (right + left) / 2;
		//printf("%lld [(%d)%d:%d]", suu(bet), bet, left, right);
		if (x - suu(bet) > 0) {
			//printf("case:1\n");
			left = bet;
		} else {
			//printf("case:2\n");
			right = bet;
		}
	}

	printf("%d", right);

	return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <string>

using std::string;

int main() {
    int x, a, b, n;
    std::cin >> x >> a >> b >> n;

    for (int i = 0; i < n; ++i) {
        string s;
        std::cin >> s;
        if (s.front() == 'n') {
            x = std::max(0, x + a);
        } else if (s.front() == 't') {
            x = std::max(0, x + b);
        } else {
            x = 0;
        }
    }

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



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

int main() {
  int n = 0 ;
  cin >> n ;
  
  std::unordered_map< string, int > count_map ;
  rep( i, n ) {
    std::string str ;
    cin >> str ;
    sort( str.begin(), str.end() ) ;
    count_map[str]++ ;
  }
  
  ll ans = 0 ;
  for ( auto& pair : count_map ) {
    int count = pair.second ;
    ans += (ll)count*(count-1)/2 ;
  }
  
  cout << ans << endl ;
  return 0 ;
}



Measured memory_bytes: 10660
#include <stdio.h>
#define N 100000

typedef struct{
  char name[10];
  int time;
}process;

int head = 0, tail = 0, MAX;
process a[N];

void enqueue(process);
process dequeue(void);

int main(){
  int i, n, q, sum = 0; 
  process p;

  scanf("%d%d", &n, &q);
 
  for(i = 0;i < n;i++){
    scanf("%s%d", p.name, &p.time);
    enqueue(p);
  }
  while(1){
    if(head == tail) break;
    if(a[head].time > q){
      p = dequeue();
      p.time -= q;
      enqueue(p);
      sum += q;
    }
    else{
      p = dequeue();
      printf("%s %d\n", p.name, p.time + sum);
      sum += p.time;
    }
  }
  return 0;
}

void enqueue(process x){
  a[tail] = x;
  if(tail + 1 == N){
    tail = 0;
  }
  else tail++;
}

process dequeue(){
  process x;

  x = a[head];
  if(head + 1 == N){
    head = 0;
  }
  else head++;
  return x;
} 

Measured memory_bytes: 2160
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

typedef enum { top, south, east, west, north, bottom, NUM_SIDES } sides;

sides getOperator()
{
    return rand() % north + 1;
}

void roll(int *dice, const sides operator)
{
    int anti_op;
    switch( operator ){
    case south: anti_op = north; break;
    case east: anti_op = west; break;
    case west: anti_op = east; break;
    case north: anti_op = south; break;
    default: break;
    }

    int tmp = dice[operator];
    dice[operator] = dice[top];
    dice[top] = dice[anti_op];
    dice[anti_op] = dice[bottom];
    dice[bottom] = tmp;
}

int main()
{
    int i;

    srand(time(0));

    int q, dice[NUM_SIDES];
    for( i = 0; i < NUM_SIDES; ++i )
        scanf("%d", &dice[i]);
    scanf("%d", &q);

    for( i = 0; i < q; ++i ){
        int up, front;
        scanf("%d%d", &up, &front);
        sides operator = getOperator();
        while( dice[top] != up || dice[south] != front ){
            roll(dice, operator);
            operator = getOperator();
        }
        printf("%d\n", dice[east]);
    }

    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

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

signed main()
{
   int n; cin >> n;
   V<int> p(n);
   for (int i = 0; i < n; i++) {
      cin >> p[i]; p[i]--;
   }

   V<int> s(n);
   for (int i = 0; i < n; i++) {
      s[p[i]] = i;
   }
   V<int> d(n-1);
   for (int i = 0; i < n-1; i++) {
      d[i] = s[i+1] - s[i];
   }

   V<int> a(n), b(n);
   a[0] = b[0] = 1;
   for (int i = 0; i < n-1; i++) {
      if (d[i] > 0) {
         a[i+1] = a[i] + d[i] + 1;
         b[i+1] = b[i] - 1;
      } else {
         a[i+1] = a[i] + 1;
         b[i+1] = b[i] + d[i] - 1;
      }
   }
   int minb = *min_element(b.begin(), b.end());
   for (int i = 0; i < n; i++) {
      b[i] -= (minb - 1);
   }
   for (int i = 0; i < n; i++) {
      cout << a[i] << " ";
   }
   cout << endl;
   for (int i = 0; i < n; i++) {
      cout << b[i] << " ";
   }
   cout << endl;

   return 0;
}


Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(10 ** 6)


def dfs(v, step):
    global node0, node1
    if step & 1:
        color[v] = 1
        node1 += 1
    else:
        color[v] = 0
        node0 += 1
    for nv in edge[v]:
        if color[nv] is None:
            dfs(nv, step + 1)


N = int(input())
edge = [[] for _ in range(N)]
for s in sys.stdin.readlines():
    a, b = map(int, s.split())
    a -= 1; b -= 1
    edge[a].append(b)
    edge[b].append(a)
color = [None] * N
node0 = node1 = 0
dfs(0, 0)

ans = [None] * N
num0 = N // 3
num1 = N // 3 + (N % 3 >= 1)
num2 = N // 3 + (N % 3 == 2)
if node0 > num0 and node1 > num0:
    cur = 0
    while num1 > 0:
        if color[cur] == 1:
            ans[cur] = 3 * num1 - 2
            num1 -= 1
        cur += 1
    cur = 0
    while num2 > 0:
        if color[cur] == 0:
            ans[cur] = 3 * num2 - 1
            num2 -= 1
        cur += 1
elif node0 <= num0:
    cur = 0
    while node0 > 0:
        if color[cur] == 0:
            ans[cur] = 3 * num0
            num0 -= 1
            node0 -= 1
        cur += 1
else:
    cur = 0
    while node1 > 0:
        if color[cur] == 1:
            ans[cur] = 3 * num0
            num0 -= 1
            node1 -= 1
        cur += 1

cur = 0
while num0 > 0:
    if ans[cur] is None:
        ans[cur] = 3 * num0
        num0 -= 1
    cur += 1
while num1 > 0:
    if ans[cur] is None:
        ans[cur] = 3 * num1 - 2
        num1 -= 1
    cur += 1
while num2 > 0:
    if ans[cur] is None:
        ans[cur] = 3 * num2 - 1
        num2 -= 1
    cur += 1


print(*ans)


Measured memory_bytes: 171896
N, K = map(int, input().split())
A = list(map(int, input().split()))
d = {}
for i in range(N):
    if A[i] not in d:
        d[A[i]] = 1
    else:
        d[A[i]] += 1
if len(d) <= K:
    print(0)
else:
    d=sorted(d.items(), key=lambda x:x[1])
    print(sum([d[i][1] for i in range(len(d)-K)]))



Measured memory_bytes: 124780
#include <stdio.h>

int main(void){
  int n,a,i,sum;
  scanf("%d",&n);
  while(n){
    sum=0;
    n/=4;
    for(i=0;i<n;i++){
      scanf("%d",&a);
      sum += a;
    }
    printf("%d\n",sum);
    scanf("%d",&n);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int x; cin >> x;
    ll ans = 0;
    ans += (x/500)*1000;
    x %= 500;
    ans += (x/5)*5;
    cout << ans;
}


Measured memory_bytes: 256
N,M = map(int,input().split())

s1 = set()
s2 = set()
for i in range(M):
    a,b = tuple(map(int,input().split()))
    if 1 in (a,b):
        if a != 1: s1.add(a)
        if b != 1: s1.add(b)
    if N in (a,b):
        if a != N: s2.add(a)
        if b != N: s2.add(b)

print('POSSIBLE' if len(s1&s2) else 'IMPOSSIBLE')


Measured memory_bytes: 19124
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

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

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

func main() {
	sc.Split(bufio.ScanWords)
	a := make([][]int, 3)
	for i := 0; i < 3; i++ {
		a[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			a[i][j] = readInt()
		}
	}
	n := readInt()
	for i := 0; i < n; i++ {
		b := readInt()
		for i := 0; i < 3; i++ {
			for j := 0; j < 3; j++ {
				if a[i][j] == b {
					a[i][j] = -1
				}
			}
		}
	}
	if bingoRow(a) || bingoColumn(a) || bingoCross(a) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func bingoRow(a [][]int) bool {
	for i := 0; i < 3; i++ {
		if a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1 {
			return true
		}
	}
	return false
}

func bingoColumn(a [][]int) bool {
	for i := 0; i < 3; i++ {
		if a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1 {
			return true
		}
	}
	return false
}

func bingoCross(a [][]int) bool {
	if a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1 {
		return true
	}
	if a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1 {
		return true
	}
	return false
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c||a+c==b||b+c==a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
//void solution(){}
int main(){
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cerr.tie(0);
        ll t;
        cin>>t;
        if(t>= 30)
            cout<<"Yes"<<'\n';
        else
            cout<<"No"<<'\n';
        return 0;
}

Measured memory_bytes: 3648
#include <iostream>                                           
#include <vector>                                             
using namespace std;                                          
                                                              
int main() {                                                  
  int w, n;                                                   
  cin >> w >> n;                                              
  int a, b;                                                   
  char com;                                                   
  vector<int> r;                                              
  for (int i=0; i<=w; i++) {                                  
    r.push_back(i);                                           
  }                                                           
  for (int i=0; i<n; i++) {                                   
    cin >> a >> com >> b;                                     
    swap(r[a],r[b]);                                          
  }                                                           
  for (int i=1; i<=w; i++) {                                  
    cout << r[i] << endl;                                     
  }                                                           
  return 0;                                                   
}                                                             
                           

Measured memory_bytes: 3080
def main():
    n = int(input())
    a = [int(x) for x in input().split(' ')]

    ans = 0
    i = 0
    while i < n:
        j = i
        while j < n and a[i] == a[j]: j += 1
        ans += (j - i) // 2
        i = j
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
import sys
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N, K = map(int, input().split())
P = [[] for i in range(N)]

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


dic = {}


def Perm(n, k):
    if (n, k) in dic:
        return dic[(n, k)]
    ans = 1
    for i in range(n - k + 1, n + 1):
        ans *= i
        ans %= MOD
    dic[(n, k)] = ans
    return ans


def dfs(g, p):
    ans = Perm(K - 2, len(P[p]) - 1)
    for c in P[p]:
        if not c == g:
            ans *= dfs(p, c)
            ans %= MOD
    return ans


ans = Perm(K, len(P[0]) + 1)
for c in P[0]:
    ans *= dfs(0, c)
    ans %= MOD

print(ans)


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

int main()
{
  int N;
  string str;
  string ans = "";
  
  cin >> N >> str;
  if ((N % 2) != 0) {
    ans = "No";
  }
  else {
    string str_begin = str.substr(0, N / 2);
    string str_end   = str.substr(N / 2);
    if (str_begin == str_end) {
      ans = "Yes";
    }
    else {
      ans = "No";
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
L = [[0, 0, 0] for _ in range(n)]
for i in range(n):
    x, y, z = map(int, input().split())
    L[i][0], L[i][1], L[i][2] = x, y, z

ans = 0
for i in range(2**3):
    temp = [0]*n
    for k in range(n):
        for j in range(3):
            if (i >> j) & 1:
                temp[k] += L[k][j]
            else:
                temp[k] += L[k][j]*(-1)
    temp.sort(reverse=True)
    ans = max(ans, sum(temp[0:m]))
print(ans) 

Measured memory_bytes: 42352
#include <iostream>

using namespace std;

int main()
{
	int n1, n2;

	while (1)
	{
		cin >> n1 >> n2;

		if (n1 == 0 && n2 == 0)	break;

		if (n1 > n2)
		{
			cout << n2 << " " << n1 << endl;
		}
		else
		{
			cout << n1 << " " << n2 << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main(){
	int a;
	cin >> a;
	cout << a * 800 - a / 15 * 200 << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
p = []
for i in range(n):
    p.append(input())
    
for i in range(n):
    if p.count(p[i]) != 1:
        print("No")
        exit()
for i in range(1,n):
    mae = p[i-1]
    ato = p[i]
    if mae[-1] != ato[0]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#include <string.h>
#define ll long long
using namespace std;


void printA(int *A,int size)
{
    for(int i=0;i<size;i++)
        cout<<A[i]<<" ";
}
void scanA(int *A,int size)
{
    for(int i=0;i<size;i++)
        cin>>A[i];
}



int sum(int n);
int main()
{
    int n,k;
    cin>>n>>k;
    int b[n],sum=0;
    for(int i=0;i<n;i++)
        b[i]=0;
    
    for(int d=0;d<k;d++)
    {
        int snake;
        cin>>snake;
        int a[snake];
        for(int i=0;i<snake;i++)
        {
            cin>>a[i];
            b[a[i]-1]++;
        }  
                 
    }
    for(int i=0;i<n;i++)
        {
            if(!b[i])
                sum++;
        } 
    cout<<sum<<endl;      


}






Measured memory_bytes: 3432
#include<stdio.h>
#include<iostream>
#include<string.h>
 int main()
 { 
   std::string x;
   std::cin>>x;
   if(x[x.size()-1] == 's'){
   std::cout<<x<<"es";
   }else{
     std::cout<<x<<"s";
   }
   return 0;
 }

Measured memory_bytes: 3624
#include<stdio.h>

int evaluate(int a,int b,int c)
{
	int temp;
	
	if(a<b)
	{
		temp=a;
		a=b;
		b=temp;
	}
	if(a<c)
	{
		temp=a;
		a=c;
		c=temp;
	}
	a*=a;
	b*=b;
	c*=c;
	
	if(a==b+c){return 1;}
	else return 0;
}

int main()
{
	int i,n;
	
	scanf("%d",&n);
	
	int num[n][3];
	
	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&num[i][0],&num[i][1],&num[i][2]);
	}
	
	for(i=0;i<n;i++)
	{
		if(evaluate(num[i][0],num[i][1],num[i][2])==1){printf("YES\n");}else{printf("NO\n");}
	}
	
	return 0;
}

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

int main(){
    int n;

    while(cin >> n, n){
        map<char, char> mp;
        for(int i = 0 ; i < n ; ++i){
            char a, b;
            cin >> a >> b;
            mp[a] = b;
        }

        int m;
        cin >> m;

        for(int i = 0 ; i < m ; ++i){
            char c;
            cin >> c;
            if(mp.count(c)){
                cout << mp[c];
            }else{
                cout << c;
            }
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long ll;

using namespace std;


long inputValue(){
  long a;
  cin >> a;
  return a;
};

void inputArray(long * p, long a){
  rep(i, a){
    cin >> p[i];
  }
};

void inputVector(vector<long> * p, long a){
  rep(i, a){
    long input;
    cin >> input;
    p -> push_back(input);
  }
}

template <typename T>
void output(T a, long precision) {
  if(precision > 0){
    cout << setprecision(precision)  << a << "\n";
  }
  else{
    cout << a << "\n";
  }
}

#if 0
#define debug(d) debug1(__LINE__,#d, d)
void debug1(long line, const char* name, vector<long>& v) {
  cout << line << ":" << name << ":vector<long>(" << v.size() << ") ";
  rep(i, (long)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(long line, const char* name, long& i) {
  cout << line << ":" << name << ":long " << i << endl;;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
  long n = inputValue();
  vector<long> a;
  inputVector(&a, n+1);
  debug(a);
  vector<long> b;
  inputVector(&b, n);
  debug(b);
  long d = 0;
  rep(i, n) {
    debug(i);
    debug(a);
    debug(b);
    debug(d);
    if (b[i] < a[i]) {
      debug(b[i]);
      d += b[i];
    } else {
      long t = b[i] - a[i];
      debug(a[i]);
      debug(t);
      d += a[i];
      d += min(a[i+1], t);
      a[i+1] = max(0L, a[i+1] - t);
    }
    debug(d);
  }
  cout << d << endl;


  return 0;
}


Measured memory_bytes: 2548
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

struct city {
  int pre;
  int year;
  int index;
  string id;
};

bool compYear(city cityA, city cityB) { return cityA.year < cityB.year; }
bool compIndex(city cityA, city cityB) { return cityA.index < cityB.index; }

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

  vector<city> PY;
  for (int i = 0; i < M; i++) {
    int P, Y;
    cin >> P >> Y;
    PY.push_back({P, Y, i, ""});
  }

  sort(PY.begin(), PY.end(), compYear);

  map<int, int> cityCount;
  for (int i = 1; i <= N; i++) {
    cityCount[i] = 1;
  }

  for (auto a = PY.begin(); a != PY.end(); a++) {
    string preStr = to_string(a->pre);
    while (preStr.length() < 6) preStr = "0" + preStr;
    string idStr = to_string(cityCount[a->pre]);
    while (idStr.length() < 6) idStr = "0" + idStr;
    cityCount[a->pre] += 1;

    a->id = preStr + idStr;
  }

  sort(PY.begin(), PY.end(), compIndex);

  for (auto a = PY.begin(); a != PY.end(); a++) {
    cout << a->id << endl;
  }
  return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	auto N=in();
	vector<int> C(N-1),S(N-1),F(N-1);
	REP(i,N-1){
		C[i]=in();
		S[i]=in();
		F[i]=in();
	}
	REP(i,N){
		int sum = 0;
		for(int j=i;j<N-1;j++){
			if(sum<S[j]) sum = S[j];
			else{
				if(sum%F[j]){
					sum += F[j]-sum%F[j];
				}
			}
			sum += C[j];
		}
		out(sum);
	}

	return 0;
}


Measured memory_bytes: 892
n,m,q = map(int,input().split())
lis = [[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    l,r = map(int,input().split())
    lis[l][r] += 1
for i in range(1,n+1):
    for j in range(1,n+1):
        lis[i][j] += lis[i-1][j] + lis[i][j-1] - lis[i-1][j-1]
for i in range(q):
    p,q = map(int,input().split())
    print(lis[q][q] - lis[q][p-1] - lis[p-1][q] + lis[p-1][p-1])

Measured memory_bytes: 15212
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const ll mod = 1000000007;
const ll INF = std::numeric_limits<long long>::max();
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define srep(i,s) rep(i,(ll)s.size())
#define vin(n,v) rep(i,n)cin>>v[i]
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define sz size
void YN(bool b) { cout << (b ? "YES" : "NO") << endl; }
void yn(bool b) { cout << (b ? "Yes" : "No") << endl; }
ll a, b, c, e, d, ans = 0, v[N];
string s, ss, sss;
int main(){
	cin >>  a>>b;
	cout<<a*a-b  <<endl;
	return 0;
}

Measured memory_bytes: 256