akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int ta[1111];
int t[4][4];
int n;

int main(){
    rep(i,3)rep(j,3)cin>>t[i][j];
    cin>>n;
    rep(i,n){
        int x;
        cin>>x;
        ta[x]=1;
    }
    bool ok1=1,ok2=1;
    rep(i,3){
        ok1=1,ok2=1;
        rep(j,3){
            ok1&=ta[t[i][j]];
            ok2&=ta[t[j][i]];
        }
        if(ok1||ok2){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    ok1=1,ok2=1;
    rep(i,3){

        ok1&=ta[t[i][i]];
        ok2&=ta[t[2-i][i]];
    }
     if(ok1||ok2){
        cout<<"Yes"<<endl;
        return 0;
    }

    cout<<"No"<<endl;

    return 0;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;

#define rep(i, a, b) for(auto i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back

struct edge{int to;};
using graph = vector<vector<edge>>;

const int MOD = 1000000007;
const int MAXD = 10000;
const int MAXK = 100;
ll dp[MAXD + 5][MAXK][2]; // # digits, modulo, isbelow

void add(auto& a, auto b){a = (a + b) % MOD;}

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

  string s;
  cin >> s;
  int k;
  cin >> k;
  int n = sz(s);

  dp[0][0][0] = 1;
  rep(i, 0, n) {
    rep(j, 0, k) {
      rep(c, '0', '9' + 1) {
	int v = c - '0';
	int j2 = (j + v) % k;
	add(dp[i + 1][j2][1], dp[i][j][1]);
	
	if (c < s[i]) {
	  add(dp[i + 1][j2][1], dp[i][j][0]);
	}
	else if (c == s[i]) {
	  add(dp[i + 1][j2][0], dp[i][j][0]);
	}
      }
    }
  }
  cout << (dp[n][0][1] + dp[n][0][0] - 1 + MOD) % MOD << '\n'; // zero is not valid answer
}


Measured memory_bytes: 15872
import math
S=input().split( )
a=int(S[0])
b=int(S[1])
h=int(S[2])
m=int(S[3])
t=30*h-11*m/2
c=math.cos(math.radians(t))
d=a**2+b**2-2*a*b*c
print(math.sqrt(d))

Measured memory_bytes: 9436
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N_MAX = 500002;
const int Q_MAX = 500002;

int n, q;

int c[N_MAX];

struct Query
{
    int l, r;
    int index;
};

bool operator < (const Query &a, const Query &b)
{
    return make_pair(a.l, a.r) < make_pair(b.l, b.r);
}

Query queries[Q_MAX];

vector <int> pos[N_MAX];

int BIT[N_MAX];

void BITupdate (int pos, int val)
{
    for(int i = pos; i <= n; i += i & -i)
        BIT[i] += val;
}

int BITquery (int pos)
{
    int ans = 0;
    for(int i = pos; i >= 1; i -= i & -i)
        ans += BIT[i];
    return ans;
}

int ans[Q_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> q;
    for(int i = 1; i <= n; i++)
        cin >> c[i];
    for(int i = 1; i <= q; i++)
    {
        cin >> queries[i].l >> queries[i].r;
        queries[i].index = i;
    }
    sort(queries + 1, queries + q + 1);
    for(int i = n; i >= 1; i--)
        pos[c[i]].push_back(i);
    for(int i = 1; i <= n; i++)
        if(!pos[i].empty())
            BITupdate(pos[i].back(), +1);
    int curr = 1;
    for(int i = 1; i <= q; i++)
    {
        while(curr < queries[i].l)
        {
            BITupdate(curr, -1);
            pos[c[curr]].pop_back();
            if(!pos[c[curr]].empty())
                BITupdate(pos[c[curr]].back(), +1);
            curr++;
        }
        ans[queries[i].index] = BITquery(queries[i].r);
    }
    for(int i = 1; i <= q; i++)
        cout << ans[i] << "\n";
    return 0;
}


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

#define watch(x) cout<<#x<<" -> "<<x<<endl
#define ALL(x) x.begin() , x.end()
#define INF 100000
typedef long long ll;
using namespace std;
 string s ;
 string s1;
 int check(int l , int r){
    int cnt = 0 ,j = 0;
    for (int i = l;i < r ;i++){
        if (s[i]!=s1[j])
            cnt++;
            j ++;
    }
    return cnt;
 }
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
        int mn = 1e5;
        cin>>s>>s1;
            for (int i = 0 ;i < s.size() - s1.size()+1; i++){
               // string p = s.substr(i , i +s1.size());
                mn = min(check(i , i + s1.size()), mn);
            }
            cout<<mn<<endl;
}

Measured memory_bytes: 3644
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        IntStream.rangeClosed(0, n).map(i -> {
            int cc = 0, t = i;
            while (t > 0) {
                cc += t % 6;
                t /= 6;
            }
            t = n - i;
            while (t > 0) {
                cc += t % 9;
                t /= 9;
            }
            return cc;
        }).min().ifPresent(System.out::println);
    }
}

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

using namespace std;

#define debug(x) cerr << endl << "DEBUG: (" << (#x) << " = " << x << ")" << endl;
#define debugArray(v) for (auto i : v) cerr << i << " "; cerr << endl;

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const long long INFLL = 0x3f3f3f3f3f3f3f3fLL;
const long double EPS = 1e-9;
const long double PI = acos(-1.0);

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

    int n;
    
    cin >> n;

    int n_tmp = n, amount = 0;
    
    while (n_tmp > 0) {
        amount += 1000;
        n_tmp -= 1000;
    }

    cout << amount - n << endl;

    return 0;
}

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

int main(){
    string s;
    cin>>s;
    ll n=s.size()-1;
    ll ans=0;
    for(int i=0;i<(1<<n);++i){
        V a;
        a.push_back(s[0]-'0');
        for(int k=0;k<n;++k){
            if(1<<k & i){
                a.push_back(s[k+1]-'0');
            }else{
                a.back()=a.back()*10+(s[k+1]-'0');
            }
        }
        ans+=accumulate(a.begin(), a.end(), 0LL);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
 
#define LOCAL  1
#define UPLOAD 2
 
#define ll long long
const long long INF = 1LL << 60;
 
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
#define REP(i,M) for(int i=0;i<M;i++)
 
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;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

  ll N = input();
  ll K = input();
 
  output(min(N%K, abs(K-N%K)));

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 1e9
#define eps 1e-6
#define PI acos(-1.0)
#define M 10010
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;

int n;

int main() {
  //freopen("in.txt", "r", stdin);
  //freopen("out.txt","w",stdout);
  cin>>n;
  int ans=0;
  if(n<105)
  {
      ans=0;
  }
  else
  {
      for(int i = 105 ; i <= n; i+=2)
      {
         int cnt=0;
         for(int j = 1 ; j <= i ; j++)
          if(i%j==0)cnt++;
         if(cnt==8)ans++;
      }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


zenbu = {1,2,3}
A = int(input())
B = int(input())
bubun = {A,B}

kotae = zenbu - bubun

print(*kotae)

Measured memory_bytes: 13620
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main(void){
	int n;
	cin >> n;
	int l[n];
	rep(i, n) cin >> l[i];

	ll ans = 0;
	sort(l, l + n);
	for (int i = n-1; i >= 2; i--){
		for (int j = i-1; j >= 1; j--){
			int yuuyo = l[i] - l[j];
			int pos = upper_bound(l, l + n, yuuyo) - l;
			if(j - pos >= 0) ans += j - pos;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String a  = sc.next();
    
      if(a.equals ("A") ||a.equals ("B") ||a.equals ("C") 
     ||a.equals ("D") ||a.equals ("E") ||a.equals ("F") ||a.equals ("G")
     ||a.equals ("H") ||a.equals ("I") ||a.equals ("J") ||a.equals ("K") 
     ||a.equals ("L") ||a.equals ("M") ||a.equals ("N") ||a.equals ("O")
     ||a.equals ("P")
     ||a.equals ("Q") ||a.equals ("R") ||a.equals ("S") ||a.equals ("T")
     ||a.equals ("U") ||a.equals ("V") ||a.equals ("W") ||a.equals ("U")
     ||a.equals ("X") ||a.equals ("Y") ||a.equals ("Z") ){
    System.out.println("A");
      }else{
	System.out.println("a");
      }
    }
}

Measured memory_bytes: 35636
(defmacro defsolver (name vars &body body)
  `(defun ,name ()
     (let (,@(mapcar #'list
            vars
            (mapcar (constantly '(read))
                vars)))
       ,@body)))

(defsolver solution-aa ()
  (let ((h (make-hash-table)))
    (dotimes (i 4)
      (let ((c (read-char)))
	(if (gethash c h)
	    (incf (gethash c h))
	    (setf (gethash c h) 1))))
    (let ((two? t))
      (maphash
       #'(lambda (k v)
	   (when (/= v 2)
	     (setf two? nil)))
       h)
      (format t "~:[No~;Yes~]"
	      (and
	       two?
	       (= (hash-table-count h) 2))))))

(solution-aa)

Measured memory_bytes: 16868
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

void prog()
{
    input in;
    output out;

    int n = in.read<int>();
    auto a = in.read<int>(n);
    out(std::all_of(a.begin(), a.end(), [](int x) { return x % 2 || x % 3 == 0 || x % 5 == 0; }) ? "APPROVED" : "DENIED");
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){

int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if( x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){

printf("Yes\n");
}

else{

printf("No\n");
}

return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n,m;
ll k;
const int Maxn=2e5+5;
ll preA[Maxn],preB[Maxn];
int main(){
	cin>>n>>m>>k;
	rep(i,n){
		ll x;cin>>x;
		preA[i]=x;
		if(i){
			preA[i]+=preA[i-1];
		}
	}
	rep(i,m){
		ll x;cin>>x;
		preB[i]=x;
		if(i){
			preB[i]+=preB[i-1];
		}
	}
	int ans=upper_bound(preB,preB+m,k)-preB;
	rep(i,n){
		if(k>=preA[i]){
			int cnt=upper_bound(preB,preB+m,k-preA[i])-preB;
			chkmax(ans,i+1+cnt);
		}else break;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6720
#include<bits/stdc++.h>
#define inf 1000000007
#define ll long long
using namespace std;
string a;
int k;
ll dp[1000009][4];
ll dfs(int pos,int pre,bool limit)
{
    if(pos==-1)
        return pre==k?1:0;
    if(pre>k)
        return 0;
    if(!limit&&dp[pos][k-pre]!=-1)
        return dp[pos][k-pre];
    int up=limit?a[pos]-'0':9;
    ll ans=0;
    for(int i=0; i<=up; i++)
        ans+=dfs(pos-1,pre+(i?1:0),limit&&i==up);
    if(!limit)
        dp[pos][k-pre]=ans;
    return ans;
}
int main()
{
    cin>>a>>k;
    reverse(a.begin(),a.end());
    if(!k)
    {
        printf("0");
        return 0;
    }
    for(int i=0; i<1000009; i++)
        for(int j=0; j<4; j++)
            dp[i][j]=-1;
    printf("%lld",dfs(a.length()-1,0,true));
    return 0;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

using namespace std;

mint comb(int n, int r) {
    mint ret = 1;
    for (int i = 1; i <= r; ++i) {
        ret *= n - i + 1;
        ret /= i;
    }
    return ret;
}

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

    mint ans = mint(2).pow(N) - 1;
    ans -= comb(N, A);
    ans -= comb(N, B);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iterator>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
vector<int> V[87];
LL presum[87][123];

int main() {
    int N, W;
    scanf("%d %d", &N, &W);
    int w, v;
    scanf("%d %d", &w, &v);
    V[0].push_back(v);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        V[a - w].push_back(b);
    }
    for (int i = 0; i < 4; i++) sort(V[i].begin(), V[i].end(), greater<int>());
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < (int)V[i].size(); j++) {
            presum[i][j + 1] = presum[i][j] + V[i][j];
        }
    }
    LL ans = 0;
    for (int i = 0; i <= (int)V[0].size(); i++)
        for (int j = 0; j <= (int)V[1].size(); j++)
            for (int k = 0; k <= (int)V[2].size(); k++)
                 for (int m = 0; m <= (int)V[3].size(); m++) {
                     LL tmp = (LL)(i + j + k + m) * w + (j + 2 * k + 3 * m);
                     if (tmp > W) continue;
                     LL tmpv = presum[0][i] + presum[1][j] + presum[2][k] + presum[3][m];
                     ans = max(ans, tmpv);
                 }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h> 
int main(){
  int n, i;
  int A[100000];
  scanf("%d", &n);
  for (i = 1;i <= n;i++){
    scanf("%d", &A[i]);
  }
  for (i = 1; i <= n; i++) {
    printf("node %d: key = %d, ", i, A[i]);
    if(i / 2 >= 1) printf("parent key = %d, ", A[i/2]);
    if(i*2 <= n) printf("left key = %d, ", A[i*2]);
    if(i*2+1 <= n) printf("right key = %d, ", A[i*2+1]);
    printf("\n");
  }  
  return 0;
}


Measured memory_bytes: 2036
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin = open("input.txt","r")  # <<<  Comment this line  >>> #
    sys.stdout = open("output.txt","w")  # <<<  Comment this line  >>> #
    sys.stderr = open("output.txt","w")  # <<<  Comment this line  >>> #

# int(input())
# get_ints()
li = get_list()
print(li.index(0)+1)


'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

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

namespace ITP1_3_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var a = input[0];
            var b = input[1] - a + 1;
            var c = input[2];
            Console.WriteLine(Enumerable.Range(a, b).Count(n => c % n == 0));
        }
    }
}

Measured memory_bytes: 9536
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long least = sc.nextLong();
        long total = 0;
        long mod = 1000000007;

        for (long k = least; k < n + 2; k++) {
            long first = (k * (k - 1)) / 2;
            long last = (k * (2 * n - k + 1)) / 2;
            total = (total + (last - first + 1)) % mod;
        }
        System.out.println(total);
    }
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	int tmp = 0;
	for (int i = 1; i <= N; i++){
		if (i % 2 != 0) {
			tmp++;
		}
	}

	cout << setprecision(15) << fixed << (double)tmp / N << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    P = [0] * N
    for i in range(N):
        P[i] = int(input())

    dp = [0] * (N + 1)
    for i in range(N):
        p = P[i]
        dp[p] = dp[p - 1] + 1

    ans = N - max(dp)
    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

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

    int Q;
    cin >> Q;

    string T = "";
    string B = "";

    int count = 0;

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

        if(instrunction == 1){
            count++;
        }else{
            string in;
            int tb;
            cin >> tb >> in;
            if(tb == 1){
                if(count % 2){
                    B += in;
                }else{
                    T += in;
                }
            }else{
                if(count % 2){
                    T += in;
                }else{
                    B += in;
                }
            }
        }
    }
    std::reverse(T.begin(),T.end());
    S = T + S + B;

    if(count % 2){
        std::reverse(S.begin(),S.end());
    }

    cout << S << endl;

    return 0;
}


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

int main() {
 vector<vector<int>> data(3, vector<int>(3));
	for (int i = 0; i < 3; i++) {
	 for (int j = 0; j < 3; j++) {
	  cin >> data.at(i).at(j);
     }
    }  
  int N;
  cin >> N ;
  int b[110];
  for (int i=0; i<N; i++){
  cin >> b[i];
  }    
  
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
 	 for (int k=0; k < N; k++){
      if (data.at(i).at(j) == b[k]) {
        data.at(i).at(j)=0;
      }
     }	
    }
  }
bool bingo =false;  
 if  (data.at(0).at(0)==0&&data.at(0).at(1)==0&&data.at(0).at(2)==0){
   bingo=true;
}
 if  (data.at(1).at(0)==0&&data.at(1).at(1)==0&&data.at(1).at(2)==0){
   bingo=true;
}
 if  (data.at(2).at(0)==0&&data.at(2).at(1)==0&&data.at(2).at(2)==0){
   bingo=true;
}
 if  (data.at(0).at(0)==0&&data.at(1).at(0)==0&&data.at(2).at(0)==0){
   bingo=true;
}
 if  (data.at(0).at(1)==0&&data.at(1).at(1)==0&&data.at(2).at(1)==0){
   bingo=true;
}
 if  (data.at(0).at(2)==0&&data.at(1).at(2)==0&&data.at(2).at(2)==0){
   bingo=true;
}  
 if  (data.at(0).at(0)==0&&data.at(1).at(1)==0&&data.at(2).at(2)==0){
   bingo=true;
}
 if  (data.at(2).at(0)==0&&data.at(1).at(1)==0&&data.at(2).at(0)==0){
   bingo=true;
} 
 
  if (bingo==true){
  cout << "Yes" << endl;  
  }
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	static class Node {
		int day=0;
		int inNum;
		ArrayList<Node> out = new ArrayList<>();
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[][] A = new int[N][N-1];
		for(int i=0; i<N; i++) {
			for(int j=0; j<N-1; j++) {
				A[i][j] = sc.nextInt()-1;
			}
		}
		
		Node[][] n = new Node[N][N];
		for(int i=0; i<N; i++) {
			for(int j=i+1; j<N; j++) {
				n[i][j] = new Node();
				n[j][i] = n[i][j];
			}
		}
		
		for(int i=0; i<N; i++) {
			for(int j=0; j<N-2; j++) {
				n[i][A[i][j]].out.add(n[i][A[i][j+1]]);
				n[i][A[i][j+1]].inNum++;
			}
		}
	
		LinkedList<Node> q = new LinkedList<>();
		for(int i=0; i<N; i++) {
			for(int j=i+1; j<N; j++) {
				if(n[i][j].inNum==0) {
					n[i][j].day=1;
					q.add(n[i][j]);
				}
			}
		}
		if(q.isEmpty()) {
			System.out.println(-1);
			sc.close();
			return;
		}
		
		for(int i=0; i<1000000 && q.size()>0; i++) {
			Node cur = q.poll();
			for(Node next : cur.out) {
				next.day = Math.max(next.day, cur.day+1);
				next.inNum--;
				if(next.inNum==0) {
					q.add(next);
				}
			}
		}
		
		
		int max = 0;
		int min = 1;
		for(int i=0; i<N; i++) {
			for(int j=i+1; j<N; j++) {
				max = Math.max(max, n[i][j].day);
				min = Math.min(min, n[i][j].day);
			}
		}
		
		System.out.println(min==0 ? -1 : max);
		
		sc.close();
	}
}



Measured memory_bytes: 329700
"use strict";
    
const main = arg => {
    const S  = arg.split("\n")[0].split("");
    const alphabets = "abcdefghijklmnopqrstuvwxyz".split("");

    for(let i in alphabets) {
        if(S.indexOf(alphabets[i]) == -1) {
            console.log(alphabets[i]);
            return;
        }
    }
    
    console.log("None");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(void ){
	int m, n;
	while(cin >> m >> n) {
		if(m == 0 && n == 0) {
			break;
		}
		for(int i = 0; i < n; i++) {
			cout << "#" ;
		}
		cout << endl;
		for(int i = 0; i < m - 2; i++) {
			cout << "#";
			  cout << ".";
			for(int j = 0; j < n - 3; j++) {
				cout << ".";
			}
			cout << "#";
			cout << endl;
	  	}
	  	for(int i = 0; i < n; i++) {
			cout << "#";
		}
	  	cout << endl << endl;
	}
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>

#define rep(i, N) for(int i = 0; i < N; ++i)

typedef long long ll;
using namespace std;

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

    vector<ll> height(n);
    rep(i, n)
    {
        cin >> height[i];
    }

    set<ll> bad;
    rep(i, m)
    {
        ll a, b;
        cin >> a >> b;
        if (height[a-1] < height[b-1])
        {
            bad.insert(a);
        }
        else if (height[a-1] > height[b-1])
        {
            bad.insert(b);
        }
        else
        {
            bad.insert(a);
            bad.insert(b);
        }
    }
    cout << n - bad.size() << endl;
    return 0;
}


Measured memory_bytes: 6692
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long K = inputArray[1];
			var W  = N-K;

			checked {
				//answer = w+1 C i * k-1 C i-1
				for (int i = 1; i <= K; i++) {
					if (W + 1 < i) {//W+1が最大分割できる数
						Console.WriteLine(0);
						continue;
					}
					var zenhan = combination(W + 1, i);
					var kouhan = combination(K - 1, i - 1);
					//答えの出力
					var ans = (zenhan * kouhan) % _mod;
					Console.WriteLine(ans);
				}
			}


		}

		private static readonly long _mod = 1000000000 + 7;

		/// <summary>
		/// x^n のmod　を繰り返し二乗法で求める
		/// </summary>
		/// <param name="x"></param>
		/// <param name="n"></param>
		/// <returns></returns>
		private static long repeatPow(long x, long n) {
			if (n == 0) {
				return 1;
			}
			if (n == 1) {
				return x;
			}

			if (n % 2 == 1) {
				var a = repeatPow(x, n / 2);
				var b = a * x % _mod;
				return (a * b) % _mod;
			}
			else {
				var a = repeatPow(x, n / 2);
				return (a * a) % _mod;
			}
		}

		/// <summary>
		/// nこからrこを選ぶ組み合わせの数
		/// </summary>
		/// <param name="n"></param>
		/// <param name="r"></param>
		/// <returns></returns>
		public static long combination(long n, long r) {

			long bunshi = 1;
			for (int i = 1; i <= r; i++) {
				bunshi = bunshi * (n - r + i) % _mod;
			}

			long bunbo = 1;
			for (int i = 1; i <= r; i++) {
				bunbo = bunbo * (i) % _mod;
			}
			//逆元を使って、組み合わせの数を求める	
			return (bunshi * repeatPow(bunbo, _mod - 2)) % _mod;

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


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

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First& first, Rest&... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    ll A, B;
    read(A, B);
    ll ans = A + B;
    ans = max(ans, A - B);
    ans = max(ans, A * B);
    write(ans);
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First& first, Rest&... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int, int> pii;

int main()
{
    int n, p, q, cost = 1, a, b;
    cin >> n;
    int x[n], y[n];
    map<pii, int> dp;

        for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if(i == j) continue;
            dp[{x[i] - x[j], y[i] - y[j]}]++;
        }
    }

 int ret = n;
  for(auto out: dp) {
    ret = min(ret, n - out.second);
  }
  cout << ret << endl;
}


Measured memory_bytes: 384
import copy

n=int(input())
t=list(map(int,input().split()))

m=int(input())

drinks=[]
for i in range(m):
    drinks.append(list(map(int,input().split())))

for k in range(m):
    p=drinks[k][0]
    x=drinks[k][1]
    answer=copy.deepcopy(t)
    answer[p-1]=x
    print(sum(answer))


Measured memory_bytes: 3444
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <functional>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(a)					(a).begin(),(a).end()
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(1000 * 1000 * 1000 * 2)
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int X;
	cin >> X;

	int dist = 0;
	int cnt = 0;
	int t = 1;
	while (1) {
		if (X <= dist) {
			break;
		} else {
			dist += t;
			cnt++;
			t++;
		}
	}

	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 256
/*
 * written by Yaqi Zhang (zhang623@wisc.edu)
 * University of Wisconsin-Madison
 * 2020
 */
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int a = stoi(s.substr(0, 2)), b = stoi(s.substr(2));
    if (1 <= a && a <= 12 && 1 <= b && b <= 12) cout << "AMBIGUOUS";
    else if (1 <= a && a <= 12) cout << "MMYY";
    else if (1 <= b && b <= 12) cout << "YYMM";
    else cout << "NA";
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define PI  3.14159265358979323846
#define lp(i,n) for(int i = 0; i <n;i++)
#define rlp(i,n) for(int i = int(n);i >= 0;i--)
#define range1(i,a,b,c) for(int i = int(a);i <= int(b);i+=int(c))
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define fr first
#define sc second
#define sz(v) ((int)((v).size()))
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef pair<int, int> pii;
template<class T> using ordered_set=tree<T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;
int dx[] = {0,0,-1,1};
int dy[] = {1,-1,0,0};
void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void _run(){
   ll x,k,d;
   cin>>x>>k>>d;
   ll ans =0;
   x = abs(x);
   if(x/d>k){
       cout<<x-(k*d)<<endl;
    return;
   }
   ll rem = x/d;
   k-=rem;
   x-=rem*d;
   if(k&1)x=abs(x-d);
   ans = x;
   cout<<x<<endl;
}
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    int t=1;
    // scanf("%d",&t);
    while(t--)_run();
    
    return 0;
}

Measured memory_bytes: 3640
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;
const ll inf = 1e15;

ll x[N], l[N], r[N];

int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		cin >> x[i];
	}
	int p = 0;
	while (p + 1 <= n and x[p + 1] <= 0) {
		++p;
	}
	int q = p + 1;
	if (p > 0 and x[p] == 0) {
		--k;
		--p;
	}
	for (int i = 1; i <= n; ++i) {
		l[i] = r[i] = inf;
	}
	for (int i = p, j = 1; i > 0; --i, ++j) {
		l[j] = -x[i];
	}
	for (int i = q, j = 1; i <= n; ++i, ++j) {
		r[j] = x[i];
	}
	ll ans = min(l[k], r[k]);
	for (int i = 1; i < k; ++i) {
		ans = min(ans, l[i] + r[k - i] + min(l[i], r[k - i]));
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{

    ll n, m, k, i, j, x, y, p=0, s=0, h, f=0;
    cin>>n>>m;
    if(n==1 || m==1){
        cout<<1<<endl;
    }
    else if((n*m)%2==0){
        cout<<(n*m)/2<<endl;
    }
    else cout<<(n*m)/2 +1<<endl;

    return 0;
}



Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>	
#include<string>
#include<math.h>
#include <vector>
using namespace std;
int main() {
	string S;
	int N = 0;
	int a = 0;
	int A[1000] = { 0 };
	int b = 0;
	int c = 0;
	int p = 0;
	int sum = 0;
	int ans = 0;
	int h = 0;
	int m = 0;
	int s = 0;

	cin >> N;
	if (N < 10) {
		ans = N;
	}
	else if (N < 100) {
		ans = 9;
	}
	else if (N < 1000) {
		ans = 9 + N - 99;
	}
	else if (N < 10000) {
		ans = 909;
	}
	else if (N<100000) {
		ans = 909 + N - 9999;
	}
	else {
		ans = 90909;
	}

	cout << ans;
}


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

using namespace std;

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

  stack<char> c;
  int count = 0;
  for(int i = 0; i < S.size(); i++){
    if(c.empty() == 1 || c.top() == S[i]) c.push(S[i]);
    else { c.pop(); count += 2; }
  }

  cout << count << endl;

 return 0;
}





Measured memory_bytes: 512
#if 0
2019.12.06

DP 设 f[i][j][k] 表示考虑一段前缀，三种颜色最后一次出现的位置分别为 i, j, k 的合法方案。
令 r = max(i, j, k) ，r 即当前考虑的前缀长。
检验当前状态是否合法，只需将所有右端点为 r 的限制拿出来，用 i, j, k 可以很好判断是否合法，
如果合法，枚举第 r + 1 的点的颜色进行转移即可。
#endif
#include <cstdio>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 305, mod = 1000000007;
ll f[maxn][maxn][maxn];
std::vector<int> lim[maxn];

int main() {
	int n = read, m = read;

	for(int i = 1; i <= m; i ++) {
		int l = read, r = read, x = read;
		lim[r].push_back(l * 10 + x);
	}

	f[0][0][0] = 1;
	ll ans = 0;

	for(int i = 0; i <= n; i ++) {
		for(int j = 0; j <= n; j ++) {
			for(int k = 0; k <= n; k ++) {
				int r = std::max(i, std::max(j, k));
				f[i][j][k] %= mod;

				bool ok = 1;
				for(int li : lim[r]) {
					int l = li / 10, x = li % 10;
					int y = (i >= l) + (j >= l) + (k >= l);
					if(x != y) {
						ok = 0;
						break;
					}
				}

				if(ok) {
					if(r == n) ans += f[i][j][k];
					else {
						f[r + 1][j][k] += f[i][j][k];
						f[i][r + 1][k] += f[i][j][k];
						f[i][j][r + 1] += f[i][j][k];
					}
				}
				else
					f[i][j][k] = 0;
			}
		}
	}

	ans %= mod;
	printf("%lld\n", ans);
}


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

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

int main() {
    double r; cin >> r;
    cout << 2 * M_PI * r << endl; 
}

Measured memory_bytes: 3764
#include <iostream>
#include <cstdio>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
int main(void){
    char s[3][12]={};
    scanf("%s %s %s",s[0],s[1],s[2]);
    printf("%c%c%c",s[0][0]+'A'-'a',s[1][0]+'A'-'a',s[2][0]+'A'-'a');
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

import string


def main():
    N = int(input())
    s = input().rstrip()
    a = string.ascii_uppercase
    b = (a*2)[N:N+27]
    b = {i:j for i, j in zip(a, b)}
    b = str.maketrans(b)
    print(s.translate(b))


if __name__ == '__main__':
    main()

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

int main() {
  char str[110];
  scanf("%s", str);

  int N = strlen(str);

  int ret = 9999;

  for (char c = 'a'; c <= 'z'; c++) {
    int tmp = 0;

    int cnt = 0;
    for (int i = 0; i < N; i++) {
      if (str[i] == c) {
	tmp = tmp > cnt ? tmp : cnt;
	cnt = 0;
      } else {
	cnt++;
      }
      //      printf("%c %c %d %d\n", c, str[i], cnt, tmp);
    }
    tmp = tmp > cnt ? tmp : cnt;
    ret = ret < tmp ? ret : tmp;
    //    printf("%c %d\n", c, tmp);
  }

  printf("%d\n", ret);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define mk make_pair
#define pb push_back
#define pf push_front
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int s;
bool a[2000000];

signed main()
{
    cin >> s;
    a[s] = true;
    for(int i = 2; i <= 2000000; i++){
        if(s % 2){
            s = s * 3 + 1;
        }
        else {
            s /= 2;
        }
        if(a[s]){
            cout << i << endl;
            return 0;
        }
        a[s] = true;
    }

    return 0;
}
/*


*/




Measured memory_bytes: 256
import java.util.*;

class Main{

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int A = stdIn.nextInt();
        int B = stdIn.nextInt();
        int C = stdIn.nextInt();

        if(A==B && A != C)
            System.out.println("Yes");
        else if(A==C && A != B)
            System.out.println("Yes");
        else if(B==C && C != A)
            System.out.println("Yes");
        else
            System.out.println("No"); 

    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
//setprecision(15)

int main() {
	int K, X;
	cin >> K >> X;
	if (500*K >= X) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

using namespace std;
typedef long long ll;
const int N = 200010;
int _w;

int n;
char s[N];
ll ans;

int main() {
	_w = scanf( "%s", s+1 );
	n = (int)strlen(s+1);
	int bc = 0;
	for( int i = n-1; i >= 1; ) {
		if( s[i] == 'B' && s[i+1] == 'C' ) {
			++bc;
			int j = i-1;
			while( j >= 1 && s[j] == 'A' ) {
				ans += bc;
				--j;
			}
			i = j-1;
		} else {
			bc = 0;
			--i;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

ll dp[3000][3000];
ll sum[3000][3000];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vector<ll> s(n+1),t(m+1);
    FOR(i,1,n+1) cin>>s[i];
    FOR(i,1,m+1) cin>>t[i];
    dp[0][0]=1;
    rep(i,n+1) sum[i][0]=1;
    rep(j,m+1) sum[0][j]=1;
    //cout<<endl;
    ll ans=1;
    FOR(i,1,n+1)FOR(j,1,m+1){
      if(s[i]==t[j]){
        dp[i][j]=sum[i-1][j-1];
        sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+dp[i][j];
        sum[i][j]%=mod;
        ans+=dp[i][j];
        ans%=mod;
      }else{
        sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+dp[i][j]+mod;
        sum[i][j]%=mod;
      }
    }
    /*
    FOR(i,0,n+1){
      FOR(j,0,m+1){
        cout<<dp[i][j]<<' ';
      }
      cout<<endl;
    }
    cout<<endl;
    FOR(i,0,n+1){
      FOR(j,0,m+1){
        cout<<sum[i][j]<<' ';
      }
      cout<<endl;
    }
    */
    cout<<ans<<endl;
}

Measured memory_bytes: 96256
function Main(input) {
    input = input.split(" ").map(v => Number(v));
    var tTurn = 1;
    while (true) {
        if(tTurn==1){
            
            input[2]-=input[1];
            if(input[2]<=0){
                console.log("Yes");
                break;
            }
        }else{
            input[0]-=input[3];
            if(input[0]<=0){
                console.log("No");
                break;
            }
        }
        
        tTurn = (tTurn === 1) ? 0 : 1;
    }
}

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

Measured memory_bytes: 29624
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, t, a;
    cin >> n >> t >> a;

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

    t *= 1000;
    a *= 1000;
    int min = abs(a - (t - h[0] * 6));
    int min_index = 0;
    for (int i = 1; i < n; ++i) {
        int diff = abs(a - (t - h[i] * 6));
        if (diff < min) {
            min = diff;
            min_index = i;
        }
    }
    cout << min_index + 1 << '\n';
}


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

int main(){
    string S;
    cin >> S;
    int sum=0;
    for(int i=0;i<S.length();i++){
        if(i%2==1 && S[i]=='R') sum++;
        if(i%2==0 && S[i]=='L') sum++;
    }
    if(sum>0) cout << "No" <<endl;
    else cout <<"Yes" <<endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) a[i] -= i;
    sort(a.begin(), a.end());
    long long ans = 0;
    int tmp = a[n/2];
    for (int i = 0; i < n; i++) ans += abs(a[i] - tmp);
    cout << ans << endl;
}

Measured memory_bytes: 1024