akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back
#define popf pop_front
#define int long long int
#define vi         vector<int>
#define vll        vector<ll>
#define vpii       vector<pair<int,int>>
#define vpll       vector<pair<ll,ll>>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(container) int((container).size())
#define rep(i,a,b) for(i=a;i<b;i++)
#define tr(container,it)   for(auto it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mod 998244353
#define fs first
#define sc second
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
void solve()
{
  int n,m,i,j,k,l;
  string s;
  cin>>s;
  n=s.size();
  i=0,j=n-1;
  if(s.size()==1)
    {
      cout<<"Yes";
      return;
    }
  while(i<=j && s[i]==s[j])
  {
    i++;
    j--;
  }
  if(s[i]!=s[j])
    cout<<"No";
  else
  {
    s='.'+s;
    i=1,j=(n-1)/2;
    while(i<=j && s[i]==s[j])
    {
      i++;
      j--;
    }
    if(i>=1 && i<=n && j>=1 && j<=n&&s[i]!=s[j])
      cout<<"No";
    else
    {
      i=(n+3)/2,j= n;
      while(i<=j && s[i]==s[j])
    {
      i++;
      j--;
    }
    if(i>=1 && i<=n && j>=1 && j<=n&&s[i]!=s[j])
      cout<<"No";
    else
      cout<<"Yes";
    }
  }
}
signed main()
{
  fastio
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  int t;
  t=1;
  //cin>>t;
  while(t--)
  solve();
  TIME
  return 0;
}

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

int main(){
	int A,B,C;
	cin >> A >> B >> C;
	
	if(A<B){
		if(A<C && B>C){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	}
	else{
		if(B<C && A>C){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	}
	
	
}

Measured memory_bytes: 256
combined = input().split(" ")
n = int(combined[0])
a = int(combined[1])
b = int(combined[2])

if n % (a + b) < a:
    print((int(n / (a + b)) * a) + (n % (a + b)))
else:
    print((int(n / (a + b)) * a) + a)


Measured memory_bytes: 2940
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  else:
    for r in range(H):
      for c in range(W):
        if r == 0 or r == H - 1 or c == 0 or c == W - 1:
          print('#', end = '')
        else:
          print('.', end = '')
      print()
    print()


Measured memory_bytes: 7000
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
  int w,h,n;
  cin>>w>>h>>n;
  int x,y,a;
  int lx=0,rx=w,uy=h,dy=0;
  rep(i,n){
    cin>>x>>y>>a;
    if(a==1)lx=max(lx,x);
    else if(a==2)rx=min(rx,x);
    else if(a==4)uy=min(uy,y);
    else dy=max(dy,y);
  }int ansx=rx-lx,ansy=uy-dy;
  if(rx-lx<=0)ansx=0;
  if(uy-dy<=0)ansy=0;
  cout<<ansx*ansy<<endl;
}

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

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int ans=0;
		for(int i=0;i<26;i++)
		{
			int check=0;
			for(int j=0;j<4;j++)
			{
				if(s.charAt(j)-'A'==i)
				{
					check++;					
				}				
			}
			if(check!=0&&check!=2)
			{
				ans=1;
			}			
		}
		if(ans==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}
	

Measured memory_bytes: 21844
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		char[] c = new char[3];
		for(int i=0; i<3; i++){
			c[i] = s.charAt(i);
		}
		Arrays.sort(c);
		System.out.println((c[0] == 'a' && c[1] == 'b' && c[2] == 'c') ? "Yes" : "No");
	}
}


Measured memory_bytes: 35552
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e5 + 5, M = 2 * N + 5;

ll a, b, n, mx;

void check(ll x){
    if(x > n)return ;
    ll A = (a * x) / b;
    ll B = (a * (x / b));
    mx = max(mx, A - B);
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
#endif
    scanf("%lld %lld %lld", &a, &b, &n);
    if(n >= b - 1)check(b - 1);
    else check(n);
    printf("%lld\n", mx);
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
 int main(void)
{
	long long int sum= 0;
	long long int k;
	scanf("%lld", &k); 
	for(long long int i=1;i<=k;i++)
	{
		for(long long int j=1;j<=k;j++)
		{
			for(long long int o=1;o<=k;o++)
			{
				long long int oof = gcd(j, o);
				sum = sum + gcd(i, oof);

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

}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

signed main(){
  ll n;cin>>n;
  multiset<ll,greater<ll>> t;//見たならtrue
  rep(i,n)
  {
    ll a;cin>>a;
    auto itr=t.upper_bound(a);
    if(t.end()!=itr)t.erase(itr);
    t.insert(a);
  }
  cout<<siz(t)<<endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007

using namespace std;
#define ll long long
#define dbg if(0)

int main(){
    ll a,b,c,ans;
    cin >>a>>b>>c;
    ans=b+min(a+b,c);
    if(a+b<c)ans++;
    cout <<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	vector<LL> v;
	for(int i=0; i<3; i++){
		LL u;
		cin >> u;
		v.push_back(u);
	}
	sort(v.begin(), v.end());

	LL ans = 10*v[2] + v[1] + v[0];
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 3752
//Colorful Transceivers
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d || (abs(a-b)<=d&&abs(b-c)<=d) )  cout<<"Yes"<<endl;
    else                                            cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<char> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int l = 0;
	int r = n - 1;
	int ans = 0;
	while (r > l) {
		while (l < r && a[l] == 'R') {
			l++;
		}
		while (l < r && a[r] == 'W') {
			r--;
		}
		if (l < r && a[l] == 'W' && a[r] == 'R') {
			swap(a[l], a[r]);
			l++;
			r--;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3156
#include<stdio.h>
void countingsort(int n,int a[],int b[],int k){
  int i,j,c[k+1];
  for(i=0;i<=k;i++)c[i]=0;
  for(j=1;j<=n;j++)c[a[j]]++;
  for(i=1;i<=k;i++)c[i]=c[i]+c[i-1];
  for(j=n;j>=1;j--){
    b[c[a[j]]]=a[j];
    c[a[j]]--;
  }
}

int main(){
  int n,a[2000000],i,b[2000000],k=0;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
    if(k<a[i])k=a[i];
  }
  countingsort(n,a,b,k);
  for(i=1;i<n;i++)printf("%d ",b[i]);
  printf("%d\n",b[n]);
  return 0;
}



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

const int N = 5e5 + 50;

int n;

int main()
{
	scanf("%d", &n);
	if (n & n - 1)
	{
		printf("Yes\n1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2, n + 2, n + 3);
		for (int k = 4; k < n; k += 2) printf("%d %d\n%d %d\n%d %d\n%d %d\n", n + 1, k, n + 1, k + 1, k, k + n + 1, k + n, k + 1);
		if ((n & 1) == 0)
		{
			int c = n + 1, j = 2;
			std::function<bool(int)> valid = [&](int u) { return 2 <= u && u <= n; };
			while (!valid(c ^ j)) ++j;
			assert(j <= n);
			if (j == 2) printf("%d %d\n%d %d\n", j + n, n, c ^ j, n << 1);
			else printf("%d %d\n%d %d\n", j, n, c ^ j, n << 1);
		}
	}
	else puts("No");
}



Measured memory_bytes: 2816
n, m = map(int, input().split())
lrd = [tuple(map(int, input().split())) for i in range(m)]

class WeightedUnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.rank = [0] * n
        self.count = 0
        self.weight = [0] * n

    def root(self, a):
        if self.parent[a] == a:
            return a
        else:
            pa = self.root(self.parent[a])
            self.weight[a] += self.weight[self.parent[a]]
            self.parent[a] = pa
            return pa

    def is_same(self, a, b):
        return self.root(a) == self.root(b)

    def unite(self, a, b, w):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb:
            return
        if self.rank[ra] < self.rank[rb]:
            self.parent[ra] = rb
            self.weight[ra] = w - self.weight[a] + self.weight[b]
        else:
            self.parent[rb] = ra
            self.weight[rb] = -w - self.weight[b] + self.weight[a]
            if self.rank[ra] == self.rank[rb]:
                self.rank[ra] += 1
        self.count += 1

    def diff(self, a, b):
        return self.weight[a] - self.weight[b]


uf = WeightedUnionFind(n)
for l, r, d in lrd:
    l, r = l-1, r-1
    if uf.is_same(l, r):
        if uf.diff(l, r) != d:
            print('No')
            exit(0)
    else:
        uf.unite(l, r, d)

print('Yes')


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

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

    for (int i = 0; i < 1500; ++i)
    {
        if ((i * 8 / 100) == A && (i * 10 / 100) == B)
        {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;

}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int n;
  cin >> n;
  vector<pair<int, int>> ans;
  bool odd = false;
  if (n % 2 == 1) {
    odd = true;
    n -= 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (i == j || i + j == n + 1) continue;
      ans.push_back(make_pair(i, j));
    }
  }
  if (odd) {
    for (int i = 1; i <= n; i++)
      ans.push_back(make_pair(i, n + 1));
  }
  cout << ans.size() << endl;
  for (auto p: ans) {
    cout << p.first << " " << p.second << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

const static int MAX = 20;
int n, m, c, B[MAX], A[MAX][MAX], tmp, ans;

int main() {
    scanf("%d %d %d", &n, &m, &c);

    for ( int i = 0; i < m; i++ ) {
        scanf("%d", &B[i]);
    }
    
    for ( int i = 0; i < n; i++ ) {    
        for ( int j = 0; j < m; j++ ) {
            scanf("%d", &A[i][j]);
        }
    }
    
    ans = 0;

    for ( int i = 0; i < n; i++ ) {
        tmp = 0;

        for ( int j = 0; j < m; j++ ) {
            tmp += A[i][j] * B[j];
        }

        tmp += c;

        if ( tmp > 0 ) {
            ans++;
        }
    }
    
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%s", $s);
$len = strlen($s);
$a = 'a';
for($i = 0; $i < 26; $i++) {
    $c = 0;
    for($j = 0; $j < $len; $j++) {
        if($s[$j] == $a) {
            $c++;
        }
        if($c >= 2) {
            echo 'no'. "\n";
            exit;
        }
    }
    $a++;
//var_dump($a, $c);
}
echo 'yes'. "\n";

Measured memory_bytes: 4728
n=int(input())
G=[[0 for i in range(n)] for j in range(n)]

for i in range(n):
    u=list(map(int,input().split()))

    for j in range(2,len(u)):
        G[i][u[j]-1]=1


G=[' '.join(map(str,G[i])) for i in range(n)]
print('\n'.join(G))


Measured memory_bytes: 5668
#include<bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int m,n;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			string s;
			cin>>s;
			if(s[0]=='s'&&s[1]=='n'&&s[2]=='u'&&s[3]=='k'&&s[4]=='e')
			cout<<char('A'+j-1)<<i<<endl;
		}
	return 0;
}


Measured memory_bytes: 256
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) cerr << #x << " = " << (x) << " " << endl;
#else
const bool test = false;
#define dump(x) 
#define dumpl(x) 
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
 
template<typename T>
T gcd(T a, T b)
{
  T c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}
 
class Solver {
public:
  int N, M;

  void solve() {
    cin >> N >> M;

    int a = 100 * (N - M);
    int b = 1900 * M;
    int c = a + b;
    int d = c * (1 << M);
    cout << d << endl;
  }
};
 
signed main()
{
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {    
  //     auto ptr = new Solver();
  //     ptr->solve();
  //     delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define ll long long
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define deb(x) cout << #x << "=" << x << endl;
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;      

int main() {
    fastio
    int n;
    cin>>n;
    vector<pii> vec(n);
    for(auto& it : vec) cin>>it.first>>it.second;

    int cnt = 0;
    for(int i = 0; i<n; ++i) {
        if(vec[i].first == vec[i].second) {
            cnt++;
        }
        else {
            cnt = 0;
        }
        if(cnt >= 3) {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

int n;
vi in;
vi pref, suff;

int Skip(int id){
  return pref[id - 1] + suff[id + 1] +
         abs(in[id + 1] - in[id - 1]);
}

int main(){
  scanf("%d", &n);
  in.resize(n + 2, 0);
  for(int i = 1;i <= n;++i)
    scanf("%d", &in[i]);

  pref.resize(sz(in)), suff.resize(sz(in));
  pref[0] = 0;
  for(int i = 1;i < sz(in);++i)
    pref[i] = pref[i - 1] + abs(in[i] - in[i - 1]);
  suff[sz(in) - 1] = 0;
  for(int i = sz(in) - 2;i >= 0;--i)
    suff[i] = suff[i + 1] + abs(in[i] - in[i + 1]);

  for(int i = 1;i <= n;++i)
    printf("%d\n", Skip(i));

  return 0;
}


Measured memory_bytes: 2432
{
  const main = (input: string) => {
    const r = reader(input)
    const N = r.n()

    const lib = {}

    for (let i = 1; i < 10; i++) {
      for (let j = 1; j < 10; j++) {
        lib[i * j] = true
      }
    }
    console.log(lib[N] ? 'Yes' : 'No')
  }

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    const nls = () => lines.map(Number)

    return { lines, s, n, ss, ns, nls }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')

  main(getInput())
}


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin >> N;
	int a[N+1];
	for (int i = 0; i < N; i++)cin >> a[i];
	int x = 0;
	int y = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] % 4 == 0)
			x++;
		if (a[i] % 4 == 2)
			y++;
	}
	 if (x+y/2>=N/2)
		cout << "Yes" << endl;
	 else
		cout << "No" << endl;
}








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

using namespace std;

string s;

int main()
{
	cin >> s;
	if(s[0]!='A')
	{
		cout << "WA" << endl;
		return 0;
	}
	int cind=-1,co=0;
	for(int i=2;i<s.size()-1;i++)
	{
		if(s[i]=='C')
		{
			co++;
			cind=i;
		}
	}
	if(co!=1)
	{
		cout << "WA" << endl;
		return 0;
	}
	for(int i=1;i<s.size();i++)
	{
		if(i==cind) continue;
		if(!('a'<=s[i]&&s[i]<='z'))
		{
			cout << "WA" << endl;
			return 0;
		}
	}
	cout << "AC" << endl;
	return 0;
}

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

int main(){
  int N,Q,K;
  cin >> N >> K >> Q;
  vector<int> qPoint(N,K);
  for(int i = 0; i < Q; i++){
    int qAnswer;
    cin >> qAnswer;
    qPoint.at(qAnswer - 1)++;
  }
  for(int i = 0; i < N; i++)
  qPoint.at(i) -= Q;  
  for(int i = 0; i < N; i++){
    if(qPoint.at(i) <= 0)
    cout << "No" << endl;
    else
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>

using namespace std;


int main()
{

  int N, K, Q;
  cin >> N >> K >> Q;

  vector<int> A(N);
  vector<int> score(N+1);

  for(int i = 0; i < Q; i++){
    int num;
    cin >> num;

    score[num] += 1;
  }

  for(int i = 1; i <= N; i++){
    if((K - (Q - score[i])) > 0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
const int maxn = 100010;

vector <pi> adjlist[maxn];
int n,e;
int dist[maxn];

void fail() {
	cout << "No";
	exit(0);
}

void dfs(int x, int p) {
	for (auto cur: adjlist[x]) {
		int i = cur.f;
		if (i == p) continue;
		if (dist[i] != -1 and dist[i] != dist[x] + cur.s) fail();
		
		if (dist[i] == -1) {
			dist[i] = dist[x] + cur.s;
			dfs(i,x);
		}
	}
}

int main() {
	cin >> n >> e;
	for (int i =0;i<e;i++) {
		int l,r,c; cin >> l >> r >> c;
		adjlist[l].push_back(pi(r,c));
		adjlist[r].push_back(pi(l,-c));
	}
	memset(dist,-1,sizeof dist);
	for (int i =1;i<=n;i++) {
		if (dist[i] == -1) dfs(i,0);
	}
	cout << "Yes";
}	



Measured memory_bytes: 12032
#!/usr/bin/env python3
n, k, q = map(int, input().split())
a = [0]*q
for i in range(q):
    a[i] = int(input())
s = [k-q]*n
for i in range(q):
    s[a[i] - 1] += 1
for j in s:
    if j > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 10416
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll Size=1e6+7;
ll parent[1000010];
ll Rank[1000010];
ll SIZE[1000010];
ll mx=0;
void make_set()
{
    for(ll i=0; i<Size; i++)
    {
        parent[i]=i;
        Rank[i]=0;
        SIZE[i]=1;
    }
}
ll Find_set(ll v)
{
    if(parent[v]==v)
        return v;
    return parent[v]=Find_set(parent[v]);
}
void union_set(ll a,ll b)
{
     a=Find_set(a);
     b=Find_set(b);
    if(a!=b)
    {
        if(SIZE[a]<SIZE[b])
            swap(a,b);
        parent[b]=a;
        SIZE[a]+=SIZE[b];
        //cout<<SIZE[a]<<endl;
        mx=max(SIZE[a],mx);
    }
}
int main()
{
    ll n,m;
    ll i,j,k;
    make_set();
    ll a,b;
    cin>>n>>m;
    for(i=0; i<m; i++)
    {
        cin>>a>>b;
        union_set(a,b);
    }
    if(mx)
    cout<<mx<<endl;
    else
      cout<<"1"<<endl;
    return 0;
}


Measured memory_bytes: 27060
num = gets.chomp.to_i
val = gets.chomp.split(' ').map(&:to_i)
val.sort!().reverse!
sum = 0
1.upto(val.length-1) do |i|
  sum += val[i]
end
if sum > val[0]
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
let x = require('fs').readFileSync('/dev/stdin', 'UTF-8');
const a = Number(x.split(' ')[0]);
const b = Number(x.split(' ')[1]);
if (a < b) {
  console.log('a < b');
} else if (a > b) {
  console.log('a > b');
} else {
  console.log('a == b');
};



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

main() {
  string S; cin >> S;
  bool f = false;
  rep(i, S.length()) rep(j, S.length()) {
    if (i < j && S[i] == S[j]) f = true;
  }
  cout << ( (f) ? "no" : "yes" ) << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mii map<int,int>
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b)  (x/gcd(x,y))*y
#define inf (long long) 1e18
#define neg_inf (long long) (-1*1e18)
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define rep(i,n)  for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define deb(x) cout << #x << "=" << x <<"\n";
const int N = 1e9 + 7;

int pow(int x, int y) { int res = 1; while (y > 0) { if (y & 1) res = ((res) * (x)); res %= N; y = y >> 1; x = ((x) * (x)); } return res; }
int pow(int x, int y, int p)  {  int res = 1; x = x % p; while (y > 0) {if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p;}   return res; }


vector<vector<double>> dp(3000,vector<double> (3000,0));
void solve()
{
    int n;
    cin>>n;
    vector<double> v(n+1);
    rep1(i,n)
        cin>>v[i];

    // for(int i=1;i<=n;i++)
    //     cout<<v[i]<<" ";
    // cout<<"\n";

    // for(int i=1;i<=n;i++)
    // {
    //     dp[i][0]=1;
    // }
    dp[0][0]=1;

    int proper=(n+1)/2;

    for(int i=1;i<=n;i++)
    {
        dp[i][0]=(1-v[i])*dp[i-1][0];
        for(int j=n;j>=1;j--)
        {
            // cout<<v[i]<<"\n";
            // cout<<dp[i][j-1]*(v[i])<<" ";
            // return;
            dp[i][j]=dp[i-1][j-1]*(v[i])+dp[i-1][j]*(1-v[i]);
            // cout<<i<<" "<<j<<" ";
            // cout<<dp[i][j]<<"\n";
        }
        // cout<<"\n";
    }

    // printf("%.3f ",dp[1][1]);

    // for(int i=1;i<=n;i++)
    // {
    //     for(int j=1;j<=n;j++)
    //     {
    //         cout<<fixed<<setprecision(3)<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    // cout<<"\n";


    double ans=0;
    for(int i=proper;i<=n;i++)
    {
        ans+=dp[n][i];
    }
    printf("%0.10f",ans);
} 



int32_t main()
{
  // #ifndef ONLINE_JUDGE
 //    freopen("gymnastics.in", "r", stdin);
 //    freopen("gymnastics.out", "w", stdout);
  // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t=1;
    // cin>>t;

   while(t--)
   {
      solve();
   }
}






//code by-Roshan











//unnecessary
// bool cmp(pair<int,int> &a,pair<int,int> &b)
// {
//  if(a.F==b.F)
//    return (a.S<b.S);
//  else 
//    return (a.F<b.F);
//  //< =chota wala pehle
//  //> =chota wala baad me
// }


//better use this structure
// struct s{
//  int a;
//  bool operator <(const s &x) const
//  {
//    return (a>x.a);
//  }
// };



//  priority_queue<int,vector<int>,greater<>> p;(priority queue as min heap)


//important to use this one
// cout<<fixed<<setprecision(3)<<dp[i][j]<<" ";



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

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

	int A[100][100] = {{}};
	int B[100] = {};
	int i, j;
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			scanf("%d", &A[i][j]);
		}
	}
	for (i = 0; i < m; i++) {
		cin >> B[i];
	}
	int c[100] = {};
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			c[i] = A[i][j] * B[j] + c[i];
		}
		cout << c[i] << endl;
	}


	return 0;
}


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

int sum[5001][5001];

int main() {
  int a,b,c; cin >> a >> b >> c;
  cout << a+b+c-max(a,max(b,c)) << endl;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <algorithm>

#define SIZE 1002
int Table[SIZE][SIZE];
char a[SIZE];
char b[SIZE];
int n1;
int n2;

int Count(int i, int j)
{
    if(i == 0 || j == 0) return 0;
    if(a[i-1] == b[j-1]){
        return Table[i-1][j-1] + 1;
    }
    return std::max(Table[i-1][j], Table[i][j-1]);
}
int Solve()
{
    n1 = std::strlen(a);
    n2 = std::strlen(b);
    for(std::size_t i = 1; i < n1; ++i){
        for(std::size_t j = 1; j < n2; ++j){
            Table[i][j] = Count(i, j);
        }
    }
    return Table[n1-1][n2-1];
    
}

int main()
{
    int n;
    std::scanf("%d\n", &n);
    for(int i = 0; i < n; ++i){
        std::fgets(a, SIZE, stdin);
        std::fgets(b, SIZE, stdin);
        std::printf("%d\n", Solve());
    }
    return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

bool IsPrime(ll num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  ld sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}

//実行部
void Main()
{
  ll n, h, w; cin >> n >> h >> w;
  ll ans = 0;
  rep(i, n)
  {
    ll a, b; cin >> a >> b;
    if((a / h) * (b / w) > 0) ans++;
  }
  fin(ans);
}
//前処理
int main()
{
  ifstream in("text.txt");
  cin.rdbuf(in.rdbuf());
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 256
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std;

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x;
    cin >> x;
    ll h=0;
    while(x){
        if(x>=500){
            x-=500;
            h+=1000;
        }else if(x>=5){
            x-=5;
            h+=5;
        }
        else {x=0;}
    }
    cout << h ENDL;
    
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

int main()
{ 
 ll x,y;
 cin>>x>>y;

 ll a[4];
 a[1]=300000;
 a[2]=200000;
 a[3]=100000;
ll ans=0;
 if(x==1 and y==1)
 	ans+=400000;

 if(x<4)
 	ans+=a[x];
 if(y<4)
 	ans+=a[y];
 cout<<ans<<endl;

}




Measured memory_bytes: 256
N = int(input())
def dfs(s):
	if int(s) > N:
		return 0
	ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
	for c in '753':
		ret += dfs(s + c)
	return ret
print(dfs('0'))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  string a,b;cin>>n;
  string c="";
  cin>>a>>b;
  for(int i=0;i<n;i++)
  {
    c+=a[i];c+=b[i];
  }
  cout<<c;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	}
}


Measured memory_bytes: 33096
r,c=map(int,input().split())
spl=[]
for i in range(r):
    spl.append(list(map(int,input().split())))

for i in range(r):
    tmp=sum(spl[i])
    spl[i].append(tmp)

cnt=[]
for j in range(c+1):
    tmp=0
    for k in range(r):
        tmp+=spl[k][j]
    cnt.append(tmp)

spl.append(cnt)

for i in range(r+1):
    print(*spl[i])


Measured memory_bytes: 6232
s=str(input())
t=str(input())
l=0
for i in range(len(s)-len(t)+1):
    p=0
    for j in range(len(t)):
        if t[j] == s[i:i+len(t)][j]:
            p+=1
    l=max(l,p)
print(len(t)-l)

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

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

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

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

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


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

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

  string S;
  cin >> S;
  int N = SZ(S);

  LL ans = 1;
  VL cnt(26);
  REP(i,N){
	ans += i - cnt[S[i]-'a'];
	cnt[S[i]-'a']++;
  }
  cout << ans << endl;

  return 0;
}


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

int x[15][14], y[15][14];
int A[15];

int main (void) {
  int N; cin >> N;
  int honto_max = 0;

  for (int i = 0; i < N; i++) {
    cin >> A[i];
    for (int j = 0; j < A[i]; j++){
      cin >> x[i][j] >> y[i][j];
    }
  }
  
  for (int bit = 0; bit < (1<<N); ++bit) {
    int cur_honto = 0;
    for (int i = 0; i < N; i++) {
      if (bit & (1<<i)) { // 1 == 本と付き、0== 嘘つきとする
        bool honto = true;
      	for (int j = 0; j < A[i]; j++) {
          if (y[i][j] == 1 && bit&(1<<(x[i][j]-1))) ;
          else if ( y[i][j] == 0 &&  !(bit&(1<<(x[i][j]-1))) ) ;
          else honto = false;
          //cout << y[i][j] << ", " << (1<<(x[i][j]-1)) << endl;
        }
        if (honto) {cur_honto++;}
        else {cur_honto = 0; break;}
      } else { // 嘘つきが嘘つきであることを証明することはできない
        ;
      }
    }
    honto_max = max(cur_honto, honto_max);
    //cout << cur_honto << ", " << bit << endl;
  }
  cout << honto_max << endl;
  return 0;
}

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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int x = B - A;
	if (x < 0) x = -x;
	if (x % 2 == 0) cout << "Alice";
	else cout << "Borys";
	
	return 0;
}
/*
先に隣接した方が勝ち
また逃げても同じマスだけ相手が追えるので+-0だから意味なし
*/

Measured memory_bytes: 256
N,M = map(int, input().split())
d = {'AC':0,'WA':0,}
b = 0
for i in range(N + 1):
  d[i] = 0
for j in range(M):
  p,s = input().split()
  p = int(p)
  if s == 'AC':
    if d[p] != -1:
      b = d[p]
      d[p] = -1
      d['AC'] += 1
      d['WA'] += b
      b = 0  
  if s == 'WA':
    if d[p] != -1:
       d[p] += 1
print(d['AC'],end = ' ')
print(d['WA'])
  



Measured memory_bytes: 19416
// '?'を'D'に置き換えればスコアが最低1増える。前の文字が'P'ならさらに1増える
// '?'を'P'に置き換えると、後の文字が'D'のときスコアが1増える。
// すべて'D'に置き換えるのは最適ではなさそうな感じがする、、、
// 'P????D'という文字列があって、すべて'D'にすると、
// 'PDDDDD'になって、スコアが+5になる
// 'PDPDPD'にすると、スコアが+5,,
// いや、すべて'D'でもよさそうな気はする
#include <bits/stdc++.h>
using namespace std;

int main() {
    string T;
    cin >> T;
    for(char ch: T) {
        if(ch == '?') cout << 'D' ;
        else cout << ch;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll dp[55][55][2505];

int main(){
  ll n,k;
  cin >> n >> k;
  dp[0][0][0]=1;
  for(ll i=1;i<=n;i++){
    for(ll j=0;j<=i;j++){
      for(ll x=0;x<=n*n;x+=2){
        dp[i][j][x]=(2*j+1)*dp[i-1][j][x-2*j]%mod+(j+1)*(j+1)*dp[i-1][j+1][x]%mod;
        if(j!=0) dp[i][j][x]+=dp[i-1][j-1][x-4*j+2];
        dp[i][j][x]%=mod;
      }
    }
  }       
  cout << dp[n][0][k] << endl;
}

Measured memory_bytes: 53504
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	char a;
	cin >> a;
	if (a == 'A')cout << 'T' << endl;
	if (a == 'C')cout << 'G' << endl;
	if (a == 'G')cout << 'C' << endl;
	if (a == 'T')cout << 'A' << endl;


	return 0;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
A = [int(c) for c in input().split()]
B = deque()

is_reversed = False
for a in A:
  if is_reversed:
    B.appendleft(a)
  else:
    B.append(a)
  is_reversed = not is_reversed

if is_reversed:
  ans = map(str, reversed(B))
else:
  ans = map(str, B)

print(' '.join(ans))

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

int main(){
    long x,o=0,s=100;
    cin >> x;

    for(int i=0; i<100000000000000; i++){
        s*=1.01;
        o+=1;
        if(s>=x){
            break;
        }
    }
    cout << o << endl;



}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
#define LEN 100005

//?????????????????¨????§???????
typedef struct pp{
	char name[100];
	int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue(){
	P x = Q[head];
	head = (head + 1) % LEN;
	return x;
};

int main(){
	int elaps = 0, c;
	int i, q;
	P u;
	scanf("%d %d", &n, &q);

	for (i = 1; i <= n; i++){
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].t);
	}
	head = 1; tail = n + 1;

	while (head != tail){
		u = dequeue();
		c = min(q, u.t);
		u.t -= c;
		elaps += c;//????????????
		if (u.t > 0) enqueue(u);
		else{
			printf("%s %d\n", u.name, elaps);
		}
	}
	return 0;
};

Measured memory_bytes: 11184
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let d: f64 = sc.read();
    let t: f64 = sc.read();
    let s: f64 = sc.read();
    if d / s < t + 1e-9 {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2268
#include<iostream>
#include<string>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int main(void) {
	char x, y; cin >> x >> y;
	if (x == 'H')cout << y << endl;
	else {
		if (y == 'H')cout << 'D' << endl;
		else cout << 'H' << endl;
	}
	return 0;
}

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

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

long long read(){
	long long i;
	cin >> i;
	return i;
}

int main(void){
	const int BLDS = 4;
	const int FLRS = 3;
	const int CLMN = 10;
	int rooms[BLDS][FLRS][CLMN] = {}; // 棟, 階, 部屋番号
	long long size = read();
	REP(i, size) {
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		rooms[b - 1][f - 1][r - 1] += v;
	}
	REP(i, BLDS) {
		REP(j, FLRS) {
			REP(k, CLMN) {
				cout << " " << rooms[i][j][k];
			}
			cout << endl;
		}
		// 区切り線
		if (i != BLDS - 1) {
			REP(j, CLMN * 2) {
				cout << "#";
			}
			cout << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <set>
#include <vector>
using namespace std;

int V, E, d[105][105], INF = 1e9;

int Prim() {
    int s = 0, c[105], n[105], ans = 0;
    set<int> U;
    for (int i = 1; i < V; i++) U.insert(i);
    bool p[10] = {};

    for (int i = 0; i < V; i++) {
        c[i] = d[s][i];
        n[i] = s;
    }
    vector<pair<int, int>> T;
    while (!U.empty()) {
        int mn = INF, w = -1;
        for (auto& i : U) {
            if (c[i] < mn) {
                mn = c[i];
                w = i;
            }
        }
        U.erase(w);
        T.emplace_back(w, n[w]);
        ans += d[w][n[w]];
        for (auto& i : U) {
            if (d[w][i] < c[i]) {
                c[i] = d[w][i];
                n[i] = w;
            }
        }
    }
    return ans;
}

int main() {
    cin >> V;
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
            cin >> d[i][j];
            if (d[i][j] == -1) d[i][j] = INF;
        }
    }

    cout << Prim() << endl;
}


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

int main()
{
  vector <int> v(3);
  cin >> v[0] >> v[1] >> v[2];
  set<int> s(v.begin(), v.end());
  cout<< s.size() <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define n 10000
#define q 500

int main(){
  
  int s[n],t[q],c=0,countn,countq,i,j,flag=0;
  
  scanf("%d",&countn);
  for(i = 0; i < countn; i++){
    
    scanf("%d",&s[i]);
  }
  scanf("%d",&countq);
  for(i = 0; i < countq; i++){
    
    scanf("%d",&t[i]);
  }
  for(j = 0; j < countq; j++){
    for(i = 0; i < countn; i++){
      if(s[i] == t[j] && flag == 0){ 
	c++;
      flag = 1;
      }
    }
      flag = 0;
  }
  
  
  printf("%d\n",c);
  
  return 0;
}

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

#define ll long long

int t,h,w,k;
string s[10];

bool check(int x,int y,int k) {
	int cnt=0;
	map<int,int> mp1,mp2;
	for(int i=0;i<h;++i) {
		if(1<<i&x)
			mp1[i]++;
	}
	for(int i=0;i<w;++i) {
		if(1<<i&y)
			mp2[i]++;
	}
	for(int i=0;i<h;++i)
		for(int j=0;j<w;++j) {
			if(mp1.find(i)!=mp1.end()||mp2.find(j)!=mp2.end())
				continue;
			else
				cnt+=(s[i][j]=='#');
		}
	return cnt==k;
}

void solve() {
	cin>>h>>w>>k;
	int ans=0;
	for(int i=0;i<h;++i)
		cin>>s[i];
	for(int i=0;i<1<<h;++i)
		for(int j=0;j<1<<w;++j) {
			if(check(i,j,k))
				++ans;
		}
	cout<<ans<<'\n';
}

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

	//cin >> t;
	//while(t--) 
		solve();
	//return 0;
}


Measured memory_bytes: 3648
fun main(args: Array<String>) {
    val (n, p) = readInts()

    val s = readLn()
    if (p == 2 || p == 5) {
        var ans = 0L
        for (i in 0 until n) {
            if ((s[i] - '0') % p == 0) ans += (i + 1).toLong()
        }
        println(ans)
        return
    }
    val modP = mutableListOf<Int>()
    var mul = 1
    for (i in s.length - 1 downTo 0) {
        val num = s[i] - '0'
        modP.add(((if (modP.isNotEmpty()) modP.last() else 0) + mul * num) % p)
        mul = (mul * 10) % p
    }

    val occurs = mutableMapOf<Int, Int>()
    occurs[0] = 1
    modP.forEach {
        occurs[it] = occurs[it]?.plus(1) ?: 1
    }
    var ans = 0L
    occurs.forEach { entry ->
        val occ = entry.value
        ans += (occ.toLong() * (occ - 1)) / 2
    }
    println(ans)
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
private fun readInts() = readStrings().map { it.toInt() }


Measured memory_bytes: 48500
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
int dp[100005];
int h[100005];
int n;

int func(int i)
{
    if(i>=n-1) return 0;
    if(dp[i]!=-1) return dp[i];
    int a=1e18;
    a=min(a, abs(h[i+1]-h[i])+func(i+1));
    if(i!=n-2) a=min(a, abs(h[i+2]-h[i])+func(i+2));
    dp[i]=a;
    return dp[i];
}

main()
{
    fastio;
    cin>>n;
    for(int i=0; i<n; i++) cin>>h[i];
    memset(dp, -1, sizeof(dp));
    cout<<func(0);
}


Measured memory_bytes: 4992