akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>//toINFandByd
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin >> n;
    int cntac = 0,cntwa = 0,cnttle = 0,cntre = 0;
    vector<string> v(n);
    forn(i,n){
        cin >> v[i];
    }
    int i;
    for(i=0;i<n;i++){
        if(v[i]=="AC"){
            cntac++;
        }
        else if(v[i]=="WA"){
            cntwa++;
        }
        else if(v[i]=="TLE"){
            cnttle++;
        }
        else{
            cntre++;
        }
    }
    cout << "AC" << " " << "x" << " " << cntac << endl;
    cout << "WA" << " " << "x" << " " << cntwa << endl;
    cout << "TLE" << " " << "x" << " " << cnttle << endl;
    cout << "RE" << " " << "x" << " " << cntre << endl;
}   

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 6360
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  var params = inputs.split('\n')[0].split(' ').map(Number);
  (function(a,b) {
    console.log((a*b),(a+b)*2);
  }(params[0],params[1])); 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7376
N = int(input())
l = []

for i in range(1,N):
    tmp1 = list(str(i))
    tmp2 = list(str(N-i))
    s1 = 0
    s2 = 0
    for j in range(len(tmp1)):
        s1 += int(tmp1[j])
    for j in range(len(tmp2)):
        s2 += int(tmp2[j])
    tmp3 = abs(s1+s2)
    l.append(tmp3)

ans = min(l)
print(ans)



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

def main():
    MOD = 1000000007
    n, m = map(int, input().split())
    a = set([int(input()) for _ in range(m)])

    dp = [0] * (n+1)
    dp[:2] = 1, 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i not in a:
            dp[i] += (dp[i-1] + dp[i-2]) % MOD
    print(dp[-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 13216
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <fstream>

#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) {
    if(b==0) return a;
    else return GCD(b, a%b);
}

ll LCM(ll a, ll b) {
    return a/GCD(a,b)*b;
}

class CMultiplication3 {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll a;
	    double b;
	    in>>a>>b;
	    ll b2 = llround(b*100.0);
	    string s = to_string(a*b2/100);
	    out<<s<<endl;
	}
};


int main() {
	CMultiplication3 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3192
#include <stdio.h>
 
int main(void) {
  long a, b, c, k, ans;
  if(scanf("%ld %ld %ld %ld", &a, &b, &c, &k)==1);
  if(k<=a) {
    printf("%ld", k);
  }
  else if(k<=a+b) {
    printf("%ld", a);
  }
  else {
    ans=2*a+b-k;
    printf("%ld", ans);
  }
  return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  int L;
  cin >> L;
  double a = (double)L / 3;
  cout << fixed << setprecision(10) << a * a * a << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int b1,b2,b3;
	scanf ("%d%d%d",&b1,&b2,&b3);
	if (b1==1&&b2==1||b3==1)
	printf ("Open\n");
	else
	printf ("Close\n");
	return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>

using namespace std;
int main(){
    int N;
    std::cin >> N;
    int L[2*N];
    for(int i = 0; i < 2*N; i++){
        std::cin >> L[i];
    }
    sort(L, L+2*N, greater<int>());
    int sum = 0;
    for(int i = 0; i < N; i++){
        int ind = i*2;
        sum += L[ind+1];
    }
    cout << sum << endl;
}


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

using namespace std;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
   	cin >> a[i];
  }
  sort(a.begin(), a.end());
  
  int counter = 0;
  
  for(int i = 0; i < n; i++){
   	for(int j = 0; j < i; j++){
      for(int k = 0; k < j; k++){
        if(a[i] == a[j]) continue;
        if(a[i] == a[k]) continue;
        if(a[j] == a[k]) continue;
        
        if(a[k] + a[j] > a[i]){
          counter++;
        }
      }
    }
  }
  
  cout << counter;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
void solve2(){
	string t,s;
	cin >> t >> s;
	int ans = 0;
	for(int i=0;i<t.size();i++){
		ans += t[i] != s[i];
	}
	cout << ans;
}
int main(){
	solve2();
	return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

ll w,h,v,t,x,y,p,q;

inline ll xget(ll i){
	ll res=p;
	if(i&1){
		res+=2*(w-p);
		res+=w*(i-1);
	}else{
		res+=w*i;
	}
	return res;
}

inline ll yget(ll i){
	ll res=q;
	if(i&1){
		res+=2*(h-q);
		res+=h*(i-1);
	}else{
		res+=h*i;
	}
	return res;
}


int main(void){
	cin >> w >> h >> v >> t >> x >> y >> p >> q;
	ll ans=0;
	ll d=(v*t)*(v*t);
	int dmax=(v*t)/w+10;
	for(int i=-dmax;i<=dmax;++i){
		ll xcur=xget(i)-x;
		ll ycursq=d-xcur*xcur;
		if(ycursq<0) continue;
		ll ylimit=sqrt(ycursq)/h;
		ll l=-1,r=ylimit+10;
		while(r-l>1){
			ll m=(r+l)/2;
			ll ycur=yget(m)-y;
			if(ycur*ycur<=ycursq)
				l=m;
			else
				r=m;
		}
		ll upper=l;
		l=-ylimit-10,r=1;
		while(r-l>1){
			ll m=(r+l)/2;
			ll ycur=yget(m)-y;
			if(ycur*ycur<=ycursq)
				r=m;
			else
				l=m;
		}
		ll lower=r;
		ll cur=0;
		if(lower<=0) cur-=lower;
		if(0<=upper) cur+=upper;
		if(lower<=upper) cur++;
		ans+=cur;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1160
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N, K, Q;
int S[100010];

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

	int q;
	cin >> N >> K >> Q;
	rep(i, 0, Q)
	{
		cin >> q;
		q--;
		S[q]++;
	}

	rep(i, 0, N)
	{
		S[i] += K - Q;
		if (S[i] > 0)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int row[]= {1,0,-1,0,1,-1,1,-1};
int colm[]= {0,1,0,-1,1,-1,-1,1};
int mat[2000][2000];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll n,m;
    cin>>n>>m;
   /* for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
            mat[i][j]=1;
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            for(int k=0; k<8; k++)
            {
                int u=i+row[k];
                int v=j+colm[k];
                if(0<=u && u<n && 0<=v && v<m)
                {
                    mat[i][j]^=1;
                }
            }
            mat[i][j]^=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
*/
    ll x=min(n,m);
    ll y=max(n,m);
    if(x==1 && y==1)
        cout<<"1"<<endl;
    else if(x==1)
    {
        cout<<max(0ll,y-2)<<endl;
    }
    else if(x==2){
        cout<<"0"<<endl;
    }
    else{
        cout<<(x-2)*(y-2)<<endl;
    }

    return 0;
}


Measured memory_bytes: 3600
N = int(input())
T = []
X = []
Y = []

for i in range(N):
  t,x,y = map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
  
judge = 1 # 1:可,0:不可
nx,ny = 0,0
for i in range(N):
  if(i == 0):
    t = T[i]
  else:
    t = T[i] - T[i-1]
    
  distance = abs(X[i]-nx) + abs(Y[i]-ny)
  time = 1*distance
  if(t < time):
    judge = 0
    break
  if((t - time)%2 != 0): #自分のマスに2秒で帰ってこれるので
    judge = 0
    break
  nx,ny = X[i],Y[i]
  
if(judge == 1):
  print('Yes')
else:
  print('No')
    

Measured memory_bytes: 11800
// B.

#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char *argv[]) {
	string s, ans;
	cin >> s;
	for (int i = 0; i < (int)s.length(); i += 2) {
		ans += s[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define m(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int MAXN=1e5+100;
const ll INF=1ll<<29;
int n,m,r[MAXN],cnt[MAXN];
int main(){
	scanf("%d%d",&n,&m);
	int ans=0;
	for(int i=1;i<=n;i++) cnt[i]=1;
	m(r,0);
	r[1]=1;
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		if (r[x]) r[y]=1;
		cnt[x]--;
		cnt[y]++;
		if (!cnt[x]) r[x]=0;
	}
	for(int i=1;i<=n;i++)
		if (r[i])
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
from itertools import accumulate
n, a, b = map(int, input().split())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
acc = list(accumulate(lst))
ansV = 0
ansList = []
for i in range(a, b + 1):
    value = acc[i - 1] / i
    if value > ansV:
        ansV = value
        ansList = [lst[:i]]
    elif value == ansV:
        ansList.append(lst[:i])

def score(l):
    c1 = l.count(l[-1])
    c2 = lst.count(l[-1])
    return comb(c2, c1)

def comb(x, y):
    return fact(x) // fact(x - y) // fact(y)

mem = {0:1}
def fact(x):
    if x in mem:
        return mem[x]
    mem[x] = x * fact(x - 1)
    return mem[x]

print(ansV)
print(sum(map(score, ansList)))

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

int main(void){
  int A, B, max;
  int x[3];
  cin >> A >> B;
  x[0] = A + A - 1;
  x[1] = A + B;
  x[2] = B + B - 1;
  max = x[0];
  if(x[0] < x[1])
    max = x[1];
  if(x[1] < x[2])
    max = x[2];
  cout << max << "\n";
  return 0;
}


Measured memory_bytes: 3628
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
d,t,s = ma()
if t*s>=d:
    f=True
else:f=False
yn(f)


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  if (A == B && B == C && A % 2 == 0) {
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
    ans++;
    ll AA = A / 2;
    ll BB = B / 2;
    ll CC = C / 2;
    A = BB + CC;
    B = AA + CC;
    C = AA + BB;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
const int maxn=100005;
long long dlt[maxn];
long long dlt2[maxn];
int a[maxn];
void add1(int l,int r,int x){//printf("%d %d %d\n",l,r,x);
  if(l<=r){
    dlt[l]+=x;dlt[r+1]-=x;
  }
}
void add3(int l,int r,int d){
  dlt2[l]+=d;dlt[r+1]-=(r-l+1)*d;dlt2[r+1]-=d;
}
void add2(int l,int r,int a0,int d){//printf("2:%d %d %d %d\n",l,r,a0,d);
  if(l<=r){
    add1(l,r,a0);
    add3(l+1,r,d);
  }
}
int main(){
  int n,m;scanf("%d%d",&n,&m);
  for(int i=1;i<=n;++i)scanf("%d",a+i);
  for(int i=2;i<=n;++i){
    if(a[i-1]<a[i]){
      add1(a[i]+1,m,a[i]-a[i-1]);
      add1(1,a[i-1],a[i]-a[i-1]);
      add2(a[i-1]+1,a[i],a[i]-a[i-1],-1);
    }else{
      add1(a[i]+1,a[i-1],a[i]+m-a[i-1]);
      add2(a[i-1]+1,m,a[i]+m-a[i-1],-1);
      add2(1,a[i],a[i],-1);
    }
  }
  for(int i=1;i<=m;++i)dlt2[i]+=dlt2[i-1];
  for(int i=1;i<=m;++i)dlt[i]+=dlt2[i];
  for(int i=1;i<=m;++i)dlt[i]+=dlt[i-1];
  long long ans=1ll<<60;
  for(int i=1;i<=m;++i)if(dlt[i]<ans)ans=dlt[i];
  //  for(int i=1;i<=m;++i)printf("%lld ",dlt[i]);printf("\n");
  printf("%lld\n",ans);
  return 0;
}


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

using namespace std;

int main() {
    int n = 0;
    int m = 0;
    int day = -1;
    cin >> n >> m;
    int a = 0;
    int counter = 0;

    for(int i = 0 ; i < m ; i ++){
        cin >> a;
        counter += a;
    }

    if(counter <= n){
        day = n - counter;
    }
    
    
    cout << day << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>
#include<iostream>
#include"string"
#include"math.h"
#include <algorithm>
#include<vector>
using namespace std;
bool m;
void m_sort(int a[], int tmp[], int left, int right);
void m_sort(int a[], int tmp[], int left, int right);
void sort(int a[], int total) {
	int tmp;
	for (int i = 0; i < total; i++) {
		for (int j = i + 1; j < total; j++) {
			if (a[i] < a[j]) {
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
 
}
 
void mergeSort(int a[], int tmp[], int size)
{
	m_sort(a, tmp, 0, size - 1);
}
void merge(int a[], int tmp[], int left, int mid, int right)
{
	int i, left_end, num_elements, tmp_pos;
 
	left_end = mid - 1;
	tmp_pos = left;
	num_elements = right - left + 1; // 要素 
 
	while ((left <= left_end) && (mid <= right))
	{
		if (a[left] <= a[mid])
		{
			tmp[tmp_pos] = a[left];
			tmp_pos = tmp_pos + 1;
			left = left + 1;
		}
		else
		{
			tmp[tmp_pos] = a[mid];
			tmp_pos = tmp_pos + 1;
			mid = mid + 1;
		}
	}
 
 
	while (left <= left_end)
	{
		tmp[tmp_pos] = a[left];
		left = left + 1;
		tmp_pos = tmp_pos + 1;
	}
 
	while (mid <= right)
	{
		tmp[tmp_pos] = a[mid];
		mid = mid + 1;
		tmp_pos = tmp_pos + 1;
	}
 
 
	for (i = 0; i <= num_elements; i++)
	{
		a[right] = tmp[right];
		right = right - 1;
	}
}
void m_sort(int a[], int tmp[], int left, int right)
{
	int mid;
 
	if (right > left)
	{
		mid = (right + left) / 2; 
		m_sort(a, tmp, left, mid);
		m_sort(a, tmp, mid + 1, right);
 
		merge(a, tmp, left, mid + 1, right);
	}
}

int abs(int a){
	if(a<0)return -a;
	return a;
}


int N,M,re,x,y,cost[51][51],a[100001],key[100001];
bool map[51][51];
int ans,C[501],S[501],F[501],ti[501],blank;
char s[51][51];

void start(){
	for(int i = 0;i <= N;i++){
		key[i] = i;
	}

}
int root(int i){
	if(key[i]==i)return i;
	else
		return key[i]=root(key[i]);
	
}

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

void unit(int x,int y){
	x=root(x);
	y=root(y);
	if(x==y)return;

	key[max(x,y)]=min(x,y);
}

int main(){
	cin>>N>>M;
	for(int i=1;i<=N;i++){
		cin>>a[i];
	}
	start();
	for(int i=0;i<M;i++){
		cin>>x>>y;
		unit(x,y);
	}
	ans=0;
	for(int i=1;i<=N;i++){
		if(same(a[i],i)){
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
a = gets.chomp
n = gets.to_i
isReverse = false
l = ""
r = ""

n.times do |i|
    arr = gets.chomp.split(" ")
    if arr[0]=="1" 
        isReverse = !isReverse
        next
    else
        if (arr[1]=="1" && !isReverse)||(arr[1]=="2" && isReverse)
            l << arr[2]
            next
        else
            r << arr[2]
            next
        end
    end
end

ans = l.reverse + a + r

ans.reverse! if isReverse

puts ans

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

string lower(string x){
string y = x;
for(int i = 0; i <= x.size(); i++){ y[i] = tolower(x[i]);}
return y;
}


int main(){
	int n;
	string a, b;
	cin >> a;
	a = lower(a);
	while(cin >> b){ if(b == "END_OF_TEXT"){break;} b = lower(b); if(a == b){n++;} }
	cout << n << endl;

return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n;
vpii pl;
vi el;
double ans[100];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  int mi_x, ma_y = -iinf, s;
  FOR(i, 0, n){
    int x, y;
    cin >> x >> y;
    pl.pb(pii(x, y));
    if(y > ma_y || y == ma_y && x < mi_x){
      s = i;
      mi_x = x;
      ma_y = y;
    }
  }
  int p = s;
  double pr = -5.0;
  while(true){
    el.pb(p);
    int idx;
    double cpr = 5.0;
    FOR(i, 0, n){
      if(i == p) continue;
      complex<float> c(pl[i].fi - pl[p].fi, pl[i].se - pl[p].se);
      double ar = arg(c);
      if(ar >= pr && ar <= cpr){
        cpr = ar;
        idx = i;
      }
    }
    pr = cpr;
    p = idx;
    if(p == s) break;
  }
  FOR(i, 0, sz(el)){
    complex<float> v1, v2;
    int j, k;
    j = el[i];
    k = el[(i + 1) % sz(el)];
    v1 = complex<float>(pl[k].fi - pl[j].fi, pl[k].se - pl[j].se);
    j = k;
    k = el[(i + 2) % sz(el)];
    v2 = complex<float>(pl[k].fi - pl[j].fi, pl[k].se - pl[j].se);
    double a = arg(v2) - arg(v1);
    if(a < 0.0) a += pi * 2;
    ans[j] = a / pi / 2;
  }
  FOR(i, 0, n) dout(ans[i]);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
ll MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    ll ans = 1;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<vector<int>> dp(N+1, vector<int>(3, 0));
    rep(i, N) {
        ll cnt  = 0;
        int fst = 99;
        if (dp[i][0] == A[i]) {
            cnt++;
            fst = min(fst, 0);
        }
        if (dp[i][1] == A[i]) {
            cnt++;
            fst = min(fst, 1);
        }
        if (dp[i][2] == A[i]) {
            cnt++;
            fst = min(fst, 2);
        }

        if (cnt == 0) {
            cout << 0 << endl;
            return 0;
        }
        ans *= cnt;
        ans %= MOD;
        dp[i + 1][0] = dp[i][0];
        dp[i + 1][1] = dp[i][1];
        dp[i + 1][2] = dp[i][2];
        dp[i + 1][fst]++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 6144
class Tuple():
    def __init__(self, v, w, t, d, s):
        self.v = v
        self.w = w
        self.t = t
        self.d = d
        self.s = s

def main():
    n = int(input())
    Tuples = list()

    for _ in range(n):
        v, w, t, d, s = input().split()
        p = Tuple(int(v), int(w), t, int(d), s)
        Tuples.append(p)

    Tuples.sort(key=lambda x : x.s)
    Tuples.sort(key=lambda x : x.d)
    Tuples.sort(key=lambda x : x.t)
    Tuples.sort(key=lambda x : x.w)
    Tuples.sort(key=lambda x : x.v)

    for t in Tuples:
        print(str(t.v) + " " + str(t.w) + " " + t.t + " " + str(t.d) + " " + t.s )
        
main()



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

bool is_integer(double x){
	return floor(x) == x;
}


int main(){
	int n,d;
	cin >> n >> d;
	vector<vector<int>> x(n,vector<int>(d));
	for (int i = 0; i < n; i++){
		for (int j = 0; j < d; j++){
			cin >> x[i][j];
		}
	}
	int ans = 0;
	for (int i = 0; i < n-1; i++){
		for (int j = i+1; j < n; j++){
			int dis = 0;
			for (int k = 0; k < d; k++)
				dis += pow((x[i][k]-x[j][k]),2);
			double dis2 = sqrt(dis);
			if (is_integer(dis2))
				ans += 1;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
  int A[44]={},a,i;
  A[0]=1;
  A[1]=1;
  scanf("%d",&a);
  for(i=2;i<=a;i++){
    A[i]+=(A[i-1]+A[i-2]);
  }
  printf("%d\n",A[a]);
}


Measured memory_bytes: 2756
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i < (b + a); i++)
#define W1 while (1)
#define COUT(x) cout << x << endl
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define mod 1000000007
#define PB push_back
#define F first
#define S second

int main() {
  int n;
  int ans = 0;
  cin >> n;
  vector<char> c(n);
  rep(i, n) {
    cin >> c[i];
  }
  int left = 0;
  int right = n - 1;
  while (left < right) {
    if ((c[left] == 'W') && (c[right] == 'R')) {
      ans++;
      left++;
      right--;
    } else {
      if (c[left] == 'R') left++;
      if (c[right] == 'W') right--;
    }
  }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define maxn 100010
typedef long long LL;
using namespace std;
const LL mod = 998244353;
LL x[maxn], y[maxn], P[maxn];
int fa[maxn], sz[maxn];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void unionn(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return;
    if (sz[x] > sz[y]) swap(x, y);
    fa[x] = y; sz[y] += sz[x];
}
struct node { int p, q; LL dx, dy; };
bool cmp(node u, node v) { return u.dx < v.dx || (u.dx == v.dx && u.dy < v.dy); }
vector<node> seg;
LL GCD(LL x, LL y) { return y ? GCD(y, x % y) : x; }
int main() {
    LL n;
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i) scanf("%lld%lld", &x[i], &y[i]);
    P[0] = 1;
    for (int i = 1; i <= n; ++i) (P[i] = P[i-1] << 1) %= mod;

    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            LL dx = x[i]-x[j], dy = y[i]-y[j];
            LL gcd = GCD(dx, dy);
            dx /= gcd, dy /= gcd;
            if (dx < 0) dx = -dx, dy = -dy;
            seg.push_back(node{i, j, dx, dy});
        }
    }
    sort(seg.begin(), seg.end(), cmp);

    LL ans = P[n] - 1 - n;
    int i = 0, j = 0;
    for (; i < seg.size(); i = j+1) {
        for (int k = 0; k < n; ++k) fa[k] = k, sz[k] = 1;
        for (j = i; ; ++j) {
            unionn(seg[j].p, seg[j].q);
            if (j+1 >= seg.size() || seg[i].dx != seg[j+1].dx || seg[i].dy != seg[j+1].dy) break;
        }
        for (int k = 0; k < n; ++k) {
            if (fa[k] == k) ((ans -= (P[sz[k]] - sz[k] - 1)) += mod) %= mod;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1148
N, M = map(int, input().split())
ab = tuple(tuple(a for a in map(int, input().split())) for _ in range(N))
cd = tuple(tuple(a for a in map(int, input().split())) for _ in range(M))
for i in range(N):
	ckp = 1
	dist_min = 10**9
	for j in range(M):
		dist = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
		if dist < dist_min:
			dist_min = dist
			ckp = j + 1
	print(ckp)

Measured memory_bytes: 67704
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();

		List<Integer> list = new ArrayList<>();

		for (int i = 1; i <= Math.min(A, B); i++) {
			if (A % i == 0 && B % i == 0) {
				list.add(i);
			}
		}
		System.out.println(list.get(list.size() - K));
	}
}

Measured memory_bytes: 22740
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

int a,b;

int main(){
	scanf("%d%d",&a,&b);
	if(a<=0&&b>=0)
		puts("Zero");
	else if(b<0&&(b-a)%2==0)
		puts("Negative");
	else
		puts("Positive");
	return 0;
}

Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

prise = A*X + B*Y
x = X
y = Y
anset = set()
anset.add(prise)
while max(x, y)>0:
    if x > 0:
        prise -= A
    if y > 0:
        prise -= B
    prise += C * 2
    anset.add(prise)

    x -= 1
    y -= 1

print(min(anset))

Measured memory_bytes: 11884
#!/usr/bin/env python3

def main():
    n, k, q = map(int, input().split())
    a = []
    for i in range(q):
        a.append(int(input()))
    acs = [0 for j in range(n)]
    for j in a:
        acs[j - 1] += 1
    for x in acs:
        print("Yes" if k - q + x > 0 else "No")

if __name__ == "__main__":
    main()


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

int main() {
  string s1, s2;
  cin >> s1 >> s2;
  if(s1.at(0) == s2.at(2) && s1.at(1) == s2.at(1) && s1.at(2) == s2.at(0)){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
s = list(input())
len_str = len(s)
flag_check = 0
for start_i in range(len_str):
  if start_i < len_str - 1:
    if s[start_i] == s[start_i + 1]:
      flag_check = 1
      break
  if start_i < len_str - 2:
    if s[start_i] == s[start_i + 2]:
      flag_check = 2
      break
if flag_check == 0:
  print("-1 -1")
elif flag_check == 1:
  print("{} {}".format(start_i + 1, start_i + 2))
else:
  print("{} {}".format(start_i + 1, start_i + 3))


Measured memory_bytes: 3956
import java.util.*;
public class Main {
    public static void main(String[] args ){
        Scanner sc = new Scanner(System.in);
        int n  = sc.nextInt();
        long ans = 0;
        for(int i = 1;i<=n;i++){
            for(int j = 1;j<=n/i;j++)ans+=i*j;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35896
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int f(int i){
  int res=0;
  while(i>0){
    res += i % 10;
    i /= 10;
  }
  return res;
}

int main()
{
  int n,a,b; cin >> n >> a >> b;
  int ans = 0;
  rep2(i,n){
    int sum = f(i);
    if(a <= sum && sum <= b) ans += i;
  }
  
  cout << ans << endl;
}

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

#define DRACARYS ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define PI 3.14159265
const long long int MAXN = 2e5+10;
const long long int MINN = 1e5+10;
const long long int inf = 1e9+7;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi; 
typedef stack<int> st;

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    DRACARYS
    long long int n,x;
    cin>>n>>x;
    long long int a[n],dp[n][x+1];
    for(int i=0;i<n;++i) for(int j=0;j<=x;++j) dp[i][j]=0;
    for(int i=0;i<n;++i) cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<=x;++i) dp[0][i]=i%a[0];
    for(int i=1;i<n;++i) for(int j=1;j<=x;++j){
        dp[i][j]=dp[i-1][j%a[i]]+dp[i-1][j]*i;
        dp[i][j]%=inf;
    }
    /*for(int i=0;i<n;++i){
        for(int j=0;j<=x;++j) cout<<dp[i][j]<<" ";
        cout<<endl;
    }*/
    cout<<dp[n-1][x]<<endl;
    return 0;
}

Measured memory_bytes: 156544
#include<bits/stdc++.h>
 
using namespace std;
#define MOD 1000000007

string S[1010];
int dp[1010][1010];
 int m,n;
int call(int x, int y)
{
    if(y>n) return 0;
    if(x>m) return 0;
    if(x==m && y==n) return 1;
    if(dp[x][y]!=-1)
        return dp[x][y];
    dp[x][y]=0;
    if(S[x+1][y-1]=='.')
        dp[x][y]+=call(x+1,y);
    
    dp[x][y]=dp[x][y]%MOD;
    
    if(S[x][y]=='.')
        dp[x][y]+=call(x,y+1);
        
    dp[x][y]=dp[x][y]%MOD;
    
    return dp[x][y];
    
}
int main()
{
   cin>>m>>n;
   memset(dp,-1,sizeof(dp));
    for(int i=1;i<=m;i++)
    {
        cin>>S[i];
    }
    if(S[1][0]=='#' || S[m][n-1]=='#')
    {
        cout<<0;
        return 0;
    }
    dp[m][n]=1;
    cout<<call(1,1);    
}

Measured memory_bytes: 5376
use proconio::input;
use std::collections::{HashMap, VecDeque};

fn main() {
    input! {
        n: usize,
        ab: [(usize, usize); n-1],
        mut cc: [usize; n],
    }

    let mut map = HashMap::new();

    for &(a, b) in ab.iter() {
        map.entry(a).or_insert_with(|| vec![]).push(b);
        map.entry(b).or_insert_with(|| vec![]).push(a);
    }

    cc.sort();
    let score = cc.iter().take(cc.len()-1).sum::<usize>();

    let mut nums = vec![None; n];

    let mut queue = VecDeque::new();
    queue.push_back(1);

    while let Some(vert) = queue.pop_front() {
        if nums[vert - 1].is_some() {
            continue;
        }
        let c = cc.pop().unwrap();
        nums[vert - 1] = Some(c);
        for &e in &map[&vert] {
            queue.push_back(e);
        }
    }

    let dd = nums
        .into_iter()
        .map(|d| d.unwrap().to_string())
        .collect::<Vec<_>>()
        .join(" ");

    println!("{}", score);
    println!("{}", dd);
}


Measured memory_bytes: 4140
#include <bits/stdc++.h>
#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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < n; i++)
#define SORT(a) sort(a.begin(), a.end()) //reverse()で反転
#define lower(a, n) lower_bound(a.begin(), a.end(), n);
#define upper(a, n) upper_bount(a.begin(), a.end(), n);
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int sum(int a){
  if(a == 0) return 0;
  return sum(a - 1) + a;
}
int main(){
  string s;
  cin >> s;
  if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
N = int(input())
num_list = []
for i in range(N):
    num_list.append(list(map(int,input().split())))

for j in range(N-2):
    if num_list[j][0] == num_list[j][1] and num_list[j+1][0] == num_list[j+1][1] and num_list[j+2][0] == num_list[j+2][1]:
        print ("Yes")
        break
    elif j != N-3 and (num_list[j][0] != num_list[j][1] or num_list[j+1][0] != num_list[j+1][1] or num_list[j+2][0] != num_list[j+2][1]):
        continue
    else:
        print("No")



Measured memory_bytes: 9204
#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    int P, Q, R;
    cin >> P;
    cin >> Q;
    cin >> R;
    
    int ans;
    ans = min(P + Q, Q + R);
    ans = min(ans, R + P);
    
    cout << ans << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,k;
  cin>>n>>k;
  vector<long long>h(n);
  for(long long i=0;i<n;i++)cin>>h[i];
  vector<long long>dp(n,INT_MAX);
  dp[0] = 0;
  for(long long i=0;i<n;i++){
    for(long long j=i+1;j<=i+k;j++){
      if(j<n){
        dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
      }
    }
  }
  cout<<dp[n-1];
}


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

int main()
{
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++)
  {
    if (s == t)
    {
      cout << "Yes" << endl;
      return 0;
    }
    string c = s.substr(s.length() - 1, 1);
    s.erase(s.length() - 1, 1);
    s = c + s;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int cnt[26];

int main()
{
	memset(cnt, 0, sizeof(cnt));
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string w; cin >> w;

	rep (i, w.length()){
		++cnt[(int)(w[i] - 'a')];
	} // end rep

	bool ok = true;
	rep (i, 26){
		if (cnt[i] % 2 != 0) ok = false;
	} // end rep
	
	cout << (ok ? "Yes" : "No") << endl;

	return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int 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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n;cin >> n;
  string s;cin >> s;
  int ans=0;
  rep(i,n-2){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
  }
  cout << ans << endl;

}


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

int main() {
	// your code goes here
long double n,i;
long int find;
long double f;
cin>>n;
for(i=n;i>0;i--)
{
    f=sqrt(i);
    if((floor(f)-f)==0)
    {
        find=i;
        break;
    }
}
cout<<find;

	return 0;
}

Measured memory_bytes: 256
M, D = map(int, input().split())

def f(m, d):
  d1, d10 = d % 10, d // 10
  return d1 >= 2 and d10 >= 2 and d1 * d10 == m

count = 0
for i in range(1, M+1):
  for j in range(1, D + 1):
    count += 1 if f(i, j) else 0

print(count)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int w = sc.nextInt();
		if(s <=w) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}



	}
}

Measured memory_bytes: 27088
import java.util.*;

class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int X = sc.nextInt();
   int A = sc.nextInt();
   
   if(X<A){
     System.out.println(0);
   }else{
     System.out.println(10);
   }
 }
}


Measured memory_bytes: 21716
X = int(input())
K = int(input())
rs = list(map(int,input().split()))
Q = int(input())
qs = [tuple(map(int,input().split())) for i in range(Q)]

dx = -1
ri = 0
offset = 0
upper,lower = X,0
prev_r = 0
ans = []
for t,a in qs:
    while ri < len(rs) and rs[ri] <= t:
        tmp_offset = dx * (rs[ri] - prev_r)
        if dx == 1:
            upper = min(X, upper + tmp_offset)
            lower = min(X, lower + tmp_offset)
        else:
            upper = max(0, upper + tmp_offset)
            lower = max(0, lower + tmp_offset)
        offset += tmp_offset
        dx *= -1
        prev_r = rs[ri]
        ri += 1
    a = max(lower, min(upper, a+offset))
    dt = t - prev_r
    a = max(0, min(X, a + dx*dt))
    ans.append(a)

print(*ans, sep='\n')

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

int main() {
    int n;
    cin>>n;
    long long A[n];
    for(int i = 0; i < n; i++){
        cin>>A[i];
    }
    long long ans = 0, s = 0;
    for(int i = 1; i < n; i++){
        if(A[i] <= A[i-1])s++;
        else s= 0;
        ans = max(ans, s);
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 1024
class monster:
    stamina = 0
    attack= 0
    def __init__(self,stamina,attack):
        self.stamina = stamina
        self.attack = attack


abcd = input().split()
abcd=[int(x) for x in abcd]
a = abcd[0]
b = abcd[1]
c = abcd[2]
d = abcd[3]



taka = monster(a,b)
aoki = monster(c,d)

while(1):
    # print(taka.stamina,aoki.stamina)
    aoki.stamina = aoki.stamina-taka.attack
    if aoki.stamina<=0:
        print('Yes')
        break
    taka.stamina = taka.stamina-aoki.attack
    if taka.stamina<=0 :
        print('No')
        break

Measured memory_bytes: 9080
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector<int> A[2];
	map<int, pair<int, int> > M;
	for(int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A[i%2].push_back(a);
		M[a] = {0, 0};
	}
	for(int i = 0; i < (int)A[0].size(); i++) M[A[0][i]].ff++;
	for(int i = 0; i < (int)A[1].size(); i++) M[A[1][i]].ss++;
	multiset<int> S;
	ALL_THE(M, it) S.insert(it->ss.ss);
	int ans = N;
	if((int)M.size() == 1) {
		cout << min(M[A[0][0]].ff, M[A[0][0]].ss) << "\n";
		return 0;
	}
	ALL_THE(M, it) {
		S.erase(S.find(it->ss.ss));
		ans = min(ans, N-it->ss.ff-*S.rbegin());
		S.insert(it->ss.ss);
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


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

int main() {
    int n, k;
    cin >> n >> k;
    int d[k];
    rep(i, k) cin >> d[i];

    for (int i = n; i < 100000; i++) {
        int x = i;
        bool ok = true;
        while (x > 0) {
            rep(j, k) if (x % 10 == d[j]) ok = false;
            x /= 10;
        }
        if (ok) {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3564
/*input
5 1
1 999999997 999999998 999999999 1000000000
*/
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 2e5 + 100, oo = 1ll << 60;
int v[MX];
int check(int val, int n, int x) {
    int ans = 0, k = 0, d = 1;
    for(int i = n; i >= 1; i --) {
        k ++;
        if(d == 1) ans += v[i] * 5 + x;
        else       ans += v[i] * ((d + 1) * (d + 1) - d * d);
        if(k == val) k = 0, d ++;
    }
    return ans;
}
main () {
    int n, x; cin >> n >> x;
    for(int i = 1; i <= n; i ++) cin >> v[i];
    int l = 1, r = n;
    while(l + 3 < r) {
        int d = (r - l) / 3;
        int m1 = l + d * 1;
        int m2 = l + d * 2;
        if(check(m1, n, x) <= check(m2, n, x)) r = m2;
        else                                   l = m1;
    }
    //cout << l << ' ' << r << endl;
    cout << min({check(l, n, x), check(l + 1, n, x), check(l + 2, n, x), check(l + 3, n, x)}) + n * x;
}

Measured memory_bytes: 1792
import re

a, b = map(int, input().split())
s = input()

def is_num(s, n):
    return len(s) == n and (re.match(r"[0-9]+", s) is not None)

if is_num(s[:a], a) and s[a] == "-" and  is_num(s[a+1:], b):
    print("Yes")
else:
    print("No")

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

namespace ABC109C2_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var nx = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nx[0];
            int x = nx[1];
            var cityPos = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var a = new SkipCity(n, x, cityPos);
            Console.WriteLine(a.CalculateD());
        }
    }
    public class NumberFunc
    {
        public static int Gcd(int a, int b)
        {
            return (a < b) ? Gcd(b, a)
                : (b > 0) ? Gcd(b, a % b)
                : a;
        }

        public static long Lcm(int a, int b)
        {
            return a / Gcd(a, b) * b;
        }
    }
    public class SkipCity
    {
        private readonly int n;
        private readonly int x;
        private readonly int[] cityPos;

        public SkipCity(int v1, int v2, int[] v3)
        {
            this.n = v1;
            this.x = v2;
            this.cityPos = v3;
        }

        public long CalculateD()
        {
            
            return cityPos.Select(tmp=>Math.Abs(tmp-this.x)).Aggregate((n, next) => NumberFunc.Gcd(n, next));
        }
    }
}


Measured memory_bytes: 19680
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int sum[N];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		int l,r;
		scanf("%d%d",&l,&r);
		sum[l]++; sum[r+1]--; l--;
		for(int j=1,nxt;j<=l;j=nxt+1){
			nxt=min(l/(l/j),r/(r/j));
			if(l/j<r/j) sum[j]++,sum[nxt+1]--;
		}
	}
	for(int i=1;i<=m;++i){
		sum[i]+=sum[i-1];
		printf("%d\n",sum[i]);
	}
	return 0;
}

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

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

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

  int x, y;
  cin >> x >> y;

  if (x % y == 0) {
    cout << -1 << endl;
  } else {
    cout << x << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
        int x,y;
        int a[13];
        a[1]=0;
        a[2]=2;
        a[3]=0;
        a[4]=1;
        a[5]=0;
        a[6]=1;
        a[7]=0;
        a[8]=0;
        a[9]=1;
        a[10]=0;
        a[11]=1;
        a[12]=0;

        std::cin>>x>>y;

        if( a[x] == a[y] ){
                std::cout<<"Yes"<<std::endl;
        }else{
                std::cout<<"No"<<std::endl;
        }

        return 0;
}     

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N, long long K, std::vector<long long> h){
    sort(ALL(h));
    LL ans = INFL;
    REP(i, N){
        if(N < i+K) break;
        ans = min(ans, h[i+K-1] - h[i]);
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main
{
  	char c;
  
    Main(Scanner in, PrintWriter out)
    {
      c = in.next().charAt(0);
      if (c == 'A') out.print('T');
      if (c == 'T') out.print('A');
      if (c == 'G') out.print('C');
      if (c == 'C') out.print('G');
    }
	
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		new	Main(in, out);
		out.close();
	} 
}

Measured memory_bytes: 21204