akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  rep(i, N) cin >> a[i];

  vector<ll> sum(N + 1, 0), psum(N + 1, 0);
  rep(i, N) {
    sum[i + 1] = sum[i] + a[i];
    psum[i + 1] = psum[i] + (a[i] > 0 ? a[i] : 0);
  }

  ll ans = 0;
  REP(i, K, N + 1)
  ans = max({ans, sum[i] - sum[i - K] + psum[i - K] + psum[N] - psum[i],
             psum[i - K] + psum[N] - psum[i]});

  cout << ans << endl;
}


Measured memory_bytes: 2176
import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

A,B,C,D = read_int()
Max = max(A,B,C,D)

Alice = [True if i >= A and i < B  else False for i in range(Max)]
Bob = [True if i >= C and i < D  else False for i in range(Max)]
Overlap = [True if Alice[i] and Bob[i] else False for i in range(Max)]

sec = 0
for o in Overlap:
    if o:
        sec += 1

print(sec)


Measured memory_bytes: 3064
abcd = input()
for op1 in ["+","-"]:
    for op2 in ["+","-"]:
        for op3 in ["+","-"]:
            s = abcd[0]+op1+abcd[1]+op2+abcd[2]+op3+abcd[3]
            if eval(s)==7:
                print(s+"=7")
                exit()

Measured memory_bytes: 3060
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long int ll;
//typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define MAX ((ll)1<<(ll)31)-1



int main(void) {
	char a;
	cin >> a;
	cout << (char)(a + 1) << endl;
	return 0;
}

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

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

int main( void ) {
    int n;
    cin >> n;
    vector<int> a( n );
    for( int i = 0; i < n; i++ ) cin >> a.at( i );
    for( int i = n - 1; i >= 0; i-- ) {
        if( i > 0 )
            cout << a.at( i ) << " ";
        else
            cout << a.at( i ) << endl;
    }
    return 0;
}



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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}
int disum(int n) {
	int sum = 0;

	while (n) {

		sum += n % 10;
		// sum++;
		n /= 10;





	}
	return sum;

}


// #define maxa 1000000










int main() {
	int i, n, m, k, c1 = 0, sum = 0;
	c_p_c();
	// w(t){

	string s;
	cin>>s;


	string s1="",s2="";





	for (int i = 0; i < s.size(); ++i)
	{
		/* code */
		s1+=s[0];
	}

	for (int i = 0; i < s.size(); ++i)
	{
		/* code */
		s2+=(s[0]+1);
	}


	if(s1>=s)
		cout<<s1<<endl;
	else
		cout<<s2<<endl;

	// debug(s1,s2);

	return 0;


}


// 3
// 2
// 3
// 4
// 2
// 3
// 4
// 2
// 3

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/






int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  LL a, v; cin >> a >> v;
  LL b, w; cin >> b >> w;
  LL t; cin >> t;
  LL d = abs(a-b);
  if (w >= v) {
    cout << "NO\n";
    return 0;
  }
  LL ret = d / (v-w);
  if (d % (v-w) != 0) ret++;
  if (ret <= t) cout << "YES\n";
  else cout << "NO\n";






/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 3104
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

class BBounding {
public:
void solve(std::istream& cin, std::ostream& cout) {
    int N, X;
    cin >> N >> X;
    int i = 0;
    _for(i,N){
        int t;
        cin >> t;
        X -= t;
        if(X<0){
            cout << i+1 << endl;
            return;
        }
    }
    cout << N + 1<< endl;
//    cout << (X < 0 ? N-1 : N ) <<  endl;
}
};


#undef int
int main() {
	BBounding solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  string s;cin>>s;
  int check[30]={0};
  for(int t=0;t<s.size();t++){
    int temp=s[t]-'a';
    check[temp]++;
  }

  for(int t=0;t<26;t++){
    if(check[t]>1){
      cout<<"no"<<"\n";
      return 0;
    }
  }

  cout<<"yes"<<"\n";
  return 0;
}


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

const int unit = -1; //単位元 a * e = a

int func(int a, int b) {
    if (a == unit) return b;
    else if (b == unit) return a;
    else return __gcd(a, b);
}

class SegmentTree {
public:
    int N; //要素数
    vector<int> dat;

    SegmentTree(int n_) {
        N = 1;
        while (N < n_) N *= 2;
        dat.assign(2 * N - 1, unit);
    }

    void update(int k, int a) { //k番目(0-indexed)をaに変更
        k += N - 1; //一番下
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2; //1つ上がる
            //更新
            dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]); //
        }
    }

    //[a, b)の値（最小値/和/etc.）を求める
    //kは節点の番号、l, rはその節点が[l,r)に対応づいていることを表す
    //外からはquery(a, b)と呼ぶ

    int query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;
        if (r <= a || b <= l) return unit;
        //[a, b)が[l,r)を完全に含む
        if (a <= l && r <= b) return dat[k];
        else {
            int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return func(vl, vr); //
        }
    }
};

main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    SegmentTree sg(n);

    rep(i, n) {
        int a;
        cin >> a;
        sg.update(i, a);
    }
    int ans = 1;

    rep(i, n) {
        int l = sg.query(0, i);
        int r = sg.query(i + 1, n);
        ans = max(ans, func(l, r));
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1280
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut s = std::collections::BTreeMap::new();
    let mut res = 0i64;
    for i in 0..n {
        res += *s.get(&(a[i] - i as i64)).unwrap_or(&0);
        *s.entry(-a[i] - (i as i64)).or_insert(0) += 1;
    }
    println!("{}", res);
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int min = 1000;
            for(int i = 0;i < s.Length - 2; i++)
            {
                string temp = s.Substring(i, 3);
                int b = Math.Abs(int.Parse(temp) - 753);
                min = (min < b) ? min : b;
            }
            Console.WriteLine(min);

        }
    }
}


Measured memory_bytes: 11092
package main

import (
	"fmt"
	"strings"
)

func main() {
	var t string
	fmt.Scanf("%s", &t)
	answer := pdQuotient(t)
	fmt.Println(answer)
}

func pdQuotient(t string) string {
	t = strings.ReplaceAll(t, "?", "D")
	return t
}

Measured memory_bytes: 3884
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
#define int long long
using namespace std;
const int maxn=300005,mod=1e9+7;
int n,tong0,tong1,ans,mi[maxn],a[maxn];
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
		if(ch=='-')
			f=-1;
		ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
    }
    return x*f;
}
inline void write(int a)
{
    if(a<0)
    {
		char a='-',b='1';
		putchar(a);
		putchar(b);
    }
    else
    {
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
    }
}

signed main()
{
    n=read();
	mi[0]=1;
	for(int i=1;i<=62;++i)
		mi[i]=mi[i-1]*2%mod;
	for(int i=1;i<=n;++i)
		a[i]=read();
	for(int i=0;i<=62;++i)
	{
		tong1=tong0=0;
		for(int j=1;j<=n;++j)
		{
			if(a[j]&1)
			{
				ans=(ans+tong0*mi[i]%mod)%mod;
				++tong1;
			}
			else
			{
				ans=(ans+tong1*mi[i]%mod)%mod;
				++tong0;
			}
			a[j]>>=1;
		}
	}
//	cout<<tong1[0]<<' '<<tong1[1]<<' '<<tong0[0]<<' '<<tong0[1]<<endl;
	write(ans);
    return 0;
}


Measured memory_bytes: 4352
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int N;
	cin >> N;

	long long int* A = new long long int[N];
	for (int i = 0; i < N ; i++)
	{
		cin >> A[i];
	}

	long long int total = 0;
	long long int max = A[0];

	for (int i = 1; i < N; i++)
	{
		if (A[i] > max)
		{
			max = A[i];
		} 
		else if(A[i] < max)		
		{
			total += max - A[i];
		}
	}

	cout << total;
}

Measured memory_bytes: 5200
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int k, s;
  cin >> k >> s;
  
  ll ans = 0;
  for(int i = 0; i <= k; i++) {
    for(int j = 0; j <= k; j++){
      if(i + j >= s - k && i + j <= s){
        ans++;
        //cout << i << " " << j << " " <<  s - i - j << endl;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int n;cin>>n;
    map<int,int>m;
    for(int i=1;i<n+1;++i)
        m[i]=0;
    
    for(int i=2;i<n+1;++i){
        int t; cin>>t;
        m[t]=m[t]+1;
    }
    
    for(auto [k,v]:m)
        cout<<v<<endl;
    
    return 0;
}



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

class Main {

	void solve() {
		
		int a = inint(), b = inint(), c = inint();
		if (a+b==c || a+c==b || b+c==a) out.println("Yes");
		else out.println("No");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REPR(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define FOR(i, x, n) for (int i = x; i < (int)(n); ++i)
#define ALL(n) begin(n), end(n)
#define ll long long
#define INF 1e9
int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    if (s.size() <= n)
        cout << s;
    else {
        cout << s.replace(n, s.size(), "...");
    }

    return 0;
}

Measured memory_bytes: 3568
s=int(input())
if s<=1000000000:
    print('0 0'+' '+str(s)+' 0 '+str(s)+' 1')
elif s!=10**18:
    k=s%1000000000
    S=1000000000-k
    T=s-k
    ans=['0','0',str(T//1000000000+1),'1',str(S),'1000000000']
    print(' '.join(ans))
else:
    ans=['0','0','1000000000','0','0','1000000000']
    print(' '.join(ans))

Measured memory_bytes: 3064
// {{{ include and macros
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(a, b) for(int unsafe_cnt=a; unsafe_cnt < b;unsafe_cnt++)
#include <iostream>
// #include <stdio.h>
// #include <vector>
// #include <math.h>
#include <algorithm>
#include <string>
// #include <map>
#include <set>
using namespace std;
// }}}

// {{{ put
void newline() {cout << endl;}
template <typename T> void display(T input){cout << input;}
template <typename T> void put(T input){display(input); newline();}
// }}}

pair<string, string> split_n(const string str, const int i){
  string a, b;
  for(int l=0; l<str.size(); l++){
    if(i>l){
      a.push_back(str[l]);
    }else{
      b.push_back(str[l]);
    }
  }
  return make_pair(a, b);
}

set<string> train_pattern(const string x, const string y, set<string> ret){
  string xr = x;
  string yr = y;
  reverse(xr.begin(), xr.end());
  reverse(yr.begin(), yr.end());
  string a = x  + y;
  string b = xr + y;
  string c = x  + yr;
  string d = xr + yr;
  string e = y  + x;
  string f = y  + xr;
  string g = yr + x;
  string h = yr + xr;
  ret.insert(a);
  ret.insert(b);
  ret.insert(c);
  ret.insert(d);
  ret.insert(e);
  ret.insert(f);
  ret.insert(g);
  ret.insert(h);
  return ret;
}

int main() {
  int input;
  cin >> input;
  for(int unsafe_i=0; unsafe_i<input; unsafe_i++){
    string str;
    cin >> str;
    set<string> ret;
    for(int l=1; l<str.size(); l++){
      pair<string, string> p = split_n(str, l);
      ret = train_pattern(p.first, p.second, ret);
    }
    put(ret.size());
  }
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
int main(void){
    int n;
    cin>>n;
    int L[10];
    for(int i=0;i<n;i++) cin>>L[i];
    int sum=0;
    sort(L,L+n);
    for(int i=0;i<n-1;i++) sum+=L[i];
    if(sum>L[n-1]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main(){
  int N;
  cin >> N;
  long A[N];
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  long Sum[N];
  Sum[N - 1] = A[N - 1];
  for(int i = N - 2; i > 0; i--){
    Sum[i] = (Sum[i + 1] + A[i]) % (int(pow(10, 9)) + 7);
  }
  long ans = 0;
  for(int i = 0; i < N - 1; i++){
    ans += (A[i] * Sum[i + 1]) % (int(pow(10, 9)) + 7);
    ans %= (int(pow(10, 9)) + 7);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 4010;
int con[3][3][3 * maxn];
int ans = 4 * maxn;
void calc (string a, string b, string c) {
    vector<string> vec;
    vec.pb(a);
    vec.pb(b);
    vec.pb(c);
    for (int d = 0; d < 3; d++) {
        for (int i = 0; i < 3; i++) {
            if (d != i) {
                for (int j = 0; j <= vec[d].size() + vec[i].size(); j++) {
                    con[d][i][j] = 0;
                    bool check = 1;
                    int tk = vec[i].size() - 1;
                    int g = j - 1;
                    while (tk >= 0 && g >= vec[d].size()) {
                        tk--;
                        g--;
                    }
                    for (; g >= 0 && tk >= 0; g--) {
                        if (vec[d][g] != vec[i][tk] && vec[d][g] != '?' && vec[i][tk] != '?') {
                            check = 0;
                            break;
                        }
                        tk--;
                    }
                    if (check) {
                        con[d][i][j] = 1;
                        //cout << d << " " << i << " " << j << "\n";
                    }
                }
            }
        }
    }
    //cout << "\n";
    for (int i = 0; i <= vec[0].size() + vec[1].size() + vec[2].size() + 2; i++) {
        for (int j = 0; j <= vec[0].size() + vec[1].size() + vec[2].size() + 2; j++) {
            if (i <= vec[0].size() + vec[1].size() && !con[0][1][i]) {
                continue;
            }
            if (j <= vec[0].size() + vec[2].size() && !con[0][2][j]) {
                continue;
            }
            if (j >= i) {
                if (i + vec[2].size() >= j && !con[2][1][i - (j - vec[2].size())]) {
                    continue;
                }
            } else {
                if (j + vec[1].size() >= i && !con[1][2][j - (i - vec[1].size())]) {
                    continue;
                }
            }
//            if (j == 3 && i == 3) {
//                cout << "here\n";
//            }
            int sz0 = vec[0].size(), sz1 = vec[1].size(), sz2 = vec[2].size();
            int l = min(0, min(i - sz1, j - sz2));
            int r = max(sz0, max(i, j));
            // cout << i << " " << j << " " << l << " " << r << "\n";
            ans = min(ans, r - l);
        }
    }
}
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    vector<string> vec;
    string a, b, c;
    cin >> a >> b >> c;
    calc(a, b, c);
    calc(b, a, c);
    calc(c, b, a);
    cout << ans;
}
/*
brac
abracad
cad
*/


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

int main() {
    int N, M;
    cin >> N >> M;

    if (abs(N - M) >= 2) {
        cout << 0 << endl;
        return 0;
    }

    const ll MOD = 1000000007;
    const ll MAX = 100005;

    vl fac(MAX);
    fac[0] = 1;
    fac[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = i * fac[i - 1] % MOD;
    }

    ll x = (fac[N] * fac[M]) % MOD;
    if (x < 0) x += MOD;
    if (N == M) {
        // N! * M! * 2
        ll y = (x * 2) % MOD;
        if (y < 0) y += MOD;
        cout << y << endl;
    } else {
        // N! * M!
        cout << x << endl;
    }
}

Measured memory_bytes: 4040
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <bitset>

#define FOR(i, a, b) for(int i = (int)a; i < (int)b; ++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
template <class T, class U> void CHMAX(T & a, const U & b) { if (a < b) a = b; }
template <class T, class U> void CHMIN(T& a, const U& b) { if (a > b) a = b; }

constexpr int INF = (1 << 30) - 1;

int dp[1 << 15];
int cost[1 << 15];

signed main() {
	int n, m;
	while (std::cin >> n >> m, n || m) {
		std::vector<int> s(n), d(m);
		REP(i, n) std::cin >> s[i];
		REP(i, m) std::cin >> d[i];
		std::sort(ALL(d));

		{ // cost
			REP(i, n) cost[1 << i] = s[i];
			REP(bit, 1 << n) REP(i, n) {
				if (bit & 1 << i) continue;
				cost[bit | 1 << i] = cost[bit] + cost[1 << i];
			}
		}

		REP(i, 1 << n) dp[i] = INF;
		dp[0] = 0;
		REP(bit, 1 << n) REP(i, n) {
			if (bit & 1 << n) continue;
			int pre = cost[bit];
			int cur = cost[bit | 1 << i];
			int t = dp[bit];
			REP(j, m) {
				if (pre < d[j] && d[j] <= cur) t += std::min(d[j] - pre, cur - d[j]);
			}
			CHMIN(dp[bit | 1 << i], t);
		}
		int ans = dp[(1 << n) - 1];
		REP(j, m) {
			if (cost[(1 << n) - 1] < d[j]) ans += d[j] - cost[(1 << n) - 1];
		}
		std::cout << ans << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3404
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
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")
    };
}

// ここまで

use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    input! {
        n: usize,
        m: usize,
        a: [(usize, u32); m],
    }
    let mut b = Vec::with_capacity(m);
    for (i, a) in a.iter().enumerate() {
        b.push((a.1, a.0, i));
    }
    b.sort();
    let mut cnt = vec![0; n + 1];
    let mut ans = Vec::with_capacity(n);
    for (_, p, i) in b {
        cnt[p] += 1;
        ans.push((i, p, cnt[p]));
    }
    ans.sort();
    for (_, p, x) in ans {
        writeln!(out, "{:06}{:06}", p, x).unwrap();
    }
}

fn main() {
    run();
}


Measured memory_bytes: 21752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

int main(){
    string s;cin>>s;
    ll n=s.size();
    ll ans[n];memset(ans,0,sizeof(ans));
    ll c=0;
    rep(i,0,n-1){
        if(s[i]=='R')c++;
        else{
            ans[i-1]+=(c+1)/2;
            ans[i]+=c/2;
            c=0;
        }
    }
    c=0;
    for(ll i=n-1;i>=0;i--){
        if(s[i]=='L')c++;
        else{
            ans[i+1]+=(c+1)/2;
            ans[i]+=c/2;
            c=0;
        }
    }
    rep(i,0,n-1)cout<<ans[i]<< " ";
    
    return 0;
}

















Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N;
  cin>>N;
  int A[N-1]={},B[N-1]={};
  rep(i,N-1) cin>>A[i]>>B[i];
  int C[N]={};
  rep(i,N) cin>>C[i];
  sort(C,C+N);
  int Y[N]={},U[N]={};
  Y[A[0]-1]=C[N-1];
  U[A[0]-1]++;
  rep(i,N){
    if(i){
      rep(j,N){
        if(U[A[j]-1]==0&&U[B[j]-1]){
          Y[A[j]-1]=C[N-1-i];
          U[A[j]-1]++;
          break;
        }else if(U[A[j]-1]&&U[B[j]-1]==0){
          Y[B[j]-1]=C[N-1-i];
          U[B[j]-1]++;
          break;
        }
      }
    }
  }
  ll ans=0;
  rep(i,N-1) ans+=C[i];
  cout<<ans<<endl;
  rep(i,N) cout<<Y[i]<<endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#define LL long long
using namespace std;

const int MAXN=200000+5;

int n,s[MAXN];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&s[i]);
	LL ans=0;
	for(int l=1,r=0,sum=0,Xor=0;l<=n;++l){
		while(sum==Xor && r<=n){
			r++;
			sum+=s[r];
			Xor^=s[r];
		}
		ans+=(r-l);
		sum-=s[l];
		Xor^=s[l];
	}
	printf("%lld",ans);
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll 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) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string w; cin >> w;
  map<char, int> mp;
  for(auto c : w) ++mp[c];
  for(auto x : mp) {
    if(x.second % 2 == 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-                                                                              

n = int(input())

a = []
a_copy = []
for _ in range(n):
    tmp = int(input())
    a.append(tmp)
    a_copy.append(tmp)

a.sort(reverse=True)

for x in a_copy:
    if x == a[0]:
        print(a[1])
    else:
        print(a[0])

Measured memory_bytes: 14120
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	auto n = read.to!long;
	auto h = read.to!long;
	auto w = read.to!long;
	
	auto a = n - h + 1;
	auto b = n - w + 1;
	
	(a * b).writeln;
	
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

template<int N> void mat_prod(LL a[N][N], LL b[N][N], LL c[N][N], LL MOD) { // a = b * c;
	LL d[N][N];
	inc(i, N) {
	inc(j, N) {
		d[i][j] = 0;
	}
	}
	
	inc(i, N) {
	inc(j, N) {
	inc(k, N) {
		(d[i][j] += b[i][k] * c[k][j]) %= MOD;
	}
	}
	}
	
	inc(i, N) {
	inc(j, N) {
		a[i][j] = d[i][j];
	}
	}
	
	return;
}

template<int N> void mat_exp(LL a[N][N], LL b[N][N], LL c, LL MOD) { // a = b ^ c;
	LL t[60][N][N];
	inc(i, N) {
	inc(j, N) {
		t[0][i][j] = b[i][j];
	}
	}
	inc(i, 60 - 1) {
		mat_prod<N>(t[i + 1], t[i], t[i], MOD);
	}
	
	inc(i, N) {
	inc(j, N) {
		a[i][j] = 0;
	}
	}
	inc(i, N) { a[i][i] = 1; }
	inc(i, 60) {
		if((c >> i) % 2 == 1) {
			mat_prod<N>(a, a, t[i], MOD);
		}
	}
	
	return;
}

// ----

LL n, m, x[100002];
const LL MOD = 1000000007;

int main() {
	cin >> n >> m;
	inc1(i, m) { cin >> x[i]; }
	x[0] = 0;
	x[m + 1] = n + 1;
	
	LL a[3][3] = { { 2, 1, 1 }, { 2, 1, 0 }, { 1, 1, 1 } };
	LL b[3][3] = { { 1, 0, 0 }, { 2, 1, 0 }, { 1, 1, 1 } };
	LL c[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
	LL d[3][3];
	
	inc(i, m + 1) {
		if(i != 0) { mat_prod<3>(c, b, c, MOD); }
		mat_exp<3>(d, a, x[i + 1] - x[i] - 1, MOD);
		mat_prod<3>(c, d, c, MOD);
	}
	
	cout << c[2][0] << endl;
	
	return 0;
}


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

                                // using O(1) space and O(N) time , convert a string so as to replace all spaces with "%20"
    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846
    const int MOD=1e9+7;

    vector<string>s(100005);
    vector<char>ans;
    int n;
    void dfs(int i, int a , int b, int c){
//        cout<<a<<" "<<b<<" "<<c<<"\n";
        if(a<0 || b<0 || c<0)
            return;
        if(i==n){
            cout<<"Yes"<<"\n";
            for(auto c : ans)
                cout<<c<<"\n";
            exit(0);
        }
//        cout<<"in";
        if(s[i]=="AB"){
            ans.push_back('A');
            dfs(i+1,a+1,b-1,c);
            ans.pop_back();
            ans.push_back('B');
            dfs(i+1,a-1,b+1,c);
            ans.pop_back();
        }
        else if(s[i]=="BC"){
            ans.push_back('B');
            dfs(i+1,a,b+1,c-1);
            ans.pop_back();
            ans.push_back('C');
            dfs(i+1,a,b-1,c+1);
            ans.pop_back();
        }
        else if(s[i]=="AC"){
            ans.push_back('C');
            dfs(i+1,a-1,b,c+1);
            ans.pop_back();
            ans.push_back('A');
            dfs(i+1,a+1,b,c-1);
            ans.pop_back();
        }
        return;
    }

    void solve(){
        int a,b,c;
        cin>>n>>a>>b>>c;
        for(int i=0;i<n;i++)
            cin>>s[i];

        dfs(0,a,b,c);
        cout<<"No";
        return;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


Measured memory_bytes: 14472
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int>a,b;
	for (int i = 0; i < n; ++i) {
		int ai;
		cin >> ai;
		a.push_back(ai);
	}
	for (int i = 0; i < n; ++i) {
		int bi;
		cin >> bi;
		b.push_back(bi);
	}
	int64_t result = 0;
	for (int i = 29; i >=0; --i) {
		int dx = 1 << i;
		for (int j = 0; j < n; ++j) {
			a[j] %= (dx * 2);
			b[j] %= (dx * 2);
		}
		sort(b.begin(), b.end());
		int sum = 0;
		for (auto ai : a) {
			auto r1 = lower_bound(b.begin(), b.end(), dx - ai);
			auto r2 = lower_bound(b.begin(), b.end(), dx*2 - ai);
			auto r3 = lower_bound(b.begin(), b.end(), dx*3 - ai);
			auto r4 = lower_bound(b.begin(), b.end(), dx*4 - ai);
			int t1 = distance(r1, r2);
			int t2 = distance(r3, r4);
			sum += t1 + t2;
			sum%=2;
		}
		if(sum%2==1)
			result += (int64_t)dx;
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 2548
data Stats = Open | Close deriving(Show)

check :: String -> Stats
check x
  | x == "1 0 0" = Close
  | x == "0 1 0" = Close
  | x == "1 1 0" = Open
  | x == "0 0 1" = Open
  | otherwise    = Close

main :: IO()
main = do
  line <- getLine
  print $ check line

Measured memory_bytes: 3540
while True:
    H, W = map(int, input().split())
    if H ==0 and W == 0:
        break
    for i in range(H):
        a = ""
        for j in range(W):
            if (i % 2) == 0:
                if (j % 2) == 0:
                    a += "#"
                else:
                    a += "."
            else:
                if (j % 2) == 0:
                    a += "."
                else:
                    a += "#"
            
        print(a)
    print("")

Measured memory_bytes: 7624
//06
#include<iostream>

using namespace std;

int n;
int g[8][8];

bool dfs();

bool gr(int r,int y,int x){
  int t=g[y][x];
  r+=t;
  if(r>0){
    return false;
  }else{
    g[y][x]=0;
    bool e=false;
    if(r==0){
      e=dfs();
    }else{
      for(int i=0;i<4;i++){
	int d[]={0,1,0,-1,0};
	int nx=x+d[i];
	int ny=y+d[i+1];
	if(0<=nx&&nx<n&&0<=ny&&ny<n&&g[ny][nx]>0){
	  if(gr(r,ny,nx)){
	    e=true;
	    break;
	  }
	}
      }
    }
    g[y][x]=t;
    return e;
  }
}

bool dfs(){
  bool m=false;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      m|=g[i][j];
      if(g[i][j]<0){
	return gr(0,i,j);
      }
    }
  }
  return !m;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	cin>>g[i][j];
      }
    }
    cout<<(dfs()?"YES":"NO")<<endl;
  }
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i =0; i < N; i ++){
        cin >> X.at(i);
    }
    int min = INT_MAX;
    for(int i = 1; i < 100; i ++){
        int cnt = 0;
        for(int j = 0; j < N; j ++){
            cnt += (X.at(j) - i) * (X.at(j) - i);
        }
        min = (min >= cnt) ? cnt : min;
    }
    cout << min;

}

Measured memory_bytes: 256
#include<cstdio>

int main(){
  int a;
  int ans = 0;
  scanf("%d", &a);
  while(a>0){
    int r = a%10;
    if(r==7){
      ans = 1;
      break;
    }
    a /= 10;
  }
  if(ans == 0) printf("No");
  else printf("Yes");
  return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <bitset>
#include <limits.h>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//#define int long long

/*************** using variables ***************/
int n;
/**********************************************/

signed main(){
    cin >> n;
    cout << n/3 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _dbg(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _dbg(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_dbg(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=2e5+5,M=1e9+7;
int n,k,ans;
vector<int> g[N];
void dfs(int v,int p=-1,int sosedi=0){
    int mul=k-1-(v!=1);
    for(int to:g[v])
        if(to^p){
            dfs(to,v);
            (ans*=mul)%=M;
            mul--;
        }
}
int32_t main(){
    cin>>n>>k;
    ans=k;
    forn(i,n-1){
        int a,b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(1);
    cout<<ans<<'\n';

    return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define INF -1
#define ll long long
using namespace std;

int main()
{
	string str;
	int len;

	cin >> str;
	len = str.size();

	for (int i = 0; i < len; i++) {
		str[i] = 'x';
	}


	cout << str;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, x, a; cin >> x >> a;
	if (x < a) {
		cout << '0' << endl;
	}
	else {
		cout << "10" << endl;
	}
	cin >> n;
}

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

int main() {
    int n, t;
    cin >> n >> t;
    int ans = 1001001001;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        if (x < ans && y <= t) ans = x;
    }
    cout << (ans == 1001001001 ? "TLE" : to_string(ans)) << endl;
}


Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    S = input()
    S = S.replace('BC','Z')
    S = S.replace('B',' ')
    S = S.replace('C',' ')
    S = S[::-1]
    S = S.split()
    ret = 0
    for s in S:
        zcn = 0
        for si in s:
            zcn += (si == 'Z')
            ret += zcn * (si == 'A')
    print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 11240
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int s;
int n;
long long res;
 
int pascal[2005][2005];
 
void build() {
  pascal[0][0]=1;
  for(int i=1;i<=2000;i++) {
    pascal[i][0]=1;
  }
  for(int i=1;i<=2000;i++) {
    for(int j=1;j<=i;j++) {
      pascal[i][j]=(pascal[i-1][j]+pascal[i-1][j-1])%mod;
    }
  }
}
 
 
int main() {
  scanf("%d",&s);
  n=s/3;
  build();
  for(int i=1;i<=n;i++) {
    int f=s-i*3;
    f+=i;
    res=(res+pascal[f-1][i-1])%mod;
  }
  printf("%lld",res);
  return 0;
}

Measured memory_bytes: 17524
# -*- coding: utf-8 -*-
import math
n, d = map(int, input().split())

x = [list(map(int, input().split())) for _ in range(n)]

cnt = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        tmp = 0.0
        for k in range(d):
            tmp += pow((x[i][k] - x[j][k]), 2)

        tmp = math.sqrt(tmp)
        cnt += tmp.is_integer()

print(cnt)


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n;
string s;
bool ok = false;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') cnt++;
    }
    if (cnt > n - cnt) cout << "Yes\n";
    else cout << "No\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>

using int64 = long long;

using namespace std;

constexpr int MAX_N = 200000;
int64 dp[MAX_N + 1][3];

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

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

    constexpr int64 INF = (1LL << 60);

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j < 3; j++) {
            dp[i][j] = -INF;
        }
    }

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            if (j + 1 < 3) {
                dp[i + 1][j + 1] = std::max(dp[i + 1][j + 1], dp[i][j]);
            }
            int ni = std::min(N, i + 2);
            dp[ni][j] = std::max(dp[ni][j], dp[i][j] + A[i]);
        }
    }

    int64 ans;
    if (N % 2) {
        ans = std::max(dp[N][1], dp[N][2]);
    } else {
        ans = std::max(dp[N][0], dp[N][1]);
    }
    cout << ans << endl;

    return 0;
}



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

int main(void){
	string S, T;
	cin >> S >> T;
	int ans = T.size();
	rep(i,S.size()-T.size()+1) {
		string tmp = S.substr(i,T.size());
		int n = 0;
		rep(j,T.size()) if (T[j] != tmp[j]) n++;
		ans = min(ans,n);
	}
	
	cout << ans << endl;
return 0;
}


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

int N;

int main() {
  cin>>N;
  vector<int>B(N-1);
  for (int i = 0; i < N; i++)
    cin>>B[i];

  int sum = B[0];

  for (int i = 0; i < N-2; i++) {
    sum += min(B[i],B[i+1]);
  }

  sum += B[N-2];

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256