akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s;

		int n;

		try {
			s = br.readLine();
			n = Integer.parseInt(s);

			int[][] tri = new int[n][3];
			int i, j;
			i = j = 0;

			while (null != (s = br.readLine())) {
				Scanner sc = new Scanner(s);
				j = 0;
				while (sc.hasNext()) {
					tri[i][j] = sc.nextInt();
					j++;
				}
				Arrays.sort(tri[i]);
				i++;
			}

			//
			for (i = 0; i < n; i++) {
				int a, b, c;
				a = tri[i][0];
				b = tri[i][1];
				c = tri[i][2];
				if (c * c == a * a + b * b) {
					System.out.println("YES");
				} else {
					System.out.println("NO");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}

Measured memory_bytes: 61732
N = gets.to_i

require 'prime'

nd = ->(n){n.prime_division.inject(1){|r, (_, e)| r * (e + 1)}}
ds = ->(n){n.prime_division.inject([1]){|a, (p, e)| (0 .. e).map{|k| p**k}.product(a).map{|x, y| x*y}} - [1]}
ans = nd[N - 1] - 1
ds[N].each do |k|
  n = N
  n /= k while n%k == 0
  ans += 1 if n%k == 1
end
puts ans

Measured memory_bytes: 2556
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
typedef long long ll;

int n,z,w;
int a[2000];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n >> z >> w;
    REP(i,n) cin >> a[i];
    ll ans1 = (n>1 ? abs(a[n-2] - a[n-1]) : 0); // last Y
    ll ans2 = abs(a[n-1] - w); // last X
    cout << max(ans1,ans2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	int ans = INT_MAX;
	for(int i = -100; i <= 100; ++i) {
		int sum = 0;
		
		for(int j = 0; j < n; ++j) {
			sum += (i - a[j]) * (i - a[j]);
		}
		
		ans = min(ans, sum);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define boost ios::sync_with_stdio(false); cin.tie(0)
#define ll 				long long int
#define ld 				long double
#define mk 				make_pair
#define pb 				push_back
#define f				first
#define s				second
#define fo(i,a,b) 		for(i=a;i<b;i++)
#define foe(i,a,b) 		for(i=a;i<=b;i++)
#define all(x)			x.begin(),x.end()
// #define vi 				vector<int>
#define vl 				vector <long long int>
// #define pii 			pair <int,int>
#define pll 			pair <long long int, long long int>
// #define vpii			vector< pair<int,int> >
#define vpll 			vector < pair <long long int,long long int> >
#define MOD				1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;


int main()
{
	boost;
	ll n;
	cin >> n;
	ll arr[n], i;
	bool zero = false;
	fo(i, 0, n) {
		cin >> arr[i];
		if (arr[i] == 0)zero = true;
	}
	if (zero) {
		cout << 0;
		return 0;
	}
	bool poss = true;
	ll ans = 1;
	fo(i, 0, n)
	{
		if (arr[i] <= (1000000000000000000 / ans))
			ans *= arr[i];
		else {
			poss = false;
			break;
		}
	}
	if (!poss)cout << -1;
	else cout << ans;



	return 0;
}

Measured memory_bytes: 4432
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,c,result=0,nw=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  int l[LIMIT2]={0},r[LIMIT2]={0};
  int lCount=0,rCount=0;
  
  scanf("%lld %lld %lld",&n,&k,&c);
  scanf("%s",s);
  
  rep(i,n){
    //donyoku mae
    if(nw >= 1){
      nw--;
      continue;
    }else if(s[i]=='x'){
      continue;
    }
    l[lCount]=i+1;
    lCount++;
    nw = c;
  }
  nw = 0;
  for(i=n-1;i>=0;i--){
    //donyoku ketsu
    if(nw >= 1){
      nw--;
      continue;
    }else if(s[i]=='x'){
      continue;
    }
    r[k-1-rCount]=i+1;
    rCount++;
    nw = c;
  }
  rep(i,min(lCount,rCount)){
    //printf("%d %d\n",l[i],r[i]);
    if(l[i]==r[i]) printf("%d\n",l[i]);
  }
  return 0;
}



Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	long double a, b, c;
	cin >> a >> b >> c;
	a = sqrt(a);
	b = sqrt(b);
	c = sqrt(c);
	long double eps = 1.0e-14;
	if (a + b + eps < c)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N;
  cin >> N;
  VEC<int> A(N);
  REP(i, 0, N) cin >> A[i];
  REP(i, 0, N) {
    if (A[i] % 2 == 0) {
      if (A[i] % 3 == 0 || A[i] % 5 == 0)
        continue;
      else {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout<<"APPROVED"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
#define mod 1000000007
//#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

ll f(vvl s,vl c,vl &last,ll depth){
    ll ret = -inf;
    ll retind = 0;
    rep(i,26){
        ll minus = 0;
        rep(j,26){
            if(j != i) minus += c[j]*(depth-last[j]);
        }
        if(ret < s[depth][i]-minus){
            ret = s[depth][i]-minus;
            retind = i;
        }
    }
    last[retind] = depth;
    return retind;
}

int main(){
    ll d;
    cin>>d;
    vl c(26);
    rep(i,26) cin>>c[i];
    vvl s(d,vl(26));
    rep(i,d) rep(j,26) cin>>s[i][j];
    vl last(26,0);
    rep(i,d){
        ll tmp = f(s,c,last,i);
        cout<<tmp+1<<endl;
    }
    return 0;
}

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

int main() {
	int N; cin >> N;
	vector<string> a(N);
	set<string> S;
	for(int i = 0; i < N; i++) {
		cin >> a[i];
		S.insert(a[i]);
	}

	if(S.size() != N) {
			cout << "No"<<endl;
			return 0;
	}

	for(int i = 1; i < N; i++) {
		int end = a[i-1].length() - 1;
		if(a[i-1][end] != a[i][0]) {
			cout << "No"<<endl;
			return 0;
		}
	}
	cout << "Yes"<<endl;
}


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

#define M 1000003/* your task データ数以上の素数*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]){
    /* your task */
  int i=0, flag=0;
  int hash;
  long long sum;
  sum = getKey(str);

  while(i<M){
    hash = (h1(sum)+ i*h2(sum)) % M;
    if(H[hash][0]=='\0'){
      flag=0;
      break;
    }else  if(strcmp(H[hash], str) == 0){
      flag=1;
      break;
    }
    i++;
  }

  return flag;
}

int insert(char str[]){
    /* your task */
  int i=-1;
  int hash;
  long long sum;
  sum = getKey(str);

  do{
    i++;
    hash = (h1(sum)+ i*h2(sum)) % M;
    //printf("[%s] p:%d i:%d\n", str, hash, i);  //デバッグ用
  }while(H[hash][0]!='\0');
  //printf("**[%s] p:%d i:%d\n", str, hash, i);  //デバッグ用
  strcpy(H[hash], str);
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 14280
import java.util.*;
 
public class Main {
	Scanner sc = new Scanner(System.in);
 
	public static void main(String[] args) {
		new Main();	
	}
 
	public Main() {
		new aoj506().doIt();
	}
	class aoj506{
		StringBuilder cnt(char ctr[],int length){
			StringBuilder result = new StringBuilder();
			int count = 1;
			char num = ctr[0];
			for(int i = 1;i < length;i++){
				if(num == ctr[i])count++;
				else {
					result.append(count);
					count = 1;
					result.append(num);
					num = ctr[i];
				}
			}
			result.append(count);
			result.append(num);
			return result;
		}
		void doIt(){
			while(true){
				int n = sc.nextInt();
				if(n == 0)break;
				String m = sc.next();
				StringBuilder sb = new StringBuilder();
				sb.append(m);
				for(int i = 0;i < n;i++){
					char ctr[] = new char[sb.length()];//????????????????????????
					sb.getChars(0, ctr.length, ctr, 0);
					sb = cnt(ctr,ctr.length);
				}
				System.out.println(sb);
			}
		}
	}
}

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

int main() {

    string S;
    cin >> S;

    int itr = S.length();
    string cut;

    while (S.length() > 0) {
        cut = S.substr(itr-5, 5);
        if (cut == "dream" || cut == "erase") {
            itr = itr - 5;
            S = S.substr(0, itr);
            continue;
        }
        cut = S.substr(itr-6, 6);
        if (cut == "eraser") {
            itr = itr - 6;
            S = S.substr(0, itr);
            continue;
        }
        cut = S.substr(itr-7, 7);
        if (cut == "dreamer") {
            itr = itr - 7;
            S = S.substr(0, itr);
            continue;
        }
        cout << "NO" << endl;
        return 0;
    }

    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 596
// Comment
//

#include <bits/stdc++.h>

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
using ll = long long;
using pi = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 3e5 + 100;

int N, Sum[2][MAX_N];
char S[MAX_N];
int main() {
	cin >> N;
	scanf("%s", S+1);
	for(int i=1; i<=N; i++) Sum[0][i] = Sum[0][i-1] + (S[i] == 'E');
	for(int i=N; i>=1; i--) Sum[1][i] = Sum[1][i+1] + (S[i] == 'W');

	int ans = 0;
	for(int i=1; i<=N; i++) ans = max(ans, 1 + Sum[0][i-1] + Sum[1][i+1]);
	printf("%d\n", N-ans);
	return 0;
}


Measured memory_bytes: 6388
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define ll long long
#define fm_t  ll t;cin>>t;while(t--)
#define fr(i,a,b) for( ll i=a;i<b;i++)
#define fr1(i,n,a) for( ll i=n-1;i>=a;i--)
#define sz(x) (ll)(x).size()
#define all(v)  (v).begin(), (v).end()
#define Sort(x) sort(x.begin(),x.end())
#define ms(a) memset(a,0,sizeof(a))
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
const ll mod = 998244353;
#define Mod 1000000007

#define inf 1e18
#define ld long double
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll >
#define pi pair<ll, ll>
#define ppi pair<pair<ll, ll>, ll>
#define ump unordered_map<ll,ll>
#define pri priority_queue< pair<ll,ll> , vector< pair<ll,ll> >, greater< pair<ll,ll> > >
void ingraph(vl graph[], ll m){ll x, y;fr(i,0,m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}

#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)

//setprecision(10)
//greater<int>()
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}


ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll modinv(ll a){
    return modpower(a,mod-2);
}   
     
int main()
{
      
  fast;
  string s,t;
  cin>>s>>t;

  ll n=sz(s);
  ll m=sz(t);
  ll dp[n+1][m+1];
  ms(dp);
  for(ll i=1;i<=n;i++)
  {
    for(ll j=1;j<=m;j++)
    {
        dp[i][j]=max(dp[i-1][j],dp[i][j]);
        dp[i][j]=max(dp[i][j-1],dp[i][j]);
        if(s[i-1]==t[j-1])
        {
          //cout<<s[i-1]<<endl;
          dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
        }
    }
  }
  //cout<<dp[n][m]<<endl;
  string ans="";
  ll i=n;ll j=m;
  while(i>0&&j>0)
  {

      if(dp[i][j]==dp[i-1][j])
        i--;
      else if(dp[i][j]==dp[i][j-1])j--;
      else {
        i--;
        j--;
        ans+=s[i];
      }
  }
  reverse(all(ans));
  cout<<ans<<endl;

    
//cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
return 0;
}

Measured memory_bytes: 73856
// ayy
// ' lamo
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld; //CARE
typedef complex<ld> pt;
#define fi first
#define se second
#define pb push_back
const ld eps=1e-8;
const int inf=1e9+99;
const ll linf=1e18+99;
const int P=1e9+7;










const int N=200<<10;
int a[N],b[N];

int32_t main() {
	int n; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",a+i);
	int m; scanf("%d",&m); for(int i=0;i<m;i++) scanf("%d",b+i);
	sort(a,a+n);
	sort(b,b+m);
	int j=0;
	for(int i=0;i<m;i++) {
		for(;j<n && a[j]<b[i];) ++j;
		if(j==n || a[j]!=b[i]) goto die;
		++j;
	}
	printf("YES\n");
	return 0;
	die:;
	printf("NO\n");
}













Measured memory_bytes: 1792
cards = {
		"S": [0 for n in range(13)],
		"H": [0 for n in range(13)],
		"C": [0 for n in range(13)],
		"D": [0 for n in range(13)]
}
t = int(input())
for n in range(t):
	a,b = input().split()
	cards[a][int(b)-1] = 1

for a in ("S", "H","C", "D"):
	for b in range(13):
		if cards[a][b] == 0:
			print(a,b+1)

Measured memory_bytes: 7752
//
//  main.cpp
//  ITP1-8-B
//
//  Created by h3037153 on 2017/08/22.
//  Copyright ?? 2017??´ h3037153. All rights reserved.
//
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(){
    int i=0,num=0,x=0,ii;
    char number[1000]={};
       while(1){
           scanf("%c",&number[i]);
           if(number[0]=='0'){
               break;
           }
           if(number[i]==0x30){
                x=0;
                num+=x;
               }
           if(number[i]==0x31){
               x=1;
               num+=x;
           }
           if(number[i]==0x32){
               x=2;
               num+=x;
           }
           if(number[i]==0x33){
               x=3;
               num+=x;
           }
           if(number[i]==0x34){
               x=4;
               num+=x;
           }
           if(number[i]==0x35){
               x=5;
               num+=x;
           }
           if(number[i]==0x36){
               x=6;
               num+=x;
           }
           if(number[i]==0x37){
               x=7;
               num+=x;
           }
           if(number[i]==0x38){
               x=8;
               num+=x;
           }
           if(number[i]==0x39){
               x=9;
               num+=x;
           }
           if(number[i]=='\n'){
            cout<<num<<endl;
               number[i]={};
               i=0;
               num=0;
               i--;
           }
           ++i;
    }
    //char n=0x30;0
    //char n1=0x31;1
    
    //cout<<n1<<endl;
    
    return 0;
}

Measured memory_bytes: 3148
package main

import (
	"fmt"
)

func main() {
	var n, x int
	for {
		fmt.Scan(&n, &x)

		if n == 0 && x == 0 {
			break
		}

		var count int
		for i := 1; i <= n; i++ {
			for j := i + 1; j <= n; j++ {
				for k := j + 1; k <= n; k++ {
					if i+j+k == x {
						// fmt.Println(i, j, k)
						count++
					}
				}
			}
		}
		fmt.Println(count)
	}
}



Measured memory_bytes: 1124
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int K = scan.nextInt();
        int C = scan.nextInt()+1;
        String S = scan.next();
        char[] d = S.toCharArray();
        int[] l = new int[K];
        int index = 0;
        int i = 0;
        while(i < N && index < K) {
            if (d[i] == 'o') {
                l[index++] = i;
                i += C;
                continue;
            }
            i += 1;
        }
        int[] r = new int[K];
        index = K - 1;
        i = N - 1;
        while(0 <= i && 0 <= index) {
            if (d[i] == 'o') {
                r[index--] = i;
                i -= C;
                continue;
            }
            i -= 1;
        }
        for (int j = 0; j < K; j++) {
            if (l[j] == r[j]) {
                System.out.println(l[j]+1);
            }
        }
    }
}


Measured memory_bytes: 50824
n = int(input())
A = tuple(map(int, input().split()))
sa = sum(A)

from collections import Counter
AC = dict(Counter(A))
Q = int(input())
for _ in range(Q):
    f, to = map(int, input().split())
    if f in AC:
        fcount = AC.pop(f)
        AC.setdefault(to, 0)
        AC[to] += fcount
        sa += fcount*(to-f)
    print(sa)


Measured memory_bytes: 20876
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
	double x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed << setprecision(5);
	cout << pow((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2),0.5) << endl;
	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

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

int main()
{
    cout << fixed << setprecision(15);
    string S, T;
    cin >> S;
    cin >> T;

    REP(i, S.length()){
        if(S[i] != T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3532
#include <cstdio>

using namespace std;

int parse_int()
{
    int n = 0, c;
    while (1)
    {
        c = getchar_unlocked();
        if ('0' <= c && c <= '9')
            n = n * 10 + c - '0';
        else
            break;
    }
    return n;
}

template <size_t N>
struct Solver
{
    bool is_prime[N + 1];
    short ans[N + 1];
    constexpr Solver() : is_prime(), ans()
    {
        is_prime[0] = false;
        is_prime[1] = false;
        for (size_t i = 2; i <= N; i++)
        {
            is_prime[i] = true;
        }
        for (size_t prime = 2; prime <= N; prime++)
        {
            if (is_prime[prime])
            {
                for (size_t q = prime * 2; q <= N; q += prime)
                {
                    is_prime[q] = false;
                }
            }
        }
        for (size_t i = 1; i <= N; i++)
        {
            ans[i] += ans[i - 1];
            if (is_prime[i] && is_prime[(i + 1) / 2])
            {
                ans[i] += 1;
            }
        }
    }
};

int main()
{
    // auto M = 100000;
    auto solver = Solver<100000>();

    int Q = parse_int();
    for (size_t i = 0; i < Q; i++)
    {
        int l = parse_int();
        int r = parse_int();
        auto ans = solver.ans[r] - solver.ans[l - 1];
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 896
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = np.array(read().split(), np.int64)

A = A.reshape(N, M)

def f(A):
    if A.shape[1] == 0:
        return 10**9
    count = np.bincount(A[:, 0])
    n = count.max()
    i = count.argmax()
    A = A.ravel()
    A = A[A != i]
    A = A.reshape(N, -1)
    return min(n, f(A))

print(f(A))

Measured memory_bytes: 133372
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
   input! {
      a: i64,
      v: i64,
      b: i64,
      w: i64,
      t: i64,
   }
   if v <= w {
      println!("NO");
      return;
   }
   let dr = (b - a).abs();
   let dv = (v - w).abs();
   let dt = (dr - 1) / dv + 1;
   if dt <= t {
      println!("YES");
   } else {
      println!("NO");
   }
}


Measured memory_bytes: 2160
#include <algorithm>

#include <bitset>

#include <tuple>

#include <cstdint>

#include <cstdio>

#include <cctype>

#include <assert.h>

#include <stdlib.h>

#include <stdio.h>

#include <cassert>

#include <cfloat>

#include <climits>

#include <cmath>

#include <complex>

#include <ctime>

#include <deque>

#include <fstream>

#include <functional>

#include <iomanip>

#include <iostream>

#include <iterator>

#include <list>

#include <limits>

#include <map>

#include <memory>

#include <queue>

#include <random>

#include <set>

#include <stack>

#include <string>

#include <unordered_map>

#include <unordered_set>

#include <utility>

#include <vector>

#include <math.h>
using namespace std;
int main() {
    string S, T;
    cin >> S >> T;
    int Tsize = T.size();
    if (T.substr(0, Tsize-1) == S) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
  


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

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

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

ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}

int main() {
  ll A,B; cin >>A >>B;
  cout <<lcm(A,B) <<endl;
  return 0;
}


Measured memory_bytes: 3616
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,A,B,C,D = I()
maze = s()
Flag = 0
for i in range(A,max(C,D)):
    if maze[i-1:i+1] == '##':
        print('No')
        exit()
if C < D:
    print('Yes')
    exit()
for i in range(B-1,D):
    if maze[i-1:i+2] == '...':
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 77788
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int a = scan.nextInt();
    int b = scan.nextInt();

    long[] c = new long[n];

    int pre = scan.nextInt();

    for (int i=0;i<n-1;i++){
      int x = scan.nextInt();
      long dis = (long) (x-pre)*a;
      pre = x;
      if (dis > b){
        dis = b;
      }
      c[i] = dis;
    }

    long sum = 0;
    for (int i=0;i<n;i++){
      sum += c[i];
    }

    System.out.println(sum);

  }

}


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

using namespace std;

const long long inf = 1e18;

long long f(long long bb, long long nn) {
  if (nn < bb) {
    return nn;
  }
  return f(bb, nn / bb) + nn % bb;
}

int main() {
  long long n, s;
  cin >> n >> s;
  if (n < s) {
    cout << -1 << endl;
  } else if (n == s) {
    cout << n + 1 << endl;
  } else {
    long long ans = inf;
    // case : b <= sqrt(n)
    for (long long b = 2; b * b <= n; b++) {
      if (f(b, n) == s) {
        ans = min(ans, b);
      }
    }
    // case : b > sqrt(n)
    // n = pb + q (p < b && q < b)
    // s = p + q
    // n = pb + s - p
    // n - s = p(b - 1)
    // (p < b) -> (p <= b - 1) -> p = [1, sqrt(n - s)]
    for (long long p = 1; p * p <= n - s; p++) {
      if ((n - s) % p == 0) {
        long long b = (n - s) / p + 1;
        long long q = n - p * b;
        if (0 <= p && 0 <= q && p < b && q < b && s == p + q && n == p * b + q) {
          ans = min(ans, b);
        }
      }
    }

    cout << (ans == inf ? -1 : ans) << endl;
  }
  
  return 0;
}


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

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n, q, time, tsum=0;
    string name;
    cin >> n >> q;
    queue<pair<string, int>> a;
    for(int i=0; i<n; i++){
        cin >> name >> time;
        a.push({name, time});
    }

    while(a.size()!=0){
        if(q<a.front().second){
            a.front().second -= q;
            a.push(a.front());
            tsum += q;
            a.pop();
        }else{
            cout << a.front().first << ' ' << tsum + a.front().second << endl;
            tsum += a.front().second;
            a.pop();
        }
    }

}


Measured memory_bytes: 6212
// https://beta.atcoder.jp/contests/abc104/tasks/abc104_c

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int D, G;
    cin >> D >> G;

	vector<int> P(D);
	vector<int> C(D);
    for(int i = 0; i < D; ++i){
        cin >> P[i] >> C[i];
    }

    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask){
		int num =0, s=0, rest_max = -1;
		for(int i=0;i<D;i++){
			if(mask >> i & 1){
				s += (100*(i+1)) * P[i] + C[i];
				num += P[i];
			}else{
				rest_max = i;
			}
		}

		if(s < G){
			int remain_score = G - s;
			// cout << remain_score << endl;
			int need = (remain_score + (100 * (rest_max+1)) - 1) / (100 * (rest_max+1));
			if(need >= P[rest_max]){
				continue;
			}else{
				num += need;
			}
		}
		ans = min(ans, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define ll int64_t
#define ull uint64_t
#define pii pair <int, int>
#define rep(i,n) for (int i = 0; i < int(n); ++ i)
using namespace std;

const int N = 4e6 + 5;
int n, m;
int dis[N];
int l[N];
vector <int> v;
queue <int> que;
vector <int> g[N];
vector <pii> e[N];

struct DSU {
	int par[N];
	inline int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); }
	inline void merge(int x, int y) { par[find(x)] = find(y); }
} dsu;

int main() {
	scanf("%d%d", &n, &m);
	rep(i, m) {
		int u, v, c;
		scanf("%d%d%d", &u, &v, &c);
		e[c].push_back(make_pair(u, v));
	}
	int tot = n;
	rep(c, N) {
		if (!e[c].size()) continue;
		v.clear();
		rep(i, e[c].size()) {
			v.push_back(e[c][i].first);
			v.push_back(e[c][i].second);
		}
		sort(v.begin(), v.end());
		v.erase(unique(v.begin(), v.end()), v.end());
		rep(i, v.size()) dsu.par[v[i]] = v[i];
		rep(i, e[c].size()) {
			dsu.merge(e[c][i].first, e[c][i].second);
		}
		rep(i, v.size()) {
			if (dsu.find(v[i]) == v[i]) {
				++ tot;
				l[v[i]] = tot;
			}
		}
		rep(i, v.size()) {
			g[v[i]].push_back(l[dsu.find(v[i])]);
			g[l[dsu.find(v[i])]].push_back(v[i]);
		}
	}
	memset(dis, -1, sizeof dis);
	que.push(1);
	dis[1] = 0;
	while (!que.empty()) {
		int u = que.front(); que.pop();
		if (u == n) {
			printf("%d\n", dis[n] >> 1);
			return 0;
		}
		rep(i, g[u].size()) {
			if (!~dis[g[u][i]]) {
				dis[g[u][i]] = dis[u] + 1;
				que.push(g[u][i]);
			}
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 224384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  cout<<dp[n-1]<<endl;
}

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

int main(){
    int A,B,C,K;
    cin>>A>>B>>C>>K;
    int mac = 0;
    int data[]={A,B,C};
    vector<int>num(data, end(data));
    sort(num.begin(), num.end());
    int ans = num[0] + num[1];

    for(int i = 0; i < K; i++){
        num[2] *= 2;
    }
    ans += num[2];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, S: str):
    ans = []
    for i in range(N):
        c = S[i]
        if i==0:
            ans.append(c)
        else:
            if c!=ans[-1]:
                ans.append(c)
    print(len(ans))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


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

int main()
{
	int x, y;
	cin >> x >> y;

	int ret = 0;
	if (x == 1 && y == 1) {
		ret += 400000;
	}
	if (x == 1) {
		ret += 300000;
	}
	if (y == 1) {
		ret += 300000;
	}
	if (x == 2) {
		ret += 200000;
	}
	if (y == 2) {
		ret += 200000;
	}
	if (x == 3) {
		ret += 100000;
	}
	if (y == 3) {
		ret += 100000;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
#define INF 100000000
#define ll long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define rep(i, n) for(int (i)=1; (i)<=(n); (i)++)
typedef pair<int, int> P;
int main(){
    string S;
    cin >> S;
    if(S[0] != 'A'){
        cout << "WA" << endl;
        return 0;
    }
    int C_count = 0;
    int C_index;
    for(int i=2; i<S.size()-1; i++){
        if(S[i] == 'C'){
            C_count++;
            C_index = i;
        }
    }
    if(C_count != 1){
        cout << "WA" << endl;
        return 0;
    }
    for(int i=1; i<S.size(); i++){
        if(i == C_index) continue;
        if(S[i]>=65 && S[i]<=90){
            cout << "WA" << endl;
            return 0;
        }
    }

    cout << "AC" << endl;
    return 0;
}

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

int main() {
    int N;
    cin >>N;
    map<string, int> Map;
    string S;
    for(int i = 0; i < N; ++i) {
        cin >> S;
        Map[S]++; 
    }
    cout << Map.size() << endl;
    return 0;
}

Measured memory_bytes: 19200
#include<bits/stdc++.h>
#define ll long long
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl;
using namespace std;
int n;
ll a[3005];
pair<ll,ll>memo[3005][3005][2];
pair<ll,ll> dp(int l,int r,int i,int d,int side,int m)
{
    if(l>r)
    {
        return {0,0};
    }
    if(memo[i][d][side].first!=-1)
    {
        return memo[i][d][side];
    }
    pair<ll,ll>ret1,ret2;
    ret1=dp(l+1,r,l+1,d+1,0,m^1);
    ret2=dp(l,r-1,r-1,d+1,1,m^1);
    if(!m)
    {
        ret1.first+=a[l];
        ret2.first+=a[r];
        pair<ll,ll>p;
        p.first=max(ret1.first,ret2.first);
        p.second=min(ret1.second,ret2.second);
        return memo[i][d][side]=p;
    }
    else
    {
        ret1.second+=a[l];
        ret2.second+=a[r];
        pair<ll,ll>p;
        p.second=max(ret1.second,ret2.second);
        p.first=min(ret1.first,ret2.first);
        return memo[i][d][side]=p;
    }
}
int main()
{
    scanf("%d",&n);
    ll sum=0;
    for(int i=0;i<n;++i)
    {
        scanf("%lld",&a[i]);
        sum+=a[i];
    }
    memset(memo,-1,sizeof memo);
    //watch(sum)
    ll F=dp(0,n-1,0,0,0,0).first;
    //watch(F)
    printf("%lld",F-(sum-F));
    return 0;
}




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

using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;

#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 all(x) x.begin(), x.end()

ll n, k, m, M = 1e9 + 7;

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

    vvl a(3, vl(3));
    rep(i, 3) rep(j, 3) cin >> a[i][j];

    ll n;
    cin >> n;

    ll b;
    rep(i, n) {
        cin >> b;
        rep(j, 3) {
            rep(k, 3) {
                if(a[j][k] == b) a[j][k] = 0;
            }
        }
    }

    bool y = true, yy = true;
    rep(i, 3) {
        if(a[i][i] != 0) y = false;
        if(a[i][2 - i] != 0) yy = false;

        bool z = true, zz = true;
        rep(j, 3) {
            if(a[i][j] != 0) z = false;
            if(a[j][i] != 0) zz = false;
        }
        if(z || zz) return cout << "Yes" << endl, 0;
    }
    if(y || yy) return cout << "Yes" << endl, 0;

    cout << "No" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  rep(i, 3) {
    if(s[i] == t[i]) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3600
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var ai = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            if (ai.Contains(0))
            {
                Console.WriteLine(0);
                return;
            }
            var limit = (long)1e18;
            var answer = 1L;
            for (var i = 0; i < ai.Length; i++)
            {
                try
                {
                    checked
                    {
                        answer *= ai[i];
                    }
                }
                catch
                {
                    Console.WriteLine(-1);
                    return;
                }
                if (answer > limit)
                {
                    Console.WriteLine(-1);
                    return;
                }
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 42204
/* 	* In the name of GOD 
 	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
	int x, y;
	cin >> x >> y;
	bool f = false;
	for (int i = 0; i < 1000; i++){
		for (int j = 0; j < 1000; j++){
			if (i + j == x && i * 4 + j * 2 == y)
				f = true;
		}
	}
	cout << (f ? "Yes" : "No");
}


Measured memory_bytes: 3608
#include<iostream>
using namespace std;
main(){
  int cards[4][13],n,b,c;
  char a,d;
  cin >> n;

  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      cards[i][j]=0;
    }
  }

  for(int i=1;i<=n;i++){
    cin >> a >> b;
    if(a=='S'){
      c = 0;
    }
    else if(a=='H'){
      c = 1;
    }
    else if(a=='C'){
      c = 2;
    }
    else {
      c = 3;
    }
    cards[c][b-1]=1;
  }

  for(int i=0;i<=3;i++){
    for(int j=0;j<=12;j++){
      if(cards[i][j]==1)continue;
      else{
	if(i == 0) d = 'S';
	else if(i == 1) d = 'H';
	else if(i == 2) d = 'C';
	else if(i == 3) d = 'D';
 
	cout << d << " " << j+1 << "\n";
      }
    }
  }
}


   

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

int main(void)
{

	int a,b,c;
	int n;

	scanf("%d", &n);
	while(n--, n >= 0){
		scanf("%d %d %d", &a, &b, &c);

		a *=a;
		b *=b;
		c *=c;

		if(a == b+c || b == a+c || c == a+b)
			printf("YES\n");
		else
			printf("NO\n");
	}


	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	int N, *A;

	cin >> N;

	A = new int[N];

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	sort(A, A + N);	
	cout << A[N - 1] - A[0] << endl;

	delete A;

	return 0; 
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func solve(m, n int) int {
	if n == 1 && m == 1 {
		return 1
	}
	if n == 1 {
		return m - 2
	}
	if m == 1 {
		return n - 2
	}

	return (n - 2) * (m - 2)
}

func main() {
	defer stdout.Flush()

	n := readInt()
	m := readInt()

	println(solve(m, n))
}


Measured memory_bytes: 640
a, b = gets.split(/ /).collect{|n| n.to_i}

if a <= 0 && b >= 0
	puts 'Zero'
elsif a > 0
	puts 'Positive'
elsif b < 0
	if ((-a) - (-b)) % 2 == 1
		puts 'Positive'
	else
		puts 'Negative' 
	end
else
	if (-a) % 2 == 1
		puts 'Positive'
	else
		puts 'Negative' 
	end
end



Measured memory_bytes: 1788
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  
  vector<int> P(n),Q(n);
  rep(i,n) cin>>P[i];
  rep(i,n) cin>>Q[i];
  
  vector<int> A(n);
  rep(i,n) A[i]=i+1;
  
  int cnt=0,a,b;
  do{
    cnt++;
    bool pb=true,qb=true;
    rep(i,n){
      if(A[i]!=P[i]) pb=false;
      if(A[i]!=Q[i]) qb=false;
    }
    if(pb) a=cnt;
    if(qb) b=cnt;
  }while(next_permutation(ALL(A)));
  
  cout<<abs(a-b)<<endl;

  return 0;
}

Measured memory_bytes: 3652
#include <cstdio>

using namespace std;

const int N = 100'009;

int cnt[N];

int main() {
  int n, k, q;
  scanf("%d%d%d", &n, &k, &q);
  for (int i = 0; i < N; ++i) {
    cnt[i] = 0;
  }
  for (int i = 0; i < q; ++i) {
    int x;
    scanf("%d", &x);
    --x;
    ++cnt[x];
  }
  for (int i = 0; i < n; ++i) {
    puts(q - cnt[i] >= k ? "No" : "Yes");
  }
}


Measured memory_bytes: 896
class UnionFind:
    def __init__(self, N):
        self.N = N  # ノード数
        # 親ノードを示す。負は自身が親ということ。親だった場合は−(その集合のサイズ)
        self.parent = [-1] * N

    def root(self, A):
        # Aがどのグループに属しているか調べる
        # ノード番号を受けとって一番上の親ノードの番号を返す
        # print(A)
        if self.parent[A] < 0:
            return A
        self.parent[A] = self.root(self.parent[A])
        return self.parent[A]

    def size(self, A):
        # 自分のいるグループの頂点数を調べる
        return -self.parent[self.root(A)]

    def connect(self, A, B):
        # AとBをくっつける
        # AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = self.root(A)
        B = self.root(B)

        if A == B:
            return False  # すでにくっついてるからくっつけない

        if self.size(A) < self.size(B):
            # 大きい方(A)に小さいほう(B)をくっ付けたい
            # 大小が逆だったらひっくり返しちゃう。
            A, B = B, A

        # Aのサイズを更新する
        self.parent[A] += self.parent[B]
        # Bの親をAに変更する
        self.parent[B] = A

        return True


N, M = map(int, input().split())
A = []
B = []

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    A.append(a)
    B.append(b)

# print(A, B)

Uni = UnionFind(N)
ans = [0] * M
ans[M - 1] = N * (N - 1) // 2

for i in range(M - 1, 0, -1):
    if Uni.root(A[i]) != Uni.root(B[i]):
        ans[i - 1] = ans[i] - Uni.size(A[i]) * Uni.size(B[i])
        Uni.connect(A[i], B[i])
    else:
        ans[i - 1] = ans[i]

for i in range(M):
    print(ans[i])



Measured memory_bytes: 17700
import java.util.Scanner;
class Dice{
	private int num[] = new int[6];
	private int we[] = new int[4];
	private int ns[] = new int[4];
	public Dice(){
	}
	public void setNum(int n[]){
		for(int i = 0 ; i < 6 ; i++)
			num[i] = n[i];
		we[0] = ns[3] = num[5];
		we[2] = ns[1] = num[0];
		we[1] = num[3];
		we[3] = num[2];
		ns[0] = num[4];
		ns[2] = num[1];
	}
	public void setNum(int n1, int n2, int n3, int n4, int n5, int n6){
		int N1=n1, N2=n2, N3=n3, N4=n4, N5=n5, N6=n6;
		we[2] = ns[1] = num[0] = N1;
		ns[2] = num[1] = N2;
		we[3] = num[2] = N3;
		we[1] = num[3] = N4;
		ns[0] = num[4] = N5;
		we[0] = ns[3] = num[5] = N6;
	}
	public int getNum(int i, int n){
		if(i == 0)
			return we[n];
		else
			return ns[n];
	}
	public void print(int i, int n){
		if(i == 0)
			System.out.println(we[n]);
		else 
			System.out.println(ns[n]);
	}
	public void roll(String order){
		for(int i = 0 ; i < order.length() ; i++){
			switch(order.charAt(i)){
				case 'E' : setNum(num[3],num[1],num[0],num[5],num[4],num[2]); break;
				case 'W' : setNum(num[2],num[1],num[5],num[0],num[4],num[3]); break;
				case 'S' : setNum(num[4],num[0],num[2],num[3],num[5],num[1]); break;
				case 'N' : setNum(num[1],num[5],num[2],num[3],num[0],num[4]); break;
			}
		}
	}
}
public class Main{
	public static boolean samedice(Dice dice1, Dice dice2){
		for(int i = 0 ; i < 4 ; i++)
		{
			dice1.roll("W");
			if(dice1.getNum(0,1) == dice2.getNum(0,1) && dice1.getNum(0,3) == dice2.getNum(0,3))
				break;
		}
		if(!(dice1.getNum(0,1) == dice2.getNum(0,1) && dice1.getNum(0,3) == dice2.getNum(0,3)))
		{
			dice1.roll("S");
			for(int i = 0 ; i < 4 ; i++)
			{
				dice1.roll("W");
				if(dice1.getNum(0,1) == dice2.getNum(0,1) && dice1.getNum(0,3) == dice2.getNum(0,3))
					break;
			}
		}
		if(!(dice1.getNum(0,1) == dice2.getNum(0,1) && dice1.getNum(0,3) == dice2.getNum(0,3)))
			return false;
		else
		{
			for(int i = 0 ; i < 4 ; i++)
			{
				dice1.roll("S");
				if(dice1.getNum(1,0) == dice2.getNum(1,0) && dice1.getNum(1,1) == dice2.getNum(1,1) && dice1.getNum(1,2) == dice2.getNum(1,2) && dice1.getNum(1,3) == dice2.getNum(1,3))
					return true;
			}
			return false;
		}
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num1[] = new int[6];
		int num2[] = new int[6];
		for(int i = 0 ; i < 6 ; i++)
			num1[i] = sc.nextInt();
		for(int j = 0 ; j < 6 ; j++)
			num2[j] = sc.nextInt();
		Dice dice1 = new Dice();
		Dice dice2 = new Dice();
		dice1.setNum(num1);
		dice2.setNum(num2);
		if(samedice(dice1, dice2))
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 26432