akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include<random>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint 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<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N, P[100000];
lint idx[100001];
int main() {
	cin >> N;
	REP(i, N) {
		cin >> P[i];
		idx[P[i]] = i;
	}
	multiset<lint> st = { -1, -1, N, N };
	lint ans = 0;
	IREP(i, N) {
		st.insert(idx[i + 1]);
		auto itr = st.lower_bound(idx[i + 1]);
		auto l1 = prev(itr);
		auto l2 = prev(l1);
		auto r1 = next(itr);
		auto r2 = next(r1);
		lint num = (*l1 - *l2) * (*r1 - idx[i + 1]) + (*r2 - *r1) * (idx[i + 1] - *l1);
		ans += (i + 1) * num;
	}
	cout << ans << endl;
}


Measured memory_bytes: 9768
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;

// 3-color
ll dp[301][90001];
// 2-color
ll dp2[301][90001];
static ll mod = 998244353;

int main() {

  int N;
  cin >> N;
  int a[N+1];
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ll all = 1;
  for (int i = 1; i <= N; i++) {
    all = (all*3)%mod;
  }
  dp[1][a[1]]+=1;
  dp[1][0]+=2;
  dp2[1][a[1]]+=1;
  dp2[1][0]+=1;
  for (int t_num = 2; t_num <= N; t_num++) {
    for (int i = 0; i <= sum; i++) {
      dp[t_num][i] = (dp[t_num][i]+(dp[t_num-1][i]*2))%mod;
      dp2[t_num][i] = (dp2[t_num][i]+dp2[t_num-1][i])%mod;
      if (i+a[t_num] <= 90000) {
        dp[t_num][i+a[t_num]] = (dp[t_num][i+a[t_num]]+dp[t_num-1][i])%mod;
        dp2[t_num][i+a[t_num]] = (dp2[t_num][i+a[t_num]]+dp2[t_num-1][i])%mod;
      }
    }
  }
  ll subtract = 0;
  ll add = 0;
  for (int i = ceil(sum/2.0); i <= sum; i++) {
    subtract = (subtract+dp[N][i])%mod;
  }
  subtract = (subtract*3)%mod;
  if (sum % 2 == 0) {
    add = dp2[N][sum/2];
    add = (add*3)%mod;
  }
  ll ans_sub = (subtract - add)%mod;
  ll ans = ((all - ans_sub) + mod)%mod;
  cout << ans << endl;
  return 0;
}


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

int main(){
    int x, y, z; cin >> x >> y >> z;
    x -= z;
    cout << x/(z + y) << endl;
}

Measured memory_bytes: 256
def main():
	import sys
	input = sys.stdin.readline
	A, B = list(map(int, input().split()))
	if (A - B) % 2 == 0:
		ans = (A + B) / 2
		print(int(ans))
	else:
		print('IMPOSSIBLE')


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
def main():
    N, K = map(int, input().split())

    if K == 0:
        print(N ** 2)
        return

    ans = 0
    for b in range(K + 1, N + 1):
        q, r = divmod(N, b)
        ans += q * (b - K) + max(0, r - (K - 1))
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

# a % b >= K


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  int r; scanf("%d", &r);
  double pi = acos(-1);
  printf("%.15lf\n", 2*pi*r);
  return 0;
}

Measured memory_bytes: 3828
N, A, B = map(int,input().split())
if ((A-B)%2==0):
  ans = abs(A-B)//2
elif (N-B <= A-1):
  ans = (2*N -A-B+1)//2
elif (N-B > A-1):
  ans = (B+A-1)//2
print(ans)

Measured memory_bytes: 9040
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  a = a + b;
  b = c + d;
  if (a > b) cout << "Left";
  else if (a < b) cout << "Right";
  else cout << "Balanced";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	map<char,string> atoc;
	atoc[' ']="101";
	atoc['\'']="000000";
	atoc[',']="000011";
	atoc['-']="10010001";
	atoc['.']="010001";
	atoc['?']="000001";
	atoc['A']="100101";
	atoc['B']="10011010";
	atoc['C']="0101";
	atoc['D']="0001";
	atoc['E']="110";
	atoc['F']="01001";
	atoc['G']="10011011";
	atoc['H']="010000";
	atoc['I']="0111";
	atoc['J']="10011000";
	atoc['K']="0110";
	atoc['L']="00100";
	atoc['M']="10011001";
	atoc['N']="10011110";
	atoc['O']="00101";
	atoc['P']="111";
	atoc['Q']="10011111";
	atoc['R']="1000";
	atoc['S']="00110";
	atoc['T']="00111";
	atoc['U']="10011100";
	atoc['V']="10011101";
	atoc['W']="000010";
	atoc['X']="10010010";
	atoc['Y']="10010011";
	atoc['Z']="10010000";

	map<string,char> ctoa;
	ctoa["00000"]='A';
	ctoa["00001"]='B';
	ctoa["00010"]='C';
	ctoa["00011"]='D';
	ctoa["00100"]='E';
	ctoa["00101"]='F';
	ctoa["00110"]='G';
	ctoa["00111"]='H';
	ctoa["01000"]='I';
	ctoa["01001"]='J';
	ctoa["01010"]='K';
	ctoa["01011"]='L';
	ctoa["01100"]='M';
	ctoa["01101"]='N';
	ctoa["01110"]='O';
	ctoa["01111"]='P';
	ctoa["10000"]='Q';
	ctoa["10001"]='R';
	ctoa["10010"]='S';
	ctoa["10011"]='T';
	ctoa["10100"]='U';
	ctoa["10101"]='V';
	ctoa["10110"]='W';
	ctoa["10111"]='X';
	ctoa["11000"]='Y';
	ctoa["11001"]='Z';
	ctoa["11010"]=' ';
	ctoa["11011"]='.';
	ctoa["11100"]=',';
	ctoa["11101"]='-';
	ctoa["11110"]='\'';
	ctoa["11111"]='?';
	
	for(string as;getline(cin,as);){
		string cs;
		rep(i,as.size())
			cs+=atoc[as[i]];
		while(cs.size()%5)
			cs+='0';
		string res;
		for(int i=0;i<cs.size();i+=5)
			res=res+ctoa[cs.substr(i,5)];
		cout<<res<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
/*
AizuOnline A2197
Title
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;
//
main()
{
  int i,c;

  while(EOF!=scanf("%d",&n) && n)
    {
      c=0;
      for(i=2;i*(i+1)<=2*n;i++)
	if(((n-(i-1)*i/2) % i)==0)
	  c++;
      printf("%d\n",c);
    }
  return(0);
}

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

#define ll long long

int n,m;
int L,R,D;
vector<pair<int,int> >mp[100100];
int dis[100100];
bool vis[100100];
int flag;

void dfs(int u,int pre)
{
	if(!flag) return;
	 int sz=mp[u].size();
	 pair<int,int>tmp;
	 for(int i=0;i<sz;++i)
	 {
	 	tmp=mp[u][i];
	 	if(vis[tmp.first])
	 	{
	 		if(dis[u]+tmp.second!=dis[tmp.first])
	 		{
	 			flag=0;return;
	 		}
	 	}
	 	else
	 	{
	 		vis[tmp.first]=1;
	 		dis[tmp.first]=dis[u]+tmp.second;
	 		dfs(tmp.first,u);
	 	}
	 }
}

int main(int argc, char const *argv[])
{
	/* code */
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;++i)
	{
		scanf("%d %d %d",&L,&R,&D);
		mp[R].push_back(make_pair(L,D));
		mp[L].push_back(make_pair(R,-D));
	}
	flag=1;
	for(int i=1;i<=n;++i) if(!vis[i])
	{
		vis[i]=1;
		dfs(i,-1);
	}
	if(flag) puts("Yes");else puts("No");
	return 0;
}

Measured memory_bytes: 12032
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

X, Y = reads()
print(next(i for i in count(0) if (X << i) > Y))
  


Measured memory_bytes: 3700
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Set<Integer> set = new HashSet<>();
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();
        int[] p = new int[N];
        int tmp;
        for(int i = 0; i < N; i++) {
            tmp = scanner.nextInt();
            set.add(tmp);
        }
        int min = Math.abs(-102) - X;
        int val = -102;
        for(int i = -101; i < 102; i++) {
            if(set.contains(i)) continue;
            int t = Math.abs(i - X);
            if(t < min) {
                min = t;
                val = i;
            }else if(t == min && i < val ){
                val = i;
            }
        }
        System.out.println(val);
    }
}

Measured memory_bytes: 35968
from collections import Counter


def main() -> None:
    n = int(input())
    p = [int(i) for i in input().split()]

    # 奇数番目の配列
    l1 = [int(p[i]) for i in range(0, n, 2)]
    # 偶数盤面の配列
    l2 = [int(p[i]) for i in range(1, n, 2)]

    if len(set(p)) == 1:
        # ゾロ目判定
        print(n // 2)
    else:
        lc1 = Counter(l1).most_common(2)
        lc2 = Counter(l2).most_common(2)

        if lc1[0][0] == lc2[0][0]:
            # 最頻値がかぶってしまった場合
            print(n - max(lc1[0][1] + lc2[1][1], lc1[1][1] + lc2[0][1]))
        else:
            # かぶっていなかったら最頻値を引く
            print(n - lc1[0][1] - lc2[0][1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 16604
#include <iostream>
#include <string>
#include <cctype>
#include <stdio.h>
#include <string.h>
using namespace std;

int main(){
    string str;
    getline(cin, str);
    for(int i = 0; i < str.length(); i++) {
        if (isupper(str[i])) {
            str[i] = tolower(str[i]);
        } else if (islower(str[i])) {
            str[i] = toupper(str[i]);
        }
    }
    cout << str << endl;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll ans=0,MD=998244353,n;
ll a[3005],s;
ll dp[3005][3005],vis[3005][3005];
ll solve(ll idx,ll sum)
{
	if(idx==n)
	{
		// cout<<sum<<" "<<idx<<endl;
		ll r1=0;
		if(sum==a[idx])
			r1=(r1+1)%MD;
		if(sum==s)
		{
			// if(sum==4)
			ans=(ans+(idx*r1)%MD)%MD;
			// cout<<ans<<endl;
		}
		return dp[idx][sum]=r1;
	}
	
	if(vis[idx][sum])
		return dp[idx][sum];
	
	vis[idx][sum]=1;
	ll r1=0;
  	if(sum>=a[idx])
		r1=(r1+solve(idx+1,sum-a[idx]))%MD;
	ll r2=solve(idx+1,sum);

	if(sum==a[idx])
		r1=(r1+n-idx+1)%MD;

	if(sum==s)
		ans=(ans+(idx*r1)%MD)%MD;

	r1=(r1+r2)%MD;
	return dp[idx][sum]=r1;
}


int main()
{
    ios_base::sync_with_stdio(false);
	ll i,j,k,x,y,t,m;

	cin >> n >> s;
	for(i=1;i<=n;i++)
		cin >> a[i];

	solve(1,s);
	cout<<ans<<endl;
}


Measured memory_bytes: 141312
t,T,a,A,b,B=map(int, open(0).read().split())
x,y=(a-b)*t,(A-B)*T
if x+y==0:
 r="infinity"
else:
 s,t=divmod(-x, x+y)
 r=0 if s<0 else s*2+(1 if t else 0)
print(r)

Measured memory_bytes: 38384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  int ans = (H-h) * (W-w);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
using namespace std;

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

    for(int i=1;i<N;i++){
        C=N%i;
        A=(N-C)/i;
        ans+=A;
        if(C==0)    ans--;
    }

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

Measured memory_bytes: 3632
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;

	vector<bool> visited(N * 100 + 1);
	visited[0] = true;
	for (int i = 0; i < N; i++) {
		int s;
		cin >> s;

		for (int i = N * 100 - s; i >= 0; i--) {
			if (visited[i]) visited[i+s] = true;
		}
	}

	for (int i = N * 100; i >= 0; i--) {
		if (i % 10 == 0) continue;
		if (visited[i]) {
			cout << i << endl;
			return 0;
		}
	}

	printf("0\n");
	return 0;
}

Measured memory_bytes: 256
/* Author : Harshit Jain a.k.a. iharshit009 */
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define int              long long
#define endl 			 "\n";
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define all(x)           x.begin(), x.end()
#define deb(x)         cout << '>' << #x << ':' << x << endl;
const int mod = 1e9 + 7;
using namespace std;
const int N = 1e5 + 5; 
int n;
// int a[N];

void fuck(){

cin >> n;
// deb(n)
int ans = 0;
for(int i = 0; i<n; i++){
	int a,b;
	cin >> a>>b;
	// deb(a)
	// deb(b)
	if(a == b){
		ans++;
		// cout << "Ddddd";
	}
	// deb(ans)
	else{
		ans = 0;
	}
	if(ans == 3){
		// deb(ans)
		cout << "Yes" << endl;
		return;
	}
	// deb(ans)
}
cout << "No" << endl;
return;


}

int32_t main(){
IOS;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
int t = 1;
// cin >>t;
while(t--){
	fuck();
// Easy things to check:
// - LONG LONGS (WA)
// - const int N is correct (WA, RTE)
// - .size()-k underflow (WA, RTE, TLE)
// - small n edge cases (WA)
 
// Rare mistakes made in the past:
// - division by 0 (WA)
// - integer division (WA)
// - setprecision (WA)
// - INF not big enough using ll (WA)
// - setting min to 0 instead of -INF (WA)
// - outputting debug (WA)
// - allocating too much memory (locRTE, MLE)
// - stack size (locRTE)
}
return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug_x(x) cout<< #x <<"---> : "<<x<<endl;
#define debug_ve(x) for(auto it: x) cout<<it<<" ";
#define rep(i,a,n) for (int i=a;i<n;i++)
#define _rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef double db;
//std::mt19937 mrand(random_device{}());
//int rnd(int x) { return mrand() % x ; }
const ll mod=1e7;
ll ksm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

/***********************/

void pr(string s,int n,char m){
    if(n==0) cout<<s<<endl;
    else for(char a='a';a-m<=1;a++) pr(s+a,n-1,max(a,m));
}
int main(){
    ssd;
    int n;cin>>n;
    string s= "a";
    pr(s,n-1,'a');
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
   T res = 1;
   for(;n;n>>=1) {
      if (n & 1) res = res * a;
      a = a * a;
   }
   return res;
}

//cin.tie(0);ios::sync_with_stdio(false);
//cout<<fixed<<setprecision(20);

const ll MAX = 2000010;//設定して

long long 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;
    }
}

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

signed main(){
  COMinit();
  ll x,y;cin>>x>>y;
  ll tty=0,yyt=0;
  if(x-y>=0){
    yyt+=x-y;
    x-=2*yyt;
    y-=yyt;
  }else{
    tty+=y-x;
    y-=2*tty;
    x-=tty;
  }

  if(x%3!=0){
    cout<<0<<endl;
    return 0;
  }
  yyt+=x/3;
  tty+=x/3;
  cout<<COM(tty+yyt,tty)<<endl;

}


//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,output_format?

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

typedef long long int ll;


int main()
{
   ll n, k;
   cin >> n >> k;
   vector<ll> a(n);
   for(ll i = 0;i < n;i++){
       cin >> a[i];
   }

   vector<ll> ans;
   vector<bool> f(n, true);
   ll now = 1;
   while(1){
       if(!f[now - 1])break;
        f[now - 1] = false;
        ans.push_back(now);
        now = a[now - 1];
   }
   ll cnt = 0;
   for(ll i = 0;i < ans.size();i++){
       if(ans[i] == now){
           cnt = i;
           break;
       }
   }

   if(k < ans.size()){
       cout << ans[k];
       return 0;
   }
   k -= cnt;

    cout << ans[k % (ans.size() - cnt) + cnt];

    return 0;
}


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

int main(){
	int n;
	string s;
	cin>>n;
	cin>>s;
	if(n%2!=0)
		cout<<"No";
	else{
		for(int i=0;i<n/2;i++){
			if(s[i]==s[n/2+i])
				continue;
			else{
				cout<<"No";
				return 0;
			}
		}
		cout<<"Yes";
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define exists(s,x) (s).find(x)!=(s).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define fi first
#define se second
typedef long long ll;
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

inline ll add(ll x, ll y) {return (x+y)%MOD;}
inline ll mul(ll x, ll y) {return (x*y)%MOD;}
inline ll sub(ll x, ll y) {
    ll res = x - y;
    if(res < 0) res += MOD;
    return res;
}
inline ll modpow(ll x, ll y) {
    ll res = 1;
    while(y) {
        if(y&1) res = mul(res,x);
        y >>= 1;
        x = mul(x,x);
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    vector<int> v(M);
    vector<char> c(M);
    REP(i,M) { cin >> v[i] >> c[i]; v[i] --;}
    bool flg = false;
    int ans;
    REP(i,1000) {
        if(to_string(i).size() != N) continue;
        string s = to_string(i);
        bool tmp = true;
        REP(j,M) {
            if(s[v[j]] != c[j]) tmp = false;
        }
        if(tmp) {
            flg = true;
            ans = i;
            break;
        }
    }
    if(flg) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

int main(void){
    int N,K;
    scanf("%d %d",&N,&K);
    char S[100002];
    scanf("%s",S);
    int ans=0;
    int start=S[0]-'0';
    int mae=0;
    vector<int> lens;
    vector<int> lenssum;lenssum.pb(0);
    rep(i,N){
        if(i>0&&S[i]!=S[i-1]){lens.pb(i-mae);lenssum.pb(lenssum[lenssum.size()-1]+i-mae);mae=i;}
        if(i==N-1){lens.pb(i-mae+1);lenssum.pb(lenssum[lenssum.size()-1]+i-mae+1);}
    }
    
    rep(i,lens.size()){
        int siz=K*2+( (i+start)%2 );
        if(i+siz>=lenssum.size()){siz=lenssum.size()-i-1;}
        ans=max(ans,lenssum[i+siz]-lenssum[i]);
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 1276
n=int(input())
s=input()
cnt=0
for i in range(1000):
  l=(3-len(str(i)))*'0'+str(i)
  #print("l: ",l)
  #break
  if l[0] in s:
    #print("l[0]: ",l[0])
    #break
    p1=s.index(l[0])
    #print("p1: ",p1)
    #break
    if l[1] in s[p1+1:]:
      #print("l[1]: ",l[1])
      #break
      p2=p1+s[p1+1:].index(l[1])+1
      #print("p2: ",p2)
      #break
      if l[2] in s[p2+1:]:
        #print("l[2]: ",l[2])
        cnt+=1
print(cnt)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
const int inf = 1000000000; // 10^9 Ten to the power of nine.
/**** Type Define ****/
 
    int main(){
       int n,k;
       cin>>n>>k;
       int a[1000];  int ans=0;

       for (int i = 0; i < n; i++)
       {
          cin>>a[i];
       }
       
       sort(a,a+n);//1000までsortしない

     
       for (int i = 0; i < k; i++)
       {
          ans +=a[i];
       }
       
         cout<<ans<<endl;
         return 0;}

Measured memory_bytes: 3592
//

fun main() {
    abc175b()
}

fun abc175b() {
    val n = readLine()!!.toInt()
    val l = readLine()!!.split(" ").map { it.toLong() }
    var count = 0L
    for (i in 0 until n - 2) {
        for (j in i + 1 until n - 1) {
            if (l[i] == l[j]) continue
            for (k in j + 1 until n) {
                if (l[k] == l[i] || l[k] == l[j]) continue
                val array = listOf(l[i], l[j], l[k])
                val sorted = array.sortedDescending()
                if (sorted[0] < sorted[2] + sorted[1]) {
                    count++
                }
            }
        }
    }
    println(count)
}


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

int main() {
  int N;
  int  a[10000], c = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    while (true) {
      if (a[i] % 2 == 0) {
        c++; 
        a[i] = a[i] / 2;
       }else{
        break;
       }
     }
  }
  cout << c;
} 

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

#include <math.h>
#include <stdlib.h>


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

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    char X, Y; cin >> X >> Y;
    if(int(X-Y) > 0) cout << ">" << endl;
    else if(X == Y) cout << "=" << endl;
    else cout << "<" << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int[] year;
            bool first = true;
            Dictionary<bool, Action<List<int>>> leapAction = new Dictionary<bool, Action<List<int>>> {
                {false, output => Console.WriteLine("NA")},
                {true,  output => output.ForEach(item => Console.WriteLine(item))},
            };
            while(((year = (from q in Console.ReadLine().Split() select int.Parse(q)).ToArray())[0] | year[1]) != 0) {
                List<int> leapYear = Enumerable.Range(year[0], year[1] - year[0] + 1).Where(temp =>
                                        (temp % 4 == 0 && (temp % 400 == 0 || temp % 100 != 0))).ToList();
                Console.Write(first ? string.Empty : System.Environment.NewLine);
                leapAction[leapYear.Count != 0](leapYear);
                first = false;
            }
        }
    }
}

Measured memory_bytes: 6516
function Main(input)
{
  input = input.split("\n");

  // var a = parseInt(input[0], 10);
  if (input[0][0] == input[1][2] && input[0][2] == input[1][0] && input[0][1] == input[1][1]) {
    console.log("YES");
  }else {
    console.log("NO");
  }

  // console.log('%d', a);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
// B - Training Camp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD 1000000007

int main(){
	int N; cin>>N;
	ll ans = 1;
	for(int i=1; i<=N; i++) ans = ans * i % MOD;
	cout<< ans <<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var abt = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int sum = 0;

            for (int i = 1;i<=abt[2]; i++)
            {
                if (i % abt[0] == 0)
                {
                    sum += abt[1];
                }

            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;


int main(){
   string S,T; cin >> S >> T;
   int m = S.size();
   int n = T.size();
   int dp[3240][3240] = {0};
   rep(i,m)rep(j,n){
       if(S[i] == T[j]){
           dp[i+1][j+1] = dp[i][j] + 1;
       }
       else{
           dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
        }
   }
   //復元
   string res = "";
   while(m > 0 && n > 0){
       if(dp[m][n] == dp[m-1][n]){
           m--;
       }
       else if(dp[m][n] == dp[m][n-1]){
           n--;
       }
       else{
           res = S[m-1] + res;
           m--;
           n--;
       }
   }
   cout << res << endl;
}



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

long gcd(long a, long b){
    if(a<b){
        long t=a;
        a=b;
        b=t;
    }
    while(b!=0){
        long r=a%b;
        a=b;
        b=r;
    }
    return a;
}

bool solve(){
    long a, b, c, d;
    scanf("%ld %ld %ld %ld\n", &a, &b, &c, &d);
    if(b>d || a<b){
        return false;
    }
    {
        long g=gcd(d-b, b);
        if(g+c<b){
            return false;
        }
    }
    {
        long q = a/b;
        if(q>=2){
            a-=(q-1)*b;
        }
    }
    {
        long q = d/b;
        if(q>=2){
            d-=(q-1)*b;
        }
    }
    for(long i=0; i<10; i++){
        a-=b;
        if(a<0){
            return false;
        }
        if(a<=c){
            a+=d;
        }
    }
    return true;
}

int main(void){
    long t;
    scanf("%ld", &t);
    for(long i=0; i<t; i++){
        bool b=solve();
        puts(b ? "Yes" : "No" );
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int main(){
    ll n; cin >> n;
    ll ans = 1e6;
    for(ll i=1;i * i <= n;i++){
        if(n % i == 0){
            ll m = n / i;
            string I = to_string(i);
            string M = to_string(m);
            ll iz = I.size();
            ll mz = M.size();
            ans = min(ans,max(iz,mz));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;;
#define int long long 
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size()) 
#define MAX(x) *max_element(ALL(x)) 
#define MIN(x) *min_element(ALL(x)) 
#define INF 1000000000000 
#define MOD 10000007 
#define MAXR 100000 
#define PB push_back 
#define PI 3.14159265358979323846


using namespace std;

signed main(){
    int n ;
    cin >> n ;
    vector<int> A(n);
    REP(i, n){
        cin >> A[i];
    }
    int a,aa ;
    long long signed aaa ;
    a = MAX(A);
    aa =MIN(A);
    aaa = accumulate(ALL(A),(int)0);

    cout << aa<<" "<<a<<" " <<aaa<<endl ;


    return 0 ;
}


Measured memory_bytes: 3180
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        scanf("%d",&a.at(i));
        a.at(i)--;
    }
    int x=0;
    for(int i=0;i<100000;i++){
        if(x==1){
            cout<<i<<endl;
            return 0;
        }
        x=a.at(x);
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 640
n = int(input())
dp = [0 for x in range(n+1)]
key = 1
while key <= n:
  key *= 6
while key > 1:
  for j in range(n+1):
    if j == 0 or dp[j]:
      if j+key <= n:
        if dp[j+key]:
          dp[j+key] = min([dp[j]+1, dp[j+key]])
        else:
          dp[j+key] = dp[j]+1
  key //= 6

key = 1
while key <= n:
  key *= 9
while key > 1:
  for j in range(n+1):
    if j == 0 or dp[j]:
      if j+key <= n:
        if dp[j+key]:
          dp[j+key] = min([dp[j]+1, dp[j+key]])
        else:
          dp[j+key] = dp[j]+1
  key //= 9

for i in range(1, n+1):
  if dp[i]:
    dp[i] = min([dp[i-1]+1, dp[i]])
  else:
    dp[i] = dp[i-1]+1

print(dp[n])

Measured memory_bytes: 3992
#include <iomanip>
#include <iostream>

using namespace std;
// clang-format off
using i64 = int64_t;
using i32 = int32_t;
#define all(x) x.begin(), x.end()
#define int i64
template <class T, typename U> constexpr inline bool exist(const T &s, const U &e) { return s.find(e) != s.end(); }
template <class T> constexpr inline i32 SZ(const T &x) { return x.size(); }
template <class T> constexpr inline bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> constexpr inline bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
const char el = '\n'; const i32 MOD = 1e9 + 7, INF = 0x3f3f3f3f; const i64 INFLL = ((i64)INF << 32) | INF;

#ifdef LOCAL // debugging swiss knife
template <typename Ostream, typename Cont> enable_if_t<is_same<Ostream, ostream>::value, Ostream &> operator<<(Ostream &os, const Cont &v) { os << "{"; for (const auto &x : v) os << x << ", "; return os << "}"; }
template <typename Ostream, typename... Ts> Ostream &operator<<(Ostream &os, const pair<Ts...> &p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class... Args> void dbg_out(Args... args) { ((std::cerr << "\033[32m" << args << "\033[37m, "), ...); }
#define dbg(...) cerr << "\033[1;31m" << __LINE__ << ": [" << #__VA_ARGS__ << "]\033[37m  = ", dbg_out(__VA_ARGS__), cerr << "\033[0m" << endl;
#else
#define dbg(...) ;
#endif
// clang-format on
////////////////////////////////// TEMPLATE ENDS /////////////////////////////////

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(13), cerr << fixed << setprecision(3);

    int n;
    cin >> n;
    int ans = n * (n + 1) / 2;
    for (i64 i = 1; i < n; ++i) {
        ans += i * (i + 1) / 2;
        int l, r;
        cin >> l >> r;
        if (l > r) swap(l, r);
        ans -= l * (n + 1 - r);
    }
    cout << ans << el;

    return 0;
}

Measured memory_bytes: 3564
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18



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

	vector<int> tb(n + 1);

	for (int i = 0; i < n; i++) {
		int buf; cin >> buf;

		tb[buf]++;
	}

	sort(tb.begin(), tb.end());


	int cnt = 0;
	for (int i = 0; i <= n; i++) {
		if (tb[i])cnt++;
	}

	int ans = 0;
	for (int i = 0; i <= n; i++) {
		if (tb[i]) {
			cnt--;
			ans += tb[i];
		}

		if (cnt<=k) {
			cout << ans << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H, W;
        while (true) {
            H = sc.nextInt();
            W = sc.nextInt();
            int i, k;
            for (i = 0; i < H; i++) {
                for (k = 0; k < W; k++) {
                    if (0 < k & 0 < i & k < W - 1 & i < H - 1) {
                        System.out.print(".");
                    } else {
                        System.out.print("#");
                    }
                }
                System.out.println("");
            }
            if (H == 0 && W == 0)
                break;
            System.out.println("");
        }
    }
}


Measured memory_bytes: 32592
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int m = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			String grade = "C";
			if(m == -1){
				if(f == -1 && r == -1){
					break;
				}else{
					grade = "F";
				}
			}else{
				if(f == -1){
					grade = "F";
				}else{
					int sum = m + f;
					if(sum >= 80){
						grade = "A";
					}else if(sum >= 65){
						grade = "B";
					}else if(sum < 30){
						grade = "F";
					}else if(sum < 50 && r < 50){
						grade = "D";
					}
				}
			}
			System.out.println(grade);
		}
	}
}



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

inline int read(){
	int res=0,f=1;char ch=' ';
	while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)){res=res*10+ch-'0';ch=getchar();}
	return res*f;
}
const int N=200005;
int n;
int a[N];
inline bool big(int i,int j,int mid){
	return a[i]>mid&&a[j]>mid;
}
inline bool small(int i,int j,int mid){
	return a[i]<=mid&&a[j]<=mid;
}
inline bool check(int mid){
	for(register int i=0;i<n-1;i++){
		if(big(n+i,n+i+1,mid)||big(n-i,n-i-1,mid)) return false;
		if(small(n+i,n+i+1,mid)||small(n-i,n-i-1,mid)) return true;
	}
	return small(1,1,mid);
}
int main(){
	n=read();
	for(register int i=1;i<=n*2-1;i++) a[i]=read();
	int l=0,r=2*n-1,ans=0;
	while(l<=r){
		int mid=(l+r)/2;
		if(check(mid)){
			r=mid-1;ans=mid;
		}
		else l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}
/*
7
1 2
3 1
3 4
5 4
4 7
6 2
3
1
2
3
*/

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

int main() {
	string s;
	int k;
	cin >> s;
	cin >> k;
	vector<string> ans;
  string sk="";
	rep(i, k) {
      sk+='z';
    }
  rep(i,k) ans.push_back(sk);
  	for (int i = 0; i < s.size(); i++) {
		string si = "";
		for (int j = i; j < min(i + k, (int)s.size()); j++) {
			si += s[j];
			if (ans[k - 1] > si) {
              bool flag=true;
              rep(l,k-1){
                if(ans[l]==si) flag=false;
              }
              if(flag){
				ans[k - 1] = si;
				sort(ans.begin(), ans.end());
              }
			}else break;
		}
	}
    cout<<ans[k-1]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;

int main() {
  ll n,m; cin>>n>>m;
  ll x[n], y[n], z[n];
  for(int i=0;i<n;i++) {
    cin>>x[i]>>y[i]>>z[i];
  }
  ll ans=-1e18;
  for(ll v1=-1;v1<=1;v1+=2) {
    for(ll v2=-1;v2<=1;v2+=2) {
      for(ll v3=-1;v3<=1;v3+=2) {
        ll sm=0;
        priority_queue<ll> que;
        for(int i=0;i<n;i++) {
          que.push(x[i]*v1+y[i]*v2+z[i]*v3);
        }
        for(int i=0;i<m;i++) {
          sm += que.top(); que.pop();
        }
        //cout<<v1<<" "<<v2<<" "<<v3<<" "<<sm<<endl;
        ans = max(ans, sm);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  cout << n * 800 - n / 15 * 200 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int gi()
{
	char c;int num=0,flg=1;
	while((c=getchar())<'0'||c>'9')if(c=='-')flg=-1;
	while(c>='0'&&c<='9'){num=num*10+c-48;c=getchar();}
	return num*flg;
}
#define N 200005
int fir[N],to[2*N],nxt[2*N],cnt;
void adde(int a,int b)
{
	to[++cnt]=b;nxt[cnt]=fir[a];fir[a]=cnt;
	to[++cnt]=a;nxt[cnt]=fir[b];fir[b]=cnt;
}
int fa[N],cir[N],clen,dep[N];bool onc[N];
void findcir(int u,int ff)
{
	fa[u]=ff;
	dep[u]=dep[ff]+1;
	for(int v,p=fir[u];p;p=nxt[p]){
		if((v=to[p])!=ff){
			if(!dep[v])findcir(v,u);
			else if(dep[v]<dep[u]){
				for(int t=u;;t=fa[t]){
					onc[t]=1;cir[++clen]=t;
					if(t==v)break;
				}
			}
		}
	}
}
int f[N];bool vis[N];
void dfs(int u,int ff)
{
	for(int v,p=fir[u];p;p=nxt[p])if((v=to[p])!=ff&&!onc[v])dfs(v,u);
	for(int v,p=fir[u];p;p=nxt[p])if((v=to[p])!=ff&&!onc[v])vis[f[v]]=1;//  KKK
	while(vis[f[u]])f[u]++;
	for(int v,p=fir[u];p;p=nxt[p])if((v=to[p])!=ff&&!onc[v])vis[f[v]]=0;
}
int main()
{
	int n=gi(),i;
	for(i=1;i<=n;i++)adde(gi(),i);
	findcir(1,0);
	for(i=1;i<=clen;i++)dfs(cir[i],0);
	bool flg=0;
	for(i=2;i<=clen;i++)
		if(f[cir[i]]!=f[cir[1]]){flg=1;break;}
	if(!flg&&(clen&1))printf("IMPOSSIBLE\n");
	else printf("POSSIBLE\n");
}

Measured memory_bytes: 21424
def main(): 
    
    N,X = map(int, input().split())
    L = list(map(int, input().split()))

    count = 1
    distance = 0

    for l in L:
        distance += l
        if distance <= X:
            count += 1
        else:
            break

    print(count)
    
if __name__ == "__main__":
    main() 

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


int main(){
    string s;
    cin >> s;
    char l[4] = {'N', 'W', 'S', 'E'};
    map<char, int> m;
    for(auto c : s){
        m[c]++;
    }

    if(0 < m[l[0]] && m[l[2]] == 0){
        cout << "No" << endl;
        return 0;
    }
    if(0 < m[l[2]] && m[l[0]] == 0){
        cout << "No" << endl;
        return 0;
    }
    if(0 < m[l[1]] && m[l[3]] == 0){
        cout << "No" << endl;
        return 0;
    }
    if(0 < m[l[3]] && m[l[1]] == 0){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;



    return 0;
}


Measured memory_bytes: 256
ary = Array.new(4).map {Array.new(13,true)}
n = gets.to_i
for i in 1..n
  s,r = gets.split
  k = r.to_i
  case s
  when "S"
    ary[0][k-1] = false
  when "H"
    ary[1][k-1] = false
  when "C"
    ary[2][k-1] = false
  when "D"
    ary[3][k-1] = false
  end
end
suit = ["S","H","C","D"]
for i in 0..3
  for j in 1..13
    if ary[i][j-1]
      puts suit[i] + " " + j.to_s
    end
  end
end


Measured memory_bytes: 6872
import java.util.Scanner;

public class Main
{

	public static void main(String[] args) 
	{
		assert(false);
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long i1 = sc.nextLong();
		long i2 = sc.nextLong();
		long a = Math.min(i1, i2);
		long b = Math.max(i1, i2);
		
		if((a%2==0)==(b%2==0))
		{
			long dis = b-a;
			System.out.println(dis/2);
		}
		else
		{
			long l = b-1; //both go left
			long r = n-a; //both go right
			long ans = (Math.min(l, r));
			
//			if(a%2 != b%2)
			{
				{
					//a goes to 1 then go right again
					long time = 0;
					time += a-1; //a goes to 1
					time++; //a waits there 1 turn, now both are odd (even)
					long curb = Math.max(b - time, 1);
					
//					if((curb%2 != 0))
					{ //now they meet
						long dis = curb-1;
						ans = Math.min(ans, time + (dis/2));
					}
				}
//				if(n%2!=b%2)
				{ //b goes to right and waits a turn
					long time = n - b + 1; //now both are even
					long cura = Math.min(a + time, n);
//					if((cura%2 == 0))
					{ //now they meet
						long dis = n-cura;
						ans = Math.min(ans, time + (dis/2));
					}
				}
			}
			
			System.out.println(ans);
		}
			

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    string st;
    cin >> st;
    int ok=0;
    for(int i=0;i<st.size();i++)
        if(st[i]=='7')ok=1;
    if(ok)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  pair<int,int>a[n+1];
  memset(a,0,sizeof(a));
  int x;
  string s;
  for(int i=0;i<m;i++)
  {
    cin>>x>>s;
    if(s=="WA")
    {
      if(a[x].second==0)
        a[x].first++;
    }else
      a[x].second=1;
  }
  int p=0,q=0;
  for(int i=1;i<=n;i++)
  {
    if(a[i].second==1)
    {
      p++;
      q+=a[i].first;
    }
  }
  cout<<p<<" "<<q<<"\n";
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N = 1005;
vector< int > g[N*N];
int dgin[N*N];
int reach[N*N];
queue< pair< int,int > > q;
int main()
{
    int n,mx = 0;
    scanf("%d",&n);
    for(int i=1,num;i<=n;i++)
    {
        int last = 0;
        for(int j=1;j<n;j++)
        {
            scanf("%d",&num);
            int a = min(i,num),b = max(i,num);
            if(last)    g[last].push_back((a-1)*n+b),++dgin[(a-1)*n+b];
            last = (a-1)*n+b;
        }
    }
    int ch = 0;
    for(int i=1;i<n;i++)   for(int j=i+1;j<=n;j++) if(!dgin[(i-1)*n+j])    q.push({(i-1)*n+j,0});
    while(!q.empty())
    {
        int nowi = q.front().first,noww = q.front().second;q.pop();
        ++ch;
        mx = max(mx,noww+1);
        for(auto &x:g[nowi])
        {
            --dgin[x];
            reach[x] = max(reach[x],noww+1);
            if(!dgin[x])    q.push({x,reach[x]});
        }
    }
    if(ch!=n*(n-1)/2) return puts("-1"),0;
    printf("%d\n",mx);
    return 0;
}


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

#define ll          long long
#define endl        "\n"
#define inf         10000000002
#define pb          push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      //freopen("inputNew.txt", "r", stdin);

      ll n;
      cin>>n;
      ll arr[n];
      for(int i=0; i<n; i++){
            cin>>arr[i];
      }
      vector<ll>V[2];
      ll mn,mx;
      mx=arr[n-1];

      for(int i=n-2; i>=0; i--){
            if(arr[i]>=mx) mx=arr[i];
            else{
                  mn=arr[i];
                  ll temp=0;
                  while(i>0){
                        if(arr[i-1]<=mn){mn=arr[i-1]; i--;}
                        else{temp=arr[i-1];break;}
                  }
                  //cout<<mn<<"  "<<mx<<endl;
                  V[0].pb(mn);
                  V[1].pb(mx);
                  mx=temp;
            }

      }
      ll sz=V[0].size();
      reverse(V[0].begin(),V[0].end());
      reverse(V[1].begin(),V[1].end());

      ll money=1000;
      for(int i=0; i<sz; i++){
            ll s=(money/V[0][i]);
            money= (money%V[0][i]);

            money+= (s*V[1][i]);
      }
      cout<<money<<endl;


      bye;
}


Measured memory_bytes: 3556
#include<stdio.h>
#include <string.h>
int main()
{
  char s[99];
  int i;
  for(;fgets(s,99,stdin);)
    {
      for(;;)
	{
	  for(i=0;s[i]!='\0';i++)
	    {
	      if(s[i]>='a' && s[i]<'z')
		s[i]++;
	      else if(s[i]=='z')
		s[i]='a';
	      else if(s[i]=='\n')
		s[i]='\0';
	    }
	  if(strstr(s,"the")!=NULL ||strstr(s,"this")!=NULL || strstr(s,"that")!=NULL)
	    break;	  
	}
      puts(s);
    }
  return 0;
}

Measured memory_bytes: 0
n = int(input())
h = list(map(int, input().split()))
ans = 0
count = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    count += 1
  else:
    ans = max(ans, count)
    count = 0
ans = max(ans, count)
print(ans)


Measured memory_bytes: 14224