akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

typedef vector<ll> vll;

vll divisors(ll x) { // O(sqrt x)
    vll r;
    for (ll i = 1; i*i <= x; i++) {
        ll d = x/i;
        if (d*i == x) {
            if (i != 1) r.pb(i);
            if (d != i) r.pb(d);
        }
    }
    return r;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    ll n; cin >> n;
    int ans = si(divisors(n-1));
    vll d = divisors(n);
    for (ll x : d) {
        ll y = n;
        while (y % x == 0) y /= x;
        if ((y-1) % x == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n,m,t;

vector<PP> G;
vector<P> bfsG[100001];
int edge[200001];
int s[200001],e[200001];
int par[200001];
int rank[200001];
int nowG[200001];
int dist[100001];
int cnt[200001];
ll dp[200001];

int find(int x){
	if(x==par[x])return x;
	return (par[x]=find(par[x]));
}

bool same(int x,int y){
	return find(x)==find(y);
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	if(rank[x]<rank[y]){
		par[y]=x;
	}else{
		par[x]=y;
		if(rank[x]==rank[y]){
			rank[x]++;
		}
	}
}

void bfs(){
	queue<int> que;
	memset(dist,-1,sizeof(dist));
	dist[0]=0;
	que.push(0);
	while(que.size()){
		int v=que.front();
		que.pop();
		//printf("%d %d\n",v,dist[v]);
		for(int i=0;i<bfsG[v].size();i++){
			if(dist[v]<bfsG[v][i].sc && dist[bfsG[v][i].fi]==-1){
				dist[bfsG[v][i].fi]=dist[v]+1;
				que.push(bfsG[v][i].fi);
			}
		}
	}
}

ll func(int v){
	if(dp[v]!=-1)return dp[v];
	ll res=0;
	if(edge[v]!=-1){
		res+=func(edge[v]);
	}
	ll get=(ll)cnt[v]*(s[v]-e[v]);
	//printf("%d %lld %lld\n",v,res,get);
	return dp[v]=(res+get);
}

int main(void){
	scanf("%d%d%d",&n,&m,&t);
	for(int i=0;i<m;i++){
		int a,b,T;
		scanf("%d%d%d",&a,&b,&T);
		a--;
		b--;
		G.push_back(PP(T,P(a,b)));
		bfsG[a].push_back(P(b,T));
		bfsG[b].push_back(P(a,T));
	}
	bfs();
	sort(G.begin(),G.end());
	reverse(G.begin(),G.end());
	for(int i=0;i<n;i++){
		par[i]=i;
		rank[i]=0;
		nowG[i]=i;
		s[i]=t;
		cnt[i]=1;
	}
	int all=n;
	memset(edge,-1,sizeof(edge));
	for(int i=0;i<G.size();i++){
		if(!same(G[i].sc.fi,G[i].sc.sc)){
			int x=find(G[i].sc.fi);
			int y=find(G[i].sc.sc);
			unite(x,y);
			//printf("par %d %d\n",x,y);
			edge[nowG[x]]=all;
			edge[nowG[y]]=all;
			cnt[all]=cnt[nowG[x]]+cnt[nowG[y]];
			e[nowG[x]]=G[i].fi;
			e[nowG[y]]=G[i].fi;
			s[all]=G[i].fi;
			//printf("now %d %d\n",nowG[x],nowG[y]);
			nowG[x]=all;
			nowG[y]=all;
			all++;
			//printf("%d %d %d %d\n",all-1,cnt[all-1],G[i].sc.fi,G[i].sc.sc);
		}
	}
	memset(dp,-1,sizeof(dp));
	ll res=0;
	for(int i=0;i<n;i++){
		if(dist[i]!=-1){
			res=max(res,func(i));
		}
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 20264
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  int inf =1e9;
  int e[N];
  REP(i,N)e[i]=inf;
  REP(i,M){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(a>b)swap(a,b);
    e[a]=min(e[a],b);
  }
  int ans=0;
  int right=inf;
  REP(i,N){
    right=min(right,e[i]);
    if(i==right-1){
      ans++;
      right=inf;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<stack>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define me(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=1111122;
const int M=200005;
char s[1000000],b[1000000],ch;
int main()
{
	int i,q,u,flag=1;
	cin>>s;
	int o=200000;
	for(i=0;s[i]!='\0';i++)
	{
		b[o++]=s[i];
	}
	int l=200000,r=strlen(s)+199999;
	cin>>q;
	while(q--)
	{
		cin>>u;
		if(u==1)
		{
			flag*=-1;
		}
		else
		{
			cin>>u>>ch;
			if(u==1)
			{
				if(flag==1)
				{
					b[--l]=ch;
				}
				else b[++r]=ch;
			}
			else 
			{
				if(flag==-1)
				{
					b[--l]=ch;
				}
				else b[++r]=ch;
			}
		}
	}
	if(flag==-1)
	{
		for(i=r;i>=l;i--)
		cout<<b[i];
	}
	else 
	{
		for(i=l;i<=r;i++)
		cout<<b[i];
	}
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i<n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0);
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%lld", &v[i]);
#define vstr(v,n) vector<string> v(n); REP(i,n) scanf("%lld", &v[i]);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
int k=0,n=0, m=0, l=0,r=0,a=0, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    cin >> x;
    FOR(i,x,1000000){
        if(is_prime(i)){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
const ll INF=1e18;
const ll MOD=998244353;
const double pi=3.1415926;
ll n,m,vis[MAXN];
vector<ll>G[MAXN];
void dfs(ll u)
{
    for(ll i=0;i<G[u].size();i++)
    {
        ll v=G[u][i];
        if(!vis[v])
        {
            vis[v]=1;
            dfs(v);
        }
    }
}
void solve()
{
    ll cnt=0;
    for(ll i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            vis[i]=1;
            dfs(i);
            cnt++;
        }
    }
    printf("%lld\n",cnt);
}
int main()
{
//    freopen("c://duipai//data.txt","r",stdin);
//    freopen("c://duipai//wa.txt","w",stdout);

    while(~scanf("%lld %lld",&n,&m))
    {
        for(ll i=1;i<=m;i++)
        {
            ll x,y,z;
            scanf("%lld %lld %lld",&x,&y,&z);
            G[x].push_back(y);
            G[y].push_back(x);
        }
        solve();
    }
}
/*
100
3
1 1
1
4
1 1 1
1 1
1
*/


Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt(),b = scanner.nextInt(),c = scanner.nextInt();
		if(c >= a && c <= b){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 22484
s=input()
t=input()
n=len(s)
m=len(t)
dp=[[100000]*(m+1) for i in range(n+1)]
dp[0][0]=0
for i in range(n+1):
    for j in range (m+1):
        if i+1<=n:
            if dp[i+1][j]>dp[i][j]:
                dp[i+1][j]=dp[i][j]+1
        if j+1<=m:
            if dp[i][j+1]>dp[i][j]:
                dp[i][j+1]=dp[i][j]+1
        if i+1<=n and j+1<=m:
            if s[i]==t[j]:
                if dp[i+1][j+1]>dp[i][j]:
                    dp[i+1][j+1]=dp[i][j]
            else:
                if dp[i+1][j+1]>dp[i][j]:
                    dp[i+1][j+1]=dp[i][j]+1
print(dp[n][m])


Measured memory_bytes: 42536
n, k = map(int, input().split())

if n % k == 0:
    print(0)
elif n < k:
    if k/2 < n:
        rem = n % k
        if abs(rem-k) < k:
            print(abs(rem-k))
        else:
            print(rem)
    else:
        print(n)
else:
    rem = n % k
    if abs(rem-k) < k:
        print(abs(rem-k))
    else:
        print(rem)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int a[10],i,j,temp;
  for(i=0;i<10;i++){
    cin>>a[i];
  }
  for(i=0;i<10-1;i++){
    for(j=0;j<10-i-1;j++){
      if(a[j]<a[j+1]){
	temp=a[j];
	a[j]=a[j+1];
	a[j+1]=temp;
      }
    }
  }
  for(i=0;i<3;i++){
    cout<<a[i]<<endl;
  }
  return(0);
}

Measured memory_bytes: 3092
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1e9 as usize + 9;

fn main() {
    input! {
        a: usize,
        b: usize,
    }

    let mut s = std::collections::HashSet::new();
    s.insert(a);
    s.insert(b);

    for i in 1..4 {
        if s.get(&i).is_none() {
            println!("{}", i);
        }
    }
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    int H[N];
    for (int i = 0; i < N; i++) cin >> H[i];

    sort(H, H + N, greater<>());

    long long ans = 0;
    for (int i = K; i < N; i++) ans += H[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4352
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int K;
    cin >> K;
    vector<bool> appeard(1000001,false);
    int tmp = 7;
    ll ans = 0;
    while (true) {
        ans++;
        tmp %= K;
        if (tmp == 0) {
            cout << ans << endl;
            return 0;
        }
        if (appeard[tmp]) {
            cout << -1 << endl;
            return 0;
        }
        appeard[tmp] = true;
        tmp = tmp * 10 + 7;
    }
}

Measured memory_bytes: 3752
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>
using namespace std;
using dl=long long;

int main(){
    int l,n;
    cin>>n>>l;
    vector<string> s(n);
    lp(i,n)
        cin>>s[i];
    sort(s.begin(),s.end());
    lp(i,n){
        cout<<s[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
using namespace std;
const int inf=0x3f3f3f3f;
const long long inf2=(1<<62)-1;
const double eps=1e-6;
const int mod=1000000007;
int a[111111];
int a1[111111],a2[111111];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i+=2){
		a1[a[i]]++;
	}
	for(int i=1;i<n;i+=2){
		a2[a[i]]++;
	}
	int mx11=0,mx12=0,mx21=0,mx22=0,mxn11=0,mxn12=0,mxn21=0,mxn22=0;
	for(int i=0;i<=100000;i++){
		if(a1[i]>mx11){
			mx12=mx11;mxn12=mxn11;
			mx11=a1[i];mxn11=i;
		}
		else if(a1[i]>mx12){
			mx12=a1[i];mxn12=i;
		}
	}
	for(int i=0;i<=100000;i++){
		if(a2[i]>mx21){
			mx22=mx21;mxn22=mxn21;
			mx21=a2[i];mxn21=i;
		}
		else if(a2[i]>mx22){
			mx22=a2[i];mxn22=i;
		}
	}
	if(mxn11!=mxn21){
		cout<<n-mx11-mx21<<endl;
	}
	else{
		cout<<n-mx11-max(mx12,mx22)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int mn = n+1;
    int ans = 0;
    REP(i,n){
        int p;
        cin >> p;
        mn = min(mn,p);
        if(mn>=p){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 mt(736);

const int let = 26;
const int max_states = int(1e6) + 1;

struct trie
{
	vector<array<int, let>> next;
	vector<string> who_need;
	vector<int> cnt_in_subtree;

	array<int, let> array_of_minus_ones, array_of_zeros;

	trie ()
	{
		for (auto &it : array_of_minus_ones)
			it = -1;
		for (auto &it : array_of_zeros)
			it = 0;

		next.reserve(max_states + 1);

		next.push_back(array_of_minus_ones);
		who_need.push_back("");
		cnt_in_subtree.push_back(0);
	}

	void add (const string &s, const char what)
	{
		int state = 0;
		cnt_in_subtree[state]++;

		for (char ch : s)
		{
			if (next[state][ch - 'a'] == -1)
			{
				next[state][ch - 'a'] = int(next.size());
				next.push_back(array_of_minus_ones);
				who_need.push_back("");
				cnt_in_subtree.push_back(0);
			}

			state = next[state][ch - 'a'];
			cnt_in_subtree[state]++;
		}

		who_need[state] += what;
	}

	array<int, let> dfs (const int state, ll &ans)
	{
		auto res = array_of_zeros;

		for (int i = 0; i < let; i++)
			if (next[state][i] != -1)
			{
				const int to = next[state][i];
				auto cur = dfs(to, ans);
				assert(cur[i] <= cnt_in_subtree[to]);
				cur[i] = cnt_in_subtree[to];
				for (int j = 0; j < int(cur.size()); j++)
					res[j] += cur[j];
			}

//		if (state == 0)
//		{
//			cerr << "cnt[b] = " << (next[state][1] == -1 ? -1 : cnt_in_subtree[next[state][1]]) << endl;
//
//			for (auto it : res)
//				cerr << it << ' ';
//			cerr << endl;
//		}

		for (char ch : who_need[state])
			ans += res[ch - 'a'];
		for (auto ch : who_need[state])
			res[ch - 'a']++;
		return res;
	}

	ll calc_ans ()
	{
		ll ans = 0;
		dfs(0, ans);
		return ans;
	}
};

void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int n;
	cin >> n;

	vector<string> str(n);
	for (auto &it : str)
	{
		cin >> it;
		reverse(it.begin(), it.end());
	}

	trie data;
	for (auto it : str)
		data.add(it.substr(0, int(it.size()) - 1), it.back());
	cout << data.calc_ans() << endl;
}

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

	cout << fixed;

#ifdef LOCAL
	auto st = clock();

	ifstream fin("../input.txt");

	do
	{
		solve(fin);

		cout << "===" << endl;

		string str;
		while (getline(fin, str) && str != string(max(1, (int) str.size()), '='));
	} while (fin);

	cout << setprecision(6) << "clock: " << ld(clock() - st) / CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  int a;
  cin>>a;
  int y = a / 15;
  cout<<(a*800 - 200*y)<<endl;
  return 0;
}


Measured memory_bytes: 12160
from sys import stdin

N = int(stdin.readline().rstrip())

ans = 0
digit = len(str(N))
for i in range(digit):
    if i % 2 == 1:
        ans += 10 ** i - 10 ** (i - 1)

if digit % 2 == 1:
    ans += N - 10 ** (digit - 1) + 1

print(ans)


Measured memory_bytes: 38384
#include <iostream>

using namespace std;

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

    if (x == y && x == z)
        cout << 1 ;

    else if (x == y||x == z||y == z)
        cout << 2 ;

    else cout << 3 ;

    return 0 ;
}


Measured memory_bytes: 256
(let* ((n (read))
       (arr (make-array n :element-type 'fixnum :initial-element 0))
       (ans 0))
  (loop :for a :from 0 :upto (1- n) :do(setf (aref arr a) (1- (read))))
  (defun f (k)
    (cond ((< n ans) (princ "-1"))
          ((= k 1) (princ ans))
          (t (incf ans) (f (aref arr k)))))
  (f 0))

Measured memory_bytes: 68200
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;
const int M = 1e9+7;

string s;
int mem[N][20];

void add_itself(int & a , int b){
    a %= M;
    b %= M;
    a += b;
    a %= M;
}

int go(int idx , int mod){
    if(idx == s.size()){
        return mod == 5;
    }
    if(~mem[idx][mod])
        return mem[idx][mod];
    int ways = 0;
    if(s[idx] == '?'){
        for(int i = 0; i < 10; i++){
            add_itself(ways , go(idx + 1 , (mod*10 + i)%13 ));
        }
    } else {
        ways = go(idx + 1 , (mod*10 + int(s[idx]-'0')) % 13);
    }
    return mem[idx][mod] = ways;
}

int main(){
    cin >> s;
    memset(mem , -1 , sizeof mem);
    cout << go(0 , 0) << endl;
}
// number % 13 == 5
/*109%13==5
1%13 = 1
10 % 13 = 10
109 % 13 = 5


2865 % 13 = 5
2*10 - 13 = 7
*/

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

#define MAX 244140625

int Hash[MAX];
char s[13];

int getChar(char);
int getKey();
int find();
void insert();

int main(){
  int n;
  char com[7];

  scanf("%d" ,&n);
  while(n--){
    scanf("%s %s" ,com ,s);

    if(com[0] == 'i'){
      insert();
    }else{
      if(find()){
	puts("yes");
      }else{
	puts("no");
      }
    }
  }

  return 0;
}

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

int getKey(){
  int sum = 0, p = 1, i;

  for(i = 0 ; i < strlen(s) ; i++){
    sum += p*(getChar(s[i]));
    p *= 5;
  }
  return sum;
}

int find(){
  int key = getKey();

  if(Hash[key]){
    return 1;
  }

  return 0;
}

void insert(){
  Hash[getKey()] = 1;
}



Measured memory_bytes: 18624
def main():
    N = int(input())
    A = list(map(int, input().split()))

    current = A[0]
    answer = 0
    for i in range(N):
        if A[i] < current:
            answer += current - A[i]
        elif A[i] > current:
            current = A[i]

    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 32188
class Dice:
    def __init__(self):
        self.numbers = map(int, raw_input().split())
        
    def roll(self, direction):
        if direction == "N":
            before_inds = [0, 1, 5, 4]
            after_inds  = [1, 5, 4, 0]
        elif direction == "S":
            before_inds = [0, 1, 5, 4]
            after_inds  = [4, 0, 1, 5]
        elif direction == "E":
            before_inds = [0, 2, 5, 3]
            after_inds  = [3, 0, 2, 5]
        elif direction == "W":
            before_inds = [0, 2, 5, 3]
            after_inds  = [2, 5, 3, 0]
        else:
            return False
        changed = [self.numbers[i] for i in after_inds]
        for c_i, n_i in enumerate(before_inds):
            self.numbers[n_i] = changed[c_i]
        return True
        
dice = Dice()
for d in raw_input():
    dice.roll(d)
    
print dice.numbers[0]

Measured memory_bytes: 6444
/*	ex5_4
	suzuto	*/

#include <stdio.h>
#define  LIMIT 10

int main(void) {
  char word[LIMIT]; /*変数の宣言*/
  char *w_ptr, ins;
  int max_count = 0, count = 0, i;

  scanf("%s", word); /*調べる文字列を入力*/
  w_ptr = word; /*文字列の最初の要素のアドレスを記憶*/
  for(i = 0; i < LIMIT + 1; i++){
    ins = *(w_ptr++); /*注目する要素を一時記憶*/
    if(ins == '\0'){ /*文字の終端を判定*/
      break;
    }
    if(ins == 'A'||ins == 'C'||ins == 'G'||ins == 'T'){ /*insが'A','C','G','T'のいずれかに含まれるか判定*/
      count++; /*含まれていたのでカウントを継続*/
    }else{
      if(max_count < count){ /*最長の部分文字列か判定*/
        max_count = count; /*答えを更新*/
      }
      count = 0; /*countを初期化*/
    }
  }
  if(max_count < count){ /*最後に更新されなかった時*/
    max_count = count; /*答えを更新*/
  }
  printf("%d\n", max_count);/*結果を出力*/
  return 0;
}


Measured memory_bytes: 1732
import java.util.*;

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

    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();

    int max=Math.max(a,Math.max(b,c));
    System.out.println(a+b+c-max);

    sc.close();
  }
}



Measured memory_bytes: 21972
#include<stdio.h>

int main(void)
{
    int a, b, c, n, i;

    n = 0;

    scanf("%d %d %d", &a, &b, &c);

    for(i = a; i <= b; i++)
    {
        if(c % i == 0)
        {
            n++;
        }
    }

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

    return 0;
}


Measured memory_bytes: 2100
puts "Yes"

n, m = gets.to_s.split.map{|e|e.to_i}

g = Array.new(n){ [] }
m.times do
  a, b = gets.to_s.split.map{|e|e.to_i - 1}
  g[a] << b
  g[b] << a
end

used = Array.new(n){ false }
ans = Array.new(n)

q = [0]
used[0] = true

while q.any?
  
  v = q.shift
  g[v].each do |u|
    next if used[u] 
    ans[u] = v + 1
    used[u] = true
    q.push u
  end
end

puts ans[1, n-1]

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

int main() {
    int n,m,i,sum=0;
    cin>>n>>m;
    int a[m];
    for(i=0;i<m;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum<=n)
    {
        cout<<n-sum;
    }
    else
        cout<<"-1";
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define mod 1000000007
typedef long long ll;
using namespace std;

const int M = (int)(2e6 + 239);

ll nCr(int n, int r)
{

    ll p=1,k=1;
    if (n-r<r)
    {
        r=n-r;
    }
    if(r!=0)
    {
        while(r)
        {
            p*=n;
            k*=r;
            ll m=__gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else
    {
        p=1;
    }
    return p;
}

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

    ll a,b;
    cin>>a>>b;
    ll sum=0;
    if(a>1)
    {
        sum=sum+nCr(a,2);
    }
    if(b>1)
    {
        sum=sum+nCr(b,2);
    }
    else if(a==1 && b==1)
    {
        sum=0;
    }
    cout<<sum<<endl;
}


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

int main() {
    int a , b;

    cin >> a >> b;
    int i;

    i = a * b;

    if(i % 2 == 0){
        cout << "Even" << endl;
    }else{
        cout << "Odd" << endl;
    }
}

Measured memory_bytes: 3596
def get_max_length(grid, n)
  max_length = 0

  for y in 0...n
    length = 0
    for x in 0...n
      if grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
    end
  end

  for x in 0...n
    length = 0
    for y in 0...n
      if grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
    end
  end

  for i in 0..(n * 2 - 2)
    length = 0
    x = 0
    y = i - x
    while x < n && y >= 0
      if y < n && grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
      x += 1
      y -= 1
    end
  end

  for i in 0..(n * 2 - 2)
    length = 0
    x = 0
    y = n - 1 - i - x
    while x < n && y < n
      if y >= 0 && grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
      y += 1
      x += 1
    end
  end

  max_length
end

while line = gets
  n = line.chomp.to_i
  break if n == 0

  grid = []
  n.times do
    grid << gets.chomp.split('').map(&:to_i)
  end

  puts get_max_length(grid, n)
end

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

int main() {
  char s[100001] = {};
  scanf("%s", &s);

  char judge[4] = {};
  judge[1] = s[0];
  judge[2] = s[1];
  for(int i=0; i<100001; i++){
    judge[0] = judge[1];
    judge[1] = judge[2];
    judge[2] = s[i+2];

    if((judge[0]==judge[1]||judge[1]==judge[2])||judge[2]==judge[0]){
      if(judge[2]=='\0'){
        printf("%d %d\n", i+1, i+2);
      }else{
        printf("%d %d\n", i+1, i+3);
      }
      break;
    }
    if(judge[2]=='\0'){
      printf("%d %d\n", -1, -1);
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 1828
N = int(input())
A = map(int, input().split())
B = list(A)
B.sort()
B.reverse()
Alice = 0
Bob = 0
for i in range(N):
    if i % 2 == 0:
        Alice += B[i]
    else:
        Bob += B[i]
print(Alice - Bob)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define MAX 1000005
#define MOD (ll)(1e9+7)
using namespace std;

void solve()	{
    int n,t;
    cin >> n >> t;
    ll a[n+1];
    a[n]=INT32_MAX;
    for(int i=0; i<n; i++)  cin >> a[i];
    ll ans=0;
    for(int i=1; i<=n; i++) {
        if(a[i]-a[i-1]>=t) ans+=t;
        else ans+=a[i]-a[i-1]; 
    }
    cout << ans << endl;
}

int main()	
{
	int t=1;
	//cin >> t;
	for(int i=1; i<=t; i++)	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 5132
from collections import defaultdict

N = int(input())
dic = defaultdict(list)
for i in range(N):
    S, P = input().split(" ")
    P = int(P)
    dic[S].append((P, i))

for c in sorted(dic.keys()):
    for v, i in sorted(dic[c], key=lambda x: x[0], reverse=True):
        print(i + 1)

Measured memory_bytes: 3444
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    var s = next()
    val t = next()

    for (i in 1..s.length) {
        s = s.takeLast(1) + s.take(s.length-1)
        if (s == t) {
            println("Yes")
            return
        }
    }

    println("No")
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 31852
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <lli>>;
const int mod = 1e9 + 7;
const lli inf = 1e18;

const int N = 2e5 + 1;
int n,m,R;
vector <int> r;
vvint adj;

void floyd(){
	for(int k = 0;k < n;++k){
		for(int i = 0;i < n;++i){
			for(int j = 0;j < n;++j){
				if(adj[i][k] + adj[k][j] < adj[i][j]){
					adj[i][j] = adj[i][k] + adj[k][j];
				}
			}
		}
	}
	return;
}

void solve(){
	cin >> n >> m >> R;
	r = vector <int> (R);
	for(int i = 0;i < R;++i){
		int num;
		cin >> num;
		--num;
		r[i] = num;
	}
	sort(r.begin(),r.end());
	adj = vvint(n,vector <lli>(n,inf));
	for(int i = 0;i < m;++i){
		int a,b,c;
		cin >> a >> b >> c;
		--a;--b;
		adj[a][b] = c;
		adj[b][a] = c;
	}
	floyd();
	lli minn = 2e18;
	do{
		lli summ = 0;
		for(int i = 1;i < R;++i){
			summ = summ + adj[r[i]][r[i - 1]];
		}
		minn = min(minn,summ);
	}while(next_permutation(r.begin(),r.end()));
	cout << minn << newl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3748
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI = 2*acos(0.0);

signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	int h[n];
	for(int i=0;i<n;i++)cin>>h[i];
	vector<int> v;
	for(int i=0;i<n-1;i++)
		if(h[i]<h[i+1])
			v.push_back(i);
	int res = 0;
	for(int i=0;i<n;i++)
	{
		int loc = lower_bound(v.begin(),v.end(),i) - v.begin();
		if(loc==v.size())
			res=max(res,n-i-1);
		else
			res=max(res,v[loc]-i);
	}		
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1276
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int, int>P;
typedef pair<string, pair<int, int>>PP;
typedef long long ll;

int main() { 
	ll n, k; cin >> n >> k;
	ll ans = 0;
	if (k != 0) {
		for (int b = k + 1; b <= n; b++) {
			int p = n / b, r = n % b;
			ans += p * max(0ll, b - k);
			ans += max(0ll, r - k + 1);
		}
	}
	else {
		ans = n * n;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n: i32 = read();
    let x: Vec<i32> = read_vec();

    let a: i32 = x.iter().sum();
    let a = a as f32;
    let n = n as f32;
    let point = (a / n).round();

    let point = point as i32;

    let ans = x.iter().map(|i| {
        let j = i - point;
        j.pow(2)
    }).sum::<i32>();

    println!("{}", ans);
}

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

int n,m,L;
int apsp[305][305];
int fuel[305][305];

int q;

int main(){
	scanf("%d%d%d",&n,&m,&L);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(i==j) apsp[i][j] = fuel[i][j] = 0;
			else apsp[i][j] = fuel[i][j] = 1e9+7;
		}
	}
	for(int i=1;i<=m;i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		apsp[u][v] = min(apsp[u][v] , w);
		apsp[v][u] = min(apsp[v][u] , w);
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				apsp[i][j] = min(apsp[i][j], apsp[i][k] + apsp[k][j]);
			}
		}
	}
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(i==j) continue;
			if(apsp[i][j] <= L) fuel[i][j] = 1;
		}
	}
	
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j]);
			}
		}
	}
	
	scanf("%d",&q);
	while(q--){
		int s,t;
		scanf("%d%d",&s,&t);
		if(fuel[s][t] >= 1e9) printf("-1\n");
		else printf("%d\n",fuel[s][t]-1);
	}
	
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>		//线段树维护区间和
#define ll long long
#define inf 0x3f3f3f3f 
using namespace std;
const int maxn = 1e5+10;
int a[200005];
int n,k;
int check(int mid){
	int sum = 0;
	for(int i = 1; i <= n; i ++){
		if(a[i] != mid) sum += a[i]/mid;
		if(sum > k) return 0;
	}
	return sum <= k;
}
int main(){
	scanf("%d %d", &n, &k);
	int l = 1;
	int r = -1;
	for(int i = 1; i <= n; i ++){
		scanf("%d", a+i);
		r = max(r,a[i]);
	}
	if(k == 0){
		printf("%d\n", r);
		return 0;
	}
	int ans;
	while(l<r){
		int mid = (l+r)/2;
		if(check(mid)){
			r = mid;
			ans = mid;
		}else l = mid + 1;
	}
	printf("%d\n", r);

 	return 0;
}

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

int main(){
 int A,B,C,D;
  cin>>A>>B>>C>>D;
 while(A>0&&C>0){
   C-=B;
   if(C<=0){
     cout<<"Yes"<<endl;
     break;
   }
   A-=D;
   if(A<=0){
     cout<<"No"<<endl;
     break;
   }
 }
    
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
// #include"testlib.h"

using namespace std;

#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()

const int MX = (int)5e5 + 10;
const int mod = 998244353;

int main(int argc, char* argv[]){

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

    // registerGen(argc, argv, 1);

    int n, d;
    cin >> n >> d;

    int point[n][d];
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < d; ++j){
            cin >> point[i][j];
        }
    }

    int res = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            int acc = 0;
            for(int k = 0; k < d; ++k){
                int x = point[i][k] - point[j][k];
                acc += x * x;
            }
            int sq = sqrt(acc);
            res += sq * sq == acc;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll n, a, cnt = 0, l[2];
	in(n);
	map<ll, ll> dic;
	rep(i, 0, n) {
		in(a);
		dic[a]++;
	}

	auto itr = dic.end();
	while (cnt < 2)
	{
		itr--;
		if (itr->second > 3 && cnt==0) {
			outn(itr->first * itr->first);
			return 0;
		}
		else if (itr->second > 1) {
			l[cnt] = itr->first;
			cnt++;
		}

		if (itr == dic.begin()) {
			break;
		}
	}

	if (cnt == 2) {
		outn(l[0] * l[1]);
	}
	else {
		outn(0);
	}

	return 0;
}


Measured memory_bytes: 6528
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	a := strings.Split(s, "S")
	var count int
	for _, v := range a {
		if v != "" && len(v) > count {
			count = len(v)
		}
	}
	fmt.Println(count)
}

func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 1836
#include<iostream>
#include<iomanip>
#include<vector>
#include<climits>
using namespace std;
typedef long long ll;

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

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

int main(){
    ll n, m;
    while(cin >> n >> m, n+m){
        ll cnt = 0, sum = 0, p[m];
        for(int i = 0; i < m; i++)  cin >> p[i];
        for(int i = 1; i < 1<<m; i++){
            vector<ll> v;
            for(int j = 0; j < m; j++){
                if((i>>j)&1)   v.push_back(p[j]);
            }
            ll val = v[0];
            for(ll j : v){
                val = lcm(val, j);
            }
            int num = v.size();
            if(num%2 == 0)      cnt -= n/val, sum -= n/val*(n/val+1)/2*val;
            else if(num%2 == 1) cnt += n/val, sum += n/val*(n/val+1)/2*val;
        }
        cnt = n-cnt;
        sum = n*(n+1)/2-sum;
        if(cnt == 0)    sum = 0, cnt = 1;
        cout << fixed << setprecision(12) << (double)sum/cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 3260
#include<bits/stdc++.h>
using namespace std;
int dp[3005][3005];



int main()
{
	string s,t;
	cin>>s;
	cin>>t;
	int n = s.length();
	int m = t.length();
	
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			if(i==0 || j==0)
			{
				dp[i][j] = 0;
				continue;
			}
			if(s[i-1]==t[j-1])
			{
				dp[i][j] = dp[i-1][j-1]+1;
			}
			else{
				dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
			}	
		}
	}
	string ss="";
	/*
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			
		}
		
	}*/
	int i=n,j=m;
	int len=dp[n][m];
	while(i>0&&j>0)
	{
		
		if(s[i-1]==t[j-1])
		{
			ss+=t[j-1];
			i--;j--;
			
		}
		else 
		{
			if(dp[i][j-1]<dp[i-1][j])
			{
				i--;
			}
			else j--;
		}
		
	}
	reverse(ss.begin(),ss.end());
	cout<<ss<<endl;
	//cout<<dp[n][m]<<endl;
	
	return 0;
}

Measured memory_bytes: 35456
using System;
using System.Linq;

namespace Aizu {
    class OnlineJudge {
        static void Main() {
            int count = 0;
            foreach (var c in Console.ReadLine()) {
                if (((count & 1) == 0 && c == 'A') || ((count & 1) == 1 && c == 'Z')) {
                    ++count;
                }
            }
            Console.WriteLine(count >= 2 ? string.Concat(Enumerable.Repeat("AZ", count >> 1).ToArray()) : "-1");
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0;i < n;i++){
        cin >> p[i];
        p[i]--;
    }

    vector<int> a(n);
    vector<int> b(n);
    for(int i = 0;i < n;i++){
        a[i] = n * (i + 1);
        b[i] = n * (n - i);
    }

    for(int i = 1;i < n;i++){
        b[p[i]] += i;
    }

    for(int i = 0;i < n;i++)cout << a[i] << ' ';
    cout << '\n';
    for(int i = 0;i < n;i++)cout << b[i] << ' ';
    cout << '\n';
}


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

int main(void){
	int i, j;

	int a[50000];
	int x = 8, y = 13;
	a[0] = 6;
	i = 1;
	while(1){
		for(j = 0; j < i; j++){
			if(!(x % a[j])) break;
		}
		if(j == i){
//cout << x << endl;
			a[i] = x;
			i++;
		}

		if(a[i - 1] > 300000) break;
		for(j = 0; j < i; j++){
			if(!(y % a[j])) break;
		}
		if(j == i){
//cout << y << endl;
			a[i] = y;
			i++;
		}
		if(a[i - 1] > 300000) break;
		x += 7;
		y += 7;
	}

//for(j = i - 10; j < i; j++) cout << a[j] << endl;

	int n;
	while(cin >> n, n != 1){
		cout << n << ":";
		for(i = 0; a[i] <= n; i++){
		 	if(!(n % a[i])) cout << " " << a[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1304
# ABC068-B
N = int(input())
if N == 1:
    print(N)
elif N < 4:
    print(2)
elif N < 8:
    print(4)
elif N < 16:
    print(8)
elif N < 32:
    print(16)
elif N < 64:
    print(32)
else:
    print(64)

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

int main()
{
	int search(int head, int nail, int key, int a[]);

	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];

	int q, o;
	cin >> q;
	while (q--)
	{
		cin >> o;
		if (search(0, n - 1, o, a)==1)cout << "1" << endl;
		else cout << "0" << endl;
	}
	return 0;
}

int search(int head, int nail, int key, int a[])
{	
	if(head>nail)return 0; 
	int mid;
	mid =( nail+head) / 2;
	if (a[mid] > key)return search(head, mid - 1, key, a);
	else if (a[mid] < key) return search(mid + 1, nail, key, a);
	else return 1;

}



Measured memory_bytes: 3496
N,M,C=map(int,input().split())
B=list(map(int, input().split()))
ok=0
for i in range(N):
  A=list(map(int, input().split()))
  x=0
  for i in range(M):
    x+=A[i]*B[i]
  if x+C>0:
    ok+=1
print(ok)

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int len = s.length();

    for(int i = 0; i < len; i+= 2){
        cout << s[i];
    }

    return 0;
}


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

int main(){
    string w;
    int cnt[26]={0};
    cin >> w;
    for(int i=0; i<w.length(); i++){
        cnt[(w[i]-'a'+0)]++;
    }
    
    for(int i=0; i<26; i++){
        if(cnt[i]%2 != 0){
            cout << "No" <<endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int line[3][4] = {{1,2,4,3},{0,3,5,2},{0,1,5,4}}; 

struct dice {
	int f2n[6];
	map<int,int> n2f;
};

int main(void) {
	dice d1,d2;
	for (int i = 0; i < 6; ++i) {
		cin >> d1.f2n[i];
		d1.n2f[d1.f2n[i]] = i+1;
	}
	for (int i = 0; i < 6; ++i) {
		cin >> d2.f2n[i];
		d2.n2f[d2.f2n[i]] = i+1;
	}

	bool equal = false;
	for (int f = 0; !equal && f < 3; ++f) {
		if ((d1.f2n[0] == d2.f2n[f])&&(d1.f2n[5] == d2.f2n[5-f])) {
			for (int i = 0; !equal && i < 4; ++i) {
				bool seq = true;
				for (int j = 0; seq && j < 4; ++j) {
					if (d1.f2n[line[0][j]] != d2.f2n[line[f][(i+j)%4]]) {
						seq = false;
					}
				}
				if (seq) {
					equal = true;
				}
			}
		}
		else if ((d1.f2n[0] == d2.f2n[5-f])&&(d1.f2n[5] == d2.f2n[f])) {
			for (int i = 0; !equal && i < 4; ++i) {
				bool seq = true;
				for (int j = 0; seq && j < 4; ++j) {
					int next = i-j;
					if (next < 0) {
						next = 4 + (i-j);
					}
					if (d1.f2n[line[0][j]] != d2.f2n[line[f][next]]) {
						seq = false;
					}
				}
				if (seq) {
					equal = true;
				}
			}
		}
	}
	if (equal) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}




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

int main() {
  int a,b,c,k,s=0;
  cin>>a>>b>>c>>k;
  if(a+b >= k){
    if(a >= k){
      s=k;
    }else{
      s=a;
    }
  }else{
    s=a;
    s-=k-a-b;
  }
  cout<<s<<endl;
}

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

int main() {
  int N;
  cin >> N;
  string s, t;
  cin >> s >> t;
  string ans = s + t;
  int dif = 0;
  for (int i = 2 * N - 1; i >= N; i--) if (ans.substr(N - (2 * N - i), 2 * N - i) == ans.substr(N, 2 * N - i)) dif = 2 * N - i;
  cout << ans.size() - dif << endl;
  return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if j > 0 and a[i][j-1] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif j < w - 1 and a[i][j+1] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif i > 0 and a[i-1][j] != "." and a[i][j] == "#":
      a[i][j] = "*"
    elif i < h - 1 and a[i+1][j] != "." and a[i][j] == "#":
      a[i][j] = "*"

print("No" if sum([row.count("#") for row in a]) else "Yes")

Measured memory_bytes: 3188
#include <iostream> 
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main() {
    int N, M, d, SUM = 0;
    cin >> N >> M;
    vector<int>X(M);
    vector<int>D(M-1);

    for(int i = 0; i < M; i++) {
        cin >> X[i];
    }
    
    sort(X.begin(), X.end());

    for(int i = 0; i < M-1; i++) {
        D[i] = X[i+1] - X[i];
    }

    sort(D.begin(), D.end(), greater<int>());
    
    SUM = X[M-1] - X[0];

    
    if (N >= M) {
        SUM = 0;
    } else {
        for(int i = 0; i < N-1; i++) {
            SUM -= D[i];
        }
    }
    
    
    cout << SUM << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, hiduke;
  cin >> S;
  hiduke = "2019/05/01";

if ( S < hiduke ) {
   cout << "Heisei" << endl; //入力した日付が4月30日までなら平成
}
if ( S >= hiduke ) {
   cout << "TBD" << endl;
  }
}

Measured memory_bytes: 256