akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

int main() {
    string S;
    cin >> S;

    bool ok = true;
    for (int i = 0; i < S.size(); i++) {
        if (i % 2 == 0) {
            if (S.at(i) != 'h') {
                ok = false;
            }
        } else { // i % 2 == 1
            if (S.at(i) != 'i') {
                ok = false;
            }
        }
    }

    if (ok && S.size() % 2 == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int n, m;
int hint[10000][10];
bool appear[10000][10];
int hit[10000], blow[10000];
int tmp[10];
int ans[10];
int ansnum;

typedef pair<bool, int> pbi;

void dfs(int now, int used) {
   REP(i, m) {
    if (hit[i] + blow[i] > n-now) return;
  }
  // REP(i, now)
  //   cout << tmp[i];
  // cout << endl;
  if (now == n) {
    ansnum++;
    memcpy(ans, tmp, sizeof(tmp));
    return;
  }
 
  REP(i, 10) {
    if (used >> i & 1) continue;
    vector<pbi> record;
    REP(j, m) {
      if (hint[j][now] == i) {
        if (hit[j] > 0) {
          hit[j]--;
          record.push_back(pbi(0, j));
        } else {
          goto br;
        }
      } else if (appear[j][i]) {
        if (blow[j] > 0) {
          blow[j]--;
          record.push_back(pbi(1, j));
        }
        else {
          goto br;
        }
      }
    }
    tmp[now] = i;
    dfs(now+1, used|1<<i);
  br:;
    FOR(it, record) {
      if (it->first) {
        blow[it->second]++;
      } else {
        hit[it->second]++;
      }
    }
  }
}

int main() {
  while(cin >>n>>m, n||m) {
    memset(appear, 0, sizeof(appear));
    REP(i, m) {
      REP(j,n) {
        char c;
        cin >> c;
        hint[i][j] = c-'0';
        appear[i][c-'0'] = 1;
      }
      cin >> hit[i];
      cin >> blow[i];
    }
    ansnum = 0;
    dfs(0, 0);
    if (ansnum == 1) {
      REP(i, n)
        cout << ans[i];
      cout << endl;
    }
    else cout << "NO" << endl;
  }
}

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

ll h,w,ch,cw,dh,dw;
ll dx[4]={0,-1,0,1},dy[4]={1,0,-1,0};

int main(){
  cin>>h>>w>>ch>>cw>>dh>>dw;
  char s[h+1][w+1];
  ll d[h+1][w+1];
  for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)cin>>s[i][j];
  for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)d[i][j]=-1;
  deque<pair<ll,ll>> q;
  ll m=0;
  q.push_back({ch,cw});
  q.push_back({1e4,1e4});
  while(q.size()>1){
    ll x=q.front().first;
    ll y=q.front().second;
    q.pop_front();
    if(x==1e4){
      m++;
      q.push_back({1e4,1e4});
      continue;
    }
    if(x<=0 || h<x || y<=0 || w<y || s[x][y]=='#' || d[x][y]!=-1)continue;
    d[x][y]=m;
    for(int i=0;i<4;i++){
      q.push_front({x+dx[i],y+dy[i]});
    }
    for(int i=-2;i<3;i++){
      for(int j=-2;j<3;j++){
        q.push_back({x+i,y+j});
      }
    }
  }
  cout<<d[dh][dw]<<endl;
}


Measured memory_bytes: 16640
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
def BF(graph,s):##Bellman-Ford
    n=len(graph)
    INF=10**15
    dist = [INF]*n
    dist[s] = 0
    for _ in range(n-1):
        for u in range(n):
            if dist[u]==INF:
                continue
            for v,c in graph[u]:
                if dist[v] >dist[u]+c:
                    dist[v] =dist[u]+c
    for _ in range(n):
        for u in range(n):
            if dist[u]==INF:
                continue
            for v,c in graph[u]:
                if dist[v] >dist[u]+c:
                    dist[v]=-INF
    return dist
n,m,p  = ma()
G = [[] for i in range(n)]
for i in range(m):
    a,b,c = ma()
    G[a-1].append((b-1,-c+p))##コストが高いほうがいいので反転させておく
d=BF(G,0)
if abs(d[-1])==10**15:
    print(-1)
else:
    print(max(0,-d[-1]))


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

int main()
{
	int n;
	string s;
	cin >> n;
	cin >> s;
	int i = 0;
	int r = 0;
	int b = 0;
	while (i<n)
	{
		if (s[i]=='R')
		{
			r++;
		}
		else
		{
			b++;
		}
		i++;
	}
	if (r>b)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int main()
{
    int N;
    cin >> N;
    int ans = 0;

    REP(d, 10)
    {
        REP(i, pow(3, d))
        {
            lint a = 0, j = i;
            vector<int> flg(3);
            REP(_, d)
            {
                a *= 10;
                flg[j % 3] = 1;
                a += (j % 3) * 2 + 3;
                j /= 3;
            }
            if (a <= N && flg[0] && flg[1] && flg[2]) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
char S[20][20];
int D[20][20];

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

ll calc(ll N){
    ll ans = 0;
    for(int i = 1; i < ll(log10(N)); i++){
        ans += i;
        ans *= 9;
    }
    return ans;
}


int main(){
    ll N,ans = 0;
    cin >> N;
    ll div = 10;
    if(N % 2 == 0){
        while(ll (N / div) >= 1){
            ans += ll (N / div);
            div *= 5;
        }
    }
    else{
        ans = 0;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int cnt = 0;
    int tmp = 1;
    for (int i = 1; i < N; i++) {
        if(a[i] == a[i-1]){
            tmp++;
        }
        else{
            cnt += tmp / 2;
            tmp = 1;
        }
    }
    cnt += tmp / 2;
    printf("%d\n", cnt);

}

Measured memory_bytes: 3656
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();    
    String b = sc.next();
    String ans = "No";
    int ab = Integer.parseInt(a + b);
    for(int i=1; i<317; i++) {
      if(ab == i * i) {
        ans = "Yes";
        break;
      }
      if(ab < i * i){
        break;
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
long long h[N];
int g[N];
int v[N];
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%lld",&h[i]);
	}
	for(int i=1;i<=m;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		g[a]++;
		g[b]++;
		if(h[a]>h[b])
			v[a]++;
		if(h[b]>h[a])
			v[b]++;
	}
	int ans=0;
	for(int i=1;i<=n;i++){
//		if(g[i]!=0){
			if(g[i]==v[i])
				ans++;
//		}
		
	}
	printf("%d\n",ans);
	return 0;
} 

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

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

  int i = 1;
  int count = 0;
  while(true) {
    int x = i;

    int div_count = 0;
    while(x % 100 == 0) {
      div_count++;
      x /= 100;
    }

    if(div_count == D) {
      count++;
      if(count == N) {
        cout << i << endl;
        return 0;
      }
    }

    i++;
  }
}


Measured memory_bytes: 256
/**
 *   Author:  Wasi Ur Rahman
 *   FROM RMSTU
**/
#include <bits/stdc++.h>
#define ll         		long long
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define dourao       		ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define min3(a,b,c)    		min(a,min(b,c))
#define min4(a,b,c,d)  		min(d,min3(a,b,c))
#define max3(a,b,c)    		max(a,max(b,c))
#define max4(a,b,c,d)  		max(d,max3(a,b,c))
#define all(v)         		v.begin(),v.end()
#define revall(v)      		v.rbegin(),v.rend()
#define pb             		push_back
#define eb             		emplace_back
#define setbits(x)     		__builtin_popcountll(x)
#define zrobits(x)     		__builtin_ctzll(x)
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)
#define poro                freopen("input.txt","r",stdin)
#define lekho               freopen("output.txt","w",stdout)
#define println()           cout << endl
#define printi(x)           printf("%d\n")
#define printii(x,y)        printf("%d %d\n")
#define printiii(x,y,z)     printf("%d %d %d\n")
#define printl(x)           printf("%lld\n")
#define printll(x,y)        printf("%lld %lld\n")
#define printlll(x,y,z)     printf("%lld %lld %lld\n") 
using namespace __gnu_pbds;
using namespace std;
/*************************************
**          A S S E M B L E         **
**************************************/
bool isPrime(ll n){if(n <= 1)return false;for (ll i = 2; i * i < n; i++)if (n % i == 0)return false;return true;}
ll fact(ll n){ll res = 1;for(ll i = n;i>=1;i--)res *= i;return res;}
ll nCr(ll n,ll r){return (fact(n)/(fact(r)*fact(n-r)));}
ll nPr(ll n,ll r){return fact(n)/fact(n-r);}
ll modpow(ll a, ll n, ll mod){ll res=1;while(n>0){if(n&1) res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
const int mod=998244353;
inline int add(int a,int b){if((a+=b)>=mod)a-=mod;return a;}
inline int dec(int a,int b){if((a-=b)<0)a+=mod;return a;}
inline int mult(int a,int b){long long t=1ll*a*b;if(t>=mod)t%=mod;return t;}
inline int power(int a,int b){int out=1;while(b){if(b&1)out=mult(out,a);a=mult(a,a);b>>=1;}return out;} 
/*************************************
**  E N D    G A M E   S T A R T S  **
**************************************/
int main(){
	dourao;
	int n,k;
	cin >> n >> k;
	int arr[n];
	for(int i = 0;i<n;i++)
		cin >> arr[i];
	sort(arr,arr+n);
	int sum = 0;
	//int m = INT_MAX;
	for(int i = 0;i<k;i++){
		sum += arr[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

// = = = Mint = = =
template<int64_t MOD> struct Mint {
    int64_t v;
    Mint() { v = 0; }
    Mint(int64_t x) { v = x % MOD; if(v < 0)  v += MOD; }

    Mint operator-() { return Mint{-v}; };
    Mint operator+(Mint x) { return Mint(v + x.v); };
    Mint operator-(Mint x) { return Mint(v - x.v); };
    Mint operator*(Mint x) { return Mint(v * x.v); };
    Mint operator/(Mint x) { return Mint(v * pow(x.v, MOD-2).v); };

    Mint& operator+=(Mint x) { return *this = (*this + x); };
    Mint& operator-=(Mint x) { return *this = (*this - x); };
    Mint& operator*=(Mint x) { return *this = (*this * x); };
    Mint& operator/=(Mint x) { return *this = (*this / x); };

    static Mint pow(Mint base, int64_t exp) {
        if(exp == 0)  return Mint(1);
        return pow(base*base, exp/2) * (exp&1 ? base : Mint(1));
    }

    friend ostream& operator<<(ostream& os, Mint x) { return os << x.v; }
};
using mint = Mint<1000000007>;
// = = = = = = = = = =

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

    lint s[n], t[m];
    for(auto& e : s)  cin >> e;
    for(auto& e : t)  cin >> e;

    mint dp[n+1][m+1];
    fill(dp[0], dp[n+1], 1);
    for(lint i = 0; i < n; i++) {
        for(lint j = 0; j < m; j++) {
            dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j] - dp[i][j];
            if(s[i] == t[j])  dp[i+1][j+1] += dp[i][j];
        }
    }
    cout << dp[n][m] << endl;
}

Measured memory_bytes: 31616
/*
    Tanuj Johal
    
*/
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define ll long long
#define f() for(ll i=0;i<n;i++)
#define begin(v) v.begin,v.end()
#define ump unordered_map<ll,ll>
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);



int main()
{
    fast
    // ll t;cin>>t;while(t--)
    {
        string s;cin>>s;
        
        if(s=="SUN")
        {
            cout<<"7";    
        }
        else if(s=="SAT")
        {
            cout<<"1";
        }
        else if(s=="MON")
        {
            
            cout<<"6";
        }
        else if(s=="TUE")
        {
            
            cout<<"5";
        }
        else if(s=="WED")
        {
            
            cout<<"4";
        }
        else if(s=="THU")
        {
            
            cout<<"3";
            
        }
        else
        {
            
            cout<<"2";
        }
        
    }
    
    
    return 0;
}


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

int main(void)
{
	char str[21];
	int len;
	int i;
	
	scanf("%s", str);
	len = strlen(str);
	
	for (i = len - 1; i >= 0; i--){
		printf("%c", str[i]);
	}
	
	printf("\n");
	
	return (0);
}

Measured memory_bytes: 524
#include <cstdio>

int n;
int dp[10001];

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

  for(int x = 1; x < 100; ++x){
    for(int y = 1; x*x + y*y + x*y + x + y + 1 <= n; ++y){
      for(int z = 1; ; ++z){
        int r = (x+y+z)*(x+y+z) - x*y - y*z - z*x;
        if(r > n) break;
        dp[r]++;
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
int N,ans=0;
int A[100010]={};
int D[100010]={};
int counter=0;
int sum=0;
int tmp;
int main(){
  cin >> N;
  for(int i=1;i<=N;i++){
    cin >> A[i];
    D[i-1]=abs(A[i]-A[i-1]);
    sum+=D[i-1];
  }
  D[N]=abs(A[N]);
  sum+=D[N];
  for(int i=1;i<=N;i++){
    if((A[i]>A[i-1] && A[i]<A[i+1]) || (A[i]<A[i-1] && A[i]>A[i+1])) cout << sum-D[i-1]-D[i]+abs(D[i]+D[i-1]) << endl;
    else cout << sum-D[i-1]-D[i]+abs(D[i]-D[i-1]) << endl;
  }
  /*for(int j=1;j<=N;j++){
  ans=0;
  tmp=A[j];
  A[j]=A[j-1];
  for(int i=0;i<=N;i++){
  ans+=abs(A[i+1]-A[i]);
}
A[j]=tmp;
cout << ans << endl;
}*/
return 0;
}


Measured memory_bytes: 2048
N = int(input())
A = list(map(int,input().split()))

#print(A)

cou = 0

for i in range(1,len(A)):
    if A[i] < A[i - 1]:
        dan = A[i - 1] - A[i]
        #print(dan)
        cou = cou + dan
        A[i] = A[i - 1]
        #print(A)

print(cou)
        


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

using namespace std;

int main() {
    int n,m;
    int t[100002] = {};
    cin >> n >> m;
    for(int i=0;i<m;++i) {
        int l, r;
        cin >> l >> r;
        t[l-1]++;
        t[r]--;
    }
    int ans = 0;
    for(int i=0;i<n;++i) {
        if(t[i] == m) ans++;
        t[i+1] += t[i];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main(){

	int h, w;
	vector<string> s;
	vector< vector<int> > board;

	cin>> h >> w;

	s.resize(h);
	board.resize(h);
	for(int i=0;i<h;i++) board[i].resize(w);

	for(int i=0;i<h;i++) cin>> s[i];

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			board[i][j]=0;
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i].substr(j, 1)=="#"){
				for(int k=i-1;k<=i+1;k++){
					for(int l=j-1;l<=j+1;l++){
						if(0<=k && 0<=l && k<h && l<w){
							board[k][l]++;
						}
					}
				}
			}
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i].substr(j, 1)=="#") board[i][j]=-1;
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(0<=board[i][j]){
				cout<< board[i][j];
			}else{
				cout<< "#";
			}
		}
		cout<< endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define timeKyaHorhaH 1.0 * clock() / CLOCKS_PER_SEC

#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
lld power(lld b, lld e)
{
    if(e==0)
        return 1;
    if(e%2==1)
        return b*power(b*b,(e-1)/2);
    else
        return power(b*b,e/2);
}
 
lld power(lld b, lld e, lld m)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else
		return power(((b%m)*(b%m))%m,e/2,m)%m;
}
 
int nDig(lld n)
{
	if(n<0) 
		n*=-1;
	if(n==0)
		return 1;

    return floor(log10(n) + 1);
}

#define endl '\n'
#define mod 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	lld n;
	cin>>n;

	float x=3.1415926535*2*n;
	cout<<x;
	return;
}

int main()
{
    SPEEDUP;
 	lld t=1;
 	//cin>>t;

 	while(t--)
 		swagWaalaFunction();
	
	// cerr<<"\n"<<timeKyaHorhaH; 	
 	return 0;
}

Measured memory_bytes: 3820
#include<iostream>
#include<string>

using namespace std;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int task[n][3];
	for(int i=0;i<n;i++)
	{
		cin>>task[i][0]>>task[i][1]>>task[i][2];
	}
	int dp[n][3];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
		  if(i)dp[i][j]= max( dp[i-1][(j+1)%3], dp[i-1][(j+2)%3] ) + task[i][j];
		  else dp[i][j]=task[i][j];
		}		
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]) )<<"\n";
}

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

int main(){
  int N;
  int n_AC=0, n_WA=0, n_TLE=0, n_RE=0;
  
  cin >> N;
  
  vector<string> Si(N);
  
  for (int i=0;i<N;i++){
    cin >> Si.at(i);
    
    if ( Si.at(i) == "AC" )
      n_AC++;
    else if ( Si.at(i) == "WA" )
      n_WA++;
    else if ( Si.at(i) == "TLE" )
      n_TLE++;
    else if ( Si.at(i) == "RE" )
      n_RE++;
  }
  
  cout << "AC x " << n_AC << endl;
  cout << "WA x " << n_WA << endl;
  cout << "TLE x " << n_TLE << endl;
  cout << "RE x " << n_RE << endl;
}

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

int main(){

 while(1){
  int n,x,cnt=0;
  cin >> n >> x;
  if(n==0&&x==0)break;
  for(int i=1;i<=n;i++){
   for(int j=i+1;j<=n;j++){
    for(int k=j+1;k<=n;k++){
     if(i+j+k==x)cnt++;
    }
   }
  }
  cout << cnt << endl;
 }

 return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e5+3;
const int INF = 1e9;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int x, n; cin >> x >> n;
    if(n == 0) RETURN(x);
    set<int> s;
    fori(i,n) {
        int a; cin >> a;
        s.insert(a);
    }

    int xl = x, xr = x;
    while(s.count(xl)) xl--;
    while(s.count(xr)) xr++;
    debug(xl);
    debug(xr);
    if(x-xl <= xr-x) cout << xl;
    else cout << xr;

    //int ntest; cin >> ntest; while(ntest--) 
    //{
    //}
    cout << '\n';
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()

d={}
t={}
for i in range(ord("a"),ord("z")+1):
  d[chr(i)]=0
  t[chr(i)]=0
  
for i in s:
  d[i]+=1
for i in range(n-1):
  s=input()
  for j in s: t[j]+=1
  for j in t: d[j]=min(d[j],t[j])
  for j in s: t[j]=0
ans=[]
for i in d:
  for j in range(d[i]):
    ans.append(i)
ans.sort()
x="".join(ans)
print(x)


Measured memory_bytes: 3064
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    String s = sc.next();
    String answer ="red";
    if(a>=3200){
      answer=s;
    }
    System.out.println(answer);
  }
}

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

#define int long long

void fastio() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}


int sum(vector<int> &cum, int i, int j) {
	if (i == 0) return cum[j];
	return cum[j] - cum[i-1];
}


void update(vector<vector<int> > &matrix, int start, int end, vector<int> &nums) {
	int ans = 100000000000000LL;
	for (int k = start; k < end; ++k) {
		// start - k
		// k + 1 - end
		int prev = matrix[start][k] + matrix[k+1][end];
		int diff = sum(nums, start, k) + sum(nums, k + 1, end);
		ans = min(ans, prev + diff);
	}
	matrix[start][end] = ans;
}

#undef int
int main(int argc, char const *argv[])
{
	#define int long long
	int n;
	cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; ++i) {
		cin >> nums[i];
	}
	for (int i = 1; i < n; ++i) nums[i] += nums[i-1];
	vector<vector<int> > matrix(n, vector<int>(n, 0));
	for (int i = 1; i < n; ++i) {
		int j = i;
		int count = 0;
		while (j < n) {
			int start = count++, end = start + i;
			update(matrix, start, end, nums);
			j++;
		}
	}
	cout << matrix[0][n-1] << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cstring>
#include <set>
using namespace std;

set <int> S;

inline int get( char c ) {
    char T[5] = "ACGT";
    for ( int i = 0; i < 4; ++ i ) {
        if ( c == T[i] ) return i + 1;
    }
    return 0;
}

void insert( char *s ) {
    int n = strlen( s );
    int sum = 0;
    int t = 1;
    for ( int i = 0; i < n; ++ i ) {
        sum += get( s[i] ) * t;
        t *= 4;
    }
    S.insert( sum );
}

bool find( char *s ) {
    int n = strlen( s );
    int sum = 0;
    int t = 1;
    for ( int i = 0; i < n; ++ i ) {
        sum += get( s[i] ) * t;
        t *= 4;
    }
    return S.count( sum ) > 0;
}

int main() {
    int n;
    while ( scanf("%d", &n) != EOF ) {
        S.clear();
        char cmd[13], data[13];
        for ( int i = 0; i < n; ++ i ) {
            scanf( "%s%s", cmd, data );
            if ( strcmp( cmd, "find" ) != 0 ) {
                insert( data );
            } else {
                puts( find( data ) ? "yes" : "no" );
            }
        }
    }
    return 0;
}

Measured memory_bytes: 7252
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	int a[2][100];
	for(int j=0;j<2;j++)
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[j][i]);
	}
	int max = 0;
	//解法
	for (int i = 0; i < n; i++) {
		int tmp = 0;
		for (int j = 0; j <= i; j++) {
			tmp += a[0][j];
		}
		//一段下に行く
		for (int j = i; j < n; j++) {
			tmp += a[1][j];
		}
		if (max < tmp) max = tmp;
	}
	printf("%d\n", max);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
int a[3];
int m=0,n=0;
for(int i=0;i<3;i++)
scanf("%d",&a[i]);
for(int i=0;i<3;i++){
if(a[i]==5)
m++;
if(a[i]==7)
n++;
}
if(m==2&&n==1)
printf("YES\n");
else
printf("NO\n");
return 0;	
} //

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

h,w = inpl()
s = [list(input()) for i in range(h)]
if s[0][0] != '#':
    print('Impossible')
    quit()
s[0][0] = '.'
for i in itertools.combinations(range(h+w-2),h-1):
    # print(i)
    cnt = [1] * (h+w-2)
    for l in range(h+w-2):
        if l in i:
            cnt[l] = 0 
    # print(cnt)
    t = [['' for k in range(w)] for j in range(h)] 
    for k in range(h):
        for j in range(w):
            tmp = s[k][j]
            t[k][j] = tmp
    nx = ny = 0
    # print('t')
    # print(t)
    # print('s')
    # print(s)
    # print(i)
    for j in cnt:
        if j:
            nx += 1
        else:
            ny += 1
        if t[ny][nx] == '#':
            t[ny][nx] = '.'
    for j in t:
        if '#' in j:
            break
    else:
        print('Possible')
        # print(i)
        # print(t)
        break
else:
    print('Impossible')


Measured memory_bytes: 46812
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

// 入力
int N;
long long weight[110];
long long value[110];

int MAX_V = 100 * 1000 + 10;
// DP テーブル
long long dp[110][100010];

int main() {
    int N, W; cin >> N >> W;
    for (int i = 0; i < N; ++i) {
        cin >> weight[i] >> value[i];
    }

    // 初期化 (最小問題なので INF に初期化)
    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= MAX_V; ++j) {
            dp[i][j] = INF;
        }
    }

    // 初期条件
    dp[0][0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int s_v = 0;s_v <= MAX_V;++s_v) {
            if (s_v - value[i] >= 0) chmin(dp[i+1][s_v], dp[i][s_v - value[i]] + weight[i]);
            chmin(dp[i+1][s_v], dp[i][s_v]);
        }
    }
    // 答え
    long long max_v = 0;
    for (int i = 0; i < MAX_V; ++i) {
        if (W >= dp[N][i]) max_v = i;
    }
    cout << max_v << endl;
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc143/abc143_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int a, b;
  cin >> a >> b;

  ll ans = a - 2 * b;
  if (ans < 0) ans = 0;

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N;
int X[110];


signed main(){
    cin >> N;
    rep(i, 0, N) cin >> X[i];

    int ans = 0, ans2 = 0;
    int m = accumulate(X, X+N, 0LL)/N;
    int m2 = m+1;

    rep(i, 0, N) ans += (X[i]-m)*(X[i]-m), ans2 += (X[i]-m2)*(X[i]-m2);

    cout << min(ans, ans2) << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter
input=sys.stdin.readline

N=int(input())
SPs=[0]*N
for i in range(N):
  Str,integ = input().split()
  SPs[i] = [Str,int(integ),i+1]

SPs.sort(key=itemgetter(0))
name=''
queue=[]
for sp in SPs:
  if sp[0] != name:
    queue.sort(key=itemgetter(1),reverse=True)
    for q in queue:
      print(q[2])
    queue=[]
    name = sp[0]
    queue.append(sp)
  else:
    queue.append(sp)
queue.sort(key=itemgetter(1),reverse=True)
for q in queue:
  print(q[2])




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;


  

int main() {
  ll N;
  cin>>N;
  ll h[N];
  for(int i=0;i<N;i++){
    cin>>h[i];
  }
  ll P[N];
  ll M[N];
  for(int i=0;i<N;i++){
    P[i]=0;
    M[i]=0;
  }
  for(int i=0;i<N;i++){
    if(i+h[i]>N){
      continue;
    }
    P[i+h[i]]++;
  }
  for(int i=0;i<N;i++){
    if(i-h[i]<0){
      continue;
    }
    M[i-h[i]]++;
  }
  ll ans=0;
  for(int i=0;i<N;i++){
    ans+=P[i]*M[i];
  }
  cout<<ans;
}


Measured memory_bytes: 8276
count = 0
tmp = 0

while True:

    n, x = (int(x) for x in input().split())


    if (n == 0 and x == 0):
        break

    else :

        for i in range(n,2,-1):
            for j in range(i-1,1,-1):
                for k in range(j-1,0,-1):
                    tmp = i+j+k

                    if (x == tmp):
                        count += 1

                    else :
                        continue

        print(count)
        count = 0



Measured memory_bytes: 5600
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int x = sc.nextInt();
	      int a = sc.nextInt();
	      int b = sc.nextInt();
	      int oturi = (x-a) % b;
	      System.out.println(oturi);
	}
}

Measured memory_bytes: 21844
a, b, c, d = map(int, input().split())
if a <= c and b >= c:
    if b < d:
        print(b - c)
    else:
        print(d - c)
elif c <= a and d >= a:
    if d < b:
        print(d - a)
    else:
        print(b - a)
else:
    print (0)

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

int main() {
 int n; cin >> n;
 vector<ll> x(n),sortx(n),ans(n);
 rep(i,n){
   cin >> x[i];
   sortx[i]=x[i];
 }
 sort(sortx.begin(),sortx.end());
 ll left=sortx[n/2-1];
 ll right=sortx[n/2];
 double med=(double)(right+left)/2.0;


 rep(i,n){
   if(x[i]<=med)cout << right << endl;
   else cout << left <<endl;
 }

}

Measured memory_bytes: 6912
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni();
		int[] a = na(n);
		int ct = 0;
		for(int i = 0; i < n; i++) {
			if(a[i] != i + 1) ct++;
		}
		out.println(ct > 2 ? "NO" : "YES");
	}
		
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception 
	{ new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try 
			{ lenbuf = is.read(inbuf); } 
			catch (IOException e) 
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip() 
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() 
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) 
	{ System.out.println(Arrays.deepToString(o)); }
}


Measured memory_bytes: 22996
from decimal import Decimal

	
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


A,B,C,D = map(int,input().split())
A = Decimal(str(A))
B = Decimal(str(B))
C = Decimal(str(C))
D = Decimal(str(D))

G = C * D / gcd(C,D)

#print('{:.100g}'.format(G))

ans = ( B // C - (A-1) // C ) + (B // D - (A-1) // D) - (B // G - (A-1) // G)

print ('{:.100g}'.format(B - A + 1 - ans))


Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n, p;
	cin >> n >> p;
	if(n == 1){
		co(p);
		return 0;
	}else if(n >= 50){
		co(1);
		return 0;
	}
	ll ans = 0;
	repn(i, p){
		ll num = 1;
		rep(j, n) num *= i;
		if(num > p) break;
		else if(!(p%num)) ans = i;
	}
	co(ans);

	return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    int a[100][100] = {0};
    int b[100] = {0};
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++){
        cin >> b[i];
    }
    for (int i = 0; i < n; i++){
        int sum = 0;
        for (int j = 0; j < m; j++){
            sum += a[i][j] * b[j];  
        }
        cout << sum << endl;  
    }
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>

int main()
{
	using namespace std;
	string s;
	getline(cin, s);
	for (int i = 0;i < s.length();i++) {
		if (s[i] == ',') {
			s[i] = ' ';
		}
	}
	cout << s;
}

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

int main(){
  int n;
  cin >> n;
  if(n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9)
    cout << "hon" << endl;
  else if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
    cout << "pon" << endl;
  else
    cout << "bon" << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include<string>
 
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
     
    while(true){
        int a,b;
        string s;
        cin>>a>>s>>b;
        int ans;
        if(s=="?") break;
        else if(s=="+") ans = a+b;
        else if(s=="-") ans = a-b;
        else if(s=="*") ans = a*b;
        else ans = a/b;
        
        printf("%d\n",ans);
    }
     
    return 0;
     
}


Measured memory_bytes: 3228
n,q=map(int,input().split())
s=input()
lr=[list(map(int,input().split())) for _ in range(q)]
L=[0]
c=0
for i in range(n-1):
	if s[i]=='A' and s[i+1]=='C':
		c += 1
	L.append(c)
for l,r in lr:
	print(L[r-1]-L[l-1])

Measured memory_bytes: 30704
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define pi          6.283185307179586232
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  long double r;
  cin>>r;
  cout<<(r*pi)<<endl;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	string s,p;
	cin>>s>>p;
	int n = s.length();
	int m = p.length();
	int ans = m;
	f(i,n-m+1){
		int temp = 0;
		f(j,m){
			if(p[j]!=s[i+j]){
				temp++;
			}
		}
		ans = min(ans,temp);
	}
	cout<<ans<<"\n";
}

int main(){
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
ll ans;
int n;
map<int,int> mp;
int a[N];
int main() {
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		mp[i+a[i]]++;
	}
	for (i=1;i<=n;i++)
		ans=ans+mp[i-a[i]];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 21536
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
int main()
{
    string s;
    cin>>s;
    int a=(s[0]-'0')*10+s[1]-'0',b=(s[2]-'0')*10+s[3]-'0';
    if(1<=a&&a<=12){
        if(1<=b&&b<=12){
            cout<<"AMBIGUOUS";
            return 0;
        }
        else{
            cout<<"MMYY";
            return 0;
        }
    }
    else{
        if(1<=b&&b<=12){
            cout<<"YYMM";
            return 0;
        }
        else{
            cout<<"NA";
            return 0;
        }
    }
}

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

using namespace std;

int main() {
	char a;
	cin >> a;
	if ((a >= 'a') && (a <= 'z')) {
		cout << 'a';
		return 0;
	}
	else {
		cout << 'A';
		return 0;
	}
}

Measured memory_bytes: 3668
#include<iostream>
#include<cstdio>

using namespace std;

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

int n_year[] = {20,19,20,19,20,19,20,19,20,19};
int m_year[] = {20,20,20,20,20,20,20,20,20,20};
int n_s,m_s;
int mireday;

int main()
{
	REP(i,10)
	{
		n_s += n_year[i];
		m_s += m_year[i];
	}
	int tmp = 999 / 3;
	mireday = tmp * m_s + (999 - tmp) * n_s + 1;
		
	int n;
	int y,m,d;
	cin >> n;
	REP(qqq,n)
	{
		cin >> y >> m >> d;
		int ou = 0,tmp1;
		
		tmp1 = (y-1) / 3;
		ou += tmp1 * m_s;
		if(y - 1 - tmp1 > 0)
			ou += (y - 1 - tmp1) * n_s;
		
		
		if(y % 3 == 0)
		{
			REP(i,m-1)
			{
				ou += m_year[i];
			}
		}
		else
		{
			REP(i,m-1)
			{
				ou += n_year[i];
			}
		}
		ou += d;
		
		cout << mireday - ou << endl;
		
	}
				
	return 0;
	
}

Measured memory_bytes: 2976
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i=0; i<(int)c; i++)
int main() {
	int n;
	string s;
	map <string,int > memo;
	cin >>n;

	rep(i,n){
		cin >> s;
		memo[s]+=1;
	}
	cout <<memo.size()<<endl;
	return 0;
}


Measured memory_bytes: 19232
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;

int main() {
	string S,S_;
	cin >> S;
	for (int i = 0; i < S.size(); i += 2) {
		S_.push_back(S[i]);
	}
	cout << S_ << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int x; cin>>x; cout<<3*x*x;
}

Measured memory_bytes: 256
def main():
    d, g = map(int, input().split())
    p, c = [0 for i in range(d)], [0 for i in range(d)]
    for i in range(d):
        p[i], c[i] = map(int, input().split())

    min_p = 1001
    for i in range(2**d):
        s = 0
        max_s, t = -1, 0
        for j in range(d):
            if (i >> j) & 1:
                s += p[j] * (j+1) * 100 + c[j]
                t += p[j]
            else:
                max_s = j + 1

        if g <= s:
            min_p = min(t, min_p)
        elif max_s != -1 and (g-s) // (max_s*100) < p[max_s-1]:
            t += (g-s+max_s*100-1) // (max_s*100)
            min_p = min(t, min_p)

    print(min_p)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064