akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
#define vv(a,b) vector< vector<int> > v(a,vector<int>(b,0));
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;

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

int main()
{
    int n;
    ll k;
    cin>>n>>k;
    vector<ll> a(n);
    ll amin=1e9;
    ll amax=0;
    rep(i,n)
    {
        cin>>a[i];
        amin=min(amin,a[i]);
        amax=max(amax,a[i]);
    }
    if(k>amax)
    {
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }

    ll gnum=a[0];
    for(int i=1;i<n;i++)
    {
        gnum=gcd(gnum,a[i]);
        if(gnum==1)break;
    }

    if(gnum==1)
    {
        cout<<"POSSIBLE"<<endl;
    }
    else
    {
        if((amax-k)%gnum==0)
        {
            cout<<"POSSIBLE"<<endl;
        }
        else
        {
            cout<<"IMPOSSIBLE"<<endl;
            
        }
        
    }
    return 0;
    

}


Measured memory_bytes: 1024
#include <iostream>
//#include <string>
using namespace std;

int main() {
	int Alice, Bob;
	cin >> Alice >> Bob;

	if (Alice == 1) {
		Alice = 14;
	}
	if (Bob == 1) {
		Bob = 14;
	}

	if (Alice > Bob) {
		cout << "Alice" << endl;
	}
	else if (Alice < Bob) {
		cout << "Bob" << endl;
	}
	else if (Alice == Bob) {
		cout << "Draw" << endl;
	}
}

Measured memory_bytes: 256
// ここからトピック10

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func swap(a []int, i, j int) {
	tmp := a[i]
	a[i] = a[j]
	a[j] = tmp
}

func main() {
	scanner.Split(bufio.ScanWords)
	dice := make([]int, 6)
	for i := 0; i < 6; i++ {
		dice[i], _ = nextInt()
	}
	commands := strings.Split(nextString(), "")
	for i:=range commands{
		cmd := commands[i]

		switch cmd {
		case "S":
			swap(dice, 0, 4)
			swap(dice, 4, 5)
			swap(dice, 5, 1)
		case "E":
			swap(dice, 0, 3)
			swap(dice, 3, 5)
			swap(dice, 5, 2)
		case "N":
			swap(dice, 0, 1)
			swap(dice, 1, 5)
			swap(dice, 5, 4)
		case "W":
			swap(dice, 0, 2)
			swap(dice, 2, 5)
			swap(dice, 5, 3)
		}
	}
	fmt.Println(dice[0])
}




Measured memory_bytes: 1104
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W,K;
  cin>>H>>W>>K;
  vector<string> A(H);
  for(string &S:A)
    cin>>S;
  int ans=0;
  for(int i=0;i<(1<<H);i++){
    bitset<6> B(i);
    for(int j=0;j<(1<<W);j++){
      bitset<6> C(j);
      int cnt=0;
      for(int k=0;k<H;k++)
        for(int l=0;l<W;l++)
          if(B.test(k) && C.test(l) && A[k][l]=='#')
            cnt++;
      if(cnt==K)
        ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int fh = n / 500;
        int left = n % 500;
        int f = left / 5;
        System.out.println(fh * 1000  + f * 5);
    }
}

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

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

	long long temp = 0;

	for (int i = 0; i < n.length(); i++) {
		temp += n[i] - '0';
	}

	if (temp%9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3732
import numpy as np

x = int(input())

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return table

sosu_table = sieve(100000)
sosu_table.append(100003)

sosu_table = np.array(sosu_table)

print(sosu_table[x<=sosu_table][0])

Measured memory_bytes: 22464
A, B = map(int, input().split())

def f(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
            n = int(n)
        i += 1
    if n > 1:
        table.append(n)
    return table
    

a = set(f(A))
b = set(f(B))

a_and_b = a & b
# print(a_and_b)
print(len(a_and_b) + 1)

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

long long p[51];
long long l[51];


long long solve(int n, long long x){

  if(x ==0) return 0LL;
  else if(x >= l[n]) return p[n];
  else if(x >= l[n-1]+2) return solve(n-1, x-l[n-1]-2) + p[n-1]+1; 
  else if(x < l[n-1]+2) return solve(n-1, x-1);
}


int main(void){
  int N;
  long long X;
  cin >> N >> X;
  p[0]=1LL; l[0]=1LL;
  for(int i=0; i<N; i++){
    l[i+1] = 2*l[i]+3; p[i+1] = 2*p[i]+1;
  }
  long long ans;
  ans = solve(N, X);
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[17],t[17];
  int a=0;
  cin >> s;
  strcpy(t,"CODEFESTIVAL2016");
  for(int i=0;i<16;i++){
    if(s[i]!=t[i])a++;
  }
  cout << a;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    ll ans;
    if(X <  600) ans = 8;
    else if(X < 800) ans = 7;
    else if(X < 1000) ans = 6;
    else if(X < 1200) ans = 5;
    else if(X < 1400) ans = 4;
    else if(X < 1600) ans = 3;
    else if(X < 1800) ans = 2;
    else ans = 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int zoo = sc.nextInt();;
        int leg = sc.nextInt();
        if(leg % 2 != 0){
            System.out.println("No");
        }else if(zoo * 4 < leg){
            System.out.println("No");
        }else if(zoo * 2 > leg){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 35764
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[40000],a[200000],b[200000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<LL>vec;
vector<edge>ed;
vector<Pll>v;
map<LL,LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n >> m >> s >> t;
	cout << n - (m + s - t) << endl;
	return 0;
}



Measured memory_bytes: 3136
alphabet = dict([(chr(i), 0) for i in range(97, 123)])

while True:
    try:
        text = list(map(str.lower, input()))
        for c in text:
            if c.isalpha():
                alphabet.update({c: alphabet[c]+1})
    except:
        break

for k, v in alphabet.items():
    print(k, ":", v)



Measured memory_bytes: 5576
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
inline void chmin(T &a, T b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, T b) { a = max(a, b); }
template <class T>
inline bool kbit(T &x, int k) { return ((x >> k) & 1LL); }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
void debug() { cerr << "ok" << endl; }
template <class T>
void printv(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void readv(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    if (s == "ABC") {
        cout << "ARC\n";
    } else {
        cout << "ABC\n";
    }
}

Measured memory_bytes: 3580
n = int(input())
saidan = input()

isiall = min(saidan.count('W'), saidan.count('R'))

tesuu = 0
for i in range(len(saidan)//2):
    r_iti = saidan.rfind('R')
    w_iti = saidan.find('W')
    
    if r_iti == -1 or w_iti == -1 or r_iti < w_iti:
        break
    
    saidan = saidan[w_iti+1 : r_iti]
    tesuu += 1
    
print(min(tesuu, isiall))

Measured memory_bytes: 9356
n,*t=map(int,open(0).read().split())
*z,=zip(t[::2],t[1::2])
s=set((a+b)%2for a,b in z)
if len(s)>1:
    print(-1)
    exit()
s,*_=s
d=[2**(38-i)for i in range(39)]+[1]*(s<1)
print(len(d))
print(*d)
for a,b in z:
    x=y=0
    for i in d:
        if abs(a-x)>abs(b-y):
            if a-x>0:
                print('R',end='')
                x+=i
            else:
                print('L',end='')
                x-=i
        else:
            if b-y>0:
                print('U',end='')
                y+=i
            else:
                print('D',end='')
                y-=i
    print()

Measured memory_bytes: 64600
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    ans=n*m
    cnt=0
    if n>1:
        ans-=2*m
        cnt+=1
    if m>1:
        ans-=2*n
        cnt+=1
    if cnt==2: ans+=4
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int millennium = getNumberOfDates(1000, 1, 1);
        Scanner s = new Scanner(System.in);
        int line = s.nextInt();
        for(int i = 0; i < line; i++) {
            int year = s.nextInt();
            int month = s.nextInt();
            int date = s.nextInt();
            System.out.println(millennium - getNumberOfDates(year, month, date));
        }
    }


    private static int getNumberOfDates(int year, int month, int date) {
        int numberOfDates = 0;
        for (int i = 1; i < year; i++) {
            int datesInOddMonth = 20;
            int datesInEvenMonth = 19;

            if (i % 3 == 0) {
                datesInEvenMonth = 20;
            }

            numberOfDates += (datesInOddMonth + datesInEvenMonth) * 5;
        }

        for (int j = 1; j < month; j++) {
            if(year % 3 ==0){
                numberOfDates += 20;
            } else if (j % 2 == 0) {
                numberOfDates += 19;
            } else {
                numberOfDates += 20;
            }
        }

        return numberOfDates + date;
    }
}

Measured memory_bytes: 20660
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)

int main() {
  ll n;cin >>n;
  ll out = 0LL;
  if(n%2LL==0LL){
    n/=2LL;//偶数の数
    ll div = 5LL;
    while(n/div>0LL){
      ll tmp = n/div;
      out += tmp;//10*nの数
      div*=5LL;
    }
  }
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 256
#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);
    ll S;

    cin >> S;

    ll L = 1000000000;
    ll x1 = 0;
    ll y1 = 0;
    ll x2 = L;
    ll y2 = 1;
    
    ll x3 = (L - S%L)%L;
    ll y3 = (S+x3)/L;

    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
    return 0;
}

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

int main(){
        int i,j,h,w,ih,iw,cnt=0,ans=0;
        cin >> h >> w;
        vector<vector<char>> s(h, vector<char>(w));
        for(i=0;i<h;++i){
                for(j=0;j<w;++j){
                        cin >> s.at(i).at(j);
                }
        }
        for(i=0;i<h;++i){
                for(j=0;j<w;++j){
                        if(s.at(i).at(j)=='#') continue;
                        vector<vector<int>> done(h, vector<int>(w));
                        queue<tuple<int,int,int>> q;
                        q.push({i,j,0});
                        while(!q.empty()){
                                ih = get<0>(q.front());
                                iw = get<1>(q.front());
                                cnt = get<2>(q.front());
                                q.pop();
                                if(ih<0||ih>=h) continue;
                                if(iw<0||iw>=w) continue;
                                if(s.at(ih).at(iw)=='#') continue;
                                if(done.at(ih).at(iw)) continue;
                                done.at(ih).at(iw) = 1;
                                ans = max(ans, cnt);
                                q.push({ih+1,iw,cnt+1});
                                q.push({ih-1,iw,cnt+1});
                                q.push({ih,iw+1,cnt+1});
                                q.push({ih,iw-1,cnt+1});
                        }
                }
        }
        cout << ans << endl;
        return 0;
}

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	ll N=in();
	auto A=vecin(N);
	map<ll,ll> M;
	for(auto& x:A) M[x]++;
	ll S=accumulate(ALL(A),0ll);

	ll Q=in();
	LOOP(Q){
		ll B=in(),D=in();
		ll X=M[B];
		S += X*(D-B);
		M[D] += M[B];
		M[B]=0ll;
		out(S);
	}
	return 0;
}


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

int main()
{
  int n;
  long long day[32];

  day[0] = 0;
  day[1] = 1;
  day[2] = 1;

  for (int i = 3; i <= 31; i++){
    day[i] = day[i - 3] + day[i - 2] + day[i - 1];
  }

  while (cin >> n, n){
    int year = day[n + 1] / 10 / 365;
    cout << year + 1 << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<min(c,b/a)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int x,y,z;
	scanf("%d %d",&x,&y);
	if(x<=y){
		z=y-x;
		printf("%d\n",z); 
	}
	else  if(x>=y){
		z=x-y;
		printf("%d\n",z);
	}
	return 0;
}


Measured memory_bytes: 2068
n=int(input())
x0=0
y0=0
t0=0
ans='Yes'
for i in range(n):
    t1,x1,y1=map(lambda x: int(x), input().split())
    dt=t1-t0
    dx=x1-x0
    dy=y1-y0
    if dt<abs(dx)+abs(dy):
        ans='No'
    if dt%2!=(abs(dx)+abs(dy))%2:
        ans='No'
    t0=t1
    x0=x1
    y0=y1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(a) ((int) (a).size())
#define nl '\n'
#define sp ' '

#define MAXN 10005

int N;

int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N;
    ll a;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        cin >> a;
        for (; a % 2 == 0; cnt++) a /= 2;
    }
    cout << cnt << nl;
    return 0;
}


Measured memory_bytes: 256
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const ll N = 1e5 + 15, MOD =  998244353;

void solve() {
    ll n;
    cin >> n;
    string ans = "";
    while(n) {
        n--;
        ans += 'a' + n % 26;
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
}



int main()  {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    } 
}                                   

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<vector>
#include<deque>
#include<map>

using namespace std;

int N;
vector<long> parts;

int input(){
  int tmp, n;
  map<int, int> tmpparts;
  cin >> N;
  for( int i = 0; i < N; i++ ){
	cin >> tmp;
	if( tmpparts.count(tmp) ){
	  n = tmpparts.at(tmp);
	  tmpparts.erase(tmp);
	  tmpparts.insert(pair<int,int>(tmp,n+1));
	}else{
	  tmpparts.insert(pair<int,int>(tmp,1));
	}
  }

  // 1本しか無いものは除外．
  for( auto itr = tmpparts.begin(), itr_end = tmpparts.end(); itr != itr_end; itr++ ){
	if( itr->second >= 2 ){ parts.push_back(itr->first); }
	if( itr->second >= 4 ){ parts.push_back(itr->first); }
  }
  return 0;
}

int main(){
  input();
  sort(parts.begin(), parts.end());
  /*
  for( auto itr = parts.begin(), itr_end = parts.end(); itr != itr_end; itr++ ){
	cout << *itr << endl;
  }
  */
  int l = parts.size();
  if( l < 2 ){
	cout << 0 << endl;
  }else{
	cout << parts[l-2] * parts[l-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 4992
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

const Nmax = 10^5
const Mmax = 2*10^5

mutable struct Graph{T}
  nodes::Vector{Vector{T}}
  degree::Vector{int}
  N::int
  M::int
end

function Graph(Nmax, T::DataType)
  nodes = Vector{Vector{T}}(undef,Nmax)
  for i in 1:Nmax
    nodes[i] = Vector{T}(undef,0)
  end
  degree = zeros(int,Nmax)
  N = 0
  M = 0
  
  return Graph{T}(nodes, degree,N,M)
end

mutable struct Queue{T}
  q::Vector{T}
  Nmax::int
  n::int
  head::int
  tail::int
  
end

function Queue(Nmax, T)
  q = Vector{T}(undef,Nmax)
  n = 0
  head = 1
  tail = 0
  return Queue{T}(q,Nmax,n,head,tail)
end
is_empty(Q::Queue{T}) where T = Q.n==0
is_full(Q::Queue{T}) where T = Q.n==Q.Nmax

function push(Q::Queue{T},d::T) where T
  is_full(Q) && error("満杯だから無理なんですよ")
  
  Q.n += 1
  Q.tail = (Q.tail)%Q.Nmax+1
  Q.q[Q.tail] = d  
end

function pop(Q::Queue{T}) where T
  is_empty(Q) && error("空だから無理なんですよ")
  
  Q.n -= 1
  d = Q.q[Q.head]
  Q.head = (Q.head)%Q.Nmax + 1
  return d
end

global G = Graph(Nmax, int)
global Q = Queue(Mmax, int)

function main()
  N, M = readint()

  G.N = N
  
  for i in 1:M
    A,B = readint()
    G.degree[A] +=1
    G.degree[B] +=1
    append!(G.nodes[A],[B])
    append!(G.nodes[B],[A])
  end

  checked = Vector{Bool}(undef,N)
  checked .=false

  answer = Vector{int}(undef,N)
  answer .= 0

  push(Q, 1)
  while ! is_empty(Q)
    q = pop(Q)
    for p in G.nodes[q]
      checked[p] && continue
      answer[p]=q
      push(Q,p)
      checked[p] = true
      #@printf("%d ",d.y)
    end    
  end
  println("Yes") 
  for i in 2:N
    println(answer[i])
  end 
end

main()

Measured memory_bytes: 252772
n = int(input())
a = list(map(int, input().split()))
b = [0] * n

ans = 0
for i in range(n):
    tmp = i + a[i]

    if tmp < n:
        b[tmp] += 1

    if a[i] <= i and b[i - a[i]]:
        ans += b[i - a[i]]

print(ans)


Measured memory_bytes: 32276
/// 11:59 AM 26/04/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef int ll;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

template<typename T>
void ContainerError(T &v);

ll powmod(ll base, ll exp, ll MOD);

ll mpow(ll base, ll exp);

ll gcd(ll a, ll b);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin>>s;
    ll k= 2019;
    ll n = s.size();
    ll ans = 0;
    vector<ll > v(k+1);
    ll c = 0;
    ll cf = 1;
    v[0]++;
    for(ll i=0;i<n;i++) {
        c = (c + cf * (s[n - i - 1] - '0') % k) % k;
        cf=cf*10%k;
        v[c]++;
    }
    for(ll i=0;i<k;i++) {
        ans += v[i]*(v[i]-1)/2;
    }
    cout<<ans;
    return 0;
}

template<typename T>
void ContainerError(T &v) {
    cout << "{";
    for (auto &x:v) { cout << x << ','; }
    cout << "}" << endl;
    return;
}

ll powmod(ll base, ll exp, ll MOD) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return (res % MOD);
}

ll mpow(ll base, ll exp) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base);
        base = (base * base);
        exp /= 2;
    }
    return (res);
}

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }



Measured memory_bytes: 3748
N = int(input())
W = [input() for i in range(N)]

ok = True
for i in W:
    if W.count(i)>1:
        ok = False
        
for i in range(1,N):
    if W[i-1][-1] != W[i][0]:
        ok = False
        
if ok:
    print('Yes')
else:
    print('No')

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

typedef long long ll;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);++(i))
#define RFOR(i,num,N) for(int (i)=(num);(i)>(N);--(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()

int main(){
    string s,t,u;
    cin>>s>>t>>u;

    s += " "; t += " "; u += " ";

    reverse(all(s));
    reverse(all(t));
    reverse(all(u));
    char c = s.back(); s.pop_back();

    while(s.size() && t.size() && u.size()){
        cout<<endl;
        if(c == 'a'){c = s.back(); s.pop_back();}
        else if(c == 'b'){c = t.back(); t.pop_back();}
        else if(c == 'c'){c = u.back(); u.pop_back();}
    }

    if(!s.size()) puts("A");
    else if(!t.size()) puts("B");
    else puts("C");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[3000][3000];
    int csum[3000][3000];
 void pre(int *a, int n){
     forr(i,1,n+1){
         forr(j,i,n+1){
                   if(i==j)csum[i][j]= a[j];
                   else csum[i][j]= (a[j]+ csum[i][j-1]);}
             }}
    
    int mixtures(int * a, int s ,int e){
        if(s==e)return 0;
        if (dp[s][e]!=-1)return dp[s][e]; 
         int ans=(1ll<<60);
        forr(i,s,e){
        ans=min( ans, (mixtures(a,s,i)+mixtures(a,i+1,e)+  csum[s][e]));}
return dp[s][e]=ans;
    }
    
    signed main(){
        int n;cin>>n;
        int a[n+5];forr(i,1,n+1)cin>>a[i];
        memset(dp,-1, sizeof dp);
        memset(csum , 0 , sizeof csum);
        pre(a,n);
        cout<<mixtures(a,1,n);
    }

Measured memory_bytes: 140928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  for (int i =0;i<N;i++){
  string S;
  
  cin>>S;
  
  if(S=="Y"){
  cout<<"Four"<<endl;
  break;
  }
  
  if(i==N-1){
  
  if(S=="Y"){
  cout<<"Four"<<endl;
  break;
  }
  else{
   cout<<"Three"<<endl;
  }
  
  
  }
}
}

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

char s[10 + 5];

int main() { // claudio van
  scanf("%s", s);
  int n = strlen(s);
  for (int len = n; len >= 1; --len) {
    for (int i = 0; i + len - 1 < n; ++i) {
      bool ok = 1;
      for (int j = 0; j < len; ++j) {
        if (s[i + j] != 'A' and s[i + j] != 'T' and s[i + j] != 'C' and s[i + j] != 'G') {
          ok = 0;
        }
      }
      if (ok) {
        printf("%d\n", len);
        return 0;
      }
    }
  }
  printf("0\n");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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; }
const ll INF = 1e11;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n;
    cin >> n;
    int a[12];
    rep(i,n){
        cin >> a[i];
    }
    sort(a,a+n);
    int ans = 0;
    rep(i,n-1) ans += a[i];
    ans += a[n-1]/2;
    PRINT(ans);
}

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

int dp[20005][300];

int solve(int N, int M) {
    vector<int> C(M);
    for (int i = 0; i < M; i++) {
        cin >> C[i];
    }
    vector<int> X(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i];
    }
    
    const int INF = 100000000;
    for (int i = 0; i < 20005; i++) {
        for (int j = 0; j < 300; j++) {
            dp[i][j] = INF;
        }
    }
    
    dp[0][128] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 300; j++) {
            if (dp[i][j] == INF) continue;
            for (int k = 0; k < M; k++) {
                int nj = j + C[k];
                nj = min(255, nj);
                nj = max(0, nj);
                dp[i+1][nj] = min((X[i] - nj)*(X[i] - nj) + dp[i][j], dp[i+1][nj]);
            }
        }
    }
    
    int ret = INF;
    for (int i = 0; i < 256; i++) {
        ret = min(ret, dp[N][i]);
    }
    return ret;
}

int main(void){
    // Your code here!
    int N, M;
    vector<int> ans;
    while (1) {
        cin >> N >> M;
        if (!N && !M) break;
        ans.push_back(solve(N, M));
    }
    for (auto &i : ans) {
        cout << i << endl;
    }
}



Measured memory_bytes: 26672
#include <stdio.h>

using namespace std;

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

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

	for(int i = 0; i < n; i++){
		for(int k = 0; k < l; k++){
			for(int j = 0; j < m; j++){
				C[i][k] += A[i][j]*B[j][k];
			}
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l-1; j++){
			printf("%lld ",C[i][j]);
		}
		printf("%lld\n",C[i][l-1]);
	}
}

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

#define pb push_back
void solve(){
  string s; cin>> s;
  int a,z,ca=1;
  for(int i=0;i<(int)s.size();++i){
    if(s[i]=='A' && ca) a=i,ca=0;
    if(s[i]=='Z') z=i;
  }
  cout<<z-a+1<<endl;
}


int main() {
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif

 ios_base::sync_with_stdio(0);
 cin.tie(0);

int t=1 ;  while(t--)
 solve();

return 0;
}


Measured memory_bytes: 3704
n = int(input())
array = [int(x) for x in input().split()]

tmp_res = 0
tmp_ici = 0
tmp_array = []
for i in array:
    tmp_array.append(abs(tmp_ici-i))
    tmp_ici = i
tmp_array.append(abs(tmp_ici-0))
tmp_sum = sum(tmp_array)

array = [0] + array + [0]
for i in range(n):
    c = array[i]
    cc = array[i+2]
    a = sum(tmp_array[i:i+2])
    print(tmp_sum-a+abs(c-cc))

Measured memory_bytes: 14048
#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

bool nums[2000000];

int main(){
	memset(nums, false, sizeof(nums));
	nums[1] = true;
	rep2(i, 2, 2000000){
		if(i % 2 == 0 && nums[i/2]) nums[i] = true;
		if(i % 3 == 0 && nums[i/3]) nums[i] = true;
		if(i % 5 == 0 && nums[i/5]) nums[i] = true;
	}
	int m, n;
	while(cin >> m && m){
		int cnt = 0;
		cin >> n;
		rep2(i, m, n + 1) if(nums[i]) cnt++;
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 0
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	
	#ifndef ONLINE_JUDGE
	freopen("C:/Users/DELL/Desktop/input.txt", "r", stdin);
	#endif

	fast;
	ll n;
	cin>>n;
	vector<ll> v(n);
	ll x=0;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		x^=v[i];
	}
	vector<int> ans;
	for(int i=0;i<n;i++)
		ans.pb(v[i]^x);
	for(auto it: ans)
		cout<<it<<"\n";
	return 0;
}


Measured memory_bytes: 5776
#include <stdio.h>
#include <stdlib.h>
 
typedef struct Bomb
{
    int map[8][8];
} BOMB;
 
int x_cnt, y_cnt;
 
Input(BOMB *);
BOMB *explode(BOMB *);  /*Recursion*/
 
int main()
{
    int input_times, input_cnt;
    BOMB Bomb[50];
    int x, y;
     
    scanf("%d", &input_times);
    input_cnt = 0;
    while(input_cnt < input_times)
    {
        Input(&Bomb[input_cnt]);
        /*Read first explosion*/
		scanf("%d\n%d", &x, &y);
		Bomb[input_cnt].map[x - 1][y - 1] = 2;
        explode(&Bomb[input_cnt]);
        input_cnt++;
    }
     
    /*Output*/
    input_cnt = 0;
    while(input_cnt < input_times)
    {
        printf("Data %d:\n", input_cnt + 1);
        for(y_cnt = 0; y_cnt < 8; y_cnt++)
        {
            for(x_cnt = 0; x_cnt < 8; x_cnt++)
            {
                printf("%d", Bomb[input_cnt].map[x_cnt][y_cnt]);
            }
            printf("\n");
        }
        input_cnt++;
    }
	
    return 0;
}

Input(BOMB *bomb)
{
    /*Read input map*/
    char dump;      /*Get rid of enter*/
    dump = getchar();
    for(y_cnt = 0; y_cnt < 8; y_cnt++)
    {
        dump = getchar();
        for(x_cnt = 0; x_cnt < 8; x_cnt++)
            bomb->map[x_cnt][y_cnt] = getchar() - 48;    /*ASCII table*/
    }
    
}
 
BOMB* explode(BOMB* bomb_map)
{
    int explode_cnt;
    for(y_cnt = 0; y_cnt < 8; y_cnt++)
        for(x_cnt = 0; x_cnt < 8; x_cnt++)
        {
            /*Find exploded bomb and process*/
            if(bomb_map->map[x_cnt][y_cnt] == 2)
            {
                bomb_map->map[x_cnt][y_cnt] = 0;
                /*Left*/
                explode_cnt = 1;
                while((x_cnt - explode_cnt) >= 0 && explode_cnt <= 3)
                {
                    if((bomb_map->map[x_cnt - explode_cnt][y_cnt]) == 1)
                        (bomb_map->map[x_cnt - explode_cnt][y_cnt]) = 2;
                    explode_cnt++;
                }
                /*Right*/
                explode_cnt = 1;
                while((x_cnt + explode_cnt) <= 7 && explode_cnt <= 3)
                {
                    if((bomb_map->map[x_cnt + explode_cnt][y_cnt]) == 1)
                        (bomb_map->map[x_cnt + explode_cnt][y_cnt]) = 2;
                    explode_cnt++;
                }
                /*Down*/
                explode_cnt = 1;
                while((y_cnt - explode_cnt) >= 0 && explode_cnt <= 3)
                {
                    if((bomb_map->map[x_cnt][y_cnt - explode_cnt]) == 1)
                        (bomb_map->map[x_cnt][y_cnt - explode_cnt]) = 2;
                    explode_cnt++;
                }
                /*Up*/
                explode_cnt = 1;
                while((y_cnt + explode_cnt) <= 7 && explode_cnt <= 3)
                {
                    if((bomb_map->map[x_cnt][y_cnt + explode_cnt]) == 1)
                        (bomb_map->map[x_cnt][y_cnt + explode_cnt]) = 2;
                    explode_cnt++;
                }
                return explode(bomb_map);
            }
        }
    return bomb_map;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#define MAXN 3001000
#define lc (x << 1)
#define rc (x << 1 | 1)
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

ll n, C, h[MAXN], dp[MAXN];
int vis[MAXN << 1];

struct line {
    double k, b;
    line(double _k = 0, double _b = 0) {
        k = _k; b = _b;
    }
    double get(double x) {
        return k * x + b;
    }
} c[MAXN << 1];

void modify(int x, int l, int r, line v) {
    if (!vis[x]) {vis[x] = 1; c[x] = v; return;}
    if (c[x].get(l) > v.get(l) && c[x].get(r) > v.get(r)) return;
    if (c[x].get(l) < v.get(l) && c[x].get(r) < v.get(r)) {c[x] = v; return;}
    int m = (l + r) >> 1;
    if (c[x].get(l) < v.get(l)) swap(c[x], v);
    if (c[x].get(m) > v.get(m)) modify(rc, m + 1, r, v);
    else {swap(c[x], v); modify(lc, l, m, v);}
}

double get(int x, int l, int r, int pos) {
    if (l == r) return c[x].get(l);
    int m = (l + r) >> 1; double ans = c[x].get(pos);
    if (pos <= m) ans = max(ans, get(lc, l, m, pos));
    else ans = max(ans, get(rc, m + 1, r, pos));
    return ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> n >> C;
    for(int i = 0; i < n; i++){
    	cin >> h[i];
    	if(i > 0)
    		dp[i] = -get(1, 1, 1e6 + 10, h[i]) + h[i] * h[i] + C;
    	line l = line(2 * h[i], -(dp[i] + h[i] * h[i]));
    	modify(1, 1, 1e6 + 10, l);
    //cout << dp[i] << " ";
    }
    cout << dp[n - 1];
}

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

int main () {
    long long int X; cin >> X;
    int year = 0;
    long long int money = 100;
    while (1) {
        if (money >= X) {
            cout << year << endl;
            break;
        }
        money += money / 100;
        year++;
    }
}


Measured memory_bytes: 3600
#include<stdio.h>

int main(){
    int f = 1;
    int cnt = 0;
    while (f){
        int x;
        cnt ++;
        scanf("%d", &x);
        if (x == 0){
            f = 0;
        }
        
        if (f){
            printf("Case %d: %d\n", cnt, x);
        }
        
        else{
            break;
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 2032
N = int(input())
B = list(map(int, input().split()))

A=[]
A.append(B[0])
for i in range(0,N-2):
    if i>=1 & i < N-2:
      A.append(min(B[i],B[i+1]))
      
A.append(B[-1])
print(sum(A))


Measured memory_bytes: 3060
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>

struct SCC {
    int N, p;
    std::vector<std::vector<int> > g, gr, g2i, t, tr;
    std::vector<bool> visited;
    std::vector<int> i2g;
    std::stack<int> order;

    SCC(){}
    SCC(int n){init(n);}
    void init(int n){
        N = n;
        g.clear();
        g.resize(N);
        gr.clear();
        gr.resize(N);
        visited.resize(N);
        i2g.resize(N);
    }
    void add_edge(int u, int v) {
        g[u].emplace_back(v);
        gr[v].emplace_back(u);
    }

    void dfs(int x) {
        if (visited[x]) return;
        visited[x] = true;
        for (int i : g[x]) dfs(i);
        order.push(x);
    }

    void rdfs(int x, int k) {
        if (visited[x]) return;
        visited[x] = true;
        i2g[x] = k;
        for (int i : gr[x]) rdfs(i, k);
    }

    void build() {
        std::fill(visited.begin(), visited.end(), false);
        std::fill(i2g.begin(), i2g.end(), -1);
        for (int i = 0; i < N; i++) dfs(i);
        p = 0;
        std::fill(visited.begin(), visited.end(), false);
        while (!order.empty()) {
            int idx = order.top();
            order.pop();
            if(!visited[idx]) rdfs(idx, p++);
        }
        g2i.clear();
        g2i.resize(p);
        for(int i=0;i<N;i++){
            g2i[i2g[i]].push_back(i);
        }
        t.resize(p);
        tr.resize(p);
        for(int i=0;i<N;i++){
            for (auto &to : g[i]) {
                int x = i2g[i], y = i2g[to];
                if (x == y) continue;
                t[x].push_back(y);
                tr[y].push_back(x);
            }
        }
        for(int i=0;i<p;i++){
            sort(t[i].begin(), t[i].end());
            t[i].erase(unique(t[i].begin(), t[i].end()),t[i].end());
            sort(tr[i].begin(), tr[i].end());
            tr[i].erase(unique(tr[i].begin(), tr[i].end()),tr[i].end());
        }
    }
    int count() const {return p;}
    int operator[](int k) const {return i2g[k];}
};

int main() {
    int V, E;
    std::cin >> V >> E;
    SCC G(V);
    for(int i=0;i<E;i++){
        int s, t;
        std::cin >> s >> t;
        G.add_edge(s,t);
    }
    G.build();
    std::cout << (G.count() < V) << std::endl;
    return 0;
}


Measured memory_bytes: 3184
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String S = scan.next();
		String T = scan.next();

		int count = 0;
		int maxCount = 0;

	  if(S.length() == T.length())
	  {
		  for(int i = 0; i < S.length(); i++) {
				if((S.charAt(i) == T.charAt(i)))
				{
					maxCount++;
				}
			}
	  }
	  else
	  {
      for(int x = 0; x < S.length() - T.length(); x++) {
		for(int i = 0; i < T.length(); i++) {
			if((S.charAt(i + x) == T.charAt(i)))
			{
				count++;
			}
		}
		if(count > maxCount) {
			maxCount = count;
		}
		count = 0;
      	}
      }
		System.out.println(T.length() - maxCount);
		scan.close();
	}
}

Measured memory_bytes: 35764
#include <bits/stdc++.h>  
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define REP(i, a, n, op) for(int i=a; i<(int)(n); i ## op ## op)
#define cout(val) cout << val << endl

using namespace std;  

int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k){
        cout(s);
    }else{
        cout((s.substr(0,k) + "..."));
    }
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
#define ll long long
using namespace std;
const int maxn=1e5+10;
int k;
ll a[maxn];
ll ans=2ll,a1,a2;
int main(){
//	freopen("sb.in","r",stdin);
//	freopen("ss.out","w",stdout);
	cin>>k;
	REP(i,1,k)
		cin>>a[i];
	if(a[k]>2){
		cout<<-1<<endl;
		return 0;
	}
	DREP(i,k-1,1){
		ll tmp=(ans+a[i+1]-1ll)/a[i]*a[i];
		if(tmp==0){
			cout<<-1<<endl;
			return 0;
		}
		ans=tmp;
	}
	a2=ans+a[1]-1ll;
	ans=2ll;
	DREP(i,k-1,1){
		ll tmp=ans%a[i]==0?ans/a[i]:ans/a[i]+1;
		tmp=tmp*a[i];
		ans=tmp;
	}
	if(ans>a2)return cout<<"-1"<<endl,0;
	cout<<ans<<" "<<a2<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0
#define br break
#define con continue;
#define um unordered_map<ll,ll>
#define ms(x) memset(x , 0 , so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
int main()
{
    ios;
    ll n ;
    cin >> n ;
    string s ;
    cin >> s;
    s.insert(0,"%");
    ll ans = 0;
    forn(i ,1 , n){
       forn(j , i+1 , n){
          ll cnt = 0 ;
          set<char> s1 , s2 ;
          for(ll k = 1; k<=i;++k){
              s1.insert(s[k]);
          }
          for(ll k = j ; k<=n;++k){
            s2.insert(s[k]);
          }
          for(auto &x : s1){
            if(s2.find(x)!=s2.end()){
                ++cnt;
            }
          }
          ans = max(ans , cnt ) ;

       }
    }
    cout << ans << el ;
}

















Measured memory_bytes: 256
K = int(input())
remainder_set = set()
sequence = 7
i = 1
for i in range(K):
    remainder = sequence%K
    #print(sequence,remainder)
    if remainder == 0:
        print(i+1)
        break
    else:
        if remainder in remainder_set:
            print(-1)
            break
        else:
            i += 1
            remainder_set.add(remainder)
            sequence = remainder*10 + 7

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





int main(){
  while(1){
    
  int n;
  cin>>n;
  if(n==0){break;}
  int a[10000];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int mi=2000000000;
  sort(a,a+n);
  for(int i=1;i<n;i++){
    mi=min(a[i]-a[i-1],mi);
  }
  cout<<mi<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n, k;
   string s;
   cin >> n >> k >> s;
   k--;
   s[k] = tolower(s[k]);
   cout << s << endl;

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;

int main() {
	ll a, b,anss=0;
	cin >> a >> b;
	anss = (a - 2) * (b - 2);
	ll ans = abs(anss);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

int dfs(int cur, int tmp, vector<vector<int> > &G, int d, vector<bool> &used, int u, int v){

    used[cur] = true;
    int ret = 0;
    for(auto nxt : G[cur]){
        if(!used[nxt]){
            if(cur == u && nxt == v) continue;
            if(cur == v && nxt == u) continue;
            ret += dfs(nxt, tmp + 1, G, d, used, u, v);
        }
    }

    if(d < tmp) ret++;
    return ret;
}

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

    int ans = INF;
    if(k % 2 == 0){
        for(int i = 0; i < n; i++){
            vector<bool> used(n, false);
            ans = min(ans, dfs(i, 0, G, k / 2, used, -1, -1));            
        }    
    }else{
        for(int i = 0; i < n; i++){
            for(auto j : G[i]){
                G[n].push_back(i);
                G[n].push_back(j);
                vector<bool> used(n, false);            
                ans = min(ans, dfs(n, 0, G, (k + 1) / 2, used, i, j));
                G[n].erase(G[n].begin(), G[n].end());
            }
        }
    }

    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s[n];
    for(int i = 0; i < n; i++){
        cin >> s[i];
        //文字列内のソート
        sort(s[i].begin(), s[i].end());
    }
    sort(s,s+n);
    long long count = 0;
    long long sum = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == s[i+1]){
            count++;
        }else{
            sum += count * (count+1) / 2;
            count = 0;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 7296