akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long 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*(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;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

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);
};
//fixed << setprecision(2)

//小文字=大文字+32

int main() {
	map<char, char>m;
	m['A'] = 'T';
	m['C'] = 'G';
	m['G'] = 'C';
	m['T'] = 'A';
	char b;
	cin >> b;
	cout << m[b];

}
	



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

using namespace std;

const int MAXN = 2e5 + 7;

int n, m;
int cnta[MAXN], cntb[MAXN];
vector <int> g[MAXN];
char c[MAXN];

void read() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i) cin >> c[i];
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
}

bool used[MAXN];
queue <int> q;

void relax(int u, int v) {
    if (c[u] == 'A') --cnta[v];
    else --cntb[v];
    if ((!cnta[v] || !cntb[v]) && !used[v]) {
        q.push(v);
        used[v] = 1;
    }
}

void solve() {
    for (int u = 0; u < n; ++u) {
        for (int v : g[u]) {
            if (c[v] == 'A') ++cnta[u];
            else ++cntb[u];
        }
        if (!cnta[u] || !cntb[u]) {
            q.push(u);
            used[u] = 1;
        }
    }

    int del = 0;
    while (q.size()) {
        ++del;
        int u = q.front();
        //cout << "del " << u << '\n';
        q.pop();
        for (int v : g[u]) {
            relax(u, v);
        }
    }

    if (del == n) cout << "No\n";
    else cout << "Yes\n";
}

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

    read();
    solve();

    return 0;
}

Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
map<int,int> mp;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,x;
    cin>>x>>n;
    for(int i=1;i<=n;i++){
        int y;
        cin>>y;
        mp[y] = 1;
    }
    int st = x;
    int en = x;
    for(int i=1;i<=n+n+12;i++){
        if(mp[st]==0){
            cout<<st<<endl;
            return 0;
        }
        if(mp[en]==0){
            cout<<en<<endl;
            return 0;
        }
        st--;
        en++;
    }
    return 0;
}

Measured memory_bytes: 3560
/*Author SHUBH AGRAWAL  */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
//a power n mod p

#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 

long long int modp(lld a,lld p,lld n)
{
    int d[100];
    int i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
    
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    lld fac[n+1]; 
    fac[0] = 1; 
    for (lld i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}


lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,y,d;

void solve()
{
    cin>>n>>k;
    ans=0;
    for(i=0;i<n;i++)
    {
        cin>>l;
        if(l>=k) ans+=1;
    }
    cout<<ans;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  int A[N+1]={}; rep(i,N) cin >> A[i];
  ll result = 0;
  rep(i,N+1) {
    // cout << i << " " << result << endl;
    if (i==0) {
      if (A[i]==0) continue;
      else { result = -1; break; }
    }
    if (A[i]-A[i-1]==1) continue;
    if (A[i-1]>=A[i]) { result += A[i-1]; continue; }
    result = -1; break;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
 
#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)

 
template <typename T>
inline vector<T> divisor( T n )
{
	vector<T> res;
	for( T i = 1; i * i <= n; ++i )
	{
		if( n % i == 0 )
		{
			res.push_back( i );
			if( i != n / i ) res.push_back( n / i );
		}
	}
	sort( ALL( res ) );
	return res;
}
 
template <typename T>
inline T gcd(T a, T b)
{
	if (a < b)
		swap(a, b);
	return b ? gcd(b, a % b) : a;
}
 
int main()
{
	ll n; cin >> n;
	vector<ll> s( n, 0 );
	REP(i,n) cin>>s[i];

	vector<vector<ll>> dp(n, vector<ll>());
	REP(i,n) if( i >= 1 )
	{
		dp[i].push_back( 0 );
		for( ll j = 1; j * i < n; ++j )
		{
			auto sum = s[i*j] + s[n-1-i*j] + dp[i][j-1];
			dp[i].push_back( sum );
		}
	}
 
	ll ans = 0;
	REP( a, n )
	{
		if( a <= 2 || a == n - 1 ) continue;
		auto div = divisor<ll>( n - 1 - a );
		for( auto m : div )
		{
			ll b = a - ( n - 1 - a ) / m;
			//cout << a << " " << b << " " << m << " " << endl;
			if( a <= b || b <= 0 ) continue;
 
			// どぼん
			ll g = gcd<ll>( a, b );
			ll a_ = a / g;
			ll b_ = b / g;
			if( a_ == b_ + 1 && b_ < m ) continue;
 
			ll sc = dp[a-b][m];
			//cout << a << " " << b << " " << sc << endl;
			ans = max( ans, sc );
		}
	}
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 17268
/*
 * atcoder/abc103_2nd/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * f(m) = (m mod a_1) + (m mod a_2) + ... + (m mod a_N)
 * f(m)の最大値を求める.
 * (m mod a_1) の最大値はa_1 - 1
 * (m mod a_2) の最大値はa_2 - 1
 * ...
 * (m mod a_N) の最大値はa_N - 1
 * 問題はこれらをすべて満たすようなmがあるか？
 * a_1 + 1, a_2 + 1, ..., a_N + 1 の積なら少なくとも満たすのでmは存在する.
 */
int N;
void solve() {
  cin >> N;
  int a;
  ll total = 0;
  loop(n,0,N) {
    cin >> a;
    total += a-1;
  }
  cout << total << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> rei(A);
  vector<int> len(B);
  for(int i = 0; i < A; i++){
    cin >> rei.at(i);
  }
  for(int i = 0; i < B; i++){
    cin >> len.at(i);
  }
  vector<int> x(M);
  vector<int> y(M);
  vector<int> c(M);
   for(int i = 0; i < M; i++){
    cin >> x.at(i) >> y.at(i) >> c.at(i);
  }
  vector<int> price(M);
  for(int i = 0; i < M; i++){
  price[i] =   rei[x[i]-1] + len[y[i]-1] - c[i];
  }
  sort(price.begin(), price.end());
  sort(rei.begin(), rei.end());
  sort(len.begin(), len.end());
  int mi = rei.at(0) + len.at(0);
  if(price.at(0) < mi) cout << price.at(0) << endl;
  if(price.at(0) >= mi)  cout << mi << endl;
}

Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
 
int main(void){
int n,m;
int a[101][101];
int b[101];
int sum;
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++){
    for(int k=0;k<m;k++){
        scanf("%d",&a[i][k]);
    }
}
    for(int k=0;k<m;k++){
        scanf("%d",&b[k]);
    }

for(int i=0;i<n;i++){
            sum=0;
    for(int j=0;j<m;j++){
        sum=sum+(a[i][j]*b[j]);
    }
    printf("%d\n",sum);
}

}



Measured memory_bytes: 2120
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 100000
#define N_max 100

#define rep(i, a, n) for(int i = a; i < n; i++)
#define lrep(i, a, n) for(long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

int digits(int n)
{
    int digits=1;

    while(n) {
        if(n/=10) digits++;
    }
    return digits;
}

int main()
{
    int A, B, C, D, E, F;
    double ans = -1.0;
    int sugar_max = 0, all_max = 0;

    cin >> A >> B >> C >> D >> E >> F;

    for(int i = 0; i <= F; i++) {
        for(int j = 0; j <= F; j++) {
            if(i == 0 && j ==0) { continue; }
            int x = 100 * (A * i + B * j);
            if  (x > F) { continue; } 
            
            int amari = F - x;
            for(int k = 0; k <= F; k++) {
                for(int l = 0; l <= F; l++) {
                    //if(k == 0 && l ==0) { continue; }
                    int y = C * k + D * l;
                    if (y > amari) { continue; }
                    if (y * 100 > (E * x)) { continue; } 
                    int all = x + y;
                    int sugar = y;
                    double den = (y * 100.0) / all;
                    if(den - ans > 1e-16) { ans = den; all_max = all, sugar_max = sugar; }
                    //cnt++;
                    //cout << "den" << den << "all" << all << "sugar" << sugar << endl;
                }
            } 
        }
    }        

    cout << all_max << " " << sugar_max << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	a.push_back(0) ;
	ll ans = 1000 ;
	ll sub = 0 ;
	for(int i=0;i<n;i++){
		if(i==0||a.at(i-1)>a.at(i)){
			sub = ans/a.at(i) ;
			ans -= sub*a.at(i) ;
		}
		if(a.at(i+1)<a.at(i)){
			ans += a.at(i)*sub ;
			sub = 0 ;
		}
	}
	cout << ans << endl ;
}

Measured memory_bytes: 3552
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		long x = sc.nextLong();
		sc.close();
		
		long ans = x / 11 * 2 + x % 11 / 7 + Math.min(x % 11, 1);
		out.println(ans);
		out.flush();
	}
	
}

class Scanner {
	private final InputStream in;
	private final byte[] buffer;
	private int ptr;
	private int buflen;
	
	public Scanner(InputStream in) {
		this.in = in;
		this.buffer = new byte[1024];
		this.ptr = 0;
		this.buflen = 0;
	}
	
	public void close() {
		try {
			this.in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
}


Measured memory_bytes: 8148
#include"iostream"
using namespace std;
int main(void) {
	int a = 0, b = 0;
	cin >> a >> b;
	int res = 0;
	if (a != 0) {
		res += a * (a - 1) / 2;
	}
	if (b != 0) {
		res += b * (b - 1)/2;
	}

	cout << res;


}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <sstream>
using namespace std;

typedef long long LL;
#define lowbit(x) ((x)&(-x))
#define INF 0x3f3f3f3f
#define memset(a,b) memset(a,b,sizeof(a))
#define	GE() printf(">----------\n")
#define	IN() freopen("in.txt","r",stdin)
#define	OUT() freopen("out.txt","w",stdout)
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-8;
const int maxn=1e5+5;


int main() {
    int a, b;
    while(cin>>a>>b){
        printf("%s\n", ((a+b)%3==0||a%3==0||b%3==0)?"Possible":"Impossible");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    reverse(sa.begin(), sa.end());
    reverse(sb.begin(), sb.end());
    reverse(sc.begin(), sc.end());
    char winner;
    char next = 'a';
    while (true) {
        if (next == 'a') {
            if (sa.size() == 0) {
                winner = 'A';
                break;
            } else {
                next = sa.back();
                sa.pop_back();
            }
        } else if (next == 'b') {
            if (sb.size() == 0) {
                winner = 'B';
                break;
            } else {
                next = sb.back();
                sb.pop_back();
            }
        } else {
            if (sc.size() == 0) {
                winner = 'C';
                break;
            } else {
                next = sc.back();
                sc.pop_back();
            }
        }
    }
    cout << winner << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)

int main(void){
  int a,b;
  cin>>a>>b;

  cout<<max((a+b),max((a*b),a-b))<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
	ll N, K;
	cin >> N >> K;
	N %= K;
	cout << min(N, K - N) << endl;
}

Measured memory_bytes: 3592
/*
    TOP GUN: MAVERICK!!
                                */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli mod=1e9+7ll;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
struct edge
{
    lli x,y,z,w;
};
bool cmp(edge a,edge b)
{
    if(a.x==b.x)
    {
        return a.y<b.y;
    }
    else
    return a.x<b.x;
}
lli parent[200005];
lli ran[200005];
void make_set(int v) {
    parent[v] = v;
    ran[v] = 0;
}
lli find_set(lli v)
{
if(v==parent[v])
return v;
return parent[v]=find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (ran[a] < ran[b])
            swap(a, b);
        parent[b] = a;
        if (ran[a] == ran[b])
            ran[a]++;
    }
}
int main()
{
    cin>>n;
    int a[n+1];
    vector<int> vv;
    map<int,int> m;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)
    {
        if(m[a[i]])
        m[a[i]]=min(m[a[i]],i);
        else
        m[a[i]]=i;
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            int sum=a[i]+a[j];
            // cout<<a[i]<<" "<<a[j]<<" "<<sum<<" "<<m[sum]<<"\n";
            auto it=m.lower_bound(sum);
            if(it!=m.end())
            {
                cnt+=it->second-j-1;
            }
            else
            {
                cnt+=(n-j);
            }
        }
    }
    cout<<cnt;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

ll DIV = 1000000007LL;

int main()
{
  int h,w,k;
  cin >> h >> w >> k;
  ll dp[101][8] = {};
  dp[0][0] = 1;
  ll e[8] = {1, 2, 3, 5, 8, 13, 21, 34};

  if(w == 1) {
    cout << 1 << endl;
    return 0;
  }

  FOR(i, 1, h+1) {
    REP(j,w) {
      if (j == 0) {
        dp[i][j] = ((dp[i-1][j+1]*e[max(0,w-3)])%DIV + (dp[i-1][j]*e[max(0,w-2)])%DIV)%DIV;
      } else if (j == w-1) {
        dp[i][j] = ((dp[i-1][j-1]*e[max(0,w-3)])%DIV + (dp[i-1][j]*e[max(0,w-2)])%DIV)%DIV;
      } else {
        dp[i][j] = ((dp[i-1][j-1]*(e[max(0, j-2)]*e[max(0, w-j-2)]))%DIV + (dp[i-1][j+1]*(e[max(0, j-1)]*e[max(0, w-j-3)]))%DIV + (dp[i-1][j]*(e[max(0, j-1)]*e[max(0, w-j-2)]))%DIV)%DIV;
      }
    }
  }

  cout << dp[h][k-1] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int A[100010];
    int B[100010];
    int i,j,tmp;
    int min;
    //入力インターフェース
    for(i=0;i<n-1;i++){
        scanf("%d",&tmp);
        B[i]=tmp;
    }
    for(i=0;i<n-1;i++){
        if(i==0){
            A[i]=B[i];
        }
        else{
            if(B[i]<B[i-1]){
                min=B[i];
            }
            else{
                min=B[i-1];
            }
            A[i]=min;
        }
        //printf("%d ",A[i]);
    }
    A[n-1]=B[n-2];

    //出力インターフェース
    int sum=0;
    for(i=0;i<n;i++){
        sum+=A[i];
    }
    printf("%d\n",sum);
}

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

int main()
{
  int n;
  string res = "No";
  cin >> n;
  for(int i=1; i<10; i++)
  {
    if(n % i == 0)
    {
      n /= i;
      if(n <= 9)
      {
        res = "Yes";
        break;
      }
      n *= i;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n==1)
    {
        printf("Hello World\n");
    }
    else
    {
        int a,b;
        scanf("%d%d",&a,&b);
        printf("%d\n",a+b);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int sum=0;
    REP(i,0,n){
        int x;
        // cin>>x;
        x=i+1;
        if(x%3==0 || x%5==0){

        }
        else{
            sum+=x;
        }
    }
    cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 3648
import sys

def linierSearch(x,data):
    for i in range(0,len(data)):
        if data[i] == x:
            return 1
    return 0

l = []
for i in sys.stdin:
    l.append(i)

l[1] = l[1].split()
l[3] = l[3].split()

count = 0
for i in range(0,len(l[3])):
    count += linierSearch(l[3][i],l[1])

print(count)


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1);

ll modexp(ll x,ll n,int md){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%md,n/2,md);
    return (x*modexp((x*x)%md,n/2,md))%md;
}

int main(){
    fastio;
    //clock_t tm = clock();
    ll n;
    cin>>n;
    vl a(n);
    map<ll,ll>b;
    f(i,0,n){
        cin>>a[i];
        b[a[i]]++;
    }
    ll ans=0;
    fr(i,b){
        if(i.second>1){
            ans+=((i.second)*(i.second-1))/2;
        }
    }
    f(i,0,n){
        ll temp=ans;
        if(b[a[i]]>1){
            ll x=b[a[i]];
            temp-=(x*(x-1))/2;
            --x;
            temp+=(x*(x-1))/2;
        }
        cout<<temp<<endl;
    }
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)

using namespace std;


int main(void) {

	long long a;
	long long b;

	cin >> a >> b;

	if (a == b) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

}





Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Sharing Cookies
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int a, b;
  cin >> a >> b;

  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) puts("Possible");
  else puts("Impossible");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, m; cin >> n >> m;
  ll ans = min(n, m/2);
  cout << ans + ((m-ans*2)/4) << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (A, B, X) = listOfDouble()
    val r: Double
    val s = X / A
    if (A * B / 2 <= s) {
        val h = 2 * (A * B - s) / A
        r = Math.atan(h / A) * 180 / Math.PI
    } else {
        val w = 2 * s / B
        r = Math.atan(B / w) * 180 / Math.PI
    }
    println(r)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfDouble() = listOfString().map { java.lang.Double.parseDouble(it) }


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1000000007
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

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

    ll X = 0LL, Y = 0LL;
    for(int i = 0; i < n; ++i){
        X += i*x[i] - (n-i-1)*x[i];
        X %= MOD;
    }

    for(int i = 0; i < m; ++i){
        Y += i*y[i] - (m-i-1)*y[i];
        Y %= MOD;
    }

    ppp(X*Y % MOD);

    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define maxn 200005
#define inf 1e17
#define eps 1e-6
#define ll long long
#define ull unsigned long long
#define main() int main()
#define pii pair<int, ll>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define sa(x) scanf("%d",&x)
#define sab(x,y) scanf("%d%d",&x,&y)
#define pa(x) printf("%d",&x)
#define pab(x,y) printf("%d%d",x,y) 
#define ms(a,x) memset(a,x,sizeof(a))
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define ff0(i,n) for(int i=0;i<n;++i)
#define ff1(i,n) for(int i=1;i<=n;++i)
main()
{
    IO;
    int n;
    cin>>n;
    int a[n];
    ff0(i,n)cin>>a[i];
    ll ans=inf,pos;
    ff1(i,100)
    {
    	ll tmp=0;
    	ff0(j,n)
    	{
    		tmp+=abs(a[j]-i)*abs(a[j]-i);
		}
		if(tmp<ans)
		{
			ans=tmp;
			//pos=i;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
n, k, s = [int(i) for i in sys.stdin.readline().split()]
if s == 10**9:
    ls = [s] * k + [s - 1] * (n - k)
else:
    ls = [s] * k + [s + 1] * (n - k)
print(" ".join([str(i) for i in ls]))

Measured memory_bytes: 12644
def main():
    N = int(input())

    def trial_division(n):
        divs = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0:
                divs.append(i)
                if i != n//i:
                    divs.append(n//i)
        return divs

    divs = trial_division(N)
    d = len(divs)
    ans = float('inf')
    for i in range(d):
        for j in range(i, d):
            if divs[i] * divs[j] == N:
                ans = min(ans, divs[i] - 1 + divs[j] - 1)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39664
#include<stdio.h>
#define inf 1145141819810364364

int main(void){
	long long d[1024],n,m,a[2048],b[2048],c[2048],i,j,f;
	for(i = 0;i < 1024;i++){
		d[i] = -inf;
	}
	d[1] = 0;
	scanf("%lld%lld",&n,&m);
	for(i = 1;i <= m;i++){scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);}
	for(i = 1;i <= 6*n;i++){
		f = 0;
		for(j = 1;j <= m;j++){
			if(d[(b[j])] < d[(a[j])]+c[j]){d[(b[j])] = d[(a[j])]+c[j];if(i >= 3*n){if(b[j] == n){f = 1;}}else{f=1;}}
		}
		if(f==0){break;}
		if(i == 6*n){printf("inf\n");return 0;}
	}
	printf("%lld\n",d[n]);
	return 0;
}

Measured memory_bytes: 256
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, m = MI()
    a_list = LI()

    s = sum(a_list)
    if s > n:
        print(-1)
    else:
        print(n - s)
    pass


if __name__ == "__main__":
    main()


Measured memory_bytes: 68116
#include <iostream>
#include <string>
#include <cassert>
using namespace std;
const int INF = 10010001;

int main() {
	string s; cin >> s;
	int n = s.size(), m = n / 2;
	assert(n % 2 == 1);
	string ans = "Yes";
	for (int i = 0; i < n / 2; ++i) {
		if (s[i] != s[m - 1 - i] || s[m + 1 + i] != s[n - 1 - i] || s[i] != s[n - 1 - i]) {
			ans = "No";
			break;
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

using ll = long long;

int main(void)
{
	ll n;
	cin >> n;
	int ans = INT_MAX;
	for (ll i = 1; i * i <= n; ++i)
	{
		if (n % i == 0)
		{
			int dig1 = log10(n / i) + 1;
			int dig2 = log10(i) + 1;
			int dig = max(dig1, dig2);
			if (ans > dig)ans = dig;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
main(){
  int l,a,b,c,d,e,f;
  scanf("%d %d %d %d %d",&l,&a,&b,&c,&d);
  e=a/c;
  f=b/d;
  if(a%c!=0)e++;
  if(b%d!=0)f++;
  if(e<f)e=f;
  printf("%d\n",l-e);
  return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        String t = in.nextLine();

        int count = 0;
        for( int i = 0 ; i < s.length() ; i++ ){
            if( s.charAt(i) == t.charAt(i) ){
                count++;
            }
        }

        System.out.println(count);

    }

}





Measured memory_bytes: 23764
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long

#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))

#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000LL
#define MX2     1000000LL
#define Inf     1000000000000000LL
#define mod		1000000007LL
using namespace std;

lli a[10][10];

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    opt;

    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    lli H,W,i,j,k;
    cin>>H>>W;

    rep(i,0,10)
    {
        rep(j,0,10)
        {
            cin>>a[i][j];
        }
    }

    lli V=10;
    for (k = 0; k < V; k++)
    {
        for (i = 0; i < V; i++)
        {
            for (j = 0; j < V; j++)
            {
                if (a[i][k] + a[k][j] < a[i][j])
                    a[i][j] = a[i][k] + a[k][j];
            }
        }
    }

    lli Total=0;

    rep(i,0,H)
    {
        rep(j,0,W)
        {
            lli x;
            cin>>x;

            if(x!=-1)
            {
                Total+=a[x][1];
            }
        }
    }

    cout<<Total;








 return 0;
}


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


const int maxn = 100+10;
char G[maxn][maxn];
int W,H;

int dir[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};

void dfs(int x,int y,char tree){
	G[x][y] = '$';
	for(int i=0; i<4; i++){
		int tx = x+dir[i][0], ty = y+dir[i][1];
		if(tx>=0 && tx<W && ty>=0 && ty<H && G[tx][ty]==tree){
			dfs(tx,ty,tree);
		}
	}
}

int main(){
	while(cin>>H>>W && (W||H)){
		int ans = 0;
		
		for(int j=0; j<H; j++){
			for(int i=0; i<W; i++){
				cin >> G[i][j];
			}
		}

		for(int j=0; j<H; j++){
			for(int i=0; i<W; i++){
				if(G[i][j]!='$'){
					dfs(i,j,G[i][j]);
					ans++;
				}
			}
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 3448
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iterator>

using namespace std;

int main()
{
	int n; cin >> n;
	map<string, int> m;
	string s;
	int maxi = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> s;
		m[s]++;
		maxi = max(maxi, m[s]);
	}
	
	for (auto& p : m)
	{
		if (p.second == maxi)
		{
			cout << p.first << "\n";
		}
	}

	return 0;
}


Measured memory_bytes: 25216
#include <cstdio>
#include <algorithm>
#include <deque>
#include <functional>

#define MAX_N 100000

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

bool greatersecond(const P& left, const P& right) {
    return left.second > right.second;
}

int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    deque<P> uma;
    int t, d, i;
    for (i = 0; i < N; i++) {
        scanf("%d %d", &t, &d);
        uma.push_back({t, d});
    }
    sort(uma.begin(), uma.end(), greatersecond);
    bool used[MAX_N+1] = {0};
    ll sum=0;
    int var=0;
    for (i = 0; i < N; i++) {
        if (i < K) sum += uma[i].second;
        if (used[ uma[i].first ]) {
            uma[i].first = 0;
        } else {
            if (i < K) var++;
            used[ uma[i].first ] = true;
            uma[i].first = 1;
        }
    }
    ll max = sum + (ll)var*var;
    int j = K-1, k = K;
    for (i = var+1; i <= K; i++) {
        for ( ; j >= 0 && uma[j].first; j--);
        for ( ; k < N && !uma[k].first; k++);
        if (j < 0 || k >= N) break;
        sum += -uma[j].second + uma[k].second;
        j--; k++;
        if (max < sum + (ll)i*i) max = sum + (ll)i*i;
    }
    printf("%lld\n",max);
    return 0;
}

Measured memory_bytes: 1152
n = int(input())
a_list = []
xy_list = []
for i in range(n):
    A = int(input())
    a_list.append(A)
    xy = [list(map(int, input().split())) for _ in range(A)]
    xy_list.append(xy)

ans = 0

for i in range(2**n):
    flag = True
    for j in range(n):  # 人ｊについて
        if (i >> j) & 1 == 1:  # 人jが正直ならば
            for k in range(a_list[j]):  # 人jの証言kについて
                if xy_list[j][k][1] == 1:
                    m = xy_list[j][k][0]
                    if (i >> m-1) & 1 != 1:  # 矛盾発生（正直者のjの証言で正直者と確定したｍが不親切だった）
                        flag = False
                        break

                elif xy_list[j][k][1] == 0:
                    m = xy_list[j][k][0]
                    if (i >> m-1) & 1 == 1:
                        flag = False
                        break
    if flag:
        i_bin = format(i, 'b')
        if ans < i_bin.count('1'):
            ans = i_bin.count('1')

print(ans)

Measured memory_bytes: 45788
#include <iostream>

using namespace std;

#define DEBUG 0

int main(){

	long long int n;
	long long int *a;
	long long int sum=0;
	cin>>n;
	a = new long long int[n];

	for(int i=0;i<n;i++){
		cin>>a[i];
		sum += a[i];
	}

	long long int once = n*(n+1)/2;

	if(sum%once!=0){
		if(DEBUG)cout<<"0"<<endl;
		cout<<"NO"<<endl;
		return 0;
	}
	long long int cnt = sum/once;

	if(DEBUG)cout<<"cnt="<<cnt<<endl;

	long long int *d;
	d = new long long int[n];
	for(int i=1;i<=n;i++){
		d[i-1] = a[i%n] -a[i-1] -cnt;
	}

	long long int ansCnt=0;
	for(int i=0;i<n;i++){
		while(d[i]<0){
			d[i]+=n;
			ansCnt++;
		}
		if(DEBUG)cout<<"i="<<i<<" d[i]="<<d[i]<<endl;
		if(d[i]!=0){
			if(DEBUG)cout<<"1"<<endl;
			cout<<"NO"<<endl;
			return 0;
		}
	}

	if(ansCnt==cnt){
		cout<<"YES"<<endl;
	}else{
		if(DEBUG)cout<<"2"<<endl;
		cout<<"NO"<<endl;
	}


	return 0;

}

Measured memory_bytes: 1792
from itertools import accumulate
n = int(input())
a = [int(item) for item in input().split()]

cum = [0]* (10**5 + 2)
for item in a:
    if item - 1 < 0:
        cum[0] += 1
    else:
        cum[item-1] += 1
    cum[item+2] -= 1
print(max(list(accumulate(cum))))

Measured memory_bytes: 13744
from collections import deque
k=int(input())
nums=[1,2,3,4,5,6,7,8,9]
lst=deque()
for j in nums:
  d=deque()
  d.append(j)
  while len(d)<10**5:
    num=d.popleft()
    lst.append(num)
    s=str(num)
    l=len(s)
    t=int(s[l-1])
    if 1<=t<=8:
      d.append(s+str(t-1))
      d.append(s+str(t))
      d.append(s+str(t+1))
    if t==0:
      d.append(s+str(0))
      d.append(s+str(1))
    if t==9:
      d.append(s+str(8))
      d.append(s+str(9))

Lst=list(lst)
Lst=list(map(int,Lst))
Lst.sort()
print(Lst[k-1])
    
    
      
   

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

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

typedef long long int64;

class CReplacingInteger {
 public:
  void solve(std::istream &in, std::ostream &out) {
      int64 n, k;
      in >> n >> k;

      if (n % k == 0) {
          out << 0 << '\n';
      } else if (k <= n) {
          int64 x = (((n / k) + 1) * k) - n;
          out << x << '\n';
      } else {
          out << min(n, abs(n - k)) << '\n';
      }

  }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    CReplacingInteger solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>        //sort(v.begin(), v.end(), [std::greater()]);  第3引数をなしにすると昇順。
#include <utility>  
#include <vector>           
#include <iterator>         //vector入力で使う istream_iterator(cin)
#include <iomanip>          //doubleやfloatなどの少数の桁数を指定する setprecision(桁数) 

/*----------- 定義 -----------*/
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

typedef long long int lli;
/*----------------------------*/


/*----------- 入力 -----------*/
lli N;
string S;
vector<int> data;

/*----------------------------*/

int main(void){

    cin >> S;
    int day = 0;
    
    if(S == "SUN"){
        day = 7;
    }else if(S == "MON"){
        day = 6;
    }else if(S == "TUE"){
        day = 5;
    }else if(S == "WED"){
        day = 4;
    }else if(S == "THU"){
        day = 3;
    }else if(S == "FRI"){
        day = 2;
    }else{
        day = 1;
    }
    
    cout << day <<endl;
    
    return 0;
}


Measured memory_bytes: 256
a = input()
b = input()
m = len(a)
n = len(b)
flag = False
if m > n:
    flag = True
    print("GREATER")
elif m < n:
    flag = True
    print("LESS")
else:
    if a == b:
        print("EQUAL")
    else:
        for i in range(m):
            if a[i] > b[i]:
                print("GREATER")
                break
            elif a[i] < b[i]:
                print("LESS")
                break

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<cstdio>
#include<cstring>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mp make_pair
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
const int MOD = 1e9+7;
const ll INF =1e18;

int main(){
    int n;cin>>n;
    ll place[n+1];

    fr(i,n){
        ll a;cin>>a;
        place[a] = i+1;
    }

    ll ans = 0;
    set<ll> used = {0, n+1};

    fr(i,n){
        ll r, l;

        auto itr = used.lower_bound(place[i+1]);
        r = *itr;

        l = *(--itr);

        ans += (i+1)*(place[i+1]-l)*(r-place[i+1]);
        used.insert(place[i+1]);
    }

    cout << ans << endl;

}

Measured memory_bytes: 11136
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//----------------------------------------------------------------------

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

int main(void) {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    sort(h.begin(), h.end());
    int ans = 1e9;

    rep(i, n-k+1) {
        ans = min( ans, h[i+k-1] - h[i] );
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: usize = sc.read();
    let t: f64 = sc.read();
    let a: f64 = sc.read();
    let mut v: Vec<f64> = Vec::with_capacity(n);
    for _i in 0..n {
        v.push(sc.read());
    }

    let mut res = (std::f64::MAX, 0);
    for i in 0..n {
        let tmp = (t - (v[i] * 0.006), i);
        res = choose(res, tmp, a);
    }
    println!("{}", res.1 + 1)
}

fn choose(prev: (f64, usize), arg2: (f64, usize), base: f64) -> (f64, usize) {
    let tmp;

    if base < arg2.0 {
        tmp = arg2.0 - base;
    } else {
        tmp = base - arg2.0;
    }

    if prev.0 < tmp {
        prev
    } else {
        (tmp, arg2.1)
    }
}



Measured memory_bytes: 4352