akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

ll gcd(ll a, ll b){
    ll temp;
	while (a % b != 0){
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

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

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};

ll digit__(ll num){
    ll cnt=1;
    while(num > 10){
        cnt ++;
        num /= 10;
    }
    return cnt;
}


int main(){
    int A,B,C;
    cin >> A >> B>>C;

    if (A==B && B!=C){
        cout << "Yes" << endl;
    }else if (B==C && C!=A){
        cout << "Yes" << endl;
    }else if (C==A && A!=B){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

input = sys.stdin.readline


N, M, S = map(int, input().split())
S = min(S, 2500)

row = []    #start
col = []    #end
data = []

for _ in range(M):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    for i in range(a, 2501):
        row.append(N * i + u)
        col.append(N * (i - a) + v)
        data.append(b)
        row.append(N * i + v)
        col.append(N * (i - a) + u)
        data.append(b)

for u in range(N):
    c, d = map(int, input().split())
    for i in range(1, c):
        row.append(N * (2500 - i) + u)
        col.append(N * 2500 + u)
        data.append(d)
    for i in range(c, 2501):
        row.append(N * (i - c) + u)
        col.append(N * i + u)
        data.append(d)

graph = csr_matrix((data, (row, col)), shape = (2501*N, 2501*N))

times = dijkstra(graph, directed  = True, indices = N * S)

for end in range(1, N):
    print(int(min(times[N * i + end] for i in range(2501))))

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

int main(){
	int n,k,m;
	vector<int>a;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>m;
		a.push_back(m);
	}
	int sum=0;
	sort(a.begin(),a.end());
	for(int i=n-1;i>n-1-k;i--){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int x;
  int y=0;
  int a[10000];
  for(int i=0; i<10000;i++){
  scanf("%d",&x);
  if(x==0) break;
  a[i]=x;
  y+=1;
  }
  for(int i=0;i<y;i++){
    printf("Case %d: %d\n",i+1,a[i]);
  }
  return 0;
}

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

using namespace std;

const int md = 1e9 + 7;

inline void add(int &x, int y) {
  x += y;
  if (x >= md) {
    x -= md;
  }
}

inline int mul(int x, int y) {
  return (long long) x * y % md;
}

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  vector<vector<int>> f(n, vector<int> (n));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      f[i][j] = a[i] > a[j];
    }
  }
  int coef = 1;
  while (m--) {
    coef = mul(coef, 2);
    int x, y;
    scanf("%d %d", &x, &y);
    --x;
    --y;
    f[x][y] = f[y][x] = mul(f[x][y] + f[y][x], md + 1 >> 1);
    for (int i = 0; i < n; ++i) {
      if (i != x && i != y) {
        f[i][x] = f[i][y] = mul(f[i][x] + f[i][y], md + 1 >> 1);
        f[x][i] = f[y][i] = mul(f[x][i] + f[y][i], md + 1 >> 1);
      }
    }
  }
  int answer = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      add(answer, f[i][j]);
    }
  }
  printf("%d\n", mul(answer, coef));
  return 0;
}


Measured memory_bytes: 37632
"""
N = 12
S = "..#..##.##.."
# expected => 4
"""
N = int(input())
S = input()
###


# black from left
vB = []
cntB = 0
vB.append(cntB)
for s in S:
    if s == "#":
        cntB += 1
    vB.append(cntB)

# white from right
vW = []
cntW = 0
for s in S[::-1]:
    vW.append(cntW)
    if s == ".":
        cntW += 1
vW.append(cntW)


#print(cntB, cntW)
#print(vB)
#print(vW[::-1])

print(min(b+w for b,w in zip(vB, vW[::-1])))


Measured memory_bytes: 14568
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>

using namespace std;

int main(){
  int N;
  cin>>N;
  long long a[100000];
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a,a+N,greater<long long>());
  long long r=0;
  for(int i=0;i<N-2;i++){
    if(a[i]<a[i+1]+a[i+2]){
      for(int j=i+3;j<N-2;j++){
	if(a[j]<a[j+1]+a[j+2]){
	  r=max(r,a[i]+a[i+1]+a[i+2]+a[j]+a[j+1]+a[j+2]);
	  break;
	}
      }
    }
  }
  for(int i=0;i<N-5;i++){
    vector<int> b(6);
    b[3]=b[4]=b[5]=1;
    do{
      vector<long long> v[2];
      for(int k=0;k<6;k++){
	v[b[k]].push_back(a[i+k]);
      }
      if(v[0][0]<v[0][1]+v[0][2]&&v[1][0]<v[1][1]+v[1][2]){
	r=max(r,v[0][0]+v[0][1]+v[0][2]+v[1][0]+v[1][1]+v[1][2]);
      }
    }while(next_permutation(begin(b),end(b)));
  }
  cout<<r<<endl;
}

Measured memory_bytes: 1996
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int mod;
void fx(vector<int> &a,int n, int m){

}

// -----------------------------------------------------------------------

int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}

// -----------------------------------------------------------------------



void q1(){
	int n;
	cin>>n;
	n*=(n+1);
	n/=2;
	cout<<n;
}
// -----------------------------------------------------------------------


void q2(){
	string s,t;
	cin>>s;
	t="";
	int skip=0;
	for(int i=(int)s.size()-1;i>=0;i--){
		if(s[i]=='B'){
			skip++;
		} else{
			if(skip>0){
				skip--;
			} else{
				t+=s[i];
			}
		}
	}
	for(int i=sz(t)-1;i>=0;--i)
	cout<<t[i];
}

// -----------------------------------------------------------------------

void q3(){
	int n;
	cin>>n;
	input(n);
	ld sum=0;
	for(int i=0;i<n;++i){
		sum+=arr[i];
	}
	sum/=n;
	//cout<<sum<<endl;
	int l=sum;
//	cout<<l<<endl;
	sum+=1.00;
	int u=sum;
//	cout<<u<<endl;
	int pp,p;
	pp=0;
	for(int i=0;i<n;++i){
		pp+=((arr[i]-l)*(arr[i]-l));
	}
//	cout<<pp<<endl;
	p=0;
	for(int i=0;i<n;++i){
		p+=((arr[i]-u)*(arr[i]-u));
	}
//	cout<<p<<endl;
	cout<<min(p,pp);
}


// -----------------------------------------------------------------------

void q4(){
	string s;
	cin>>s;
	int xp=sz(s);
	for(int i=0;i<xp-2;++i){
		if(s[i]==s[i+1]){
			cout<<i+1<<" "<<i+2<<endl;
			return ;
		}
		if(s[i]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return ;
		}
	}
	if(s[xp-1]==s[xp-2]){
		cout<<xp-1<<" "<<xp<<endl;
		return ;
	}
	cout<<"-1 -1\n";
	return ;
}

// -----------------------------------------------------------------------


int32_t main()
{
	mod=1e+7;
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	q3();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
string s;
int n=-1;
bool f1,f2;
int main(){
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(s[i]=='C'){
			n=i;
			f1=1;
			break;
		}
	}
	if(n==-1){
		cout<<"No";return 0;
	}
	for(int i=n+1;i<s.length();i++){
		
		if(s[i]=='F'){
			f2=1;
			break;
		}
	}
	if(f1==1&&f2==1)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
def double_dp(dp,num):
    dp_new = [0]*num
    for i in range(num):
        dp_new[i] = dp[dp[i]]
    return dp_new

S = input()
dp = [int(i) for i in range(len(S))]

for i in range(len(S)):
    dp[i] = dp[i] + 1 if S[dp[i]] == 'R' else dp[i] - 1

for _ in range(17):
    dp = double_dp(dp, len(S))
        
answer_dict = {i : 0 for i in range(len(S))}
for mass in dp:
    answer_dict[mass] += 1
print(' '.join(map(str,answer_dict.values())))

Measured memory_bytes: 23372
/*
If you want to shine like a sun, first burn like a sun.
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define vpi vector<ppi>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/

int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("in.txt",  "r",  stdin);
        freopen("out.txt", "w", stdout);
    #endif
//*/

        

        
    ll n;
    cin>>n;    

    ll i = 1;

    ll a = 0;
    for(; i*i < n; i++)
    {
        if(n%i == 0)
        {
            a = i;
        }
    }

    if(i*i == n) a = i;


    cout<<(a+n/a -2);





    return 0;
}

Measured memory_bytes: 256
import sys

*S, = input()

op = ['-', '+']
for i in op:
    for j in op:
        for k in op:
            e = f'{S[0]}{i}{S[1]}{j}{S[2]}{k}{S[3]}'
            if eval(e) == 7:
                print(f'{e}=7')
                sys.exit()

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define sbp(p, n) rep(i, n) { int a, b; scanf("%d %d", &a, &b); p[i] = make_pair(a, b); }
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;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	int n, h[20], m=0, ans = 0;
	cin >> n;
	rep(i, n){
		cin>> h[i];
		chmax(m, h[i]);
		if(h[i] >= m) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int MAX_N = 1000000;

bool sieve[MAX_N];
int num[MAX_N];

int main()
{
  memset(sieve, true, sizeof sieve);

  sieve[0] = sieve[1] = false;
  int n = 0;
  for (int i = 2; i < MAX_N; i++) {
    if (sieve[i]) {
      n++;
      for (int j = 2 * i; j < MAX_N; j += i) {
        sieve[j] = false;
      }
    }
    num[i] = n;
  }

  int a;
  while (scanf("%d", &a) != EOF) {
    printf("%d\n", num[a]);
  }

  return 0;
}



Measured memory_bytes: 7572
#include<bits/stdc++.h>
	using namespace std;
	#define ll  long long int
	#define ii pair<ll ,ll >
	#define pb push_back
	#define range 
	#define vi vector <ll >
	#define mod 1000000007
	#define eps 1e-9
	#define fi first
	#define se second
	#define _ <<" "<<
	#define forn(x,	n) for(long long ll x = 0; x < n ;++ x) 
	#define forn2(x, n) for(long long ll x = 1; x < n ;++ x) 
	#define forn1(x,n) for(ll x = 1; x <= n ;++ x)
	#define IOS ios_base::sync_left_iith_stdio();cin.tie(0);cout.tie(0);
		ll dp[20][2][140];
void func()
{
		for(ll i=0;i<20;i++)
	{
		for(ll j=0;j<2;j++)
		{
			for(ll k=0;k<140;k++)
			{
				dp[i][j][k] = -1;
			}
		}
 
		
	}
} 
ll sum(string &s,ll index,ll flag, ll diff)
{ if(s.length()==index)
	{if(diff==0)
	  { return 1;}
	  return 0;
	}
	if(diff<0)
		{ return 0;}
  ll limit=9;
if(flag){ limit=s[index]-'0';}
if(dp[index][flag][diff]!=-1){ return dp[index][flag][diff];}
ll ans=0;
for(ll i=0;i<=limit;i++)
 {
   ll nf=flag;

 if(i<limit){ nf=0;}
   
 ans+=sum(s,index+1,nf,diff-i);    
 }
 dp[index][flag][diff]=ans;
return ans;
}


int main()
{//freopen("test.txt","r", stdin);



  int k,x;
  cin>>k>>x;
  int t,y;
  t=x-k+1;
  y=x+k-1;
  for(int i=t;i<=y;i++)
  { 
    cout<<i<<" ";
  }
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;


class P
{
    static void Main()
    {
        var abq = Console.ReadLine().Split().Select(int.Parse).ToList();
        var s = Enumerable.Repeat(0, abq[0]).Select(_ => long.Parse(Console.ReadLine())).ToList();
        var t = Enumerable.Repeat(0, abq[1]).Select(_ => long.Parse(Console.ReadLine())).ToList();
        var x = Enumerable.Repeat(0, abq[2]).Select(_ => long.Parse(Console.ReadLine())).ToList();
        foreach (var place in x)
        {
            var sres = s.BinarySearch(place);
            long sbefdst = 0;
            long saftdst = 0;
            if (sres <= 0)
            {
                sres = ~sres;
                if (sres != 0) sbefdst = place - s[sres - 1];
                else sbefdst = long.MaxValue / 4;
                if (sres < s.Count) saftdst = s[sres] - place;
                else saftdst = long.MaxValue / 4;
            }
            var tres = t.BinarySearch(place);
            long tbefdst = 0;
            long taftdst = 0;
            if (tres <= 0)
            {
                tres = ~tres;
                if (tres != 0) tbefdst = place - t[tres - 1];
                else tbefdst = long.MaxValue / 4;
                if (tres < t.Count) taftdst = t[tres] - place;
                else taftdst = long.MaxValue / 4;
            }
            var res = Min(Max(sbefdst, tbefdst), Max(saftdst, taftdst));
            res = Min(res, Min(sbefdst + taftdst + Min(sbefdst, taftdst), tbefdst + saftdst + Min(tbefdst, saftdst)));
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 22316
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
vector <int> edges[100000];
bool done[100000];
void dfs(int cur){
  done[cur] = true;
  for(int i = 0; i < edges[cur].size(); i++){
    int next = edges[cur][i];
    if(!done[next]){
      dfs(next);
    }
  }
}

int main(void){
  int N;
  int M;
  cin >> N >> M;
  for(int i = 0; i < M; i++){
    int X;
    int Y;
    int Z;
    cin >> X >> Y >> Z;
    edges[X - 1].push_back(Y - 1);
    edges[Y - 1].push_back(X - 1);
  }
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(!done[i]){
      ans ++;
      dfs(i);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8960
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>	
using namespace std;
typedef long long ll;
#define bay_bay return 0;
#define fori(n) for(int i=0;i<n;++i)
#define for1(n) for(int i=1;i<=n;i+=3)
#define all(v) ((v).begin()), ((v).end())	
#define sz(v) v.size()
#define endl "\n"
constexpr auto EPS = 1e-9;
#define ff fflush(stdout);
const int mod = 1000000007;
clock_t T;
#define ctime cerr << "Time : " << double(clock() - T) / CLOCKS_PER_SEC << endl
void GOAT()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
#endif
}
ll solve(ll n)
{
	if (n == 1)
		return 1;
	else
		return 2 * solve(n / 2) + 1;
}
int main()
{

	//GOAT();
	ll n;
	cin >> n;
	cout << solve(n) << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to; int cost; };
vector<int>G[200006];
int dis[200006];
void dfs(int now,int par){
    rep(i,G[now].size()){
        int e=G[now][i];
        if(par!=e){
            dis[e]=min(dis[now]+1,dis[e]);
            dfs(e,now);
        }
        
    }
    
}

signed main(){
    int n;cin>>n;
    rep(i,n-1){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    fill(dis,dis+n,inf);
    dis[0]=0;
    dfs(0,-1);
    
    int mx=0,mm;
    rep(i,n){
        if(mx<dis[i]){
            mx=dis[i];
            mm=i;
        }
        
    }
    fill(dis,dis+n,inf);
    dis[mm]=0;
    dfs(mm,-1);
    int di=0;
    rep(i,n)di=max(di,dis[i]);
    
    if(di%3!=1)puts("First");
    else puts("Second");
    
}

Measured memory_bytes: 22144
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S;
  int flag = 0;
  int index;
  cin >> S;
  bool flag2 = false;
  int size = S.size();
  if(S[0]=='A'){
 
    for(int i = 2;i<size-1;i++){
      if(S[i]=='C'){
        flag++;
        index = i;
      }
    }
 
    if(flag == 1){
      for(int i = 0;i<size;i++){
        if((i==0) || (i==index)){
          continue;
        }
        if((S[i]<'a') || (S[i]>'z')){
          flag2 = true;
        }
      }
      if(flag2 == false){
        cout << "AC";
      }else{
        cout << "WA";
      }
    }else{
      cout << "WA";
    }
  }else{
    cout << "WA";
  }
 
  return 0;
 
}

Measured memory_bytes: 256
//
// Created by 52816 on 2020/1/30.
//
#include <bits/stdc++.h>
using namespace std;

int main(){
    char s[110];
    cin>>s;
    int flag=0;
    for(int i=0;i<strlen(s);++i){
        if(s[i]=='C'){
            for(int j=i+1;j<strlen(s);++j){
                if(s[j]=='F'){
                    flag=1;
                    break;
                }
            }
        }
    }
    if(flag)
        cout<<"Yes";
    else
        cout<<"No";
}


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

int main(){
    int64_t N, T, t[200001];
    
    cin >> N >> T;
    for(int i=0;i<N;i++) cin >> t[i];
    t[N] = t[N-1] + T;

    int64_t ans = 0;
    for(int i=1;i<=N;i++) ans += min(t[i]-t[i-1], T);

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

Measured memory_bytes: 1792
import sys

def main(inp):
    S=next(inp)
    l=len(S)-1
    ns=int(S,2)
    
    wh=1
    bl=0
    for i in range(l-1):
        if(i%2==0): 
            wh = (wh << 1)
            bl = (bl << 1) + 1
        else: 
            wh = (wh << 1) +1
            bl = (bl << 1)
            
    return min(bin(ns^wh).count("1"),bin(ns^bl).count("1"))
    
print(main(sys.stdin))

Measured memory_bytes: 3316
def Eratosthenes(x: int) -> set:
    from math import sqrt
    sup = int(x)
    primes = {i for i in range(2, sup+1)}
    for i in range(2, int(sqrt(sup+1))+1):
        if i in primes:
            mul = 2
            while i*mul <= sup:
                primes.discard(i*mul)
                mul += 1
    return primes


def main():
    import sys
    input = sys.stdin.buffer.readline
    P = Eratosthenes(10**5+5)
    A = [0]*(10**5+5)
    for i in range(3, 10**5+5):
        if i in P and (i+1)//2 in P:
            A[i] = 1
    from itertools import accumulate
    S = list(accumulate(A))
    Q = int(input())
    LR = [[int(i) for i in input().split()] for j in range(Q)]
    for le, ri in LR:
        print(S[ri] - S[le-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 67172
#include<stdio.h>
main(){
  int a,b,s,i;
  while(scanf("%d %d",&a,&b) !=EOF){
    s=0;
    s=a+b;
    for(i=1;s>=10;i++){
      s/=10;
    }
    printf("%d\n",i);
  }
  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
using namespace std ;

int main(){
	char s[4] ;
  	scanf ("%s",s);
  	if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
    	printf("Bad");
    } else {
    	printf("Good");
    }
  	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
  #include "_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  string s, t; cin >> s >> t;

  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    ans += (s[i] != t[i]);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3920
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX_N 100000
using namespace std;
const int MOD=1000000007;

struct union_find {
	int par[MAX_N];
	int Size[MAX_N];
	union_find(int n) {
		for (int i = 0; i < n; i++) {
			par[i] = i;
			Size[i] = 1;
		}
	}
	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	void unite(int x, int y) {
		if (same(x, y))return;
		Size[root(x)] += Size[root(y)];
		par[root(y)] = root(x);
	}
};

int main(){
    int n,k,m,i,j;
    cin>>n>>m>>k;
    struct union_find U(n);
    vector<int> a(m),b(m);
    vector<int> c(k),d(k);
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
    }
    rep(i,k){
        cin>>c[i]>>d[i];
        c[i]--; d[i]--;
    }

    vector<int> dele(n,0);
    rep(i,m){
        U.unite(a[i],b[i]);
        dele[a[i]]++,dele[b[i]]++;
    }
    rep(i,k){
        if(U.same(c[i],d[i])) dele[c[i]]++,dele[d[i]]++;
    }
    int ans;
    rep(i,n){
        ans=U.Size[U.root(i)]-1-dele[i];
        cout<<ans<<" ";
    }
    cout<<endl;
    return 0;
}

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

int main(void) {
  double l;
  cin >> l;
  double a, b, c;
  a = b = c = l / 3;
  cout << fixed << setprecision(10);
  cout << a * b * c << '\n';
  return 0;
}

Measured memory_bytes: 3760
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace


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

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPM(i,n) for(int i=n;i>=0;i--)

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    string s;
    cin>>s;
    int min_=100000;
    if(s.find("0")==-1 || s.find("1")==-1)min_=s.size();
    else{
        FOR(k,1,s.size()){
            bool t = s.at(k-1)==s.at(k);
            if(!t){
                int max_=max(k,(int)s.size()-k);
                min_=min(min_,max_);
            }
        }
    };
    cout<<min_<<endl;
}


Measured memory_bytes: 512
import copy
class Node():
    def __init__(self, parent = -1, left = -1, right = -1):
        self.parent = parent
        self.left = left
        self.right = right
        
    def __eq__(self, other):
        if self.num == other.num:
            return True
        else:
            return False

def insert(node, z):
    global root
    p = -1
    x = root
    while x != -1:
        p = x
        if z < x:
            x = node[x].left
        else:
            x = node[x].right
    
    if p == -1:
        root = z
        node[z] = Node()
    elif z < p:
        node[p].left = z
        node[z] = Node(p)
    else:
        node[p].right = z
        node[z] = Node(p)
        
def preorder(node, i):
    print(" " + str(i), end ="")
    if node[i].left != -1:
        preorder(node, node[i].left)
    if node[i].right != -1:
        preorder(node, node[i].right)

def inorder(node, i):
    if node[i].left != -1:
        inorder(node, node[i].left)
    print(" " + str(i), end ="")
    if node[i].right != -1:
        inorder(node, node[i].right)
        
n = int(input())
node = {}
root = -1
for i in range(n):
    s = input()
    if s == "print":
        inorder(node, root)
        print()
        preorder(node, root)
        print()
    else:
        s = s.split()
        insert(node, int(s[1]))



Measured memory_bytes: 126224
n = int(input())
a = list(map(int, input().split()))

nums = [0]*(10**5+1)
for i in a: nums[i] += 1

t = sum(nums[:3])
ans = t
for i in range(3,10**5+1):
  t = t - nums[i-3] + nums[i]
  if ans < t: ans = t
print(ans)

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

inline void chmin(long long &a, long long b){
  a = a>b ? b : a ;
}

int main(){

  long long N, dp[1000000];
  cin >> N;

  const long long INF = 100001;
  For(i, 100001) dp[i] = INF;
  dp[0] = 0;

  for(int i=0; i<N; i++){
    chmin(dp[i+1], dp[i] + 1);
    for(int j=1; j<7; j++){
      long long six = pow(6,j);
      long long nine = pow(9,j);
      chmin(dp[i+six], dp[i] + 1);
      chmin(dp[i+nine], dp[i] + 1);
    }
  }

  cout << dp[N] << endl;

  return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MAX_V 100005

using namespace std;
typedef long long ll;

const int mod = 1e9 + 7;

int fib[MAX_V];
int n, m;

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

    int lf = 0;
    fib[0] = 1;
    for (int k = 0; k < m; k++) {
        int x;
        cin >> x;
        for (int i = lf + 1; i < x; i++)
            fib[i] = (fib[i-1] + (i > 1 ? fib[i-2] : 0)) % mod;
        lf = x;
        fib[x] = 0;
    }
    for (int i = lf + 1; i <= n; i++)
        fib[i] = (fib[i-1] + (i > 1 ? fib[i-2] : 0)) % mod;
    cout << fib[n] << endl;

    return 0;
}

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

int main(){
    int n;cin>>n;
    vector<int> h(n);
    rep(i,n) cin>> h[i];
    vector<int> dp(n,0);
    dp[1]=abs(h[1]-h[0]);
    rept(i,2,n){
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define ll long long
using namespace std;

ll i,j,k;
const ll MOD = 1000000000 + 7;

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    string ans="NG";
    if(b%n<=b-a){
        ans="OK";
    }
    
    cout<<ans<<'\n';

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    long double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    long double ma = max({hypot(x2-x1, y2-y1), hypot(x3-x2, y3-y2),hypot(x3-x1,y3-y1)});
    long double S = fabs((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1))/2.0;
    long double r = 2*S/(hypot(x2-x1, y2-y1)+hypot(x3-x2, y3-y2)+hypot(x3-x1,y3-y1));
    cout << setprecision(20) << r*ma/(2*r+ma) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  long int k,x;
  scanf("%ld%ld",&k,&x);
  if(x-k+1<-100000){
    for(int i=1;i<=x-1000000+k;i++){
    	printf("%d ",i-1000001);
    }
   return 0;
  }
  if(x+k-1>1000000){
    for(int i=1;i<=1000000-x+k;i++){
      printf("%d ",1000001-i);
    }
    return 0;
  }
  else{
    for(int i=1;i<=2*k-1;i++){
      printf("%d ",x-k+i);
    }
  }
  return 0;
}



Measured memory_bytes: 128
n = int(input())
aList = list(map(int, input().split()))
count = 0
change = 0
for i in range(1, n):
    if aList[i - 1] == aList[i]:
        pass
    elif aList[i - 1] < aList[i]:
        if change == -1:
            count += 1
            change = 0
        else:
            change = 1
    else:
        if change == 1:
            count += 1
            change  = 0
        else:
            change = -1
    i += 1
print(count + 1)

Measured memory_bytes: 15020
/* *********************************
Author        :clogos
Created Time  :2016/10/29 21:27:30
File Name     :B.cpp
********************************** */

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);
using namespace std;
const int N = 200000 + 10;
int n, x, a[N];

int main()
{
	scanf("%d%d", &n, &x);	
	if(x == 1 || x == 2 * n - 1) { puts("No"); return 0; }
	puts("Yes");
	a[n] = x; a[n-1] = 1; a[n+1] = x+1;
	int s = 2;
	for(int i = 1; i < 2 * n; ++i) if(a[i] == 0) {
		if(s == x) s += 2;
		a[i] = s++;
	}
	for(int i = 1; i < 2 * n; ++i) printf("%d\n", a[i]);
	return 0;
}


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

int main() {
    long long a, b, c, d; cin >> a >> b >> c >> d;
    long long acd = max(a*c, a*d);
    long long bcd = max(b*c, b*d);
    cout << max(acd, bcd) << endl;
}

Measured memory_bytes: 3604
import java.util.Arrays;
import java.util.Scanner;

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

        int[] A = new int[3];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

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

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    }
}

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

const int N = 1e5+10;
struct qyx{int num, d, ans;} p[N];
int vis[N], deep[N];
int len=0, cnt=0, sum, n, m, Q;

vector<int> e[N];

void Insert(int a, int b, int c) {
	p[++cnt].num = a;
	p[cnt].d = b;
	p[cnt].ans = c;
}

void dfs(int k, int d, int ans, int fa) {
	if(deep[k]>d) return;
	deep[k] = d;
	if(!vis[k]) vis[k] = ans, sum--;
	for(int i = 0; i<e[k].size(); i++) {
		int y = e[k][i];
		if(y == fa) continue;
		if(d) dfs(y, d-1, ans, k);
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1, v, u; i <= m; i++) {
		scanf("%d%d", &u, &v);
		e[v].push_back(u);
		e[u].push_back(v);
	}
	scanf("%d", &Q);
	for(int i = 1,u, v, w; i <= Q; i++) {
		scanf("%d%d%d", &u, &v, &w);
		Insert(u, v, w);
	}
	sum = n;
	for(int i = Q; i >= 1&&sum; i--) 
		dfs(p[i].num, p[i].d, p[i].ans, 0);	
	for(int i = 1; i <= n; i++)
		printf("%d\n", vis[i]);
	return 0;
}

Measured memory_bytes: 8440
//"push hoge"と言われたらhogeを最後に入れ、"pop"と言われたら最後尾を取りだす。"quit"で終わり。
#include<iostream>
using namespace std;

int main(){
	int a,b,hoge = 0,j=0;
	int gcd,gcds,lcm,lcms;

	while(cin >> a >> b){
		//最大公約数
		if(a > b){
			lcm = b;
			lcms = a;
		}else{
			lcm = a;
			lcms = b;
		}
		for(int i=1;i<=lcm;i++)
			if(!(lcms % (lcm / i)) && !(lcm % i)) {
				lcm = lcm / i;
				break;
			}
	
		j = 0;
		//最小公倍数
		if(a > b){
			gcd = a;
			gcds = b;
		}else{
			gcd = b;
			gcds = a;
		}
		while(1){
			j++;
			hoge = gcd * j;
			if(!(hoge % gcds)){
				gcd = hoge;
				break;
			}
		}

		cout << lcm << " " << gcd << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3
#ABC105 D

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = list(accumulate(a))
b = list(map(lambda x:x % m,a))
b = list(Counter(b).items())

ans = 0
for i,j in b:
    if j >= 2:
        #nC2
        ans += j*(j-1)//2
    if i == 0:
        ans += j
print(ans)


Measured memory_bytes: 63768
# ビンゴの番号の入力
bingo = {}
for _ in range(3):
    l = list(map(int, input().split()))
    for i in range(3):
        bingo[l[i]] = 0

# 番号があれば該当の値を1にする
n = int(input())
for _ in range(n):
    x = int(input())
    if x in bingo:
        bingo[x] = 1

# 辞書の値をリストに変換
b = list(bingo.values())

# ビンゴ達成の判定(未達成ならflg==0になる)
flg = b[0] * b[1] * b[2]
flg += b[3] * b[4] * b[5]
flg += b[6] * b[7] * b[8]
flg += b[0] * b[3] * b[6]
flg += b[1] * b[4] * b[7]
flg += b[2] * b[5] * b[8]
flg += b[0] * b[4] * b[8]
flg += b[2] * b[4] * b[6]

# 出力
print(["Yes", "No"][flg == 0])

Measured memory_bytes: 9108
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;
int n,d;
int x[100001];
int ans=0;
int main(){
  cin >> d >> n;
  if(d==0){ans=n;if(n==100)ans=101;}
  else if(d==1){ans=100*n;if(n==100)ans=10100;}
  else {ans=10000*n;if(n==100)ans=1010000;}
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	string s, t; cin >> s >> t;
	int ans = 1e7, slen = s.size(), tlen = t.size();
	for (int i = 0; i + tlen - 1 < slen; i++) {
		int temp = 0;
		for (int j = 0; j < tlen; j++) {
			if (s[i + j] != t[j]) temp++;
		}
		ans = min(ans, temp);
	}

	cout << ans << endl;


}


Measured memory_bytes: 3608
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>

int p,q,a,n;

int func(int turn,int last,int product,int c,int d){
  if(p*d==c*q)return 1;
  if(!turn)return 0;
  
  int count=0;
  for(int i=last;product*i<=a;i++){
    if(c/d+1/i<=p/q)
      count+=func(turn-1,i,product*i,i*c+d,i*d);
  }  
  return count;
}

int main(void){
  
  while(scanf("%d %d %d %d",&p,&q,&a,&n),p,q,a,n){
    printf("%d\n",func(n,1,1,0,1));
  }
  
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
int mp[1001][1001],dp[1001][1001];;
int h,w,n;

void saiki(int x,int y){
  int dx[]={0,1},dy[]={1,0};
  if(y==h||x==w)cout << y+1<<" "<<x+1<<endl;
  else  saiki(x+dx[mp[y][x]],y+dy[mp[y][x]]);
}

int main(){
  while(1){
    cin>>h>>w>>n;
    if(!h&&!w&&!n)break;

    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)cin>>mp[i][j];
    memset(dp,0,sizeof(dp));
    dp[0][0]=n-1;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	dp[i][j+1]+=dp[i][j]/2+mp[i][j]*dp[i][j]%2;
	dp[i+1][j]+=dp[i][j]/2+!mp[i][j]*dp[i][j]%2;
	if(dp[i][j]%2)mp[i][j]=!mp[i][j];
      }

    saiki(0,0);
  }


  return 0;
}

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

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;

  int e_all=0,w_all=0;
  rep(i,n){
    if(s.at(i)=='E') e_all++;
    else w_all++;
  }

  int ans=n;
  int w=0, e=0;
  rep(i,n){
    int p = w + e_all - e;
    if(s.at(i)=='E') p--;
    ans = min(p, ans);
    
    if(s.at(i)=='E') e++;
    else w++;
  }

  cout << ans;
}

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

int main(){
    int D;
    std::cin >> D;
    std::vector< int > C(26);
    std::vector< int > cur_bad(26);
    for(int i=0; i<26; i++){
        std::cin >> C[i];
        cur_bad[i] = C[i];
    }
    std::vector< std::vector< int > > S(D, std::vector< int >(26));
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            std::cin >> S[i][j];
        }
    }
    std::vector< int > T(D);
    
    std::vector< int > qD_list;
    std::vector< int > Q_list;
    
    for(int i=0; i<D; i++){
        std::priority_queue< std::pair< int, int > > pq;
        for(int j=0; j<26; j++){
            int score = S[i][j] + cur_bad[j];
            std::pair< int, int > tmp;
            tmp.first = score;
            tmp.second = j;
            pq.push(tmp);
        }
        std::pair< int, int > tmp = pq.top();
        int max_index = tmp.second;
        T[i] = max_index + 1;
        cur_bad[max_index] = 0;
        for(int j=0; j<26; j++){
            cur_bad[j] += C[j];
        }
        
        for(int j=0; j<10; j++){
            tmp = pq.top();
            pq.pop();
            qD_list.push_back(i);
            Q_list.push_back(tmp.second);
        }
    }
    
    long long score = 0;
    std::vector< int > lasta(26, 0);
    for(int i=0; i<D; i++){
        score += S[i][T[i] - 1];
        lasta[T[i] - 1] = i + 1;
        for(int j=0; j<26; j++){
            score -= (i + 1 - lasta[j]) * C[j];
        }
    }
    
    for(int trial=0; trial<50; trial++){
        for(int q=0; q<(int)qD_list.size(); q++){
            int qD = qD_list[q];
            int Q = Q_list[q] + 1;
            int pre = T[qD];
            
            T[qD] = Q;
            long long ans = 0;
            std::vector< int > last(26, 0);
            for(int i=0; i<D; i++){
                ans += S[i][T[i] - 1];
                last[T[i] - 1] = i + 1;
                for(int j=0; j<26; j++){
                    ans -= (i + 1 - last[j]) * C[j];
                }
            }
            if(score < ans){
                score = ans;
            }else{
                T[qD] = pre;
            }
        }
    }
    
    
    
    
    for(int i=0; i<D; i++){
        std::cout << T[i] << std::endl;
    }
    
    //std::cout << score << std::endl;
    
    return 0;
}



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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll a[1111];
ll n;

int main(){
	a[0]=2;
  a[1]=1;
  cin>>n;
  repl(i,2,n+1)a[i]=a[i-1]+a[i-2];
  cout<<a[n]<<endl;
	return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;


const int B = 1000;

signed main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  int a, b, c;
  int ans = 0;

  cin >> a >> b >> c;

  if (min({a, b, c}) == max({a, b, c})) {
      if (a % 2 == 0)
          cout << "-1\n";
      else
          cout << "0\n";
      return 0;
  }

  while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
      int x = (a + b) / 2;
      int y = (b + c) / 2;
      int z = (c + a) / 2;
      a = x, b = y, c = z;
      ++ans;
  }

  cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n);i++)
#define rep1(i,n) for(int i=1; i<(n); i++)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;
const int mod = 1e9+7;

struct edge{
    int src, to, cost;
};
using Edges = vector<edge>;
using WeightedGraph = vector<Edges>;
using pi = pair<int, int>;

pi dfs(WeightedGraph &G, int idx, int src){
    pi res(0, idx);
    for(auto &e : G[idx]) {
        if(e.to == src) continue;
        pi cost = dfs(G, e.to, idx);
        cost.first += e.cost;
        res = max(res, cost);
    }
    return res;
}

int tree_diameter(WeightedGraph &G)
{
    auto far = dfs(G, 0, -1);
    auto res = dfs(G, far.second, -1);
    return (res.first);
}

int main(){
    int n;
    cin >> n;
    WeightedGraph G(n);
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back((edge){a, b, 1});
        G[b].push_back((edge){b, a, 1});
    }
    int grundy = (tree_diameter(G)+2) % 3;
    cout << (grundy==0 ? "Second" : "First") << endl;

}

Measured memory_bytes: 26752
#include <stdio.h>

int main(void)
{	
	int x,y,i;
	
	int group_1[]={1,3,5,7,8,10,12};
	int group_2[]={4,6,9,11};
	
	scanf("%d%d",&x,&y);
	
	
	switch(x){
		
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
		
		for(i=0;i<7;i++){
			if(y==group_1[i]){
				printf("Yes");
				break;
			}
			else if(i==6){
				printf("No");
			}
		}
		break;
		
		case 4:
		case 6:
		case 9:
		case 11:
		
		for(i=0;i<4;i++){
			if(y==group_2[i]){
				printf("Yes");
				break;
			}
			else if(i==3){
				printf("No");
			}
		}
		break;
		
		default:
		
		printf("No");
		break;
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

/*
 * Dependencies: typedef long long ll
 * Headers: iostream
 * Verified by: ARC099-F
 *              https://beta.atcoder.jp/contests/arc099/submissions/2743855
 */

template<ll mod = (ll)1e9 + 7>
struct ModInt {
  ll x;
  ModInt(void): x(0) {}
  ModInt(ll x): x(x % mod){}
  ModInt(const ModInt &x): x(x.x) {}
  ModInt operator+(ModInt o) const {
    ll y = x + o.x;
    if (y >= mod) y -= mod;
    return ModInt(y);
  }
  ModInt operator-(ModInt o) const {
    ll y = x - o.x + mod;
    if (y >= mod) y -= mod;
    return ModInt(y);
  }
  ModInt operator*(ModInt o) const {
    return ModInt((x * o.x) % mod);
  }
  void operator+=(ModInt o) { *this = *this + o; }
  void operator-=(ModInt o) { *this = *this - o; }
  void operator*=(ModInt o) { *this = *this * o; }
  ModInt operator-(void) const { return ModInt() - *this; }
  ll to_ll() const {
    return x;
  }
  bool operator<(ModInt o) const {
    return x < o.x;
  }
  ModInt pow(ll e) {
    assert (e >= 0);
    ModInt sum = 1;
    ModInt cur = *this;
    while (e > 0) {
      if (e % 2) {
        sum = sum * cur;
      }
      cur = cur * cur;
      e /= 2;
    }
    return sum;
  }
  ModInt inv(void) {
    return pow(mod - 2);
  }
};

template<ll mod>
ostream &operator<<(ostream &os, ModInt<mod> mi) {
  return os << mi.x;
}

const int H = 100;
const int W = 8;
ModInt<> dp[H + 1][W];

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  k--;
  dp[0][0] = 1;
  REP(i, 0, h) {
    REP(bits, 0, 1 << (w - 1)) {
      VI u;
      REP(j, 0, w - 1) {
        if (bits & 1 << j) u.push_back(j);
      }
      bool ok = 1;
      REP(j, 0, (int) u.size() - 1) {
        if (u[j] + 1 == u[j + 1]) {
          ok = 0;
          break;
        }
      }
      if (not ok) continue;
      REP(j, 0, w) {
        int nxt = j;
        if (bits & 1 << j) nxt++;
        if (bits & 1 << (j - 1)) nxt--;
        dp[i + 1][nxt] += dp[i][j];
      }
    }
  }
  cout << dp[h][k] << endl;
}


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
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;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
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...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  string s;cin>>s;
  s.insert(s.begin()+4,' ');
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256