akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 500005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,D,Q;
int a[MAXN],b[MAXN],f[MAXN];
void Solve() {
    read(N);read(D);
    for(int i = 1 ; i <= N ; ++i) read(a[i]);
    for(int i = N ; i >= 1 ; --i) {
	if(a[i] - b[i + 1] <= b[i + 1] + 1) b[i] = a[i] + b[i + 1];
	else b[i] = b[i + 1];
    }
    f[0] = D;
    for(int i = 1 ; i <= N ; ++i) {
	f[i] = min(abs(f[i - 1] - a[i]),f[i - 1]);
    }
    read(Q);
    int p;
    for(int i = 1 ; i <= Q ; ++i) {
	read(p);
	if(f[p - 1] > b[p + 1]) puts("YES");
	else puts("NO");
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pbs(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main(){
	int l,r,d;
	cin>>l>>r>>d;
	int ans=0;
	while(l<=r){
		if(l%d==0)ans++;
		l++;
	}
	cout<<ans;
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
const int maxn =  1e6 + 10;
#define ll long long
#define ios std::ios::sync_with_stdio(false)
const ll INF(0x3f3f3f3f3f3f3f3fll);
const int inf(0x3f3f3f3f);
#define int long long
#define pb(a) push_back(a)
#define debug(a) cout << "a : " << a << '\n'
#define mp(a , b) make_pair(a ,b)
const int mod = 998244353;
const double eps = 1e-6;
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-48;isdigit(ch=getchar());res=(res<<1)+(res<<3)+ch - 48);flag&&(res=-res);}
template<typename T>void Out(T x){if(x<0)putchar('-'),x=-x;if(x>9)Out(x/10);putchar(x%10+'0');}

signed main()
{
    ios,cin.tie(0);
    string a , b;
    cin >> a >> b;
    int ans = inf;
    for(int i = 0 ; i < a.size() ; i ++){
        if(i + b.size() > a.size())break;
        int num = 0;
        for(int j = 0 ; j < b.size() ; j ++){
            if(a[i + j] != b[j]) num ++;
        }
        ans = min(ans , num);
    }
    cout << ans << '\n';
    return 0;
}

/*
1
12
LLLLRRLRRRLL
*/


Measured memory_bytes: 3640
n = int(input())
ti, xi, yi = 0, 0, 0

ans = 'Yes'
for i in range(n):
  t, x, y = map(int, input().split())
  t_diff = t - ti
  x_diff = x - xi
  y_diff = y - yi
  dis_diff = abs(x_diff) + abs(y_diff)
  if not(t_diff >= dis_diff and t_diff % 2 == dis_diff % 2):
    ans = 'No'
    break
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve(){
    ll v,e;cin>>v>>e;
    vvl d(v,vl(v,LINF));
    rep(i,v)d[i][i]=0;
    rep(i,e){
        ll s,t,dd;cin>>s>>t>>dd;
        d[s][t]=dd;
    }
    rep(i,v)rep(j,v)rep(k,v){
        chmin(d[j][k],d[j][i]+d[i][k]);
    }
    rep(i,v){
        if(d[i][i]<0){
            cout<<"NEGATIVE CYCLE"<<endl;
            return;
        }
    }
    rep(i,v){
        rep(j,v){
            if(j>0)cout<<" ";
            if(d[i][j]>=LINF/2)cout<<"INF";
            else cout<<d[i][j];
        }
        cout<<endl;
    }
}

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



Measured memory_bytes: 3244
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

struct Info{
	Info(){
		dir_x = dir_y = -1;
		tmp = used = false;
	}
	int dir_x,dir_y;
	bool used,tmp;

};

void func(int N){
	Info info[N][N];

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++)scanf("%d %d",&info[i][k].dir_x,&info[i][k].dir_y);
	}

	int count = 0,x,y,new_x,new_y;

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			if(info[i][k].used == false){
				info[i][k].tmp = true;
				x = info[i][k].dir_x,y = info[i][k].dir_y;
				while(info[y][x].used == false && info[y][x].tmp == false){
					info[y][x].tmp = true;
					new_x = info[y][x].dir_x;
					new_y = info[y][x].dir_y;
					x = new_x;
					y = new_y;
				}
				if(y == i && x == k){
					count++;

					info[i][k].used = true;
					x = info[i][k].dir_x,y = info[i][k].dir_y;
					while(info[y][x].used == false){
						info[y][x].used = true;
						new_x = info[y][x].dir_x;
						new_y = info[y][x].dir_y;
						x = new_x;
						y = new_y;
					}

				}else{

					info[i][k].tmp = false;
					x = info[i][k].dir_x,y = info[i][k].dir_y;
					while(info[y][x].used == false && info[y][x].tmp == true){
						info[y][x].tmp = false;
						new_x = info[y][x].dir_x;
						new_y = info[y][x].dir_y;
						x = new_x;
						y = new_y;
					}

				}
			}
		}
	}
	printf("%d\n",count);
}


int main(){

	int N;
	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func(N);
	}


}

Measured memory_bytes: 2704
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ld, ld> pdd;

void solve();

const int N = 2e5 + 10;

int main() {
    fast_cin();

    int t=1;
    // cin >> t;
    while(t--) {
        solve();
    }
}

void solve() {
    int n;
    cin >> n;
    // int a[N];
    // for (int i=1; i <= n; i++) { 
    //     cin >> a[i];
    // }

    string s, t;
    cin >> s >> t;
    
    vector<char> v;
    int index = 0;
    for (int i=1; i <= 2*n; i++) {
        if (i&1) v.pb(s[index]);
        else v.pb(t[index++]);
    }
    
    for (int i=0; i <= v.size()-1; i++) {
        cout << v[i];
    }
    cout << '\n';
}


Measured memory_bytes: 256
//============================================================================
// Name        : ATcoder.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int N,M;
int D[9][9]={};
int calc(int n1[9],int n2){
	int ans=0;
	int flg=1;
	if(n2>N){
		for(int i=2;i<N+1;++i){
			if(D[n1[i]][n1[i-1]]!=1)flg=0;
		}
		return flg;
	}
	for(int i=2;i<N+1;++i){
		if(n1[i]==0){
			n1[i]=n2;
			ans+=calc(n1,n2+1);
			n1[i]=0;
		}
	}
	return ans;
}

int main() {

	cin>>N>>M;
	int A,B;
	for(int i=0;i<M;++i){
		cin>>A>>B;
		D[A][B]=1;
		D[B][A]=1;
	}

	int n3[9]={};
	n3[1]=1;
	cout<<calc(n3,2)<<endl;


	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    n, k = getlist()
    print(math.ceil(n / k))


if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Measured memory_bytes: 38384
#include <array>
#include <iostream>

struct Dice {
  std::array<int, 7> num;

  void rotate(char n) {
    int tmp;
    switch (n) {
    case 'E':
      tmp = num[1];
      num[1] = num[4];
      num[4] = num[6];
      num[6] = num[3];
      num[3] = tmp;
      break;
    case 'N':
      tmp = num[1];
      num[1] = num[2];
      num[2] = num[6];
      num[6] = num[5];
      num[5] = tmp;
      break;
    case 'S':
      tmp = num[1];
      num[1] = num[5];
      num[5] = num[6];
      num[6] = num[2];
      num[2] = tmp;
      break;
    case 'W':
      tmp = num[1];
      num[1] = num[3];
      num[3] = num[6];
      num[6] = num[4];
      num[4] = tmp;
      break;
    default:
      throw;
    }
  }

  void print() {
    std::cout << "\t" << num[1] << std::endl;
    std::cout << num[4] << " " << num[2] << " " << num[3] << " " << num[5]
              << std::endl;
    std::cout << "\t" << num[6] << std::endl;
  }

  bool equal(Dice d) {
    for (int k = 0; k < 2; k++) {
      d.rotate('E');
      for (int i = 0; i < 4; i++) {
        d.rotate('N');
        for (int j = 0; j < 4; j++) {
          bool is_same = true;
          for (int l = 1; l <= 6; l++)
            if (num[l] != d.num[l])
              is_same = false;
          if (is_same) return true;
          d.rotate('E');
        }
      }
    }
    return false;
  };

  bool operator==(Dice d) { return equal(d); }
};

int main() {
  std::array<int, 7> num1, num2;
  for (int i = 1; i <= 6; i++) {
    std::cin >> num1[i];
  }
  for (int i = 1; i <= 6; i++) {
    std::cin >> num2[i];
  }

  Dice d1 = {num1}, d2 = {num2};
  std::cout << ((d1 == d2) ? "Yes" : "No") << std::endl;
}



Measured memory_bytes: 3116
# ABC078 D - ABS
N,Z,W = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
if N == 1:
    ans = abs(A[0]-W)
else:
    ans = max(abs(A[N-1]-W),abs(A[N-1]-A[N-2]))

print(ans)


Measured memory_bytes: 3188
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
F = sys.stdin
N, K = F.readline().rstrip().split()
N = int(N)
K = int(K)
D = list(map(str,F.readline().rstrip().split()))

answer = None

# pdb.set_trace()

while answer is None:
    Nstr = str(N)
    for i in range(len(Nstr)):
        if Nstr[i] in D:
            N += 1
            break

        if i == len(Nstr) - 1:
            answer = N

print(answer)


Measured memory_bytes: 5376
package main

import "fmt"

func gcd(a, b int64) int64 {
	r := a % b
	if r == 0 {
		return b
	}
	return gcd(b, r)
}

func main() {
	var a, b, c, d int64
	fmt.Scan(&a, &b, &c, &d)

	dC := b/c - (a-1)/c
	dD := b/d - (a-1)/d
	l := c * d / gcd(c, d)
	dCandD := b/l - (a-1)/l

	fmt.Println(b - a + 1 - (dC + dD - dCandD))
}


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

// C++ program to demonstrate 
// Basic Euclidean Algorithm 
// Function to return  
// gcd of a and b 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
// Dr

int main() {
ll a,b,i,j,count=0;
	a=360;
	cin>>b;
count=gcd(a,b);
j=(a*b)/count;
cout<<j/b;

return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<cstring>
#define p pair<int,int>
#define P pair<int,p>
using namespace std;

P a[100000];
int Par[10000], Rank[10000];
int saiki(int b) {
	if (Par[b] == b)return b;
	return Par[b]=saiki(Par[b]);
}
void unite(int b, int c) {
	b = saiki(b); c = saiki(c);
	if (Rank[b] > Rank[c]) {
		Par[c] = b;
	}
	else if (Rank[b] < Rank[c]) {
		Par[b] = c;
	}
	else {
		Par[c] = b;
		Rank[b]++;
	}
}
signed main() {
	int b, c; cin >> b >> c;
	for (int d = 0; d < c; d++) {
		int e, f, g; scanf("%d%d%d", &e, &f, &g);
		a[d] = P(g, p(e, f));
	}
	sort(a, a + c);
	int cost = 0;
	for (int i = 0; i < b; i++)Par[i] = i;
	for (P s : a) {
		if (saiki(s.second.first) != saiki(s.second.second)) {
			cost += s.first;
			unite(s.second.first, s.second.second);
		}
	}
	cout << cost << endl;
}

Measured memory_bytes: 4412
def gdc(x,y):
  if x%y==0:
    return y
  return gdc(y, x%y)

def main():
  K = int(input())
  total = 0

  for a in range(K):
    for b in range(K):
      for c in range(K):
        total += gdc(c+1, gdc(b+1, a+1))
  print(total)
  
if __name__ == '__main__':
    main()

Measured memory_bytes: 79008
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=998244353;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=(1<<14)+5,M=205;
int r[N],rt[2][N<<1],lim,d,ilim;
void NTT(int *A,int ty){
    fp(i,0,lim-1)if(i<r[i])swap(A[i],A[r[i]]);
    for(R int mid=1;mid<lim;mid<<=1)
        for(R int j=0,t;j<lim;j+=(mid<<1))
            fp(k,0,mid-1)
                A[j+k+mid]=dec(A[j+k],t=mul(rt[ty][mid+k],A[j+k+mid])),
                A[j+k]=add(A[j+k],t);
    if(!ty)fp(i,0,lim-1)A[i]=mul(A[i],ilim);
}
int coef[N],fac[N],ifac[N],f[N],g[N],n,m,res;
inline int C(R int n,R int m){return m>n?0:1ll*fac[n]*ifac[m]%P*ifac[n-m]%P;}
void init(int n=10000){
    fp(i,1,(1<<d)-1)r[i]=(r[i>>1]>>1)|((i&1)<<(d-1));
    for(R int t=(P-1)>>1,i=1,x,y;i<lim;i<<=1,t>>=1){
        x=ksm(3,t),y=ksm(332748118,t),rt[0][i]=rt[1][i]=1;
        fp(k,1,i-1)
            rt[1][i+k]=mul(rt[1][i+k-1],x),
            rt[0][i+k]=mul(rt[0][i+k-1],y);
    }
	fac[0]=ifac[0]=1;fp(i,1,n)fac[i]=mul(fac[i-1],i);
	ifac[n]=ksm(fac[n],P-2);fd(i,n-1,1)ifac[i]=mul(ifac[i+1],i+1);
	coef[0]=0;fp(i,1,lim>>1)coef[i]=ifac[i+2];
	NTT(coef,1);
}
void calc(){
	fp(i,0,n)g[i]=mul(f[i],ifac[i]);fp(i,n+1,lim-1)g[i]=0;
	NTT(g,1);
	fp(i,0,lim-1)g[i]=mul(g[i],coef[i]);
	NTT(g,0);
	fp(i,0,n)f[i]=add(mul(g[i],fac[i+2]),mul(f[i],(i*(i+1)>>1)+1));
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	lim=1,d=0;while(lim<=(n<<1))lim<<=1,++d;
	ilim=ksm(lim,P-2);
	init();
	f[0]=1;
	fp(i,1,m)calc();
	fp(i,0,n)upd(res,mul(C(n,i),f[i]));
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 640
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N, M = map(int, input().split())
h = []
for _ in range(N):
    A, B = map(int, input().split())
    heappush(h, (A, B))

count = 0
ans = 0
while M > 0:
    a, b = heappop(h)
    ans += a
    if b - 1 > 0:
        heappush(h, (a, b - 1))
    M -= 1

print(ans)




Measured memory_bytes: 92760
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

int lft[1000000];
int rgt[1000000];

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    lft[0] = 0;
    for (int i = 0; i < N - 1; i++) {
        if (S[i] == 'W') {
            lft[i + 1] = lft[i] + 1;
        } else {
            lft[i + 1] = lft[i];
        }
    }
    rgt[N - 1] = 0;
    for (int i = N - 1; i > 0; i--) {
        if (S[i] == 'E') {
            rgt[i - 1] = rgt[i] + 1;
        } else {
            rgt[i - 1] = rgt[i];
        }
    }
    ll ans = llmax;
    for (int i = 0; i < N; i++) {
        ll num = lft[i] + rgt[i];
        if (num < ans) {
            ans = num;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5892
#include <stdio.h>

unsigned long gcd(unsigned long x,unsigned long y)
{
  if (x % y == 0) {
    return y;
  }else{
    return gcd(y, x%y);
  }
}

int main() 
{
  unsigned long a, b, c, d;
  scanf("%lu %lu %lu %lu", &a, &b, &c, &d);
 
  unsigned long c_num = b/c - (a-1)/c;
  unsigned long d_num = b/d - (a-1)/d;
  unsigned long g = gcd(c, d);
  unsigned long e = (c/g)*d;
  unsigned long e_num = b/e - (a-1)/e;

  unsigned long ans = (b - a + 1) - (c_num + d_num - e_num);
  printf("%lu", ans);
  
  return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define pb push_back
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N;cin>>N;
    map<int,int>memo;
    int ans=0;
    REP(i,N){
        int a;cin>>a;
        memo[a]++;
        memo[a+1]++;
        memo[a-1]++;
    }
    for(auto it=memo.begin();it!=memo.end();it++){
        ans=max(ans,it->second);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
typedef long long ll;
typedef long double ld;
using namespace std;
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;



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

  int r;
  cin >> r;
  cout << r * r << endl;
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    string s;
    cin >> s;
    string ans = "No";
    if (s.find("AC") != string::npos) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var S = ReadLine();

        var ACGT = "ACGT";

        var ans = 0;
        var count = 0;

        foreach (var c in S)
        {
            if (ACGT.Contains(c))
                count++;
            else
                count = 0;

            ans = Math.Max(ans, count);
        }

        WriteLine(ans);
    }
}


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

int main() {
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    vector<int> sqmod;
    for(int i = 1; i < N; ++i)
      sqmod.push_back((i*i)%N);
    sort(begin(sqmod), end(sqmod));
    sqmod.erase(unique(begin(sqmod), end(sqmod)), end(sqmod));
    vector<int> cnt((N - 1) / 2 + 1, 0);
    for(int i : sqmod) {
      for(int j : sqmod) {
        if(i == j) continue;
        int diff = i - j;
        if(diff < 0) diff += N;
        if(diff > (N - 1)/2) diff = N - diff;
        cnt[diff]++;
      }
    }
    for(int i = 1; i < (int)cnt.size(); ++i) {
      cout << cnt[i] << endl;
    }
  }
}

Measured memory_bytes: 1324
S = input()
C_cnt = 0
if S[0] == 'A' and S[1].islower() and S[-1].islower():
    temp = S[2:len(S)]
    if temp.count('C') == 1:
        for t in temp:
            if t != "C" and t.isupper() == True:
                print("WA")
                exit()
        else:
            print("AC")
            exit()
print("WA")


Measured memory_bytes: 8996
import numpy as np

# 約数列挙(nを含む)
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n // i)

    return divisors


N = int(input())
A = np.array(input().split(), dtype=np.int64)
A.sort()
A = A[::-1]


p0 = make_divisors(A[0])
p1 = make_divisors(A[-1])
P = p0 | p1

for p in sorted(P)[::-1]:
    c = np.count_nonzero(A % p == 0)
    if c == N - 1:
        break

q = np.gcd.reduce(A)
if p > q:
    print(p)
else:
    print(q)


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

void cal(int p,vector<int>&x,vector<int>&y){
	int64_t sum=0;
	for(int i=0;i<x.size();++i){
		sum+=pow(abs(x.at(i)-y.at(i)),p);
	}
	cout<<fixed<<setprecision(8)<<pow(sum,1.0/p)<<"\n"s;
}

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>x(n),y(n); for(auto&&i:x)cin>>i; for(auto&&i:y)cin>>i;
	cal(1,x,y);
	cal(2,x,y);
	cal(3,x,y);
	double mx=0;
	for(int i=0;i<n;++i){
		mx=max(mx,1.0*abs(x.at(i)-y.at(i)));
	}
	cout<<fixed<<setprecision(8)<<mx<<"\n"s;
}


Measured memory_bytes: 3488
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



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

    set<int> s;
    rep(i,k){
        int a;cin>>a;
        s.insert(a);
    }

    for(int i=n;i < 100001;i++)
    {
        int x=i;
        bool flag=true;
        while(x>0){
            if(s.count(x%10))flag=false;
            x/=10;
        }
        if(flag){
            cout<<i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define ss second
#define ff first 
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
const ll M=1000000007;
ll power(ll x,ll n,ll m){if(n==0)return 1;else if(n%2==0)return (power(((x%m)*(x%m))%m,n/2,m))%m;else return ((x%m)*power(x,n-1,m)%m);}
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n - r;ll ans = 1;
int i;for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}return ans;}
ll nCrModpDP(ll n, ll r, ll p){ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
    for (ll i = 1; i <= n; i++){ 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll ncrmod(ll n, ll r, ll p){ 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
   return (ncrmod(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p;  
} 
ll modInverse(ll a,ll m) 
{ 
   ll m0 = m; 
   ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
       ll q = a / m; 
       ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
int dx[] = {1,-1,0,0,1,1,-1,-1}; 
int dy[] = {0,0,1,-1,-1,1,-1,1}; 
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin>>n;
ll num[n];
ll ans=0;
ll max=0;
for(int i=0; i<n; i++){
cin>>num[i];
if(num[i]<max){
ans+=(max-num[i]);
}
else
max=num[i];
}
cout<<ans;
return 0;
}

Measured memory_bytes: 5268
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
 
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
 
    vector<ll> p(a);
    vector<ll> q(b);
    vector<ll> r(c);
 
    rep(i, a) cin >> p[i];
    rep(i, b) cin >> q[i];
    rep(i, c) cin >> r[i];
 
    sort(p.begin(), p.end(), greater<ll>());
    rep(i, x) r.push_back(p[i]);
 
    sort(q.begin(), q.end(), greater<ll>());
    rep(i, y) r.push_back(q[i]);
 
    sort(r.begin(), r.end(), greater<ll>());
 
    ll res = 0;
    rep(i, x+y) res += r[i];
 
    cout << res << endl;
 
    return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmax(T& ref, const T value) {
	if (ref < value) ref = value;
}

const ll mod = 1000000007;

ll m = 1e9 + 7;

class modint {
	using u64 = std::int_fast64_t;

public:
	u64 a;
	modint(const u64 x = 0) noexcept : a(x% m) {}
	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	modint operator+(const modint rhs) const noexcept {
		return modint(*this) += rhs;
	}
	modint operator-(const modint rhs) const noexcept {
		return modint(*this) -= rhs;
	}
	modint operator*(const modint rhs) const noexcept {
		return modint(*this) *= rhs;
	}
	modint& operator+=(const modint rhs) noexcept {
		a += rhs.a;
		if (a >= m) {
			a -= m;
		}
		return *this;
	}
	modint& operator-=(const modint rhs) noexcept {
		if (a < rhs.a) {
			a += m;
		}
		a -= rhs.a;
		return *this;
	}
	modint& operator*=(const modint rhs) noexcept {
		a = a * rhs.a % m;
		return *this;
	}
};

ostream& operator<<(ostream& stream, const modint& data) {
	stream << data.a;
	return stream;
}

ll n;
vector<vector<int>> g;

vector<map<int, modint>> children;

modint dfs(int current, int prev) {
	//頂点current が黒である組み合わせ
	modint i = 1;
	for (auto c : g[current]) {
		if (c == prev) continue;
		modint t = dfs(c, current) + 1;
		children[current][c] = t;
		i *= t;
	}
	return i;
}

vector<modint> dp1;

void dfs2(int current, int parent, modint pValue) {
	//親ノードの情報マージ
	auto& child = children[current];
	if (parent != -1) {
		child[parent] = pValue + 1;
	}
	modint& ans = dp1[current];
	ans = 1;
	for (auto p : child) {
		ans *= p.second;
	}

	//publish
	auto csize = child.size();
	if (csize <= 0) return;
	vector<int> next;
	for (auto p : child) {
		next.push_back(p.first);
	}
	auto b = child.begin();
	auto rb = child.rbegin();
	vector<modint> pos(csize);
	vector<modint> neg(csize);
	pos[0] = b->second;
	neg[csize-1] = rb->second;
	for (int i = 1; i < csize; i++) {
		b++;
		rb++;
		pos[i] = pos[i - 1] * b->second;
		neg[csize -1-i] = neg[csize - i] * rb->second;
	}
	for (int i = 0; i < csize; i++) {
		if (next[i] == parent) continue;
		modint p = 1;
		if (i > 0) {
			p *= pos[i - 1];
		}
		if (i < csize-1) {
			p *= neg[i + 1];
		}
		dfs2(next[i], current, p);
	}
}

int main() {
	cin >> n >> m;
	g.resize(n);
	dp1.resize(n);
	children.resize(n);
	rep(i, n-1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0, -1);
	dfs2(0, -1, 0);
	rep(i, n) {
		cout << dp1[i] << endl;
	}
    return 0;
}


Measured memory_bytes: 44120
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n+2);
  a[0] = a[n+1] = 0;
  REP(i, n) cin >> a[i+1];
  ll sum = 0;
  REP(i, n) sum += abs(a[i+1]-a[i]);
  sum += abs(a[n]);

  REP(i, n){
    ll ans = sum - (abs(a[i+1]-a[i])+abs(a[i+2]-a[i+1])) + abs(a[i+2]-a[i]);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2048
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d", &N)
	flg := false
	m := 4294967296
	M := 4294967296
	for x := -2147483648; x != 0; x /= -2 {
		min := (4 - m) / 6
		max := (M - 1) / 3
		//fmt.Printf("%d %d %d %d\n", x, N, min, max)
		if min <= N && N <= max {
			if flg == true {
				fmt.Print("0")
			}
		} else {
			N -= x
			flg = true
			fmt.Print("1")
		}
		if x < 0 {
			M /= 4
		} else {
			m /= 4
		}
	}
	if !flg {
		fmt.Print("0")
	}
	fmt.Print("\n")
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>

using namespace std;

double h = 0.5;

double Prob(int n, int k) {
	int num = 0;
	while (n < k) {
		n <<= 1;
		num++;
	}
	return pow(h, num);
}

int main(void) {
	int n, k;
	double ans = 0.0, d;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		ans += Prob(i, k);
	printf("%.12lf\n", ans / n);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int A, B, C;
	cin >> A >> B >> C;

	auto result = "NO";
	for (auto i = 1; i <= 100; ++i)
	{
		if (A * i % B == C)
		{
			result = "YES";
			break;
		}
	}
	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B&lang=jp
// Getting Started - Greatest Common Divisor

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <set>
#include <cmath>

using namespace std;
using i64 = long long;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    while (0 < y) {
        auto r = x % y;
        x = y, y = r;
    }

    return x;
}

int main() {
    int x, y;
    cin >> x >> y;
    auto ans = gcd(x, y);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}



void solve()
{
	int n;
	cin >> n;
	ll a[n];
	vector<ll> p;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	rep(i, n){
		if(i && a[i] == a[i - 1]) p.pb(a[i++]);
	}
	sort(p.rbegin(), p.rend());
	if(sz(p) <= 1) cout << 0;
	else cout << p[0] * p[1];
}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 4652
#include <iostream>
using namespace std;
const int max_num=10;

char a[max_num][max_num];
int h,w,k;
int count=0;

void inputnumbers(){
	cin >> h >> w >> k;
	for(int i=0;i<h;i++)
			cin >> a[i];
}

void printnumbers(char c[][max_num]){
	cout << h << ' ' << w << ' ' << k << endl;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)
		cout << c[i][j] ;
	cout << endl;
	}

}
void printmatrix(char c[][max_num]){
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)
		cout << c[i][j] ;
	cout << endl;
	}
}

void printrawcol(bool *rawcol){
	for(int i=0;i<h+w;i++)
		cout << (int) rawcol[i];
	cout << endl;
}

int countnumber(char c[][max_num]){
	int num=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(*(*(c+i)+j)=='#')
				num++;
		}
	}
	return num;
}


void resetraw(int i,char c[][max_num]){
	for(int j=0;j<w;j++)
		c[i][j]='&';
}

void resetcolumn(int j,char c[][max_num]){
	for(int i=0;i<h;i++)
		c[i][j]='!';
}

int rawtolinear(int raw){
	return raw;
}
int coltolinear(int col){
	return h+col;
}

void lineartorc(int l,int *raw,int *col){
	if(l<h){
		*raw=l;
		*col=-1;
	}
	else{
		*raw=-1;
		*col=l-h;
	}
}

int countsolvnum(bool *rawcol,char c[][max_num],int *n){
	char b[max_num][max_num];
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			b[i][j]=c[i][j];
	for(int i=0;i<h;i++)
		if(rawcol[rawtolinear(i)])
			resetraw(i,b);
	for(int j=0;j<w;j++)
		if(rawcol[coltolinear(j)])
			resetcolumn(j,b);
	//printnumbers(b);
	*n=countnumber(b);
	return *n;
}
int countsolvnum(bool *rawcol,char c[][max_num]){
	int n;
	char b[max_num][max_num];
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			b[i][j]=c[i][j];
	for(int i=0;i<h;i++)
		if(rawcol[rawtolinear(i)])
			resetraw(i,b);
	for(int j=0;j<w;j++)
		if(rawcol[coltolinear(j)])
			resetcolumn(j,b);
	n=countnumber(b);
	//printrawcol(rawcol);
	//printmatrix(b);
	//cout << n << endl;
	return n;
}



void copymatrix(char d[][max_num],char s[][max_num]){
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			d[i][j]=s[i][j];
}

bool dfs(int i,bool *rawcol){
	bool hantei=true;
	char b[max_num][max_num];
	copymatrix(b,a);
	bool rawcolcopy[2*max_num];
	//cout << "dfs i=" << i << endl;
	for(int i=0;i<h+w;i++)
		rawcolcopy[i]=rawcol[i];
	if(i==h+w){
		if(countsolvnum(rawcolcopy,a)==k)
			count++;
	for(int i=0;i<h+w;i++)
		if(rawcol[i]==false)
			hantei=false;
	return hantei;
	}
	if(dfs(i+1,rawcolcopy))
		return false;
	if((rawcolcopy[i]=true) && dfs(i+1,rawcolcopy))
		return true;
	return false;
}


int main() {
	bool rowcol[2*max_num];

	inputnumbers();
	//printnumbers(a);
	//cout << countnumber(a) << endl;

	/*for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			cout<<rawtolinear(i)<<' '<<coltolinear(j)<<' ' <<endl;
	for(int i=0;i<h+w;i++){
		int r,c;
		lineartorc(i,&r,&c);
		cout <<i<<' '<< r << ' ' << c <<endl;
	}*/

	for(int i=0;i<h+w;i++)
		rowcol[i]=false;
	//cout << "total = " << count << endl;
	dfs(0,rowcol);
	cout << count << endl;

	return 0;
}


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

int main()
{
	int N, M;
	int K;

	int cnt_k = 0;

	cin >> N >> M;

	int A;

	int cnt_p[M];
	for (int i=0; i<M; i++)
		cnt_p[i] = 0;


	for (int j = 0; j < N; j++) 
	{
		cin >> K;
		for (int  i = 0; i < K; i++)
		{
			cin >> A;

			(cnt_p[A-1])++;
		}
		cout << endl;
	}

	for (int i = 0; i < M; i++)
	{
	    // cout << cnt_p[M];
		if (cnt_p[i] == N)
		{
			cnt_k++;
		}
	}
	cout << cnt_k << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
    import java.util.Scanner;
     
    public class Main {
    	public static void main(String[] args) {
    		Scanner scan = new Scanner(System.in);
    		int n = scan.nextInt();
    		HashSet<Long> list = new HashSet<Long>();
     
    		for(int i = 0;i < n;i++) {
    			list.add(scan.nextLong());
    		}
     
    		if(n != list.size()) {
    			System.out.println("NO");
    		}else {
    			System.out.println("YES");
    		}
    	}
    }

Measured memory_bytes: 71696
n=int(input())
t,a=map(lambda x: int(x), input().split())
h=list(map(lambda x: int(x), input().split()))
ans=0
min_t = 1000
for i in range(n):
    tmp_t=t-0.006*h[i]
    if min_t > abs(a-tmp_t):
        ans=i+1
        min_t = abs(a-tmp_t)
print(ans)

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

int main() {
	int n, ans = 0, tmp;
	scanf("%d", &n), tmp = n;
	while(n) {
		ans += n % 10;
		n /= 10;
	}
	if(tmp % 10 == 0) printf("%d\n", ans * 10);
	else printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<map>
using namespace std;
const int MAXX=3000;
const int MAXN=100010;
map<long long ,int >num;
map<long long ,bool >vis;
int prime[MAXN],v[MAXN];
int n,tot,ans;
long long a[MAXN],b[MAXN];
inline void init(){
    for(int i=2;i<=MAXX;++i){
    	if(!v[i]){
    		prime[++tot]=i;
    		v[i]=i;
    	}
    	for(int j=1;j<=tot;++j){
    		if(i*prime[j]>MAXX||v[i]<prime[j])break;
    		v[i*prime[j]]=prime[j];
    	}
    }
}
inline void solve(long long x,int pos){
	long long u=1;
	long long v=1;
    for(int i=1;i<=tot;++i){
    	if(x%prime[i]==0){
        long long cnt=0;
        while(x%prime[i]==0){
           x/=prime[i];
           cnt++;
         }
          cnt%=3;
          if(cnt==1){
          	u*=prime[i];
          	v*=prime[i]*prime[i];
          }
          if(cnt==2){
          	u*=prime[i]*prime[i];
          	v*=prime[i];
          }
       }
       if(x==1)break;
    }
    if(x>1){
    	long long t=(long long)sqrt(x);
    	u*=x;
    	if((t*t)==x)v*=t;
    	else v*=x*x;
    }
    a[pos]=u;
    b[pos]=v;
    num[u]++;
}
int main(){
    init();
    scanf("%d",&n);
    for(int i=1;i<=n;++i)cin>>a[i];
    for(int i=1;i<=n;++i)solve(a[i],i);
    for(int i=1;i<=n;++i){
    	if(!vis[a[i]]){
    		vis[a[i]]=1;
    		vis[b[i]]=1;
    		if(a[i]==b[i])ans++;
    		else ans+=max(num[a[i]],num[b[i]]);
    	}
    }
    cout<<ans<<endl;	
    return 0;
}

Measured memory_bytes: 26880
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    string s;cin >> s;
    map<char,int> mp;
    for(auto a : s)mp[a]++;
    if(mp.size() == 2){
        bool r = true;
        for(auto a : mp){
            if(a.second != 2)r = false;
        }
        if(r){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import math
import sys
import heapq
from operator import itemgetter
import itertools
input = sys.stdin.readline

# a = int(input().rstrip())
# a, b = map(int, input().rstrip().split())
# D = list(map(int, input().rstrip().split()))
# H = [int(input().rstrip()) for _ in range(L)]
# DD = [[0 for j in range(100)] for i in range(200)]
# dict = {} ## dictionary

# a = sorted(a, key=lambda x: x[1]))
# if __name__ == '__main__':




def gcd(big, small):
	if big < small:
		tmp = big
		big = small
		small = tmp

	if small == 0:
		return big
	else:
		return gcd(small, big % small)


if __name__ == '__main__':
	N, X = map(int, input().rstrip().split())
	x_s = list(map(int, input().rstrip().split())) + [X]
	x_s = sorted(x_s)

	sec_s = []
	for i in range(1, N+1):
		sec_s.append(x_s[i] - x_s[i-1])
	
	ans = sec_s[0]
	for sec in sec_s[1:]:
		ans = gcd(ans, sec)
	print(ans)

Measured memory_bytes: 14380
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



class BIT {//binary indexed tree, Fenwick treeとも
	int lg;
	std::vector<int> bit;
public:
	BIT() {
	}
	void init(int size) {
		bit.assign(size + 1, 0);
		lg = size;
		while (lg & lg - 1)lg &= lg - 1;
	}
	void add(int i, int x) {//i番目にx加える
		i++;//BIT添え字は1～ｎだから
		while (i < (int)bit.size()) {
			bit[i] += x;
			i += i & -i;
		}
	}
	int sum(int a)const {//[0,a]の和
		a++;
		int res = 0;
		while (0 < a) {
			res += bit[a];
			a -= a & -a;
		}
		return res;
	}
	int sum(int a, int b)const {//[a,b]の合計
		return sum(b) - sum(a - 1);
	}
};



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

	BIT bit[26];
	int n;
	string s;
	cin >> n >> s;

	rep(i, 26)bit[i].init(n);
	rep(i, s.size()) {
		int d = s[i] - 'a';
		bit[d].add(i, 1);
	}

	int q;
	cin >> q;
	rep(_, q) {
		int t;
		cin >> t;
		if (t == 1) {
			int p;
			char c;
			cin >> p >> c;
			p--;
			bit[s[p] - 'a'].add(p, -1);
			bit[c - 'a'].add(p, 1);
			s[p] = c;
		}
		else {
			int x, y;
			cin >> x >> y;
			x--; y--;
			int ans = 0;
			rep(i, 26) {
				int cnt = bit[i].sum(y);
				if (0 < x)cnt -= bit[i].sum(x - 1);
				if (cnt)ans++;
			}
			cout << ans << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 51740
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define endl "\n"

// const ll mod = 1e9 + 7;
const ll mod = 998244353;
const ll sz = 1e6 + 5;
vector<ll> fac(sz, 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 nCr(ll n, ll r) { return ( ( ( (fac[n] * powmod(fac[n-r], mod-2)) % mod ) * powmod(fac[r], mod-2) ) % mod ); }
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }
ll lcm(ll a, ll b) { return (a / gcd(a,b)) * b; }
ll extended_gcd(ll a, ll b, ll &x, ll &y) {
    if (b == 0) { x = 1; y = 0; return a; }
    ll xx, yy;
    ll res = extended_gcd(b, a%b, xx, yy); x = yy; y = xx - yy * (a / b);
    return res;
}

// * ALways PASS arrays, strings etc to functions BY REFERENCE

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    // for (ll i = 2; i < sz; i++)
    //     fac[i] = (fac[i-1] * i) % mod;
    
    int t = 1;
    // cin >> t;

    while(t--) {
        ll n, x, m;
        cin >> n >> x >> m;
        
        vector<ll> arr, sm;
        map<ll, ll> mpp;
        
        arr.pb(x);
        sm.pb(x);
        mpp[x] = 0;
        int sz = 1;
        
        while (sz < n) {
            ll xx = (arr[sz-1] * arr[sz-1]) % m;
            if (mpp.count(xx))
                break;
            
            arr.pb(xx);
            sm.pb(sm.back() + xx);
            mpp[xx] = sz;
            sz += 1;
        }
        
        ll res = sm.back();
        if (sz < n) {
            ll xx = (arr[sz-1] * arr[sz-1]) % m;
            ll indx = mpp[xx];
            
            ll par_sm = sm.back();
            par_sm -= (indx == 0 ? 0 : sm[indx-1]);
            
            ll itr = (n-sz) / (sz-indx);
            res += (par_sm * itr);
            ll rem = (n-sz) % (sz-indx);
            if (rem != 0)
                res += (sm[indx + rem - 1] - (indx == 0 ? 0 : sm[indx-1]));
        }
        
        cout << res << endl;
    }
    
	return 0;
}


Measured memory_bytes: 15008
#include<bits/stdc++.h>
using namespace std ;
int main () {
    int a , b ;
    cin>>a>>b;
    string s ;
    cin>>s;
    for(int i=0;i<a+b+1; ++i){
    if(i==a){
    if(s[i]!='-'){
    cout<<"No\n";
    return 0;
    }
    }
    else{
    if(!(s[i]<='9' && s[i]>='0')){
    cout<<"No\n";
    return 0;
    }

    } 
    }
    cout<<"Yes\n";
  
}

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

int num[233333], n, k;

bool check(int x)
{
    int ls = 0;
    for (int i = 1; i <= n; i++)
    {
        int lss = 0;
        if (num[i] % x == 0)
            lss = -1;
        ls += num[i] / x + lss;
    }
    if (ls > k)
        return 0;
    return 1;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> n >> k;
    int l = 1, r = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> num[i];
        r = max(num[i], r);
    }
    while (l < r)
    {
        int mid = (l + r) / 2;
        if (check(mid))
        {
            r = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 4324
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>
#include <bitset>

using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

using bit = std::bitset<50>;

int main()
{
    using namespace std;

    int a, b, k;
    cin >> a >> b >> k;

    set<int> se;

    for (int i = 0; i < k; ++i)
    {
        if (a + i <= b)
            se.emplace(a + i);
        if (b - i >= a)
            se.emplace(b - i);
    }

    for (auto e : se)
    {
        cout << e << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
if N % 2 == 0:
    print(N * (N-2) // 2)
    for i in range(1,N):
        for j in range(i+1, N+1):
            if i + j != N + 1:
                print(i, j)
else:
    print((N - 1) ** 2 // 2)
    for i in range(1, N-1):
        for j in range(i+1, N):
            if i + j != N:
                print(i, j)
    for i in range(1, N):
        print(i, N)

Measured memory_bytes: 9188
#include<stdio.h>

int prime[497];

void iniprm(){
  int i;
  for(i=2;i<497;i++){
    prime[i]=1;
  }
}

int mkprm(){
  int i;
  int m=0;
  prime[0]=0;
  prime[1]=0;
  iniprm();
  for(i=2;i<497;i++){
    if(prime[i]==1){
      int j;
      for(j=2*i;j<497;j+=i){
	prime[j]=0;
      }
    }
  }
  for(i=0;i<497;i++){
    if(prime[i]==1){
      m++;
    }
  }
  return m;
}

void doit(int n){
  int m=mkprm();
  int prmlst[m];
  int i;
  int j=0;
  int cnt=0;
  for(i=0;i<497;i++){
    if(prime[i]==1){
      prmlst[j]=i;
      j++;
    }
  }
  for(i=n+1;i<=2*n;i++){
    int f=0;
    int j=0;
    while((prmlst[j]<i)&&(j<m)&&(f==0)){
      if(i%prmlst[j]==0){
	f=1;
      }
      j++;
    }
    if(f==0){
      cnt++;
    }
  }
  printf("%d\n",cnt);
}

int main(){
  int n;
  scanf("%d",&n);
  while(n!=0){
    doit(n);
    scanf("%d",&n);
  }
  return 0;
}

Measured memory_bytes: 600