akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long lol;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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 main()
{
    lol result{0}, sum{0};
    string s; cin >> s;
    REP(i, 3)
    {
        if(s[i] == 'R')
            sum++;
    }
    if(s[0] == 'S' && s[1] == 'S' && s[2] == 'S')
        result = 0;
    else if(sum == 1 || ((sum == 2) && s[1] == 'S'))
        result = 1;
    else if(sum == 2 && (s[1] == 'R'))
        result = 2;
    else if(sum == 3)
        result = 3;

    cout << result << endl;
    return 0;
}

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

namespace _0021
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Coordinate coordinate = new Coordinate();
            List<bool> answerList = new List<bool>();
            for (int i = 0; i < n; ++i)
            {
                List<decimal> list = Console.ReadLine().Split(' ').Select(decimal.Parse).ToList();
                answerList.Add(coordinate.Parallel(list[0], list[1], list[2], list[3], list[4], list[5], list[6], list[7]));
            }
            foreach (var item in answerList)
            {
                if (item == true)
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }



        }

        class Coordinate
        {
            public bool Parallel(decimal x1, decimal y1, decimal x2, decimal y2, decimal x3, decimal y3, decimal x4, decimal y4)
            {

                if (x1 == x2 && x3 == x4)
                {
                    return true;
                }
                else if (x1 == x2 || x3 == x4)
                {
                    return false;
                }
                else if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
    }
}



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

const int INF = 10000000;
int N, M;
int  G[101][101];
int dist[101][101];
int a[1001],b[1001],c[1001];
int ans;

void d_init () {
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      dist[i][j] = INF;
    }
  }

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

  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      if(G[i][j]) dist[i][j] = G[i][j];
    }
  }
}

int main() {
  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--; b[i]--;
    G[a[i]][b[i]] = c[i];
    G[b[i]][a[i]] = c[i];
  }

  d_init();
  
  
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < N; k++) {
	dist[j][k] = min(dist[j][k],dist[j][i] + dist[i][k]);
      }
    }
  }

  /*for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      cout << dist[i][j] <<endl;
    }
    }*/

  for(int i = 0; i < M; i++) {
    bool is = false;
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < N; k++) {
	if(j == k)continue;
	if(dist[j][a[i]] + c[i] + dist[b[i]][k] == dist[j][k]){ is = true;
	  /*  cout <<dist[j][a[i]]<<"  "<< c[i] << "   " << dist[b[i]][k] <<"aaa"<<dist[j][k]<<endl;*/}
      }
    }
    if(is)ans++;
  }
  cout << M - ans <<endl;
}



  


Measured memory_bytes: 512
n=int(input())
a=list(map(int,input().split()))
res=[0]*n
temp=0
for i in range(n):
  temp+= a[i]*(-1)**i
res[0]=temp//2
for i in range(1,n):
  res[i]=a[i-1]-res[i-1]
for i in range(n):
  res[i]*=2
print(*res)

Measured memory_bytes: 20584
#!/usr/bin/env python3
import numpy as np

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N=int(input())
    A = []
    for i in range(N):
        a = int(input())
        A.append([])
        xy = None
        for j in range(a):
            xy = list(map(int,input().split()))
            A[i].append(xy)
    #print(A)

    c=0
    for bit in range(1,2**N):
        bs = np.array(list(map(int,list("0"*N+bin(bit)[2:])[-N:])))
        #print(bs)
        ok=True
        for i in range(N):
            if bs[i]:
                for j in range(len(A[i])):
                    x, y = A[i][j]
                    if y==1 and bs[x-1]==0:
                        ok=False
                        break
                    if y==0 and bs[x-1]!=0:
                        ok=False
                        break
                else:
                    continue
                break

        if ok:
            #print("OK")
            #print(bs)
            c = max(c, bs.sum())

    print(c)        


if __name__ == '__main__':
    main()


Measured memory_bytes: 14400
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main(void){
    int n,k;
    cin >> n >> k;
    int b[n];
    for(int i=0;i<n;i++)b[i]=0;
    for(int i=0;i<k;i++){
        int x;
        cin >> x;
        int a[x];
        for(int j=0;j<x;j++)cin >> a[j];
        for(int j=0;j<x;j++)b[a[j]-1]++;
    }
    int ans = 0;
    for(int i=0;i<n;i++)if(b[i]==0)ans++;
    cout << ans << endl;
    return 0;
}


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

int main() {
  string A, B;
  cin >> A;
  B = "Good";
  
  if (A.at(0) == A.at(1))
    B = "Bad";
  if (A.at(1) == A.at(2))
    B = "Bad";
  if (A.at(2) == A.at(3))
    B = "Bad";
  cout << B << endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long


bool bingo[3][3];
int main(void)
{
    ll a[3][3];
    rep(i,3)rep(j,3) cin>>a[i][j];
    ll n; cin>>n;
    ll b[n];
    rep(i,n) cin>>b[i];
    rep(i,3){
        rep(j,3){
            rep(k,n){
                if(b[k]==a[i][j]) bingo[i][j]=true;
            }
        }
    }
    string ans="No";
    rep(i,3){
        if(bingo[i][0] && bingo[i][1] && bingo[i][2]) ans="Yes"; //よこ
    }
    rep(i,3){
        if(bingo[0][i] && bingo[1][i] && bingo[2][i]) ans="Yes"; //たて
    }
    if(bingo[0][0] && bingo[1][1] && bingo[2][2]) ans="Yes";
    if(bingo[0][2] && bingo[1][1] && bingo[2][0]) ans="Yes";
    
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
	string s,t;
	int ans = 0;
	cin >> s >> t;
  
 	for (int i = 0; i < 3; ++i){
		if(s[i] == t[i]){
		ans += 1;
		};
  	};
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

class InverseTable:
    __slots__ = ['In', 'fac', 'Ifac']

    def __init__(self, mod, maxnum):
        self.In = [0, 1]; self.fac = [1, 1]; self.Ifac = [1, 1]
        for i in range( 2, maxnum + 1 ):
            self.In.append( ( -self.In[mod % i] * (mod//i) ) % mod )
            self.fac.append( ( self.fac[-1] * i ) % mod )
            self.Ifac.append( (self.Ifac[-1] * self.In[-1]) % mod )
        
    def cmb(self, n, r):
        if ( r<0 or r>n ): return 0
        r = min(r, n-r)
        return self.fac[n] * self.Ifac[r] * self.Ifac[n-r] % mod
    
    def per(self, n, r):
        if ( r<0 or r>n ): return 0
        return self.fac[n] * self.Ifac[n-r] % mod

invt = InverseTable(mod, 10**6)
# maxnum=10**6だとテーブル生成に200ms程かかるので（Pythonだと1000msほど）
# 最大生成領域は問題ごとに要検討

n,k=map(int,input().split())
for i in range(min(n,k+1)):
  ans += invt.cmb(n-1,n-i-1) * invt.cmb(n,i)
  # print(invt.cmb(n-1,n-i-1) * invt.cmb(n,i))
  ans %= mod
print(ans)

Measured memory_bytes: 128296
s=input()
ans=0
for i in range(2**(len(s)-1)):
    num=s[0]
    for j in range(len(s)-1):
        if (i>>j) & 1:
            ans+=int(num)
            num=""
        num+=s[j+1]
    if len(num)!=0:
        ans+=int(num)
print(ans)


Measured memory_bytes: 9084
using System;
using System.Collections.Generic;
using System.Linq;

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var list = new List<int>();

            for(int i = 0; i < N; ++i)
            {
                list.Add(int.Parse(Console.ReadLine()));
            }

            var rist = list.Distinct();

            int rl = rist.Count();

            Console.WriteLine(rl);
        }
    }
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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 vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
  ll N; cin >> N;
  ll ans = pow(10, 18) + 7;
  vector<ll> d = divisor(N);
  REP(i, d.size()) {
    ll tmp = 0;
    ll a = N / d[i];
    tmp = (a - 1) + (d[i] - 1);
    if(ans > tmp) ans = tmp;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3692
#include<iostream>
using namespace std;
const int MAXN=105;
int Array[MAXN];

int Print(int n){
	for(int i=0;i<n;i++){
		cout<<Array[i];
		if(i!=n-1)cout<<" ";
	}
	cout<<endl;
}

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>Array[i];
	}
	for(int i=0;i<n;i++){
		int key=Array[i];
		int j=i-1;
		while(j>=0&&Array[j]>key){
			Array[j+1]=Array[j];
			j--;
		}
		Array[j+1]=key;
		Print(n);
	}
	return 0;
}


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

int H;

void swap(int *i, int *j){
    int tmp = *i;
    *i = *j;
    *j = tmp;
}
void maxHeapify(int *A, int i){
    int l = 2*i;
    int r = 2*i + 1;
    int largest;
    if (l <= H && A[l] > A[i]){
        largest = l;
    }else{
        largest = i;
    }
    if (r <= H && A[r] > A[largest]){
        largest = r;
    }
    if (largest != i){
        swap(&A[i], &A[largest]);
        maxHeapify(A, largest);
    }else{
        return;
    }
}
void buildingMaxHeap(int *A){
    for (int i = H/2; i >= 1; i--) maxHeapify(A, i);
}
int main(int argc, char* argv[]) {
    scanf("%d", &H);
    int A[H+1];
    for (int i = 1; i < H+1; i++) scanf("%d", &A[i]);

    buildingMaxHeap(A);

    for (int i = 1; i < H+1; i++) printf(" %d", A[i]);
    printf("\n");
    return 0;
}



Measured memory_bytes: 5116
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <deque>
#include <queue>
#include <string>
#include <cstring>
#include <stack>

using namespace std;
typedef long long ll;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
#define V vector

int A;
ll B, N;

int main() {
    cin >> A >> B >> N;
    ll x = min(B-1, N);
    int res = (A*x/B);
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    if(b < 0) {
        return power(power(a, -b), mod-2);
    }
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 3e5+9;
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    map<int, int> f;  
    ll ans = 0;
    for(int i = 0; i < n; i++) {
        ans += f[i-a[i]];
        f[i+a[i]]++;
    }
    cout << ans << '\n';



    return 0;
    
}


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

int main(){
  int N, K, i, dis = 0;
  cin >> N;
  cin >> K;
  int x[N];
  for ( i = 0; i < N; i++)
  {
    cin >> x[i];
  }
  // manipulate
  for (i = 0; i < N; i++)
  {
    if (x[i] <= (K - x[i]))
    {
      dis += x[i] * 2;
    }else
    {
      dis += (K - x[i]) * 2;
    }
  }

  // output
  cout << dis << endl;


  return 0;
}

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

using vi = std::vector<int64_t>;

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

    int n; std::cin >> n;
    vi a(n);
    for (auto &e : a) std::cin >> e;
    std::sort(a.begin(), a.end(), std::greater<int64_t>());
    vi pairs;
    pairs.reserve(n);
    for (int i = 1; i < n; i++) {
        if (a[i] == a[i-1]) {
            pairs.push_back(a[i]);
            i++;
        }
    }
    pairs.push_back(0);
    pairs.push_back(0);
    std::cout << (pairs[0] * pairs[1]) << std::endl;
}


Measured memory_bytes: 1408
s = input()

year = int(s[0:2])
month = int(s[2:4])

mmy = False
yym = False

if 1 <= year <= 12:
    mmy = True
if 1 <= month <=12:
    yym = True
if mmy and yym:
    print('AMBIGUOUS')
elif yym:
    print('YYMM')
elif mmy:
    print('MMYY')
else:
    print('NA')


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

int main() {
    int n;
    std::cin >> n;

    std::vector<int> A(n);
    for (int i = 0; i < n; i++) {
        std::cin >> A[i];
    }

    int q;
    std::cin >> q;
    for (int i = 0; i < q; i++) {
        int k;
        std::cin >> k;
        auto range = std::equal_range(A.begin(), A.end(), k);
        int lower_bound = std::distance(A.begin(), range.first);
        int upper_bound = std::distance(A.begin(), range.second);
        std::cout << lower_bound << " " << upper_bound << std::endl;
    }
}



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

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

void insertionsort(int* A, int N);

int main () {
	int N;
	cin >> N;
	int A[N];
	FOR(i,0,N) cin >> A[i];
	FOR(i,0,N-1) cout <<  A[i] << " ";
	cout << A[N-1] <<  endl;
	insertionsort(A,N);
	
	
	return 0;
}

void insertionsort(int* A, int N) {
	int v;
	int j;
	FOR(i,1,N) {
		v = A[i];
		j = i-1;
		while(j>=0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		FOR(k,0,N-1) cout << A[k] << " ";
		cout << A[N-1] << endl;
	}
	
	
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,e,x,i,j,n,t,m,k,y;
    double p,q,r,w,u ;
    string str = "",str1 = "" ;
    ll a1,a2,b1,b2 ;
    cin>>a>>b>>c>>d ;
    cout<<(a-c)*(b-d) ;

}

Measured memory_bytes: 256
n = list(range(1,int(input())+1,2))
li = []
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
for i in range(len(n)):
    if len(make_divisors(n[i])) == 8:
        li.append(n[i])
print(len(li))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n,d[200001][70];
ll k;

int main(){
	ios::sync_with_stdio(0);
	cin>>n>>k;
	rep(i,n){
		cin>>d[i][0];
		d[i][0]--;
	}
	forn(j,1,65){
		rep(i,n){
			d[i][j]=d[d[i][j-1]][j-1];
		}
	}
	int now=0;
	int b=0;
	while(k){
		if(k%2){
			now=d[now][b];
		}
		b++;
		k/=2;
	}
	cout<<now+1;
	re 0;
}


Measured memory_bytes: 58300
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> c(n), deg(n, 0), ans(n, -1);
  vector<vector<int>> g(n);
  vector<pii> edges;
  for (int i = 1; i < n; i++) {
    int u ,v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
    edges.push_back({u, v});
    deg[u]++, deg[v]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(c.begin(), c.end());
  priority_queue<pii, vector<pii>, greater<pii>> pq;
  for (int i = 0; i < n ; i++) {
    pq.push({deg[i], i});
  }
  vector<int> order;
  vector<bool> visited(n, 0);
  while (!pq.empty()) {
    int v = pq.top().se;
    int d = pq.top().fi;
    pq.pop();
    if (visited[v] || d != deg[v]) continue;
    visited[v] = true;
    order.push_back(v);
    for (auto &u : g[v]) {
      deg[u]--;
      pq.push({deg[u], u});
    }
  }
  for (int i = 0; i < n; i++) {
    ans[order[i]] = c[i];
  }
  int M = 0;
  for (auto &el : edges) {
    M += min(ans[el.fi], ans[el.se]);
  }
  cout << M << "\n";
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}



Measured memory_bytes: 2044
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int main() {
    int N, K;
    while (~scanf("%d %d", &N, &K)) {
          map<int, int> mp;
          for (int i = 0; i < N; i++) {
              int tmp;
              scanf("%d", &tmp);
              if (!mp.count(tmp)) mp[tmp] = 1;
              else mp[tmp]++;
          }
          vector<pii> line;
          for (auto i : mp) line.push_back(make_pair(i.second, i.first));
          sort(line.begin(), line.end());
          int sz = (int)line.size();
          int ans = 0;
          for (int i = 0; i < (int)line.size() && sz > K; i++) {
              ans += line[i].first;
              sz--;
          }
          printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 11768
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
void chmax(ll &a, ll b) { if (a < b) a = b; }
void chmin(ll &a, ll b) { if (a > b) a = b; }

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

//C

//B
int main() {
	ll N;
	scanf("%lld", &N);

	ll temp = (ll)((double)N / 1.08);

	ll result = 0;

	if ((ll)((double)temp * 1.08) == N) {
		result = temp;
	}
	else if ((ll)((double)(temp - 1) * 1.08) == N) {
		result = temp - 1;
	}
	else if ((ll)((double)(temp + 1) * 1.08) == N) {
		result = temp + 1;
	}
	else {
		printf(":(\n");
		return 0;
	}

	printf("%lld\n", result);
}

//A
/*
int main() {
	ll M1;
	scanf("%lld", &M1);
	ll D1;
	scanf("%lld", &D1);
	ll M2;
	scanf("%lld", &M2);
	ll D2;
	scanf("%lld", &D2);

	ll result = 0;

	if (M1 != M2) {
		result = 1;
	}

	printf("%lld\n", result);
}
*/

Measured memory_bytes: 128
even = Hash.new(0)
odd = Hash.new(0)
count = 0
gets.chomp.split('').map do |x|
  if count.even?
    even[x] += 1
  else
    odd[x] += 1
  end
  count += 1
end
# p even
# p odd
pre1 = even["0"] + odd["1"]
pre2 = even["1"] + odd["0"]
puts pre1 <= pre2 ? pre1 : pre2


Measured memory_bytes: 7676
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
 int s,n,a[10001],max1;
 string b;

 int main()
 {
     cin>>n;
     cin>>b;
     for (int i=0;i<b.size();i++)
     {
         if (int(b[i])==73) s++;
         else s--;
         if (s>max1) max1=s;
     }
     cout<<max1;
 }

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

int main(){
  int X;
  int ans=1,p;
  cin >> X;
  for(int i=2;i<=40;i++){
    p=i;
    if(p*p>X) break;
    while((p*i)<=X){
      p*=i;
    }
   if(X!=1) ans=max(ans,p);
  }

  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 256
// Problem Matrix Maltiple

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    // Config
    Scanner sc = new Scanner(System.in);

    // Input
    String[] rowIn = sc.nextLine().split(" ");
    int n = Integer.parseInt(rowIn[0]);
    int m = Integer.parseInt(rowIn[1]);
    int l = Integer.parseInt(rowIn[2]);

    // Initialization
    int[][] A = new int[n][m];
    int[][] B = new int[m][l];
    long[][] C = new long[n][l];
    for(int i=0; i<n; i++){
      String[] tmp = sc.nextLine().split(" ");
      for(int j=0; j<m; j++){
        A[i][j] = Integer.parseInt(tmp[j]);
      }
    }
    for(int i=0; i<m; i++){
      String[] tmp = sc.nextLine().split(" ");
      for(int j=0; j<l; j++){
        B[i][j] = Integer.parseInt(tmp[j]);
      }
    }

    // Matrix Multiple
    for(int i=0; i<n; i++){
      for(int j=0; j<l; j++){
        long tmp = 0;
        for(int k=0; k<m; k++){
          tmp += A[i][k] * B[k][j];
        }
        C[i][j] = tmp;
      }
    }

    // Output
    for(int i=0; i<n; i++){
      for(int j=0; j<l-1; j++){
        System.out.print(C[i][j] + " ");
      }
      System.out.print(C[i][l-1]);
      System.out.println();
    }
  }
}



Measured memory_bytes: 35628
N = int(input())
A = []
W = [[] for i in range(N)]
for i in range(N):
    a = int(input())
    A.append(a)
    for j in range(a):
        a, b = input().split()
        W[i].append((int(a) - 1, int(b)))

L = 2 ** N
max_cnt = 0
for G in range(L):
    n = 0
    ok = True
    while n < N:
        if G & (1 << n) > 0:
            for i in range(A[n]):
                no = W[n][i][0]
                hl = W[n][i][1]
                c = 1 << no
                if (c & G > 0 and hl == 0) or (c & G == 0 and hl == 1):
                    ok = False
                    break

            if not ok:
                break
        n += 1
    if ok:
        cnt = bin(G)[2:].count('1')
        max_cnt = max(cnt, max_cnt)

print(max_cnt)






Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
int main() {
	int n; std::cin >> n;
	std::vector<int> numbers(n); for (auto& b : numbers) std::cin >> b;
	std::vector<int> result;
	for (auto i = 0; i < n; ++i) {
		int last_position = -1;
		for (auto j = 0; j + i < n; ++j) {
			if (j + 1 == numbers[j]) {
				last_position = j + 1;
			}
		}
		if (last_position != -1) {
			result.push_back(last_position);
			for (auto j = last_position; j + i < n; ++j) {
				std::swap(numbers[j], numbers[j - 1]);
			}
		}
		else break;
	}
	if (result.size() != n) {
		std::cout << -1 << std::endl;
	}
	else {
		for (auto i = 0; i < n; ++i) {
			if (i != 0) std::cout << '\n';
			std::cout << result[n - i - 1];
		}
	}
}

Measured memory_bytes: 256
/* ex7_3 
melo */
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int row_N,col_N,i,j;//整数の箱を４つ用意する
    char **arrayc;//二重ポインタ
    int *row_TorF, *col_TorF;//黒があるかないか判別する
    scanf("%d %d",&row_N,&col_N);//行と列を代入
    arrayc=(char**)calloc(row_N,sizeof(char*));//列分のint*型ポイント配列を確保して確保した領域を0に初期化する
    if(arrayc==NULL){//確保できなかった場合エラーを出す
        fprintf(stderr,"memory allocation error.\n");
        exit(1);
    }
    for(int i=0;i<row_N;i++){
        arrayc[i]=(char*)calloc(col_N,sizeof(char));//行分のint型の配列を各ポイントに対して確保して確保した領域を0に初期化する
        if(arrayc[i]==NULL){//確保できなかった場合エラーを出す
            fprintf(stderr,"memory allocation error.\n");
            exit(1);
        }
    }
    row_TorF=(int*)calloc(row_N,sizeof(int));//領域を確保して確保した領域を0に初期化する
    if(row_TorF==NULL){//確保できなかった場合エラーを出す
        fprintf(stderr,"memory allocation error.\n");
        exit(1);
    }
    col_TorF=(int*)calloc(col_N,sizeof(int));//領域を確保して確保した領域を0に初期化する
    if(col_TorF==NULL){//確保できなかった場合エラーを出す
        fprintf(stderr,"memory allocation error.\n");
        exit(1);
    }
    for(i=0;i<row_N;i++){//二次元の文字配列を代入
        for(j=0;j<col_N;j++){
            scanf(" %c",&arrayc[i][j]);
        }
    }
    for(i=0;i<row_N;i++){//黒がある行と列を探す
        for(j=0;j<col_N;j++){
            if(arrayc[i][j]=='#'){
                row_TorF[i]=1;//i列には黒がある
                col_TorF[j]=1;//i行には黒がある
            }
        }
    }
    for(i=0;i<row_N;i++){//白いマスのみからなる列または行以外（黒があった列または行）を表示する
        for(j=0;j<col_N;j++){
            if(row_TorF[i]==1&&col_TorF[j]==1){
                printf("%c",arrayc[i][j]);
            }
        }
        if(row_TorF[i]==1){
                printf("\n");//1列分表示されたら改行する
        }
    }
    free(row_TorF);//メモリ解放
    free(col_TorF);//メモリ解放
    for(int i=0;i<row_N;i++){//二次元のメモリ解放
        free(arrayc[i]);
    }
    free(arrayc);
    return 0;//正常終了
}

Measured memory_bytes: 1660
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  string s;
  cin >> s;
  
  sort(s.begin(),s.end());
  
  if(s[0]==s[1] && s[1] != s[2] && s[2] == s[3]){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	int s;
	int w;


	cin >> s >> w;

	if (w >= s) {
		cout << "unsafe";
		return 0;
	}
	cout << "safe";


	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int t = 0;
    for (int i = 0; i < 4; i++) {
        int k;
        cin >> k;
        t += k;
    }
    cout << t / 60 << "\n";
    cout << t - t / 60 * 60<< "\n";
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

const int mod = 1000000007;


struct Direction {
    int y, x;
};

vector<Direction> directions = {
        {0,  1},
        {1,  0},
        {0,  -1},
        {-1, 0},
};


bool reachable(int y, int x, int n) {
    if (x == -1 || x == n || y == -1 || y == n) return false;
    return true;
}


int main() {

    int n;
    cin >> n;

    vector<int> ps(n * n);
    vector<vector<int>> theater(n, vector<int>(n));
    vector<vector<bool>> is_exists(n, vector<bool>(n, true));

    rep(i, n * n) cin >> ps[i], ps[i]--;

    rep(y, n) rep(x, n) theater[y][x] = min({n - 1 - x, x, n - 1 - y, y});

    auto update = [&](int ys, int xs) -> void {
        queue<P> q;
        q.push(make_pair(ys, xs));
        while (!q.empty()) {
            P p = q.front();
            ll y = p.first, x = p.second;
            q.pop();

            for (Direction d : directions) {
                ll ny = y + d.y;
                ll nx = x + d.x;
                if (!reachable(ny, nx, n)) continue;

                if (theater[ny][nx] > theater[y][x] + is_exists[y][x]) {
                    theater[ny][nx] = theater[y][x] + is_exists[y][x];
                    q.push(make_pair(ny, nx));
                }

            }

        }
    };

    int ans = 0;
    rep(k, n * n) {
        int sy = ps[k] / n;
        int sx = ps[k] % n;

        ans += theater[sy][sx];
        is_exists[sy][sx] = false;
        update(sy, sx);
    }
    cout << ans << endl;
}


Measured memory_bytes: 5288
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
 
int n;
ll t[105];
 
ll lcm(ll a, ll b) {
	return a / __gcd(a, b) * b;
}
 
int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	ll l = 1;
	FOR(i, n) {
		cin >> t[i];
		if (t[i] % l) l = lcm(l, t[i]);
		else l = t[i];
	}
	cout << l << endl;
	return 0;
}

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

ifstream fin("pentagon.in");
ofstream fout("pentagon.out");

#define MOD 100019
#define NMAX 100005

int main()
{
   int a,b;
   cin>>a>>b;
   int c = 1;
   int ans = 0;
   while(c<b)
   {
      c--;
      c+=a;
      ans++;
   }
   cout<<ans;

   return 0;
}


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

int main()
{
    long  n, i,k;
    cin >> n;
    long a[n+1],b[n+1];
    for (int i=1;i<=n;i++)
        cin >> a[i];
    b[0]=999999;
    b[1]=0;

    for (i=2;i<=n;i++)

    {
        b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<b[n];

    return 0;
}


Measured memory_bytes: 1792
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

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

    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int r = sc.nextInt();
        int ans=0;
        
        if(n>=10){
            ans=r;
        }else{
            ans = r + 100*(10-n);
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 35700
//#define DEBUGGING  // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifndef DEBUGGING
#define debug(...)
#define DEBUG(...)
#else
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                     \
  do {                                 \
    cerr << " (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ": ";      \
    debug(__VA_ARGS__);                \
    cerr << endl;                      \
  } while (0)
#endif

const i64 INF = 1LL << 50;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int rev[4] = {1, 0, 3, 2};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 H, W, K;
  cin >> H >> W >> K;
  pair<i64, i64> start, goal;
  cin >> start.first >> start.second;
  cin >> goal.first >> goal.second;
  start.first--;
  start.second--;
  goal.first--;
  goal.second--;

  vector<string> grid(H);
  cin.ignore();
  REP(i, H) {
    getline(cin, grid[i]);
    assert(grid[i].size() == (size_t)W);
  }

  map<tuple<int, int>, i64> distm;
  auto get_dist = [&](int r, int c) -> i64 {
    auto it = distm.find({r, c});
    if (it == distm.end()) return INF;
    return it->second;
  };

  auto solve = [&]() -> i64 {
    deque<tuple<i64, int, int, int>> pq;
    pq.emplace_back(0LL, start.first, start.second, -1);
    while (pq.size()) {
      auto [d, r, c, dirs] = pq.front();
      d *= -1;
      pq.pop_front();
      if (grid[r][c] == '@') continue;
      if (get_dist(r, c) <= d) continue;
      if (r == goal.first && c == goal.second) return d;
      distm[{r, c}] = d;
      grid[r][c] = '@';
      DEBUG(r, c, d);
      REP(j, 4) {
        if ((dirs & (1 << j)) == 0) continue;
        for (int k = 1; k <= K; ++k) {
          int nr = r + dx[j] * k;
          int nc = c + dy[j] * k;
          if (nr < 0 || nr >= H) continue;
          if (nc < 0 || nc >= W) continue;
          if (grid[nr][nc] == '@') {
            break;
          }
          int ndirs = -1 & ~(1 << rev[j]);
          if (k < K) {
            ndirs &= ~(1 << j);
          }
          pq.emplace_back(-(d + 1), nr, nc, ndirs);
        }
      }
    }
    return -1LL;
  };
  i64 ans = solve();
  cout << ans << endl;
}


Measured memory_bytes: 68276
#include <bits/stdc++.h>
#define ll long long

using namespace std;
int n , k;
ll dp[100005];
ll a[100005];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    cin >> k;
    for (int i=0;i<n;i++)cin >> a[i];
    for (int i=1;i<n;i++)dp[i] = 1e18;
    for (int i=1;i<n;i++)
    {
        for (int j=1;j<=k;j++)
        {
            if (i - j >= 0)
            {
                dp[i] = min(dp[i] , dp[i - j] + abs(a[i] - a[i - j]));
            }
        }
    }
    cout << dp[n-1] << endl;
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
	if(a+b<10){
		cout << a+b << endl;
	}
	else{
		cout << "error" << endl;
	}
}

Measured memory_bytes: 256
#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

while True:
    N = input()
    if N == 0:
        break
    lst = []
    for i in range(N):
        S = raw_input()
        lst.append(len(S))
    for i in range(N):
        S = 0
        ll = []
        for j in range(i, N):
            S += lst[j]
            ll.append(S)
        if 5 in ll and 12 in ll and 17 in ll and 24 in ll and 31 in ll:
            print i + 1
            break
    pass


Measured memory_bytes: 5028
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
			final int num1 = cin.nextInt();
			final int num2 = cin.nextInt();
			final int num3 = cin.nextInt();
			final int num = num1 * 100 + num2 * 10 + num3;

			if (num % 4 == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
	}

}


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

const ll mod = 1e9 + 7;

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){
		y %= x;
		swap(x, y);
	}
	return y;
}


ll mpow(ll x, ll r){
	if(r == 1) return x;
	if(r % 2 == 1) return x * mpow(x, r-1) % mod;
	else{
		ll aa = mpow(x, r/2);
		return aa*aa%mod;
	}
}

ll N;
ll A[200010];
ll ans[200010];

ll solve(int num){
	
}

int main(){
	cin >> N;
	rep(i, N) cin >> A[i];
	if(N%2 == 0){
		ll cnt = 0, ans;
		rep(i, (N/2)+1){
			if(i==0){
				rep(j, N/2){
					cnt += A[2*j+1];
				}
				ans = cnt;
			}else{
				cnt -= A[2*i-1];
				cnt += A[2*i-2];
				if(cnt > ans) ans = cnt;
			}
		}
		cout << ans << endl;
	}else{
		ll dp[N+1];
		ll sum[N];
		for(int i=N-1; i>=0; i--){
			if(i%2==1) continue;
			if(i==N-1) sum[i] = A[i];
			else{
				sum[i] = A[i] + sum[i+2];
			}
		}
		rep(i, N+1){
			if(i<=1) dp[i] = 0;
			else{
				if(i%2==0){
					dp[i] = max(A[N-i]+dp[i-2], sum[N-i+1]);
				}else{
					dp[i] = max(sum[N-i+2], max(A[N-i]+dp[i-2], A[N-i+1]+dp[i-3]));
				}
			}
		}
		cout << dp[N] << endl;
	}
	return 0;
}


Measured memory_bytes: 8272
H, W = map(int, input().split())
#左右に'.'を余分に付けて標準入力からリストを作成
grid = [list('.'+input()+'.') for i in range(H)]
#上下にも付けてやる
grid.insert(0, list('.' * (W + 2)))
grid.append(list('.' * (W + 2)))

tmp = 0
for i in range(1, H + 1):
  for j in range(1, W + 1):
    if grid[i][j] == '#' and (grid[i-1][j:j+1]+grid[i][j-1:j+2]+grid[i+1][j:j+1]).count('#') == 1:
        tmp += 1

if tmp == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define fi first
#define se second
#define pb push_back
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1e9 + 3;
const int MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin >> s;
	fore(i, 0, (int)s.size() - 1) if (s[i] == s[i + 1]) {
		cout << "Bad\n";
		return 0;
	}
	cout << "Good\n";
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 10000000
int MAP[210][210];
int N,M,R;
int a,b,c;
int r[210];
int hamiton[210][210];
int visit[210];
set<int>s;
int ans=INT_MAX;
void dfs(int i,int dis)
{
    s.insert(i);
    if(s.size()==R)
    {
        if(dis<ans)
        {
            ans=dis;
        }
    }

    for(int j=0;j<R;j++)
    {
        if(!visit[j])
        {
            visit[j]=1;
            dfs(j,dis+hamiton[i][j]);
            visit[j]=0;
            s.erase(j);
        }
    }
}
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>N>>M>>R;
    fill(*MAP,*MAP+sizeof(MAP)/sizeof(int),inf);
    int temp;
    for(int i=0;i<R;i++)
    {
        cin>>temp;
        temp--;
        r[i]=temp;
    }
    for(int i=0;i<=N;i++)
    {
        MAP[i][i]=0;
    }
    for(int i=0;i<M;i++)
    {
        cin>>a>>b>>c;
        a--;
        b--;
        MAP[a][b]=c;
        MAP[b][a]=c;
    }

    for(int k=0;k<N;k++)
    {
        for(int i=0;i<N;i++)
        {
            for(int j=0;j<N;j++)
            {
                MAP[i][j]=min(MAP[i][k]+MAP[k][j],MAP[i][j]);
            }
        }
    }
    sort(r,r+R);
    for(int i=0;i<R;i++)
    {
        for(int j=0;j<R;j++)
        {
            hamiton[i][j]=MAP[r[i]][r[j]];
        }
    }
    for(int i=0;i<R;i++)
    {
        memset(visit,0,sizeof(visit));
        s.clear();
        visit[i]=1;
        dfs(i,0);
    }
    cout << ans <<endl;
    return 0;
}


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

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        vector<int> c(n);
        vector<vector<int>> a(n, vector<int>(m));
        rep (i, n) {
                cin >> c[i];
                rep (j, m) cin >> a[i][j];
        }

        int ans = numeric_limits<int>::max();
        rep (b, (1 << n)) {
                int t = 0;
                vector<int> now(m, 0);
                rep (i, n) {
                        if (b & (1 << i)) {
                                t += c[i];
                                rep (j, m) {
                                        now[j] += a[i][j];
                                }
                        }
                }
                bool f = all_of(now.begin(), now.end(), [&](int v) {
                        return v >= x;
                });

                if (f) ans = min(ans, t);
        }
                
        if (ans == numeric_limits<int>::max()) ans = -1;
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 3636
# ABC162a


def main():
    import sys
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    n = input()
    if n.find('7') != -1:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9036
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << "=" << x << endl
#define reps(i,s,n) for(int i = (int) (s); i < (int) (n); i++)
#define rep(i,n) reps(i,0,n)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

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

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define endl '\n'
const ll mod = 998244353;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    ll arr[n][3],dp[n][3];
    for(int i=0;i<n;i++){
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
        dp[i][0]=0;
        dp[i][1]=0;
        dp[i][2]=0;
    }
    dp[0][0]=arr[0][0];
    dp[0][1]=arr[0][1];
    dp[0][2]=arr[0][2];
    for(int i=1;i<n;i++){
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])+arr[i][0];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])+arr[i][1];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1])+arr[i][2];
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
}


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

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

Measured memory_bytes: 256