akhauriyash/Code-Regression huggingface dataset:
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, x] = [int(input_raw[0]), long(input_raw[1])]
    A = []
    input_raw = read_func().strip().split()
    for i in range(N):
        A.append(long(input_raw[i]))

    min_time = long(sys.maxint * sys.maxint)
    min_A = [0L for i in range(N)]
    for k in range(N):
        sum_min_A = 0L
        for i in range(N):
            if k == 0:
                min_A[i] = A[i]
            else:
                i + k
                min_A[i] = min(min_A[i], A[(i + k)%N])
            sum_min_A += min_A[i]
        time = sum_min_A + x * long(k)
        if time < min_time:
            min_time = time
    print min_time

##    max_shift_num = 0L
##    sum_Aj = 0L
##    for i in range(N):
##        min_time = A[i]
##        min_Aj = A[i]
##        min_time_shift_num = 0L
##        for j in range(N):
##            if i == j:
##                continue;
##            if i - j < 0:
##                shift_num = N + (i - j)
##            else:
##                shift_num = i - j
##            time = shift_num * x + A[j]
##            if time < min_time:
##                min_time = time
##                min_Aj = A[j]
##                min_time_shift_num = shift_num
##        sum_Aj += min_Aj
##        if  min_time_shift_num > max_shift_num:
##            max_shift_num = min_time_shift_num
##    print sum_Aj + max_shift_num * x


if __name__ == '__main__':
    main()

Measured memory_bytes: 2944
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
	ll n;
	cin >> n;
	vector<int> v(n);
	rep(i, n) {
		cin >> v[i];
	}
	sort(all(v));
	ll i = 0;
	ll ans = 0;
	while(i<n){
		ll k = 0;
		//cout << i << " " << k << endl;
		while (v[i] == v[i + k]) {
			k++;
			if (i + k >= n) break;
			//cout << i << " " << k << endl;
		}
		if (k >= v[i]) ans += k - v[i];
		else ans += k;
		i += k;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
var fs, max, scale, max_log2, max_pow2, series;

fs = require('fs');

max = 300;

function log2(n) {
	return n.toString(2).length - 1;
}

max_log2 = Math.floor(log2(max));
max_pow2 = Math.pow(2, max_log2);

series = function(max_pow2) {
	var i, series = [];
	for (i = max_pow2; i >= 1; i /= 2) series.push(i);
	return series;
} (max_pow2);

scale = function(max) {
	var scale, i, str;
	scale = [];
	str = "#";
	for (i = 1; i < max; i *= 2) {
		scale.push(str);
		str = str + str;
	}
	return scale.reverse();
}(max);

function get_column(W) {
	var i, res, rest;
	res = "";
	rest = W;
	for (i in series) {
		if (rest >= series[i]) {
			rest -= series[i];
			res = res + scale[i];
		}
	}
	return res;
}

function repeat(str, n) {
	return get_column(n).replace(/#/g, str);
}

function main() {
	var line, i, hw, end_i;
	line = fs.readFileSync('/dev/stdin', 'ascii').split("\n");
	end = false;
	for (i in line) {
		hw = line[i].split(' ', 2).map(Number);
		if (hw[0] === 0 && hw[1] === 0) {
			end_i = Number(i);
			break;
		}
		line[i] = repeat(get_column(hw[1]) + "\n", hw[0]) + "\n";
	}
	line.length = end_i;
	console.log(line.join("").trim() + "\n");
}

main();

Measured memory_bytes: 16444
#include <iostream>
using namespace std;
int main(void){
    
    
    int antena[5];
    int K;
    for(int i = 0; i < 5; i++){
        cin >> antena[i];
    }
    cin >> K;
    
    for(int i = 0; i < 5; i++){
        for(int j = i + 1; j < 5; j++){
            if(K < antena[j] - antena[i]){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    
    cout << "Yay!" << endl;
    
}


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

vector<long long> l(51);
vector<long long> p(51);

long long solve (int n, long long x) {
  assert(l[n] >= x && x >= 0);
  if (n == 0) {
    return x;
  }
  if (x == l[n]) {
    return p[n];
  }
  long long ans = 0;
  if (x > l[n - 1] + 1) {
    ans += p[n - 1] + 1;
    x -= l[n - 1] + 1;
  }
  if (x > 0) {
    ans += solve(n - 1, x - 1);
  }
  return ans;
}

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

  int n;
  long long x;
  cin >> n >> x;
  l[0] = 1LL;
  p[0] = 1LL;
  for (int i = 1; i <= n; i++) {
    l[i] = l[i - 1] * 2 + 3;
    p[i] = p[i - 1] * 2 + 1;
  }
  cout << solve(n, x) << '\n';
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc074/tasks/arc083_b
# DP
import copy
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
graph = []
for _ in range(n):
    row = [int(i) for i in input().split()]
    graph.append(row)

ans = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            if graph[i][j] > graph[i][k] + graph[k][j]:
                # iからjに行く間に、kを挟む方が早いパターンが存在するなら、最短ではない。
                print(-1)
                exit()
            elif graph[i][j] == graph[i][k] + graph[k][j] and k != i and k != j:
                # 自分の点以外で、iからjに行く間に、kを挟んでも同じパターンが存在するなら、それは不要。
                break
        else:
            ans += graph[i][j]

print(ans // 2)


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

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

//  -d
int main() {
    int n, k;
    cin >> n >> k;

    vector<bool> donhave(n, false);
    rep(i, 0, k) {
        int d;
        cin >> d;
        rep(i, 0, d) {
            int idx;
            cin >> idx;
            donhave[idx - 1] = true;
        }
    }

    int cnt = 0;
    rep(i, 0, n) {
        if (donhave[i] == false) cnt++;
    }

    cout << cnt << endl;

    return 0;
}



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

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

int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> fragile(n+1,true);
  for(int i=0;i<m;i++){
    int a;
    cin >> a;
    fragile[a]=false;
  }
  vector<ll> fx(n+1);
  fx.at(0)=1;
  if(fragile[1]){
    fx.at(1)=1;
  }
  else{
    fx.at(1)=0;
  }
  for(int now=2;now<n+1;now++){
    if(fragile[now]){
      fx.at(now)=(fx.at(now-1)+fx.at(now-2))%mod;
    }
    else{
      fx.at(now)=0;
    }
  }
  cout << fx.at(n) << endl;
  
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

const int maxn = 1e5+10;
const int mod = 1e9+7;

using namespace std;

void solve(){
	string s;
	cin>>s;
	int a=0,b=0;
	for(int i=0;i<s.size();++i){
		a+=s[i]=='A';
		b+=s[i]=='B';
	}
	if(a&&b)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

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

string s;

ll toI(string s){
  stringstream ss;
  ll res;
  ss << s;
  ss >> res;
  return res;
}

ll search(string s){
  ll res = toI(s);
  int size = (int)s.size();
  if(size == 1){
    return res;
  }
  for(int i = 0;i < size-1 ;++i){
    string subs = s.substr(0,i+1);
    res += (ll)pow(2,size-i-2) * toI(subs);
    res += search(s.substr(i+1,size-i-1));
  }
  return res;
}

int main(void){
  string s;
  cin >> s;
  cout << search(s) << endl;
  return 0;
}


Measured memory_bytes: 384
# include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod = 1e9+7;
const LL maxn = 1e5+3;
LL inv[maxn+8]={1,1}, fi[maxn+8]={1,1}, fac[maxn+8]={1,1};
int vis[maxn+8]={0};
void init()
{
    for(int i=2; i<=maxn; ++i)
    {
        fac[i] = fac[i-1]*i%mod;
        inv[i] = (mod-mod/i)*inv[mod%i]%mod;
        fi[i] = fi[i-1]*inv[i]%mod;
    }
}

LL c(LL n, LL m)
{
    return fac[n]*fi[n-m]%mod*fi[m]%mod;
}
int main()
{
    init();
    int n, t, dis;
    scanf("%d",&n);
    for(int i=1; i<=n+1; ++i)
    {
        scanf("%d",&t);
        if(vis[t])
            dis = vis[t]+n-i;
        vis[t] = i;
    }
    for(int i=1; i<=n+1; ++i)
    {
        LL ans = c(n*1LL+1, i*1LL)%mod;
        if(dis >= i-1) ans = (ans-c(dis*1LL, i*1LL-1)+mod)%mod;
        printf("%lld\n",ans);
    }
    return 0;
}


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

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

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

const ll INF = 1e10;;

int main(){
    ll N,W;
    cin >> N >> W;
    vector<ll> w(N);
    vector<ll> v(N);
    rep(i,N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N+5,vector<ll>(W+5,0));

    rep(i,N){
        rep(j,W+1){
            if(j - w[i] >= 0){
                chmax(dp[i+1][j] , dp[i][j - w[i]] + v[i]);
            }

            chmax(dp[i+1][j] , dp[i][j]);
        }
    }

    cout << dp[N][W] << endl;
    // rep(i,N+1)rep(j,W+1){
    //     cout << dp[i][j] << " ";
    //     if(j==W)cout << endl;
    // }

    return 0;
}

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

using namespace std;

#define SPEED ios::sync_with_stdio(false)
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define MOD 1000000007
#define INF 1e18
ll n,a1,a[200001];
set<ll>s;
int main() {
SPEED;
cin>>n;
ll ans=1;
for(int i=1;i<=n;i++)
{
	cin>>a1;
	a[a1]=i;
}
ll i=1;
ll j=2,cur=1;
while(j<=n)
{
	while(a[j]>a[j-1] && j<=n)
	cur++,j++;
		ans=max(ans,cur);
		cur=1;
		i=j;
		j++;
}
cout<<n-ans<<endl;
return 0;
           }

Measured memory_bytes: 1792
def main():
    n = int(input())
    s = input().rstrip()
    k = int(input()) 
    l = s[k-1]
    char_array = [None] * n
    for i, c in enumerate(s):
        if c != l:
            char_array[i] = '*'
        else:
            char_array[i] = l
    print(''.join(char_array))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
    using namespace std;
    const long long INF = 1LL <<60;
    const long long Mo=1000000007;
         
    long long gcn(long long x,long long y){
      if(x%y==0){
        return y;  
      }
      else{
        return gcn(y,x%y);
      }
    }
     
    long long modpow(long long a, long long n, long long mod) {
        long long res = 1;
        while (n > 0) {
            if (n & 1) res = res * a % mod;
            a = a * a % mod;
            n >>= 1;
        }
        return res;
    }
     
    int main(void){
      long long tmp1,tmp2;
      long long l[200001]={};
      long long dp[1000001]={};
      long long n,k;
      long long x=0;
      long long i,j,m=0;
      long double res=0.0;
      
      cin>>n;
      long long nn=(long long)pow(n,0.5);
      if(n==nn*nn){
        nn=nn-1;
      }
      
      //cout<<n<<" "<<nn<<endl;
      
      for(i=1;i<=nn;i++){
        dp[i*i]+=1;
        for(j=i*(i+1);j<n;j+=i){
          dp[j]+=2;
        }
      }
      
      for(i=1;i<n;i++){
        //cout<<i<<" "<<dp[i]<<endl;
        res+=dp[i];
      }

      
      cout<<setprecision(15)<<res<<endl;
     
      return 0;
    }

Measured memory_bytes: 12052
n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if nums < minv:
    minv = nums
  
print maxv

Measured memory_bytes: 12692
num = list(map(int, input().split()))
m = []
for i in range(num[0]):
	m.append(int(input()))
for i in range(num[0]):
	num[1]-=m[i]
m = sorted(m)
#print(num[1])
#print(m)
if(num[1]==0):
	print(num[0])
else:
	print(num[1]//m[0]+num[0])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE

template<typename T,typename F>
T KnuthYao(int n,T INF,F cost){
  vector<vector<T> > dp(n+1,vector<T>(n+1,INF));
  vector<vector<int> > nx(n,vector<int>(n));
  for(int i=0;i<n;i++) dp[i][i]=0,nx[i][i]=i;
  for(int w=1;w<n;w++){
    for(int i=0;i+w<n;i++){
      int j=i+w;
      for(int r=nx[i][j-1];r<=nx[i+1][j];r++){
	T c=dp[i][r]+dp[r+1][j]+cost(i,r,j);
	if(dp[i][j]>c) dp[i][j]=c,nx[i][j]=r;
      }
    }
  }
  return dp[0][n-1];
}

signed AOJ_2488(){  
  Int n;
  cin>>n;
  vector<Int> x(n),y(n);
  for(Int i=0;i<n;i++) cin>>x[i]>>y[i];
  const Int INF = 1e18;
  auto calc=[&](int i,int r,int j){	      
	      return r+1<n?x[r+1]-x[i]+y[r]-y[j]:INF;
	    };
  cout<<KnuthYao(n,INF,calc)<<endl;
  return 0;
}
/*
  verified on 2018/09/30
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2488
*/

signed KUPC2012_J(){
  Int n;
  cin>>n;
  vector<Int> w(n);
  for(Int i=0;i<n;i++) cin>>w[i];
  vector<Int> s(n+1);
  for(Int i=0;i<n;i++) s[i+1]=s[i]+w[i];
  const Int INF =1e18;
  auto cost=[&](int i,int r,int j){return s[j+1]-s[i];};
  cout<<KnuthYao(n,INF,cost)<<endl;
  return 0;
}
/*
  verified on 2018/09/30
  https://beta.atcoder.jp/contests/kupc2012/tasks/kupc2012_10
*/

signed main(){
  AOJ_2488();
  //KUPC2012_J();
  return 0;
}



Measured memory_bytes: 14772
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <assert.h>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>                                    
#include <deque>                                    
#include <queue>
#include <iomanip>
#include <ctime>
#include <random>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;

 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

string s, t;
 
inline void boost () {
   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
}

inline void Solve () {
   cin >> s >> t;
   int ans = sz (t);
   for (int i = 0; i + sz (t) - 1 < sz (s); i ++) {
      int res = 0;
      for (int j = 0; j < sz (t); j ++) {
         if (t[j] != s[i + j])
            res ++;
      }
      ans = min (ans, res);
   }
   cout << ans;
}               
 
signed main () {                                       
  // #ifdef QWERTY
   //   freopen("input", "r", stdin);
   //#endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                 


Measured memory_bytes: 3644
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int N = 3;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		int c = parseInt(sc.next());
		sc.close();
		out.println(b-a==c-b?"YES":"NO");
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 6e3 + 30;
const ll SQ = 330;

ll dp[N][N * 2];
ll Mod;
ll mul(ll a, ll b) {
	return (a * b) % Mod;
}
ll sum(ll a, ll b) {
	return (a + b + Mod) % Mod;
}
void Add(ll &a, ll b) {
	a = sum(a, b);
}
int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	ll n;
	cin >> n;
	cin >> Mod;
	n *= 3;
	dp[0][n] = 1;
	for (int i = 1; i <= n; i ++) {
		for (int j = 0; j <= n + n; j ++) {
			if (j) Add(dp[i][j], dp[i - 1][j - 1]);
			if (i >= 2) Add(dp[i][j], mul(i - 1, dp[i - 2][j + 1]));
			if (i >= 3) Add(dp[i][j], mul(mul(i - 1, i - 2), dp[i - 3][j]));
		}
	}
	ll ans = 0;
	for (int i = n; i <= n + n; i ++)
		Add(ans, dp[n][i]);
	cout << ans;
	
}

Measured memory_bytes: 567424
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int n,k;
  cin>>n>>k;
  vector<int>p(n);
  rep(i,n)cin>>p[i];
  p.pb(-1e9);
  set<int>st;
  vector<int>sum(n),cnt(n-1);
  rep(i,n-1){
    if(p[i]<p[i+1])cnt[i]=1;
  }
  rep(i,n-1)sum[i+1]=sum[i]+cnt[i];
  int c=0;
  rep(i,k)st.emplace(p[i]);
  int ans=n-k+1;
  rep(i,n-k+1){
    if(p[i]==*st.begin()){
      st.erase(p[i]);
      st.emplace(p[i+k]);
      if(sum[i+k-1]-sum[i]==k-1)++c;
      else if(*prev(st.end())==p[i+k])--ans;
    }
    else st.erase(p[i]),st.emplace(p[i+k]);
  }
  if(c)c--;
  //cerr<<c<<endl;
  cout<<ans-c;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 12016
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n%2 == 0){
            System.out.println(n);
        }else{
            System.out.println(n*2);
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    double a[105];
    double sou=0.0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sou+=a[i];
    }
    int ans=0;
    double hantei=sou/(4*m);
    for(int i=0;i<n;i++){
        if(a[i]>=hantei){
            ans++;
        }
    }
    if(ans>=m){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

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

using namespace std;


int main()
{
	int N;
	set<int> s;

	scanf("%d", &N);

	for (int i = 0, temp; i < N; i++)
	{
		scanf("%d", &temp);
		s.insert(temp);
	}
	printf("%d\n", s.size());
	return 0;
}

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

int h, w;
char c[101][101];
int main() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
			cout << c[i][j];
		}
		cout << endl;
		rep(j, w) cout << c[i][j];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define all(x) (x).begin(),(y).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vec<ll> A(2),B(2);
    cin >> A[0] >> A[1];
    cin >> B[0] >> B[1];
    ll ans = -2e18;
    if(A[0]<=0 && 0<=A[1]) ans = 0;
    if(B[0]<=0 && 0<=B[1]) ans = 0;    
    for(int i=0;i<2;i++) for(int j=0;j<2;j++){
        chmax(ans,A[i]*B[j]);
    }
    cout << ans << "\n";
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    ll sum=100;
    ll x;
    cin >> x;
    for(ll i=0;;i++){
        if(sum>=x){
            cout << i << endl;
            break;
        }
        sum += ll(sum*0.01);
    }


}


Measured memory_bytes: 3652
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long k = long.Parse(input[1]);
    long answer = long.MaxValue;

    long[,] vertexes = new long[n,2];//ここに受け取る
    for(long i = 0; i < n; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);//１行ごとに受け取る
      vertexes[i,0] = nums[0];
      vertexes[i,1] = nums[1];
    }

    for(int xa = 0; xa < n; xa++)
    {
      for(int xb = xa+1; xb < n; xb++)
      {
        for(int ya = 0; ya < n; ya++)
        {
          for(int yb = ya+1; yb < n; yb++)
          {
            int memo = 0;
            for(int i = 0; i < n; i++)
            {
              if((vertexes[xa,0]-vertexes[i,0])*(vertexes[xb,0]-vertexes[i,0])<=0 &&
                (vertexes[ya,1]-vertexes[i,1])*(vertexes[yb,1]-vertexes[i,1])<=0) memo++;
            }
            if(memo >= k) answer = Math.Min(answer, 
              Math.Abs((vertexes[xb,0]-vertexes[xa,0])*(vertexes[yb,1]-vertexes[ya,1])));
          }
        }
      }
    }

		Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i,n) cin >> vec[i];
    rep(i,n) vec[i]--;
    map<int,int> mp;
    int i=0;
    auto itr=mp.find(vec[i]);
    do{
        itr=mp.find(vec[i]);
        mp[vec[i]]=mp.size();
        i=vec[i];
        if(i==1){
            cout << mp.size() << endl;
            return 0;
        }
    }while(itr==mp.end());
    cout << -1 << endl;
    return 0;
}

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

#define PI 3.14159265358979323846264338327950L
int main(void) {
int a, b, h, m;
scanf("%d%d%d%d", &a, &b, &h, &m);
 long double rad = PI * 2 * (
 (long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long
double)m / 60.0);
long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *b) * cosl(rad); 
printf("%20.20Lf\n", sqrtl(rsq));
return 0;
 }


Measured memory_bytes: 2500
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
typedef long long ll;
/*

*/
int main()
{
    string S;
    int ans = 0;
    cin >> S;
    char state;
    state = S[0];
    for (int i = 1; i < S.length(); i++)
    {
        if(state != S[i]){
            ans++;
            state = S[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S, T; cin >> S >> T;
    int n = S.size();
    bool ok = false;
    rep(i, n){
        ok |= (S.substr(i) + S.substr(0, i) == T);
    }

    cout << (ok ? "Yes":"No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

const int MAXN=1e2+10;
ll a[MAXN], b[MAXN], c[MAXN], d[MAXN];
ll av[MAXN], bv[MAXN], cv[MAXN], dv[MAXN];

bool cmp(ll a, ll b){
    return a>b;
}

int main(void){
    ll n, m, x, y, cnt, ans=0;
    int indxa=1, indxb=1, indxc=1, indxd=1;
    cin >> n >> m;
    cin >> x >> y;
    cnt=x;
    a[indxa++]=y;
    for(int i=0; i<n-1; i++){
        cin >> x >> y;
        int cc=x-cnt;
        if(cc==0) a[indxa++]=y;
        else if(cc==1) b[indxb++]=y;
        else if(cc==2) c[indxc++]=y;
        else d[indxd++]=y;
    }
    sort(a+1, a+indxa, cmp);
    sort(b+1, b+indxb, cmp);
    sort(c+1, c+indxc, cmp);
    sort(d+1, d+indxd, cmp);
    for(int i=1; i<indxa; i++){
        av[i]=av[i-1]+a[i];
    }
    for(int i=1; i<indxb; i++){
        bv[i]=bv[i-1]+b[i];
    }
    for(int i=1; i<indxc; i++){
        cv[i]=cv[i-1]+c[i];
    }
    for(int i=1; i<indxd; i++){
        dv[i]=dv[i-1]+d[i];
    }
    for(int i=0; i<indxa; i++){
        ll cnt1=i*cnt;
        if(cnt1>m) break;
        for(int j=0; j<indxb; j++){
            ll cnt2=cnt1+j*(cnt+1);
            if(cnt2>m) break;
            for(int k=0; k<indxc; k++){
                ll cnt3=cnt2+k*(cnt+2);
                if(cnt3>m) break;
                for(int l=0; l<indxd; l++){
                    ll cnt4=cnt3+(cnt+3)*l;
                    if(cnt4>m) break;
                    ll num=av[i]+bv[j]+cv[k]+dv[l];
                    ans=max(ans, num);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    X = readint()
    print('Yes' if X >= 30 else 'No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9164
#include <bits/stdc++.h>
#define rep(a, b, c) for(int a = (b); a <= (c); ++ a)
#define per(a, b, c) for(int a = (b); a >= (c); -- a)
using namespace std;
template <class T> void rd(T &x){
  x = 0; int f = 1; char ch = getchar();
  while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); }
  while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}

int main(){
  int n; rd(n);
  printf("%d\n", n * 180 - 360);
  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

void debug_out() {};
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

struct C1 {
        string S_{};
        ll K_{};
        vector<ll> consec_lengths{};
    explicit C1(string S, ll K) : S_(move(S)), K_(K) {}
    ll resolve() {
        auto unique_S = S_;
        unique_S.erase(std::unique(unique_S.begin(), unique_S.end()), unique_S.end());

        if (S_.size() == 1 || unique_S.size() == 1) {
            return S_.size() * K_ / 2;
        }
        bool consecutive = S_.front() == S_.back();
        char prev{S_[0]};
        ll count = 0;
        ll len = 1;
        for(ll i=1; i < S_.size(); i++) {
            if(S_[i] != prev) {
                prev = S_[i];
                consec_lengths.emplace_back(len);
                len = 1;
            } else {
                ++len;
            }
        }
        consec_lengths.emplace_back(len);
        if (!consecutive) {
            for(auto l : consec_lengths) {
                count += l / 2;
            }
            count *= K_;
        } else {
            for(ll i = 1; i < consec_lengths.size()-1; ++i) {
                count += consec_lengths[i] / 2;
            }
            count *= K_;
            count += (consec_lengths[0]+consec_lengths[consec_lengths.size()-1]) / 2 * (K_-1) + consec_lengths[0]/2 + consec_lengths[consec_lengths.size()-1]/2;
        }
        return count;
    }
};

int main() {
    string S;
    ll K;
    cin >> S >> K ;
    C1 c{move(S), K};
    cout << c.resolve() << endl;
    return 0;
}


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

def main():
    S = input()
    gp = [0, 0]
    ans = 0
    for c in S:
        if gp[0] > gp[1] and c == 'g':
            ans += 1
            gp[1] += 1
        elif gp[0] > gp[1] and c == 'p':
            gp[1] += 1
        elif c == 'g':
            gp[0] += 1
        else:
            ans -= 1
            gp[0] += 1
    print(ans)




if __name__ == "__main__":
    main()


Measured memory_bytes: 71568
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int k = s.nextInt();
		boolean [] not_replay = new boolean[n];
		boolean [] is_replayed = new boolean[n];
		boolean [] visible = new boolean[n];
		int [] parent = new int[n];
		int [] height = new int[n];
		for (int i=0;i<n;i++) {
			int a = s.nextInt();
			if (a == 0) {
				not_replay[i] = true;
				parent[i] = -1;
			} else {
				is_replayed[a - 1] = true;
				parent[i] = a - 1;
			}
		}
		Deque<Integer> que = new ArrayDeque<Integer>();
		boolean[] checked = new boolean[n];
		for (int i=0;i<n;i++) {
			check(i, not_replay, is_replayed, visible, que, height, checked);
		}
		while (!que.isEmpty()) {
			int x = que.poll();
			if (height[x] < k) {
				visible[x] = true;
				int p = parent[x];
				if (p != -1 && !checked[p]) {
					height[p] = height[x] + 1;
					checked[p] = true;
					que.add(p);
				}
			}
		}
		int ans = 0;
		for (int i=0;i<n;i++) {
			if (visible[i]) ans++;
		}
		System.out.println(ans);
	}
	static void check (int x, boolean[] not_replay, boolean[] is_replayed, boolean[] visible, Deque<Integer> que, int[] height, boolean[] checked) {
		if (not_replay[x]) {
			visible[x] = true;
		}
		if (!is_replayed[x]) {
			height[x] = 0;
			checked[x] = true;
			que.push(x);
		}
	}
}




Measured memory_bytes: 72124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	ll change=0;
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]){
			change++;
		}
	}
	ll sum=0;char now=s[0];ll cnt=1;
	for(int i=1;i<n;i++){
		if(s[i]==now){
			cnt++;
		}
		else{
			sum+=cnt-1;
			cnt=1;
			now=s[i];
		}
	}
	sum+=cnt-1;
	//cout <<sum<<endl;
    sum+=2*min(k,change);
    if(k>change){
    	sum+=k-change;
    }
	cout <<min(n-1,sum);
	return 0;
}

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

if A + B == 0:
    print(0)
elif A >= N:
    print(N)
elif A+B >= N:
    print(A)
else:
    res = (N // (A+B))*A
    amari = N % (A+B)
    
    if amari <= A:
        print(res + amari)
    elif amari <= A+B:
        print(res + A)

Measured memory_bytes: 38384
import java.util.*;
public class Main {

	public static void main(String[] args) {
	Scanner cin = new Scanner(System.in);
	double h=0,l=0;
	while(true){
		if(!cin.hasNext()){
			break;
		}
		double x;
		x=cin.nextDouble();
		if(l==0){
			l=x;
		}
		if(x>=h){
			h=x;
		}
		if(l>=x){
			l=x;
		}
	}
	System.out.println(h-l);
	}
}

Measured memory_bytes: 18588
#include<iostream>
#include<utility>
using namespace std;
int N,M;
pair<int,int>A[2][10];
int T[100];
main()
{
	for(int i=0;i<10;i++)A[0][i].first=A[1][i].first=-1;
	while(cin>>N>>M,N)
	{
		for(int i=0;i<M;i++)cin>>T[i];
		int id=0;
		bool flag=false;
		for(int t=0;t<2e4;t++)
		{
			for(int i=0;i<N;i++)
			{
				if(A[0][i].first>0&&A[0][i].second<=t)
				{
					if(flag)cout<<" ";
					flag=true;
					cout<<A[0][i].first;
					A[0][i]=A[1][i];
					A[1][i].first=-1;
					if(A[0][i].first>0&&A[0][i].second<=t)
					{
						if(flag)cout<<" ";
						flag=true;
						cout<<A[0][i].first;
						A[0][i].first=-1;
					}
				}
			}
			for(;id<M&&id*10<=t;id++)
			{
				int I=-1;
				for(int i=0;i<N;i++)
				{
					if(A[0][i].first<0)
					{
						I=i;
						break;
					}
				}
				if(I>=0)
				{
					A[0][I].first=id+1;
					A[0][I].second=t+T[id];
					continue;
				}
				int J=-1;
				for(int i=0;i<N;i++)
				{
					if(A[1][i].first<0)
					{
						if(A[0][i].second>=t+T[id])
						{
							if(I<0||A[0][i].second<A[0][I].second)I=i;
						}
						else
						{
							if(J<0||A[0][i].second>A[0][J].second)J=i;
						}
					}
				}
				if(I>=0)
				{
					A[1][I]=A[0][I];
					A[0][I].first=id+1;
					A[0][I].second=t+T[id];
				}
				else if(J>=0)
				{
					A[1][J]=A[0][J];
					A[0][J].first=id+1;
					A[0][J].second=t+T[id];
				}
				else break;
			}
		}
		cout<<endl;
	}
}



Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 2e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
int n, k;
ll p[maxx];

int main() {
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++) scanf("%lld", &p[i]);
	// x的期望 = (x + 1) / 2.0;
	// 期望和 = (sum + k) / 2.0;
	ll sum = 0ll;
	for(int i = 1; i <= k; i++) sum += p[i];
	ll ans = sum;
	for(int i = 2; i <= n - k + 1; i++) {
		ll tmp = sum - p[i - 1] + p[i + k - 1];
		sum = tmp;
		//printf("%lld", sum);
		ans = max(ans, sum);
	}
	printf("%.10lf\n", (ans + k) / 2.00000000000);
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define pb push_back
    #define printV(v) for(int i=0;i<v.size();i++){cout << v[i] << " ";} cout << endl
    #define printRev(v) for(int i=v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
    #define sortV(v) sort(v.begin(),v.end())
    #define revV(v) reverse(v.begin(),v.end())
    ll a,b,c,d,e,f,g,n,m,k,t,p,x;
 
    ll mod = 998244353;
 
   
    bool isPal(string &str){
        for(int i=0;i<str.size();i++){
            if(str[i] != str[str.size()-1-i]) return false;
        }
        return true;
    }

    void solve(){
       cin >> n;
       map<ll,ll> mp;
       ll answer = 0;
       ll arr[n];
       for(int i=0;i<n;i++){
           cin >> arr[i];
           mp[arr[i]]++;
       }
       for(auto it : mp){
           answer += it.second * (it.second -1) / 2;
       }
       for(int i=0;i<n;i++){
           ll curr = mp[arr[i]];
           cout << answer - (curr * (curr-1))/2 + (curr-1) * (curr-2)/2 << endl;
       }
    }
 
 
 
    int main(){
        ios_base::sync_with_stdio(false);
       
        int cases = 1; 
        //cin >> cases;

        while(cases--){
            solve();
        }
        return 0;
 
    }

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

int main() {
  int A, B, count=0;
  cin >> A >>B;
  
  for(int i=A; i<B+1; i++){
    if(i/10000 == i%10
    && i/1000%10 == i%100/10){
      count++;
    }
    
  }
  cout << count << endl;
}


Measured memory_bytes: 256
n = int( raw_input( ) )
dic = {}
for i in range( n ):
	cmd, word = raw_input( ).split( " " )
	if "insert" == cmd:
		dic[ word ] = True
	elif "find" == cmd:
		if not dic.get( word ):
			print( "no" )
		else:
			print( "yes" )

Measured memory_bytes: 62724
n = int(input())

dp = [0 for i in range(3)]
for i in range(1,n+1):
    a,b,c = map(int, input().split())
    x = max(dp[1] + a, dp[2] + a)
    y = max(dp[2] + b, dp[0] + b)
    z = max(dp[0] + c, dp[1] + c)
    dp = [x,y,z]
print(max(dp))


Measured memory_bytes: 3060
s = input()
q = int(input())
is_r = False
f_list = []
b_list = []

for i in range(q):
    q_i = input().split(' ')
    t_i = q_i[0]
    if t_i == '1':
        is_r = not is_r
    else:
        f_i = q_i[1]
        if (f_i == '1' and not is_r) or (f_i == '2' and is_r):
            f_list.append(q_i[2])
        else:
            b_list.append(q_i[2])

f_list = f_list[::-1]
f_list.append(s)
f_list.extend(b_list)
s = ''.join(f_list) if not is_r else ''.join(f_list)[::-1]
print(s)

Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;
long long n, k, mx, a[N], s[N], l[N], r;
int main() {
	int i;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++) {
		scanf("%lld", a+i);
		s[i] = s[i-1] + a[i];
		l[i] = l[i-1] + max(0LL, a[i]);
	}
	for(i=n; i>=k; i--) {
		mx = max(mx, l[i-k] + max(0LL, s[i]-s[i-k]) + r);
		r += max(0LL, a[i]);
	}
	printf("%lld", mx);
	return 0;
}

Measured memory_bytes: 2688
//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/

#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define fo(x,y) for(int x = 1 ; x <= y ; ++x)
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;

typedef long long ll;
typedef unsigned int uint;
const int nmax = 200005;
const ll linf = LLONG_MAX;
const int mod = 1e9+7;
const int inf = INT_MAX;
#define pll pair<ll,ll>



string sa;

int main(){
    cin >> sa;
    fo(i,sa.size()){
    cout << 'x';
    }

}


Measured memory_bytes: 256
import Control.Applicative

includeThree :: Integer -> Bool
includeThree 0 = False
includeThree x
    | mod x 10 == 3 = True
    | otherwise     = includeThree $ div x 10

main :: IO()
main = do
    n <- read <$> getLine
    putStrLn (" " ++ (unwords . map show) [x | x <- [1 .. n], or [mod x 3 == 0, includeThree x]])

Measured memory_bytes: 4136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;

int main()
{
  int A, N;
  cin >> N >> A;
  int rest = N % 500;
  cout << ((rest <= A) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,x,i,j,cards[4][13] = {{0}};
    char ch;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> ch >> x;
        if(ch=='S'){
            cards[0][x-1]=1;
        }else if(ch=='H'){
            cards[1][x-1]=1;
        }else if(ch=='C'){
            cards[2][x-1]=1;
        }else if(ch=='D'){
            cards[3][x-1]=1; 
        }
    }
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(cards[i][j]==0){
                if(i==0){
                    cout << "S"<< " " <<j+1;
                    cout << endl;
                }else if(i==1){
                    cout << "H" << " " << j+1;
                    cout << endl;
                }else if(i==2){
                    cout << "C" << " " << j+1;
                    cout << endl;
                }else if(i==3){
                    cout << "D" << " " << j+1;
                    cout << endl;
                }
            }
        }
    }
}



Measured memory_bytes: 3088
//インクルード
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

//型宣言
typedef long long ll;
typedef unsigned long long ull;
typedef std::string answerType;

//変数宣言
ll N;
std::vector<int> Ai;
answerType answer;
int A;
int B;

//関数のプロトタイプ宣言
//入力の取得
void getInput();

//メイン関数
int main() {
	//入力の取得
	getInput();

	//答え
	answerType answer;

	if(A > B) {
		answer = "Alice";
	} else if(A < B) {
		answer = "Bob";
	} else {
		answer = "Draw";
	}

	//答えの出力
	std::cout << answer << std::endl;

	//正常終了
	return EXIT_SUCCESS;
}

//入力の取得
void getInput() {
	std::cin >> A >> B;
	if(A == 1) {
		A = 14;
	}
	if(B == 1) {
		B = 14;
	}
}


Measured memory_bytes: 256
from collections import deque
order = int(input())
llist = [input().split() for _ in range(order)]
ans = deque([])
count = 0
for lst in llist:
    if lst[0] == 'insert':
        ans.appendleft(lst[1])
    
    elif lst[0] == 'delete':
        if lst[1] in ans:
            ans.remove(lst[1])
   
    elif lst[0] == 'deleteFirst':
        ans.popleft()
    
    elif lst[0] == 'deleteLast':
        ans.pop()
        
    count += 1

print(*ans)
    

Measured memory_bytes: 557392
#include<bits/stdc++.h>
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    IOS;
    int n,t,a,h;
    cin>>n;
    cin>>t>>a;
    vector<float>v;
    for(int i=0;i<n;i++)
    {
        cin>>h;
        v.push_back(t-((float)(h*6)/1000));
    }
    for(int i=0;i<n;i++)
    {
        v[i]=fabs(v[i]-a);
    }
    auto it=find(v.begin(),v.end(),*min_element(v.begin(),v.end()));
    cout<<it-v.begin()+1<<endl;
return 0;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007LL
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
int dp[214514][16], rdp[214514][16],tdp[214514],trdp[214514];
signed main(){
	int n;
	cin>>n;
	if( n==1 ){ cout<<0<<endl; return 0; }
	vector<int> a,r;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		a.pb(x); r.pb(x);
	}
	reverse( r.begin(), r.end() );
	for(int i=0;i<n;i++){
		tdp[i] = LINF;
		trdp[i] = LINF;
		for(int j=0;j<=15;j++){
			dp[i][j] = LINF;
			rdp[i][j] = LINF;
		}
	}
	for(int i=0;i<=15;i++){
		dp[n-1][i] = i;
	}
	for(int i=n-2;i>=0;i--){
		int cur = a[i];
		for(int j=0;j<=15;j++){
			int nex = a[i+1];
			int cnt = 0;
			while( cur > nex ){
				cnt ++ ;
				nex <<= 2;
			}
			if( cnt <= 15 ){
				dp[i][j] = dp[i+1][cnt] + j;
			}
			else{
				dp[i][j] = dp[i+1][15] + (cnt-15)*(n-i-1) + j;
			}
			cur *= 4;
		}
	}
	for(int i=0;i<=15;i++){
		rdp[n-1][i] = i;
	}
	for(int i=n-2;i>=0;i--){
		int cur = r[i];
		for(int j=0;j<=15;j++){
			int nex = r[i+1];
			int cnt = 0;
			while( cur > nex ){
				cnt ++ ;
				nex <<= 2;
			}
			if( cnt <= 15 ){
				rdp[i][j] = rdp[i+1][cnt] + j;
			}
			else{
				rdp[i][j] = rdp[i+1][15] + (cnt-15)*(n-i-1) + j;
			}
			cur *= 4;
		}
	}
	int ans = LINF;
	for(int i=0;i<n;i++){
		for(int j=0;j<=15;j++){
			tdp[i] = min(tdp[i],dp[i][j]);
			trdp[i] = min(trdp[i],rdp[i][j]);
		}
	}
	ans = min(ans,2*tdp[0]);
	//cout<<0<<" "<<2*tdp[0]<<" "<<0<<endl;
	for(int i=1;i<=n-1;i++){
		ans = min( ans, 2*tdp[i]+2*trdp[n-i]+i );
		//cout<<i<<" "<<2*tdp[i]<<" "<<2*trdp[n-i]<<endl;
	}
	ans = min(ans, 2*trdp[0] + n); 
	//cout<<n<<" "<<0<<" "<<2*trdp[0]<<endl;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 58724
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  for(int i = 0; i < A; i++) {
    cin >> a.at(i);
  }
  for(int i = 0; i < B; i++) {
    cin >> b.at(i);
  }
  int ans = 200000;
  for(int i = 0; i < M; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    if(a.at(x - 1) + b.at(y - 1) - c < ans) {
      ans = a.at(x - 1) + b.at(y - 1) - c;
    }
    if(i == M - 1) {
      sort(a.begin(), a.end());
      sort(b.begin(), b.end());
      if(a.at(0) + b.at(0) < ans) {
        ans = a.at(0) + b.at(0);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3992
#include <stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(i*j==n){
        printf("Yes");
        return 0;
      }
    }
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int a,b,c,x=0,y=0;
  while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
    if(a == b) x++;
    else if(a*a+b*b == c*c) y++;
  }
  cout <<y<<endl<<x<<endl;
  return 0;
}

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

typedef long long ll;

int n;
string str;
string s1, s2, ss;
ll dp[20][20];

ll get(int i, int j){
    if(i == 0 && j == 0) return 1;
    if(dp[i][j] != -1) return dp[i][j];

    dp[i][j] = 0;
    if(i > 0 && j > 0 && s1[j-1] == ss[i-1]) dp[i][j] += get(i-1, j-1);
    if(i > 0 && i > j && s2[i-j-1] == ss[i-1]) dp[i][j] += get(i-1, j);

    return dp[i][j];
}

ll solve(){
    for(int i = 0; i <= 18; i++) for(int j = 0; j <= 18; j++) dp[i][j] = -1;
    return get(ss.length(), s1.length());
}

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

    ll res = 0;
    for(int i = 0; i < (1 << n); i++){
        s1.clear(), s2.clear(), ss.clear();
        for(int j = 0; j < n; j++){
            if((1 << j) & i) s1.push_back(str[j]);
            else s2.push_back(str[j]);
        }
        ss = str.substr(n, n);
        reverse(ss.begin(), ss.end());
        res += solve();
    }
    cout << res << endl;
}

Measured memory_bytes: 256