akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(x,val) memset(x,val,sizeof(x))
#define F(i,n) for(ll i=0;i<n;i++)
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll cost(ll a[],ll ind,vector<ll>&dp,ll n)
{
    if(ind==n)
        return 0;
    if(dp[ind]!=-1)
        return dp[ind];
    ll left=abs(a[ind]-a[ind+1])+cost(a,ind+1,dp,n);
    ll right=INT_MAX;
    if(ind+2<=n)
    right=abs(a[ind]-a[ind+2])+cost(a,ind+2,dp,n);
    
    dp[ind]=min(left,right);
    return dp[ind];
}

int main(){
    crap;
        ll n;
        cin>>n;
        ll a[n+1];
        for(ll i=1;i<=n;i++)
        {
        cin>>a[i];
        }
        vector<ll> dp(n+1,-1);
        cout<<cost(a,1,dp,n);
return 0;
}


Measured memory_bytes: 9600
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <iomanip>
#include <random>
#include <queue>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <numeric>
#include <bitset>
#include <cassert>
#include <sstream>
#include <bitset>
#include <list>

using namespace std;

#define all(x) x.begin(), x.end()
#define z(x) fixed << setprecision(x)
#define sqr(x) ((x)*(x))
#define nl '\n'
#define eb emplace_back
#define elif else if
#define dbg(a) cout << (#a) << " " << a << nl;
#define eb emplace_back
#define mineq(a, b) (a) = min(a, b)
#define maxeq(a, b) (a) = max(a, b)
#pragma comment(linker, "/STACK:216777216")

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned short int usht;
mt19937 rnd(22353128);

const ll LINF = numeric_limits<ll>::max();
const int INF = 1e9;
const int MAXN = 1e6;
const double EPS = 1e-9;

inline void IO() {
#ifdef _DIVAN
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.setf(ios::fixed);
	cout.precision(10);
}

#define int ll
#define double long double

void solve() {
	int n, k;
	cin >> n >> k;
	vector<bool> a(n, 0);
	for (int i = 0; i < k; i++) {
		int q;
		cin >> q;
		while (q--) {
			int w;
			cin >> w;
			w--;
			a[w] = 1;
		}
	}
	for (auto t : a) {
		n -= t;
	}
	cout << n;
}

signed main() {
	IO();
	int t;
	t = 1;
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll pow_mod(ll n, ll k, ll mod = MOD) {
    if(k == 0) {
        return 1;
    } else if(k % 2 == 1) {
        return pow_mod(n, k - 1, mod) * n % mod;
    } else {
        ll t = pow_mod(n, k / 2, mod);
        return t * t % mod;
    }
}

// a / b (mod p)
ll waru(ll a, ll b) { return a * pow_mod(b, MOD - 2) % MOD; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> x(n);
    for(int i = 0; i < n; i++) {
        cin >> x[i];
    }
    vector<ll> inv(n);
    for(int i = 0; i < n; i++) {
        inv[i] = waru(1, i + 1);
    }
    for(int i = 1; i < n; i++) {
        (inv[i] += inv[i - 1]) %= MOD;
    }
    ll ans = 0;
    for(int i = 1; i < n; i++) {
        (ans += (x[i] - x[i - 1]) * inv[i - 1] % MOD) %= MOD;
    }
    for(int i = 1; i <= n - 1; i++) {
        (ans *= i) %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
let s = read_line ()
let rec f acc bc i =
  if i < 0 then acc
  else if s.[i] = 'A' then f (acc + bc) bc (i - 1)
  else if i = 0 then acc
  else if s.[i - 1] = 'B' && s.[i] = 'C' then f acc (bc + 1) (i - 2)
  else f acc 0 (i - 1)
let _ = f 0 0 @@ String.length s - 1 |> Printf.printf "%d\n"

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  std::cin >> K;

  std::cout << a[K - 1] << '\n';
}


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

using namespace std;

int main(void) {
  int N, X, Y; cin >> N >> X >> Y;
  int NoL[N]; memset(NoL, 0, sizeof(NoL));

  for (int i = 1; i < N; i++) {
    for (int j = i + 1; j <= N; j++) {
      if (j <= X || i >= Y) {
        NoL[j-i]++;
      } else if (i <= X && j >= Y) {
        NoL[X-i + j-Y + 1]++;
      } else if (i < X && j < Y) {
        NoL[X-i + min(j-X, Y-j+1)]++;
      } else if (j > Y && i < Y) {
        NoL[j-Y + min(i-X+1, Y-i)]++;
      } else {
        NoL[min(j-i, i-X + Y-j + 1)]++;
      }
    }
  }

  for (int i = 1; i < N; i++) {
    cout << NoL[i] << endl;
  }

  return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1E9 + 7, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

ll arr[200005] ;

int main()
{
    ll n, xoor = 0 ;
    cin >> n ;
    for (int i = 0; i < n; i++) {
        cin >> arr[i] ;
        xoor ^= arr[i] ;
    }
    for (int i = 0; i < n; i++) {
        printf("%lld ", xoor ^ arr[i]) ;
    }

    return 0 ;
}


Measured memory_bytes: 5320
#include<bits/stdc++.h>
   using namespace std;
   int main()
   {
   ios::sync_with_stdio(0);
   cin.tie(0);
   int n;
   cin>>n;
   int arr[n];
   int count[1000000]={0};
   long sum=0;
   for(int i=0;i<n;i++)
   {
   cin>>arr[i];
   sum+=arr[i];
   count[arr[i]]++;
   }
   int q;
   cin>>q;
   int b,c;
   while(q--)
   {
       cin>>b>>c;
       if(count[b]>0)
       {
           sum+=(count[b]*(c-b));
           count[c]+=count[b];
           count[b]=0;
       }
       cout<<sum<<endl;
   }
   
   return 0;
   }

Measured memory_bytes: 7888
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type As [][]int

func (a As) Len() int {
	return len(a)
}

func (a As) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func (a As) Less(i, j int) bool {
	return a[i][1] > a[j][1]
}

const mod = int(1e9 + 7)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	as := make(As, n)
	var spc, smc int
	for i := range as {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		as[i] = []int{a, abs(a)}
		if a >= 0 {
			spc++
		} else {
			smc++
		}
	}
	mode := true
	pk := k
	if k%2 == 1 {
		if spc > 0 {
			spc--
			pk--
		} else {
			mode = false
		}
	}
	if mode && (smc-smc%2)+(spc-spc%2) < pk {
		mode = false
	}

	m := make(map[int]int)
	if mode {
		sort.Sort(as)

		pmin := int(1e9 + 1)
		mmin := int(1e9 + 1)
		var mc int
		for i := 0; i < k; i++ {
			m[as[i][0]]++
			if as[i][0] >= 0 {
				if as[i][1] < pmin {
					pmin = as[i][1]
				}
			} else {
				mc++
				if as[i][1] < mmin {
					mmin = as[i][1]
				}
			}
		}
		if mc%2 == 1 {
			pmax := -1
			mmax := -1
			for i := k; i < n; i++ {
				if as[i][0] >= 0 {
					if as[i][1] > pmax {
						pmax = as[i][1]
					}
				} else {
					if as[i][1] > mmax {
						mmax = as[i][1]
					}
				}
			}
			if pmax > -1 && mmin < 1e9+1 {
				if pmin == 1e9+1 || mmax == -1 || pmin*pmax > mmin*mmax {
					m[-mmin]--
					m[pmax]++
				}
			}
			if mmax > -1 && pmin < 1e9+1 {
				if mmin == 1e9+1 || pmax == -1 || pmin*pmax <= mmin*mmax {
					m[pmin]--
					m[-mmax]++
				}
			}
		}
	} else {
		sort.Sort(sort.Reverse(as))

		for i := 0; i < k; i++ {
			m[as[i][0]]++
		}
	}
	ans := 1
	for key, val := range m {
		for i := 0; i < val; i++ {
			ans *= key
			ans %= mod
			if ans < 0 {
				ans += mod
			}
		}
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 24908
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>

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

using namespace std;

int fct[14];

void init(){
  fct[0] = 1;
  REP(i,11)
    fct[i+1] = (i+1)*fct[i];
}

int main() {
  int n,s;
  init();
  vector<vector<int>> t(10,vector<int>(500));
  vector<int> ok(10);
  REP(i,10)ok[i]=i;
  int i = 0;
  do{
    int sum = 0;
    REP(j,10){
      sum += (j+1)*ok[j];
      ++t[j][sum];
    }
    ++i;
  } while(next_permutation(begin(ok),end(ok)));
  while(scanf("%d%d",&n,&s) != EOF) {
    if(n > 0 && s >= 0 && n <= 10 && s < 500)
      printf("%d\n", t[n-1][s]/fct[10-n]);
    else
      printf("0\n");
  }
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;


void solve(){
	int n,m, sx, sy, fx, fy;
	cin >> n >> m >> sx >> sy >> fx >> fy;
	sx--;sy--;fx--;fy--;
	string arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int dist[n][m];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			dist[i][j] = 1000000001;
	deque<pair<int,int> > dq;
	dist[sx][sy] = 0;
	dq.push_front(make_pair(sx,sy));
	int d0x[4] = {1, 0, 0, -1};
	int d0y[4] = {0, 1, -1, 0};
	while(dq.size()){
		int x = dq.front().first, y = dq.front().second;
		dq.pop_front();
		for (int i = 0; i < 4; i++){
			int xn = x + d0x[i], yn = y + d0y[i];
			if (xn < n && xn >= 0 && yn < m && yn >= 0 && arr[xn][yn] == '.' && dist[xn][yn] > dist[x][y]){
				dist[xn][yn] = dist[x][y];
				dq.push_front(make_pair(xn,yn));
			}
		}
		for (int dx = -2; dx <= 2; dx ++)
			for(int dy = -2; dy <= 2; dy++){
				int xn = x + dx, yn = y + dy;
				if (!(dx == 0 and dy == 0) and xn < n && xn >= 0 && yn < m && yn >= 0 && arr[xn][yn] == '.' && dist[xn][yn] > dist[x][y] + 1){
					dist[xn][yn] = dist[x][y] + 1;
					dq.push_back(make_pair(xn,yn));
				}
			}
	}
	if (dist[fx][fy] == 1000000001)
		cout << -1 << endl;
	else cout << dist[fx][fy] << endl;
}

int main(){
	int TC = 1;
	//cin >> TC;
	for (int tcc = 1; tcc <= TC; tcc++){
		//cout << "Case #"<< tcc << ": ";
		solve();
	}
	return 0;
		
}

Measured memory_bytes: 9504
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int C = sc.nextInt();

        double h = b * Math.sin(C * Math.PI / 180);
        double S = h * a / 2;
        double c = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(C * Math.PI / 180));
        double l = a + b + c;
        System.out.printf("%f\n%f\n%f\n", S, l, h);
    }
}

Measured memory_bytes: 17296
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).OrderBy(a => a).ToArray();

        int ans = 0;
        for (int i = 1; i < inpt.Length; i++) {
            ans += inpt[i] - inpt[i - 1];
        }
        Console.WriteLine(ans);
    }





    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"




11 5 5



";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(ll i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a) memset(a,0,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll inf=1e18+5;
int main()
{
    int n,w;
    cin>>n>>w;
    int wgt[n],val[n];
    rep(i,0,n)
    cin>>wgt[i]>>val[i];
    int v=0;
    rep(i,0,n)
    v+=val[i];
    vector<vector<ll>>dp(n+1,vector<ll>(v+1,inf));
    dp[0][0]=0;
    repA(i,1,n)
    {
        repA(j,0,v)
        {
            dp[i][j]=dp[i-1][j];
            if(val[i-1]<=j)
            dp[i][j]=min(dp[i][j],wgt[i-1]+dp[i-1][j-val[i-1]]);
        }
    }
    ll res=0;
    repA(i,0,v)
    if(dp[n][i]<=w)
        res=max(res,ll(i));
    cout<<res<<endl;
}


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


int main(){
    int N;
    int d[100020]={};
    int ans = 0;
    cin >> N;
    for(int i = 1; i <=N; i++) cin >> d[i];
    sort(d, d + N+3, greater<int>());
    ans = d[(N/2)-1] - d[(N/2)];
    
  
    cout << ans<<"\n";
    
    
    return 0;
}

Measured memory_bytes: 640
n = int(input())
lst = []
for i in range(n):
  lst.append(int(input()))

not10nums = [i for i in lst if i%10!=0]
subnum=0
if len(not10nums)>0:
  subnum=min(not10nums)
  
sm =sum(lst)
if sm%10==0:
  sm-=subnum
if sm%10==0:
  sm=0
print(sm)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

/*  prime_table(n)
    入力：整数 n
    出力：nまでの数字が素数か判定したテーブル
    計算量：O(nloglogn)
*/
vector<bool> prime_table(int n) {
    vector<bool> prime(n + 1, true);
    if (n >= 0) prime[0] = false;
    if (n >= 1) prime[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (!prime[i]) continue;
        for (int j = i + i; j <= n; j += i) {
            prime[j] = false;
        }
    }
    return prime;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int Q;
    cin >> Q;
    vector<int> l(Q), r(Q);
    REP(i, Q) cin >> l.at(i) >> r.at(i);

    vector<bool> prime_t = prime_table(100005);

    vector<bool> like(100005);
    REP(i, 100005) {
        if (prime_t[i] && prime_t[(i + 1) / 2]) {
            like[i] = true;
        } else {
            like[i] = false;
        }
    }

    vector<int> sum(100005);
    FOR(i, 1, 100005) {
        if (like[i]) {
            sum[i] += sum[i - 1] + 1;
        } else {
            sum[i] = sum[i - 1];
        }
    }
    REP(i, Q) { cout << sum[r[i]] - sum[l[i] - 1] << endl; }
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std ;

bool Mysoty(pair<string,double> a,pair<string,double> b){
    
    if(a.first < b.first) return true ;
    if(a.first == b.first){
        if(a.second > b.second) return true ;
    }

    return 0 ;
}

int main(){
    int N = 10 ;
    cin >> N ;
    vector< pair<string,double> > S(N) ;
    for (int i = 0; i < N; i++)
    {
        cin >> S[i].first >> S[i].second  ;
        S[i].second +=  0.001*(i+1) ;
    }

    cout<<endl;

    sort(S.begin(),S.end(),Mysoty);

    for (int i = 0; i < N; i++)
    {
        double sho = S[i].second - (int)S[i].second ;
        cout << sho*1000 <<endl;
    }
    
    
}

Measured memory_bytes: 256
L1 = [1, 3, 5, 7, 8, 10, 12]
L2 = [4, 6, 9, 11]
L3 = [2]
x, y = list(map(int, input().split()))

X = 0
Y = 0
if L1.count(x) == 1:
	X = 1
elif L2.count(x) == 1:
	X = 2
else:
	X = 3

if L1.count(y) == 1:
	Y = 1
elif L2.count(y) == 1:
	Y = 2
else:
	Y = 3

if X == Y:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3316
import java.util.HashSet;
import java.util.Scanner;
public class Main
{ 
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int N=in.nextInt();
		while(N-->0)
		{
			String st=in.next();
			HashSet<String> hs=new HashSet<String>();
			hs.add(st);
			for(int i=1;i<st.length();i++)
			{
				String head=st.substring(0, i);
				String tail=st.substring(i,st.length());
				hs.add(head+re(tail));
				hs.add(re(head)+tail);
				hs.add(re(head)+re(tail));
				hs.add(tail+head);
				hs.add(re(tail)+head);
				hs.add(tail+re(head));
				hs.add(re(tail)+re(head));
			}
			System.out.println(hs.size());
		}
	}
	static String re(String st)
	{
		StringBuilder sb=new StringBuilder(st);
		return sb.reverse().toString();
	}
}

Measured memory_bytes: 13000
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
if(n<105){
cout << 0;
}else if(n<135){
cout << 1;
}else if(n<165){
cout << 2;
}else if(n<189){
cout << 3;
}else if(n<195){
cout << 4;
}else{
 cout <<5; 
}
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

struct mint {
	ll x;
	mint(ll x=0):x((x%MOD+MOD)%MOD){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
	if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += MOD-a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

	mint inv() const { return pow(MOD-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
	int n, k;
	cin >> n >> k;
	vector<ll> sumL(n+2,0), sumR(n+2, 0);
	for (int i = 0; i <= n; i++) sumL[i+1] = sumL[i] + i;
	for (int i = 0; i <= n; i++) sumR[i+1] = sumR[i] + (n - i);
	mint ans = 0;
	for (int i = k; i <= n+1; i++) {
		ans += sumR[i] - sumL[i] + 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1);
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(T x, T y){
        cout << x << "," << y << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//



//----------//

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    ll n;
    cin >> n;
    ll ans = 0;
    for(int i=n; i>=1; i--){
        int nowketa = 0;
        if(i / 100000LL >= 1LL) nowketa = 6;
        else if(i / 10000LL >= 1LL)nowketa = 5;
        else if(i / 1000LL >= 1LL) nowketa =4;
        else if(i / 100LL>= 1LL) nowketa =3;
        else if(i / 10LL >= 1LL) nowketa =2;
        else nowketa =1;
        //print(i, nowketa);

        string str = to_string(i);
        char a = str[0];
        char b = str[nowketa-1];
        if(b == '0') continue;
        if(a == b){
            ans++; // 一桁め
            if(nowketa > 1){
                int tmp = max(0, nowketa - 2);
                if(tmp > 0){
                    string tmp2 = str.substr(1, tmp);
                    ans += atoi(tmp2.c_str()) * 2 + 2;
                }
                else
                    ans+=2; // 二桁の時
            }
        }
        else{
            if(nowketa > 1){
                string str2 = str;
                str2[0] = b;
                str2[nowketa-1] = a;
                if(atoi(str.c_str()) > atoi(str2.c_str())){
                    int tmp = pow(10, max(0, nowketa - 2));
                    ans += 2 * tmp;
                }
            }
        }
        if(nowketa == 6){
            ans += 1000 * 2;
            ans += 100 * 2;
            ans += 10 * 2;
            ans += 2;
        }
        if(nowketa == 5){
            ans += 100 * 2;
            ans += 10 * 2;
            ans += 2;
        }
        if(nowketa == 4){
            ans += 10 * 2;
            ans += 2;
        }
        if(nowketa == 3){
            ans += 2;
        }
        //cout << ans << endl;
    }

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


Measured memory_bytes: 256
N = int(input())
num_list = list(map(int,input().split()))
ans = 0

while True:
    waru = 0
    for i in range(N):
        if num_list[i]%2==0:
            waru += 1
            num_list[i] //=2
    ans += waru
    if waru == 0:
        break

print(ans)

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            int a, b, c;
            int hito = 0;

            c = int.Parse(Console.ReadLine());


            for (int i = 0; i < c; i++)
            {
                string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
                a = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
                b = int.Parse(str[1]);

                if ((b - a) == 0)
                {
                    hito++;
                }
                else
                {
                    hito += b - a + 1;
                }

            }

            Console.WriteLine(hito);
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
#define SUCCESS 0
#define FAILURE -1
#define STACK_SIZE 100
int stack[STACK_SIZE]={0};
int stack_num;

int push(int push_data){
    if (stack_num < STACK_SIZE){
        stack[stack_num]=push_data;
        stack_num++;
        return SUCCESS;
    }
    return FAILURE;
}

int pop(int *pop_data){
    if (stack_num > 0){
        *pop_data=stack[stack_num-1];
        stack_num--;
        return SUCCESS;
    }
    return FAILURE;
}

int main(void){
    char a[2000]={'\0'};
    int data1,data2;
    fgets(a, sizeof(a), stdin);
    stack_num=0;
    for (int i = 0; i < strlen(a); i++) {
        data1=0; data2=0;
        if ('0' <= a[i] && a[i] <= '9') {
            if (i>0 && '0' <= a[i-1] && a[i-1] <= '9') pop(&data1);
            push(data1*10+a[i]-'0'); continue;
        }
        if (a[i]=='+') {pop(&data2); pop(&data1); push(data1 + data2); continue;}
        if (a[i]=='-') {pop(&data2); pop(&data1); push(data1 - data2); continue;}
        if (a[i]=='*') {pop(&data2); pop(&data1); push(data1 * data2); continue;}
        if (a[i]=='/') {pop(&data2); pop(&data1); push(data1 / data2); continue;}
    }
    printf("%d\n",stack[stack_num-1]);
    return 0;
}


Measured memory_bytes: 2092
import java.math.*

fun main(args: Array<String>) {
    val (N, T) = readInputLine().split(" ").map { it.toInt() }
    
    val dishes = Array(N) { Pair(0, 0) }

    for (i in 0 until N) {
        val (A, B) = readInputLine().split(" ").map { it.toInt() }
        dishes[i] = Pair(A, B)
    }
    
    val dp1 = Array(N + 2) { IntArray(T) }
    val dp2 = Array(N + 2) { IntArray(T) }
    
    for (i in 1 until T) {
        for (j in 1..N) {
            if (dishes[j - 1].first <= i) {
                dp1[j][i] = Math.max(dp1[j - 1][i], dp1[j - 1][i - dishes[j - 1].first] + dishes[j - 1].second)
            } else {
                dp1[j][i] = dp1[j - 1][i]
            }
            
            if (dishes[N - j].first <= i) {
                dp2[N - j + 1][i] = Math.max(dp2[N - j + 2][i], dp2[N - j + 2][i - dishes[N - j].first] + dishes[N - j].second)
            } else {
                dp2[N - j + 1][i] = dp2[N - j + 2][i]
            }
        }
    }

    var ans = 0

    for (i in 0 until T) {
        for (j in 1..N) {
            ans = Math.max(ans, dp1[j - 1][i] + dp2[j + 1][T - 1 - i] + dishes[j - 1].second)
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}



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

int main(void){
	int n,m;
	cin>>m;
	for(int i=1;i<=m;i++){
		cin>>n;
		cout<<"Case "<<i<<":"<<endl;
		for(int j=0;j<10;j++){
			n=n*n;
			n=((n%1000000)/100);
			cout<<n<<endl;
		}
	}
}

Measured memory_bytes: 1160
#B Bitter Alchemy
n,z = map(int,input().split())
k = []
s = 0
for i in range(n):
    l = int(input())
    k.append(l)
    z -= l
    if z <0:
        break
    s+=1

k.sort()
print(s+z//k[0])
    
    

Measured memory_bytes: 2940
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;



public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int size = 1<<n;

		TreeMap<Integer, int[]> s = new TreeMap<>();

		for (int i=0;i<size;i++) {
			int x = sc.nextInt();
			if (!s.containsKey(x)) {
				s.put(x, new int[1]);
			}
			s.get(x)[0]++;
		}
		System.out.println(isPossible(s) ? "Yes" : "No");


	}

	static boolean isPossible (TreeMap<Integer, int[]> s) {
		TreeMap<Integer, int[]> t = new TreeMap<>();
		t.put(s.lastKey(), new int[]{1});
		s.get(s.lastKey())[0]--;
		if (s.get(s.lastKey())[0]==0) {
			s.remove(s.lastKey());
		}
		
		while (true) {
		
			TreeMap<Integer, int[]> u = new TreeMap<>();
			for (Map.Entry<Integer, int[]> v : t.entrySet()) {
				int size = v.getKey();
				int num = v.getValue()[0];

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

					if (s.lowerKey(size)==null) {
						return s.isEmpty();
					}
					int target = s.lowerKey(size);
					s.get(target)[0]--;
					if (s.get(target)[0]==0) {
						s.remove(target);
					}
					if (!u.containsKey(target)) {
						u.put(target, new int[1]);
					}
					u.get(target)[0]++;
				}
			}

			for (Map.Entry<Integer, int[]> v : u.entrySet()) {
				int size = v.getKey();
				int num = v.getValue()[0];
				for (int i=0;i<num;i++) {

					if (!t.containsKey(size)) {
						t.put(size, new int[1]);
					}
					t.get(size)[0]++;
				}
			}

		}

	}




}







Measured memory_bytes: 115332
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1<<28)
#define int long long
#define double long double
#define floot10 cout<<fixed<<setprecision(10)
int check[101000];
int nex[101000];
int done[101000];

signed main(){
  int n,k;
  cin>>n>>k;
  int ans=0;
  lp(i,n){
    int a;
    cin>>a;
    if(a==0) ans++;
    else{
      nex[i+1]=a;
      check[a]=1;
    }
  }
  queue<pair<int,int> > q;
  lp(i,n+1){
    if(i==0) continue;
    if(check[i]==0){
      q.push({i,0});
    }
  }
  while(!q.empty()){
    int now=q.front().first;
    int count=q.front().second;
    q.pop();
    if(done[now]==1) continue;
    done[now]=1;
    if(count>=k) continue;
    if(nex[now]==0) continue;
    ans++;
    q.push({nex[now],count+1});
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 6200
#include <iostream>
#include <stdlib.h>

int main() {
    int n, l, min = 1000, res, ans, total=0;
    std::cin >> n >> l;

    for(int i=1; i<=n; i++){
        res = abs(0-(l+i-1));
        if(res < min) {
            min = res;
            ans = i;
        }
    }

    for(int i=1; i<=n; i++){
        if(ans != i)
            total += l+i-1;
    }

    std::cout << total;

    return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  rep(i, s.size()){
    if ( i % 2 == 0){
      if (s[i] == 'L'){
        puts("No");
        return 0;
      }
    } else {
      if (s[i] == 'R'){
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  
  int x , y;
  
  while(1){
    
  
  
  cin >> x >> y;
  
  if(x > y){
    
    swap(x , y);
  }
    if(x == 0&&y == 0)   
    break;
    
  cout << x << ' ' << y << endl;
  }
}


Measured memory_bytes: 3072
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {


	int N,t;
	scanf("%d%d", &N,&t);

	printf("%d", max(N - t, 0));
	

}

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

// int binary(int bina){
//     int ans = 0;
//     for (int i = 0; bina>0 ; i++)
//     {
//         ans = ans+(bina%2)*pow(10,i);
//         bina = bina/2;
//     }
//     return ans;
// }

int main(){
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    int A[N][M];
    rep(i, N){
        cin >> C[i];
        rep(j, M){
            cin >> A[i][j];
        }
    }
    int ans = 99999999;

    vector<int> price(pow(2,N), 0);

    rep(k, pow(2,N)){
        // string s = bitset<12>(k);
        vector<int> und(M, 0);
        vector<int> use(N, 0);

        int temp = k;

        rep(i, N){
            use[i] = temp % 2;
            temp = temp / 2;
        }

        rep(i, N){
            rep(j, M){
                und[j] += use[i] * A[i][j];
            }
            price[k] += use[i] * C[i];
        }
        rep(j, M){
            if (und[j] < X){
                price[k] = 99999999;
            }
        }

        if (ans > price[k]){
            ans = price[k];
        }
    }

    if (ans == 99999999){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 4124
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);}
#define N 200005
int a[N],b[N],n,m;
bool chk(int mid)
{
	for(int i=1;i<=mid;i++) b[i]=a[i];
	for(int i=mid+1;i<=n;i++) b[i]=a[i]-m;
	sort(b+1,b+n+1);
	for(int i=1;i<=n/2;i++)
	{
		if(b[i]+b[n-i+1]<0) return 0;
	}
	return 1;
}
signed main()
{
	cin>>n>>m; n*=2;
	for(int i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	int l=1,r=n+1,ans;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(chk(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	for(int i=1;i<=ans;i++) b[i]=a[i];
	for(int i=ans+1;i<=n;i++) b[i]=a[i]-m;
	sort(b+1,b+n+1);
	ans=0;
	for(int i=1;i<=n/2;i++) ans=max(ans,(b[i]+b[n-i+1])%m);
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 5164
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  int b[n] = {}, w[n] = {};
  for (int i = 0; i < n; ++i)
  {
    if (i == 0)
    {
      if (s[i] == '#')
        b[i] = 1;
      else
        w[i] = 1;
    }
    else if (s[i] == '#')
      b[i] = b[i - 1] + 1, w[i] = w[i - 1];
    else
      w[i] = w[i - 1] + 1, b[i] = b[i - 1];
  }
  if (b[n - 1] == n || w[n - 1] == n)
  {
    cout << 0 << endl;
    return 0;
  }

  int ans = 1e9;
  for (int i = 0; i < n; ++i)
  {
    ans = min(ans, b[i] + w[n - 1] - w[i]);
  }
  ans = min({w[n - 1], b[n - 1], ans});
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2180
s=input()
for i in range(2**3):
    op = ['+','+','+']
    for j in range(3):
        if ((i >> j) & 1):
            op[j] = '-'
    if eval(s[0]+op[0]+s[1]+op[1]+s[2]+op[2]+s[3]) == 7:
        print(s[0]+op[0]+s[1]+op[1]+s[2]+op[2]+s[3]+'=7')
        break

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

int a[111][111];
int main()
{
    int r, c, a[111][111] = {};
    cin >> r >> c;
    for (int i = 0; i < r; i++) for (int j = 0; j < c; j++) cin >> a[i][j];

    for (int i = 0; i < r; i++) {
        int t = 0;
        for (int j = 0; j < c; j++) {
            t += a[i][j];
        }
        a[i][c] = t;
    }

    for (int i = 0; i <= c; i++) {
        int t = 0;
        for (int j = 0; j < r; j++) {
            t += a[j][i];
        }
        a[r][i] = t;
    }

    for (int i = 0; i <= r; i++) {
        for (int j = 0; j <= c; j++) {
            cout << a[i][j] << (j == c ? "" :" ");
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3144
S = gets.chomp.split("")
T = gets.chomp.split("")

index = S.count - T.count

search_result = -1
while index >= 0
  r_flag = true
  T.each_with_index do|c, s_index|
    unless S[index + s_index] == c || S[index + s_index] == '?'
      r_flag = false
      break
    end
  end
  if r_flag
    search_result = index
    break
  end
  index -= 1
end

if search_result != -1
  T.each_with_index do |c, s_index|
    S[index + s_index] = c
  end
  S.count.times do |i|
    S[i] = 'a' if S[i] == '?'
  end
  puts S.join
else
  puts 'UNRESTORABLE'
end

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
void CountingSort(int *,int *,int);
int C[2000000],max=0;
int main(void){
  int n,*A,*B,i;
  scanf("%d",&n);
  A=(int *)malloc(sizeof(int)*n);
  B=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(max<A[i])max=A[i];
  }
  CountingSort(A,B,n);
  for(i=0;i<n;i++){
    printf("%d",B[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  return 0;
}
void CountingSort(int *A,int *B,int k){
  int i;
  for(i=0;i<=k;i++)
    C[i]=0;

  /* C[i] に i の出現数を記録する */
  for(i=0;i<k;i++)
    C[A[i]]++;

  /* C[i] に i 以下の数の出現数を記録する*/
  for(i=1;i<=max;i++)
    C[i]=C[i]+C[i-1];

  for(i=k-1;i>=0;i--){
    B[C[A[i]]-1]=A[i];
    C[A[i]]--;
  }
}


Measured memory_bytes: 25168
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<functional>

using namespace std;
#define LL long long
#define ALF "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define LLBIG 1999999999999999999
#define INTBIG 1111111111
#define MOD 1000000007
#define PI pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>

int main() {
	int a, b; cin >> a >> b;
	cout << (a == b ? a + b : max(a, b) * 2 - 1) << endl;
	return 0;
}


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.at(i);
    int Alice = 0, Bob = 0;
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    for (int i=0; i<N; i++) {
        if (i%2 == 0) Alice += a.at(i);
        else Bob += a.at(i);
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  string s;
  cin >> s;
  string ans = "";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != 'B') {
      ans += s[i];
    } else {
      if (ans.size() == 0) continue;
      ans = ans.substr(0, ans.size() - 1);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  	int A[3][3];
  	bool check[3][3];
  	
  	for(int i=0; i<3; i++){
    	cin >> A[i][0] >> A[i][1] >> A[i][2];	
      	check[i][0]=false;
      	check[i][1]=false;
      	check[i][2]=false;
    }
  	
  	int N;
  	cin >> N;
  	int b[N];
  	
  	for(int i=0; i<N; i++){
    	cin >> b[i];
      	for(int j=0; j<3; j++){
        	if(A[j][0]==b[i]){
            	check[j][0]=true;
            }else if(A[j][1]==b[i]){
            	check[j][1]=true;
            }else if(A[j][2]==b[i]){
            	check[j][2]=true;
            }
        }
    }
  
  	if(check[0][0]==true&&check[0][1]&&check[0][2]==true ||
       check[1][0]==true&&check[1][1]&&check[1][2]==true ||
       check[2][0]==true&&check[2][1]&&check[2][2]==true ||
       check[0][0]==true&&check[1][0]&&check[2][0]==true ||
       check[0][1]==true&&check[1][1]&&check[2][1]==true ||
       check[0][2]==true&&check[1][2]&&check[2][2]==true ||
       check[0][0]==true&&check[1][1]&&check[2][2]==true ||
       check[0][2]==true&&check[1][1]&&check[2][0]==true){
    	cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }
  	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
 #define mod 1000000007
 const int N=100005;
 const int inf=1e18;
 
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin>>n;
	int a[n];
	for(int x=0;x<n;x++){
		cin>>a[x];
	}
	int r[n];
	int w1=0,w2=2*a[n-1];
	for(int x=0;x<n-1;x++){
		if(x%2==0){
			w1+=2*a[x];
		}else{
			w1-=2*a[x];
		}
	}
//	cout<<w
	r[0]=(w1+w2)/2;
	r[n-1]=r[0]-w1;
	for(int x=1;x<n-1;x++){
		r[x]=2*a[x-1]-r[x-1];
	}
	for(int x=0;x<n;x++){
		cout<<r[x]<<" ";
	}
	







	
	
return 0;	
}


Measured memory_bytes: 2944
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}
 
const int mod = 1000000007;
//const int mod = 998244353;
 
struct mint {
	int64_t x;
	mint(int64_t x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(int64_t t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
 
	//for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) {return mint(*this) /= a;}
};
 
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
struct combination {
	vector<mint> frac, ifrac;
	combination(int n):frac(n+1), ifrac(n+1) {
		assert(n < mod);
		frac[0] = 1;
		for (int i = 1; i <= n; ++i) frac[i] = frac[i-1]*i;
		ifrac[n] = frac[n].inv();
		for (int i = n; i >= 1; --i) ifrac[i-1] = ifrac[i]*i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return frac[n]*ifrac[k]*ifrac[n-k];
	}
} c(1000000);
 
//head
 
 
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	cin >> h >> w;
	int a, b;
	cin >> a >> b;
	mint ans;
	for(int i = b; i < w; i++) {
		ans += c(i+h-a-1, i) * c(a-1+w-i-1, a-1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 18652
S = input()
arr = [0]*(len(S) + 1)
cn = 0
for i in range(len(S)):
    if S[i] == "<":
        cn += 1
    else:
        cn = 0
    arr[i+1] = cn
cn = 0
for i in range(len(S)-1, -1, -1):
    if S[i] == ">":
        cn += 1
    else:
        cn = 0
    arr[i] = max(arr[i], cn)
# print(arr)
print(sum(arr))

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

using namespace std;

// cl /EHsc xxx.cpp
void call(int n)
{
	int i = 1;
	do { // CHECK_NUM:
		int x = i;
		if ( x % 3 == 0 ) {
			cout << " " << i;
		} else {
			do { // INCLUDE3:
				if ( x % 10 == 3 ) {
					cout << " " << i;
					break;
				}
				x /= 10;
			} while ( x ); // goto INCLUDE3;
		}
	} while (++i <= n); // goto CHECK_NUM;
	
	cout << endl;
}

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	call(n);
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
  cin >> s;
  int i,sw;
  sw=0;

  
  for(i=0;i<3;++i)
  {
  if(s.at(i)=='o') sw++;}
    
  cout <<700+100*sw;  
    
return 0;}

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

typedef long long ll;
ll s;
string a;

void f(ll p, ll q, ll r) {
	if (p == a.size()) {s += q + r; return;}
	f(p + 1, q, r * 10 + a[p] - '0');
	f(p + 1, q + r, a[p] - '0');
}

int main()
{
	cin >> a;
	f(1, 0, a[0] - '0');
    cout << s << endl;
    return 0;
}

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

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int a = arr[0];
    int b = arr[1];
    int k = arr[2];
    var s = Enumerable.Range(a, k).TakeWhile(x => x <= b);
    var L = Enumerable.Range(b - k + 1, k).SkipWhile(x => x <= a);
    foreach (var n in s.Union(L)) {
      Console.WriteLine(n);
    }
  }
}

Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
#define WHITE 0
#define BLACK 1
typedef long long ll;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
string s;
int k;
int INFi=1000000000;
ll INFl=1000000000000000;

struct UnionFind{
    vector<int> par;//初期化
    vector<int> rank;//高さ
    UnionFind(int n=0):par(n),rank(n,0){
        for(int i=0;i<n;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);//経路圧縮
    }
    void unite(int x,int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        if(rank[rx]<rank[ry]) rank[rx]=ry;
        else rank[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
struct edge{int from,to,cost;};
vector<edge> es(100); //辺の集合
vector<int> d(100,INFi);//最短距離
int V,E;//頂点数、辺数

int main(){
    int n;cin>>n;
    string s;cin>>s;
    int ans=0;
    for(int l=1;l<=n-1;l++){
        string ls=s.substr(0,l);
        string rs=s.substr(l,n-l);
        vector<bool> bl(26,false);
        vector<bool> br(26,false);
        for(int i=0;i<ls.size();i++){
            bl[(int)(ls[i]-'a')]=true;
        }
        for(int i=0;i<rs.size();i++){
            br[(int)(rs[i]-'a')]=true;
        }
        int count=0;
        for(int i=0;i<26;i++)if(bl[i]&&br[i]) count++;
        ans=max(ans,count);
    }
    cout<<ans<<endl;
}




Measured memory_bytes: 256
private fun readIntArray(): List<Int> {
    return readLine()!!.split(" ").map{ it.toInt() }
}

private fun readInt(): Int {
    return readLine()!!.toInt()
}

private fun readTextArray(): List<String> {
    return readLine()!!.split(" ")
}

fun main(args: Array<String>) {
    val s = readTextArray()[0]!!

    if (s.contains('a') && s.contains('b') && s.contains('c')) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 37872