akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,zx,xc,mod=998244353,pas,xar[200009],n,m,k,fct[200009];
long long xaar(long long q, long long w){
    if(w==0) return 1;
    long long qw=xaar(q,w/2);
    if(w%2==0) return (qw*qw)%mod; else return ((qw*qw)%mod*q)%mod;
}
long long gayo(long long q, long long w){
    return (q*xaar(w,mod-2))%mod;
}
long long C(long long q, long long w){
    long long qw=fct[q],we=fct[w]*fct[q-w];
    we%=mod;
    return gayo(qw,we);
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>n>>m>>k;
    if(m==1){
        if(k==n-1){
            cout<<1;
        }else{
            cout<<0;
        }
        return 0;
    }
    m--;
    xar[0]=1;
    for(i=1; i<=n+2; i++){
        xar[i]=xar[i-1]*m;
        xar[i]%=mod;
    }
    fct[0]=1;
    for(i=1; i<=n+2; i++){
        fct[i]=fct[i-1]*i;
        fct[i]%=mod;
    }
    for(i=0; i<=k; i++){
        zx=C(n-1,i)*xar[n-i-1];
        zx%=mod;
        zx*=(m+1);
        zx%=mod;
        //cout<<C(n-1,i)<<" "<<xar[n-i-1]<<" "<<(m+1)<<"   "<<zx<<endl;
        pas+=zx;
        pas%=mod;
    }
    cout<<pas;
    return 0;
}

Measured memory_bytes: 6660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


int main(){
    ll M;
    cin >> M;
    cout << 48-M << "\n";
}


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

void print(int x,int y,int z){
  cout << x << " " << y << " " << z << endl;
}
//1,5,10 -> divide by 1000
int main(){
  int N,Y;
  cin >> N >> Y;
  Y /= 1000;
  // greedy solution
  int x,y,z;
  x = 0; y = 0; z = 0;
  for(int u = (Y-N) / 9; u >= 0; u--){
      if(((Y-N) - 9 * u) % 4 == 0){
        y = ((Y-N) - 9 * u) / 4;
        x = u;
        break;
      }
  }
  if(N - y - x < 0){
    x = -1; y = -1; z = -1;
  }
  else{
    z = N - y - x;
    if(10 * x + 5 * y + z == Y){

    }
    else{
      x = -1; y = -1; z = -1;
    }
  }

  print(x,y,z);
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split(" ");

   //  String nyu=sc.nextLine();
//int[] num=new int[6];
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu);
//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

Arrays.sort(nyu);

String tem=nyu[2]+nyu[1];
int res=Integer.parseInt(tem)+Integer.parseInt(nyu[0]);

System.out.println(res) ;

	}
}

Measured memory_bytes: 22608
S = input()
T = input()
minA = float("inf")
for i in range(len(S) - len(T) + 1):
    sumA = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            sumA += 1
    minA = min(minA, sumA)
print(minA)


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

template <typename monoid>
class segmentTree {
public:
  using M = monoid;
  using T = typename M::value_type;

  int sz;
  vector<T> x;

  segmentTree(int n = 1e5) {
    sz = 1; while(sz < n) sz *= 2;
    init();
  }
  void init() { x.assign(sz*2, M::id()); }

  // [a, b)
  T query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return M::id();
    if(a <= l && r <= b) return x[k];
    return M::f(query(a, b, 2*k+1, l, (l+r)/2),
                query(a, b, 2*k+2, (l+r)/2, r));
  }
  T query(int a, int b) {return query(a, b, 0, 0, sz);}
  // 点更新
  void update(int i, const T &val) {
    i += sz-1;
    x[i] = M::g(x[i], val);
    while(i > 0) {
      i = (i-1) / 2;
      x[i] = M::f(x[i*2+1], x[i*2+2]);
    }
  }
};

template <typename T>
struct min_monoid {
  using value_type = T;
  static constexpr T id() { return std::numeric_limits<T>::max(); }
  static T f(const T &a, const T &b) { return min(a, b); }
  static T g(const T &a, const T &b) { return b; }
};
template <typename T>
struct max_monoid {
  using value_type = T;
  static constexpr T id() { return std::numeric_limits<T>::min; }
  static T f(const T &a, const T &b) { return max(a, b); }
  static T g(const T &a, const T &b) { return b; }
};
template <typename T>
struct sum_monoid {
  using value_type = T;
  static constexpr T id() {return 0;}
  static T f(const T &a, const T &b) { return a+b; }
  static T g(const T &a, const T &b) { return a+b; }
};

template <typename T>
using rmq = segmentTree<min_monoid<T>>;
template <typename T>
using rsq = segmentTree<sum_monoid<T>>;

signed main() {
  int n, q;
  cin >> n >> q;
  rmq<int> seg(n);
  for(int i=0; i<q; ++i) {
    int c, x, y;
    cin >> c >> x >> y;
    if(c == 0) {
      seg.update(x, y);
    } else {
      cout << seg.query(x, y+1) << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3892
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//head

vi adj[9];

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int ans = 0;
  	int n, m;
  	cin >> n >> m;
  	for(int i = 0; i < m; i++){
  		int u, v;
  		cin >> u >> v;
  		adj[u].pb(v);
  		adj[v].pb(u);
  	}
  	vi p;
  	for(int i = 1; i <=n; i++){
  		p.pb(i);
  	}
  	do{
  		bool con = true;
  		for(int i = 0; i < n - 1; i++){
  			if(count(all(adj[p[i]]), p[i+1]) == 0)
  			{
  				con = false;
  				break;
  			}
  		}
  		if(con) ans++;
  	}while(next_permutation(p.begin()+1, p.end()));
  	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*|In The Name of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a , a + 3);
    int b = a[0];
    int h = a[1];
    int area = 0.5 * b * h;
    cout << area << endl;
    return 0;
}


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

typedef struct Restaurant {
    int index;
    int score;
    char *city;
} Restaurant;

void swap(Restaurant *a, Restaurant *b) {
    Restaurant tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}
void show(Restaurant **list, int length) {
    for (int i = 0; i < length; i++) {
        printf("%s, %d\n", list[i]->city, list[i]->score);
    }
}

Restaurant **merge_sort(Restaurant **list, int length) {
    if (length == 0 || length == 1)
        return list;
    Restaurant **left = merge_sort(list, length / 2);
    Restaurant **right = merge_sort(list + (length / 2), length - length / 2);
    int i = 0;
    int j = 0;
    int k = 0;
    Restaurant **tmp = malloc(length * sizeof(Restaurant*));
    while (i < length / 2 || j < (length - length / 2)) {
        if (i == length / 2) {
            tmp[k++] = right[j++];
            continue;
        }
        if (j == (length - length / 2)) {
            tmp[k++] = left[i++];
            continue;
        }

        if(strcmp(left[i]->city, right[j]->city) > 0) { // b, aみたいな
            tmp[k++] =  right[j++];
        } else if(strcmp(left[i]->city, right[j]->city) == 0) {
            if (left[i]->score < right[j]->score) {
                tmp[k++] =  right[j++];
            } else {
                tmp[k++] = left[i++];
            }
        } else {
            tmp[k++] = left[i++];
        }
    }

    for (int i = 0; i < length; i++) {
        list[i] = tmp[i];
    }
    free(tmp);
    return list;
}

int main() {
    int N;
    scanf("%d", &N);
    Restaurant **S = malloc(N * sizeof(Restaurant*));
    //int *P = malloc((N + 1) * sizeof(int));

    for (int i = 0; i < N; i++) {
        char *city = malloc(10 * sizeof(char));
        int score;
        scanf("%s", city);
        scanf("%d", &score);
        S[i] = malloc(sizeof(Restaurant));
        S[i]->city = city;
        S[i]->score = score;
        S[i]->index = i + 1;
    }

    S = merge_sort(S, N);
    //swap(S[0], S[4]);
    for (int i = 0; i < N; i++) {
        printf("%d\n", S[i]->index);
    }

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <vector>

using namespace std;

int a[100010],f[100010];

int main()
{
    int n;scanf("%d",&n);
    for (int i=0;i<n;++i) scanf("%d",&a[i]);
    int ans=0;f[0]=1e9+1;
    for (int i=0;i<n;++i){
        int tmp=0;
        int ll=1,rr=ans;
        while (ll<=rr){
            int mid=(ll+rr)/2;
            if (f[mid]>=a[i]){
                tmp=mid;ll=mid+1;
            }
            else rr=mid-1;
        }
        if (f[tmp+1]<a[i]) f[tmp+1]=a[i];
        if (tmp+1>ans) ans=tmp+1;
    }
    printf("%d\n",ans);
}



Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

ll dp[200001][2][4];

int main(){
	int n;
	cin >> n;
	vector<ll> a(n+1);
	for (int i = 0; i <= 200000; i++){
		for (int j = 0; j < 2; j++){
			for (int k = 0; k < 4; k++){
				dp[i][j][k] = -LLINF;
			}
		}
	}
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	dp[1][0][0] = a[1];
	dp[1][1][1] = 0;
	for (int i = 2; i <= n; i++){
		for (int j = 0; j < 2; j++){
			for (int k = 0; k < 3; k++){
				if (dp[i-1][j][k] != -LLINF){
					if (j == 0){
						dp[i][1][k] = max(dp[i][1][k], dp[i-1][j][k]);
					}else{
						dp[i][0][k] = max(dp[i][0][k], dp[i-1][j][k] + a[i]);
						dp[i][1][k+1] = max(dp[i][1][k+1], dp[i-1][j][k]);
					}
				}
			}
		}
	}
	if (n%2) cout << max(dp[n][0][2], dp[n][1][1]) << endl;
	else cout << max(dp[n][0][1], dp[n][1][0]) << endl;
	
	return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<ll,pair<ll,ll>> pii;
typedef pair<ll,ll> pi;
typedef vector<ll> vl;

#define matrix vector<vector<ll>>
#define llmax LLONG_MAX
#define llmin LLONG_MIN
#define rep(i,n) for(ll (i)=0;(i)<n;++(i))
#define crep(i,m,n) for(ll (i)=m;(i)<n;++(i))
#define zero(a) memset((a),0,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)));
#define sq(a) ((a)*(a))
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define ff first
#define ss second

ll global=0;

// return nCr value
long long C(int n, int r) {
	if(r>n) return 0;
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;
    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }
    return ans;
}

// return whether number is prime or not
vector<ll> sieve(ll n){
    vector<ll> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i] && (long long)i * i <= n) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return is_prime;
}


void test_case();
int main(){
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    for(ll T=0;T<t;T++){
        test_case();
    }
    //**************************************************************************//
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

void test_case(){
    ll n,m;cin>>n>>m;
    vector<vector<char>>grid(n, vector<char>(m));
    rep(i,n){
        rep(j,m){
            cin>>grid[i][j];
        }
    }
    vector<vector<ll>>dp(n,vector<ll>(m,0));
    crep(i,1,n){if(grid[i][0]=='.')dp[i][0]=1;else break;}
    crep(j,1,m){if(grid[0][j]=='.')dp[0][j]=1;else break;}

    crep(i,1,n){
        crep(j,1,m){
            if(grid[i][j]=='#')continue;
            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }
    cout<<dp[n-1][m-1];
}


Measured memory_bytes: 12064
N = int(input())

n = 1
while True:
	if n * (n + 1) / 2 >= N:
		break
	else:
		n += 1
n = n - 1
if N == int(n * (n + 1) / 2):
	for i in range(1, n + 1):
		print(i)

else:
	s = int(N - n * (n + 1) / 2)
	for i in range(1,n - s + 1):
		print(i)
	for i in range(n - s + 1, n + 1):
		print(i + 1)


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

const int N = 100010;

int n;

vector<int> g[N];

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

  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : g[u]) {
      if (dist[v] == -1) {
        dist[v] = dist[u] + 1;
        q.push(v);
      }
    }
  }
  return dist;
}

int main() {
  cin >> n;

  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> d1 = bfs(0);
  vector<int> d2 = bfs(n - 1);

  int l = 0, r = 0;
  for (int i = 0; i < n; ++i) {
    if (d1[i] <= d2[i])
      ++l;
    else
      ++r;
  }

  if (l > r)
    cout << "Fennec" << endl;
  else
    cout << "Snuke" << endl;

  return 0;
}


Measured memory_bytes: 6656
/*
 * src.cpp
 *
 *  Created on: 2016/07/29
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_M=100,INF=1e8;

int n,m,k;
int G[2][MAX_M][MAX_M];

void warshall_floyd(){
	REP(t,2){
		REP(k,m){
			REP(i,m){
				REP(j,m){
					G[t][i][j]=min(G[t][i][j],G[t][i][k]+G[t][k][j]);
				}
			}
		}
	}
}

int main(){
	do{
		scanf("%d %d",&n,&m);
		if (n || m){
			REP(t,2){
				REP(i,m){
					REP(j,m){
						G[t][i][j]=INF;
					}
				}
			}
			REP(t,2){
				REP(i,m){
					G[t][i][i]=0;
				}
			}
			REP(i,n){
				int a,b,c,t;
				scanf("%d %d %d %d",&a,&b,&c,&t);
				a--;
				b--;
				G[0][a][b]=G[0][b][a]=c;
				G[1][a][b]=G[1][b][a]=t;
			}
			warshall_floyd();
			scanf("%d",&k);
			REP(i,k){
				int p,q,r;
				scanf("%d %d %d",&p,&q,&r);
				p--;
				q--;
				printf("%d\n",G[r][p][q]);
			}
		}
	}while(n || m);
	return 0;
}

Measured memory_bytes: 1264
#include<bits/stdc++.h>
#define ll long long
#define PI acos(-1)
#define INF 0x7f3f3f3f
#define L first
#define R second
#define pii  pair<int ,int>
#define pll  pair<long,long>
#define pb push_back
#define lowbit(x)  (x&-x)
#define fr(i,m,n) for( int i=m;i<n;++i)
#define fo(i,m,n) for(int i=m;i<=n;++i)
#define MM(a,b) memset(a,b,sizeof(a));
#define fin freopen("C:\\Users\\w\\Desktop\\ACM\\in.txt","r",stdin)
#define fot freopen("C:\\Users\\w\\Desktop\\ACM\\out.txt","w",stdout)
#define fcs fclose(stdin);fclose(stdout);


using namespace std;

inline void read(int&a){char ch;while(!(((ch=getchar())>='0')&&(ch<='9')));a=ch-'0';while(((ch=getchar())>='0')&&(ch<='9'))(a*=10)+=ch-'0';}

int main()
{
   int a,b,w;
   cin>>w>>a>>b;
   if(abs(a-b)-w>=0) cout<<abs(a-b)-w<<endl;
   else cout<<"0";

}













Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
  
  
    vector<int> vec_a(n);
    vector<int> vec_b(n);
    vector<int> vec_c(n);

    rep(i,n){
      cin >> vec_a.at(i);
    }
    rep(i,n){
        cin >> vec_b.at(i);
    }
    rep(i,n){
        cin >> vec_c.at(i);
    }
  
  	int ans = 0;
    int tmp = 0;
  	rep(i,n){
      int num = vec_a.at(i) - 1;
      ans += vec_b.at(num);
      
      if(i != 0 && tmp + 1 == num){
        ans += vec_c.at(tmp);
      }
      
      
      tmp = num;
      
      
    }



    cout << ans << endl;
    
}



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

const int inf=0x3f3f3f3f;
typedef long long LL;
LL n, m;

int main(){
    while(~scanf("%lld%lld", &n, &m)){
        LL ans=(1900*m+100*(n-m))*pow(2, m);
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    t1,t2=map(int,input().split())
    a1,a2=map(int,input().split())
    b1,b2=map(int,input().split())
    if a1<b1:
        a1,b1,a2,b2 = b1,a1,b2,a2

    d1 = a1*t1
    d2 = b1*t1

    dd1 = d1 - d2

    d1 += a2*t2
    d2 += b2*t2

    if d1 == d2:
        return "infinity"

    dd2 = d1 - d2

    if dd1 * dd2 > 0:
        return 0
    else:
        d1 += a1*t1
        d2 += b1*t1

        dd3 = d1 - d2

        if dd2 * dd3 > 0:
            return 1
        else:
            d1 += a2*t2
            d2 += b2*t2

            dd4 = d1 - d2
        if dd3 * dd4 > 0:
            return 2
        else:
            if dd1 > dd3:
                if dd1 % (dd1-dd3) == 0:
                    return (dd1 // (dd1-dd3) )*2
                else:
                    return (dd1 // (dd1-dd3) )*2+1
            else:
                if dd2 % (dd2-dd4) == 0:
                    return (dd2 // (dd2-dd4) )*2 +1
                else:
                    return (dd2 // (dd2-dd4) )*2+2



print(main())

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
int minPath[100007];
void dfs(int src, vector<int> adj[], bool visited[])
{
    visited[src] = true;
    // cout << src << " ";

    for (auto c : adj[src])
    {
        if (!visited[c])
            dfs(c, adj, visited);
    }
    return;


}
void dfs1(int src, vector<int> adj[], int curr, bool visited[])
{

    visited[src] = true;
    // minPath[src] = min(minPath[src], curr);
    minPath[src] = curr;

    for (auto c : adj[src])
    {
        if (!visited[c])
        {
            //  minPath[c] = minPath[src] + 1;
            dfs1(c, adj, src + 1, visited);
        }
    }
    //visited[src] = false;

}
void findAns()
{
    string s, t;
    cin >> s >> t;

    int ans = 0;

    for (int i = 0; i < s.size(); i++) if (s[i] != t[i]) ans++;
    cout << ans;

}
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("o1.txt", "w", stdout);
//     cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s" << "\n";
// #endif

    fastio;

    // ll int t;
    // cin >> t;,
    findAns();
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

ll f(ll x){
  if(x == -1)return 0;
  ll a = x;
  rep(i,x%4){
    a ^= x-i-1;
  }
  return a;
}

signed main() {
  ll a,b;cin>>a>>b;
  cout << (f(a-1) ^ f(b)) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

using namespace std;

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (d == 1 ? 1 : 0) << endl;
}


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

int main() {
	string s;
	cin >> s;
	for ( char c = 'a'; c <= 'z'; ++c ) {
		if ( s.find(c) == string::npos ) {
			cout << c << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>                                                   //---------------------------------------------------------------
                                                                    
# define ll long long   
# define ld long double                                               
# define mod 1000000007                                                   
# define MAX 100005
# define pi 3.141592653589793238                                                                                  //shortcut keys
                                                                                
# define pb push_back                                                                     
# define mp make_pair 
# define all(x) x.begin(),x.end()                                                      
                                                                  
# define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);        //---------------------------------------------------------------                                       
using namespace std;

ll power(ll x,ll y,ll m){            //power(x,y)=x^y  %m;
	if(y==0)return 1;
	int ll a=power(x,y/2,m);
	if(y%2){
		return (a*((a*x)%m))%m;
	}
	else{
		return (a*a)%m;
	}
}
ll mod_inverse(ll x,ll m){
	return power(x,m-2,m);
}
ll fact(ll n,ll m){
	if(n<=1)return 1;
	return (fact(n-1,m)*n)%m;
}
ll ncr(ll n,ll r,ll m){
	ll n1=1,d1=1,d2=1;
	n1=fact(n,m);d1=fact(r,m);d2=fact(n-r,m);
	ll ans=mod_inverse((d1*d2)%m,m);
	ans=(ans*n1)%m;
	return ans;
}
int main()
{
	ll n;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				ans+=__gcd(i,__gcd(j,k));
			}
		}
	}
	cout<<ans<<'\n';
}




Measured memory_bytes: 3624
import sys

inf = 1<<60

def solve():
    N, M = map(int, sys.stdin.readline().split())

    cost = [[inf]*N for i in range(N)]

    for mi in range(M):
        a, b, c = map(int, sys.stdin.readline().split())
        a, b = a-1, b-1
        cost[a][b] = cost[b][a] = c

    dist = [[0]*N for i in range(N)]

    for i in range(N):
        for j in range(i + 1, N):
            dist[i][j] = dist[j][i] = cost[i][j]

    for k in range(N):
        for i in range(N):
            for j in range(i + 1, N):
                dist[j][i] = dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    ans = 0

    for i in range(N):
        for j in range(i + 1, N):
            if cost[i][j] < inf and cost[i][j] != dist[i][j]:
                ans += 1

    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3316
#include <stdio.h>


int main(void){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	int i;
	for(i = n-1; i >= 0; i -= 2){
#ifdef DEBUG
printf(" |0 %d ", i);
#endif
		printf("%d ", a[i]);
	}
	if(n % 2 == 0){
		i++;
	}else{
		i += 3;
	}
	for( ; i < n; i += 2){
#ifdef DEBUG
printf(" |1 %d ", i);
#endif
		printf("%d ", a[i]);
	}
	printf("\n");
	return 0;
}

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))

int main() {
    int price = 700;
    string orders;

    cin >> orders;

    for(int i=0; i < orders.size(); i++) {
        char order = orders[i];
        if(order == 'o') {
            price += 100;
        }
    }
    cout << price << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef tuple<string, int, int> T;

int main(void) {
  int N;
  cin >> N;
  vector<T> v(N);
  for (int i = 0; i < N; i++) {
    string S;
    int P;
    cin >> S >> P;
    v[i] = T(S, P, i + 1);
  }
  sort(v.begin(), v.end(), [](T a, T b) {
    if (get<0>(a) != get<0>(b)) {
      return a < b;
    } else {
      return get<1>(a) > get<1>(b);
    }
  });
  for (int i = 0; i < N; i++) {
    cout << get<2>(v[i]) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double N, T, A;
  cin >> N >> T >> A;
  double gap = 1000;
  int ans = 0;
  
  for (int i = 0; i < N; i++) {
    double check = 0;
    double h;
    cin >> h;
    
    double d = T - h * 0.006;
    
    check = max(d - A, A - d);
    
    if (gap > check) {
      gap = check;
      ans = i + 1;
    }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;
char ss[500][501];
bool s[500][500];
int row[500], col[500];
int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%s", ss[i]);
        for(int j = 0; j < n; j++) {
            s[i][j] = ss[i][j] != '.';
            row[i] += s[i][j];
            col[j] += s[i][j];
        }
    }
    if(accumulate(row, row + n, 0) == 0) {
        puts("-1");
        return 0;
    }
    int ans = 999999;
    for(int i = 0; i < n; i++) {
        if(row[i] == n) {
            ans = 0;
            break;
        }
        ans = min(ans, n - row[i] + !col[i]);
    }
    ans += n - count(col, col + n, n);
    printf("%d\n", ans);
}


Measured memory_bytes: 640
import java.util.Scanner;

class Card {
	int number;
	String design;
	int value;
	
	Card(int n, String d, int v) {
		this.number = n;
		this.design = d;
		this.value = v;
	}
}
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Card[] A = new Card[n];
		for (int i = 0; i < n; i++) {
			A[i] = new Card(i, sc.next(), sc.nextInt());
		}
		quicksort(A, 0, n - 1);
		int i = 1, j, f = 1;
		while (i < n) {
			j = 0;
			while((f > 0) && (j < i)) {
				if ((A[i].value == A[j].value) && (A[i].number < A[j].number)) {
					f = 0;
					System.out.println("Not stable");
				}
				j++;
			}
			i++;
		}
		if (f > 0) {
			System.out.println("Stable");
		}
		for (i = 0; i < n; i++) {
			System.out.println(A[i].design + " " + A[i].value);
		}
	}
	
	public static void quicksort(Card[] A, int p, int r) {
		if (p < r) {
			int q = partition(A, p, r);
			quicksort(A, p, q - 1);
			quicksort(A, q + 1, r);
		}
	}
	public static int partition(Card[] A, int p, int r){
		int x = A[r].value;
		int i = p - 1;
		for (int j = p; j < r; j++){
			if (A[j].value <= x){
				i++;
				Card m = A[i];
				A[i] = A[j];
				A[j] = m;
			}
		}
		Card m = A[i + 1];
		A[i + 1] = A[r];
		A[r] = m;
		return i + 1;
	}

}



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

def comb_num(a, b):
    if a - b < b: b = a - b
    if b == 0: return 1
    if b == 1: return a

    numerator = [a - b + k + 1 for k in range(b)]
    denominator = [k + 1 for k in range(b)]

    for p in range(2,b+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (a - b) % p
            for k in range(p-1,b,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(b):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if N >= 2:
    num_n = comb_num(N,2)
else:
    num_n = 0

if M >= 2:
    num_m = comb_num(M,2)
else:
    num_m = 0

print(num_n + num_m)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int rows = scanner.nextInt();
        int arr[][] = new int[rows][3];
        int ans[][] = new int[rows][3];
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = scanner.nextInt();
                ans[i][j] = -1;
            }
        }
        
        System.out.println(maxVaca(arr, 0, -1, ans));
       

    }



    public static int get(int arr[][], int i, int j) {
        if (i >= arr.length || j >= arr.length) {
            return 0;
        }
        return arr[i][j];

    }

    public static int maxVaca(int arr[][], int i, int j, int ans[][]) {

        if (i > arr.length - 1) {
            return 0;
        }
        if (j >= 0 && ans[i][j] != -1) {

            return ans[i][j];
        }

        int max = Integer.MIN_VALUE;
        for (int k = 0; k < arr[0].length; k++) {
            if (k != j) {
                max = Math.max(arr[i][k] + maxVaca(arr, i + 1, k, ans), max);
            }

        }
        if (j != -1)
            ans[i][j] = max;
        return max;

    }

}

Measured memory_bytes: 72632
import Control.Monad

main = do
  s <- getLine
  let [x,y] = map (read ::String->Int) $ words s in
    if x /= 0 && y /= 0 then do
      putStr $ replicate y '#' ++ "\n"
      putStr $ join . replicate (x-2) $ "#" ++ replicate (y-2) '.' ++ "#\n"
      if x > 1 then putStr $ replicate y '#' ++ "\n" else return ()
      putStr "\n"
      main
    else
      return ()

Measured memory_bytes: 4152
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main()
{
  int a,b;
  cin >> a >> b ;
  
  cout << (b%a == 0 ? a+b : b-a) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int cost_min = -1;
  for (int i = -100; i <= 100; ++i) {
    int cost = 0;
    for (int j = 0; j < n; ++j) {
      cost += (i-a[j]) * (i-a[j]);
    }
    if (cost_min == -1) {
      cost_min = cost;
    } else {
      cost_min = min(cost, cost_min);
    }
  }
  cout << cost_min << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 9999999999999999
#define rep(i,m,n) for(ll i = m;i < n;i++)
#define rrep(i,m,n) for(ll i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<ll,ll>
#define tint tuple<int, int, int>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000010
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a/b;
        a -= t*b; swap(a, b);
        u -= t*v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  ll N, M, K;
  cin >> N >> M >> K;
  vector<ll> dp(N);
  dp[0] = M;
  rep(i, 1, N) dp[i] = dp[i - 1] * (M - 1) % mod;
  ll res = 0, comb = 1;
  rep(i, 0, K + 1) {
    res += dp[N - i - 1] * comb;
    res %= mod;
    comb = comb * (N - i - 1) % mod * modinv(i + 1, mod) % mod;
  }
  cout << res << endl;
}

Measured memory_bytes: 4816
s = gets.to_i

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

a = [s]
1000000.times{
  a.push(f(a[-1]))
}

h = {}

a.each.with_index{|x,i|
  if h[x]
    p i+1
    exit
  else
    h[x] = 1
  end
}

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

#define ll long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

using namespace std;
ll power(ll a,ll n)
{
          ll result=1;
          while(n>0)
          {
               if(n&1)
                    result=result*a;
               a=a*a;
               n=n>>1;
          }
          return result;
}
ll lcm(ll a,ll b)
{
          return ((a*b)/__gcd(a,b));
}
bool ispow2(ll n)
{
          return (ceil(log2(n))==floor(log2(n)));
}
bool isprime(ll n)
{
          if(n==1)
               return false;
          else if(n==2)
               return true;
          else
          {
               for(ll i=2;i*i<=n;++i)
               {
                    if(n%i==0)
                         return false;
               }
               return true;
          }
}

ll ncr(ll n,ll r)
{
    if(r > n - r)
          r = n - r;
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++)
     {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}

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

          int t=1;
          //cin>>t;
          while(t--)
          {
                    int n;
                    cin>>n;
                    int a[n];
                    ll ans=0;
                    for(int i=0;i<n;++i)
                         cin>>a[i];
                    for(int i=1;i<n;++i)
                    {
                         if(a[i]<a[i-1])
                         {
                              ans += a[i-1]-a[i];
                              a[i] = a[i-1];
                         }
                    }
                    cout<<ans;
          }
          return 0;
}


Measured memory_bytes: 4480
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  val n = br.readLine().toInt()
  val ref = "MARCH"

  val table = LongArray(ref.length)
  for(i in 1..n) {
    val s = br.readLine().first()
    val idx = ref.indexOf(s)
    if(idx != -1)
      table[idx]++
  }

  fun compute():Long {
    var acc = 0L
    for(i in ref.indices)
      for(j in i+1..ref.lastIndex)
        for(k in j+1..ref.lastIndex) {
          acc += table[i] * table[j] * table[k]
        }
    return acc
  }

  val ans = compute()
  println(ans)
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (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)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int a, b;
  cin >> a >> b;
  if (a >= 10 || b >= 10)
    pr(-1);
  else
    pr(a * b);
  return 0;
}

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

int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	vector<int> score(N);
	for (int i = 0; i < Q; i++) {
		int tmp;
		cin >> tmp;
		score.at(tmp - 1)++;
	}

	for (int i = 0; i < N; i++) {
		int tmp = K - (Q - score.at(i));
		if (tmp > 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int n   = Integer.parseInt(tmp[0]);
		long d  = Long.parseLong(tmp[1]);
		int ans = 0;

		for(int i = 0; i < n; i++) {

			long a   = scanner.nextLong();
			long b   = scanner.nextLong();
			double c = Math.sqrt(a * a + b * b);
			if(c <= d) {
				ans++;
			}

		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 59164
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp89 {
    class Program {
        static int ans = 0;

        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());

            var h = Console.ReadLine().Split().Select(int.Parse).ToList();

            CountAndSplitList(h);

            Console.WriteLine(ans);

        }

        static void CountAndSplitList(List<int> p_) {
            if (p_.Count() == 0) {
                return;
            }

            if (p_.Distinct().Count() == 1) {
                ans += p_.Min();    
                return;
            }

            ans += p_.Min();

            var h_new = p_.Select(x => x - p_.Min()).ToList();
            var a = new List<List<int>>();
            a.Add(new List<int>());
            int index = 0;

            for (int i = 0; i < h_new.Count(); i++) {
                if (h_new[i] != 0) {
                    a[index].Add(h_new[i]);
                }
                if (i != (h_new.Count() - 1) && h_new[i] == 0 && h_new[i + 1] != 0) {
                    a.Add(new List<int>());
                    index++;
                }
            }

            foreach (var element in a) {
                CountAndSplitList(element);
            }
        }
    }
}


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

int main(){
    string s;
    cin>>s;
    bool x=true;
    for(int i=0;i<3;i++){
        if(s[i]-s[i+1]==0) x=false;
    }
    if(x) cout<<"Good"<<endl;
    else cout<<"Bad"<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClarss
{
	public const long Giri = 1000000007;
	
	class Term
	{
		public int Start{get;set;}
		public int End{get;set;}
		public bool Right{get;set;}
	}
	
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		string[] a  = Input();
		double bo = 0;
		for(int i = 0; i < n; i++)
		{
			int av = int.Parse(a[i]);
			bo += 1d / av;
		}
		Console.WriteLine(1d / bo);
	}

	
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define abs(x,y) max(x,y)-min(x,y)
using namespace std;
int n, h[100005], dp[100005],cost(int x);
signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cin >> n;
  for(int i = 1;i <= n;i ++){
    cin >> h[i];
  }
  dp[0] = 1e9;
  cout << cost(n) << '\n';
  return 0;
}
int cost(int x){
  if(x == 1){
    dp[x] = 0;
    return dp[x];
  }
  dp[x] = min(dp[x - 2] + abs(h[x], h[x - 2]), cost(x - 1) + abs(h[x], h[x - 1]));
  return dp[x];
}

Measured memory_bytes: 7536
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main() {
  // input
  string s; cin >> s;
 
  // compute
  int counter = 0;
  int max = 0;
  int ssize =s.size();
  
  for(int i =0; i < ssize; i++){
     bool a,c,g,t;
      a = (s.at(i) == 'A');
      c = (s.at(i) == 'C');
      g = (s.at(i) == 'G');
      t = (s.at(i) == 'T');
    
    if (a || c || g || t) {
        counter++;
         if(counter > max){
             max = counter;
         }
     }else{
         counter = 0;
     }
  }
 
  // output  
  cout << max << endl;
  
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;

typedef long long ll;

int main(int argc, char **argv)
{
    ll N;
    cin >> N;
    ll A[N];
    for (ll i = 0; i < N; ++i) cin >> A[i];

    map<ll, ll> m;
    for (ll i = 0; i < N; ++i) {
        if (m.find(A[i]) != m.end())
            m[A[i]]++;
        else
            m[A[i]] = 1;
    }
    //for (auto itr = m.begin(); itr != m.end(); ++itr)
    //    cout << itr->first << ", " << itr->second << endl;

    //count all
    ll sum = 0;
    for (auto itr = m.begin(); itr != m.end(); ++itr) {
        if (itr->second > 1) {
            sum += ((itr->second) * ((itr->second) - 1)) / 2;
        }
    }
    for (ll i = 0; i < N; ++i) {
        ll target = A[i];
        ll t = sum;
        ll c = m[target];
        if (c > 1) {
            t -= (c * (c - 1)) / 2;
        }
        t += ((c - 1) * (c - 2)) / 2;
        cout << t << endl;
    }

    return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << pair_var.first << " " << pair_var.second ;return os;}

// head


int m,n,k,res,tmp,tmp2,tmp3,h,w,x,y;
VI a;
deque<PII> que;
string s;
//VI b;
vector<PII> g[2100600];
int b[2100000];
int c[210] = {};
int rui[210000];
set<int> ch;
VI ab;
VI bb;

signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>s;
  int flag = 1;
  if(s[0] == s[1])flag = 0;
  if(s[1]==s[2])flag = 0;
  if(s[2]==s[3])flag = 0;
  if(flag)cout << "Good" << '\n';
  else cout << "Bad" << '\n';
}

Measured memory_bytes: 51200
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N = 0, K =0;
    cin >> N >> K;


    //本文
    //出力
    if(K==1) cout << 0 << endl;
    else if(K!=1)cout << N-K << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;

ll a[MAXN],b[MAXN];

int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=1; i<=n; ++i)
		scanf("%lld%lld",&a[i],&b[i]);
	
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	if(n&1)
		printf("%lld",b[(n+1)/2] - a[(n+1)/2] + 1);
	else
	{
		ll mn = a[n/2] + a[n/2+1];
		ll mx = b[n/2] + b[n/2+1];
		printf("%lld",mx - mn + 1);
	}
	return 0;
}

Measured memory_bytes: 6912
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
ios::sync_with_stdio(false);cin.tie(nullptr);
    int n;
    cin>>n;
    int x;
    vector<queue<int>> b(n);
    rep(i,n)rep(j,n-1){
        cin>>x;
        x --;
        b[i].emplace(x);
    }
    set<int> seen;
    int ans=-1;
    bool f=1;
    while(f){
        f=0;
        rep(i,n){
            if(b[i].empty()) continue;
            int op=b[i].front();
            if(op<i) continue;
            if(seen.count(op) || seen.count(i)) continue;
            if(b[op].front() != i) continue;
            f=1;
            b[i].pop();
            b[op].pop();
            seen.emplace(op);
            seen.emplace(i);
        }
        ans ++;
        seen.clear();
    }
    rep(i,n){
        if(!b[i].empty()){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 7980