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

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

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

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

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

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main(){
  int N,M;
  cin >> N >> M;
  UnionFind tree(N);
  vector<int> p(N);
  for(int i=0;i<N;i++)cin >> p[i];
  for(int i=0;i<M;i++){
    int x,y;
    cin >> x >> y;
    tree.unite(x-1,y-1);
  }
  int sum=0;
  for(int i=0;i<N;i++)if(tree.same(i,p[i]-1))sum++;
  cout << sum;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

int main(){
    int N;
    cin >> N;
    int cnt = 0;
    vector<ll> A;
    for(int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        if (a < 0) cnt++;
        A.push_back(abs(a));
    }

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

    ll ans = (cnt%2 == 0) ? A[0] : -A[0];
    for(int i = 1; i < N; i++) {
        ans += A[i];
    }    

    cout << ans << endl;

    return 0;
}

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

int main() {
string s,t;
cin >> s >> t;
sort(s.begin(),s.end());
sort(t.begin(),t.end());
reverse(t.begin(),t.end());
if(s<t)cout << "Yes" <<endl;
else cout << "No" <<endl;


}


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

#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl

using namespace std;
typedef long long ll;

const int maxn = 100005;
const ll inf = 1e10;

ll a[maxn];
ll dp[maxn];

int main(){
	ll n, k;
	scanf ("%lld %lld", &n, &k);
	for (ll i = 1; i <= n; i++)
		scanf ("%lld", &a[i]);
	dp[1] = 0;
	dp[2] = llabs (a[1] - a[2]);
	for (ll i = 3; i <= n; i++){
		dp[i] = inf;
		for (ll j = i; j >= max (1LL, i - k); j--){
			dp[i] = min (dp[i], dp[j] + llabs (a[j] - a[i]));
		}
	}
	cout << dp[n] << '\n';
	return 0;
}

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

int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  double ans=a[0];
  for(int i=1;i<n;i++)
    ans=(ans+a[i])/2.0;
  cout<<fixed<<setprecision(5)<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8



int main() {
    ll N,M;cin >> N >> M;
    char A[57][57],B[57][57];
    rep(i,N){
        cin >> A[i];
    }
    rep(i,M){
        cin >> B[i];
    }
    rep(i,N-M+1){
        rep(j,N-M+1){
            int t=0;
            for(int k=0;k<M;k++){
                for(int l=0;l<M;l++){
                    if(A[i+k][j+l]!=B[k][l]){
                        t++;
                    }
                }
            }
            if(t==0){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

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

int main(){
  int n, l;
  char s[101][101];
  char t[101];
  scanf("%d %d", &n, &l);
  for(int i=0; i<n; i++)
    scanf("%s", s[i]);
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      strcpy(t, s[i]);
      if(strcmp(s[i], s[j]) < 0){
        strcpy(s[i], s[j]);
        strcpy(s[j], t);
      }
    }
  }
  for(int i=0; i<n; i++)
    printf("%s", s[i]);
  return 0;
}


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

using namespace std;

typedef long long ll;

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define N 100005
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795


ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}
vector<ll>v[10001];

void dfs(ll x,vector<bool>& vis)
{
vis[x]=true;
for(int j=0;j<v[x].size();j++)
  {
    ll t=v[x][j];
    dfs(t,vis);
  }

}

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

ll n,m;cin>>n>>m;
vector<bool>vis(n+1,false);
//vector<ll>v[n+1];
ll a,b;
set<ll>s1,s2;

for(int i=1;i<=m;i++)
{
  cin>>a>>b;
  if(a==1)s1.insert(b);
  else if(b==n)s2.insert(a);
}
for(auto x:s1)
{
  if(s2.find(x)!=s2.end())
  {
    cout<<"POSSIBLE"<<"\n";
    return 0;
  }
}

cout<<"IMPOSSIBLE"<<"\n";

}

Measured memory_bytes: 9856
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()
pre = ''
ans = 0
for t in s:
    if(pre != t):
        ans += 1
    pre = t
print(ans)

Measured memory_bytes: 70032
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; ++i)
#define int long long
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
using namespace std;
typedef pair<int, int> P;
struct edge {
  int to, cost;
};
// other libs
int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int lcm(int a, int b) {
  return a * b / gcd(a, b);
}

class dijkstra {
private:
  int V;
  int d[100002];
  priority_queue<P, vector<P>, greater<>> que;

public:
  dijkstra(int v, int s, vector<edge> G[]) {
    V = v;
    update(s, G);
  }

  void update(int s, vector<edge> G[]) {
    fill(d, d + V + 1, 100000000000ll);
    d[s] = 0;
    que.push(make_pair(0, s));
    while (!que.empty()) {
      P p = que.top();
      que.pop();
      int v = p.second;
      if (d[v] < p.first)
        continue;
      rep(i, G[v].size()) {
        edge e = G[v][i];
        if (d[e.to] > d[v] + e.cost) {
          d[e.to] = d[v] + e.cost;
          que.push(make_pair(d[e.to], e.to));
        }
      }
    }
  }

  int find(int e) {
    return d[e];
  }
};
template<typename T>
class Union_Find {
private:
  vector<T> t, s;

public:
  Union_Find(T max_length) {
    rep(i, max_length + 1) {
      t.push_back(i);
      s.push_back(1);
    }
  }

  void Union(T x, T y) {
    if (same(x, y))
      return;
    T tx = Find(x), ty = Find(y);
    if (s[tx] < s[ty]) {
      s[ty] += s[tx];
      t[tx] = ty;
    }
    else if (s[tx] > s[ty]) {
      s[tx] += s[ty];
      t[ty] = tx;
    }
    else if (tx > ty) {
      t[tx] = ty;
      s[ty] += s[tx];
    }
    else {
      t[ty] = tx;
      s[tx] += s[ty];
    }
  }
  T Find(T n) {
    if (t[n] == n)
      return n;
    else
      return t[n] = Find(t[n]);
  }

  bool same(T x, T y) {
    return Find(x) == Find(y);
  }

  T get_Size(size_t a) {
    return s[a];
  }
};
bool ifPrime(int n) {
  if (n == 1)
    return false;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0)
      return false;
  }
  return true;
}

set<int> prime_num_factor(int n){
  if(n<2)return set<int>();
  set<int> prime;
  prime.insert(2);
  for(int i=3;i<=n;i++){
    for(int it:prime){
      if(it*it>i){
        prime.insert(i);
        break;
      }
      if(i%it==0)break;
    }
  }
  return prime;
}
vector<int> makeDivisors(int n){
  vector<int> re;
  REP(i,1,sqrt(n)+1){
    if(n%i==0){
      re.push_back(i);
      if(i!=n/i)re.push_back(n/i);
    }
  }
  return re;
}
int modPow(int a,int n,int mod){
  int ret=1;
  while(n){
    if(n&1)ret=ret*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return ret;
}
signed main(signed argc, char* argv[]) {
  int n;
  cin>>n;
  vector<int> d(n);
  rep(i,n)cin>>d[i];
  int ans=0;
  REP(i,1,n){
    rep(j,i){
      ans+=d[i]*d[j];
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

	int n,m;
	cin >> n >> m;
	vl h(n);
	rep(i,n){
		cin >> h[i];
	}

	vector<vi> able(n);

	rep(i,m){
		int s,g;
		cin >> s >>g;
		able[s-1].pb(g-1);
		able[g-1].pb(s-1);
	}
	int ans = 0;
	/*
	rep(i,n){
	for(auto it : able[i]) cout << it << " ";
		cout << endl; 
	}
	*/
	
	rep(i,n){
		bool ok = true;
		//if(able[i].empty()){ans++;continue;}

		rep(j,able[i].size()){
			if(h[i]<=h[able[i][j]]){ok =false ;break;}
		}
		if(ok) {ans++; }
	}	
	cout << ans << endl;
    return 0;
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


int main() {

   int N, X;
   cin >> N >> X;
   vector<int> L(N);
   REP(i, N)cin >> L[i];
   int d = 0;
   int count = 1;

   REP(i, N){
       d += L[i];
       if(d <= X){
           count++;
       }

   }

    cout << count << endl;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
using namespace std;
int ans,n,a[100005];
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		int t;
		cin>>t;
		a[i]=t;
		if(a[t]==i)
			++ans;
	}
	cout<<ans<<endl;
}

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

int main()
{
    map<string, int> s;
    s["SUN"] = 2;
    s["MON"] = 3;
    s["TUE"] = 4;
    s["WED"] = 5;
    s["THU"] = 6;
    s["FRI"] = 7;
    s["SAT"] = 1;
    string day; cin >> day;
    if(day == "SUN")
    {

        cout << 7;
        return 0;
    }
    int con = 0, c = s[day];
    while(s["SUN"] != c)
    {
        c++;
        con++;
        if(c == 8) c = 1;

    }
    cout << con;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = ["x"]*N
for i in range(M):
  s, c = map(int, input().split())
  if A[s-1] == "x":
    A[s-1] = c
  elif A[s-1] != c:
    print(-1)
    exit()


if A[0]==0 and N>1:
  print(-1)
  exit()
elif N==1 and (A[0]=="x" or A[0] == 0):
  print(0)
  exit()
elif A[0]=="x" or A[0] == 0:
  A[0]=1

for i in range(1,N):
  if A[i]=="x":
    A[i]=0

ans = 0
if A[0]>0:
  for i in range(N):
    ans += A[i]*10**(N-i-1)
else:
  ans = -1
  
print(ans)

Measured memory_bytes: 9124
import collections

N = int(input())
A = list(map(int, input().split()))

l1 = []
l2 = []

for i in range(N):
  l1.append(i+1+A[i])
  l2.append(i+1-A[i])

c1 = collections.Counter(l1)
c2 = collections.Counter(l2)

sum = 0
for i in c1.keys():
  sum += c1[i]*c2[i]
 
print(sum)

Measured memory_bytes: 63336
#include<stdio.h>
#define max(a,b) (a)>(b)?(a):(b)
int main(void)
{
  char s[11];
  int ans[11]={},cnt=0;
  scanf("%s",s);
  for(int i=0;i<11;i++){
    if((s[i]=='A')||(s[i]=='T')||(s[i]=='G')||(s[i]=='C')){
      cnt++;
    }else{
      ans[i]=cnt;
      cnt=0;
    }
  }
  cnt=0;
  for(int i=0;i<11;i++){
    cnt=max(cnt,ans[i]);
  }
  printf("%d",cnt);
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx,avx2,sse4")
char out[1<<20];outsz;
char ffs[]="0101110101011101110111010101110101011101010111011101110101011101110111010101110111011101010111010101110101011101110111010101110101011101010111011101110101011101010111010101110111011101010111011101110101011101110111010101110101011101010111011101110101011101110111010101110111011101010111010101110101011101110111010101110111011101010111011101110101011101010111010101110111011101010111010101110101011101110111010101110101011101010111011101110101011101110111010101110111011101010111010101110101011101110111010101110101011101010111011101110101011101010111010101110111011101010111011101110101011101110111010101110101011101010111011101110101011101010111010101110111011101010111010101110101011101110111010101110111011101010111011101110101011101010111010101110111011101010111011101110101011101110111010101110101011101010111011101110101011101110111010101110111011101010111010101110101011101110111010101110101011101010111011101110101011101010111010101110111011101010111011101110101011101110111010101110101011101010111011101110101011101";
char in[9];
main(){
	read(0,in,5);
	int N,M;
	if(in[1]==' ')
	{
		N=in[0]-'0';
		if(in[3]=='\n')
		{
			M=in[2]-'0';
		}
		else
		{
			M=10;
		}
	}
	else
	{
		N=10;
		if(in[4]=='\n')
		{
			M=in[3]-'0';
		}
		else
		{
			M=10;
		}
	}
	for(int i=1;i<1<<N;i++)
	{
		for(int j=1;j<1<<M;j++)
		{
			out[outsz++]=ffs[i|j];
		}
		out[outsz++]='\n';
	}
	write(1,out,outsz);
}


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



int main() {
	int m, d;
	cin >> m >> d;
	int cnt = 0;
	for (int i = 1;i <= m;i++) {
		for (int j = 1;j <= d;j++) {
			if ((j / 10) >= 2 && (j % 10) >= 2 && i == (j / 10) * (j % 10)) {
				cnt++;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define F first
#define S second
#define MK make_pair
const ll E=1e17+7;



int main(){
    ll a[60][60];
    ll dis[60][60];
    int count=0;
    for(int i=0;i<60;i++){
        for(int t=0;t<60;t++){
            a[i][t]=E;
            dis[i][t]=E;
        }
    }
    dis[0][0]=1;
    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;i++){
        for(int t=0;t<w;t++){
            char c;
            cin>>c;
            if(c=='.'){a[i][t]=1; count++;}
        }
    }
    //cout<<count<<endl;
    queue<pair<int,int>> q;
    q.push({0,0});
    //if(a[0][0]==1 || a[h-1][w-1]==1){cout<<-1<<endl; return 0;}
    while(!q.empty()){
        pair<int,int> W=q.front();
        q.pop();
        if(W.F!=0 && dis[W.F-1][W.S]>dis[W.F][W.S]+a[W.F-1][W.S]){dis[W.F-1][W.S]=dis[W.F][W.S]+a[W.F-1][W.S]; q.push({W.F-1,W.S});}
        if(W.S!=0 && dis[W.F][W.S-1]>dis[W.F][W.S]+a[W.F][W.S-1]){dis[W.F][W.S-1]=dis[W.F][W.S]+a[W.F][W.S-1]; q.push({W.F,W.S-1});}
        if(W.F<55 && dis[W.F+1][W.S]>dis[W.F][W.S]+a[W.F+1][W.S]){dis[W.F+1][W.S]=dis[W.F][W.S]+a[W.F+1][W.S]; q.push({W.F+1,W.S});}
        if(W.S<55 && dis[W.F][W.S+1]>dis[W.F][W.S]+a[W.F][W.S+1]){dis[W.F][W.S+1]=dis[W.F][W.S]+a[W.F][W.S+1]; q.push({W.F,W.S+1});}
    }
    if(dis[h-1][w-1]==E){cout<<-1<<endl;}
    else{cout<<count-dis[h-1][w-1]<<endl;}
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
 
char a[4],b[4],c[4];
 
using namespace std;
 
int main()
{
    cin >> a[0] >> a[1] >> a[2];
    cin >> b[0] >> b[1] >> b[2];
    cin >> c[0] >> c[1] >> c[2];
    cout << a[0] << b[1] << c[2];
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int gcd(int n, int m)
{
  return n ? gcd(m % n, n) : m;
}

int main()
{
  int n, X;
  cin >> n >> X;
  vector<int> x(n);
  REP(i, n)
  {
    cin >> x[i];
    x[i] = abs(X - x[i]);
  }
  int ans = x[0];
  REP(i, n)
  {
    ans = gcd(ans, x[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=998244353;
int main(){
    int64_t n,x,m;
    cin>>n>>x>>m;
    int64_t a=x;
    set<int64_t> s;
    s.insert(a);
    vector<int64_t> ans(100001,0);
    ans[0] = a;
    map<int64_t,int> p;
    p[a] = 0;
    int cycle =-1;
    int64_t cycle_value;
    int k;
    for(int64_t i=1;i<n;i++){
        a = (a*a)%m;
        //cout<<a<<endl;
        ans[i]= ans[i-1] + a;
        if(s.count(a)){
            k = p[a];
            cycle = i - p[a];
            cycle_value = ans[i] - ans[p[a]];
            //cout<<k<<" "<<cycle<<" "<<cycle_value<<endl;
            break;
        }
        s.insert(a);
        p[a]=i;
    }
    if(cycle==-1){
        //cout<<"a"<<endl;
        cout<<ans[n-1]<<endl;
    }
    else{
        int64_t reala=0 ;
        if(k!=0){
            reala = ans[k-1];
        } 
        //cout<<reala<<endl;
        reala += (n-k)/cycle * cycle_value;
        int amari = (n-k)%cycle;
        if(amari!=0){
        reala += a;
        }
        rep(i,amari-1){
            a = (a*a)%m;
            reala += a;
        }
        cout<<reala<<endl;
    }
}

Measured memory_bytes: 9596
MOD = 10 ** 9 + 7
n, a, b = map(int, input().split())

def getInvs(n, MOD):
    invs = [0] * (n+1)
    invs[1] = 1
    for x in range(2, n+1):
        invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
    return invs
invs = getInvs(200000, MOD)

def combi(n, k):
    if k > n-k:
        k = n-k
    ret = 1
    for x in range(n, n-k, -1):
        ret *= x
        ret %= MOD
    for x in range(k, 1, -1):
        ret *= invs[x]
        ret %= MOD
    return ret

print((pow(2, n, MOD) - 1 - combi(n, a) - combi(n, b)) % MOD)

Measured memory_bytes: 10996
n, m = map(int, input().split())
a = set()
for _ in range(m):
  a_ = int(input())
  a.add(a_)

dp = [0] * (n+1)
if 1 not in a:
  dp[1] = 1
if 2 not in a and n != 1:
  dp[2] = dp[1] + 1
for i in range(3, n+1):
  if i not in a:
    dp[i] = dp[i-1] + dp[i-2]

print(dp[n]%(10**9+7))

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

int main() {
    int d = 100000;
    int n;
    cin >> n;
    while(n-- > 0) {
        d *= 1.05;
        if(d % 1000) {
            d = (d / 1000 + 1) * 1000;
        }
    }
        cout << d << endl;
    return 0;
}


Measured memory_bytes: 3080
import fractions

N, M = (int(i) for i in input().split())  
S = input()
T = input()

L = fractions.gcd(N, M)
lcm = (N * M) // fractions.gcd(N, M)

flag = True
for i in range(L):
    if (S[N//L * i] != T[M//L * i]):
        flag = False

if flag:
    print(lcm)
else:
    print("-1")


Measured memory_bytes: 5688
import sys
  
l = map(int, raw_input().split())
N, M, X = l[0], l[1], l[2]
m = map(int, raw_input().split())
cost_N = 0
if m[0] > X or m[-1] < X:
    print(0)
    sys.exit()
for a in m:
    if a > X:
        idx = m.index(a)
        count_N = M - idx
        count_0 = idx
        print(min(count_N, count_0))
        sys.exit()


Measured memory_bytes: 2568
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<time.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
#define INF (1<<30)
#define INFLL (1LL << 60)
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }

class UnionFind
{
	vector<int> par;
public:
	UnionFind(int n) {
		par.resize(n);
		for (int i = 0; i < n; ++i) par[i] = i;	//頂点iの親を格納する
	}
	int root(int x) {
		if (x == par[x]) return x;
		else return par[x] = root(par[x]);	//経路圧縮
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	bool unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		par[x] = y;
		return true;
	}
};


int main()
{
	int N, K, L; cin >> N >> K >> L;
	auto uf1 = UnionFind(N);
	auto uf2 = UnionFind(N);
	rep(i, K) {
		int p, q; cin >> p >> q; --p; --q;
		uf1.unite(p, q);
	}
	rep(i, L) {
		int r, s; cin >> r >> s; --r; --s;
		uf2.unite(r, s);
	}
	vector<pair<int, int>> town(N);
	rep(i, N) {
		town[i].first = uf1.root(i);
		town[i].second = uf2.root(i);
	}
	map<pair<int, int>, int> ans;
	rep(i, N) ++ans[town[i]];
	rep(i, N) cout << ans[town[i]] << ' ';
	cout << endl;
	return 0;
}


Measured memory_bytes: 14368
#include <bits/stdc++.h>
using namespace std;
int i,s,t,n;
bitset <100004> d;
int main()
{
    d[0]=1;
    for(int s=100;s<=105;s++){
    for(int i=0;i<=100000;i++){
        if(d[i]){
            for(t=i+s;t<=100000;t+=s){
                d[t]=1;
            }
        }
    }
    }
    cin>>n;
    cout<<d[n];
}


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

int main(){
    int A,B;
    cin >> A;
    cin >> B;
    if(A*B==2)cout << 3 <<endl;
    else if(A*B==3)cout << 2 <<endl;
    else cout << 1 <<endl;
    return 0;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
#define N 100010
using namespace std;

ll n, ans, a[N];

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9'){
		if (ch == '-') w *= -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9'){
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}

int main(){
	n = read();
	REP(i, 1, n) a[i] = read();
	REP(i, 1, n)
		if (a[i - 1] < a[i]) ans += a[i] - a[i - 1];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int n,h,b=0,i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> h;
    if(h<b){
      cout << "No" << endl;
      return 0;
    }
    if(h>b) b=h-1;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 384
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n, m, x, y, p = -114514, q = 8101919, tmp;
	scanf("%d%d%d%d", &n, &m, &x, &y);
	rep(i, n) {
		scanf("%d", &tmp);
		p = max(p, tmp);
	}
	rep(i, m) {
		scanf("%d", &tmp);
		q = min(q, tmp);
	}
	bool f = false;
	for (int i = -114; i < 514; ++i) {
		if (x < i && i <= y && p < i && i <= q)f = true;
	}
	printf("%s\n", f ? "No War\n" : "War\n");

	Please AC;
}


Measured memory_bytes: 888
def main():
    N, M = map(int, input().split())
    A = [int(a) for a in input().split()]
    BC = []
    for _ in range(M):
        b, c = map(int, input().split())
        BC.append([b, c])
    BC = sorted(BC, key = lambda x: x[1], reverse = True)
    A = sorted(A)
    # print(A)
    # print(BC)
    i = 0
    while i < len(A) and BC:
        b, c = BC.pop(0)
        if c <= A[i]:
            return sum(A)
        while b > 0 and i < len(A) and c > A[i]:
            A[i] = c
            i += 1
            b -= 1
    return sum(A)



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

Measured memory_bytes: 27572
#include <iostream>
#include <string>
#include <vector>


using namespace std;

int main(void) {
  int N;
  vector<int> L;
  int i, j, k, tmp, answer;
  // get input
  cin >> N;
  for(i = 0; i < N; i++) {
    cin >> tmp;
    L.push_back(tmp);
  }
  // count pair
  answer = 0;
  for(i = 0; i < N; i++) {
    for(j = i+1; j < N; j++) {
      for(k = j+1; k < N; k++) {
        if(L[i] != L[j] && L[j] != L[k] && L[k] != L[i] &&
           L[i] + L[j] > L[k] &&
           L[j] + L[k] > L[i] &&
           L[k] + L[i] > L[j])
        {
          answer++;
        }
      }
    }
  }
  // disp answer
  cout << answer << endl;
  return 0;
}

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

typedef long long int in;

int main() 
{
	in n;
	cin>>n;
	
	in a[n],i,dp[n];
	
	for(i=0;i<n;++i)
	cin>>a[i];
	
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	
	for(i=2;i<n;++i)
	dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
	
	cout<<dp[n-1];
	
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))

D.sort();T.sort()
di = 0
ti = 0
while True:
     d = D[di];t=T[ti]
     if d==t:
         di+=1;ti+=1
     elif d>t:
         print("NO")
         exit()
     elif t>d:
         di+=1
     if ti >= len(T):
         print("YES")
         exit()
     if di >= len(D):
         print(di)
         print("NO")
         exit()


Measured memory_bytes: 35420
import collections
n = int(input())
s = input()
l = s.count("W")
r = s.count("E")
ans = 0
keep = r
minn = keep
if s[0] == "E":
    ans = 1
for i in range(1, n):
    if s[i - 1:i + 1] == "WW":
        keep += 1
    elif s[i - 1:i + 1] == "WE":
        keep += 0
    elif s[i - 1:i + 1] == "EW":
        keep += 0
    elif s[i - 1:i + 1] == "EE":
        keep -= 1
    if minn > keep:
        minn = keep
print([minn, minn - 1][ans])


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    int a,b;
    cin >> a >> b;
    if(a+b%2!=0){
        a++;
    }
    cout << (a+b)/2 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int k = sc.nextInt();

        String t = s.substring(k - 1, k);
        String an = "";
        for (int i = 0 ; i < n ; i++) {
            if (!s.substring(i, i + 1).equals(t)) {
                an += "*";
            } else {
                an += t;
            }
        }

        System.out.println(an);
    }

}

Measured memory_bytes: 23252
function main(input){
  var args = input.split(" ").map(x=>parseInt(x));
  var divCount = args[0];
  var index = args[1];
  var answer = Math.pow(100,divCount)*index;
  if(index===100){
  	answer+=Math.pow(100,divCount);
  }
  console.log(answer);
}



main(require("fs").readFileSync("/dev/stdin","utf-8"));

Measured memory_bytes: 7372
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
	set<int> s;
	REP( i, 3 ) { int x; cin >> x; s.insert( x ); }
	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

int main(){
    string s;
    cin >> s;
    int n = (int)(s.length());
    int res = 0;
    for(int i=0;i<n/2;i++){
        if(s[i] != s[n-1-i]) res++;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.ToDoubleFunction;


public class Main {
    private static final String ex = "internationalization";

    public static void main(String[] args) {
        solve(new Scanner(System.in));
//        solve(new Scanner(ex));
    }

    private static void solve(Scanner scanner) {
        String s = scanner.nextLine();

        StringBuilder sb = new StringBuilder();
        sb.append(s.charAt(0));
        sb.append(s.length() - 2);
        sb.append(s.charAt(s.length() - 1));

        System.out.println(new String(sb));
    }
}


Measured memory_bytes: 23764
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long


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

    int l,r; cin >> l >> r;
    if(r - l >= 2019){
        cout << 0 << endl;
        return 0;
    }

    int ans = 10000000000;
    for(int i = l;i < r;i ++){
        for(int j = l+1;j <= r;j ++){
            ans = min(ans,(i*j)%2019);
        }
    }

    cout << ans << endl;
}

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

vector<int> G[100100];

int main()
{
    int x;
    cin >> x;
    int a = 0;
    int b = 0;
    bool finished = false;
    for(int i = -118; i < 120; i++) {
        for(int j = -119; j < 119; j++) {
            if(i*i*i*i*i - j*j*j*j*j == x) {
                cout << i << " " << j << endl;
                finished = true;
                break;
            }
        }
        if(finished) break;
    }
    return 0;
}

Measured memory_bytes: 5944
#include <bits/stdc++.h>
#define ll long long
#define MAX 1000005
using namespace std;
ll n, m, i ,j ,k ,l, ans, tmp, res, tmp2;
ll arr[MAX], brr[MAX];
vector<ll> v;
string s;
map<ll,ll> mp;
int main()
{
	
		cin>>n>>m;
		for(i=0;i<n;i++)
			cin>>arr[i]>>brr[i];
		sort(arr,arr+n);
		sort(brr,brr+n);
		for(i=n-1;i>=0;i--)
		{
			if(brr[i]<=arr[n-1])break;
			ans+=brr[i];
			if(ans>=m)
			{
				cout<<n-i;
				return 0;
			}
		}
		i++;
		cout<<(n-i) + (m-ans+arr[n-1]-1)/arr[n-1];


return 0;
}
 

Measured memory_bytes: 5120
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

bool arr[101];

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }
void printint(uint32_t x){ if(x<0){x=-x; putchar_unlocked('-');}else if(x==0){putchar_unlocked('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar_unlocked(s[i]); putchar_unlocked('\n'); }

uint32_t h[100000];
bool is[100000];

int main(void){
	uint32_t n=nextpint();
	uint32_t m=nextpint();
	for(uint32_t i=0; i<n; i++){
		h[i]=nextpint();
	}
	for(uint32_t i=0; i<m; i++){
		uint32_t a=nextpint()-1;
		uint32_t b=nextpint()-1;
		if(h[a]>h[b]){
			is[b]=true;
		}else if(h[a]<h[b]){
			is[a]=true;
		}else{
			is[a]=true;
			is[b]=true;
		}
	}
	uint32_t ans=0;
	for(uint32_t i=0; i<n; i++){
		if(!is[i]) ans++;
	}
	printint(ans);
}


Measured memory_bytes: 2020
#include <stdio.h>
#include <string.h>

int main(void){
  char s[100] = {};
  char s1[50] = {};
  scanf("%s", s);
  for(int i = 0; i < strlen(s) / 2; i++){
    s1[i] = s[strlen(s) - i - 1];
  }
  int count = 0;
  for(int i = 0; i < strlen(s) / 2; i++){
    if(s[i] != s1[i]) count++;
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.math.*;

public class Main{

	public static BigInteger lcm(BigInteger x,BigInteger y){
		return (x.divide(x.gcd(y))).multiply(y);
	}

	public static BigInteger solve(int a[],int m[]){
		int x[] = {1,1,1};
		int c[] = {0,0,0};

		for(int i=0;i<3;i++){
			do{
				x[i] = (a[i] * x[i]) % m[i];
				c[i]++;
			}while(x[i] != 1);
		}

		return lcm(lcm(new BigInteger(Integer.toString(c[0])),
									 new BigInteger(Integer.toString(c[1]))),
							 new BigInteger(Integer.toString(c[2])));
	}

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a[]=new int[3];
		int m[]=new int[3];
		while(true){
			for(int i=0;i<3;i++){
				a[i] = scan.nextInt();
				m[i] = scan.nextInt();
			}
			if(a[0] == 0) break;

			System.out.println(solve(a,m));
		}
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double r=sc.nextDouble();
		 
		//????????????
		System.out.printf("%.6f %.6f",(r*r*3.141592653589),(r*2*3.141592653589));
	}
}

Measured memory_bytes: 19124
import sys
import collections

sys.setrecursionlimit(100000000)


# p:parent
def bfs(g: {}, parent_g: {}, v: int, p: int, depth: int, dd: {}, dq):
    p_ls = parent_g.setdefault(v, [])
    if len(p_ls) > 1:
        p_ls.remove(p)
        return
    dd[v] = (p, depth)

    ls = g.setdefault(v, [])
    for next_v in ls:
        # next_v が親だったらスルー
        if next_v == p:
            continue
        # 探索キューに追加
        dq.append((next_v, v, depth+1))


def main():
    n, m = map(int, input().split())

    children = set()
    g = {}
    parent_g = {}
    for i in range(n - 1 + m):
        a, b = map(int, input().split())
        dic_a = g.setdefault(a - 1, [])
        dic_a.append(b - 1)
        children.add(b - 1)
        dic_b = parent_g.setdefault(b - 1, [])
        dic_b.append(a - 1)

    root = -1
    for i in range(n):
        if i not in children:
            root = i
            break
    parent = -1
    depth = 0
    dd = {}

    dq = collections.deque()
    dq.append((root, parent, depth))
    while len(dq) > 0:
        t, p, d = dq.popleft()
        bfs(g, parent_g, t, p, d, dd, dq)

    for i in range(n):
        print(dd[i][0] + 1)
        # if len(v) == 1:
        #     print(v[0][0]+1)
        #     continue
        #
        # v.sort(key=lambda x: x[1], reverse=True)
        # print(v[0][0]+1)



main()


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

int main()
{
    string S;
    cin >> S;
    
    if( S[0] == S[1] or S[1] == S[2] or S[2] == S[3]){
        cout << "Bad" << endl;
    }else{
        cout << "Good" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
*A, = map(int, input().split())

n = 0
loc = 1
flag_visit = [-1]*N
flag_when = [-1]*N
flag_visit[0] *= -1
flag_when[0] = 0
move_hist = [1, ]
while 1:
    loc = A[loc-1]
    move_hist.append(loc)
    n += 1
    if flag_visit[loc-1] == -1:
        flag_visit[loc-1] *= -1
        flag_when[loc-1] = n
    else:
        m = flag_when[loc-1]
        break
if K > m:
    print(move_hist[m+(K-m) % (n-m)])
else:
    print(move_hist[K])


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }
  for (int i = 0; i < n; i++) v[i]--;  // 1ずつ引いていく

  // 累積和をとって区間に対応しやすくする
  vector<ll> rui(n + 1);
  for (int i = 0; i < n; i++) rui[i + 1] = (rui[i] + v[i]) % k;

  ll ans = 0;
  map<ll, int> mp;
  for (int i = 0; i <= n; i++) {
    mp[rui[i]]++;  // 右側を追加
    // 確認用
    // for (auto x : mp) cout << x.first << " " << x.second << endl;
    // cout << "+= " << mp[rui[i]] - 1 << endl;
    // cout << "----------" << endl;
    ans += mp[rui[i]] - 1;                 // 引いて0になる→右側と同じ値である
    if (i >= k - 1) mp[rui[i - k + 1]]--;  // 左側を消していく
  }

  cout << ans << endl;
}


Measured memory_bytes: 15872
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    int n,m,cnt = 0;
    cin >> n >> m;
    int target[m],game[m][n],pts[n] = {0};
    
    rep(i,0,m){
        cin >> target[i];
    }
    
    rep(i,0,m){
        rep(j,0,n){
            cin >> game[i][j];
        }
    }
    
    rep(i,0,m){
        cnt = 0;
        rep(j,0,n){
            if(target[i] == game[i][j]){
                pts[j]++;
            }
            else{
                cnt++;   
            }
        }
        
        pts[target[i]-1] += cnt;
    }
    
    
    rep(i,0,n){
        cout << pts[i] << endl;
        
    }
    
    return 0;
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int ans=0;
	int lenth=s.size()-1;
	for(int i=0;i<=lenth;i++)
	{
		if(s[i]!=s[lenth-i]&&i<=lenth-i)
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if((A<C && C<B) || (B<C && C<A)){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
n=int(input())
s=[]
for i in range(n):
  h=int(input())
  s.append(h)
s.sort()
d=sum(s)
ss=d
if d%10!=0:
  print(d)
else:
  while d%10==0 and ss>0:
    if s[0]%10!=0:
      d-=s[0]
    else:
      ss-=s[0]
      s.pop(0)
      
  if ss==0:
    print(0)
  else:
    print(d)


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    int N,M;
    cin >> N >> M;
    vector<vector<bool>> a(N, vector<bool>(N,false));
    vector<vector<bool>> b(M, vector<bool>(M,false));

    char tmp;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            cin >> tmp;
            if(tmp == '#'){
                a.at(i).at(j) = '#';
            }
        }
    }
    for(int i = 0; i < M; i++){
        for(int j = 0; j < M; j++){
            cin >> tmp;
            if(tmp == '#'){
                b.at(i).at(j) = '#';
            }
        }
    }

    for(int i = 0; i <= N - M; i++){
        for(int j = 0; j <= N - M; j++){
            //cout << i << "," << j << endl;
            bool check = true;
            for(int k = 0; k < M; k++){
                for(int l = 0; l < M; l++){
                    check &= (a.at(i+k).at(j+l) == b.at(k).at(l));
                }
            }
            if(check){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
get=->{gets.split.map(&:to_i)}
n,m = get.call

box = Array.new(n){{red:false,num:1}}

box[0][:red] = true

m.times do
  x,y = get.call
  x-=1
  y-=1
  if box[x][:num] > 0
    box[x][:num] -= 1
    box[y][:num] += 1
    if box[x][:red]
      if box[x][:num] == 0
        box[x][:red] = false
      end
      box[y][:red] = true
    end
  end
#  p box
end

puts box.count{|item| item[:red] == true}

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

ll n,w;
ll wt[102],val[102];
ll dp[102][100005];
ll find(int index,int curr_wt)
{
	if(index==n)
	return 0;
	if(dp[index][curr_wt]!=-1)
	   return dp[index][curr_wt];
	if(wt[index]<=curr_wt)
		return dp[index][curr_wt]=max(find(index+1,curr_wt),val[index]+find(index+1,curr_wt-wt[index]));
	else
		return dp[index][curr_wt]=find(index+1,curr_wt);
}
int main()
{
	cin>>n>>w;
	for(int i=0;i<n;i++)
	{
		cin>>wt[i]>>val[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=w;j++)
		dp[i][j]=-1;
	}
	dp[0][0]=0;
	ll ans=find(0,w);
	cout<<ans;
}

Measured memory_bytes: 78336