akhauriyash/Code-Regression huggingface dataset:
// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<LL> t(n), a(n), th(n), ah(n);
    for(int i=0;i<n;i++) cin >> t[i];
    for(int i=0;i<n;i++) cin >> a[i];
    LL ans = 1;
    for(int i=0;i<n;i++){
        th[i] = t[i];
        if(i > 0){
            if(t[i-1] == t[i]) th[i] = 0;
        }
        ah[i] = a[i];
        if(i < n-1){
            if(a[i] == a[i+1]) ah[i] = 0;
        }

        //cout << th[i] << " " << ah[i] << endl;

        if(th[i] == 0 && ah[i] == 0){
            ans *= min(t[i], a[i]);
            ans %= MOD;
        }
        if(th[i] == 0 && ah[i] != 0){
            if(t[i] < ah[i]){
                cout << 0 << endl;
                return 0;
            }
        }
        if(th[i] != 0 && ah[i] == 0){
            if(a[i] < th[i]){
                cout << 0 << endl;
                return 0;
            }
        }
        if(th[i] != 0 && ah[i] != 0){
            if(th[i] != ah[i]){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main(void) {
    double a, s;
    while (true) {
        cin >> a;
        s = a;
        if (cin.eof()) break;;
        for (int i = 2; i <= 10; i++) {
            if (i % 2 == 0) {
                a = a * 2;
                s += a;
            } else {
                a = a / 3;
                s += a;
            }
        }
        printf("%.8f\n", s);
    }
    return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
    string s, t;
    cin >> s >> t;

    int ret = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i])ret++;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3924
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n,t;
    cin >> n >> t;
    vector<P> data(n,P(n,0));
    rep(i,n)cin >> data.at(i).first >> data.at(i).second;
    sort(data.begin(),data.end());
    rep(i,n)
    {    if(data.at(i).second <= t){
            cout << data.at(i).first << endl;
            return 0;
        }else{
            continue;
        }
    }
    cout << "TLE\n";
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define int long long
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string
int digitsum(int a){
  int b=0;
  while(a){
    b+=a%10;
    a/=10;
  }
  return b;
}
signed main(){
  int N,M,O,P=0,c=0,co=0,cou=0,minN=mod;
  double D,Do;
  char C,Ca;
  str S,T;
  cin>>N>>M;
  vint A(M);
  rep(0,M){
    cin>>A[i];
    c+=A[i];
  }
  c>=N?cout<<"Yes"<<endl:cout<<"No"<<endl;
}


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

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;

ll mod = 1e9+7;

ll solve() {
    string s; cin >> s;
    int cnt = 0, n = static_cast<int>(s.size());
    int res = 0;
    rep(i, n) {
        if (s[i] == 'R') {
            cnt++;
        } else {
            cnt = 0;
        }
        res = max(res, cnt);
    }

    return res;
}

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

	cout << solve() << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define allr(a) (a).rbegin(),(a).rend()
#define F first
#define S second
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define N 200010
using namespace std;
void solve()
{
    ll ans=0;
    string s,t; cin>>s>>t;
    for(int i=0;i<s.size();i++)
        if(s[i]!=t[i])ans++;
    cout<<ans;
}
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int t=1;
  //cin>>t;
  //freopen("b2.in", "r", stdin);
  //freopen("output2.txt", "w", stdout);
  for(int i=1;i<=t;i++)
  {
      solve();
  }
  return 0;
}



Measured memory_bytes: 3776
#include <iostream>
#include <string>
#include <vector>
#include <ios>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>

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

using namespace std;

const int INF = 100000000;
int main(){
  char b;
  cin >> b;

  switch (b) {
    case 'A':
             cout << 'T';
               break;
    case 'T':
             cout << 'A';
               break;
    case 'G':
             cout << 'C';
               break;
    case 'C':
             cout << 'G';
               break;
  }
  cout << endl;
  return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    if(S[0] == '9' || S[1] == '9'){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    LL n;
    cin >> n;
    VLL l(n);
    REP(i,0,n) cin >> l[i];
    sort(all(l));
    LL ans = 0;
    REP(i,0,n) REP(j,i+1,n) {
        auto it = lower_bound(all(l),l[i]+l[j]);
        --it;
        ans += max(0, int(distance(l.begin(), it)) - j);
        //cerr << i << ", " << j << ": " << ans << endl;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	string s;
	int n,a,b,c,d;
	cin >> n >> a >> b >> c >> d >> s;
	s = "#" + s + "#";
	if(c < d){
		bool flag = true;
		for(int i = a;i < c;i++){
			if(s[i] == '#' && s[i + 1] == '#') flag = false;
		}
		for(int i = b;i < d;i++){
			if(s[i] == '#' && s[i + 1] == '#') flag = false;
		}
		if(flag) Yes();
		else No();
	}else{
		bool f1 = false,f2 = true;
		for(int i = b;i <= d;i++){
			if(s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') f1 = true;
		}
		for(int i = a;i < c;i++){
			if(s[i] == '#' && s[i + 1] == '#') f2 = false;
		}
		if(f1 && f2) Yes();
		else No();
	}
}


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

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

Measured memory_bytes: 3612
#


def main():
    array = [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]
    k = int(input())
    print(array[k - 1])


if __name__ == '__main__':
    main()


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

int main() {
  int n,x,t;
  cin>>n>>x>>t;
  int ans;
  n%x==0?ans=(n/x)*t:ans=(n/x+1)*t;
  cout<<ans<<endl;
  system("pause");
  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod = 1000000007;
//const int mod = 998244353;
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;}
};
mint choose(int n,int a){
  mint x = 1,y=1;
  rep(i,a){
    x*= n-i;
    y*= i+1;
  }
  return x/y;
}
int main(){
  int n,k;
  cin>>n>>k;
  rep(i,k){
    int a=i+1;
    mint ans=choose(n-k+1,a);
    ans*=choose(k-1,a-1);
    cout<<ans.x<<endl;
  }
}

Measured memory_bytes: 384
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int K = Integer.parseInt(sc.nextLine());
    int ans = 0;
    for(int i = 1; i <= N; i++){
      int n = Integer.parseInt(sc.next());
      ans += Math.min(n,K-n)*2;
    }

    System.out.println(ans);
  }
}

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

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

using namespace std;

int main() {
  int c[3][3];
  rep(i, 3) {
    rep(j, 3) { std::cin >> c[i][j]; }
  }

  bool ok = false;
  if (c[0][0] - c[0][1] == c[1][0] - c[1][1] &&
      c[1][0] - c[1][1] == c[2][0] - c[2][1] &&
      c[0][1] - c[0][2] == c[1][1] - c[1][2] &&
      c[1][1] - c[1][2] == c[2][1] - c[2][2]) {
    ok = true;
  }

  std::cout << (ok ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<numeric>
#include<set>
#include<map>
#include<deque>
#include<list>
#include<forward_list>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long 
const ll w = (1e9+7);
using namespace std;
void fireman()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

//int prime(int x)
//{
//	bool b = true;
//	if (x == 2)
//	{
//		return true;
//	}
//	else if (x == 1 || x % 2 == 0)
//	{
//		return false;
//	}
//	for (int i = 3; i * i <= x; i += 2)
//	{
//		if (x % i == 0)
//		{
//			b = false;
//			return false;
//			break;
//		}
//	}
//	return true;
//}


int main()
{
	fireman();
	ll x,y;
	cin >> x >> y;
	if (y & 1 || x * 2 > y || x * 4 < y)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

}




Measured memory_bytes: 3608
#include <iostream>
using namespace std;
int main(){
    string s; cin >> s;
    if (s == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if (s == "Cloudy"){
        cout << "Rainy" << endl;
    }
    else {
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  int n;
  cin >> h >> w;
  cin >> n;
  vector<int>a(n+1);
  int i,j;
  int cnt = 1;
  bool right = true;
  for(i=1;i<=n;i++){
    cin >> a[i];
  }
  int c[w][h];
  i=0;
  j=0;
  for(cnt = 1;cnt<=n;cnt++){
    while(a[cnt]>0){
      c[i][j] = cnt;
      if(right){
        if(i<w-1)i++;
        else{
          j++;
          right = false;
        }
      }else{
        if(i>0)i--;
        else{
          j++;
          right = true;
        }
      }
      a[cnt]--;
    }
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cout << c[j][i] << " ";
    }
    cout << endl;
  }


}


Measured memory_bytes: 384
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};

fn main() {
    input! {
        k: usize,
    }

    for _ in 0..k {
        print!("ACL");
    }
}


Measured memory_bytes: 2136
package main

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

func main() {
	sc := NewScanner()
	A, B := sc.NextInt(), sc.NextInt()
	l := make([]bool, 4)
	l[A] = true
	l[B] = true

	for i := 1; i <= 3; i++ {
		if !l[i] {
			fmt.Println(i)
			return
		}
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(long[]), n = rd[0], m = rd[1];
  auto c = min(n, m/2);
  m -= c*2;
  c += m/4;
  writeln(c);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=2e5+9;
const int mod=1e9+7;

ll a[N],b[N];

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,x,c,ans,ans1;
    map<int,int>cnt;
    cin>>x>>n;
    while(n--){
    	cin>>c;
    	cnt[c]++;
    }
    for(int i=x; ;i++){
    	if(cnt[i]==0){
    		ans=i;
    		//cout<<ans;
    		break; 
    	}
    }
    for(int i=x-1; ;i--){
    	if(cnt[i]==0){
    		ans1=i;
    		break; 
    	}
    }
    if(abs(ans-x)<abs(ans1-x)){
    	cout<<ans;
    }
    if(abs(ans-x)>abs(ans1-x)){
    	cout<<ans1;
    }
    if(abs(ans-x)==abs(ans1-x)){
    	cout<<min(ans,ans1);
    }

}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	string a;
	cin >> a;
	int ans = 0;
	rep(i, 3) {
		if (a[i] == *"1") {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

//Ctrl+Aを使わない


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

LL N, C;
vector<pair<LL, LL>> XV;
map<LL, LL> M;
vector<LL> X, V;

LL P[100004] = {0};
LL Q[100004] = {0};
LL R[100004] = {0};
LL S[100004] = {0};

LL XP[100004] = {0};
LL XQ[100004] = {0};
LL XR[100004] = {0};
LL XS[100004] = {0};


int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> C;
	V.push_back(0);
	X.push_back(0);
	for(int i=0; i<N; i++){
		long long x, v;
		cin >> x >> v;
		X.push_back(x);
		V.push_back(v);
		XV.push_back(make_pair(x, v));
		M[x] = v;
	}
	X.push_back(C);

	LL eg = 0, w = 0;
	LL ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0;
	for(int i=1; i<=N; i++){
		eg += (V[i] - (X[i] - X[i-1]));
		w = eg - X[i];
		P[i] = eg;
		Q[i] = w;
		if(ans1 < eg){
			ans1 = eg;
		}
	}
	P[N+1] = P[N] - (C - X[N]);
	Q[N+1] = P[N+1] - C;

	eg = 0, w = 0;
	for(int i=N; i>=1; i--){
		eg += (V[i] - (X[i+1] - X[i]));
		w = eg - (C - X[i]);
		R[i] = eg;
		S[i] = w;
		if(ans2 < eg){
			ans2 = eg;
		}
	}
	R[N+1] = 0;
	S[N+1] = 0;

	for(int i=1; i<=N; i++){
		if(i == 1){
			XP[i] = P[i];
			XQ[i] = Q[i];
		}
		else{
			if(P[i] > XP[i-1]){
				XP[i] = P[i];
			}
			else{
				XP[i] = XP[i-1];
			}
			if(Q[i] > XQ[i-1]){
				XQ[i] = Q[i];
			}
			else{
				XQ[i] = XQ[i-1];
			}
		}
	}
	for(int i=N; i>=1; i--){
		if(i == N){
			XR[i] = R[i];
			XS[i] = S[i];
		}
		else{
			if(R[i] > XR[i+1]){
				XR[i] = R[i];
			}
			else{
				XR[i] = XR[i+1];
			}
			if(S[i] > XS[i+1]){
				XS[i] = S[i];
			}
			else{
				XS[i] = XS[i+1];
			}
		}
	}

	eg = 0;
	for(int i=1; i<=N; i++){
		eg = XQ[i] + XR[i+1];
		if(ans3 < eg){
			ans3 = eg;
		}
	}

	eg = 0;
	for(int i=1; i<=N; i++){
		eg = XS[i+1] + XP[i];
		if(ans4 < eg){
			ans4 = eg;
		}
	}
	LL ans = max(max(max(ans1, ans2), ans3), ans4);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 18748
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
    string s,ts,tsl,tsr;
    cin>>s;
    int l=s.length();
    string sl="";
    string sr="";
    for(int i=0;i<l/2;i++)
        sl+=s[i];
    for(int i=l/2+1;i<l;i++)
        sr+=s[i];
    bool f =false;
    ts=s;
    tsl=sl;
    tsr=sr;
    reverse(s.begin(),s.end());
    reverse(sl.begin(),sl.end());
    reverse(sr.begin(),sr.end());
    if(s==ts){
        if(sl==tsl)
            if(sr==tsr)
                f=true;
    }
    if (f)
        cout<<"Yes";
    else
        cout<<"No";

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		long d = Long.parseLong(scan.next());
		int count = 0;

		long[] x = new long[n];
		long[] y = new long[n];

		for(int i=0;i<n;i++) {
			x[i] = Long.parseLong(scan.next());
			y[i] = Long.parseLong(scan.next());
			if((x[i] * x[i]) + (y[i] * y[i]) <= (d * d)) {
				count++;
			}
		}

		//プログラムはここに記入

		System.out.println(count);

		scan.close();
	}
}


Measured memory_bytes: 62316
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Long[] a = new Long[n];
        Long[] cumulativeSum = new Long[n];

        final long MOD = 1000000007L;
        a[0] = Long.parseLong(sc.next());
        cumulativeSum[0] = a[0];
        for (int i = 1; i < n; i++) {
            a[i] = Long.parseLong(sc.next());
            cumulativeSum[i] = a[i] + cumulativeSum[i - 1] % MOD;
        }
        sc.close();

        // 主処理
        long sum = 0;
        for (int i = 1; i < n; i++) {
            sum += cumulativeSum[i - 1] * a[i] % MOD;
            sum %= MOD;
        }
        long result = sum;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 69656
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1ll << 60;

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

string s, t;
int s_len, t_len;
int dp[3010][3010];

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

    cin >> s >> t;
    s_len = s.length();
    t_len = t.length();

    memset(dp, 0, sizeof(dp));

    rep(i, 0, s_len) rep(j, 0, t_len) {
        if(s[i] == t[j]) {
            chmax(dp[i + 1][j + 1], dp[i][j] + 1);
        } else {
            chmax(dp[i + 1][j + 1], max(dp[i + 1][j], dp[i][j + 1]));
        }
    }

    int i = s_len, j = t_len;
    string rsl = "";
    while(i > 0 and j > 0) {
        if(dp[i][j] == dp[i - 1][j]) i--;
        else if(dp[i][j] == dp[i][j - 1]) j--;
        else {
            rsl = s[i - 1] + rsl;
            i--; j--;
        }
    }

    cout << rsl << endl;


}


Measured memory_bytes: 35712
# Binary Indexed Tree (Fenwick Tree)
class BIT:
  def __init__(self, n):
    self.n = n
    self.bit = [0]*(n+1)
    self.el = [0]*(n+1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.bit[i]
      i -= i & -i
    return s
  def add(self, i, x):
    # assert i > 0
    self.el[i] += x
    while i <= self.n:
      self.bit[i] += x
      i += i & -i
  def get(self, i, j=None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i-1)
  def lower_bound(self,x):
    w = i = 0
    k = 1<<((self.n).bit_length())
    while k:
      if i+k <= self.n and w + self.bit[i+k] < x:
        w += self.bit[i+k]
        i += k
      k >>= 1
    return i+1

def solve():
  N, Q = map(int, input().split())
  C = list(map(int, input().split()))
  lis = [-1]*(N+1) #各色が最後に出た位置
  bit = BIT(N) #良い玉の位置
  ans = [0]*Q
  A = [list(map(int, input().split()))+[i] for i in range(Q)]
  A.sort(key=lambda x:x[1])
  now = 0
  for l,r,ind in A:
    for i in range(now,r):
      if lis[C[i]]>=0:
        bit.add(lis[C[i]]+1,-1)
      lis[C[i]] = i
      bit.add(i+1,1)
    ans[ind] = bit.get(l,r)
    now = r
  return ans
print(*solve(),sep='\n')

Measured memory_bytes: 228328
#include <stdio.h>
int main(void){
    int H,W,i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0)break;
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
            if(((j+1)%2 == 1 && (i+1)%2 == 0 ) || ((j+1)%2 == 0 && (i+1)%2 == 1)){
            printf(".");
            }
        else{
            printf("#");
            }
            }
        printf("\n");
        }
    printf("\n");
    }
    return 0;
}


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

#define ll long long

void solve() {
	int years;
	ll final_amt, balance = 100;

	cin >> final_amt;

	for (years = 0; balance < final_amt; years++) {
		balance += (balance / 100);
	}

	cout << years << endl;
}

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

Measured memory_bytes: 3632
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars,
        t: chars,
    }
    let mut s = s;
    let mut t = t;
    s.sort();
    let s: String = s.into_iter().collect();
    t.sort();
    t.reverse();
    let t: String = t.into_iter().collect();
    if s < t {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;
    ll n;
    cin>>n;
    cout<<n*n*n<<endl;
    
    return 0;
}

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

using namespace std;

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

  string s;
  cin >> s;
  int i = 0;
  int j = s.size()-1;
  while (s[i] != 'A') ++i;
  while (s[j] != 'Z') --j;
  cout << j-i+1 << endl;

  return 0;
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int n;
  cin >> n;
  vector<pair<int,int>> a;
  rep(i,n) {
    int x;
    cin >> x;
    a.push_back(make_pair(x,i));
  }
  sort(a.begin(),a.end());
  rep(j,n) {
    cout << a.at(j).second+1 << " ";
  }
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+5;
const ll mod=1e9+7;
ll qp(ll t1,ll t2) { ll s=1;for (;t2;t1=t1*t1%mod,t2>>=1) if (t2&1) s=s*t1%mod; return s;}
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
ll p[maxn];
int a[maxn];
int b[maxn];
ll dp[maxn];
int main()
{
    int n;

    n=read();

    for (int q=1;q<=n;q++)
    a[q]=read();

    int tot=1;
    for (int q=1;q<=n;q++)
    {
        if( a[q]!=a[q-1])
        {
            b[tot++]=a[q];
        }
    }

    dp[0]=1;
    int x;
    memset(p,0,sizeof p);
    for (int q=1;q<tot;q++)
    {
        dp[q]=dp[q-1];
        x=b[q];
        if (p[x]==0)
        p[x]=dp[q-1];
        else 
        {
            dp[q]+=p[x];
            p[x]+=dp[q-1];
            dp[q]%=mod;
            p[x]%=mod;
        }
    }

    printf("%lld\n",dp[tot-1]);
  

    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
using namespace std;
#define ll long long

int main() {
  ll N, x;
  cin >> N >> x;

  ll a[N];
  for(ll i=0; i<N; ++i) cin >> a[i];

  ll dp[N][N], sum[N];
  for(ll j=0; j<N; ++j) sum[j]=0;

  for(ll i=0; i<N; ++i) dp[i][0] = a[i];

  for(ll j=1; j<N; ++j) {
    for(ll i=0; i<N; ++i){
      if (dp[i][j-1]<dp[(i-1+N)%N][j-1]) {
        dp[i][j] = dp[i][j-1];
      }else{
        dp[i][j] = dp[(i-1+N)%N][j-1];
      }
    }
  }

  for(ll i=0; i<N; ++i) for(ll j=0; j<N; ++j) sum[j]+=dp[i][j];

  ll min=sum[0];
  for(ll j=1; j<N; ++j) { if(min>sum[j]+x*j) min=sum[j]+x*j; }

  cout << min << endl;

  return 0;
}

Measured memory_bytes: 31488
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<int, int>p;
struct edge { int to, cost; };
std::vector<edge>v[1000];
typedef std::vector<std::vector<int>>ma;
ma d;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
bool f = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";

int main() {
	int a, b, ans = 0;
	std::cin >> a >> b;
	for (int i = a;i <= b;i++) {
		std::string s = std::to_string(i);
		if (s[0] == s[4] && s[1] == s[3])ans++;
	}
	std::cout << ans << std::endl;
	}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	x := make([]float64, n)
	y := make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i], &y[i])
	}

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = i
	}
	perms := permutations(a)

	var sum float64 = 0
	for _, p := range perms {
		for i := 1; i < n; i++ {
			x1, x2 := x[p[i-1]], x[p[i]]
			y1, y2 := y[p[i-1]], y[p[i]]
			d := math.Sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
			sum += d
		}
	}

	ans := sum / float64(len(perms))
	fmt.Println(ans)
}

// https://stackoverflow.com/questions/30226438/generate-all-permutations-in-go
func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

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

    int r = 0;
    if (S[0] == 'R' || S[1] == 'R' || S[2] == 'R') {
        if (S[0] == 'R' && S[1] == 'R' && S[2] == 'R') {
            r = 3;
        } else if ((S[0] == 'R' && S[1] == 'R') || (S[1] == 'R' && S[2] == 'R')) {
            r = 2;
        } else {
            r = 1;
        }
    } else {
        r = 0;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<int> a(4), b(4);
        for(int i=0; i<4; ++i)
            if(!(cin >> a[i]))
                return 0;
        for(int i=0; i<4; ++i)
            cin >> b[i];

        int ret = 0;
        for(int i=0; i<4; ++i)
            if(a[i] == b[i])
                ++ ret;
        cout << ret << ' ';

        sort(a.begin(), a.end());
        sort(b.begin(), b.end());
        ret = -ret;
        int i=0, j=0;
        while(i < 4 && j < 4){
            if(a[i] < b[j])
                ++ i;
            else if(a[i] > b[j])
                ++ j;
            else{
                ++ ret;
                ++ i;
                ++ j;
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#include <algorithm>
#include<math.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

#define pb(a) push_back(a)
#define mp(a , b) make_pair((a) , (b))
#define fore(i,a,b) for(int  i = (int)(a) ; i < (int)(b) ; ++i)
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main(){
	FIN;
	int n;
	cin>>n;
	int a[n],b[n];
	b[0] = 0;
	fore(i,0,n)
		cin>>a[i];
	for(int i=n-1; i>=0; i--){
		b[0] += pow(-1,i)*a[i];
	}
	for(int i=1; i<n; i++){
		b[i] = 2*a[i-1] - b[i-1];
	}
	fore(i,0,n)
		cout<<b[i]<<" ";
	return 0;
}

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

int main(){
    string a, b;
    cin >> a >> b;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());
    if(a < b)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3604
N, K = gets.split.map(&:to_i)
S = gets.chomp

b = true
count = 0

nums = []
for f in S.chars.map{|c| c == '1'} do
    if f == b then
        count += 1
    else
        nums.push(count)
        count = 1
        b = !b
    end
end
nums.push(count)

tmp = 0
Nums = (nums + [0]*(2*K + 1)).zip([0]*(2*K + 1) + nums).map{|i, j| tmp += i - j}

p [*0...Nums.size].select(&:even?).map{|i| Nums[i]}.max


Measured memory_bytes: 27344
#include <cstdio>
#include <map>

using std::map;

map<int,int> mp;

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1,a;i<=n;++i){
		scanf("%d",&a);
		++mp[a];
	}
	int ans=0;
	for(map<int,int>::iterator i=mp.begin();i!=mp.end();){
		if(i->first!=i->second){
			if(i->first>i->second)
				ans+=i->second;
			else ans+=i->second-i->first;
			mp.erase(i++);
		}
		else ++i;
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void dfs(int cur, int pre, vector<pair<ll, ll>> &dp, const Graph &G) {
    for (int nx : G[cur]) {
        if (nx == pre) continue;
        dfs(nx, cur, dp, G);
        (dp[cur].first *= dp[nx].first + dp[nx].second) %= MOD;
        (dp[cur].second *= dp[nx].first) %= MOD;
    }
}

void solve() {
    int N;
    cin >> N;
    Graph G(N);
    for (int i=0; i<N-1; ++i) {
        int x, y;
        cin >> x >> y;
        G[x-1].push_back(y-1);
        G[y-1].push_back(x-1);
    }

    vector<pair<ll, ll>> dp(N, make_pair(1, 1));
    dfs(0, -1, dp, G);
    cout << (dp[0].first + dp[0].second) % MOD << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 18396
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val p = Array.fill[Int](n)(sc.nextInt)

    var count = 0
    p.sliding(3).foreach(a => {
      if (a.min != a(1) && a.max != a(1)) {
        count += 1
      }
    })

    println(count)
  }
}

Measured memory_bytes: 27444
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A[3][3];
	bool B[3][3] = {};
	int N;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) 
		    cin >> A[i][j];
	}
	cin >> N;
	for (int i = 0; i < N; i++) {
		int X;
		cin >> X;
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (A[j][k] == X) B[j][k] = true;
			}
		}
	}
	for (int i = 0; i < 3; i++) {
		if (B[i][0] && B[i][1] && B[i][2]) {
			cout << "Yes" << endl;
			return 0;
		}
		if (B[0][i] && B[1][i] && B[2][i]) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	if (B[0][0] && B[1][1] && B[2][2]) {
		cout << "Yes" << endl;
		return 0;
	}
	if (B[0][2] && B[1][1] && B[2][0]) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int k = sc.nextInt();
    
    if (n % k == 0) {
      System.out.println(0);
    } else {
      System.out.println(1);
    }
  }
}

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

int N, A;
vector<int> x, y;
ll dp[55][5055];

int main() {
    cin >> N >> A; x.resize(N); y.resize(N);
    for (int i = 0; i < N; i++) scanf("%d", &x[i]);
    for (int i = 0; i < N; i++) y[i] = x[i] - A;
    dp[0][2500] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= 5000; j++) {
            dp[i+1][j] += dp[i][j];
            dp[i+1][j+y[i]] += dp[i][j];
        }
    }
    cout << dp[N][2500] - 1 << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

void out(){cout << "\n";}
template<class T,class... Args>
void out(const T &x,const Args &... args){
	cout << x << " ";
	out(args...);
}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	string s;
	vs ans;
	while(cin>>s && s!="-"){
		ll m,sum=0,x;
		cin >> m;
		rep(i,m){
			cin >> x;
			sum+=x;
		}
		sum%=s.size();
		string t="";
		for(ll i=sum;i<(ll)s.size();i++) t+=s[i];
		for(ll i=0;i<sum;i++) t+=s[i];
		ans.pb(t);
	}
	for(auto&& e:ans) cout << e << endl;
	return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  while(cin>>n,n) {
    int res = 0;
    for (int i= 1;i<n/2+1;++i) {
      int sum = 0;
      REP(j,n) {
        sum += i+j;
        if (sum == n)
          res++;
        if (sum>=n)
          break;
      }
    }
    cout <<res << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1e9 + 7

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

    string s;

    cin >> s;

    int l = 0,r = s.length()-1;

    while(l<=r)
    {
        if(s[l]!=s[r]){ cout << "No"; return 0; }
        l++;
        r--;
    }

    cout << "Yes";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{
	int to,cap,cost,rev;
};
typedef vector<edge> ve;
typedef vector<ve> vve;
class MCF{	//Minimum Cost Flow
	public:
	int n;
	vve G;
	vi h,dist,prev,pree;
	MCF(int size){
		n=size;
		G=vve(n);
		h=dist=prev=pree=vi(n);
	}
	void add_edge(int s,int t,int ca,int co){
		edge e={t,ca,co,G[t].size()};
		G[s].pb(e);
		edge ee={s,0,-co,G[s].size()-1};
		G[t].pb(ee);
	}
	int mcf(int s,int t,int f){
		int out=0;
		h=vi(n);
		while(f>0){			
			priority_queue<pii,vector<pii> >q;
			dist=vi(n,inf);
			dist[s]=0;
			q.push(pii(0,s));
			while(!q.empty()){
				pii p=q.top();q.pop();
				int v=p.second;
				if(dist[v]<-p.first)continue;
				rep(i,G[v].size()){
					edge &e=G[v][i];
					if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
						dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
						prev[e.to]=v;
						pree[e.to]=i;
						q.push(pii(-dist[e.to],e.to));
					}
				}
			}
			if(dist[t]==inf)return -1;
			rep(i,n)h[i]+=dist[i];
			int d=f;
			for(int v=t;v!=s;v=prev[v])d=min(d,G[prev[v]][pree[v]].cap);
			f-=d;
			out+=d*h[t];
			for(int v=t;v!=s;v=prev[v]){
				edge &e=G[prev[v]][pree[v]];
				e.cap-=d;
				G[v][e.rev].cap+=d;
			}
		}
		return out;	
	}
};
signed main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	MCF mcf(n*2+2);
	int s=n*2,t=s+1;
	rep(i,n)mcf.add_edge(s,i,1,0);
	rep(i,n)mcf.add_edge(n+i,t,1,0);
	vi T(n);
	rep(i,n)T[in[i]-1]=i;
	rep(i,n){
		if(i!=in[i]-1){
			mcf.add_edge(T[i],n+i,1,0);
//			cout<<T[i]<<" "<<n+i<<endl;
		}
		rep(j,n)if(i!=j){
//			cout<<j<<" "<<i<<" "<<abs(T[i]-j)*(1+i)<<endl;
			mcf.add_edge(j,n+i,1,abs(T[i]-j)*(1+i));
		}
	}
	cout<<mcf.mcf(s,t,n)<<endl;
}

Measured memory_bytes: 3536