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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    for(int i=0; i<s.size(); i++) {
        if(s[i] != t[i]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main() {
    int d;
    cin >> d;
    int c[26], s[d][26], last[26], satisfaction = 0;
    for (int i=0; i<26; i++) {
        cin >> c[i];
        last[i] = -1;
    }
    for (int i=0; i<d; i++) {
        for (int j=0; j<26; j++) {
            cin >> s[i][j];
        }
    }
    for (int i=0; i<d; i++) {
        //1日での満足度の減少量の絶対値は最大でも100*365*25=912500
        int bestT, tempS = 0, maxS = -1000000;
        for (int t=0; t<26; t++) {
            tempS = s[i][t] + c[t] * (i-last[t]);
            for (int j=0; j<26; j++) {
                tempS -= c[j] * (i-last[j]);
            }
            if (tempS > maxS) {
                maxS = tempS;
                bestT = t;
            }
        }
        last[bestT] = i;
        cout << bestT+1 << endl;
    }
}

Measured memory_bytes: 3668
import networkx as nx

N = int(input())
UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

pred, dist = nx.dijkstra_predecessor_and_distance(G, 0)

c = [dist[i] for i in range(N)]
ans = [1 if i % 2 == 0 else 0 for i in c]
print(*ans)


Measured memory_bytes: 197352
readline = open(0).readline
from heapq import heappush, heappop
N = int(readline())
que = []
P = [list(map(int, readline().split())) for i in range(N)]
P.sort()
ans = 0
for s, t in P:
    while que and que[0][0] < s:
        ans = max(ans, heappop(que)[1])
    heappush(que, (t, ans+1))
while que:
    ans = max(ans, heappop(que)[1])
open(1, 'w').write("%d\n" % ans)


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

long long c[20],n,po[20];
vector<int> ans;

int main()
{
    cin>>n;
    po[0]=1;
    for(int i=1;i<=17;++i) po[i]=po[i-1]*(long long)26;
    for(int i=1;i<=17;++i) c[i]=c[i-1]+po[i];
    for(int i=1;i<=16;++i) if(c[i]>=n) {
        int now=i;
        while(n>0) {
            int t=n%26;
            if(t==0) t=26;
            ans.push_back(t-1);
            n-=t;
            n/=26;
        }
        for(int i=ans.size()-1;i>-1;--i) putchar('a'+ans[i]);
        return 0;
    }
}

Measured memory_bytes: 3648
N = gets.to_i
F = N.times.map { gets.split.map(&:to_i) }
P = N.times.map { gets.split.map(&:to_i) }

ans = -Float::INFINITY

(1..10).each do |i|
  [*0..9].combination(i).each do |list|
    profit = 0

    N.times do |j|
      cnt = 0

      F[j].each_with_index do |v, i|
        cnt += 1 if v == 1 && list.include?(i)
      end

      profit += P[j][cnt]
    end

    ans = profit if ans < profit
  end
end

puts ans


Measured memory_bytes: 3836
s = int(input())

def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1

a = [s]
ans = 1

while True:
    s = f(s)
    ans += 1
    if s in a:
        print(ans)
        break
    a.append(s)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define li(x) x.size()-1
#define oo 1000000000
#define inf 1000000000000000000
#define M 1000000007
#define M2 1000000009
#define pii pair<ll,ll>
using namespace std;
typedef long long ll;
const int N = 2e5+100;
const int SQRTN = 320;
const int LOGN = 20;
const double PI = acos(-1);

int n,k=3;
int a[N];
int dp[N];
int main() {
	cin >> n;
	//cin >> k;
	for(int i = 0 ; i < n ; i++){
		scanf("%d",a+i);
	}
	dp[0]=0;
	for(int i = 1 ; i < n ; i++){
		dp[i]=oo;
		for(int j = 1 ; j < k ; j++){
			if(i-j<0)break;
			dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
		}
	}
	cout << dp[n-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

bool sx[200001], xe[200001];
int n, m, a, b;


int main() {
	//九日目

	cin >> n >> m;
	rep(i, m) {
		cin >> a >> b;
		if (a == 1) {
			sx[b] = true;
		}
		else if (b == n) {
			xe[a] = true;
		}
	}
	string ans = "IMPOSSIBLE";
	rep(i, n) {
		if (sx[i] && xe[i]) {
			ans = "POSSIBLE";
			break;
		}
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
int compare(const void *a,const void *b){
    if(*(int *)a>*(int *)b)return 1;
    return -1;
}
int main()
{   char s[5];
    scanf("%s",s);
    int a[4];
    a[0]=s[0]-'A';
    a[1]=s[1]-'A';
    a[2]=s[2]-'A';
    a[3]=s[3]-'A';
    qsort(a,4,sizeof(int),compare);
    if(a[0]==a[1]&&a[2]==a[3]&&a[1]!=a[2])
    printf("Yes");
    else printf("No");

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,a) FOR(i,0,a)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const static int INF = 1e8;

struct edge{
  int from,to,cost,cap,rev;
  edge(int a,int b,int c,int d,int e)
    :from(a),to(b),cost(c),cap(d),rev(e){}
};

//Based on Dijkstra (using potential)
struct minFlow{
  int v;
  vector< vector<edge> > graph;
  vi d,use,pv,pe;
  
  minFlow(int n):v(n){
    graph.resize(v);
    pv.resize(v); pe.resize(v);
  }

  void add(int s,int g,int c,int p){
    graph[s].pb(edge(s,g,c,p,graph[g].sz));
    graph[g].pb(edge(g,s,-c,0,graph[s].sz-1));
  }

  int cal(int s,int t,int f){
    int res = 0;
    while(f>0){
      d = vi(v,INF);
      d[s] = 0;

      rep(azu,v){
	bool update = false;
	rep(u,v){
	  rep(i,graph[u].sz){
	    edge &e = graph[u][i];
	    if(e.cap>0 && d[e.to] > d[u] + e.cost){
	      update = true;
	      d[e.to] = d[u] + e.cost;
	      pv[e.to] = u; pe[e.to] = i;
	    }
	  }
	}
	if(!update)break;
      }

      if(d[t]==INF)return -1;

      int x = f;
      for(int u=t;u!=s;u=pv[u])x = min(x,graph[pv[u]][pe[u]].cap);
      f -= x;
      res += x*d[t];
      for(int u=t;u!=s;u=pv[u]){
	edge &e = graph[pv[u]][pe[u]];
	e.cap -= x; graph[u][e.rev].cap += x;
      }
    }
    return res;
  }
};

int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n);
  vector<int> len;

  rep(i,n){
    cin >> a[i] >> b[i];
    len.pb(a[i]); len.pb(b[i]);
  }
  sort(all(len));
  len.erase(unique(all(len)),len.end());
  

  int m = len.size();
  int V = n+m+3;
  minFlow mf(V);
  rep(i,n){
    mf.add(0,i+1,0,1);

    int id1 = lower_bound(all(len),a[i]) - len.begin();
    mf.add(i+1,n+1+id1,-b[i],1);
    int id2 = lower_bound(all(len),b[i]) - len.begin();
    mf.add(i+1,n+1+id2,-a[i],1);

    mf.add(i+1,n+m+1,0,1);
  }

  rep(i,m){
    mf.add(n+1+i,n+m+2,0,1);
  }

  mf.add(n+m+1,n+m+2,0,n);

  cout << -mf.cal(0,V-1,n) << endl;
}

Measured memory_bytes: 1624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i <= n; ++i)
#define pb push_back
#define fr first
#define sc second
const int MAXN = 65535 + 5;
const double INF = 2e9;
const ll MOD = 1e9 + 7;
int dp[82][82][82 * 164];
//#define DEBUG

int main(){
  FastIO;
  #ifdef DEBUG
    freopen("input.txt", "r", stdin);
  #endif
  int h, w;
  cin >> h >> w;
  int a[h][w];
  forn(i, h)
  {
    forn(j, w)
    {
      cin >> a[i][j];
    }
  }
  forn(i, h)
  {
    forn(j, w)
    {
      int c;
      cin >> c;
      a[i][j] = abs(a[i][j] - c);
    }
  }
  dp[0][0][0] = 1;
  int ans = 1e9;
  forn(i, h)
  {
    forn(j, w)
    {
      forn(z, 82 * 164)
      {
        if (dp[i][j][z] == 1)
        {
          dp[i + 1][j][z + a[i][j]] = 1;
          dp[i + 1][j][abs(z - a[i][j])] = 1;
          dp[i][j + 1][z + a[i][j]] = 1;
          dp[i][j + 1][abs(z - a[i][j])] = 1;
          if (i == h - 1 && j == w - 1)
          {
            ans = min(ans, min(abs(z - a[i][j]), abs(z + a[i][j])));
          }
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 348800
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e6 + 5;
 
 
int32_t main()
{
  IOS;
  char c;
  cin >> c;
  int ascii = (int) c;
  ascii++;
  printf("%c",ascii)  ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,mx=0;
    cin>>n;
    int ara[n];
    for(i=0;i<n;i++){
        cin>>ara[i];
    }  
    j=0;
    for(i=0;i<n-1;i++){
        if(ara[i]>=ara[i+1]){
            j++;

        }
        else{
            mx=max(mx,j);
            j=0;
        }
    }
    mx=max(j,mx);
    cout<<mx<<endl;;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

signed main()
{

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S, T;
    cin >> S >> T;

    int count = 1e9;
    REP(s, S.length() - T.length()+1)
    {
        int temp = 0;
        
        REP(i, T.length())
        {
            
            if (S[s + i] != T[i])
            {
                temp++;
            }
            
        }
        if (count > temp)
        {
            count = temp;
        }
    }
    cout << count << endl;
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005;
vector<int> S[MAX],T[MAX];
int state[MAX],N;
stack<int> st;

int DFS(){
    for(int i=0;i<N;i++){
        state[i]=0;
    }
    int cnt=1;
    state[0]=1;
    st.push(0);
    while(st.size()){
        int a=st.top();
        st.pop();
        for(int i=0;i<T[a].size();i++){
            int b=T[a][i];
            if(state[b]==0){
                st.push(b);
                state[b]=1;
                cnt++;
            }
        }
    }
    return cnt;
}

int main(){
    
    int M;cin>>N>>M;
    for(int i=0;i<N;i++){
        int a;cin>>a;
        for(int j=0;j<a;j++){
            int b;cin>>b;
            b--;
            S[b].push_back(i);
        }
    }
    
    for(int i=0;i<M;i++){
        if(S[i].size()>=2){
            for(int j=1;j<S[i].size();j++){
                int a=S[i][j-1];
                int b=S[i][j];
                T[a].push_back(b);
                T[b].push_back(a);
            }
        }
    }
    
    if(DFS()==N) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 8832
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift()
l = inp.shift().split(' ')
S = l[0]
T = l[1]
ans = ''
for (i=0;i<S.length;i++) {
    ans += S[i]
    ans += T[i]
}
console.log(ans)

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


int main(){
	int n;
	cin >> n;
	int s[n];
	for(int i = 0;i < n;i++){
		cin >> s[i];
	}
	int count = 0;
	int mark_0 = 0;
	for(int i = 0;i < n;i++){
		if(s[i] == 0){
			mark_0 = 1;
			break;
		}else{
			if(s[i] < 0){
				count++;
			}
		}
	}
	for(int i = 0;i < n;i++){
		if(s[i] < 0){
			s[i] = -s[i];
		}
	}
	long long ans = 0;
	int t;
	for(int i = 0;i < n;i++){
		if(s[i] != 0){
			t = s[i];
			break;
		}
	}
	if(mark_0 != 0){
		for(int i = 0;i < n;i++){
			ans += s[i];
		}
	}else {
		for(int i = 0;i < n;i++){
			if(s[i] < t){
				t = s[i];
			}
			ans += s[i];
		}
		if(count % 2 != 0){
			ans = ans - 2*t;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>

int f(int x, int y, char op){
    switch (op){
        case '+': return x + y;
        case '-': return x - y;
        case '*': return x * y;
        case '/': return x / y;
        default : return 0;
    }
}

int main(void){
    while(true){
        int x, y; char op;
        scanf("%d %c %d", &x, &op, &y);
        if(op == '?') break;
        printf("%d\n", f(x, y, op));
    }
    return 0;
}


Measured memory_bytes: 3176
N,K= map(int, input().split())
S=[int(x) for x in list(str(input()))]

nums=list()
ds={0:1,1:0}
now=1
cnt=0
for i in S:
    if i==now:
        cnt=cnt+1
    else:
        nums.append(cnt)
        now=ds[now]
        cnt=1

if cnt!=0:
    nums.append(cnt)

if len(nums)%2==0:
    nums.append(0)

Add=2*K+1
ans=0
left=0
right=0
tmp=0
for i in range(0,len(nums),2):
    
    nextleft=i
    nextright=min(i+Add,len(nums))
    while nextleft>left:
        tmp=tmp-nums[left]
        left+=1

    while nextright>right:
        tmp=tmp+nums[right]
        right+=1
        

    ans=max(ans,tmp)

print(ans)


Measured memory_bytes: 4792
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int                 long long   
#define double              long double
#define endl                "\n"
#define pb                  push_back
#define PI                  3.1415926535897932384626433832795l
#define F                   first
#define S                   second
#define mp                  make_pair
#define f(i,n)              for(int i=0;i<n;++i)
#define loop(i,a,b)         for (int i=a ; i<b ;++i)
#define fastio              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define gcd(a,b)            __gcd((a),(b))
#define fill(a,value)       memset(a,value,sizeof(a));
#define minn(v)             *min_element(v.begin(), v.end());
#define maxx(v)             *max_element(v.begin(), v.end());
#define print(x)            cout<<(x)<<endl;
#define sum(v)+x            accumulate(v.begin(), v.end(),x);
typedef pair<int,int> pii;  
typedef vector<int> vi;

signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n;
    cin>>n;
    multiset<int>s;
    vi a;
    f(i,n)
    {
        int x;
        cin>>x;
        a.pb(x);
        s.insert(x);
    }
    f(i,n)
    {
        s.erase(s.find(a[i]));
        int ans=*s.rbegin();
        print(ans)
        s.insert(a[i]);
    }
    
    
    
    
    return 0;
}

Measured memory_bytes: 14276
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

//main
int main(){
  struct shop{
    ll A;
    ll B;
  };
  ll N,M; cin >> N >> M;
  vector<shop> S(N);
  rep(i,N) cin >> S[i].A >> S[i].B;
  sort(ALL(S), sort_key(shop,A));
  ll price = 0;
  ll place = 0;
  while(M>0){
    if(S[place].B>0){
      S[place].B -= 1;
      price += S[place].A;
      M -= 1;
    }else{
      place += 1;
    }
  }
  cout << price << endl;
}

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

vector<vector<int> > G;
vector<int> color;

//二部グラフ判定
bool dfs(int v, int c){
  color[v] = c;
  for ( auto e : G[v]) {
    if (color[e] == c) return false;
    if (color[e] == 0 && !dfs(e,-c)) return false;
  }
  return true;
} 

int bfs(int s, int n) {
  vector<int> dist(n,-1);
  queue<int> que;
  int mx = 0;
  que.push(s);
  dist[s] = 0;

  while(!que.empty()){
    int u = que.front();
    que.pop();
    mx = (mx,dist[u]);
    for (auto v : G[u]) {
      if (dist[v] != -1) continue;
      que.push(v);
      dist[v] = dist[u] + 1;
    }
  }
  return mx;
}

int main(){

  int n;
  cin >> n;
  G.resize(n);
  color.resize(n,0);
  rep(i,n) {
    string s;
    cin >> s;
    rep(j,sz(s)) {
      if (s[j] == '1') {
        G[i].push_back(j);
      } 
    }
  }
  if (!dfs(0,1)) {
    puts("-1");
    return 0;
  } 
  int res = 0;
  rep(i,n) {
    res = max(res,bfs(i,n));
  }
  cout << res + 1 << endl;
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <ctype.h>

int main(void){
  char ch;

  while(1){
    scanf("%c", &ch);
  if(ch=='\n'){
    printf("%c",'\n');
    break;
  } else {
    if(islower(ch)==0){
      printf("%c",tolower(ch));
    } else {
      printf("%c",toupper(ch));
    }
  }
  }

  return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

int f(int n) {
  if (n < 0) return 0;
  if (n == 0 || n == 1) return 1;
  return n * f(n - 1);
}

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

  P p[n];
  rep(i, n) cin >> p[i].first >> p[i].second;

  // double d[n][n];
  // rep(i, n) rep(j, n) {
  //   double dx = p[i].first - p[j].first;
  //   double dy = p[i].second - p[j].second;
  //   d[i][j] = sqrt(dx * dx + dy * dy);
  // }

  // double ans = 0;
  // rep(i, n) rep(j, n) { ans += d[i][j]; }

  // printf("%.15f\n", f(n - 1) * ans / f(n));

  auto d = [&](int i, int j) {
    int dx = p[i].first - p[j].first;
    int dy = p[i].second - p[j].second;
    return sqrt(dx * dx + dy * dy);
  };

  vector<int> a(n);
  rep(i, n) a[i] = i;
  int cnt = 0;
  double len = 0;
  do {
    rep(i, n - 1) { len += d(a[i], a[i + 1]); }
    ++cnt;
  } while (next_permutation(a.begin(), a.end()));

  double ans = len / cnt;
  printf("%.15f\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if(C >= A && C <= B) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int W,H,x,y,r;
	
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if(x-r<0||y-r<0||x+r>W||y+r>H){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	
	
	
	return 0;
}



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

int main(){
  int x;
  cin>>x;
  
  int answer=1;
  
  for (int i=2;i<32;i++){
    int check=i*i;
    while (check*i<=x){
      check*=i;
    }
    
    if (check<=x){
      answer=max(answer,check);
    }
  }
  
  cout<<answer<<endl;
  
    
  
  
  
}

  













Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int N;
  cin>>N;
  if(N%2 == 0)
  {
    cout<<N<<endl;
  }
  else
  {
    cout<<N*2<<endl;
  }
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


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

int main() {
    int n,m,q;
    cin >> n >> m >> q;
    vector<vector<int>> a(n + 1, vector<int>(n + 1, 0));
    int l,r;
    for(int i = 0; i < m; i++)
    {
        cin >> l >> r;
        a.at(l).at(r)++;
    }
    int s;
    vector<vector<int>> sum(n + 1, vector<int>(n + 1, 0));
    for(int i = 1; i <= n; i++)
    {
        s = 0;
        for(int j = 1; j <= n; j++)
        {
            s += a.at(i).at(j);
            sum.at(i).at(j) = s;
        }
    }
    int pi,qi;
    for(int i = 0; i < q; i++)
    {
        cin >> pi >> qi;
        s = 0;
        for(int j = 0; j < qi - pi + 1; j++)
        {
            s += sum.at(pi + j).at(qi) - sum.at(pi + j).at(pi - 1);
        }
        cout << s << endl;
    }
    
    
}

Measured memory_bytes: 2944
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
from operator import mul
from functools import reduce
def cmb1(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A_c=Counter(A)

    combi=0
    for ac in A_c.items():
        if ac[1]>=2:
            combi+=cmb1(ac[1],2)
    for i in range(n):
        print(combi-(A_c[A[i]]-1))



if __name__=='__main__':
    main()

Measured memory_bytes: 26636
H, W = map(int, input().split())
cells = []
for _ in range(H):
    a = list(input())
    try:
        idx = a.index('#')
        cells.append(a)
    except:
        pass
# print('cells', cells)
cells = list(zip(*cells))
# print('cells', cells)
ans = []
for cell in cells:
    try:
        idx = cell.index('#')
        ans.append(cell)
    except:
        pass
ans = list(zip(*ans))
# print('ans', ans)
for i in ans:
    print(''.join(i))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  char s[100];
  bool p = 0;
  bool w = 0;
  bool g = 0;
  bool y = 0;
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  for(int j = 0; j < n; j++){
    if(s[j] == 'P')p=1;
    if(s[j] == 'W')w=1;
    if(s[j] == 'G')g=1;
    if(s[j] == 'Y')y=1;
  }
  if(p&&w&&g&&y){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    int ans=0,cnt=0;
    REP(i,s.size()){
        if(s[i]=='B') cnt++;
        if(s[i]=='W') ans+=cnt;
    }
    cout<<ans<<endl;
}


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

int n;
int l[127];

int main(){
    int maxi = 0;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &l[i]);
        if(l[i]>l[maxi]){
            maxi = i;
        }
    }
    int sum = 0;
    for(int i=0; i<n; i++){
        if(i != maxi){
            sum+=l[i];
        }
    }
    int ans = sum > l[maxi] ? 1: 0;
    if(ans){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

}


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

void DFS(int start, vector <bool> &visited, vector < vector <ll> > &adjList, set<ll> &component)
{
    visited[start]=1;
    component.insert(start);
    for (auto z: adjList[start])
    {
        if (!visited[z])
        {
            visited[z]=true;
            DFS(z, visited, adjList, component);
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N, M, K;
    cin >> N >> M >> K;
    vector < set <ll> > components(N+1);
    vector < vector <ll> > adjList(N+1);
    vector < vector <ll> > blockList(N+1);
    loop(i,0,M)
    {
        ll u,v;
        cin >> u >> v;
        adjList[u].push_back(v);
        adjList[v].push_back(u);
    }
    loop(i,0,K)
    {
        ll u,v;
        cin >> u >> v;
        blockList[u].push_back(v);
        blockList[v].push_back(u);
    }
    vector <bool> visited(N+1, false);
    vector <ll> answers(N+1, 0);
    int cIndex=0;
    loop(i,1, N+1)
    {
        if (!visited[i])
        {
            DFS(i, visited, adjList, components[cIndex]);
            cIndex++;
        }        
    }
    loop(i,0,cIndex)
    {
        // cout << i << " " << components[i].size() << endl;
        for (auto z: components[i])
        {
            // cout << z << endl;
            answers[z]=(int)components[i].size()-1-(int)adjList[z].size();
            // cout << answers[z] << endl;
            for (auto y: blockList[z])
            {
                if (components[i].find(y) != components[i].end())
                {
                    answers[z]--;
                }
            }
        }
    }
    loop(i,1, N+1) cout << answers[i] << " ";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 24576
import math

n = int(input())

primes = []

x = 11
while len(primes)<n:
    max_ = int( math.sqrt(x) )    
    is_prime = True
    for i in range(3,max_+1,2):
        if x%i == 0:
            is_prime = False
            break

    if is_prime:
        primes.append(x)

    x = x+10

print(*primes, sep = ' ')

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

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 9500
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, W; cin >> N >> W;
	vl w(N);
	vi v(N);
	REP(i, N) cin >> w[i] >> v[i];
	
	int v_max = 100001;
	ll w_max = numeric_limits<ll>::max();
	vvl dp(N + 1, vl(v_max, w_max));
	dp[0][0] = 0;
	REP(i, N) {
		REP(j, v_max) {
			if (v[i] <= j && dp[i][j - v[i]] != w_max) {
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			}
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	int res = 0;
	REP(i, v_max) {
		if (dp[N][i] <= W) res = i;
	}
	cout << res << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 80384
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

#define REP(i, n) for(int i = 0; i < n; i++)
#define VREP(vec, vecs) for(auto& vec : vecs)
#define ALL(vec) vec.begin(), vec.end()
#define SUM(vec) accumulate(ALL(vec), 0)

#define INF 2e9

using namespace std;
typedef long long ll;

ll N;
string S;

int main() {
	vector<ll> H;
	ll tmp;

	cin >> N;
	REP(i, N) {
		cin >> tmp;
		H.push_back(tmp);
	}

	int ans = 0, count = 0;
	REP(i, N-1) {
		if (H[i] >= H[i + 1]) count += 1;
		else {
			ans = max(ans, count);
			count = 0;
		}
	}

	cout << max(ans, count) << endl;

	return 0;
}

Measured memory_bytes: 1400
#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<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int waru(int n){
    int s=0;
    while(n>0){
        s +=n%10;
        n=n/10;
    }
    return s;

}


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

    int n;
    cin>>n;

    
  

    
   
        if(n%waru(n)==0){
            cout<<"Yes\n";
        }
    else{
    cout<<"No"<<endl;
}



}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  Int sum=accumulate(a.begin(),a.end(),(long long)0);
  Int mi=*min_element(a.begin(),a.end());
  Int ma=*max_element(a.begin(),a.end());

  cout<<mi<<" "<<ma<<" "<<sum<<endl;
  return 0;
}



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

vector<ll> lun(1000000,INF);

void dfs(ll i, ll pre, ll lead){

  if(i > 10) return;

  for(ll j = -1; j <= 1; ++j){
    if(lead+j < 0 || 9 < lead+j) continue;
    ll now = pre + (lead + j) * pow(10,i);
    dfs(i+1 ,now, lead+j);
    if(lead+j != 0) lun.push_back(now);
  }

  return;

}

int main(){

  int k;
  cin >> k;

  rep(i,10){
    dfs(1,i,i);
    if(i != 0) lun.push_back(i);
  }

  sort(lun.begin(), lun.end());
  ll ans = lun[k-1];
  cout << ans << endl;

  return 0;
}


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

int main()
{
    int n;
    cin >> n; 
    vector<int> v;
    vector<int> m;
    int mi;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        v.push_back(a);
        if(i == 0){
            mi = a;
            m.push_back(a);
        }else{
            mi = min(a,mi);
            m.push_back(mi);
        }
    }
    
    int count = 0;
    for(int i=0; i<n; i++){
        if(v[i] <= m[i]) count++;
    }
    cout << count << endl;
    return 0;
}


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

const int MAX = 305;

int A[MAX][MAX], B[MAX][MAX];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            scanf("%d", &A[i][j]);
            B[i][j] = A[i][j];
        }
    }

    bool flg = false;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                if (A[j][k] > A[j][i] + A[i][k]) flg = true;
                if (i != j && i != k && A[j][k] == A[j][i] + A[i][k]) B[j][k] = 0;
            }
        }
    }

    if (flg) printf("-1\n");
    else {
        long long ans = 0ll;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                ans += B[i][j];
            }
        }
        ans /= 2;
        printf("%lld\n", ans);
    }
    
    return 0;
}

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

#define go(i,a,b) for(int i=a;i<=b;++i)
#define com(i,a,b) for(int i=a;i>=b;--i)
#define mem(a,b) memset(a,b,sizeof(a))
#define fo(i,a) for(int i=0;i<a;++i)
#define il inline

const int inf=0x3f3f3f3f,N=4e4;

int n,m,block[N],dp[N][20],g[20][20];

il void read(int &x){
	x=0;char c=getchar(),f=1;
	while(!isdigit(c)){ if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)){ x=x*10+c-'0'; c=getchar(); }
	x*=f;
}
il void gmax(int &x,const int &y){
	x=x>y?x:y;
}

int main(){
	//freopen("input.txt","r",stdin);
	read(n),read(m);
	int x,y,w;
	go(i,1,m){
		read(x),read(y),read(w);
		--x,--y;
		g[x][y]=g[y][x]=w;
	}
	int all=(1<<n)-1;
	go(i,1,all)
		fo(j,n){
			if(i>>j&1){
				block[i]=block[i^1<<j];
				fo(k,n) if(i>>k&1) block[i]+=g[j][k];
				break;
			}
		}
	mem(dp,-1);
	dp[1][0]=0;
	go(i,1,all)
		fo(j,n)
			if(i>>j&1&&dp[i][j]!=-1){
				fo(k,n)
					if(!(i>>k&1)&&g[j][k])
						gmax(dp[i|1<<k][k],dp[i][j]+g[j][k]);
				int tmp=(all^i)|1<<j;
				for(int k=tmp;k;k=(k-1)&tmp){
					if(k>>j&1)
						gmax(dp[i|k][j],dp[i][j]+block[k]);
				}
			}
	cout<<block[all]-dp[all][n-1];
	return 0;
}

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

int main() {
    long long a, b;
    cin >> a >> b;
    long long merge = stoll(to_string(a) + to_string(b));
    for (int i = 1; i <= 500; i++) {
        if (merge == i * i) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
function main()
  
  (A,B,C) = map(x -> parse(Int,x), split(readline()))
  
  check = false
  
  for i in 1:100
    
    if A*i % B == C
      check = true
      println("YES")
      break
    end
    
  end
  
  if check == false
    println("NO")
  end
  
end

main()

Measured memory_bytes: 110344
#include <algorithm>
#include <cstdio>
#include <map>
std::map<int, int> app;
int a[100005], b[100005], fa[200005];
int getfa(int u)
{
	if (u == fa[u])
		return u;
	return fa[u] = getfa(fa[u]);
}
inline void unite(int u, int v)
{
	fa[getfa(u)] = getfa(v);
}
int main()
{
	// freopen("AGC016-D.in", "r", stdin);
	int n, cnt = 0, ans = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", a + i);
		a[n] ^= a[i];
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", b + i);
		b[n] ^= b[i];
	}
	for (int i = 0; i < 200005; i++)
		fa[i] = i;
	for (int i = 0; i <= n; i++)
	{
		if (a[i] != b[i] || i == n)
		{
			if (!app.count(a[i]))
				app[a[i]] = cnt++;
			if (!app.count(b[i]))
				app[b[i]] = cnt++;
			unite(app[a[i]], app[b[i]]);
			ans++;
		}
	}
	ans--;
	for (int i = 0; i < cnt; i++)
		ans += i == fa[i];
	std::sort(a, a + n + 1);
	std::sort(b, b + n + 1);
	for (int i = 0; i <= n; i++)
	{
		if (a[i] != b[i])
		{
			puts("-1");
			return 0;
		}
	}
	printf("%d\n", ans - 1);
	return 0;
}


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

using namespace std;

string s , t;
int dp[4000][4000];


int solve(int i , int j)
{
    if(i==s.size() || j==t.size())
        return 0;

    int &res = dp[i][j];
    if(~res)
        return res;
    res = 0;

    res = max(solve(i+1 , j) , solve(i , j+1));
    if(s[i] == t[j])
        res = max(res , solve(i+1 , j+1) + 1);

    return res;
}

void build(int i , int j)
{
    if(i==s.size() || j==t.size())
        return;

    if(dp[i][j] == solve(i+1,j))
        build(i+1 , j);
    else if(dp[i][j] == solve(i,j+1))
        build(i , j+1);
    else if(dp[i][j] == solve(i+1,j+1)+1)
    {
        cout<<s[i];
        build(i+1 , j+1);
    }
}

int main()
{

    memset(dp , -1 , sizeof(dp));
    cin>>s>>t;
    solve(0,0);
    build(0,0);

    return 0;
}


Measured memory_bytes: 63232
#pragma warning disable IDE1006
#pragma warning disable IDE0011
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] line;

    public void R(params char[] sep) { line = Console.ReadLine().Split(sep); idx = 0; }
    public string S => line[idx++];
    public string[] Ss => line.Skip(idx++).ToArray();
    public char C => char.Parse(line[idx++]);
    public char[] Cs => line.Skip(idx++).Select(char.Parse).ToArray();
    public int I => int.Parse(line[idx++]);
    public int[] Is => line.Skip(idx++).Select(int.Parse).ToArray();
    public long L => long.Parse(line[idx++]);
    public long[] Ls => line.Skip(idx++).Select(long.Parse).ToArray();
    public double F => double.Parse(line[idx++]);
    public double[] Fs => line.Skip(idx++).Select(double.Parse).ToArray();
    public decimal D => decimal.Parse(line[idx++]);
    public decimal[] Ds => line.Skip(idx++).Select(decimal.Parse).ToArray();
    public BigInteger B => BigInteger.Parse(line[idx++]);
    public BigInteger[] Bs => line.Skip(idx++).Select(BigInteger.Parse).ToArray();

    public void Write<T>(params T[] xs)
    {
        Console.Write(xs.First());
        foreach (var x in xs.Skip(1)) Console.Write(" " + x);
        Console.WriteLine();
    }
    public void Write(params object[] xs)
    {
        Console.Write(xs.First());
        foreach (var x in xs.Skip(1)) Console.Write(" " + x);
        Console.WriteLine();
    }
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
#if !DEBUG
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
#endif
        Solve(new IO());
        Console.Out.Flush();
    }

    public static void Solve(IO io)
    {
        io.R();
        var n = io.I;
        var k = io.I;
        io.R();
        var l = io.Is;

        io.Write(l.OrderByDescending(x => x).Take(k).Sum());
    }
}

Measured memory_bytes: 13524
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll M1, D1, M2, D2;

int main() {
	cin >> M1 >> D1;
	cin >> M2 >> D2;
	if (M1 != M2) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long S, long long W){
  string ans;
  if(S>W){
    ans="safe";
  }else{
    ans="unsafe";
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long S;
    scanf("%lld",&S);
    long long W;
    scanf("%lld",&W);
    solve(S, W);
    return 0;
}


Measured memory_bytes: 3696
def main():
	n,k = map(int,input().split())
	# n = int(input())
	# s = str(input())
	a = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	ans = 0
	for i in range(n):
		if a[i] >= k:
			ans += 1
	print(ans)



if __name__ == '__main__':
	main()

Measured memory_bytes: 51440
dic = {}
N = int(input())
for _ in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
M = int(input())
for _ in range(M):
    s = input()
    if s in dic:
        dic[s] -= 1
    else:
        dic[s] = -1

ans_dic = sorted(dic.items(),key=lambda x:x[1],reverse = True)
print( max(ans_dic[0][1], 0))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 3223372036854775807;

void f(){
    cout << "No" << endl;
    exit(0);
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;cin >> S;
    int N = S.size();
    int A = (N-1)/2;int B = (N+3)/2;
    int a = A-1,b = N-1;
    REP(i,A){
        if(S[i] != S[a]) f();
        else a--;
        if(i >= a) break;
    }
    REPP(i,B-1,N){
        if(S[i] != S[b]) f();
        else b--;
        if(i >= b) break;
    }
    int n = N-1;
    REP(i,N){
        if(S[i] != S[n]) f();
        else n--;
        if(i >= n) break;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
var lines = input.split('\n');

var line;
while (line = lines.shift()) {
    var time = line.split(' ').map(function(n){return +n;});
    if (time[0] == -1 && time[1] == -1 && time[2] == -1)
        break;

    var hour = time[0];
    var min = time[1] + hour * 60;
    var sec = time[2] + min * 60;

    var rem = 120 * 60 - sec;
    var rem3 = rem * 3;
    var remSec = rem % 60;
    var remSec3 = rem3 % 60;
    rem = Math.floor(rem / 60);
    rem3 = Math.floor(rem3 / 60);
    var remMin = rem % 60;
    var remMin3 = rem3 % 60;
    var remHour = Math.floor(rem / 60);
    var remHour3 = Math.floor(rem3 / 60);

    console.log(('0' + remHour).slice(-2) + ':' + ('0' + remMin).slice(-2) + ':' + ('0' + remSec).slice(-2));
    console.log(('0' + remHour3).slice(-2) + ':' + ('0' + remMin3).slice(-2) + ':' + ('0' + remSec3).slice(-2));
}

Measured memory_bytes: 7640
#include <bits/stdc++.h>
using namespace std;
long long aa[100000];
int main()
{
	int a,cnt=0;
	cin>>a;
	for(int i=0;i<a;i++){
		cin>>aa[i];
		if(aa[i]%2==1){
			cnt++;
		}
	}
	if(cnt%2==1){
		cout<<"NO";
	}else{
		cout<<"YES";
	}
}

Measured memory_bytes: 1024
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==1:
        print('IMPOSSIBLE')
    else:
        print((a+b)//2)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
    public static void Main(){
        var S = Console.ReadLine();
        var T = Console.ReadLine();
        
        var Q = new Queue<char>();
        
        for(var i = 0;i < T.Length;i++){
            Q.Enqueue(T[i]);
        }
        
        for(var i = 0;i < T.Length;i++){
            if(S == string.Join("",Q)){
                Console.WriteLine("Yes");
                return;
            }else{
                var temp = Q.Dequeue();
                Q.Enqueue(temp);
            }
        }
        Console.WriteLine("No");
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <algorithm>


int main(){
	
	int A[111], N; 
	scanf("%d", &N);
	
	for(int i = 0; i < N; ++i){
		scanf("%d", &A[i]);
	}
	
	std::sort(A, A + N);
	
	printf("%d", A[N - 1] - A[0]);
	
return 0;	
}



Measured memory_bytes: 128
n,m,l = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(n)]
B = [map(int,input().split()) for i in range(m)]
B_T = list(map(list, zip(*B)))
for a in A:
    row = []
    for b in B_T:
        row.append(sum([x*y for (x,y) in zip(a,b)]))
    print(' '.join(map(str,row)))

Measured memory_bytes: 9184
#include <stdio.h>
#include <math.h>


int main(int argc, char *argv[]){

  int i;
  int N;
  double ave = 0;
  double x;
  int cost = 0;

  scanf("%d", &N);

  int a[N];

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

  for(i=0; i<=N-1; i++){
    ave += (double)a[i] / N;
  }
  //printf("ave = %f\n", ave);

  x = round(ave);
  //printf("x = %f\n", x);

  for(i=0; i<=N-1; i++){
    cost += (a[i] - x) * (a[i] - x);
  }

  printf("%d\n", cost);

  return 0;
}


Measured memory_bytes: 128