akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<stdio.h>



using namespace std;


int main(void)
{
	int n, d;
	cin >> n >> d;
	int i;
	int count = 0;
	i = d + 1;
	count++;
	while (i +d < n)
	{
		i = i + d + 1+d;
		count++;
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
field = [list(input()) for _ in range(h)]
dx = [1, 0, -1, 0, 1, -1, -1, 1]
dy = [0, 1, 0, -1, 1, 1, -1, -1]
for i in range(h):
    for j in range(w):
        if field[i][j] == "#":
            continue
        num = 0
        for k in range(8):
            ni = i + dy[k]
            nj = j + dx[k]
            if ni < 0 or h <= ni:
                continue
            if nj < 0 or w <= nj:
                continue
            if field[ni][nj] == "#":
                num += 1
        field[i][j] = str(num)
for out in field:
    print("".join(out))


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

int main() {
  int N;
  long long int count=0;
  cin >> N;
  
  vector<char> MARCH={'M', 'A', 'R', 'C', 'H'};
  map<char, long long int> m;
  
  for(int i=0 ; i<N ; i++){
    string name;
    cin >> name;
    if(name[0]=='M' || name[0]=='A' || name[0]=='R' || name[0]=='C' || name[0]=='H')
      m[name[0]]++;
  }
  
  for(int i=0 ; i<4 ; i++)
    for(int j=i+1 ; j<5 ; j++)
      for(int k=j+1 ; k<5 ; k++)
        count+=m[MARCH[i]]*m[MARCH[j]]*m[MARCH[k]];
      //cout << x << " " << y << " " << z << endl;
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
     // int t;
     // cin >> t;

     // while(t--){
 		

     // }

 int k;
 cin >> k;
 int total = 0;
 int ans = -1;
 for(int i = 1; i< (int)1e7;i++){
 	total = (total*10 + 7)%k;
 	if(total == 0){
 		ans = i;
 		break;
 	}
 }
cout << ans << endl;

return 0;
}




Measured memory_bytes: 3620
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll x,a,b;
  cin >> x >> a >> b;
  a -= b;
  if(a>=0){
    cout <<"delicious\n";
  }else{
    a =-a;
    if(a<=x){
      cout <<"safe\n";
    }else{
      cout <<"dangerous\n";
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

map<pll,int> m;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
ll x[55],y[55];
rep(i,0,n-1)cin>>x[i]>>y[i];

rep(i,0,n-1)
{
	rep(j,i+1,n-1)
	{
		m[mp(x[i]-x[j],y[i]-y[j])]++;
		m[mp(x[j]-x[i],y[j]-y[i])]++;
	}
}
int ans=n;
int kk=0;
tr(m,it)kk=max(kk,it->ss);
ol(ans-kk);
return 0;
}



Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
    static void Main (string[] args) {
        var input = Console.ReadLine ().Split (' ')
            .Select (x => double.Parse (x)).ToList ();
        var r = input[0];
        var ans = Math.Pow (r, 2) * 3;
        Console.WriteLine (ans);
    }
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

map<pll, ll> m;

ll gcd(ll a, ll b){
  if(a==1 || b==1)return 1;
  if (a < b)swap(a,b);
  if(m[{a, b}]>0)return m[{a, b}];

  m[{a, b}] = b ? gcd(b, a % b) : a;
  return m[{a, b}];
}

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

ll f(ll x){
  ll res=0;
  while(x%2==0){
    x /= 2;
    res++;
  }
  return res;
}

int main(){
  ll n,m;cin>>n>>m;
  vector<ll>a(n);
  rep(i, n)cin>>a[i];
  rep(i, n)a[i]/=2;

  ll t = f(a[0]);
  rep(i, t)m/=2;

  rep(i, n){
    if(f(a[i])!=t){ cout<<0<<endl; return 0; }
    rep(k, t) a[i]/=2;
  }

  ll base = 1;
  rep(i, n){
    base = lcm(base, a[i]);
    if(base>m){cout<<0<<endl;return 0;}
  }

  ll result = 0;
  result = ((m/base)+1)/2;
  cout<<result<<endl;

  return 0;
}


Measured memory_bytes: 1024
object Main {
  def main(args: Array[String]): Unit = {
    val in = new java.util.Scanner(System.in)
    val a = in.nextInt()
    val b = in.nextInt()
    val c = in.nextInt()
    if(a < b && b < c){
      println("Yes")
    }else{
      println("No")
    }
  
  }
}

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

int main(){
	int n;cin>>n;
    vector<long long>v(3*n);
  	for(auto&& w:v)cin>>w;
  sort(begin(v),end(v),greater<long long>());
  long long ans=0ll;
  for(int i=0;i<n;i++){
  ans+=v[2*i+1];
  }
  cout<<ans<<endl;
}

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

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

    ll X;
    cin >> X;

    for(ll i = -1000; i <= 1000; i++) {
        for(ll j = -1000; j <= 1000; j++) {
            if(pow(i, 5) - pow(j, 5) == X) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4040
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define pb push_back

int main(){
    int n;
    cin>>n;
    int a[5];
    for (int i=1;i<=4;i++){
        a[i] = 0;
    }
    string sss;
    for (int i=1;i<=n;i++){
        cin>>sss;
        if (sss == "AC"){
            a[1]++;
        }
        if (sss == "WA"){
            a[2]++;
        }
        if (sss == "TLE"){
            a[3]++;
        }
        if (sss == "RE"){
            a[4]++;
        }
    }
    cout<<"AC x "<<a[1]<<endl;
    cout<<"WA x "<<a[2]<<endl;
    cout<<"TLE x "<<a[3]<<endl;
    cout<<"RE x "<<a[4]<<endl;
}


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

int main(){
  string tmp;
  long long num[5] = {};
  int n;

  char tmpm[5] = {'M','A','R','C','H'};
  cin >> n;

  for(int i = 0;i < n;i++){
    cin >> tmp;
    for(int x = 0;x < 5;x++){
      if(tmp[0] == tmpm[x]){
        num[x]++;
        break;
      }
    }
  }

  long long ans = 0;
  for(int i = 0;i < 5;i++){
    for(int j = i+1;j < 5;j++){
      for(int k = j+1;k < 5;k++){
        ans += num[i] * num[j] * num[k];
      }
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] numsUnder = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long answer = 0;
    long sumMemo = 0;
    for(long i = 0; i < n; i++)
    {
      sumMemo = 0;
      for(long j = 0; j <= i; j++) sumMemo += nums[j];
      for(long j = i; j < n; j++) sumMemo += numsUnder[j];
      answer = Math.Max(answer, sumMemo);
    }
    
		Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 11220
#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using i128 = __int128_t;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) {if (a < b) {a = b; return true;} return false;}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) {if (a > b) {a = b; return true;} return false;}
inline int topbit(int x) {return x == 0 ? -1 : 31-__builtin_clz(x);}
inline int topbit(long long x) {return x == 0 ? -1 : 63-__builtin_clzll(x);}
inline int botbit(int x) {return x == 0 ? 32 : __builtin_ctz(x);}
inline int botbit(long long x) {return x == 0 ? 64 : __builtin_ctzll(x);}
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
inline void print() {cout << "\n";}
template<class T>
inline void print(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
    print();
}
template<class T, class... Args>
inline void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
#ifdef MINATO_LOCAL
#define dump(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
inline void debug() {cerr << endl;}
template<class T>
inline void debug(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cerr << *itr << " ";
    debug();
}
template<class T, class... Args>
inline void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
#else
#define dump(x) void(0)
inline void debug() {}
template<class T> inline void debug(const vector<T> &v) {}
template<class T, class... Args> inline void debug(const T &x, const Args &... args) {}
#endif
struct Fast_ios {Fast_ios() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);};} fast_ios;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ll D,T,S; cin >> D >> T >> S;
    cout << (S*T>=D ? "Yes" : "No") << ln;
}

Measured memory_bytes: 3640
BingoRow = 3
BingoList = [list(map(int,input().split())) for i in range(BingoRow)]
 
TargetRow = int(input())
TargetList = [int(input()) for i in range(TargetRow)]
 
ansList = []
x = 0
flg = False
for row in BingoList:
  for num in row:
    flg = False
    for target in TargetList:
      if num == target:
        ansList.append(1)
        flg = True
    if not flg:
      ansList.append(0)
 
if (ansList[0] + ansList[1] + ansList[2]) == 3:
  print('Yes')
elif (ansList[3] + ansList[4] + ansList[5]) == 3:
  print('Yes')
elif (ansList[6] + ansList[7] + ansList[8]) == 3:
  print('Yes')
elif (ansList[0] + ansList[3] + ansList[6]) == 3:
  print('Yes')
elif (ansList[1] + ansList[4] + ansList[7]) == 3:
  print('Yes')
elif (ansList[2] + ansList[5] + ansList[8]) == 3:
  print('Yes')
elif (ansList[0] + ansList[4] + ansList[8]) == 3:
  print('Yes')
elif (ansList[2] + ansList[4] + ansList[6]) == 3:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
def examA():
    N = I()
    A = LI()
    D = defaultdict(int)
    for a in A:
        D[a] += 1
    ans = 0
    for key,d in D.items():
        if key>d:
            ans += d
        else:
            ans += d - key
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    N, A, B, C = LI()
    L = [I()for _ in range(N)]
    loop = (1<<(2*N))
    ans = inf
    for l in range(loop):
        cost = 0
        bamboo_A = 0
        bamboo_B = 0
        bamboo_C = 0
        for j in range(N):
            if l&(1<<(2*j))>0:
                if l&(1<<(2*j+1))>0:
                    cost += 10
                    bamboo_A += L[j]
                else:
                    cost += 10
                    bamboo_B += L[j]
            else:
                if l&(1<<(2*j+1))>0:
                    cost += 10
                    bamboo_C += L[j]
        if bamboo_A==0 or bamboo_B==0 or bamboo_C==0:
            continue
        cost += abs(A-bamboo_A) + abs(B-bamboo_B) + abs(C-bamboo_C) - 30
        ans = min(ans,cost)

    print(ans)
    return

def examD():
    N = I()
    P = LI()
    O_ = [-1]*N
    start = P[0]-1
    for i in range(N):
        O_[P[i]-1] = i
    #print(O_,start)
    A = [1]*N
    B = [1]*N
    for i in range(start+1,N):
        cur = O_[i]-O_[i-1]
        if cur>0:
            A[i] = A[i-1] + (cur+1)
            B[i] = B[i-1] - 1
        else:
            A[i] = A[i-1] + 1
            B[i] = B[i-1] - (-cur+1)
    for i in range(start)[::-1]:
        cur = O_[i]-O_[i+1]
        if cur>0:
            B[i] = B[i+1] + (cur+1)
            A[i] = A[i+1] - 1
        else:
            B[i] = B[i+1] + 1
            A[i] = A[i+1] - (-cur+1)
    if A[0]<1:
        add = (1-A[0])
        for i in range(N):
            A[i] += add
    if B[-1]<1:
        add = (1-B[-1])
        for i in range(N):
            B[i] += add

    print(" ".join(map(str,A)))
    print(" ".join(map(str,B)))
    return

def examE():
    return

def examF():
    ans = 0
    print(ans)
    return


from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
9
7 3 9 1 8 4 5 6 2
"""

Measured memory_bytes: 23172
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

const int N = 1e5 + 5;

int n;

void O(int x, int y) {
	printf("%d %d\n", x, y);
}

int main() {
	scanf("%d", &n);
	if (!(n - (n & (-n)))) {
		puts("No");
		return 0;
	}
	puts("Yes");
	if (n & 1) {
		O(1, 2);
		O(2, 3);
		O(3, 1 + n);
		O(1 + n, 2 + n);
		O(2 + n, 3 + n);
		for (int i = 4; i < n; i += 2) {
			int v = i ^ (i + 1);
			O(i, i + 1);
			O(i + 1, v);
			O(v, i + n);
			O(i + n, i + n + 1);
		}
	} else {
		int x = (n & (-n)) - 1;
		int y = x + 1;
		assert(!(x ^ y ^ (n - 1) ^ n));
		O(y, x);
		O(x, n - 1);
		O(n - 1, n);
		O(n, y + n);
		O(y + n, x + n);
		O(x + n, n + n - 1);
		O(n + n - 1, n + n);
		int hig = 1;
		while ((hig << 1) < n)
			hig <<= 1;
		vector<int> a;
		for (int i = 1; i < hig; i++) {
			a.push_back(i);
		}
		a.erase(find(a.begin(), a.end(), x));
		a.erase(find(a.begin(), a.end(), y));
		for (int i = 1; i < (signed) a.size(); i++)
			O(a[i - 1], a[i]);
		O(a.back(), x);
		O(y, a[0] + n);
		for (int i = 1; i < (signed) a.size(); i++)
			O(a[i - 1] + n, a[i] + n);
		
		a.clear();
		int z = x ^ (n - 1);
		O(z, x);
		O(n - 1, z + n);
		for (int i = hig; i < n - 1; i++)
			a.push_back(i);
		a.erase(find(a.begin(), a.end(), z));
		assert(!(a.size() & 1));
		for (int i = 1; i < (signed) a.size(); i += 2) {
			int v = a[i - 1] ^ a[i];
			O(a[i - 1], a[i]);
			O(a[i], v);
			O(v, a[i - 1] + n);
			O(a[i - 1] + n, a[i] + n);
		}
	}
	return 0;
}


Measured memory_bytes: 2940
#!/usr/bin/env python3
from itertools import*
I = input
n = int(I())
c = 0;z = []
for i in range(n):
    for j in range(int(I())):
        z += [[i] + list(map(int, I().split()))]
for j in product([0,1], repeat=n):
    if all(j[i] == 0 or j[x-1] - y == 0 for i, x, y in z):
        c = max(c, sum(j))
print(c)

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	v A(a),B(b),C(c);
	for(auto& it:A)cin>>it;
	for(auto& it:B)cin>>it;
	for(auto& it:C)cin>>it;
	sort(all(A),greater<int>());
	sort(all(B),greater<int>());
	sort(all(C),greater<int>());
	int ans=0,idx=0;
	priority_queue<ii,vii,greater<ii> > pq;
	for (int i = 0; i < x; ++i)
		ans+=A[i],pq.push(ii(A[i],0));
	for (int i = 0; i < y; ++i)
		ans+=B[i],pq.push(ii(B[i],1));
	while(!pq.empty()){
		ii f=pq.top();
		pq.pop();
		if(idx==c)break;
		if(f.fi>C[idx])break;
		ans-=f.fi;
		ans+=C[idx];
		idx++;
	}
	cout<<ans;
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 8816
#include<iostream>
	#include<vector>
	#include<algorithm>
	#include<string>
	#include<cmath>
	#include<map>
	#include<cstdio>
	#include<stack>
	#include<queue>
	#include<fstream>
	#include<cstdio>
	#include<deque>
	#include<iomanip>
	#include <numeric>
	//#include<bits/stdc++.h>

	using namespace std;
	#define ok1 printf("ok1\n");
	#define ok2 printf("ok2\n");
	#define M 1000000000000000000LL
	#define rep(i,n) for(int i=0;i<n;i++)
	#define REP(i,s,n) for(int i=(s);i<(n);i++)
	#define repr(i,n) for(int i=n-1;i>=0;i--)
	#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
	#define all(a) (a).begin(),(a).end()
	#define reall(a) (a).rbegin(),(a).rend()
	#define pb push_back
	#define pf push_front
	#define MIN(a,b) a=min((a),(b))
	#define MAX(a,b) a=max((a),(b))
	#define SIZE(v) (int)v.size()
	const double pi = acos(-1.0);

	typedef vector<int> vi;
	typedef vector<string> vs;
	typedef long long ll;
	typedef vector<ll> vll;
	typedef vector<vi> vvi;
	typedef vector<vll> vvll;
	typedef deque<ll> dll;
	typedef pair<ll, ll> P;
	const ll mod = 1e9 + 7;
	ll dx[4] = {1,0,-1,0};
	ll dy[4] = {0,1,0,-1};


	int main() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		ll n;
		cin >> n;
		ll ans = 1;
		REP(i,1, n+1) {
			ans *= i;
			ans %= mod;
		}
		cout << ans << endl;
		return 0;
	}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    H = int(input())

    c = 0
    while H > 0:
        c += 1
        if H < 1:
            H = 0
        else:
            H //= 2
    print(sum([2 ** i for i in range(c)]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int N;
    cin >>  N;
    string S;
    cin >> S;

    string tmpStr1 = "";
    string tmpStr2 = "";
    bool flag = false;

    for (int i = 0; i < S.length(); i++)
    {
        /* code */
        tmpStr1 += S[i];
        for (int j = i + 1; j < S.length(); j++)
        {
            /* code */
            tmpStr2 += S[j];
        }
        if(tmpStr1 == tmpStr2){
            flag = true;
            break;
        }
        tmpStr2 = "";
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static string[] input = Console.ReadLine().Split(' ');
static int n = int.Parse(input[0]);
static int k = int.Parse(input[1]);
static long mod = 1000000007;
static long answer = k;
static List<int>[] nextList = new List<int>[n];//隣接リスト（リストの入った配列）
static List<int> checkList = new List<int>();//次に見る頂点のリスト

	static void Main()
	{
    for(int i = 0; i < n; i++)
    {
      nextList[i] = new List<int>();//リストの宣言
    }
    for(int i = 0; i < n-1; i++)
    {
      int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
      nextList[nums[0]-1].Add(nums[1]-1);//隣接リストへ追加。
      nextList[nums[1]-1].Add(nums[0]-1);
    }

    for(int i = 0; i < nextList[0].Count(); i++)
    {
      answer *= k-1-i;
      answer %= mod;
      checkList.Add(nextList[0][i]);
      nextList[nextList[0][i]].Remove(0);//木の逆走を防ぐ
    }

    for(int i = 0; i < checkList.Count(); i++)
    {
      answer *= AnswerAdd(checkList[i]);
      answer %= mod;
    }

    Console.WriteLine(answer);
	}

  static long AnswerAdd(int vertexNum)
  {
    long answerMemo = 1;

    for(int i = 0; i < nextList[vertexNum].Count(); i++)
    {
      answerMemo *= k-2-i;
      answerMemo %= mod;
      nextList[nextList[vertexNum][i]].Remove(vertexNum);//木の逆走を防ぐ
      answerMemo *= AnswerAdd(nextList[vertexNum][i]);
      answerMemo %= mod;
    }

    return answerMemo;
  }
}

Measured memory_bytes: 31112
x, y = map(int, input().split())
s = [400000, 300000, 200000, 100000]

ax = 0
ay = 0

if x<4:
	ax=s[x]

if y<4:
	ay=s[y]

ans = ax+ay
if x==1 and y==1:
	ans += s[0]

print(ans)

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m;
    cin>>n;
    map<int,int> mp;
    rep(i,n){
        int a;
        cin>>a;
        mp[a]++;
    }
    cin>>m;
    map<int,int> mpp;
    rep(i,m){
        int b;
        cin>>b;
        mpp[b]++;
    }
    int ng=0;
    for(auto x:mpp){
        if(x.sc<=mp[x.fs]){

        }
        else{
            ng++;
        }
    }
    if(ng==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
}

Measured memory_bytes: 29952
n = int(input())
P = list(map(int,input().split(' ')))
count = 1
i = 1
Pmin = P[0]
while i < n:
    if Pmin == 2:
        count += 1
        break
    elif P[i] < Pmin:
        count += 1
        Pmin = P[i]
    i += 1
print(count)

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

int main(){
  	int h, w, k, ans = 0;
  	cin >> h >> w >> k;
 	vector< string > in(h);
  	for(int i = 0 ; i < h ; i++)
    	cin >> in[i];
  	for(int mask1 = 0 ; mask1 < (1 << h) ; mask1++){
    	string a[h];
    	for(int i = 0 ; i < h ; i++)
      		a[i] = in[i];
    	for(int s = 0 ; s < h ; s++)
      		if( (1 << s ) & mask1 ){
        		for(int i = 0 ; i < w ; i++)
          			a[s][i] = 'r';
      		}
    	for(int mask2 = 0 ; mask2 < (1 << w) ; mask2++){
    		int ctr = 0;
      		for(int s = 0 ; s < w ; s++){
        		if( (1 << s) & mask2 ){
        			
        		}
        		else{
        			for(int i = 0 ; i < h ; i++)
        				if( a[i][s] == '#' )
        					ctr++;
        		}
    		}
    		if( ctr == k )
    			ans++;
   		}
   	}
   	cout << ans << endl;
  return(0);
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
  int n;cin>>n;
  int a[n],b[n],c[n];
  rep(i,n)cin>>a[i]>>b[i]>>c[i];
  int dp[n][3]={};
  dp[0][0]=a[0];dp[0][1]=b[0];dp[0][2]=c[0];
  rep(i,1,n){
    dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
    dp[i][1]=max(dp[i-1][2]+b[i],dp[i-1][0]+b[i]);
    dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
  }
  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}


    



  


Measured memory_bytes: 2560
// use proconio::marker::Chars;
use proconio::{fastout, input};
// use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
        s: usize
    };

    let mut count = 1;
    let mut n = s;
    let mut v = vec![n];
    loop {
        count += 1;
        n = if n % 2 == 0 { n / 2 } else { 3 * n + 1 };
        // println!("{}", n);
        if v.contains(&n) {
            break;
        } else {
            v.push(n);
        }
    }

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


Measured memory_bytes: 2172
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <set>
#include <algorithm>
#include <iostream>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const int MOD = 1000000007;
const int INF = 1000007;
const LL LINF = 1LL * INF * INF;
const int MAXN = 107;
const LD EPS = 1e-12;

int A[2][MAXN];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, s1 = 0, s2 = 0, ans = 0;
	cin >> n;
	REP(i, n)
		cin >> A[0][i];
	REP(i, n)
	{
		cin >> A[1][i];
		s2 += A[1][i];
	}
	REP(i, n)
	{
		s1 += A[0][i];
		ans = max(ans, s1 + s2);
		s2 -= A[1][i];
	}
	cout << ans;
	//cout << endl; system("pause");
	return 0;
}

Measured memory_bytes: 256
fn main() {
    let s = read::<String>();

    let mut price = 700;
    for c in s.chars() {
        if c == 'o' {
            price += 100;
        }
    }

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

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

Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}
int gcd(int x, int y){
	if(x<y){
    return gcd(y,x);
  }
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}
int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}







int main() {
   int N;
   cin>>N;
   int max=0;
   for(int i=0;i*i<=N;i++){
     max=i*i;
   }
   cout<<max<<endl;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;	
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	
	int n,ans = 0,in;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>in;
		if(i%2==1 and in%2==1)ans++;
	}
	cout<<ans<<'\n';
}


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


int main(){
    int H,W;
    string S[50];
    int mine[50][50] ={};
    int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
    int dy[8] = {0, 1, 1,  1,  0, -1,-1,-1};
    cin >> H >> W;
    rep(i,H){
        cin >> S[i];
    }
    rep(i,H){
        rep(j,W){
            int cnt = 0;
            rep(l,8){
                if(j+dx[l] < 0 || i+dy[l] < 0 || W <=j+dx[l] || H <=i+dy[l]){
                    continue;
                }
                cnt += (S[i+dy[l]][j+dx[l]] == '#'? 1 : 0);
            }
            if(S[i][j]=='#'){
                cout << '#';
            }else{
                cout << cnt;
            }
        }
        cout << endl;
    }

    //cout <<  (flag ? "Yes" : "No") << endl;
}


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

int main(){
    int n;
    cin >> n;
    int a[n+1] = {};
    int b[n+1] = {};
    for(int i = 2; i <= n; i++){
        cin >> a[i];
        b[a[i]] += 1;
    }
    for(int i = 1; i <= n; i++){
        cout << b[i] << endl;
    }
}

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

int main(){

    int n,a,b,c,d;
    string s;

    cin >> n >> a >> b >> c >> d;
    cin >> s;

    a--;b--;c--;d--;
    bool f=true;
    if(c<d){
        for(int i=a;i<=c-1;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f=false;
            }
        }
        for(int i=b;i<=d-1;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f=false;
            }
        }
        if(f){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        for(int i=a;i<=c-1;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f=false;
            }
        }
        for(int i=b;i<=d-1;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f=false;
            }
        }
        bool o=false;
        for(int i=b-1;i<=min(d-1,(int)s.size()-3);i++){
            if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
                o=true;
            }
        }
        if(f&&o){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<stack>
#include<queue>
#include<cstdio>
using namespace std;

#define X_MAX 100+10
#define Y_MAX 100+10

#define Vertical 1
#define Horizontal 0

int my[4] = { 1,-1,0,0 };
int mx[4] = { 0,0,1,-1 };

struct ST
{
	int now_y;
	int now_x;
};


void paint_V(int*map , int col)
{
	int i;
	for (i = 0; i < 2; i++)
	{
		*(map + i) = col;
	}
}

void paint_H(int*map, int col)
{
	int i;
	for (i = 0; i < 4; i++)
	{
		*(map + i) = col;
	}
}


void chek(int map[Y_MAX][X_MAX],int lx,int ly)
{
	int i, j;
	for (i = 0; i <= ly+1;i++)
	{
		for (j = 0; j <= lx+1; j++)
		{
			cout << map[i][j];
		}
		cout << endl;
	}
}


int main(void)
{
	ST an, tmp;
	queue<ST> ma;

	int lx, ly, n;
	int sx, sy, gx, gy;
	int col, VorH,set_x,set_y;
	int i, j;

	while ((cin >> lx >> ly), lx!=0&&ly!=0)
	{
		bool goal = false;
		int map[Y_MAX][X_MAX] = { 0 };
		cin >> sx >> sy >> gx >> gy >> n;

		for (i = 0; i < n; i++)
		{
			cin >> col >> VorH >> set_x >> set_y;
			if (VorH == Vertical)
			{
				for (j = 0; j < 4; j++)
				{
					paint_V(map[set_y + j] + set_x, col);
				}
			}
			else
			{
				for (j = 0; j < 2; j++)
				{
					paint_H(map[set_y + j] + set_x, col);
				}
			}
		}
		
		int s_col = map[sy][sx];
		if (s_col == 0)
		{
			cout << "NG\n";
			continue;
		}

		an.now_y = sy;
		an.now_x = sx;
		ma.push(an);

		//chek(map, lx, ly);

		while (!ma.empty())
		{
			an = ma.front();
			ma.pop();
			//an.came[an.now_y][an.now_x] = -1;
			if (map[an.now_y][an.now_x] == s_col)
			{
				map[an.now_y][an.now_x] = -1;

				//printf("y=%d,x=%d\n", an.now_y, an.now_x);
				//chek(an.came, lx, ly);

				if (an.now_y == gy && an.now_x == gx)
				{
					goal = true;
					break;
				}

				tmp = an;

				for (i = 0; i < 4; i++)
				{
					if (map[an.now_y + my[i]][an.now_x + mx[i]] == s_col/* && an.came[an.now_y + my[i]][an.now_x + mx[i]] == 0*/)
					{
						tmp.now_y = an.now_y + my[i];
						tmp.now_x = an.now_x + mx[i];
						ma.push(tmp);
					}
				}
			}
		}
		if (goal)
		{
			while (!ma.empty())
			{
				ma.pop();
			}
			cout << "OK\n";
		}
		else
		{
			cout << "NG\n";
		}


	}
	return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const int MOD = 1000000007;
const ll INF = 1LL << 60;

ll dp[3005][3005];

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  rep(i,n) dp[i][i] = 0;
  
  for(int len = 1; len <= n; len++){
    for(int i = 0; i+ len <= n; i++){
      int j = i + len;
      
      if((n - len) % 2 == 0){
        dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1]+a[j-1]);
      }else{
        dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1]-a[j-1]);
      }
    }
  }
  
  cout << dp[0][n] << endl;

  return 0;
}

Measured memory_bytes: 70016
#include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int f(int x){
    return x * x;
}

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

    int d;
    while(cin >> d){
        int ans = 0;
        for(int i = 0 ; i < 600 ; i += d){
            ans += d * f(i);
        }
        cout << ans << endl;
    }

    return 0;
}


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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define Hardmode usleep(1.5 * 1000000);
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, T;
    cin >> N >> T;
    int min = 99999;
    for(int i = 0;i < N;i++){
    	int c, t;
    	cin >> c >> t;
    	if(min <= c || t > T){
    		continue;
    	}
    	min = c;
    }
    if(min == 99999){
    	cout << "TLE" << endl;
    	ED;
    }
    cout << min << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int Max=1e6;
bool prime[Max+1];
void sieve()
{
    memset(prime,true,sizeof (prime));
    for(int i=2;i*i<=Max;i++)
    {
        if(prime[i]==true)
        {
            for(int j=i*i;j<=Max;j+=i)
            {
                prime[j]=false;
            }
        }
    }
}
int find_prime(int n)
{
    if(prime[n]==true)
    {
        return n;
    }
    else
    {
        find_prime(n+1);
    }
}
int main()
{
    sieve();
    int x;
    cin>>x;
    if(prime[x]==true)
    {
        cout<<x<<endl;
    }
    else
    {
        cout<<find_prime(x+1)<<endl;
    }
}



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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 13;

string s;

int main()
{
	cin >> s;
	for (int i = 0; i < s.size() - 1; i ++ )
		if (s[i] == s[i + 1])
		{
			cout << i + 1 << ' ' << i + 2 << endl;
			return 0;
		}
	
	for (int i = 0; i < s.size() - 2; i ++ )
		if (s[i] == s[i + 2])
		{
			cout << i + 1 << ' ' << i + 3 << endl;
			return 0;
		}
	puts("-1 -1");
	return 0;
}

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

int main()
{
  int sum,n,i;
  int a[1000];
  double m,a2;

  scanf("%d",&n);
  while(n!=0){
  sum=0;
  for (i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  m=(double)sum/n;
  a2=0;
  for (i=0;i<n;i++){
    a2+=pow(a[i]-m,2);
  }
  printf("%lf\n",sqrt(a2/n));
  scanf("%d",&n);
  }
  return 0;
}



Measured memory_bytes: 2036
# AOJ 0093 Leap Year
# Python3 2018.6.11 bal4u

def leap_year(y):
    return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)

import sys
first = True
for line in sys.stdin:
    a, b = list(map(int, line.split()))
    if a == 0:
        break
    else:
        if first:
            first = False
        else:
            print()

        f = False
        for y in range(a, b+1):
            if leap_year(y):
                print(y)
                f = True
        if not f:
            print('NA')	



Measured memory_bytes: 5716
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t A1, A2, A3;
    std::cin >> A1 >> A2 >> A3;

    // std::string S;
    // std::cin >> S;

    // 123
    // 132
    // 
    int64_t ans = INT64_MAX;

    ans = std::min(ans, abs(A2-A1) + abs(A3-A2));
    ans = std::min(ans, abs(A3-A1) + abs(A2-A3));
    ans = std::min(ans, abs(A1-A2) + abs(A3-A1));
    ans = std::min(ans, abs(A3-A2) + abs(A1-A3));
    ans = std::min(ans, abs(A1-A3) + abs(A2-A1));
    ans = std::min(ans, abs(A2-A3) + abs(A1-A2));

    std::cout << ans << std::endl;

    return 0;
}


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

int main(){

    int N;
    cin >> N;

    vector<int> cards(N);
    for (int i=0; i<N; i++) {
        cin >> cards[i];
    }
    sort(cards.begin(), cards.end());
    reverse(cards.begin(), cards.end());
    int answer = 0;
    for (int i=0; i<N; i++) {
        answer = answer + cards[i];
        i = i+1;
        answer = answer - cards[i];
    }

    cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  vector<int> num(N, 1);
  vector<int> red(N, 0);
  red.at(0)=1;
  for(int i=0;i<M;i++){
    int x,y;
    cin >> x >> y;
    num.at(x-1)-=1;
    num.at(y-1)+=1;
    if(red.at(x-1)==1){
      if(num.at(x-1)==0){
        red.at(x-1)=0;
      }
      red.at(y-1)=1;
    }
  }
  int sum=0;
  for(int i=0;i<N;i++){
    sum+=red.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    char B;
    cin>>B;
    if(B=='A')cout<<'T'<<endl;
    if(B=='T')cout<<'A'<<endl;
    if(B=='G')cout<<'C'<<endl;
    if(B=='C')cout<<'G'<<endl;
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll H[100010];
    rep(i,0,N) cin >> H[i];
    bool ng[100010] = {};
    rep(i,0,M){
        ll a,b;
        cin >> a >> b;
        a--; b--;
        if(H[a] > H[b]){
            ng[b] = true;
        }else if(H[a] < H[b]){
            ng[a] = true;
        }else{
            ng[a] = true;
            ng[b] = true;
        }
    }
    ll ans = 0;
    rep(i,0,N){
        if(ng[i] == 0) ans++;
    }
    print(ans);
    

}

Measured memory_bytes: 4520
#include <stdio.h>

int main(){
   int h,w;scanf("%d %d",&h,&w);
   char c[101][101];for(int i = 0;i < h;i++){
      scanf("%s\n",c[i]);
   }
   for(int i = 0;i < h;i++){
      printf("%s\n",c[i]);
      printf("%s\n",c[i]);
   }
   return 0;
}


Measured memory_bytes: 128
// AOJ 1219: Pump up Batteries
// 2017.10.23 bal4u@uu

#include <stdio.h>
#include <string.h>

#define QMAX 102
int que[104], top, end;

typedef struct { char use; int t, r, i, n, u[51], c[51]; } T; // r:remain time
T tbl[102], *tp, *tend;

int main() 
{
	int n, lim, i, u, c, t, ans;

	while (scanf("%d%d", &n, &lim) && n > 0) {
		for (tp = tbl, tend = tp + n; tp < tend; tp++) {
			tp->use = 1, tp->i = 0;
			for (i = 0; scanf("%d", &u) && u > 0; i++)
				scanf("%d", &c), tp->u[i] = u, tp->c[i] = c;
			tp->n = i, tp->r = tp->u[0];
		}

		ans = 0, top = end = 0;
		for (t = 1; t <= lim; t++) {
			for (tp = tbl, i = 0; i < n; i++, tp++) {
				if (tp->use) {
					tp->t = t;
					if (--tp->r == 0) {
						tp->use = 0, tp->r = tp->c[tp->i];
						que[end] = i; if (++end == QMAX) end = 0;
					}
				}
			}
			if (end == top) continue;
			for (tp = tbl, i = 0; i < n; i++, tp++) {
				if (tp->t != t && tp->use == 0) {
					if (i == que[top]) tp->r--;
					else ans++;
				}
			}
			if (top != end) {
				tp = tbl + que[top];
				if (tp->r == 0) {
					tp->use = 1;
					if (++tp->i == tp->n) tp->i = 0;
					tp->r = tp->u[tp->i];
					if (++top == QMAX) top = 0;
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0; 
}

Measured memory_bytes: 1776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1000000007;

int main(){
    ll N, K;
    cin>>N>>K;
    if(K>(N-1)*(N-2)/2){
        cout<<-1<<endl;
        return 0;
    }
    
    ll W=(N-1)*(N-2)/2-K;
    cout<<N-1+W<<endl;
    for(int i=2; i<=N; i++){
        cout<<1<<" "<<i<<endl;
    }
    if(W==0){
        return 0;
    }
    for(int i=2; i<=N; i++){
        for(int j=i+1; j<=N; j++){
            cout<<i<<" "<<j<<endl;
            W--;
            if(W==0){
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
char r[99],g[99],*G,d[99];main(c,i,k){for(;scanf("%s%s%s",r,g,d)>1;puts(G))for(i=k=0,G=g,c=*G++;*(G-1);)c=c==d[k]?k++,r[i++]:(putchar(c),*G++);exit(0);}

Measured memory_bytes: 524
n,d = map(int,input().split())
pnt = [list(map(int,input().split())) for _ in range(n)]




def dst(i, j):
    a = pnt[i]
    b = pnt[j]
    ret = 0
    for p, q in zip(a, b):
        ret += (p - q) ** 2
    r = ((ret ** (0.5)))

    return r


ans = 0
for i in range(n):
    for j in range(i + 1, n):
        tmp = dst(i, j)
        if tmp == int(tmp):
            ans = ans + 1 

print(ans)

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

int dy[4]={-1,1,0,0};
int dx[4]={0,0,1,-1};

#define MAX_N 100010
ll N, A, B;
ll X[MAX_N];
int main(){
    ios::sync_with_stdio(false);
    cin >> N >> A >> B;
    REP(i,N){
        cin >> X[i];
    }
    ll ans = 0;
    FOR(i,1,N) {
        ans += min((X[i]-X[i-1])*A,B);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,a[200010],b,c,i,j,h,sum = 0;
    cin>>h>>n;
    for(i=0;i<h;i++)
    {
        cin>>a[i];
    }
    sort(a,a+h);
    for(i=0;i<h-n;i++)
        sum+=a[i];
    cout<<sum<<endl;
    return 0;
}





Measured memory_bytes: 1792