akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main()
{
    int x;
    std::cin >> x;

    if (x < 4) {
        std::cout << 1 << std::endl;
        return 0;
    }
    int ans = 0;
    for (int i = 2; i <= std::sqrt(x); i++) {
        for (int j = 2; (int)pow(i, j) <= x; j++) {
            ans = std::max(ans, (int)pow(i, j));
        }
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  char S[11];
  char T[12];

  scanf("%s", &S);
  scanf("%s", &T);
  int l = strlen(S);
  int cnt = 0;
  for (int i = 0; S[i] != '\0'; i++) {
    if (S[i] != T[i]) {
      cnt++;
    }
  }
  if (cnt == 0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 1656
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> x;
	int temp;
	for(int i=0;i!=n;++i){
		cin>>temp;
		x.push_back(temp);
	}
	int ans=1,flag=-1;
	for(int i=0;i!=n-1;++i){
		if(flag==-1){
			if(x[i+1]>x[i])
				flag=1;
			else if(x[i+1]<x[i])
				flag=0;
		}
		else if(flag==1 && x[i+1]<x[i]){
			++ans;
			flag=-1;
		}
		else if(flag==0 && x[i+1]>x[i]){
			++ans;
			flag=-1;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 892
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll block[2005][2005]={0},bsum[2005][2005]={0};
ll rsum1[2005][2005]={0},rsum2[2005][2005]={0};
ll blue_block(ll x1,ll y1,ll x2,ll y2){
  ll res=0;
  x1--;
  y1--;
  res+=bsum[x1][y1];
  res+=bsum[x2][y2];
  res-=bsum[x1][y2];
  res-=bsum[x2][y1];
  return res;
}
ll node(ll x1,ll y1,ll x2,ll y2){
  ll res=0;
  x1--;
  y1--;
  ll R1=0,R2=0;

  R1+=rsum1[x2][y2];
  R1+=rsum1[x1][y1+1];
  R1-=rsum1[x2][y1+1];
  R1-=rsum1[x1][y2];

  R2+=rsum2[x2][y2];
  R2+=rsum2[x1+1][y1];
  R2-=rsum2[x2][y1];
  R2-=rsum2[x1+1][y2];

  res=R1+R2;

  return res;
}
int main(){
  ll n,m,q;
  cin>>n>>m>>q;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      char c;
      cin>>c;
      if(c=='1'){
        block[i][j]++;
        bsum[i][j]++;
      }
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++) bsum[i][j]+=bsum[i-1][j];
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++) bsum[i][j]+=bsum[i][j-1];
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      if(block[i][j]==1&&block[i+1][j]==1){
        rsum2[i+1][j]++;
      }
      if(block[i][j]==1&&block[i][j+1]==1){
        rsum1[i][j+1]++;
      }
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++) {
      rsum1[i][j]+=rsum1[i-1][j];
      rsum2[i][j]+=rsum2[i-1][j];
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      rsum1[i][j]+=rsum1[i][j-1];
      rsum2[i][j]+=rsum2[i][j-1];
    }
  }
  for(int i=0;i<q;i++){
    ll x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    cout<<blue_block(x1,y1,x2,y2)-node(x1,y1,x2,y2)<<endl;
  }
}


Measured memory_bytes: 127360
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int> > VVi;
typedef vector<vector<ll> > VVl;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 28;
const ll linf = 1LL << 60;
const int MOD = 1000000007;

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

	if (N == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (N == 2) {
		cout << 1 << endl;
		return 0;
	}

	int ans = (N - 1) / 2;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

ll N,x;
cin >> N >> x;
vl a(N);
rep(i,N) cin >> a[i];

ll ans = 0;
ll now = 0;
rep(i,N) {
    if(now + a[i] < x) {
        now = a[i];
        continue;
    }
    ans += now + a[i] - x;
    a[i] = x - now;
    now = a[i];
}
cout << ans << endl;
return 0;
}

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

int main() {
  int N;
  cin >> N;
  string ans;
  if (N % 10 == 3) ans = "bon";
  else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) ans = "pon";
  else ans = "hon";  
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

class node{
public:
    node(){
        in = 0;
        out = 0;
    }
    
    int in;
    int out;
    vector<int> nxt;
    bool reachable;
};

int main(){

    int n;
    string str;
    while(cin >> n && n){
        node *v;
        v = new node[26];
        for(int i=0;i<n;i++){
            cin >> str;
            v[str[0] - 'a'].in++;
            v[str[str.size()-1] - 'a'].out++;
            v[str[0] - 'a'].nxt.push_back(str[str.size()-1] - 'a');
        }
   
        bool isok = true;
        for(int i=0;i<26;i++){
            if(v[i].in != v[i].out) isok = false;
        }
        if(isok){
            deque<int> q;
            for(int i=0;i<26;i++){
                if(v[i].in != 0){
                    v[i].reachable = true;
                    q.push_back(i);
                    break;
                }
            }
            while(!q.empty()){
                int tmp = q.front();
                q.pop_front();

                for(int i=0;i<v[tmp].nxt.size();i++){
                    if(v[v[tmp].nxt[i]].reachable == false){
                        q.push_back(v[tmp].nxt[i]);
                        v[v[tmp].nxt[i]].reachable = true;
                    }
                }
            }
            for(int i=0;i<26;i++){
                if(v[i].in != 0 && v[i].reachable == false){
                    isok = false;
                }
            }
        }

        if(isok){
            cout << "OK" << endl;
        }else{
            cout << "NG" << endl;
        }
    } 
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=3e5+10;
const int mod=1e9+7;
int a[N],b[N];
ll maxs=-9999;
ll sum;
struct A
{
    int x,y;
};
map <pair<int,int >,int >mp;
int main()
{
    int h,w,m;
    int q[N],t[N];//记录最多障碍物的行和列。
    int cnt1,cnt2;//记录有多少条最多的行和列。
    cin>>h>>w>>m;
    int  sum1=0,sum2=0;//求最大的行和列。
    for(int i=0; i<m; i++)
    {
        int x,y;
        cin>>x>>y;
        mp[make_pair(x,y)]++;
        a[x]++;
        b[y]++;
    }
    for(int i=1; i<=h; i++)
    {
        if(sum1<a[i])
        {
            cnt1=0;
            memset(q,0,sizeof(q));
            sum1=max(sum1,a[i]);
            q[cnt1++]=i;
            while(sum1==a[i+1])
            {
                q[cnt1++]=i;
                i++;
            }
        }
        if(sum1==a[i])
        {
            q[cnt1++]=i;
            while(sum1==a[i+1])
            {
                q[cnt1++]=i;
                i++;
            }
        }
    }
    for(int i=1; i<=w; i++)
    {
        if(sum2<b[i])
        {
            cnt2=0;
            memset(t,0,sizeof(t));
            sum2=max(sum2,b[i]);
            t[cnt2++]=i;
            while(sum2==b[i+1])
            {
                t[cnt2++]=i;
                i++;
            }
        }
        if(sum2==b[i])
        {
            t[cnt2++]=i;
            while(sum2==b[i+1])
            {
                t[cnt2++]=i;
                i++;
            }
        }
    }
    sum=sum1+sum2;
    int xx=0;
    for(int i=0; i<cnt1; i++)
    {
        for(int j=0; j<cnt2; j++)
        {
            int x1,y1;
            x1=q[i];
            y1=t[j];
            if(mp[make_pair(x1,y1)]==0)//判断是否交点有障碍物
            {
                xx=1;
                break;
            }

        }
        if(xx==1)
        {
            break;
        }
    }
    if(xx==0)
    {
        sum--;
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 27084
s = input()

if s == 'SUN':
    print(int(7))
elif s == 'MON':
    print(int(6))
elif s == 'TUE':
    print(int(5))
elif s == 'WED':
    print(int(4))
elif s == 'THU':
    print(int(3))
elif s == 'FRI':
    print(int(2))
elif s == 'SAT':
    print(int(1))
else:
    print('曜日が入力されていません')


Measured memory_bytes: 8972
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int Tc; string s;
  while(cin>>Tc) {
    while(Tc--) {
      cin >> s;
      int const N = s.size();
      bool NA = 0;
      bool isA;
      if(s[0] != '>') NA = 1;
      if(s[1] == '\'') {
	if(s[2] != '=') NA = 1;
	for(int i=2; i<(N-3)/2+2; i++) if(s[i]!='=') NA=1;
	if(s.substr(2, (N-3)/2) + "~" != s.substr(3+(N-3)/2)) NA = 1;
	if(s[(N-3)/2+2] != '#') NA = 1;
	isA = 1;
      }
      else if(s[1] == '^') {
	int cnt;
	if( !(s[2] == 'Q' && s[3] == '=') ) NA = 1;
	for(cnt=2; cnt<N-2; cnt+=2) {
	  if(!(s[cnt] == 'Q' && s[cnt+1] == '=')) NA = 1;
	}
	if(!(s[cnt] == '~' && s[cnt+1] == '~')) NA = 1;
	if(cnt+2 != N) NA = 1;
	isA = 0;
      }
      else {
	NA = 1;
      }
      
      if(NA) cout << "NA" << endl;
      else if(isA) cout << "A" << endl;
      else cout << "B" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,D;
  cin >> N>>D;
  vector<vector<int>> X(N,vector<int>(D));
  for (int i=0;i<N;i++){
    for (int j=0;j<D;j++){
      cin>>X.at(i).at(j);
    }
  }
  
  int c=0;
  
  for (int i=0;i<N;i++){
    for (int j=0;j<i;j++){
      long int l=0;
      for (int d=0;d<D;d++){
        l+=(X.at(i).at(d)-X.at(j).at(d))*(X.at(i).at(d)-X.at(j).at(d));
      }
      for (int k=1;k<127;k++){
        if (k*k==l){
          c++;
          break;
        }
      }
    }
  }
  cout<< c <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int h, a; cin >> h >> a;
	cout << (h + a - 1) / a << endl;
	
	return 0;
}

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

int main() {
    string s;
    cin >> s;

    int size = s.size();
    size--;
    size -= size % 2;
    for (int i = size; i >= 0; i-=2) {
        if (s.substr(0, i/2) == s.substr(i/2, i/2)) {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 384
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    A, B = read_values()
    print(A * B)


if __name__ == "__main__":
    main()



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

#define MAX 100000
#define NIL -1
struct node{int p,l,r;};

struct node T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int,int);
int setHeight(int);
int getSibling(int);
void print(int);

int main(void){
    int i,v,l,r,root=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){//入力する部分の配列のみ初期化する
        T[i].p=NIL;
    }
    for(i=0;i<n;i++){//入力
        scanf("%d %d %d",&v,&l,&r);
        T[v].l=l;
        T[v].r=r;
        if(l!=NIL) T[l].p=v;//左の子供の親を設定
        if(r!=NIL) T[r].p=v;//右の子供の親を設定
    }
    for(i=0;i<n;i++){
        if(T[i].p==NIL) root=i;//根の値(id)を教えてあげる
    }
    setDepth(root,0);//rootnodeからそれぞれのidの深さを設定
    setHeight(root);//それぞれのidの高さを再帰により設定
    for(i=0;i<n;i++){
        print(i);
    }
    return 0;
}
void setDepth(int id,int d){
    if(id==NIL) return;//存在しなかったらreturn
    D[id]=d;
    setDepth(T[id].l,d+1);
    setDepth(T[id].r,d+1);
}
int setHeight(int id){
    int hl=0,hr=0;
    if(T[id].l!=NIL){
        hl=setHeight(T[id].l)+1;
    }
    if(T[id].r!=NIL){
        hr=setHeight(T[id].r)+1;
    }
    if(hl>hr) H[id]=hl;
    else H[id]=hr;
    return H[id];
}
int getSibling(int id){//兄弟を出力用に探す
    if(T[id].p==NIL) return NIL;//id=0のとき親はいない(親はNIL)かつ兄弟もいない
    if(T[T[id].p].l!=id && T[T[id].p].l!=NIL){//idの親の左の子を確認して、id自身ではなくかつNILでなかった場合
        return T[T[id].p].l;//その子はidの兄弟なので返してあげる
    }
    if(T[T[id].p].r!=id && T[T[id].p].r!=NIL){//idの親の右の子を確認して、id自身ではなくかつNILでなかった場合
        return T[T[id].p].r;//その子はidの兄弟なので返してあげる
    }
    return NIL;//条件以外の場合は兄弟がいないのでNILを返す
}
void print(int id){
    int degree=0;
    if(T[id].l!=NIL) degree++;
    if(T[id].r!=NIL) degree++;
    printf("node %d: ",id);
    printf("parent = %d, ",T[id].p);
    printf("sibling = %d, ",getSibling(id));
    printf("degree = %d, ",degree);
    printf("depth = %d, ",D[id]);
    printf("height = %d, ",H[id]);
    if(T[id].p==NIL) printf("root\n");//親がいなかったらroot
    else if(T[id].l==NIL && T[id].r==NIL) printf("leaf\n");//左右どっちも子供がいなかったらleaf
    else printf("internal node\n");
}



Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

int a[10];

int main() {
    rep(i, 6)cin >> a[i];

    sort(a, a + 5);
    if (abs(a[0] - a[4]) <= a[5])cout << "Yay!" << endl;
    else cout << ":(" << endl;


}

Measured memory_bytes: 256
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e16;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };


const int N=300005;



void solve()
{
    int n;
    cin>>n;
    set<string>s;string S;
    for(int i=0;i<n;i++)
    {
        cin>>S;
        s.insert(S);
    }
    cout<<s.size()<<endl;
}

int32_t main()
{
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 19236
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
int main(void){
    int n; cin >> n;
    vector<double> r(n);
    for(auto & e : r) cin >> e;

    vector<double> x(n);

    double res = 0.0;
    rep(i, n){
        x[i] = r[i];

        rep(j, i){
            double b = r[i] - r[j], c = r[i] + r[j];
            x[i] = max(x[i], sqrt(c * c - b * b) + x[j]);
        }

        res = max(res, x[i] + r[i]);
    }

    cout.precision(12);
    cout << res << endl;

	return 0;
}

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

const int MOD = 1e9+7;
const int MAX_N = 1e5+2;
int N;
int x[MAX_N], y[MAX_N];
vector<int> G[MAX_N];
ll dp[MAX_N][2];

void add_edge(int from, int to)
{
	G[from].push_back(to);
	G[to].push_back(from);
}

ll dfs(int x, int p, int c)
{
	ll& res = dp[x][c];
	if(res != -1) return res;
	res = 1;
	for(int i=0;i<G[x].size();++i){
		int y = G[x][i];
		if(y == p) continue;
		if(!c){ //black
		    (res *= dfs(y,x,1))%=MOD;
		}else{ //c==1
		    (res *= (dfs(y,x,1)+dfs(y,x,0))%MOD)%=MOD;
		}
	}
	return res;
}

void solve()
{
	for(int i=0;i<N-1;++i) add_edge(x[i], y[i]);
	memset(dp, -1, sizeof(dp));
	ll ans = (dfs(1, -1, 0) + dfs(1,-1,1))%MOD;
	cout << ans << '\n';
}

int main()
{
	cin >> N;
	for(int i=0;i<N-1;++i){
		cin >> x[i] >> y[i];
	}
	solve();
	return 0;
}

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

int main() {
  int k, a, b;
  cin >> k >> a >> b;
  bool lehet=false;
  for (int i=a;i<=b;i++){
    if (i%k==0){
      lehet=true;
    }
  }
  
  if (lehet==true){
    cout << "OK";
  }else{
    cout << "NG";
  }
  
	return 0;
}
 

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    string s;
    cin >> s;
    if(s[0]=='7' or s[1]=='7' or s[2]=='7')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

using namespace std;
typedef long long ll;
int n,x,b[200005],sum[200005];
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=2;i<=n;i++)
	cin>>x,b[x]++;
	for(int i=1;i<=n;i++)
	cout<<b[i]<<endl;
	return 0;
} 

Measured memory_bytes: 4388
I = [input() for i in range(2)]
N,M = map(int,I[0].split())
A = list(map(int,I[1].split()))
#print(A)
A.sort(reverse = True)
#print(A)
S = sum(A)

if A[M-1] >= S/(4*M) :
    ans = 'Yes'
else :
    ans = 'No'

print(ans)

Measured memory_bytes: 3064
#include <cstdio>

using namespace std;

int h[100000];

int main() {
    int n, a, b, i;
    long long l, r, m;
    
    scanf("%d %d %d", &n, &a, &b);
    
    a -= b;
    
    for (i = 0; i < n; i++) scanf("%d", &h[i]);
    
    l = 0, r = 1e9, m = (l + r) / 2;
    
    while (r - l > 1) {
        long long sum = 0;
        
        for (i = 0; i < n; i++) {
            if (h[i] > m * b) {
                long long x = h[i] - m * b;
                
                sum += (x + a - 1) / a;
            }
        }
        
        if (sum <= m) {
            r = m;
            m = (l + r) / 2;
        } else {
            l = m;
            m = (l + r) / 2;
        }
    }
    
    printf("%lld\n", r);
    
    return 0;
}


Measured memory_bytes: 512
n = int(input())
h = [int(e) for e in input().split(" ")]
flag = True

if n > 2:
    pre = h[0]
    now = h[1]
    
    for e in h[2:]:
        if pre <= now-1 and now-1 <= e:
            pre = now - 1
            now = e
        else:
            if pre <= now and now <= e:
                pre = now
                now = e
            else:
                flag = False
                break

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14704
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll dp[2004][2004];
struct node{
	ll id,act;
}a[2004];
bool cmp(node a,node b){
	if(a.act!=b.act)return a.act>b.act;
	else return a.id<b.id;
}
int main(){
	ll n;
	scanf("%lld",&n);
	for(ll i=0;i<n;i++){
		scanf("%lld",&a[i].act);
		a[i].id=i;
	}
	sort(a,a+n,cmp);
	ll ans=0;
	for(int l=0;l<n;l++){
		for(int r=0;r<n;r++){
			int i=l+r;
			if(i>=n)break;
			
			ll act=a[i].act;
			ll loc=a[i].id;
			
			dp[l+1][r]=max(dp[l+1][r],dp[l][r]+act*abs(l-loc));
			dp[l][r+1]=max(dp[l][r+1],dp[l][r]+act*abs((n-1)-loc-r));
			
			ans=max(ans,dp[l+1][r]);
			ans=max(ans,dp[l][r+1]);
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 26396
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void run (void) {
  i32 n, d;
  scanf ("%" SCNi32 "%" SCNi32, &n, &d);
  i32 **a = ALLOC (n, i32 *);
  for (i32 i = 0; i < n; ++i) {
    a[i] = ALLOC (d, i32);
    for (i32 j = 0; j < d; ++j) {
      scanf ("%" SCNi32, a[i] + j);
    }
  }
  i32 ans = 0;
  for (i32 i = 0; i < n; ++i) {
    for (i32 j = i + 1; j < n; ++j) {
      i32 sum = 0;
      for (i32 k = 0; k < d; ++k) {
        i32 f = a[i][k] - a[j][k];
        sum += f * f;
      }
      for (i32 k = 0; k * k <= sum; ++k) {
        if (sum == k * k) {
          ans++;
        }
      }
    }
  }
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 128
s, t = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

def calc(li):
    div = 10 ** 9 + 7
    li_size = len(li)
    su_m = 0
    for k in range(li_size):
        su_m += ((2 * k + 1 - li_size) * li[k] ) % div
    return su_m

x_sum = calc(x)
y_sum = calc(y)
print((x_sum * y_sum ) % (10 ** 9 + 7))

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

int main() {
  int N, x, count=99999, local;
  cin >> N;
  for (int i = 0; i<N; i++){
    cin >> x;
    local = 0;
    while (x % 2 == 0){
      local++;
      x /= 2;
    }
    count = (local < count)? local: count;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
# D - String Equivalence 
def dfs(s, mx):
    if len(s)==n:
        print(s)
        return
    for c in range(ord('a'),ord(mx)+1):
        dfs(s+chr(c),(chr(ord(mx)+1) if ord(mx)==c else mx))

n=int(input())
dfs('','a')


Measured memory_bytes: 4340
import numpy,itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
c = [0] * 5
for _ in range(n):
    s = readline().decode().rstrip()
    if s[0] == 'M':
        c[0] += 1
    elif s[0] == 'A':
        c[1] += 1
    elif s[0] == 'R':
        c[2] += 1
    elif s[0] == 'C':
        c[3] += 1
    elif s[0] == 'H':
        c[4] += 1

cm = list(itertools.combinations(c, 3))
arr = numpy.array(cm)

print(sum(list(numpy.prod(arr, axis=1))))

Measured memory_bytes: 27268
#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

char f[2002];
short que[2002]; int top, end;

int main()
{
	int n, a, q;
	int stop, x;
	
	n = in(), que[0] = 0, end = 1;
	while (n--) {
		stop = end;
		a = in();
		for (top = 0; top < stop; top++) {
			x = que[top] + a;
			if (f[x]) continue;
			f[x] = 1, que[end++] = x;
		}
	}

	q = in();
	while (q--) {
		puts(f[in()]? "yes": "no");
	}
	return 0;
}



  

 



Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
const int nax=1000010;
vector<vector<int> > graph(nax , vector<int>()); 
int par[nax]={};

void g_clear()
{
    for (int i=0; i<nax; i++){
        graph[i].clear();
    }
}

void bfs(int source)
{
    queue<int>q;
    q.push(source) ;
    
    par[source] = 1;
    
    while(!q.empty()){
        int x = q.front();
        q.pop();
        
        for(int i=0; i<graph[x].size(); i++){
            int y = graph[x][i];
            
            if(par[y] == 0){
                par[y] = x;
                q.push(y);
            }
        }
        
    }
    
}

int main()
{
    int node,edge;
    cin>>node>>edge;
    
    for(int i=0; i<edge; i++){
        int u,v;
        cin>>u>>v;
        
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    bfs(1);
    
    for(int i=2; i<=node; i++){
        if (0 == par[i]){
            cout << "No" <<endl;
            return 0;
        }
    }
    
    cout << "Yes" <<endl;
    
    for(int i=2; i<=node; i++){
        cout << par[i] <<endl;
    }
    
}

Measured memory_bytes: 31412
#include <iostream>

using namespace std;

int main(){
	int num, max;
	int list[100] = {0};
	
	max = 0;

	while (cin >> num){
		list[num - 1]++;
	}
	for (int i = 0; i < 100; i++){
		if (max < list[i]){
			max = list[i];
		}
	}
	for (int j = 0; j < 100; j++){
		if (max == list[j]){
			cout << j + 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define RevRange(container) container.rbegin(), container.rend()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(){
    Cin(int, n);
    Cin(int, m);
    Cin(int, x0);
    Cin(int, y0);
    Cins(int, n, x);
    Cins(int, m, y);
    x.push_back(x0);
    y.push_back(y0);
    sort(Range(x));
    sort(Range(y));
    Cout((x.back() < y.front()) ? "No War" : "War");
}



Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		Map<String, Integer> map = new TreeMap<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			if(map.containsKey(s)) {
				if(max < map.get(s) + 1) {max = map.get(s) + 1;}
				map.put(s, map.get(s) + 1);
			}else {
				if(max < 1) {max = 1;}
				map.put(s, 1);
			}
		}

		for(String key : map.keySet()) {
			if(map.get(key) == max) {
				System.out.println(key);
			}
		}

		sc.close();
	}
}


Measured memory_bytes: 83112
arr = gets.chomp.split(" ").map{|n| n.to_i}
n = arr[0]
m = arr[1]
x = arr[2]

arr = []
line = gets.chomp.split(" ")
line.each_with_index do |node, i|
  arr << node.to_i
end

position = 0
while(position<m) do
  if arr[position] >= x
    break
  end
  position += 1
end
left = position
right = m-position

puts left <right ? left : right


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

int main(){
    int n;
    vector<int> one, two;
    string s;
    bool flg = true;
    cin >> n >> s;
    --n;
    for(int i=0;i<=n;++i){
        int d = s[i] - '1';
        one.emplace_back(d & 1);
        two.emplace_back(d == 2);
        if(d & 1) flg = false;
    }
    int ans = 0;
    for(int i=0;i<=n;++i){
        if((n&i) == i) ans += one[i];
    }
    if(ans & 1){ cout << 1 << endl; return 0; }
    if(!flg){ cout << 0 << endl; return 0; }
    ans = 0;
    for(int i=0;i<=n;++i){
        if((n&i) == i) ans += two[i];
    }
    if(ans & 1){ cout << 2 << endl; return 0; }
    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 12276
import java.io.PrintWriter;
import java.util.*;

public class Main{
    static PrintWriter out;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        out=new PrintWriter(System.out);

        long a[]=new long[4];
        for (int i = 0; i <4 ; i++) {
            a[i]=sc.nextInt();
        }
        out.println(Math.max(a[0]*a[2],Math.max(a[0]*a[3],Math.max(a[1]*a[2],a[1]*a[3]))));


        sc.close();
        out.close();
    }




}

Measured memory_bytes: 35720
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
    while(true){
        int n,r;
        cin >> n >> r;
        if(n == 0 && r == 0) break;
        int tmp[n];
        for(int i = 0; i < n; i++){
            tmp[i] = n-i;
        }
        for(int j = 0; j < r; j++){
            int v[n];
            int p,c; cin >> p >> c;
            for(int i = 0; i < c;i++){
                v[i] = tmp[i+p-1];
            }
            for(int i = 0; i < p-1;i++){
                v[i+c] = tmp[i];
            }
            for(int i = p+c-1; i<n; i++){
                v[i] = tmp[i];
            }
            for(int i = 0; i < n; i++){
                tmp[i] = v[i];
            }
        }
        cout << tmp[0] << endl;
    }
}


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

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

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 (b<a) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    map<int, int> mp;
    auto med = mp.begin();
    int l = 0, r = 0, N = 0;
    ll lsum = 0, rsum = 0, B = 0;
    rep(_, Q) {
        int t; cin >> t;

        if (t == 1) {
            int a, b; cin >> a >> b;
            N++;
            mp[a]++;
            B += b;
            if (N == 1) {
                med = mp.begin();
                continue;
            }

            if (med->first < a) {
                r++;
                rsum += a;
                while (l + med->second < (N+1)/2) {
                    l += med->second;
                    lsum += (ll)med->first * med->second;
                    med++;
                    r -= med->second;
                    rsum -= (ll)med->first * med->second;
                }
            }

            else if (med->first > a) {
                l++;
                lsum += a;
                while (l >= (N+1)/2) {
                    r += med->second;
                    rsum += (ll)med->first * med->second;
                    med--;
                    l -= med->second;
                    lsum -= (ll)med->first * med->second;
                }
            }
        }

        if (t == 2) {
            ll ans = 0;
            ans += (ll)l * med->first - lsum;
            ans += rsum - (ll)r * med->first;
            ans += B;
            cout << med->first << " " << ans << endl;
        }
    }
}

Measured memory_bytes: 8292
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

ll MOD = 1e9 + 7;
ll add(ll x, ll y)
{
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}
ll sub(ll x, ll y)
{
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}
ll mult(ll x, ll y)
{
    return (x * y) % MOD;
}
ll bin_pow(ll x, ll p)
{
    if (p == 0)
        return 1;
    if (p & 1)
        return mult(x, bin_pow(x, p - 1));
    return bin_pow(mult(x, x), p / 2);
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n)
    cin >> a[i];

    map<int, int> lcm;
    for (int i = 0; i < n; i++)
    {
        int x = a[i];
      
        map<int, int> mp;
       
        int cnt = 2;
        while (cnt * cnt <= x)
        {
            if(x%cnt==0){
                mp[cnt]++;
                x /= cnt;
            }
            else{
                cnt++;
            }
        }
         if(x!=1) mp[x]++;
      /*  for (auto itr = mp.begin(); itr != mp.end(); ++itr)
        {
            cout << itr->first << " " << itr->second << endl;
        }*/
        for (auto itr = mp.begin(); itr != mp.end(); ++itr){
            if(lcm[itr->first] < itr->second){
                lcm[itr->first] = itr->second;
            }
        }
    }


   
    ll ans = 0;
    int L = 1;
    vector<int> v(1000010,0);
    for (auto u: lcm){
        v[u.first] = u.second;
    }
    for (int i = 0; i < 1e6+1; i++)
    {
        if (v[i] == 0)
            continue;
        L = mult(L, bin_pow(i, v[i]));
        }
    for (int i = 0; i < n; i++)
    {
        ans += mult(L, bin_pow(a[i], MOD - 2));
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8832
#include <atcoder/scc>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll solve() {
    ll N, M, a, b;
    cin >> N >> M;
    atcoder::scc_graph g(N);
    for ( int i = 0; i < M; i++ ) {
        cin >> a >> b;
        g.add_edge(a,b);
    }
    auto cs = g.scc();
    cout << cs.size() << "\n";
    for ( auto c : cs ) {
        cout << c.size();
        for ( auto v : c ) {
            cout << " " << v;
        }
        cout << "\n";
    }

    return 0;
}

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

Measured memory_bytes: 40092
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    char c;
    cin>>c;
   cout<<char(c+1)<<endl;
}


Measured memory_bytes: 3648
from collections import defaultdict
dd = defaultdict(lambda:0)
n, k = map(int, input().split())
for _ in range(k):
    d = int(input())
    li_a = list(map(int, input().split()))
    for i in li_a:
        dd[i] += 1
sum_ = 0    
for key in dd:
    sum_ += 1
print(n-sum_)

Measured memory_bytes: 9464
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
using namespace std;

const int MAX = 1 << 20;

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

  for(int n,k;cin>>n>>k,n;){
    vector<vector<int>> fare(n,vector<int> (n,MAX));
    for(int i=0;i<n;++i)
      fare[i][i]=0;

    for(int i=0;i<k;++i){
      int y;cin>>y;
      if(y==1){
	int c,d,e;cin>>c>>d>>e;--c;--d;

	fare[c][d]=min(fare[c][d],e);
	fare[d][c]=min(fare[d][c],e);

	// wa-sharu floydo hou
	for(int o=0;o<n;++o)
	  for(int p=0;p<n;++p){
      	    fare[o][p] = min(fare[o][p],fare[o][c] + fare[c][d] + fare[d][p]);
	    fare[o][p] = min(fare[o][p],fare[o][d] + fare[d][c] + fare[c][p]);
	  }
      }else{
	int a,b;cin>>a>>b;--a;--b;

	if(fare[a][b]==MAX)
	  cout<<-1<<endl;
	else
	  cout<<fare[a][b]<<endl;
      }
    }
  }

  return EXIT_SUCCESS;
}

Measured memory_bytes: 1264
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N;cin>>N;
    vector<ll> cnt(N);
    REPS(i,N-1){
        ll A;cin>>A;A--;
        cnt[A]++;
    }
    REP(i,N){
        cout<<cnt[i]<<"\n";
    }
}
    

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

int main(){
    string s; cin >> s;
    int n = s.size();
    bool ok = true;
    rep(i, n){
        if(i%2==0 && s[i] == 'L') ok=false;
        if(i%2==1 && s[i] == 'R') ok=false;
    }
    if(ok) cout << "Yes"; else cout << "No";
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
class Lake {
    Lake(int area, int x){
        this.area = area;
        this.x = x;
    }
    public int area, x;
}
 
public class Main{
    public static void main(String[] args)throws Exception{
        BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in));
        char g[] = br.readLine().toCharArray();
        int sum = 0;
        ArrayDeque<Integer> lx = new ArrayDeque<Integer>();
        ArrayDeque<Lake> lakes = new ArrayDeque<Lake>();
 
        for(int x = 0; x < g.length; x++) {
            if (g[x] == '\\') {
                lx.add(x);
            } else if (!lx.isEmpty() && g[x] == '/') {
                int a = x - lx.getLast();
                sum += a;
                while (!lakes.isEmpty() && lx.getLast() < lakes.getLast().x) {
                    a += lakes.getLast().area;
                    lakes.removeLast();
                }
                lakes.add(new Lake(a, lx.pollLast()));
            }
        }
        StringBuilder sb = new StringBuilder();
        sb.append(sum).append('\n').append(lakes.size());
        for (Lake l : lakes) {
            sb.append(' ').append(l.area);
        }
        System.out.println(sb);
    }
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	for (int i = 0; i < n; i++)
		cin >> s[i];
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++)
		cout << s[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    int base=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for(int i=0;;i++){
        if(n<=k+i*(k-1)){
            ans=i+1;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}
int n, k;
ll ot[2010][2010];
ll su[2010][2010];

void solv() {
	cin >> n >> k;
	int dk = k * 2;
	for (int i = 0; i < n; i++)
	{
		ll x, y;
		char c;
		cin >> x >> y >> c;

		if (c == 'B') {
			y += k;
		}
		x = x % dk;
		y = y % dk;
		ot[x][y]++;
		ot[(x + k) % dk][(y + k) % dk]++;
	}

	for (int i = 1; i <= dk; i++)
	{
		for (int j = 1; j <= dk; j++)
		{
			su[i][j] = ot[i - 1][j - 1];
		}
	}

	for (int i = 1; i <= dk; i++)
	{
		for (int j = 1; j <= dk; j++)
		{
			su[i][j] += su[i][j - 1];
		}
	}
	for (int i = 1; i <= dk; i++)
	{
		for (int j = 1; j <= dk; j++)
		{
			su[i][j] += su[i - 1][j];
		}
	}
	ll res = 0;
	for (int i = 0; i <= k; i++)
	{
		for (int j = 0; j <= k; j++)
		{
			ll val = su[i + k][j + k];
			val -= su[i][j + k];
			val -= su[i + k][j];
			val += su[i][j];
			res = max(val, max(n - val,res));
		}
	}
	cout << res << endl;
}


int main() {
	solv();

	return 0;
}


Measured memory_bytes: 63744
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define For1(i, n) for(int i = 1; i <= (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cout((ll)n*(n-1)/2);
}




Measured memory_bytes: 256