akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
/*
ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) a=a*a%MOD;
		else res=res*a%MOD;
		b>>=1;
	}
	res=res*a%mod;
	return res;
}
*/
int a[15][15];
int d[15];
int main()
{
	//IOS;
	int n=3;
	REP(i,n) REP(j,n) cin>>a[i][j];

	REP(i,n-1){
		if(a[0][i]-a[1][i]!=a[0][i+1]-a[1][i+1]||
			a[1][i]-a[2][i]!=a[1][i+1]-a[2][i+1]){
			cout<<"No\n";
		return 0;
		}
	}
	cout<<"Yes\n";

	return 0;
}


Measured memory_bytes: 256
n,t,s[2];
D(a,b,c,d){
	t+=a;
	if(n--){
		scanf("%s",s);
		d=*s%8;
		d-2||D(a,c,7-b);//R
		d-3||D(7-b,a,c);//S
		d-4||D(a,7-c,b);//L
		d-5||D(7-c,b,a);//E
		d-6||D(b,7-a,c);//N
		d-7||D(c,b,7-a);//W
	}else{
		printf("%d\n",t);
	}
}
main(){
	for(;scanf("%d",&n)*n;){
		t=0;
		D(1,2,3);
	}
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  int C[4] = {0};
  for(int i = 0; i < N; i++){
    string S;
    cin >> S;
    if(S == "AC"){
      C[0]++;
    }else if(S == "WA"){
      C[1]++;
    }else if(S == "TLE"){
      C[2]++;
    }else{
      C[3]++;
    }
  }
  
  cout << "AC x " << C[0] << endl;
  cout << "WA x " << C[1] << endl;
  cout << "TLE x " << C[2] << endl;
  cout << "RE x " << C[3] << endl;
  
  return 0;
}

Measured memory_bytes: 3592
public class Hello{
    public static void Main(){

        int age = int.Parse(System.Console.ReadLine().Trim());
        
        if(age == 1)
        {System.Console.WriteLine("Hello World");}
        else
        {
            int a = int.Parse(System.Console.ReadLine().Trim());
            int b = int.Parse(System.Console.ReadLine().Trim());
            System.Console.WriteLine(a+b);            
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    ll a, b, c; cin >> a >> b >> c;
    ll d = (c - a - b);
    if(d > 0 && (4*a*b) < (d*d)) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
typedef long double LD;
const int MAXN = 123;
const LD pi = acos((LD)-1);
int x[MAXN], y[MAXN];
int main() {
//    freopen("test.txt", "r", stdin);
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    for (int i = 0; i < n; i++) {
        LD a = 0, b = 4*pi;
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            int tmpx = x[j] - x[i];
            int tmpy = y[j] - y[i];
            LD u = -tmpy, v = tmpx;
            LD norm = sqrt(u*u + v*v);
            LD tmpa = acos(u/norm);
            if (v < 0) {
                tmpa = 2 * pi - tmpa;
            }
            LD tmp1 = max(a, tmpa), tmp2 = min(b, tmpa+pi);
            LD tmp3 = max(a,tmpa+2*pi), tmp4 = min(b, tmpa+3*pi);
            LD tmp5 = max(a+2*pi, tmpa), tmp6 = min(b+2*pi, tmpa+pi);
            if (tmp1 < tmp2) {
                a = tmp1;
                b = tmp2;
            }
            else if (tmp3 < tmp4){
                a = tmp3;
                b = tmp4;
            }
            else {
                a = tmp5;
                b = tmp6;
            }

            if (a > b) break;
            if (a > 2*pi) {
                a -= 2*pi;
                b -= 2*pi;
            }
        }
        if (b-a > 0) a = (b-a)/ (2*pi);
        else a = 0;
        printf("%.20Lf\n", a);
    }
    return 0;
}

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

int main() {

	int N,K;
	scanf("%d %d",&N,&K);
	
	int place[N];
	for( int i=0 ; i<N; i++) {
		scanf("%d", &place[i] );
	}
	
	
	long long dp[N];
	dp[0]=0;
	
	for( int i=1; i<N; i++ ) {
		int cost;
		dp[i] = dp[i-1] + abs ( place[i] - place[i-1] ); 
		for( int j = i-1; j>=0 && j >= i - K ; j-- ) {
			 cost = 	dp[j] + abs( place[i] - place[j] );
			 if( cost < dp[i] ) {
			 	dp[i] = cost;
			}
		}
	}
	
	printf("%lld",dp[N-1] );
	return 0;
}		

Measured memory_bytes: 1280
#include <iostream>
#include <stack>

using namespace std;

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

    stack<char> st;
    for(int i=0; i<l; i++){
        if(s[i]=='B') {
            if (!st.empty()) {
                st.pop();
            }
        }else{
            st.push(s[i]);
        }
    }

    string ret;
    while(!st.empty()){
        ret = st.top() + ret;
        st.pop();
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

ll BASE_NUM = 1000000007;

int main()
{
    // 整数の入力
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    ll ans = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (i % 2 == 0 && A[i] % 2 == 1){
            ans++;
        }
    }

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

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


public class Main{
    public static void main(String... string) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] tmp = reader.readLine().split(" ");
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<tmp.length; i++){
            list.add(Integer.parseInt(tmp[i]));
        }
        list.sort( (a, b) -> a - b);
        int result = list.get(0) + list.get(2) * 10 + list.get(1);
        System.out.println(result);
    }
}

Measured memory_bytes: 27604
#include <iostream>
using namespace std;
int main(){
  long long n,a,b;
  cin>>n>>a>>b;
  if(n==1){
    if(a==b) cout<<1;
    else cout<<0;
  }else{
  if(b>=a)
  cout << (b-a)*(n-2)+1;
  else
  cout<<0;
  }
 return 0;
}

Measured memory_bytes: 256
import queue
H, W = list(map(int, input().split()))
S = list()
for i in range(H) :
    S.append(input())
dist = [[3000 for j in range(W)] for i in range(H)]
dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]
q = queue.Queue()
dist[0][0] = 0
q.put([0, 0])
while q.empty() == False:
    x, y = q.get()
    for i in range(4) :
        nx = x + dx[i]
        ny = y + dy[i]
        if nx >= 0 and ny >= 0 and nx < W and ny < H :
            if S[ny][nx] == '.' and dist[ny][nx] > dist[y][x] + 1 :
                dist[ny][nx] = dist[y][x] + 1
                q.put([nx, ny])
cnt = 0
for i in range(H) :
    for j in range(W) :
        if S[i][j] == '.' :
            cnt += 1
print(-1 if dist[H-1][W-1] == 3000 else cnt - dist[H-1][W-1] - 1)



Measured memory_bytes: 3952
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int A, B; cin >> A >> B;
  bool flag = true;
  rep(i,A+B+1){
    char c; cin >> c;

    if (i<A && isdigit(c)) continue;
    else if (i==A && c=='-') continue;
    else if (i>A && isdigit(c)) continue;
    else {
      flag = false;
    }
  }

  cout << (flag ? "Yes" : "No") << endl;


  // cout << fixed << setprecision(6);
  return 0;
}


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

int N;
queue<string> Q;
vector<string> ans;

int main() {
  cin >> N;
  
  Q.push("a");
  
  while(Q.size() > 0) {
    string S = Q.front();
    Q.pop();
    
    if (S.size() == N) {
      ans.push_back(S);
    } else {
      for (int i = 0; i < S.size() + 1; ++i) {
        if (i == 0) {
          Q.push(S + "a");
        }
        if (i == 1) {
          Q.push(S + "b");
        }
        if (i > 1) {
          char memo;
          if (i == 2) memo = 'b';
          if (i == 3) memo = 'c';
          if (i == 4) memo = 'd';
          if (i == 5) memo = 'e';
          if (i == 6) memo = 'f';
          if (i == 7) memo = 'g';
          if (i == 8) memo = 'h';
          if (i == 9) memo = 'i';
          
          bool nnn = false;
          for (auto t : S) {
            if (t == memo) nnn = true;
          }
          
          if (nnn) {
            string aaa;
            if (memo == 'b') aaa = "c";
            if (memo == 'c') aaa = "d";
            if (memo == 'd') aaa = "e";
            if (memo == 'e') aaa = "f";
            if (memo == 'f') aaa = "g";
            if (memo == 'g') aaa = "h";
            if (memo == 'h') aaa = "i";
            if (memo == 'i') aaa = "j";
            Q.push(S + aaa);
          }
        }
      }
    }
  }
  
  sort(ans.begin(), ans.end());
  for (auto s : ans) {
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 10228
#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 pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 998244353
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-5
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

ull bin(ull a, ull b)
{
    ull res = 1;
    while(b)
    {
        if(b&1) res=((res%mod)*(a%mod))%mod;
        a*=a;
        a%=mod;
        b>>=1;
    }
    return res%mod;
}

ull inv(const ull& a)
{
    return bin(a, mod-2)%mod;
}

ull fact[200005];
ull inverse[200005];

ull ncr(ull n, ull r)
{
    if(r==0 || n==r)
    {
        return 1;
    }

    return ((fact[n]%mod) * (((inverse[r] % mod) * (inverse[n-r]%mod)%mod))%mod)%mod;
}

int main() 
{
    fastio
    fact[0] = 1;
    for(ll i = 1; i<=200000; ++i) 
        fact[i] = fact[i-1]*i, fact[i] %= mod;
    for(ll i = 0; i<=200000; ++i)
        inverse[i] = inv(fact[i])%mod;

    ll n, m, k;
    cin>>n>>m>>k;
    ll ans = 0;
    for(int i = 0; i<=k; ++i) {
        ans += (((ncr(n-1, i)%mod)*(bin(m-1, n-1-i)%mod))%mod)*(m%mod);
        ans %= mod;
    }

    cout<<ans%mod<<endl;
}

Measured memory_bytes: 6776
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline void reverse(Type& arr) { reverse(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1e9+7;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
using P = pair<ll, ll>;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //
    ll N;
    cin >> N;
    vector<ll> d(N);
    rep(i, N) cin >> d[i];
    //
    sort(d);
    //
    cout << d[N / 2 + 0] - d[N / 2 - 1];
    //
    return 0;
}

Measured memory_bytes: 3672
#include <cstdio>
#include <algorithm>
using namespace std;
int dp[2][5010][2];
#define MAX  100000000
int main(void){
	int n;
	scanf("%d",&n);
	int i,j;
	int a[10001];
	for(i=0;i<n-1;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<2;i++){
		for(j=0;j<=5001;j++){
			dp[i][j][0]=MAX;
			dp[i][j][1]=MAX;
		}
	}
	dp[0][0][0]=0;//スタート地点
	for(int i = 0;i < n;i++){
		int m = min(5010,i);
		    for(int j = 0;j <= m;j++){
			dp[(i+1)&1][j+1][0]=min(dp[i&1][j][0],dp[i&1][j][1]+a[i]);
			dp[(i+1)&1][j][1]=min(dp[i&1][j][1],dp[i&1][j][0]+a[i]);
		}
		dp[i&1][0][0]=MAX;

	}
	int min=MAX;
	for(i=0;i<2;i++){
		if(dp[0][n/2][i]<min){
			min=dp[0][n/2][i];
		}
	}
	printf("%d\n",dp[n%2][n/2][0]);

	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

int MOD = 1e9 + 7;
ll INF = 1e18;

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

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

    int cnt1=0, cnt2=0;
    for(int i=1; i<=n; i++){
        if(i % k == 0) cnt1++;
        else if(k % 2 == 0){
            if((i % k) % (k / 2) == 0) cnt2++;
        }
    }
    ll ans1=1, ans2=1;
    for(int i=1; i<=3; i++) ans1 *= cnt1;
    for(int i=1; i<=3; i++) ans2 *= cnt2;

    cout << ans1 + ans2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int A,B,C,D,E,F;
    cin  >> A >> B >> C >> D;
    
    E = max(A,C);
    F = min(B,D);
    
    if(B <= C) {
        cout << 0 << endl;
    }else if(A >= D) {
        cout << 0 << endl;
    }else {
        cout << F - E << endl;
    }
    
    return 0;
}


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

//#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;

mt19937 rnd(time(0));

#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("lights.in", "r", stdin); freopen("lights.out", "w", stdout);
#define s second
#define f first
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pll pair<ll,ll>
#define pii pair<int,int>

const ll INF = 1e18;
constexpr ll mod = 1e9 + 7;

ll x0r(ll x, ll y) { return (x | y) & (~x | ~y); }


void solve() {
    int x,n;
    cin>>x>>n;
    while(n--){
        int o;
        cin>>o;
        x-=o;
    }
    if(x<=0)cout<<"Yes\n";
    else cout<<"No\n";
}


signed main() {
    //ioss
    //clock_t time = clock();
    //if ((double) (clock() - time) / CLOCKS_PER_SEC > 0.96) {
    //file
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


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

int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	double max = 0;
	int ans1 = 0, ans2 = 0;
	for (int i = 0; 100 * a * i <= f; i++) {
		for (int j = 0; 100 * a * i + 100 * b * j <= f; j++) {
			for (int k = 0; 100 * a * i + 100 * b * j + c * k <= f; k++) {
				for (int l = 0; 100 * a * i + 100 * b * j + c * k + d * l <= f; l++) {
					if (max <= double(100 * (c * k + d * l)) / double((100 * a * i + 100 * b * j + c * k + d * l)) && double(100 * (c * k + d * l)) / double((100 * a * i + 100 * b * j + c * k + d * l)) <= double(100 * e) / double(100 + e)) {
						max = double(100 * (c * k + d * l)) / double((100 * a * i + 100 * b * j + c * k + d * l));
						ans1 = 100 * a * i + 100 * b * j + c * k + d * l;
						ans2 = c * k + d * l;
					}
				}
			}
		}
	}
	cout << ans1 << " " << ans2 << endl;
	return 0;
}


Measured memory_bytes: 256
l = input()
arr = l.split(' ')
s = set()
if 1 <= int(arr[0]) <= 100 and 1 <= int(arr[1]) <= 100 and 1 <= int(arr[2]) <= 100:
  for e in arr:
    s.add(e)
s = list(s)
print(len(s))

Measured memory_bytes: 3060
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if (a * b) % 2 == 1:
    print("Yes")
else:
    print("No")




Measured memory_bytes: 38256
s=input()
t=""
i=len(s)
five=["dream","erase"]
flag=0
while s!=t:
  if i>=7 and s[i-7:i]=="dreamer":
    t=s[i-7:i]+t
    i-=7
  elif  i>=6 and s[i-6:i]=="eraser":
    t=s[i-6:i]+t
    i-=6
  elif i>=5 and (s[i-5:i] in five):
    t=s[i-5:i]+t
    i-=5
  else:
    flag=1
    break
if flag==0:
  print("YES")
else:
  print("NO")

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

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

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

constexpr int MAX = 3010000;
constexpr int MOD = 1000000007;

//Please set MAX and MOD!!========================================

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll COM(int n, int k) {
	if (n < k || n < 0 || k < 0) return (0);
	return (fac[n] * (finv[k] * finv[n - k] % MOD) % MOD);
}

ll PERM(int n, int k) {
	if (n < k || n < 0 || k < 0) return (0);
	return (fac[n] * finv[n - k] % MOD);
}


void Main() {
	int N, K; cin >> N >> K;

	auto dp = makeVector(K, K+1, 0ll);

	COMinit();
	dp[0][1] = 1;
	for (int i = 0; i < K; i++) {
		for (int j = 0; j < K; j++) {
			if (i+1 < K) (dp[i+1][j+1] += dp[i][j]) %= mod;
			(dp[i][j+1] += dp[i][j]) %= mod;
		}
		cout << dp[i][K] * COM(N-K+1, i+1) % mod << el;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 105068
#include <iostream>
using namespace std;
int main(){
	int n,a,b,c,d;
	cin >>n>>a>>b>>c>>d;
	int x,y;
	if(n%a ==0){
		x=n/a;
	}
	else{
         x=n/a+1;
	}
	if(n%c ==0){
	    y=n/c;
	}
	else{
		y=n/c+1;
	}
	if(x*b > y*d){
		cout << y*d << endl;
	}
    else{
		cout <<x*b<< endl;
	}
}
    


Measured memory_bytes: 3088
n,m=[int(x) for x in input().rstrip().split()]
l=[[]*n for i in range(n)]
done=[False for i in range(n)]
for i in range(m):
  a,b=[int(x) for x in input().rstrip().split()]
  l[a-1].append(b-1)
  l[b-1].append(a-1)


def bfs():
  stack=[[0,[]]]
  ans=0
  while(stack):
    now,visited=stack.pop(0)
    if len(visited)==n-1:
      ans+=1    
    for i in l[now]:
      if i not in visited:
        stack.append([i,visited+[now]])
  return ans

print(bfs())

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
int syt[110];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		string str;
		cin>>str;
		syt[str[0]-'A']++;
	}
	int ans=0;
	bool flag=false;
	while(true)
	{
		sort(syt,syt+26);
		for(int i=25;i>25-k;i--)
		{
			if(syt[i]==0)
			{
				flag=true;
				break;
			}
			syt[i]--;
		}
		if(flag) break;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	string s, t;
	cin >> s >> t;
	ll n = s.size(), m = t.size();

	vll cnt(26, 0);
	for (ll i = 0; i < n; i++) cnt[s[i] - 'a']++;

	for (ll i = 0; i < m; i++) {
		if (cnt[t[i] - 'a'] == 0) {
			cout << -1 << endl;
			return 0;
		}
	}

	vector<vll> v(26, vll(0));
	for (ll i = 0; i < n; i++) v[s[i] - 'a'].push_back(i);

	ll ans = 1, prev_idx = -1;
	for (ll i = 0; i < m; i++) {
		auto itr = upper_bound(all(v[t[i] - 'a']), prev_idx);
		if (itr == v[t[i] - 'a'].end()) {
			prev_idx = v[t[i] - 'a'][0];
			ans++;
		}
		else prev_idx = *itr;
	}
	cout << n * (ans - 1) + prev_idx + 1 << endl;
}


Measured memory_bytes: 1724
#include<cstdio>
#include<algorithm>
#define f(x) (x)*(x)
using namespace std;
int n,ans=0x7fffffff,cost;
int a[1001];
int Abs(int x)
{
    if(x<0) return -x;
    else return x;
}
int main()
{
    bool f=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(i>1&&a[i]!=a[i-1]) f=1;
    }
    if(!f)
    {
        printf("0\n");
        return 0;
    }
    sort(a+1,a+n+1);
    for(int i=a[1];i<=a[n];i++)
    {
        cost=0;
        for(int j=1;j<=n;j++)
            cost+=(a[j]-i)*(a[j]-i);
        if(cost<ans) ans=cost;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
def factorization(n):
    i = 2
    L = []
    num = n
    while i**2 <= n:
        c = 0
        while num%i == 0:
           num //= i
           c += 1 
        
        if c > 0:
            L.append((i, c))
        i += 1

    if num > 1:
        L.append((n, 1))
    return L

N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()
facts = factorization(P)
ans = 1
for p, c in facts:
    a = c//N
    ans *= p**a
print(ans)

Measured memory_bytes: 9128
#include <iostream>
using namespace std;
int main(void){
    string S,T;
    char s;
    int i,j,n;
    cin>>S>>T;
    n=S.length();
    for(i=0;i<100;i++){
        if(S==T){
            cout<<"Yes"<<endl;
            return 0;
        }
        s=S[0];
        for(j=0;j<n-1;j++){
            S[j]=S[j+1];
        }
        S[n-1]=s;
    }
    cout<<"No"<<endl;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

template <class T, class Op>
class SegmentTree {
private:
    const Op op;
    const T ID;
    std::vector<T> vec;
    size_t sz;

public:
    explicit SegmentTree(size_t _n, Op _op, T _identity) noexcept
        : op(_op), ID(_identity) {
        sz = 1;
        while (sz < _n) sz <<= 1;
        vec.resize(sz * 2, ID);
    }
    explicit SegmentTree(const std::vector<T>& _vec, Op _op, T _identity) noexcept
        : op(_op), ID(_identity) {
        size_t n = _vec.size();
        sz = 1;
        while (sz < n) sz <<= 1;
        vec.resize(sz * 2, ID);
        set_array(_vec);
    }
    void set_value(size_t _idx, T _val) noexcept {
        vec[_idx + sz] = _val;
    }
    template <class RandomIt>
    void set_array(RandomIt _begin, RandomIt _end) noexcept {
        std::copy(_begin, _end, vec.begin() + sz);
    }
    void set_array(const std::vector<T>& _newvec) noexcept {
        set_array(_newvec.begin(), _newvec.end());
    }
    void build() noexcept {
        for (size_t i = sz - 1; i > 0; i--) {
            vec[i] = op(vec[i * 2], vec[i * 2 + 1]);
        }
    }
    void update(size_t _idx, T _val) noexcept {
        _idx += sz;
        vec[_idx] = _val;
        for (_idx >>= 1; _idx > 0; _idx >>= 1) {
            vec[_idx] = op(vec[_idx * 2], vec[_idx * 2 + 1]);
        }
    }
    // 区間[_i, _r)に対するクエリを実行する
    T query(size_t _l, size_t _r) const noexcept {
        T l_val = ID, r_val = ID;
        _l += sz, _r += sz - 1;
        for (; _l <= _r; _l >>= 1, _r >>= 1) {
            if (_l & 1) l_val = op(l_val, vec[_l++]);
            if (!(_r & 1)) r_val = op(r_val, vec[_r--]);
        }
        return op(l_val, r_val);
    }
    const T& operator[](size_t _idx) const noexcept {
        return vec[_idx + sz];
    }
};

using balpha = bitset<26>;

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

    int N;
    cin >> N;
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    auto op = [](const balpha& a, const balpha& b) { return a | b; };
    SegmentTree<balpha, decltype(op)> seg(N, op, balpha());
    for (int i = 0; i < N; i++) {
        seg.set_value(i, balpha().set(S[i] - 'a'));
    }
    seg.build();
    while (Q--) {
        int t;
        cin >> t;
        if (t == 1) {
            int idx;
            char c;
            cin >> idx >> c;
            --idx;
            seg.update(idx, balpha().set(c - 'a'));
        }
        else {
            int l, r;
            cin >> l >> r;
            --l, --r;
            cout << seg.query(l, r + 1).count() << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 9116
#include<cstdio>
#include<algorithm>

using namespace std;

int abs(int x){
    if (x > 0) return x;
    else return -x;
}

int main(){
    int n;
    scanf("%d", &n);
    int x[n], y[n], h[n];
    for(int i = 0; i < n; i++){
        scanf("%d %d %d", &x[i], &y[i], &h[i]);
    }

    int H;

    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            int height;
            for(int k = 0; k < n; k++){
                if (h[k] > 0){
                    height = h[k] + abs(x[k] - i) + abs(y[k] - j);
                    break;
                }
            }
            bool flag = true;
            for(int k = 0; k < n; k++){
                if (h[k] != max(height - abs(x[k] - i) - abs(y[k] - j), 0)) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                printf("%d %d %d\n", i, j, height);
                return 0;
            }
            

        }
        
    }
    
}

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

int main(){
	int a,b,c,k;
  	cin>>a>>b>>c>>k;
  
  	long long sum = 0;
  	long long card = 0;
  
  	if(a > k){
      	sum += k;
    	cout<<k;
      	return 0;
    }
  	if(a <= k){
    	sum += a;
      	k -= a;
    }
  
  	if(b > k){
    	cout<<sum;
      	return 0;
    }
  	if(b <= k){
    	k -= b;
    }
  
  	if(c > k){
    	sum -= k;
      	cout<<sum;
      	return 0;
    }
  	if(c <= k){
    	sum -= c;
      	cout<<sum;
      	return 0;
    }
  
  return 0;
}

Measured memory_bytes: 3184
fun main(args: Array<String>?): Unit {
    operator fun Pair<IntRange, IntRange>.contains(that: Point): Boolean = that.x in first && that.y in second
    operator fun Array<Array<BooleanArray>>.get(state: State): Boolean = this[state.direction.index][state.position.y][state.position.x]
    operator fun Array<Array<BooleanArray>>.set(state: State, value: Boolean): Unit {this[state.direction.index][state.position.y][state.position.x] = value}
    val (n, m) = readLine()!!.trim().split(' ').map(String::toInt)
    val state = Array(n){ readLine()!!.trim()}
    val (sx, sy) = (0 until m).mapNotNull { x -> (0 until n).find{ y -> state[y][x] in "^v<>"}?.let{ y -> Pair(x, y)} }.first()
    val goal = (0 until m).mapNotNull { x -> (0 until n).find{ y -> state[y][x] == 'G'}?.let{y -> Point(x, y)} }.first()
    val range = Pair(0 until m, 0 until n)
    val isPassed = Array(4){Array(n){BooleanArray(m){false}}}
    var current = when(state[sy][sx]) {
        '^' -> State(Point(sx, sy), Direction.North)
        '>' -> State(Point(sx, sy), Direction.East)
        'v' -> State(Point(sx, sy), Direction.South)
        '<' -> State(Point(sx, sy), Direction.West)
        else -> TODO()
    }
    while(current.position != goal && !isPassed[current]) {
        isPassed[current] = true
        val next = current.moveForward()
        if (next.position in range && state[next.position.y][next.position.x] != '#') {
            val right = next.turnRight().moveForward()
            if (next.position != goal && right.position in range && state[right.position.y][right.position.x] != '#') {
                isPassed[next] = true
                current = right
            }else
                current = next
        }else
            current = current.turnLeft()
    }
    if (current.position == goal) {
        println((0 until m).sumBy{ x -> (0 until n).count{ y -> (0 until 4).any{ d -> isPassed[d][y][x]}}} + 1)
    }else {
        println(-1)
    }
}
data class State(val position: Point, val direction: Direction) {
    fun moveForward(): State = State(position.moved(direction), direction)
    fun turnRight(): State = State(position, direction.turnRight())
    fun turnLeft(): State = State(position, direction.turnLeft())
}
data class Point(val x: Int, val y: Int)
fun Point.moved(direction: Direction): Point {
    return when(direction) {
        Direction.North -> Point(x, y - 1)
        Direction.East -> Point(x + 1, y)
        Direction.South -> Point(x, y + 1)
        Direction.West -> Point(x - 1, y)
    }
}
enum class Direction(val index: Int) {
    North(0){
        override fun turnRight(): Direction = East
    },
    East (1){
        override fun turnRight(): Direction = South
    },
    South (2){
        override fun turnRight(): Direction = West
    },
    West (3){
        override fun turnRight(): Direction = North
    };

    abstract fun turnRight(): Direction
    fun turnLeft(): Direction = turnRight().turnRight().turnRight()
}


Measured memory_bytes: 34828
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> G[N];
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> used(N, 0);
    queue<int> qf, qs;
    qf.push(0);
    qs.push(N - 1);
    used[0] = 1;
    used[N - 1] = 2;
    int cnt = 1;
    int cnt2 = 1;
    while(!qf.empty() || !qs.empty()){
        if(!qf.empty()){
            int tec = 0;
            while(cnt > 0){
                int t = qf.front();
                qf.pop();
                for(int i : G[t]){
                    if(used[i] == 0){
                        tec++;
                        qf.push(i);
                        used[i] = 1;
                    }
                }
                cnt--;
            }
            cnt = tec;
        }
        if(!qs.empty()){
            int tec2 = 0;
            while(cnt2 > 0){
                int s = qs.front();
                qs.pop();
                for(int i : G[s]){
                    if(used[i] == 0){
                        tec2++;
                        qs.push(i);
                        used[i] = 2;
                    }
                }
                cnt2--;
            }
            cnt2 = tec2;
        }
    }
    cnt = 0;
    cnt2 = 0;
    for(int i = 0; i < N; i++){
        if(used[i] == 1) cnt++;
        else if(used[i] == 2) cnt2++;
    }
    if(cnt <= cnt2) cout << "Snuke" << endl;
    else cout << "Fennec" << endl;
}

Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c,d;
    cin >>a>>b>>c>>d; 
    long long x = max(a*c, a*d);
    long long y = max(b*c,b*d);
    long long ans = max(x,y);
    cout << ans << endl;
}

Measured memory_bytes: 3632
import sys

N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

count=0

for i in range(N):
    if(x[i]==y[i]):
        count+=1
    else:
        count=0
    if (count==3):
        print('Yes')
        sys.exit()
print('No')

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n-1);
  for(int i=0; i<n-1; i++) {
    cin >> b.at(i);
  }
  a.at(0) = b.at(0);
  a.at(n-1) = b.at(n-2);
  long long ans = a.at(0) + a.at(n-1);
  for(int i=1; i<n-1; i++) {
    a.at(i) = min(b.at(i-1), b.at(i));
    ans += a.at(i);
  }
  cout << ans << endl;
}

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

int main() {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if ( A+B > C+D ){
		cout << "Left" << endl;
	}
	else if ( A+B == C+D ){
		cout << "Balanced" << endl;
	}
	else if ( A+B < C+D ) {
		cout << "Right" << endl;
	}
}

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

int main(){
  int n;
  cin >> n;
  int a[22];
  int b[55];
  int c[55];
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  for(int i=0; i<n; i++){
    cin >> b[i];
  }
  for(int i=0; i<n-1; i++){
    cin >> c[i];
  }
  int stf = 0;
  for(int i=0; i<n; i++){
    if(i==n-1){
      stf += b[a[i]-1];
      break;
    }
    stf += b[a[i]-1];
    if(a[i+1]==a[i]+1){
      stf += c[a[i]-1];
    }
  }
  cout << stf << endl;
  return 0;
}

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

int main() {

  int N;
  string S,T;
  cin >> N >> S >> T;

  for(int i = 0;i < N;i++) {
    cout << S.at(i) << T.at(i);
  }

}


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

int main() {
    char c;
    cin >> c;
    cout << ((c == 'a') || (c == 'e') || (c == 'i')
    || (c == 'o') || (c == 'u') ? "vowel" : "consonant") << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <stack>
#include <string>

using namespace std;
int main(){
  string hoge,hogehoge;
  stack<char> foo;

  while(1){

    while(!(foo.empty()))foo.pop();
    hogehoge = "\0";
    getline(cin,hoge);
    if(hoge == ".")break;

    for(int i = 0 ; i < (int)hoge.size(); i++ ){
      if(hoge[i] == '[' ||hoge[i] == '(' ||hoge[i] == ')' ||hoge[i] == ']' ){
	hogehoge+=hoge[i];
      }
    }

    for(int i = 0 ; i < (int)hogehoge.size() ; i++ ){
      if(hogehoge[i] == '['||hogehoge[i] == '('){
	foo.push(hogehoge[i]);
      }else if(hogehoge[i] == ']' && !(foo.empty()) && foo.top() == '['){
	foo.pop();
      }else if(hogehoge[i] == ')' && !(foo.empty()) && foo.top() == '('){
	foo.pop();
      }else goto bad;
    }
    if(foo.empty()){cout << "yes" << endl;continue;}
  bad: cout << "no" << endl; 
  }
  return 0;
}

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

    #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #define rep(i,a,b) for(int i=a; i<b; i++)
    #define ll long long
    #define pb push_back
    #define inf 1e+18L
    #define MOD 1000000007
    #define MAXN 1000007

    int n;
    vector<vector<vector<long double>>> dp(307,vector<vector<long double>>(307,vector<long double>(307,-1)));
    long double solve(int a, int b, int c)
    {
        if(a<0 || b<0 || c<0) return 0;
        if(dp[a][b][c] != -1) return dp[a][b][c];
        long double A=a, B=b, C=c;
        long double currans = 0;
        currans = (A/n * solve(a-1,b,c)) + (B/n * solve(a+1,b-1,c)) + (C/n * solve(a,b+1,c-1)) + 1;
        currans *= n;
        currans /= (a+b+c);
        dp[a][b][c] = currans;
        return dp[a][b][c];
    }

    int main()
    {
        FastIO
        dp[0][0][0]=0;
        cin >> n;
        vector<int> cnt(4,0);
        int x;
        rep(i,0,n)
        {
            cin >> x;
            cnt[x]++;
        }
        cout << fixed << setprecision(10) << solve(cnt[1], cnt[2], cnt[3]);
        return 0;
    }


Measured memory_bytes: 459648
import java.util.*;
public class Main {

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

        while (sc.hasNext()){
            int []a = new int[4];
            int []b = new int[4];

                for (int i=0;i<a.length;i++){
                    a[i] = sc.nextInt();
                }
                for (int i=0;i<b.length;i++){
                    b[i] =sc.nextInt();
                }
                int hit=0;
                for (int i=0;i<4;i++) {
                    if (a[i] == b[i]) {
                        hit++;
                    }
                }
                int blow=0;
            for (int i=0;i<a.length;i++){
                for (int j=0;j<b.length;j++){
                    if (a[i] == b[j] & i != j){
                        blow++;
                    }
                }
            }
            System.out.println(hit +" "+blow);
        }
    }
}

Measured memory_bytes: 18240
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int b[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",b+i);
		b[i]=-b[i];
	}
	std::sort(b,b+a);
	for(int i=0;i<a;i++)b[i]=-b[i];
	for(int i=0;i<a;i++){
		if(i>=b[i]){
			int cnt=0;
			for(int j=i;j<a;j++){
				if(i==b[j])cnt++;
			}
			if(cnt%2||(i&&(b[i-1]-i)%2))printf("First\n");
			else printf("Second\n");
			return 0;
		}
	}
	if((b[a-1]-a)%2)printf("First\n");
	else printf("Second\n");
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};

int main(){
    int n;
    cin >> n;
    int ans = 0;
    FOR(i, 1, n + 1){
        ans += i;
    }
    cout << ans << endl;
}

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

typedef long long int lli;

int main(void)
{
	lli x, y;
	scanf("%lld%lld", &x, &y);
	lli res = 0;
	while(x <= y) x *= 2, res++;
	printf("%lld\n", res);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void Trace(int* a, int n);

int main(void){
	int n;
	int a[200];

	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	Trace(a, n);

	for(int i=1; i<n; i++){
		int key = a[i];
		int j=i-1;
		for(; j>=0 && a[j] > key; j--){
			a[j+1] = a[j];
		}
		a[j+1] = key;
		Trace(a, n);
	}


	return 0;
}

void Trace(int* a, int n){
	for(int i=0; i<n; i++){
		if(i!=n-1)printf("%d ", a[i]);
		else printf("%d\n", a[i]);
	}
}

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

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

    string ret = "No";
    if (S == "hi" || S == "hihi" || S == "hihihi" || S == "hihihihi" ||
        S == "hihihihihi") {
        ret = "Yes";
    }

    cout << ret << endl;
}

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

int main()
{
    int N;
    cin >> N;
    map<string,int> mp;

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

    int maxS = 0;
    for(auto e:mp)
    {
        maxS = max(maxS,e.second);
    }

    for(auto e:mp)
    {
        if(e.second == maxS)
        {
            cout << e.first << endl;
        }
    }

    return 0;


}

Measured memory_bytes: 25344
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x=0,y=0,t=0,a,b,c;
    for(int i=1;i<=n;i++)
    {
        cin>>c>>a>>b;
        if(abs(x-a)+abs(y-b)>c-t)
        {
            cout<<"No"<<endl;
            return 0;
        }
        if((abs(x-a)+abs(y-b))%2==0 &&(c-t)%2==1)
        {
            cout<<"No"<<endl;
            return 0;
        }
        if((abs(x-a)+abs(y-b))%2==1 &&(c-t)%2==0)
        {
            cout<<"No"<<endl;
            return 0;
        }
        x=a;y=b;t=c;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int n,i,j,suu;
	char gara;
	int card[4][13]={0};
	int mark[4]={'S','H','C','D'};
	scanf("%d",&n);
	for(i=0;i<2*n;i++)
	{
		scanf("%c %d",&gara,&suu);
		if(gara=='S')
		{
			card[0][suu-1]=1;
		}
		else if(gara=='H')
		{
			card[1][suu-1]=1;
		}
		else if(gara=='C')
		{
			card[2][suu-1]=1;
		}
		else if(gara=='D')
		{
			card[3][suu-1]=1;
		}
	}
	for(i=0;i<4;i++)
	{
		for(j=0;j<13;j++)
		{
			if(card[i][j]!=1)
			{
				if(i==0)
				{
					printf("%c %d\n",mark[i],j+1);
				}
				else if(i==1)
				{
					printf("%c %d\n",mark[i],j+1);
				}
				else if(i==2)
				{
					printf("%c %d\n",mark[i],j+1);
				}
				else if(i==3)
				{
					printf("%c %d\n",mark[i],j+1);
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string sec;
    cin >> sec;
    for(int i = 0; i < sec.length()-1; i++)
    {
        if(sec[i] == sec[i+1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;
    
    return 0;
}


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

void insertionSort(vector<int> &V, int N)
{
    for (int i = 0; i < N; i++)
    {
        cout << V[i];
        if (i != N - 1)
        {
            cout << " ";
        }
    }
    cout << endl;

    for (int i = 1; i < N; i++)
    {
        int v = V[i];
        int j = i - 1;
        while (j >= 0 && V[j] > v)
        {
            V[j + 1] = V[j];
            j--;
        }
        V[j + 1] = v;

        for (int k = 0; k < N; k++)
        {
            cout << V[k];
            if (k != N - 1)
            {
                cout << " ";
            }
        }
        cout << endl;
    }
}

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

    insertionSort(A, n);

    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <vector>

#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DV_NUM (100000007)

using namespace std;
 
int main()
{

 string S;
 cin >> S;

 size_t size = S.length();

 string Answer = "x";

 for (int i=0;i<size-1;i++){
   Answer += "x";
 }

 cout << Answer << endl;
 
    return 0;
 
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int i,j,position;
	double x[3],y[3],xp,yp;
	double a[3],b[3];
	double min_x,min_y,buf;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&xp,&yp)!=EOF){
		for(i=0;i<3;i++){
			min_x=x[i];
			min_y=y[i];
			position=i;
			for(j=i;j<3;j++){
				if(min_x>x[j]){
					min_x=x[j];
					position=j;
				}else if(min_x==x[j]){
					if(min_y>y[j]){
						min_x=x[j];
						position=j;
					}
				}
			}
			buf=x[i];
			x[i]=min_x;
			x[position]=buf;
			buf=y[i];
			y[i]=y[position];
			y[position]=buf;
		}
		a[0]=(y[0]-y[1])/(x[0]-x[1]);
		b[0]=y[0]-a[0]*x[0];
		a[1]=(y[1]-y[2])/(x[1]-x[2]);
		b[1]=y[1]-a[1]*x[1];
		a[2]=(y[2]-y[0])/(x[2]-x[0]);
		b[2]=y[2]-a[2]*x[2];

		if(xp<x[0]){
			printf("NO\n");
		}else if(x[0]==x[1]){
			if(a[1]*xp+b[1]>yp&&a[2]*xp+b[2]<yp) printf("YES\n");
			else printf("NO\n");
		}else if(x[1]==x[2]){
			if(a[2]*xp+b[2]>yp&&a[0]*xp+b[0]<yp) printf("YES\n");
			else printf("NO\n");
		}else if(xp<x[1]){
			if(a[0]*x[2]+b[0]<y[2]){
				if(a[2]*xp+b[2]>yp&&a[0]*xp+b[0]<yp) printf("YES\n");
				else printf("NO\n");
			}else{
				if(a[0]*xp+b[0]>yp&&a[2]*xp+b[2]<yp) printf("YES\n");
				else printf("NO\n");
			}
		}else if(xp<x[2]){
			if(a[1]*x[0]+b[1]<y[0]){
				if(a[1]*xp+b[1]<yp&&a[2]*xp+b[2]>yp) printf("YES\n");
				else printf("NO\n");
			}else{
				if(a[2]*xp+b[2]<yp&&a[1]*xp+b[1]>yp) printf("YES\n");
				else printf("NO\n");
			}
		}else if(x[2]<=xp){
			printf("NO\n");
		}

	}
	return 0;
}

Measured memory_bytes: 612