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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = a; i >= b; i--)

const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    int h, w;
    cin >> h >> w;
    vector<vector<char>> matrix(h, vector<char>(w));
    REP(i, 0, h)
    {
        REP(j, 0, w)
        {
            cin >> matrix[i][j];
        }
    }
    vector<vector<ll>> dp(h + 1, vector<ll>(w + 1, 0));
    dp[1][1] = 1;

    REP(i, 1, h + 1)
    {
        REP(j, 1, w + 1)
        {
            if (matrix[i - 1][j - 1] == '.')
            {
                (dp[i][j] += dp[i - 1][j] + dp[i][j - 1]) %= MOD;
            }
            else
            {
                dp[i][j] = 0;
            }
        }
    }
    cout << dp[h][w] % MOD;
    return 0;
}

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

//エイリアス
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    ll N;
    io.read(N);
    auto v = io.read_vec<int>(N);

    priority_queue<double, vector<double>, greater<double>> q;

    for(int i = 0; i < N; i++){
        q.push(v[i]);
    }
    while(q.size() > 1){
        double tmp = q.top();
        q.pop();
        tmp += q.top();
        q.pop();
        q.push(tmp / 2);
    }

    cout << fixed << setprecision(5) << q.top();
    return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;
 
struct edge{
    ll src,dst,cost;
    edge(ll src,ll dst,ll cost):
    src(src),dst(dst),cost(cost){}
    };
vector<edge> ve;
ll d[1001];
int inf=1000100010;
int n,m;
bool negcy=false;
int bellman_ford(int st){
    rep(i,n) d[i]=-1000100010001000;
    d[st]=0;
    int cnt=0;
    while(1){
        bool update =false,nupdate=false;
        rep(i,ve.size()){
            edge e=ve[i];
            if(d[e.src]!=-1000100010001000&&d[e.dst]<d[e.src]+e.cost){
                d[e.dst]=d[e.src]+e.cost;
                update=true;
                if(e.dst==n-1) nupdate=true;
            }
        }
        if(!update) break;
        if(cnt>=ve.size()){
            if(nupdate){
                negcy=true;
            }
            break;
        }
        ++cnt;
    }
}
int main(){
    int sr,ds,cs;
    cin>>n>>m;
    rep(i,m){
        cin>>sr>>ds>>cs;
        ve.pb(edge(sr-1,ds-1,cs));
    }
    bellman_ford(0);
    if(negcy) cout<<"inf"<<endl;
    else cout<<d[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		while (scanner.hasNext()) {

			// 人数取得
			int count = scanner.nextInt();
			if (count == 0) {
				break;
			}

			// 合計取得
			int sum = 0;
			int pointArray[] = new int[count];
			for (int i = 0; i < count; i++) {
				int point = scanner.nextInt();
				pointArray[i] = point;

				sum = sum + point;
			}

			// 平均値取得
			int avg = sum / count;

			// 平均値以下取得
			int counter = 0;
			for (int i = 0; i < count; i++) {
				if (avg >= pointArray[i]) {
					counter++;
				}
			}

			System.out.println(counter);
		}

		scanner.close();
	}
}



Measured memory_bytes: 58544
#include<cstdio>
#include<cstring>
char s[100005];

int solve(int n){
    int p = 1, ans = n;
    while(p<=n){
        if(s[p]=='0') p++;
        else{
            int np = p;
            while(np+1<=n && s[np+1]==s[p]) np++;
            int need = p-1;
            if(n-np>need) need = n-np;
            if(need<ans) ans = need;
            p = np+1;
        }
    }
    return ans;
}

int main(){
    scanf("%s",s+1);
    int n = strlen(s+1);
    int ans = solve(n);
    for(int i = 1; i <= n; i++){
        if(s[i]=='0') s[i] = '1';
        else s[i] = '0';
    }
    int need = solve(n);
    if(need>ans) ans = need;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1828
package main

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

var n int
var count = 0
var numsOf753 = [3]string{"3", "5", "7"}

func dfs(v string) {
	if strings.Contains(v, "3") && strings.Contains(v, "5") && strings.Contains(v, "7") {
		count++
	}

	for _, next := range numsOf753 {
		tmp := next + v
		if m, _ := strconv.Atoi(tmp); m > n {
			continue
		}

		dfs(tmp)
	}
}

func main() {
	n = getInt()

	for _, v := range numsOf753 {
		dfs(v)
	}

	fmt.Println(count)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// tmp := 200001
	// sc.Buffer(make([]byte, tmp), tmp)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


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

int main(){
  int A,B;
  cin >> A >> B;
  int count = 0;
  int X;
  for(int i = 0;i < A;i++){
    cin >> X;
   if(B <= X){
     count++;
   }
  }
  cout << count << endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999;

int num(int n){
    int res=0;
    while(n%2==0){
        n/=2;
        res++;
    }
    return res;
}

int main(){
    int n;
    cin>>n;
    int ans=INF;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ans=min(ans,num(a));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    ll N,K,ans=0;
    cin>>N>>K;
    vector<ll> H(N);
    for(int i=0;i<N;i++) cin>>H[i];
    sort(H.rbegin(),H.rend());
    for(int i=K;i<N;i++) ans+=H[i];
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
const long long mod=1e9+7; //10^9+7

ll gcd(ll m, ll n){
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

ll func(ll a, ll c, ll d){
    ll cc = a/c;
    ll dd = a/d;
    ll x = c*d;
    if(c<d){
        ll tmp = c;
        c=d;
        d=tmp;
    }
    ll r = c%d;
    while(r!=0){
        c=d;
        d=r;
        r=c%d;
    }
    ll gcd = x/d;

    ll ee = a/gcd;
    return cc+dd-ee;
}

int main() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll aa,bb;
    aa = func(a-1,c,d);
    bb = func(b,c,d);

    cout << (b-a+1)-(bb-aa)<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        HashSet<Long> set = new HashSet<>();
        for (long i = 1; i * i <= N; i++) {
            if (N % i == 0) {
                set.add(i);
                set.add(N / i);
            }
        }
        for (long i = 1; i * i <= N - 1; i++) {
            if ((N - 1) % i == 0) {
                set.add(i);
                set.add((N - 1) / i);
            }
        }
        int res = 0;
        for (long i : set) {
            if (i == 1) continue;
            long temp = N;
            while (temp % i == 0) {
                temp /= i;
            }
            temp %= i;
            if (temp == 1) res++;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 24148
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;

void main()
{
  auto n=map!(to!int)(readln.strip.split);
  writefln("%d %d %.5f",n[0]/n[1],n[0]%n[1],cast(double)n[0]/n[1]);
}

Measured memory_bytes: 2544
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int f(int i,int x){
	return i*(100+x)/100;
}

int main(){
	while(1){
		int x,y,s;
		cin>>x>>y>>s;
		if(x==0) break;
		int res=0;
		for(int i=1;i<=s;i++) for(int j=1;j<=s;j++){
			if(f(i,x)+f(j,x)==s) res=max(res,f(i,y)+f(j,y));
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{ 
    ll n,k;
    cin>>n>>k;
    ll i,j;
    ll a[n];
    ld sum[n];
    
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
       ll no = a[i]*(a[i]+1);
       no/=2;
       ld tt = 1.0*no;
       tt/=a[i];
       sum[i]=tt;
    //    cout<<sum[i]<<" ";
    }
    ld pre[n];
    pre[0]=sum[0];
    ld maxi=0;
    for(i=1;i<n;i++)
    {
        pre[i]=pre[i-1]+sum[i];
    }
    if(k==n)
    {
        cout<<pre[n-1]<<"\n";
        return;
    }
    for(i=k;i<n;i++)
    {
        ld tans = pre[i]-pre[i-k];
        maxi=max(maxi,tans);
    }
    cout<<fixed<<maxi<<"\n";

}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 11592
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int maxn=-1,n,m,a[100005],minn=1926081700;
int main()
{
    std::ios::sync_with_stdio(false);
    cin>>n>>m;
    for(register int i=1;i<=n;++i)
    {
        cin>>a[i];
        a[i]=abs(a[i]-m);
        minn=min(minn,a[i]);
    }
    int k=sqrt(minn);
    bool flag;
    for(register int i=minn;i>=k;--i)
    {
        flag=0;
        if(!(minn%i))
        {
            for(register int j=1;j<=n;++j)
                if(a[j]%i)
                {
                    flag=1;
                    break;
                }
            if(!flag)
            {
                cout<<i;
                return 0;
            }
            flag=0;
            int q=minn/i;
            for(register int j=1;j<=n;++j)
                if(a[j]%q)
                {
                    flag=1;
                    break;
                }
            if(!flag)
                maxn=max(maxn,i);
        }
    }
    if(maxn!=-1)
        cout<<maxn;
    else
        cout<<1;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
a = []
for i in range(n):
    A = int(input())
    a.append(A)
a_1 = list(set(a))[-1]
if a.count(a_1) >= 2:
    for i in range(n):
        print(a_1)
else:
    a_2 = list(set(a))[-2]
    for i in range(n):
        if a[i] == a_1:
            print(a_2)
        else:
            print(a_1)

Measured memory_bytes: 23352
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    while (1)
    {
        int n, m;
        cin >> n >> m;
        if (n == 0)
            break;
        vector<int> Max(n, 0), Min(n, 0);
        rep(i, m)
        {
            int s, k;
            cin >> s >> k;
            rep(j, k)
            {
                int c;
                cin >> c;
                c--;
                Max[c] += s;
                if (k == 1)
                    Min[c] += s;
            }
        }
        int MAX1 = -1, MAX2 = -1, MIN1 = INF, MIN2 = INF;
        int who[4];
        rep(i, n)
        {
            if (MAX1 <= Max[i])
            {
                MAX2 = MAX1;
                MAX1 = Max[i];
                who[1] = who[0];
                who[0] = i;
            }
            else if (MAX2 <= Max[i])
            {
                MAX2 = Max[i];
                who[1] = i;
            }
            if (MIN1 >= Min[i])
            {
                MIN2 = MIN1;
                MIN1 = Min[i];
                who[3] = who[2];
                who[2] = i;
            }
            else if (MIN2 >= Min[i])
            {
                MIN2 = Min[i];
                who[3] = i;
            }
        }
        if (who[0] != who[2])
            cout << MAX1 - MIN1 + 1 << endl;
        else
            cout << max(MAX1 - MIN2 + 1, MAX2 - MIN1 + 1) << endl;
    }
}



Measured memory_bytes: 3216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

const int MAX=510000;
const int mod=1000000007;
ll fac[MAX],finv[MAX],inv[MAX];

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a){
  return modpow(a,mod-2);
}

void init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  rep(i,MAX){
    if(i>1){
      fac[i]=fac[i-1]*i%mod;
      inv[i]=mod-inv[mod%i]*(mod/i)%mod;
      finv[i]=finv[i-1]*inv[i]%mod;
    }
  }
}

ll com(int n,int k){
  if(n<k) return 0;
  if(n<0||k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

int main(){
  ll N,M;
  cin>>N>>M;
  ll mod=1e9+7;
  init();
  ll ans=0;
  rep(i,N+1){
    ll tmp=com(N,i);
    (tmp*=com(M,i)*fac[i]%mod)%=mod;
    (tmp*=com(M-i,M-N)*fac[N-i]%mod)%=mod;
    (tmp*=com(M-i,M-N)*fac[N-i]%mod)%=mod;
    if(i%2) tmp=mod-tmp;
    (ans+=tmp)%=mod;
  }
  cout<<ans<<endl;
}


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

const int MN = 100005;
int n, m, odd, c[3], vis[MN];
vector<int> e[MN];

void f(int x, int y){
	if(vis[x]){
		odd |= (vis[x] != y);
		return;
	}
	vis[x] = y;
	c[y]++;
	for(auto &i : e[x]) f(i, 3 - y);
}

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 0, x, y; i < m; i++){
		scanf("%d%d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	f(1, 1);
	if(odd) printf("%lld\n", 1LL * n * (n - 1) / 2 - m);
	else printf("%lld\n", 1LL * c[1] * c[2] - m);
}

Measured memory_bytes: 6528
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    String ans = "War";
    int[] x = new int[n];
    int[] y = new int[m];
    for (int i = 0; i < n; i++) {
        x[i] = sc.nextInt();  
    }
    for (int i = 0; i < m; i++) {
        y[i] = sc.nextInt();
    }
    loop: for (int i = X; i < Y; i++) {
        for (int j = 0; j < n; j++) {
            if (x[j] > i) {
                continue loop;
            }
        }
        for (int j = 0; j < m; j++) {
            if (y[j] <= i) {
                continue loop;
            }
        }
        ans = "No War";
        break;
    }
    System.out.println(ans);
	}
}


Measured memory_bytes: 21844
n, k = map(int,input().split())
ans = 0
for b in range(k+1,n+1):
  q = n//b
  r = n%b
  #print(b,q,r,q*(b-k), max(0,r-k))
  ans += q*(b-k)
  ans += max(0,r-k+1)
if k ==0 : ans -=n
print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 8;
ll a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  cout << a*b/__gcd(a, b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define int long long
#define P pair<int,int>

int a[10][10];

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

    memset(a,0,sizeof(a));
    for(int i = 1; i <= n; i++){
        if(i % 10 == 0) continue;
        string s = to_string(i);
        int x = s[0] - '0';
        int y = s[s.size() - 1] - '0';
        a[x][y]++;
    }

    int ans = 0;
    for(int i = 1; i <= 9 ; i++){
        for(int j = 1; j <= 9; j++){
            ans += a[i][j] * a[j][i];
        }
    }
    cout << ans << endl;
}

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

void solve() {
	int d, t, s; cin >> d >> t >> s;
	if (s * t >= d)cout << "Yes";
	else cout << "No";

}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		long ans = (long) lcm(a,b) ;
		
		System.out.println(ans);
		
	}
	
	static long lcm (int a, int b) {
		int temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (long)(c/b);
	}
}


Measured memory_bytes: 21204
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int a[100010];
int main(){
	int n;
	std::cin>>n;
	int k=0;
	REP(i,n){
		if(i*(i+1)>2*n){
			puts("No");
			return 0;
		}
		if(i*(i+1)==2*n){
			k=i+1;
			break;
		}
	}
	puts("Yes");
	std::cout<<k<<std::endl;
	std::vector<std::vector<int>> vec(k+1);
	int cnt=1;
	REP(i,k-1){
		for(int j=i+1;j<=k;j++){
			vec[i].push_back(cnt);
			vec[j].push_back(cnt);
			cnt++;
		}
	}
	REP(i,k){
		std::cout<<k-1<<" ";
		printArray(all(vec[i]));
	}
	return 0;
}


Measured memory_bytes: 4160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long int ll;
typedef pair<int, int> P;
#define INF 1e9 + 7

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

    int n;
    ll y;
    cin >> n >> y;
    
    rep(i,n+1){
        rep(j,n+1){
            int k = n - i -j;
            
            if(k>=0 && (ll) i*10000 + j*5000 + k*1000 == y){
                printf("%d %d %d\n", i, j, k);
                return 0;
            }
        }
    }
    
    cout << "-1 -1 -1" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll n;
    cin >> n;
    if(n <= 10){
        cout << min((ll)9, n);
        return 0;
    }
    ll cnt[10][10] = {};

    ll keta = 1;
    for(ll i = 1; i<=n; ++i){
        if(pow(10, keta+1) == i)keta++;
        ll head = i/pow(10, keta);
        ll tail = i%10;
        if(head == 0)head = tail;
        cnt[head][tail]++;
    }

    ll ans = 0;
    rep(i, 10)rep(j, 10)ans += cnt[j][i]*cnt[i][j];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - 1e8;
const ll INFLL = numeric_limits<ll>::max() - 1e17;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    int domestic = 0, oversea = 0, pass = 0;
    for (int i = 0; i < S.length(); i++) {
        if (pass >= A + B) {
            cout << "No" << endl;
            continue;
        }
        if (S[i] == 'a') {
            domestic++;
            pass++;
            cout << "Yes" << endl;
        } else if (S[i] == 'b') {
            if (oversea >= B) {
                cout << "No" << endl;
            } else {
                cout << "Yes" << endl;
                oversea++;
                pass++;
            }
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 896
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int x, ll int y){
	ll int jhogeo = 1;
	rep(jinto,0,y) jhogeo=jhogeo*x;
	return jhogeo;
}


int main(){
int N;
  cin>>N;
  cout<<N*800-(N/15)*200;

      
}
// int *p = new int[N];

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll K;

int main() {
  std::cin >> K;

  std::string ans;

  rep( i, K )
    ans += "ACL";

  std::cout << ans << endl;

  return 0;
}

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

int main() {
  
  int N;
  string S="";
  string T="";

  cin >> N >> S;
  if(N%2 == 0){
    for (int i=0;i<N/2;++i){
      T += S[i];
    }
    if(S == (T+T)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }

  }else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    int a[M], b[M];
    int ans[N];
    REP(i, M) {
        cin >> a[i] >> b[i];
    }
    REP(i, N) {
        ans[i] = 0;
        REP(j, M) {
            if((i+1) == a[j]) ans[i]++;
            if((i+1) == b[j]) ans[i]++;
        }
        cout << ans[i] << "\n";
    }
}

Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto G = new UndirectedGraph(N);
    foreach (_; 0..M) {
        s = readln.split.map!(to!int);
        G.add_edge(s[0], s[1]);
    }

    auto B = new BridgeBlockTree(G);
    auto bridges = B.bridges.dup;

    foreach (i; 0..bridges.length) {
        bridges[i] = tuple(min(bridges[i][0], bridges[i][1]),
                           max(bridges[i][0], bridges[i][1]));
    }
    bridges.sort();

    foreach (b; bridges) {
        writeln(b[0], " ", b[1]);
    }
}

class UndirectedGraph {
    int N;
    int[][] adj;

    this (int N) {
        this.N = N;
        adj = new int[][](N);
    }

    void add_edge(int u, int v) {
        adj[u] ~= v;
        adj[v] ~= u;
    }
}

class BridgeBlockTree : UndirectedGraph { // 二重辺連結成分分解 (橋で分解したあとの木)
    int[] index;
    int[][] block;
    Tuple!(int, int)[] bridges;

    this (UndirectedGraph g) {
        int n = 0;
        int cnt = 0;

        bridges = detect_bridges(g);
        auto is_bridge = new bool[int][](g.N);
        foreach (b; bridges) {
            is_bridge[b[0]][b[1]] = true;
            is_bridge[b[1]][b[0]] = true;
        }

        index = new int[](g.N);
        auto used = new bool[](g.N);

        void dfs(int n) {
            index[n] = block.length.to!int - 1;
            block.back ~= n;
            used[n] = true;
            foreach (m; g.adj[n]) {
                if (used[m] || m in is_bridge[n]) continue;
                dfs(m);
            }
        }

        foreach (u; 0..g.N) {
            if (used[u]) continue;
            block.length += 1;
            dfs(u);
        }

        super(block.length.to!int);

        foreach (u; 0..g.N) {
            foreach (v; g.adj[u]) {
                if (u < v && index[u] != index[v]) {
                    adj[index[u]] ~= index[v];
                    adj[index[v]] ~= index[u];
                }
            }
        }
    }

    Tuple!(int, int)[] detect_bridges(UndirectedGraph g) {
        Tuple!(int, int)[] bridges;
        int cnt = 0;
        auto ord = new int[](g.N);
        auto low = new int[](g.N);
        fill(ord, -1);
        fill(low, -1);

        void dfs(int n, int p) {
            ord[n] = low[n] = cnt++;
            foreach (m; g.adj[n]) {
                if (m == p) continue;
                if (ord[m] == -1) dfs(m, n);
                low[n] = min(low[n], low[m]);
                if (ord[n] < low[m]) bridges ~= tuple(n, m);
            }
        }

        dfs(0, -1);
        return bridges;
    }
}



Measured memory_bytes: 10332
#include <iostream>
#include <string>

int Baseball()
{
    const u_int num_of_event = 100;
    u_int num_of_runner = 0, num_of_out = 0, point = 0;
    std::string event;
    
    for(u_int i = 0; i < num_of_event; ++i){
        std::cin >> event;
        if(event == "HIT"){
            if(num_of_runner == 3)
                ++point;
            else
                ++num_of_runner;
        }
        else if(event == "HOMERUN"){
            point += 1 + num_of_runner;
            num_of_runner = 0;
        }
        else{
            ++num_of_out;
            if(num_of_out == 3)
                break;
        }
    }
    
    return point;
}

int main()
{
    u_int num_of_inning;
    std::cin >> num_of_inning;
    
    for(u_int i = 0; i < num_of_inning; ++i){
        std::cout << Baseball() << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    ll x;
    cin >> x;
    ll a=100;
    int cnt=0;
    while(a<x){
        a+=a/100;
        cnt++;
    }
    cout << cnt;

    return 0;
}

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

const int maxn = 1010, mod = 1000000007;
int dp[maxn][maxn];
char a[maxn][maxn];

int main() {
	//freopen("demo.in", "r", stdin);
	//freopen("demo.out", "w", stdout);
	
	int h, w;
	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; i++)
	{
		scanf("%s", a[i]);
	}
	dp[0][0] = 1;
	for(int i = 1; i < w; i++)
		if (a[0][i] == '.') dp[0][i] = dp[0][i-1];	
	for(int i = 1; i < h; i++)
		if (a[i][0] == '.') dp[i][0] = dp[i-1][0];
	
	for (int i = 1; i < h; i++)
		for (int j = 1; j < w; j++)
			if (a[i][j] == '.')
			{
				dp[i][j] = (dp[i-1][j] % mod + dp[i][j-1] % mod) % mod;
			} else {
				dp[i][j] = 0;
			}
//	for (int i = 0; i < h; i++) {
//		for (int j = 0; j < w; j++)
//			printf("%d ", dp[i][j]);
//		printf("\n");
//	}
	printf("%d\n", dp[h-1][w-1]);

	return 0;
}


Measured memory_bytes: 5120
def dfs(src)
  D[src] = $time
  $time += 1
  (0..N - 1).each do |dst|
    if D[dst] == nil && G[src][dst] == 1
      # Back[dst] = src
      dfs(dst)
    end
  end
  F[src] = $time
  $time += 1
  # p D
  # p F
  # p $time
  # dfs(Back[src]) if Back[src]
end

N = gets.to_i
G = (1..N).map{ Array.new(N, 0) }
N.times do
  u, k, *v = gets.split(' ').map(&:to_i)
  v.each do |vi|
    G[u - 1][vi - 1] = 1
  end
end

D = Array.new(N) #??????????¨????????????????
F = Array.new(N) #?????£???????????????
# Back = Array.new(N) #??????n????????¨?????????????????\??????

$time = 1

(0..N-1).each do |id|
  dfs(id) unless D[id]
end

(0..N-1).each do |id|
  puts "#{id + 1} #{D[id]} #{F[id]}"
end

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

int V, E, R, S[500010], T[500010], D[500010];
int C[100010];

const int Inf = 10000*100000+100;

int main() {
  cin >> V >> E >> R;
  for (int i=0;i<E;++i)
    cin >> S[i] >> T[i] >> D[i];
  for (int i=0;i<V;++i) {
    if (i==R)
      C[i] = 0;
    else
      C[i] = Inf;
  }
  for (int t=0;t<V;++t) {
    bool update = false;
    for (int i=0;i<E;++i) {
      int s = S[i], t = T[i], d = D[i];
      if (C[s]<Inf && C[s]+D[i]<C[t]) {
	C[t] = C[s]+D[i];
	update = true;
      }
    }
    if (!update) break; // 辺を一巡して更新がなければ打ち切って良い
  }
  for (int i=0;i<V;++i) {
    if (C[i]==Inf)
      cout << "INF" << endl;
    else
      cout << C[i] << endl;
  }
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N;
int a[220000];
bool x[220000];
int dp[110][110];
bool judge() {
    if (x[N - 1] == x[N] || x[N] == x[N + 1])return x[N];
    int l, r;
    for (l = N - 1; l > 1; l--)if (x[l] == x[l - 1])break;
    for (r = N + 1; r < 2 * N - 1; r++)if (x[r] == x[r + 1])break;
    if (N - l < r - N)return x[l];
    return x[r];
}
signed main() {
    cin >> N;
    for (int i = 1; i <= 2 * N - 1; i++)cin >> a[i];
    // 解の存在範囲を初期化
    int lb = 0, ub = 2 * N - 1;

    // 解の存在範囲が1より大きい間、繰り返す
    while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        for (int i = 1; i <= 2 * N - 1; i++)x[i] = a[i] <= mid;

        cerr<<mid<<" "<<(judge()?"true":"false")<<endl;

        if (judge()) {
            // midが条件を満たせば、解の存在範囲は(lb, mid]
            ub = mid;
        } else {
            // midが条件を満たさなければ、解の存在範囲は(mid, ub]
            lb = mid;
        }
    }

    // この時点で、lb + 1 = ubとなっている
    cout << ub << endl;
}


Measured memory_bytes: 2048
/*---------------------------*\
____________Mari000____________         
________Mostafa  Shehab________    
\*---------------------------*/

#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
typedef long long ll;
typedef long double ld;
//template <class Type>

ll power(ll x,ll y,ll p);
int Bit(ll x);
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}

const int N=1e6;
ll arr[N];

int n,m;


int main(){
	n=D();
	if(n%10 == n/100)
		puts("Yes");
	else
		puts("No");


	

}










ll power(ll x,ll y,ll p){ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
    while (y > 0){ 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;
    }
    return res; 
}


int Bit(ll x){
	if(!x)
		return 0;
	return 1+Bit(x>>1);
}


















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
int a[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	rep(i,1,n) cin>>a[i];
	bool f=true;
	rep(i,1,n) {
		if(a[i]%2==0) {
			if(a[i]%3!=0&&a[i]%5!=0) f=false;
		}
	}
	if(f) cout<<"APPROVED"<<'\n';
	else cout<<"DENIED"<<'\n';
    return 0;
}


Measured memory_bytes: 256
n,*l=map(int,open(0).read().split())
l.sort()
c=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if len({l[i],l[j],l[k]})==3 and l[i]+l[j]>l[k]:c+=1
print(c)

Measured memory_bytes: 68196
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

int main() {
  string S;
  cin >> S;
  int N = (int)S.size();
  if (N == 2) {
    if (S[0] == S[1]) {
      cout << 1 << " " << 2 << endl;
    } else {
      cout << -1 << " " << -1 << endl;
    }
    return 0;
  }
  for (int i = 2; i < N; i++) {
    map<char,int> mp;
    for (int j = i-2; j <= i; j++) {
      mp[S[j]]++;
    }
    bool make = false;
    for (auto p : mp) {
      if (p.S >= 2) {
        make = true;
      }
    }
    if (make) {
      cout << i-2 + 1 << " " << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}

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

const int MAXN = 3010;
using ll = long long;

int N;
double p[MAXN];
// dp[i][j]: 前i个硬币j个头朝上的概率
double dp[MAXN][MAXN];

int main() {
    cin >> N;
    for(int i=1; i<=N; i++) {
        cin >> p[i];
    }

    dp[0][0] = 1; 
    for(int i=1; i<=N; i++) {
        dp[i][0] = dp[i-1][0] * (1-p[i]);
        dp[0][i] = 0.0;
    }
    for(int i=1; i<=N; i++) {
        for(int j=1; j<=i; j++) {
            dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
        }
    }

    double ans = 0.0;
    for(int i=(N+1)/2; i<=N; i++) {
        ans += dp[N][i];
    }
    cout <<setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 69120
require 'prime'
require 'complex'

n = gets.to_i
sq = Math.sqrt(n)
#素数判定
if Prime.prime?(n)
  puts n - 1
#べき乗パターン
elsif sq % 1 == 0
  puts (sq * 2 - 2).to_i
else #べき乗じゃないパターン
  sq_i = sq.to_i
  (1..sq_i).reverse_each do |i|
    if n % i == 0
      puts i + (n/i) - 2
      break
    end
  end
end

Measured memory_bytes: 9912
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const ll mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//





//方針を立てて描かないといけませんね。
//まずは深さ優先探索していくんやけど、各ボールを先頭から調べていきます。
//先頭から見てみて筒に入っている数字より大きかったらその筒に入れます。
//その入れたパターンでdfsを続けます。
//可能かどうかの判定だからすべてを入れることができたらreturn trueでいい感じになるかな。
//他に必要な情報は、すべてを入れることができたかをどう判断するかは、iが最後の数以外入っていてその最後の数がもしどちらかに入るならばyes
//入らないならばreturn false;
//順番的に上から見ていってdfsして帰ってきた値がもしtrueならyesを出してって感じにしたらいいかな？


//このdfsに入っている数はまずは0,0,0を入れるから
//
//
//
//


int n;
vvi ball;

bool dfs(int left, int right, int i, int x){
        if(i == (int)ball[x].size()) return true;

        bool ok = false;
        if(left < ball[x][i]) ok |= dfs(ball[x][i], right,i+1,x);
        if(right < ball[x][i]) ok |= dfs(left,ball[x][i],i+1,x);

        if(ok) return true;
        else return false;
}

int main(){
        cin >> n;
        ball.assign(n,vi(10));
        rep(i,n){
                rep(j,10){
                        cin >> ball[i][j];
                }
                if(dfs(0,0,0,i)) cout << "YES" << endl;
                else cout << "NO" << endl;
        }
}



Measured memory_bytes: 3116
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#define ll long long
using namespace std;
ll a[1010][5],w[1010];
inline void read(ll &x)
{
	char c=getchar();x=0;int flag=1;
	while(!isdigit(c)){if(c=='-') flag=-1;c=getchar();}
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	x*=flag;
}
bool cmp(ll a,ll b){return a>b;}
int main()
{
	ll n,m;
	ll Max=0;
	read(n),read(m);
	for(int i=1;i<=n;i++) cin>>a[i][1]>>a[i][2]>>a[i][3];
	for(int sta=0;sta<(1<<3);sta++)
	{
		memset(w,0,sizeof(w));
		for(int j=1;j<=3;j++)
		{
			int flag;
			if(sta&(1<<j-1)) flag=1;
			else flag=-1;
			for(int i=1;i<=n;i++) w[i]+=flag*a[i][j];
		}
		sort(w+1,w+n+1,cmp);
		ll ans=0;
		for(int i=1;i<=m;i++) ans+=w[i];
		Max=max(Max,ans);
	}
	cout<<Max;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "Yes"<<endl
#define no  cout<< "No"<<endl
#define all(v) (v).begin(),(v).end()
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using namespace std;    
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
signed main()
{   
    fastio();
    int t=1;
   // cin>>t;
    while(t--)
    {    
       
      int a[3];
      for(int i=0;i<3;i++)
      cin>>a[i];
      sort(a,a+3);
      cout<<a[0]+a[1];
       
    }
}


// 🍪 🍪 🍪

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll p[5002],c[5002],sum[5002],mark[5002];

int main()
{
    ll n,k,i,l,cnt,ans,j,a,b,pos;
    cin>>n>>k;
    for(i=1; i<=n; i++)scanf("%lld",&p[i]);
    for(i=1; i<=n; i++)scanf("%lld",&c[i]);
    ans=-5e14-5;
    for(i=1; i<=n; i++)
    {
        cnt=0,l=i;
        for(j=1; j<=k; j++)
        {
            if(mark[l]!=0)
            {
                pos=mark[l];
                ll dif=j-pos;
                b=k-j+1;
                for(l=pos; l<j && b>0; l++,b--)
                    ans=max(ans,cnt+sum[l]-sum[pos-1]);
                b=k-j+1;
                a=b/dif;
                if(b%dif>0)
                {
                    cnt+=(a*(sum[j-1]-sum[pos-1]));
                    ans=max(ans,cnt);
                    a=b%dif;
                    for(l=pos; a>0; l++,a--)
                        ans=max(ans,cnt+sum[l]-sum[pos-1]);
                }
                else if(a>0)
                {
                    a--;
                    cnt+=(a*(sum[j-1]-sum[pos-1]));
                    ans=max(ans,cnt);
                    for(l=pos; l<j; l++)ans=max(ans,cnt+sum[l]-sum[pos-1]);
                }
                break;
            }
            mark[l]=j;
            cnt+=c[p[l]],l=p[l];
            sum[j]=cnt;
            ans=max(ans,cnt);
        }
        for(j=1; j<=n; j++)sum[j]=mark[j]=0;
    }
    cout<<ans<<endl;
    return 0;
}


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

#define int long long int
const int N=2e5;
string S[N];
set<string> s;

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>S[i];
		s.insert(S[i]);
	}
	cout<<s.size();

	return 0;
}

Measured memory_bytes: 25448