akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <cctype>
using namespace std;

int main() {
    string s;
    cin >> s;
    vector<string> text;
    string p = "";
    while(p != "END_OF_TEXT"){
        p = "";
        cin >> p;
        text.push_back(p);
    }
    
    int count = 0;
    for(int i = 0; i< text.size(); i++){
        string tr = "";
        transform(text[i].begin(), text[i].end(), text[i].begin(), ::tolower);
        if(s == text[i]){
            count++;
        }
    }

    cout << count << endl;
}


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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i++) {
		for(int j = i + 1; j < s.size(); j++) {
			if(s[i] == s[j]) {
				cout << "no" << endl;
				return 0;
			}
		}
	}
	cout << "yes" << endl;
}


Measured memory_bytes: 256
import math
n,m=map(int,input().split())
if n>1:
  N=math.factorial(n) // (math.factorial(n - 2) * 2)
else:
  N=0
if m>1:
  M=math.factorial(m) // (math.factorial(m - 2) * 2)
else:
  M=0
print(N+M)

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

int a[MAXN];
int N, X;

int main()
{
  scanf("%d%d", &N, &X);
  for (int i = 0; i < N; i++) {
    scanf("%d", a+i);
  }
  int d = 0;
  int cnt = 1;
  for (int i = 0; i < N; i++) {
    d = a[i] + d;
    if (d <= X) cnt++;
    else break;
  }
  printf("%d\n", cnt);
}


Measured memory_bytes: 256
data Dir = N | E | W | S

mn x y = if x > y then y else x
mx x y = if x > y then x else y

play b (d,x,y) [] = (x,y)
play b@(xx,yy) (d,x,y) (["FORWARD",k]:ls) =
  case d of
    N -> play b (d,x,(mn yy (y+k'))) ls
    E -> play b (d,(mn xx (x+k')),y) ls
    W -> play b (d,(mx 1 (x-k')),y) ls
    S -> play b (d,x,(mx 1 (y-k'))) ls
  where
    k' = read k :: Int

play b@(xx,yy) (d,x,y) (["BACKWARD",k]:ls) =
  case d of
    N -> play b (d,x,(mx 1 (y-k'))) ls
    E -> play b (d,(mx 1 (x-k')),y) ls
    W -> play b (d,(mn xx (x+k')),y) ls
    S -> play b (d,x,(mn yy (y+k'))) ls
  where
    k' = read k :: Int

play b (d,x,y) (["RIGHT"]:ls) =
  case d of
    N -> play b (E,x,y) ls
    E -> play b (S,x,y) ls
    W -> play b (N,x,y) ls
    S -> play b (W,x,y) ls
play b (d,x,y) (["LEFT"]:ls) =
  case d of
    N -> play b (W,x,y) ls
    E -> play b (N,x,y) ls
    W -> play b (S,x,y) ls
    S -> play b (E,x,y) ls

ans [] = []
ans (["0","0"]:_) = []
ans (l:ls) =
  let [x,y] = map read l :: [Int]
      d = takeWhile (\x -> "STOP" /= head x) ls
      r = drop 1 $ dropWhile (\x -> "STOP" /= head x) ls
      a = play (x,y) (N,1,1) d
  in
    a:(ans r)

main = do
  c <- getContents
  let i = map words $ lines c
      o = ans i
  mapM_ putStrLn $ map (\(x,y) -> unwords $ map show [x,y] ) o
  



Measured memory_bytes: 4988
N,M=map(int,input().split())
E=[[] for _ in range(N)]
lst=[]
for i in range(M):
  x,y=map(int,input().split())
  x-=1
  y-=1
  E[x].append(y)
  E[y].append(x)
  lst.append((x,y))
cnt=0
for x,y in lst:
  stack=[0]
  seen=[0]*N
  seen[0]=1
  while stack:
    u=stack.pop()
    for v in E[u]:
      if (u==x and v==y)or (u==y and v==x):
        pass
      else:
        if seen[v]==0:
          seen[v]=1
          stack.append(v)
  if sum(seen)==N:
    pass
  else:
    cnt+=1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, k;
    cin >> n >> k;
    int count = 0;
    int m = 1;
    while(m <= n){
        m *= k;
        count++;
    }
    cout << count << endl;
    return 0;
}


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

const int INF = 500000;
const int MAXN = 200000;
int score[MAXN];
int counter[MAXN];
vector<int> G[MAXN];


int main() {
  int N, Q;
  cin >> N >> Q;
  
  for (int i = 0; i < N - 1; i++) {
    int s, t;
    cin >> s >> t;
    G[s-1].push_back(t-1);
    G[t-1].push_back(s-1);
  }
  
  int p[Q], x[Q];
  
  for (int i = 0; i < Q; i++) {
    cin >> p[i] >> x[i];
  }
  
  int counter[N];
  
  for (int i = 0; i < N; i++) {
    counter[i] = 0;
  }
  
  for (int i = 0; i < Q; i++) {
    counter[p[i] - 1] += x[i];
  }
  
  queue<int> que;
  for (int i = 0; i < N; i++) {score[i] = INF;}
  que.push(0);
  score[0] = counter[0];
  
  while (que.size()) {
    int p = que.front();
    que.pop();
    for (int i = 0; i < G[p].size(); i++) {
      int q = G[p].at(i);
      
      if (score[q] == INF) {
        que.push(q);
        score[q] = score[p] + counter[q];
      }
    }
  }
  
  for (int i = 0; i < N; i++) {
    cout << score[i] << " ";
  }
}

Measured memory_bytes: 18676
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
#include<iomanip>
#include<map>
#include<fstream>
#include<queue>
#include<set>

using namespace std;


int main()
{
	string s;
	bool flag;
	cin >> s;
	while (s.size() != 0) {
		s.erase(s.end() - 2, s.end());
		flag = true;
		int n = s.size() / 2;
		for (int i = 0; i < n; i++) {
			if (s[i] != s[n + i])
				flag = false;
		}
		if (flag) {
			cout << s.size() << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define reg register

using namespace std;

typedef long long ll;
typedef pair < int, int > pii;
const int maxn = 100005;
const int INF = 0x3f3f3f3f;

inline ll read() {
    reg ll s = 0, t = 0; reg char ch = getchar();
    while (!isdigit(ch)) t |= ch == '-', ch = getchar();
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}

int n, m, s, t;
struct Edge { int to, nxt; } p[maxn << 1];
int head[maxn], cnt;

int f[maxn][3];
inline void addedge(reg int u, reg int v) {
    p[++cnt].to = v, p[cnt].nxt = head[u], head[u] = cnt;
}

inline void bfs() {
    queue < int > q;
    q.push(s);
    memset(f, 0x3f, sizeof(f)); f[s][0] = 0;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        for (reg int i = head[u]; i; i = p[i].nxt) {
            int j = p[i].to;
            bool check = false;
            if (f[j][0] > f[u][2] + 1) f[j][0] = f[u][2] + 1, check = true;
            if (f[j][1] > f[u][0] + 1) f[j][1] = f[u][0] + 1, check = true;
            if (f[j][2] > f[u][1] + 1) f[j][2] = f[u][1] + 1, check = true;
            if (check) q.push(j);
        }
    }
}

int main() {
    n = read(), m = read(); reg int u, v;
    for (reg int i = 1; i <= m; i++) u = read(), v = read(), addedge(u, v);
    s = read(), t = read();
    bfs();
    if (f[t][0] == INF) puts("-1");
    else cout << f[t][0] / 3 << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	ll x;
	cin >> x;
	ll a = x / 500;
	ll b = x % 500;
	ll c = b / 5;
	cout << a * 1000 + c * 5;
	return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
//cin.tie(0);
//ios::sync_with_stdio(false);
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
llint LBI(vector<llint>&ar,llint in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
llint UBI(vector<llint>&ar,llint in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint n,a,b,k,i,ans=0;cin>>n>>a>>b>>k;
	vector<llint>kai(n+1);
	vector<llint>gya(n+1);
	kai[0]=1;
	for(i=1;i<=n;i++){kai[i]=(kai[i-1]*i)%mod;}
	gya[n]=1;
	llint bgen=kai[n];
	for(int h=0;h<30;h++){
		if((mod-2)&(1LL<<h)){gya[n]*=bgen;gya[n]%=mod;}
		bgen*=bgen;bgen%=mod;
	}
	for(i=n;i>0;i--){gya[i-1]=gya[i]*i%mod;}
	//cerr<<gya[3]*kai[4]%mod<<endl;
	for(i=0;i<=n;i++){
		llint j=(k-i*a)/b;
		if(j<0||n<j||i*a+j*b!=k){continue;}
		ans+=(gya[i]*gya[n-i]%mod)*(gya[j]*gya[n-j]%mod);
		ans%=mod;
	}
	ans*=kai[n];ans%=mod;
	ans*=kai[n];ans%=mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int n, a, b;
  readf("%s %s %s\n", &n, &a, &b);
  min(n*a,b).writeln;
}


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

using namespace std;

int main() {
    int H, W;
    
    while (true) {
        cin >> H >> W;
        
        if (H == 0 && W == 0) break;
        
        for (int h = 1; h <= H; ++h) {
            for (int w = 1; w <= W; ++w) {
                if (h % 2 == 0) {
                    if (w % 2 == 1) {
                        cout << "." << flush;
                    } else {
                        cout << "#" << flush;
                    }
                } else {
                    if (w % 2 == 1) {
                        cout << "#" << flush;
                    } else {
                        cout << "." << flush;
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 3080
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e+1),n=0;n<e;n++)r[n]=t.in();r[e]=-1;for(var i=0,o=r[0],s=1,u=1;u<e+1;u++)r[u]==o?s++:(i+=Math.floor(s/2),o=r[u],s=1);console.log(i)}}]);

Measured memory_bytes: 7372
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int x[n+1],y[n+1],i,t[n+1],count=0;
	x[0]=0;
	y[0]=0;
	t[0]=0;
	for(i=1;i<n+1;i++)
	{
		cin>>t[i]>>x[i]>>y[i];
		if((t[i]-t[i-1]-abs(x[i]-x[i-1])-abs(y[i]-y[i-1]))%2==0 && (t[i]-t[i-1]-abs(x[i]-x[i-1])-abs(y[i]-y[i-1]))>=0)
		count++;
	}
	if(count==n)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	
	
	return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int s = 0;
    rep(i,n) s += a[i];
    int cnt = 0;
    rep(i,n) {
      if (a[i]*(4*m) >= s) cnt++;
    }
    if (cnt >= m) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
         
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

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; }
typedef pair <ll,ll> P;


int main()
{
    ll N, A;
    cin >> N >> A;
    cout << N * N - A << endl;
    return 0;
}


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

using namespace std ;

const int MAX = 1e5 + 10 ;

int n ;
int arr[MAX] ;
long double d ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>d ;
	int cnt = 0 ;
	for(int i = 0 ; i < n ; ++i)
	{
		long long x , y ;
		cin>>x>>y ;
		long double a = sqrt((x * x) + (y * y)) ;
		if(isgreater(a , d))
			continue ;
		cnt++ ;
	}
	return cout<<cnt<<"\n" , 0 ;
}

Measured memory_bytes: 3804
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	while(-1){
		int m,f,r;cin>>m>>f>>r;
		if(m+f+r==-3){RE;}
		if(m==-1||f==-1){cout<<'F'<<endl;}
		else if(m+f<30){cout<<'F'<<endl;}
		else if(80<=m+f){cout<<'A'<<endl;}
		else if(65<=m+f){cout<<'B'<<endl;}
		else if(50<=m+f||50<=r){cout<<'C'<<endl;}
		else {cout<<'D'<<endl;}
	}
	RE;
}


Measured memory_bytes: 3096
#include<iostream>//???????????????"iostream"?????????????????????
using namespace std;

/*3????????????????¢????????????¢??°?????????*/
bool has3(int a){
	
	while(a){
		
		if(a%10==3){return true;}
		a/=10;
	}
	
	return false;
}

/*??¨???????????°????????????????????¢??°?????????*/
void call(int b){
	
	for(int i=1;i<=b;i++){
	
		if(i%3==0||has3(i)){cout<<" "<<i;}
	
	}

	cout<<"\n";

}

/*???????????¢??°(??????)*/
int main(){

	int num;
	cin>>num;
	
	call(num);

	return 0;
}

Measured memory_bytes: 1160
N, K, *h = map(int, open(0).read().split())
cost = [0]*N
for i in range(1, N):
    s = max(0, i-K)
    cost[i] = min([tc + abs(th-h[i]) for tc, th in zip(cost[s:i], h[s:i])])

print(cost[N-1])

Measured memory_bytes: 13876
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string S;cin>>S;
  map<string, int>m = {
    {"SUN", 7},
    {"MON", 6},
    {"TUE", 5},
    {"WED", 4},
    {"THU", 3},
    {"FRI", 2},
    {"SAT", 1},
  };
  cout<<m[S]<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    if(S.equals("Sunny")){
      System.out.println("Cloudy");
    }
    else if(S.equals("Cloudy")){
      System.out.println("Rainy");
    }
    else{
      System.out.println("Sunny");
    }
  }
}

Measured memory_bytes: 19668
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: usize,
        a: [u64;n],
    }

    let mut total = 0;
    for &i in &a {
        total = total ^ i;
    }

    for &i in &a {
        println!("{}", total ^ i);
    }
}


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

#define FOR(i, n) for(int i = 0; i < (int)(n); i++)

void cin_Ignore(){cin.ignore(numeric_limits<streamsize>::max(), '\n');}

int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string input;
    
    int X;
    cin >> X;
    
    for(int i = 1, count = 0;;i++){
        count += i;
        if (count >= X){
            cout << i; 
            return 0;
        }
    }
    
    
}



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

int main() {
  int N;
  cin >> N;
  vector<char> hina(N);
  for(int i=0;i<N;i++){
   cin >> hina[i];
  }
  
  bool ok = false;
  for(int i=0;i<N;i++){
     if(hina[i]=='Y'){
     ok=true;
     }
  }
  
  if(ok){
  cout << "Four" << endl;
  }
  else{
  cout << "Three" << endl;
  }

}

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

int main() {
	int i,a,b;
	char n[16];
	for (i=0;i<9;i++) {
		cin >> n >> a >> b;
		cout << n << ' ' << a+b << ' ' << 200*a+300*b << endl;
	} 
	return 0;
}

Measured memory_bytes: 1164
readlines.each do |line|
  print_string = ''

  rep_count, rep_char_index = nil, nil
  line.chomp.each_char.with_index do |char, i|
    if char == '@'
      rep_char_index = i + 2
      next
    end

    if rep_char_index
      if i == rep_char_index
        print_string << char * rep_count
        rep_count, rep_char_index = nil, nil
      else
        rep_count = char.to_i
      end
    else
      print_string << char
    end
  end

  puts print_string
end

Measured memory_bytes: 8588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)

#define Rep(i,n) for(int i=0;i<(int)(n);++i)

#define int long long

using namespace std;

signed main()
{

int a=0,b=0;
std::cin >> a>>b;

  cout<<((b%a==0)? a+b : b-a)<<endl;
    return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
cnt = b - a + 1
if a % 2 == 0:
    if b % 2 == 1:
        if (cnt // 2) % 2 == 0:
            print(0)
        else:
            print(1)
    else:
        if ((cnt - 1) // 2) % 2 == 0:
            print(b ^ 0)
        else:
            print(b ^ 1)
else:
    if b % 2 == 1:
        if ((cnt - 1) // 2) % 2 == 0:
            print(a ^ 0)
        else:
            print(a ^ 1)
    else:
        if ((cnt - 2) // 2) % 2 == 0:
            print(b ^ a ^ 0)
        else:
            print(b ^ 1 ^ a)
#print(a ^ b)



Measured memory_bytes: 61928
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
DbgTimer D_t;
  #define TSTART() D_t.start()
  #define TSTOP() D_t.stop()
#else
  #define DUMP(i) 
  #define TSTART()
  #define TSTOP()  
#endif
 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const int EPS = 1e-9;



int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  while(cin >> s){
    TSTART();
    cout << s[0] << SZ(s)-2 << s[SZ(s)-1] << endl;
    TSTOP();
  }
  return 0;
}



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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ld long double
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD=1e9+7;
const ll inf=1e10;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define put(x) cout<<#x<<" = "<<x<<endl;

ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

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

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

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

bool isVowel(char c){
	if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u')
		return true;
	return false;
}

const int sz=1e5+10;


int main()
{
    fast;
    
    ll t;
    //~ cin>>t;
    t=1;
    while(t--){
        ll n,w;
        cin>>n>>w;
        
        ll a[n][2];
        for(int i=0;i<n;i++){
			cin>>a[i][0]>>a[i][1];
		}
		ll dp[n+1][w+1];
		memset(dp,0,sizeof dp);
		dp[0][0]=0;
		for(int i=1;i<=n;i++){
			dp[i][0]=0;
			for(int j=1;j<=w;j++){
				if(j>=a[i-1][0]){
					dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i-1][0]]+a[i-1][1]);
				}else dp[i][j]=dp[i-1][j];
			}
		}
		//~ for(int i=0;i<=n;i++){
			//~ for(int j=0;j<=w;j++){
				//~ cout<<dp[i][j]<<" ";
			//~ }
			//~ cout<<endl;
		//~ }
		cout<<dp[n][w];
	}
    return 0;
}


Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    const ll mod = 1e9 + 7;
    ll n, k;
    cin >> n >> k;
    ll ek = (k / 2) * 2;
    VL a(n), neg, pos;
    ll zero = 0;

    map<ll,ll> mpp, mpn;

    rep(i, 0, n){
        cin >> a[i];
        if(a[i] == 0) zero++;
        else if(a[i] > 0) pos.push_back(a[i]);
        else neg.push_back(a[i]);
    }

    ll pn = pos.size(), nn = neg.size();
    if(pn != 0) sort(ALL(pos), greater<ll>());
    if(nn != 0) sort(ALL(neg));

    priority_queue<ll> que;

    if(k == n){
        ll ans = 1;
        rep(i, 0, k){
            ans *= a[i];
            ans %= mod;
        }
        if(ans < 0) ans += mod;
        cout << ans << endl;
        return 0;
    }

    if(n == nn && k % 2 == 1){
        ll ans = 1;
        sort(ALL(a), greater<ll>());
        rep(i, 0, k){
            // cerr << i << ": " << a[i] << endl;
            ans *= a[i];
            ans %= mod;
        }
        cerr << "flr: " << ans << endl;
        if(ans < 0) ans += mod;
        cout << ans << endl;
        return 0;
    }

    for(ll i = 0; 2*i + 1 < pn; i++){
        if(2*(i+1) + 1 >= pn){
            if(pn % 2 != 0 || k % 2 != 1){
                que.push((pos[2*i] * pos[2*i+1]));
                mpp[(pos[2*i] * pos[2*i+1])]++;
            }
        }else{
                mpp[(pos[2*i] * pos[2*i+1])]++;
                que.push((pos[2*i] * pos[2*i+1]));
        }
    }
    for(ll i = 0; 2*i + 1 < nn; i++){
        que.push((neg[2*i] * neg[2*i+1]));
        mpn[(neg[2*i] * neg[2*i+1])]++;
    }

    ll ans = 1;
    ll cnt = 0;
    ll pused = 0;
    while(cnt < ek && !que.empty()){
        auto q = que.top();
        if(mpn[q] > 0){
            mpn[q]--;
        }else{
            mpp[q]--;
            pused += 2;
        }
        q %= mod;
        ans *= q;
        ans %= mod;
        // cerr << q << endl;
        que.pop();
        cnt += 2;
    }

    ll rem = k - cnt;
    if(rem == 0){
        cerr << "pek: " << cnt << endl;
        cout << ans << endl;
        return 0;
    }

    if(pused != pn){
        ans *= pos[pused];
        ans %= mod;
        rem--;
    }

    if(rem == 0){
        cerr << "mar: " << cnt << endl;
        cout << ans << endl;
        return 0;
    }

    if(zero > 0){
        cout << 0 << endl;
        return 0;
    }

    if(nn > 0 && nn % 2 == 1){
        cerr << "rus" << endl;
        ans *= neg[nn-1];
        ans %= mod;
    }

    cerr << "noe" << endl;

    
    if(ans < 0) ans += mod;
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 13096
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstdlib>
#include<cstring>
using namespace std;
long long ans1,ans2,i,j,n,p,c[55][55],a[105],sum=0,cnt1=0,cnt2=0;
int main()
{
	cin>>n>>p;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
		if(a[i]&1)cnt1++;
		else cnt2++;
	}
	c[0][0]=c[1][0]=c[1][1]=1;
	for(i=2;i<=n;i++)
	{
		c[i][0]=1;
		for(j=1;j<=i;j++)
		{
			c[i][j]=c[i-1][j]+c[i-1][j-1];
		}
	}
	if((sum&1)==p)
	for(i=0;i<=cnt1;i+=2)ans1+=c[cnt1][i];
	else for(i=1;i<=cnt1;i+=2)ans1+=c[cnt1][i];
	for(i=0;i<=cnt2;i++)ans2+=c[cnt2][i];
	cout<<ans1*ans2;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e10;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
const ll MAX = 300010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    bool out = 0;
    cin >> s;
    rep(i,3){
        if (s[i] == s[i+1]) out = 1;
    }
    if (out) PRINT("Bad");
    else PRINT("Good");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  int a;cin>>a;
  cout<<a+a*a+a*a*a<<endl;
  return 0;
}

Measured memory_bytes: 3644
/* -- 2406:Al dente -- */
#include	<iostream>

using namespace std;

int main(void) {
	int N, T, E, x, ans = -1;

	cin >> N >> T >> E;
	for(int i=0; i<N; i++) {
		cin >> x;
		if(ans == -1 && (T+E)%x <= E ) { ans = i+1; }
	}
	cout << ans << endl;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main() {
  uint32_t N = 0;
  std::cin >> N;
  std::vector<uint32_t> f(N + 1, 1);
  f[0] = 0;
  for (size_t n = 2; n < N + 1; n++) {
    for (size_t i = 1; i * n < N + 1; i++) ++f[i * n];
  }

  uint64_t sum = 0;
  for (size_t n = 1; n <= N; n++) {
    sum += n * f[n];
  }

  std::cout << sum << std::endl;

  return 0;
}

Measured memory_bytes: 42336
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
inline void read(int &x)
{
	x=0;
	int p=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)) {x=(x<<1)+(x<<3)+(c^'0');c=getchar();}
	x*=p;
}
int n;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	int tot=n;
	int ans=0;
	while(n)
	{
		ans+=n%10;
		n/=10;
	}
	if(tot%ans==0)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
import  fractions

def lcm(x, y):
    return (x * y) //  fractions.gcd(x, y)


def do():
    A,B,C,D =  list(map(int,input().split(" ")))
    CD = lcm(C,D)
    A1 = A- 1
    ans = (B//C + B//D - B//CD) - (A1//C + A1//D - A1//CD)
    ans = (B-A+1) - ans
    print(ans)

if __name__ == "__main__":
    do()

Measured memory_bytes: 5048
open Printf
open Scanf

let id x = x

let rec seq s t f =
  if s > t then []
  else
    let x = f s in
    x :: seq (s + 1) t f

let solve n =
  let ar = Array.init n (fun _ -> scanf "%d " id) in
  let power p = Array.fold_left (fun s x -> (p - x) * (p - x) + s) 0 ar in
  List.fold_left (fun m x -> min m @@ power x) 10000000 @@ seq 1 100 id

let () =
  scanf "%d " solve |> printf "%d\n"


Measured memory_bytes: 384
use std::io::*;

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

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

fn read_vec_char() -> Vec<char> {
    read::<String>().chars().collect()
}

fn read_mat<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_mat_char(n: usize) -> Vec<Vec<char>> {
    (0..n).map(|_| read_vec_char()).collect()
}

fn main() {
    let n = read::<usize>();
    let s = read_vec_char();
    let mut accW: Vec<usize> = Vec::with_capacity(n);
    let mut accS: Vec<usize> = Vec::with_capacity(n);
    accW.push(0);
    accS.push(0);
    for i in 1..n {
        let wn = accW[i-1] + if s[i-1] == 'W' { 1 } else { 0 };
        accW.push(wn);
        let sn = accS[i-1] + if s[n-i] == 'E' { 1 } else { 0 };
        accS.push(sn);
    }
    let mut ans = n;
    for i in 0..n {
        ans = std::cmp::min(ans,accW[i]+accS[n-i-1]);
    }
    println!("{}",ans);
}


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

int main() {
  int a,b;
  cin >> a >> b;
  if (a==1 && b==2) cout << 3;
  if (a==1 && b==3) cout << 2;
  if (a==2 && b==3) cout << 1;
  if (a==2 && b==1) cout << 3;
   if (a==3 && b==2) cout << 1;
  if (a==3 && b==1) cout << 2;
  
	return 0;
}


Measured memory_bytes: 3484
# frozen_string_literal: true

n = gets.to_i
l = gets.split.map(&:to_i).sort
cnt = 0

0.upto(n - 1) do |i|
  (i + 1).upto(n - 1) do |j|
    tmp = l[i] + l[j]
    idx = l.bsearch_index { |e| e >= tmp } || n
    cnt += idx - 1 - j
  end
end

puts cnt

Measured memory_bytes: 1788
n,m=gets.split.map(&:to_i)
 
pro=[0]*n
flag=[0]*n
count=0
penalty=0


m.times do|n|
line=gets.chomp.split.map(&:to_s)
 check=line[0].to_i
 
    
if line[1]=="AC" && pro[check-1]==0
   
count+=1
penalty+=flag[check-1]

pro[check-1]=-1
 
elsif line[1]=="WA" && pro[check-1]==0
flag[check-1]+=1

else
next
end
    
    
 
end
puts "#{count} #{penalty}"

Measured memory_bytes: 3324
import bisect

N, K = map(int, input().split())
x = list(map(int, input().split()))

index = bisect.bisect_left(x, 0)
if index < len(x):
  if x[index] != 0:
    x.insert(index, 0)
    N += 1
    K += 1
else:
  x.insert(index, 0)
  N += 1
  K += 1
  index -= 1

start_min = max(index-K+1, 0)
start_max = min(index, N-K)
min_time = 10**9
for i in range(start_min, start_max+1):
  min_time = min(min_time, x[i+K-1]-x[i]+min(abs(x[i+K-1]), abs(x[i])))
print(min_time)

Measured memory_bytes: 62576
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














string S;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S;

	map<char, int> cnt;
	fore(c, S) cnt[c]++;

	if (cnt['R'] == 2 && S[1] == 'S') cout << 1 << endl;
	else cout << cnt['R'] << endl;
}







Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  string N;
  cin >> N;
    int M= 0;
  for(int i =0;i < 3; i++){
    if(N.at(i) == '7'){
    M++;
    }
      
  }
    if(M != 0){
        cout << "Yes" << endl;
    }
        else{
            cout << "No" <<endl;
}
}

Measured memory_bytes: 3624
N = int(input())
A =[0] * N
for i in range(N):
    A[i] = int(input())

A_l = [A[0]] #左から数えた最大値
A_r = [A[N-1]] #右から数えた最大値

for i in range(1,N-1):
    A_l.append(max(A_l[i-1],A[i]))

for i in range(1,N-1):
    A_r.append(max(A_r[i-1],A[-(i+1)]))

ans =[]
ans.append(A_r[N-2])
for k in range(N-2):
    ans.append(max(A_l[k],A_r[-(k+2)]))

ans.append(A_l[N-2])

for i in range(N):
    print(ans[i])

Measured memory_bytes: 18900
#include<iostream>
#include<stdio.h>
using namespace std;

int a[100050]; 
int main(){ 
    int N;
    while(scanf("%d",&N)!=EOF){
    	int t;
    	for(int i=1;i<=N;i++){
    		cin>>t;
    		a[t]=i;
		}
		cout<<a[1];
	    for(int i=2;i<=N;i++){
	    	cout<<" "<<a[i];
		}
		cout<<endl;	
	}}

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

int main(){
    long long q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;

    
    vector<pair<double, double> > v;

    //printf("%lld\n",d/2);

    v.push_back(make_pair((double)4*q, 0.25));
    v.push_back(make_pair((double)2*h, 0.5));
    v.push_back(make_pair((double)s, 1));
    v.push_back(make_pair((double)d/2, 2));

    sort(v.begin(), v.end());

    if(n >= 2 and v[0].second != 2){
        long long ans = n*((long long)v[0].first);
        printf("%lld\n", ans);
    }
    if(n >= 2 and v[0].second == 2){
        if(n % 2 == 0){
            long long ans = d*(n/2);
            printf("%lld\n", ans);
        }
        else{
            long long ans = d*(n/2) + (long long)v[1].first;
            //printf("d/2 %lld\n", d*(n/2));
            //printf("v[1].second %f\n", v[1].second);
            //printf("%f\n", (long long)(1/v[1].second)*v[1].first);
            printf("%lld\n", ans);
        }
    }
    if(n == 1){
        if(v[0].second != 2){
            long long ans = n*((long long)v[0].first);
            printf("%lld\n", ans);
        }
        else{
            long long ans = n*((long long)v[1].first);
            printf("%lld\n", ans);
        }
    }

    return 0;

}

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


int main()
{
    int n;    
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n; i++) cin >> q[i];
    vector<int> x(n);
    for (int i = 0; i < n; i++) x[i] = i + 1;
    int k = 0, a = 0, b = 0;
    do {
        k++;
        if (a == 0 && p == x) a = k;
        if (b == 0 && q == x) b = k;
    } while (next_permutation(x.begin(), x.end()));
    cout << abs(a - b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long lint;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        --A[i];
        B[A[i]] += 1;
    }
    sort(B.begin(), B.end());
    int ans = 0;
    for (int i = 0; i < N-K; i++) {
        ans += B[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
main(){
  int a;
  int b;
  int c;
  scanf("%d %d %d",&a,&b,&c);
  if(a<=b && b<=c){
    printf("%d %d %d\n",a,b,c);
  }
  else if(a<=c && c<=b){
    printf("%d %d %d\n",a,c,b);
  }
  else if(b<=a && a<=c){
    printf("%d %d %d\n",b,a,c);
  }
  else if(b<=c && c<=a){
    printf("%d %d %d\n",b,c,a);
  }
  else if(c<=a && a<=b){
    printf("%d %d %d\n",c,a,b);
  }
  else{
    printf("%d %d %d\n",c,b,a);
  }
  return 0;
}

Measured memory_bytes: 596
/*
 * test.cpp
 *
 *  Created on: 2018/01/10
 *      Author: joi
 */




#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

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

int main(){
	int h, w;
	cin >> h >> w;
	char s[51][51];
	REP(i, h){
		cin >> s[i];
	}
	REP(i, h){
		REP(j, w){
			if(s[i][j] == '#') continue;
			int cnt = 0;
			REP(k, 8){
				int nx = i + dx[k];
				int ny = j + dy[k];
				if(s[nx][ny] == '#') cnt++;
			}
			s[i][j] = (char)((int)'0' + cnt);
		}
	}
	REP(i, h){
		cout << s[i] << endl;
	}
}


Measured memory_bytes: 256
#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;
    cin >> n;

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

    ll su=0,ans=0;
    for(int i=0;i<n;i++){
        if(i%2==0){
            if(su+a[i]>0){
                su+=a[i];
            }else{
                ans+=abs(su+a[i])+1;
                su=1;
            }
        }else{
            if(su+a[i]<0){
                su+=a[i];
            }else{
                ans+=abs(su+a[i])+1;
                su=-1;
            }
        }
    }
    ll t=ans;
    ans=0;
    su=0;
    for(int i=0;i<n;i++){
        if(i%2!=0){
            if(su+a[i]>0){
                su+=a[i];
            }else{
                ans+=abs(su+a[i])+1;
                su=1;
            }
        }else{
            if(su+a[i]<0){
                su+=a[i];
            }else{
                ans+=abs(su+a[i])+1;
                su=-1;
            }
        }
    }

    cout << min(ans,t) <<endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
int th, h, t, o;
  th = n/1000,
  h = n/100-th*10,
  t = n/10-th*100-h*10,
  o = n-th*1000-h*100-t*10;
  
  if ( h == t && th == h ) {
    cout << "Yes" << endl;
  }
  else if ( h == t && o == h ){
   cout << "Yes" << endl;
  }
  else {
 cout << "No" << endl;
}
}
  

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  map<int,int> xs;
  REP(i,N){
	int x;
	cin >> x;
	xs[x]++;
  }

  int ans = 0;
  for(auto& p: xs){
	if(p.FF > p.SS){
	  ans += p.SS;
	}
	else
	  ans += p.SS - p.FF;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4736
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner stdIn=new Scanner(System.in);
        
        int n=stdIn.nextInt();
        int []x=new int[n-1];
        int []y=new int[n];

        for(int i=0; i<x.length; i++){
            x[i]=stdIn.nextInt();
        }
        for(int i=0; i<y.length; i++){
            y[i]=0;
        }
        
        System.out.println();
        
        for(int i=0; i<n-1; i++){
            y[x[i]-1]++;
        }

        for(int i=0; i<y.length; i++){
            System.out.println(y[i]);
            
        }
    }

}

Measured memory_bytes: 62864