akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,w;
    cin>>n>>w;

    vector<vector<ll>> dp(n+1,vector<ll>(w+1,0));
    vector<ll> weight(n),value(n);

    REP(i,n) cin>>weight[i]>>value[i];
    
    REP(i,n) REP(j,w+1){
        if(j>=weight[i]) chmax(dp[i+1][j],dp[i][j-weight[i]]+value[i]);
        chmax(dp[i+1][j],dp[i][j]);
    }
    
    cout<<dp[n][w]<<endl;
}


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

long long item_weight[110], item_value[110];
long long dp[110][100010];

int main() {
  int N, W; cin >> N >> W;
  for (int i = 1; i <= N; i++) {
    cin >> item_weight[i] >> item_value[i];
  }
  for (int i = 0; i < 110; i++) for (int j = 0; j < 100010; j++) dp[i][j] = 0;

  for (int i = 0; i <= N; i++) {
    for (int w = 0; w <= W; w++) {
      if (0 <= w - item_weight[i+1]) {
        dp[i+1][w] = max(dp[i+1][w], dp[i][w - item_weight[i+1]] + item_value[i+1]);
      }
      dp[i+1][w] = max(dp[i+1][w], dp[i][w]);
    }
  }

  cout << dp[N][W] << endl;
  return 0;
}

Measured memory_bytes: 86144
//    ŦĦ€Ř€'Ş ŇØŦĦƗŇǤ ĦØŁĐƗ'Ň Μ€ βΔĆҜ ΔŁŴΔ¥Ş ΔŇĐ ₣ØŘ€V€Ř 😈🤩😇😈💪🤜👊🤛🤟😉🤩:

#include<bits/stdc++.h>

#define mod 1000003
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define vs vector<string>
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define B(a) a.begin()
#define E(a) a.end()
#define For(i,a,b) for(ll i=a;i<b;i++)
#define F first
#define S second
#define M_P make_pair
#define P_B push_back
#define endd "\n"

using namespace std;

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

 string s;cin>>s;
 int l=s.length();

 if(s[l-1]=='s')
    {
        s=s+"es";

        cout<<s;
    }

 else
    cout<<s+'s'<<endd;








    return 0;
}


Measured memory_bytes: 3664
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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

if (a%3==0 or b%3==0 or (a+b)%3==0):
    print("Possible")
else:
    print("Impossible")






Measured memory_bytes: 8980
#include <bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
using namespace std;
const int N=1e6+5;
int main() {
	int n;
	sf1(n);
	char s[N];
	scanf("%s",s);
	
	int w[n+1]={},e[n+1]={};
	for(int i=0;i<n;i++)
	{
		if(s[i]=='W') //ely 2bel
			w[i]++;
		else
			e[i]++;
		w[i+1]+=w[i];
		e[i+1]+=e[i];
	}
	int mn=1e9+5,ss=0;
	for(int i=0;i<n;i++)
	{
		ss=0;
		if(s[i]=='W'&&i-1>=0) //ely 3leh 
		{
			ss+=(e[n]-e[i]);
			ss+=(w[i]);
		}
		else if(s[i]=='W'&&i==0)
			ss+=(e[n]-e[i]);
		else if(s[i]=='E'&&i-1>=0)
		{
			ss+=(e[n]-e[i]);
			ss+=(w[i]);
		}
		else if(s[i]=='E'&&i==0)
			ss+=(e[n]-e[i]);
		//cout<<ss<<endl;
		mn=min(mn,ss);
	}
	printf("%d\n",mn);
	return 0;
}

Measured memory_bytes: 2944
<?php
fscanf(STDIN, "%d %d", $monster_count, $critical);
if($monster_count<=$critical){
  echo 0;
  exit;
}
$monster_s = fgets(STDIN);
$exploded_monster_s = explode(' ', trim($monster_s));
sort($exploded_monster_s);
$nokori = array_splice($exploded_monster_s, 0, $monster_count-$critical);
echo array_sum($nokori);

Measured memory_bytes: 31392
import queue
N = int(input())
M = [-1]*(N+1)
M[0] = 0
q = queue.Queue()
q.put(0)
while not(q.empty()):
  c = q.get()
  i = M[c]
  for n in range(1, 20):
    s = c+6**n
    if s <= N and (M[s] < 0 or i+1 < M[s]):
      M[s] = i+1
      q.put(s)
  for n in range(1, 20):
    s = c+9**n
    if s <= N and (M[s] < 0 or i+1 < M[s]):
      M[s] = i+1
      q.put(s)
#print(M)
for i in reversed(range(0, N+1)):
  if not(M[i] < 0):
    r = M[i]+(N-i)
    break
print(r)


Measured memory_bytes: 4956
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int main(void){
  char a,b,c,d;
  cin >> a >> b >> c >> d;
  int l = (a - '0') * 10 + (b - '0');
  int k = (c - '0') * 10 + (d - '0');
  if(0 < l && l <= 12 && 0 < k && k <= 12){
    cout << "AMBIGUOUS" << endl;
  }else if(0 <= l && l <= 99 && 0 < k && k <= 12){
    cout << "YYMM" << endl;
  } else if(0 <= k && k <= 99 && 0 < l && l <= 12){
    cout << "MMYY" << endl;
  } else {
    cout << "NA" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<complex>
#include<vector>
#include<algorithm>
#include<functional>
#include<array>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int main() {
	int n,price=0,temp,allp=0;
	cin >> n;
	vector<int> a(n+2);
	a[0] = 0;
	a[n + 1] = 0;
	for (int i = 1;i <= n;i++)
		cin >> a[i];
	for (int i = 0;i <= n;i++) {
		allp += abs(a[i] - a[i + 1]);
	}


	for (int i = 1;i <= n;i++){

		price = 0;
		price += allp;
		price += abs(a[i-1]-a[i+1]);
		price -= (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1]));
		cout << price << endl;

	}

	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int n;
  cin >> n;
  bool t=true;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n){
    if (a[i]%2==0){
      if (a[i]%3!=0 && a[i]%5!=0) t=false;
    }
  } 
  if (t) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
}


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

const long long mod = 1e9 + 7;

long long POW(long long a, long long b) {
	long long ret = 1;
		while (b > 0) {
			if (b&1) {
				ret = ((ret % mod) * (a % mod)) % mod;
			}
			a = ((a % mod) * (a % mod)) % mod;
			b /= 2;
		}
	return ret;
}

long long nCk(long long n, long long k) {
	long long ue = 1; // 分子
	long long shita = 1; // 分母
	for (int i = 0; i < k; i++) {
		ue *= n - i;
		shita *= k - i;
		ue %= mod;
		shita %= mod;
	}
	shita = POW(shita, mod - 2) % mod; // 逆元にする

	return (ue * shita) % mod;
}

signed main() {
	int n, a, b;
	cin >> n >> a >> b;

	long long ans = POW(2, n) % mod;
	ans += mod;
	int minus = (nCk(n, a) + nCk(n, b) + 1) % mod;
	ans = (ans - minus) % mod;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
s = list(input())
a = 0
for i in range(len(s)):
  if i%2 == 0 and s[i] == 'L':
    a += 1
    print('No')
    break
  elif i%2 != 0 and s[i] == 'R':
    a += 1
    print('No')
    break
      
if a == 0:
  print('Yes')

Measured memory_bytes: 3060
#include <stdio.h>


int main(){
	int K, A, B;
	scanf("%d %d %d", &K, &A, &B);
	
	for(int i =A; i<=B; i++){
		if(i % K == 0){
			printf("OK");
			return 0;
		}
	}
	printf("NG");
	return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define pb(a) push_back(a)
#define ALL(a) a.begin(),a.end()
#define sqr(x) (x) * (x)
#define fori(i, n) for(int i = 0; i < (int)(n); ++i)
#define cint const int &
#define SZ(a) ((int)(a.size()))
#define f(cnt) (((cnt) + 1) * (cnt) / 2)
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

template<typename T>
struct edge {
    int from, to;
    T w;
    edge(int from, int to, T w): from(from), to(to), w(w) { }
    edge() { }
};


template<class T>
void show(T a) {
    for (auto x : a)
        cout << x << " ";
    cout << endl;
}

map<int, int> cnt[2];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    vi a(n);
    fori (i, n) {
        cin >> a[i];
    }
    fori (i, n) {
        cnt[i & 1][a[i]]++;
    }
    vector<vector<pii>> kek(2);
    fori (z, 2) {
        for (auto p : cnt[z]) {
            kek[z].push_back({p.second, p.first});
        }
        kek[z].push_back({0, -z});
        sort(ALL(kek[z]));
    }
    int ans = 0;
    if (kek[0].back().second == kek[1].back().second) {
        ans += max (kek[1].back().first + kek[0][kek[0].size() - 2].first, kek[0].back().first + kek[1][kek[1].size() - 2].first) ;
    } else {
        ans += kek[0].back().first + kek[1].back().first;
    }
    cout << n - ans;
}

Measured memory_bytes: 6524
#include<stdio.h>
int main(void)
{
	int m, f, r;
	
	while(1){
		scanf("%d %d %d", &m, &f, &r);
		if(m==-1 && f==-1 && r==-1){
			break;
		}
		if(m==-1 || f==-1){
			printf("F\n");
		}
		else if(m+f>=80){
			printf("A\n");
		}
		else if(m+f>=65 && m+f<80){
			printf("B\n");
		}
		else if(m+f>=50 && m+f<65){
			printf("C\n");
		}
		else if(m+f>=30 && m+f<50){
			if(r>=50){
				printf("C\n");
			}else{
				printf("D\n");
			}
		}
		else if(m+f<30){
			printf("F\n");
		}
	}
	
	return 0;
}

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

#define ll long long
#define pb push_back
#define iter std::vector<int>::iterator

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

	string s; cin >> s;

	char c = s[0];
	for (int i=1; i < 3; i++) {
		if (c != s[i]) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	return 0;	
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Numerics;
using static MyIO;


public class B
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		double[] x = new double[3];
		double[] y = new double[3];
		for(int i = 0; i < 3; i++)
		{
			x[i] = GetDouble();
			y[i] = GetDouble();
		}

		double[] len = new double[3];
		for(int i = 0; i < 3; i++)
		{
			double dx = x[(i + 1) % 3] - x[i];
			double dy = y[(i + 1) % 3] - y[i];
			len[i] = Math.Sqrt(dx * dx + dy * dy);
		}

		var a = new Complex(x[1] - x[0], y[1] - y[0]);
		var b = new Complex(x[2] - x[0], y[2] - y[0]);
		double S = Math.Abs(a.Real * b.Imaginary - a.Imaginary * b.Real) / 2.0;
		double M = len.Max();
		double r = (2.0 * S) / len.Sum();
		double ans = (M * r) / (2.0 * r + M);

		Console.WriteLine($"{ans:F12}");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>

using namespace std;

struct paper
{
    int col;
    char str[15];
};

struct paper lis[210];

int cmp(const void *a,const void *b)
{
    struct paper *c = (paper *)a;
    struct paper *d = (paper *)b;
    if (strcmp(c->str,d->str)==0)
        return c->col - d->col;
    else
        return strcmp(c->str,d->str);
}

int main()
{
    int n,m;
    int i,j,maxs;
    while (scanf("%d",&n)!=EOF)
    {
        memset(lis,0,sizeof(lis));
        for (i=0;i<n;i++)
        {
            scanf("%s",lis[i].str);
            lis[i].col=1;
        }
        scanf("%d",&m);
        for (i=n;i<m+n;i++)
        {
            scanf("%s",lis[i].str);
            lis[i].col=2;
        }
        qsort(lis,m+n,sizeof(lis[0]),cmp);
        maxs=0;
        if(lis[0].col==1)
            j=1;
        else
            j=-1;
        for (i=1;i<m+n;i++)
        {
            if (strcmp(lis[i].str,lis[i-1].str)==0)
            {
                if (lis[i].col==1)
                    j++;
                else
                    j--;
            }
            else
            {
                if (maxs<j)
                    maxs=j;
                if (lis[i].col==1)
                    j=1;
                else
                    j=-1;
            }
        }
        if (maxs<j)
            maxs=j;
        printf("%d\n",maxs);
    }
    return 0;
}

Measured memory_bytes: 256
h,*s=open(0)
h,w,k,*m=map(int,h.split())
b=w
while b:
 b-=1;r=0;t=j=w;d=[0]*h
 while j:
  i=c=0;j-=1
  while h-i:
   d[c]+=s[i][j]>'0';c+=b>>i&1;i+=1
   if max(d)>k:d=[0]*h;r+=1;t,j=j,j+(t>j);i=h
 m+=r+c,
print(min(m))


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

int main()
{
    int q;
    cin>>q;
    vector<int>ansvec(q);
    int count=0;
    while (count<q)
    {string x,y;
     cin >> x>>y;
     vector<vector<int>>dp(x.size()+1,vector<int>(y.size()+1));
     rep(i,x.size())
     {
         rep(j,y.size())
         {
             dp[i+1][j+1]= (x[i]==y[j]) ? dp[i][j]+1 : max(dp[i+1][j],dp[i][j+1]) ;
         }
     }
     ansvec[count]=dp[x.size()][y.size()];
     count++;
    }
    
    rep(i,q)
    {
        cout<<ansvec[i]<<endl;
    }
   
    return 0;
}


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

ll k;

int main()
{
    _FastIO;
    cin >> k;
    queue<ll> q;
    for(ll i = 1; i < 10; i++){
        q.push(i);
    }
    while(--k){
        ll x = q.front();
        ll n = x;
        q.pop();
        if(n % 10)  q.push(x * 10 + n % 10 - 1);
        q.push(x * 10 + n % 10);
        if(n % 10 < 9)  q.push(x * 10 + n % 10 + 1);
    }
    cout << q.front() << endl;
    return 0;
}


Measured memory_bytes: 1792
program main
    implicit none
    integer::n,i,countn
    integer,allocatable::L(:),A(:,:)
    logical::judge=.true.
    read*, n
    if(n<1.or.n>100)then
        judge=.false.
    end if
    allocate(L(2*n),A(2,n))
    read*, L
    do i=1,2*n
        if(L(i)<=0.or.L(i)>100)then
            judge=.false.
        end if
    end do
    call array(2*n,L)
    call set(n,L,A)
    print *, countn(n,A)
end program main

subroutine array(n,L)
    implicit none
    integer,intent(in)::n
    integer,intent(inout)::L(n)
    integer::i,j,a
    do i=1,n-1
        do j=1,n-i
            if(L(j)>L(j+1))then
                a=L(j+1)
                L(j+1)=L(j)
                L(j)=a
            end if
        end do
    end do
end subroutine array
subroutine set(n,L,A)
    implicit none
    integer,intent(in)::n,L(2*n)
    integer,intent(out)::A(2,n)
    integer::i
    do i=1,n
        A(1,i)=L(2*i-1)
        A(2,i)=L(2*i)
    end do
end subroutine set
function countn(n,A)
    implicit none
    integer::n,A(2,n)
    integer::countn,i,m
    m=0
    do i=1,n
        m=m+A(1,i)        
    end do
    countn=m
end function countn

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

int main(){
        int64_t N,W;
        cin >> N >> W;

        vector<vector<int64_t>> vvi(4),vvisum(4);
        int64_t w1,v1;

        cin >> w1 >> v1;
        vvi[0].push_back(v1);

        for(int i=1;i<N;i++){
                int64_t w,v;
                cin >> w >> v;
                vvi[w-w1].push_back(v);
        }

        for(int i=0;i<4;i++){
                sort(vvi[i].begin(),vvi[i].end(),greater<int64_t>());
        }

        for(int i=0;i<4;i++){
                vvisum[i].push_back(0);
                for(int j=0;j<vvi[i].size();j++){
                        vvisum[i].push_back(vvisum[i][j]+vvi[i][j]);
                }
        }

        int maxvalue=0;
        for(int i=0;i<vvisum[0].size();i++){
                for(int j=0;j<vvisum[1].size();j++){
                        for(int k=0;k<vvisum[2].size();k++){
                                for(int l=0;l<vvisum[3].size();l++){
                                        if(w1*i+(w1+1)*j+(w1+2)*k+(w1+3)*l<=W){
                                                if(maxvalue<vvisum[0][i]+vvisum[1][j]+vvisum[2][k]+vvisum[3][l]){
                                                        maxvalue = vvisum[0][i]+vvisum[1][j]+vvisum[2][k]+vvisum[3][l];
                                                }
                                        }
                                }
                        }
                }
        }

        cout << maxvalue << endl;

        return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<double> a(n);

  double ave=0.0;
  for(int i=0; i<n; i++){
    cin>>a[i];
    ave+=a[i];
  }
  ave/=n*1.0;

  int ans=0;
  for(int i=1; i<n; i++){
    if(abs(a[ans]-ave)>abs(a[i]-ave))ans=i;
  }  

  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
use proconio::input;
use std::cmp::min;
fn main() {
    input!(x: i64, n: usize);
    input!(p: [i64; n]);

    let mut v = 100000;
    let mut ans = 100000;
    for i in -100..=101 {
        if !check(i, &p) {
            continue;
        }
        if v > (x - i).abs() {
            v = (x - i).abs();
            ans = i;

            //println!("{} {}", v, ans);
        }
    }

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

fn check(v: i64, p: &Vec<i64>) -> bool {
    for &e in p.iter() {
        if e == v {
            return false;
        }
    }

    true
}


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

int main() {
	int N,M=0,ans=0; cin >> N;
	for(int i = 0 ; i < N ; i++){
		int p; cin >> p;
		ans += p;
		M = max(M,p);
	}
	cout << ans - M/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    string s;
    cin >> s;
    int n = s.length();
    VVI dp(n + 1, VI(2, -1));
    dp[1][0] = 1;
    dp[2][1] = 1;
    REP(i,n) REP(j,2){
        if (dp[i][j] == -1) continue;
        string t = s.substr(i - j - 1, j + 1);
        REP(k,2){
            if (i + k + 1 > n) continue;
            if (s.substr(i, k + 1) != t) chmax(dp[i + k + 1][k], dp[i][j] + 1);
        }
    }
    // REP(i,n+1) cout << dp[i][0] << " " << dp[i][1] << endl;
    int ans = max(dp[n][0], dp[n][1]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11396
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> A = {0,1,2,3,4,5,6,7};
    vector<double> X(N),Y(N);
    for(int i=0;i<N;i++) cin >> X[i] >> Y[i];
    int cnt = 0;
    double sum = 0;
    do{
        for(int i=0;i<N-1;i++){
            double dx = X[A[i+1]]-X[A[i]],dy = Y[A[i+1]]-Y[A[i]];
            sum += sqrt(dx*dx+dy*dy);
        }
        cnt++;
    }while(next_permutation(A.begin(),A.begin()+N));
    cerr << cnt << endl;
    cout << fixed << setprecision(10) << sum/cnt << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
A=list(map(int,input().split()))
tele=[0 for _ in range(n+1)]
cnt=1
v=1
while True:
    if tele[v]!=0:
        break
    else:
        tele[v]=cnt
        cnt+=1
        v=A[v-1]

circle_in=tele[v]
circle=[]
for idx,t in enumerate(tele):
    if t<circle_in:
        continue
    else:
        circle.append((t,idx))
circle.sort()

circle_len=len(circle)
if circle[0][1]==1:
    circle_idx=k%(circle_len)
    ans=circle[circle_idx][1]

elif k<circle_in:
    ans=tele.index(k+1)

else:
    k=k-(circle_in-1)
    circle_idx=k%(circle_len)
    ans=circle[circle_idx][1]

print(ans)

Measured memory_bytes: 110012
#include <bits/stdc++.h>
#define rep(i, x, N) for (int i = x; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll combi[2001][2001] = {0};
int main()
{
    int n, r;
    cin >> n >> r;
    rep(i, 0, 2001)
    {
        rep(j, 0, 2001)
        {
            if (i == j || j == 0)
            {
                combi[i][j] = 1;
            }
            else if (j > i)
            {
                combi[i][j] = 0;
            }
            else
            {
                combi[i][j] = (combi[i - 1][j - 1] + combi[i - 1][j]) % mod;
            }
        }
    }
    rep(i, 1, r + 1)
    {
        cout << combi[n - r + 1][i] * combi[r - 1][i - 1] % mod << endl;
    }
}


Measured memory_bytes: 31488
#include <cstdint>
#include <iostream>

using namespace std;

int32_t main()
{
  uint32_t A, B, C;

  cin >> A >> B >> C;

  for (uint32_t i = 1; i <= B; i++) {
    if (A * i % B == C) {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;

  return 0;
}


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

int main() {
    int H, N;
    cin >> H >> N;

    vector<int> vec(N);

    for(int i=0; i<N; i++) {
        cin >> vec[i];
    }

    int total = 0;
    for(int i=0; i<N; i++) {
        total += vec[i];
    }

    if (total >= H) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
B = []
for i in range(n):
    B.append(A[i] - A[i-1])

m = max(B)
no = 0

if m < 0:
    no = 1
elif m == 0:
    if A[0] % (n*(n+1)//2) > 0:
        no = 1
else:
    c = 0
    for i in range(n):
        if (m - B[i]) % n > 0:
            no = 1
        else:
            c += (m - B[i]) // n

    if c != m:
        no = 1
    if sum(A) != m * n*(n+1)//2:
        no = 1

if no==1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 59628
import * as fs from "fs";
namespace a {
  const input = fs.readFileSync("/dev/stdin", "utf8");

  // inputに入力データ全体が入る
  function main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");

    //文字列から10進数に変換するときはparseIntを使います
    const r = parseInt(input[0], 10);
    console.log(2 * r * Math.PI);
    return;
  }

  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  main(input);
}


Measured memory_bytes: 29640
h, w, n = gets.split(" ").map(&:to_i)
@data = h.times.map { gets.strip.split('') }
kuro = 0
cnt = 0

def kazoeru(h_bit, w_bit, kuro)
  h_bit.each_with_index do |h_s, h_index|
    w_bit.each_with_index do |w_s, w_index|
      next if w_s == 1 || h_s == 1
      kuro += 1 if @data[h_index][w_index] == "#"
    end
  end
  kuro
end
[0, 1].repeated_permutation(h) do |h_bit|
  [0, 1].repeated_permutation(w) do |w_bit|
    kuro = 0
    kuro = kazoeru(h_bit, w_bit, kuro)
    cnt += 1 if kuro == n
  end
end
   
puts cnt

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

void main() {
    auto S = readln.chomp;
    auto Q = readln.chomp.to!int;

    DList!dchar que;
    foreach (s; S) que.insertBack(s.to!dchar);
    bool flag = false;

    while (Q--) {
        auto s = readln.split;
        if (s[0] == "1") {
            flag ^= 1;
        } else {
            auto f = s[1].to!int;
            auto c = s[2].to!dchar;
            if ((f == 1 && !flag) || (f == 2 && flag)) {
                que.insertFront(c);
            } else {
                que.insertBack(c);
            }
        }
    }

    dchar[] ans;

    if (!flag) foreach (s; que) ans ~= s;
    else foreach_reverse (s; que) ans ~= s;

    ans.writeln;
}

Measured memory_bytes: 22168
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
using namespace std;
using ll = long long;
#define PI 3.14159265359



int main(){
    double a,b;
    
    cin >> a >> b;
    double h;
    double m;
    cin >> h >> m;
    double angle =  360.0*((h + m/60)/12. - m/60.0);
    double ans = a*a + b*b - 2*a*b*cos(PI*angle/180.0);
    ans = sqrt(ans);
    printf ("%.20f",ans);
}
















Measured memory_bytes: 4216
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;
int main(){
    int T,P,R;
    int tid,pid,time;
    string message;
    while(cin>>T>>P>>R,T || P || R){
        pair<int,int> team[51];
        int used[51]={};
        int pena[51][11]={};
        for(int i=0;i<T;i++) team[i+1].S=i+1;
        for(int i=0;i<R;i++){
            cin>>tid>>pid>>time>>message;
            if(message=="WRONG"){
                pena[tid][pid]++;
            }
            else if(message=="CORRECT"){
                used[tid]+=time+pena[tid][pid]*1200;
                team[tid].F++;
            }
        }
        sort(team+1,team+1+T);
        reverse(team+1,team+1+T);
        bool flag=true;
        while(flag){
            flag=false;
            for(int i=0;i<T;i++){
                for(int j=i+1;j<T;j++){
                    if(team[i+1].F==team[j+1].F){
                        if(used[team[i+1].S]>used[team[j+1].S]){
                            swap(team[i+1],team[j+1]);
                            flag=true;
                        }
                        else if(used[team[i+1].S]==used[team[j+1].S] && team[i+1].S > team[j+1].S){
                            swap(team[i+1],team[j+1]);
                            flag=true;
                        }
                    }
                }
            }
        }
        for(int i=0;i<T;i++){
            cout<<team[i+1].S<<" "<<team[i+1].F<<" "<<used[team[i+1].S]<<endl;
        }
        
    }
    
    return 0;
}



Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int[] B = new int[m];
        int[][] X = new int[n][m];
        int sum = 0;
        int ans = 0;

        for (int j = 0; j < m; j++) {
            B[j] = Integer.parseInt(sc.next());
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                X[i][j] = Integer.parseInt(sc.next());
            }
        }
        for (int i = 0; i < n; i++) {
            sum = 0;
            for (int j = 0; j < m; j++) {
                sum += X[i][j] * B[j];
            }
            if (sum + c > 0) {
                ans += 1;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21204
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<ll, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

ll ab(ll x){
    return max(x,-x);
}

int main(){
    fastIO;
    ll a, b;
    cin >> a >> b;
    ll res = ab(a)-ab(b);
    res = max(res,-res);
    ll ans = 2;
    if(a + res == b) ans = 0;
    else if(-a + res == b || -(a + res) == b) ans = 1;
    cout << res + ans;
    return 0;
}

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

int main(){
	string S;
  	string T;
  	cin>>S>>T;
  	if((S.size()+1)!=T.size()){
    	cout<<"No\n";
    }
  	else if((S.size()+1)==T.size()){
      	bool flag=false;
      	for(int i=0;i<S.size();i++){
        	if(S[i]!=T[i]){
            	flag=true;
              	break;
            }
        }
      	if(flag==true){
        	cout<<"No\n";
        }
      	else{
        	cout<<"Yes\n";
        }
  	}
  	else{
  	    cout<<"No\n";
  	}
}

Measured memory_bytes: 3628
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))

from itertools import permutations
cmb=list(permutations(range(1,n+1),n))
# print(cmb[0])

a=0
b=0

for i in range(len(cmb)):
    if cmb[i]==p:
            a=i+1
    else:
            continue
    
    for j in range(len(cmb)):
        if cmb[j]==q:
            b=j+1
           
        else:
            continue

# print(a,b)
print(abs(a-b))

Measured memory_bytes: 8052
use std::io;
use std::io::BufRead;

fn main() {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();

    let (a,p) = {
        let mut input = String::new();
        stdin.read_line(&mut input).unwrap();
        let mut input = input.trim().split_whitespace();
        (
            input.next().unwrap().parse::<i32>().unwrap(),
            input.next().unwrap().parse::<i32>().unwrap(),
        )
    };

    println!("{}", (3*a+p)/2);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <set>
#include <map>
#include <queue>

#define sz(v) int(v.size())
#define sqr(x) ((x) * (x))

using ll = long long;
using ld = long double;
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template <class T>
using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T1, class T2>
istream& operator >> (istream &in, pair <T1, T2> &a) {
    in >> a.first >> a.second;
    return in;
}

template <class T1, class T2>
ostream& operator << (ostream &out, pair <T1, T2> &p) {
    out << p.first << ' ' << p.second;
    return out;
}

template <class T>
istream& operator >> (istream &in, vector <T> &a) {
    for (T &i: a) in >> i;
    return in;
}

template <class T>
ostream& operator << (ostream &out, vector <T> &a) {
    for (T i : a) out << i << ' ';
    return out;
}

void fastIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
}

void solve();

int main() {
    fastIO();

    int h[3], a[3];
    cin >> h[0] >> a[0] >> h[1] >> a[1];

    for (int i = 0; i < sqr(100) + 100; ++i) {
        if (i % 2 == 0) {
            h[1] -= a[0];
            if (h[1] <= 0) {
                cout << "Yes";
                return 0;
            }
        }

        else {
            h[0] -= a[1];
            if (h[0] <= 0) {
                cout << "No";
                return 0;
            }
        }
    }

    return 0;
}

/// ЗАПУСКАЕМ ГУСЯ
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector <vector<int>>;
using vvl = vector <vector<ll>>;

ll P = 998244353;
ll sdp[401010] = {0};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector <pair<int, int >> lr(k);
  for (int i = 0; i < k; i++) cin >> lr[i].first >> lr[i].second;
  sdp[0] = 1;
  sdp[1] = -1;
  ll s = 0;
  for (int i = 0; i < n; i++) {
    s = (s + sdp[i]) % P;
    for (int j = 0; j < k; j++) {
      sdp[i + lr[j].first] += s;
      sdp[i + lr[j].second + 1] += P - s;
      sdp[i + lr[j].first] %= P;
      sdp[i + lr[j].second + 1] %= P;
    }
  }
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    sum = (sum + sdp[i]) % P;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 6628
S = input()
T = input()

ls = len(S)
lt = len(T)


ans = 1e10

for i in range(ls-lt+1):
    tmp = S[i:i+lt]
    cnt = 0
    for j in range(lt):
        if tmp[j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)

print(ans)

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cout << fixed << setprecision(10);

    int n;
    cin >> n;

    if (n % 2)
        cout << (double) (n + 1) / 2 / (double) n << '\n';
    else
        cout << (double) n / 2.0 / n << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i;
	scanf("%d", &n);
	for(i=0;i<=n;i++)
	{
		if((int)(i*1.08)==n)
		{
			printf("%d\n",i);
			return 0;

		}
	}
	printf(":(\n");
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N;

const int MAX_N = 1001;
const int MAX_GAME = MAX_N * MAX_N;

bool visited[MAX_GAME];
bool calced[MAX_GAME];
int day[MAX_GAME];
int get_day(int game, vector<vector<int>>& prev) {
    if (visited[game]) {
        if (!calced[game]) return -1;
        return day[game];
    }
    visited[game] = true;
    day[game] = 1;
    for(int prev_game : prev[game]) {
        int prev_game_day = get_day(prev_game, prev);
        if (prev_game_day == -1) return -1;
        day[game] = max(day[game], prev_game_day + 1);
    }
    calced[game] = true;
    return day[game];
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N - 1));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N - 1; j++) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }
    int index = 0;
    vector<vector<int>> game_id(N, vector<int>(N));
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            game_id[i][j] = index;
            game_id[j][i] = index;
            index++;
        }
    }
    vector<vector<int>> prev(N * (N - 1) / 2, vector<int>());
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N - 2; j++ ) {
            prev[game_id[i][A[i][j + 1]]].push_back(game_id[i][A[i][j]]);
        }
    }
    int last = 0;
    for (int g = 0; g < N * (N - 1) / 2; g++) {
        int day = get_day(g, prev);
        if (day == -1) {
            cout << -1 << endl;
            return 0;
        }
        last = max(last, day);
    }
    cout << last << endl;
    return 0;
}

Measured memory_bytes: 50048
////=====BIsmillahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comilla University

*/
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
#define fi 2*acos(0.0)
#define ee 2.71828
#define ll  long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define edl printf("\n")
#define infinity 1e16
#define mod 1000000007
#define cn continue
#define csprint1 printf("Case %lld: ", cs++)
#define csprint2 printf("Case %lld:\n", cs++)
#define sf(a) scanf("%lld", &a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define all(v) v.begin(),v.end()
#define pfn(a) printf("%lld\n",a)
#define pfs(a) printf("%lld ",a)

// using namespace __gnu_pbds;
using namespace std;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<pl> vpi;
typedef vector<pl> vpl;
// typedef tree<pair<ll, int> , null_type, less<pair<ll, int> >, rb_tree_tag, tree_order_statistics_node_update> ost;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<","<< spc;
    err(++it, args...);
    cout<<edl;
}
///Bit manipulation

bool checkbit(int mask,int bit){return mask & (1<<bit);}
int setbit(int mask,int bit){ return mask | (1<<bit) ; }
int clearbit(int mask,int bit){return mask & ~(1<<bit);}
int togglebit(int mask,int bit){return mask ^ (1<<bit);}
int bitno(int mask) {return (int)__builtin_popcount(mask);}

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

///=====================================///
const long long maX=1e5+5;
string str="codeforces";
int main(){
        string str;
        cin>>str;
        if(str.back()!='s'){
            cout<<str<<"s"<<endl;
        }
        else{
            cout<<str<<"es"<<endl;
        }
return 0;
}

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

int main(){
    string S; cin >> S;
    if(S[0]==S[1]&&S[0]==S[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

int i;
string a,b;


int main(){
	cin>>a>>b;
    for(i=0;i<=b.length()-1;i++){
        cout<<a[i]<<b[i];
    }
    if(a.length()>b.length()){
        cout<<a[a.length()-1];
    }
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp67 {
    class Program {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            int len = s.Length;

            string ans = "";

            for (int i = 0; i < len; i++) {
                if (i % 2 == 0) {
                    ans += s[i].ToString();


                }
            }

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 34772
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      double x = (double) (a+b)/2;
      if( (a+b)/2 == x) System.out.println((a+b)/2);
      else System.out.println((a+b)/2 + 1);
    }
}


Measured memory_bytes: 21588
import collections
n=int(input())
li=[input() for _ in range(n)]
c=collections.Counter(li)
M=max(c.values())
ans=[]
for k,v in c.items():
    if v==M:
      ans.append(k)
ans.sort()
for i in range(len(ans)):
  print(ans[i])
    



    

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

using ll = long long;
constexpr int mod = 1e9 + 7;

int main() {
    int n, m; cin >> n >> m;
    vector<int> a(n), b(m);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    sort(begin(a), end(a));
    sort(begin(b), end(b));
    a.erase(unique(begin(a), end(a)), end(a));
    b.erase(unique(begin(b), end(b)), end(b));

    if((int)a.size() != n || (int)b.size() != m) {
        cout << 0 << endl;
        return 0;
    }

    vector<bool> used(n * m + 1);
    vector<ll> v(n * m + 1);
    ll ans = 1;
    for(int i = 0; i < n; ++i) {
        bool check = false;
        ll cnt = 0;
        for(int j = 0; j < m; ++j) {
            check |= a[i] == b[j];
            cnt += a[i] < b[j];
        }
        used[a[i]] = true;
        if(check) continue;
        ans = (ans * cnt) % mod;
        v[a[i]] -= 1;
    }
    for(int i = 0; i < m; ++i) {
        bool check = false;
        ll cnt = 0;
        for(int j = 0; j < n; ++j) {
            check |= a[j] == b[i];
            cnt += b[i] < a[j];
        }
        used[b[i]] = true;
        if(check) continue;
        ans = (ans * cnt) % mod;
        v[b[i]] -= 1;
    }
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < m; ++j) {
            if(a[i] == b[j]) continue;
            v[min(a[i], b[j])] += 1;
        }
    }

    ll sum = 0;
    for(int i = n * m; i >= 1; --i) {
        sum += v[i];
        if(used[i]) continue;
        ans = (sum * ans) % mod;
        sum--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8192
num = int(input())
st = list(map(int,input().split()))
flag = True
all1 = 0
all2 = 0
for i in range(num):
  if flag == True:
    sum1 = max(st)
    st.remove(sum1)
    all1 = all1 + sum1
    flag = False
  else:
    sum1 = max(st)
    st.remove(sum1)
    all2 = all2 + sum1
    flag = True

print(all1-all2)

Measured memory_bytes: 3064
a,b,k=map(int,input().split())
ab=[i for i in range(1,101) if a%i==0 and a/i>0]+[i for i in range(1,101) if b%i==0 and b/i>0]
AB=[i for i in set(ab) if ab.count(i)>1]
AB.sort(reverse=True)
print(AB[k-1])

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static int A;
    static int B;
    static int C;
    static int X;
    static int Y;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);

        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        X = sc.nextInt();
        Y = sc.nextInt();

        System.out.println( solve() );
    }

    static int solve() {
        int ans = Integer.MAX_VALUE;
        for (int ab = 0; ab <= Math.max(X, Y)*2; ab+=2) {
            int buy_ab = ab * C;

            int rx = X - ab/2;
            int buy_a;
            if( rx > 0 ) {
                buy_a = rx * A;
            } else {
                buy_a = 0;
            }

            int ry = Y - ab/2;
            int buy_b = Y - ab/2;
            if( ry > 0 ) {
                buy_b = ry * B;
            } else {
                buy_b = 0;
            }

            ans = Math.min(buy_a + buy_b + buy_ab, ans);
        }
        return ans;
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 22612
// header file section
#include <iostream>
#include <cstdio>
#include <cfloat>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <numeric>
#include <algorithm>

using namespace std;
using llong = long long;

// library section
// ===

llong n, m;

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

    llong t = 1900 * m + 100 * (n - m);

    printf("%lld\n", t * (1 << m));

    return 0;
};



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n, m, sum = 0;
    cin >> n >> m;
    
    for (int i = 0; i < m; ++i) {
        int ai;
        cin >> ai;
        sum += ai;
    }
    
    if (sum <= n)
        cout << n-sum << endl;
    else
        cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>
int main(){
	
	int n;
	scanf("%d", &n);
	int a[n];
	int b[n];
	int c[n];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d", &a[i], &b[i], &c[i]);
	}
	for(i=0;i<n;i++)
	{
		if(a[i]*a[i]==b[i]*b[i]+c[i]*c[i])
		{
			printf("YES\n");
		}
		else if(b[i]*b[i]==a[i]*a[i]+c[i]*c[i])
		{
			printf("YES\n");
		}
		else if(c[i]*c[i]==a[i]*a[i]+b[i]*b[i])
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 588