akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
using P = pair<int, int>;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
ll dp[100005];
//const int mod = 1e9 + 7;
const int MAX = 1010000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long nCk(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//上のmainは消す
//memo:
//  ooo||||の並び替え...n+k-1 C k
bool memo[100005];
int main(void) {

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

    COMinit();

    int n, m;
    cin >> n >> m;
    int a[m];
    rep (i, m) {
        cin >> a[i];
        memo[a[i]] = true;
    }

    dp[0] = 0;
    if (memo[1]) {
        dp[1] = 0;
        dp[2] = 1;
    }
    else {
        if (memo[2]) {
            dp[1] = 1;
            dp[2] = 0;
        }
        else {
            dp[1] = 1;
            dp[2] = 2;
        }

    }

    rep (i, n - 1) {
        if (memo[i] && memo[i + 1]) {
            cout << 0 << endl;
            return 0;
        }
    }

    for (int i = 3; i <= n; i++) {
        if (memo[i]) {
            dp[i] = 0;
        }
        else dp[i] = dp[i - 1] + dp[i - 2];
        dp[i] %= MOD;
    }

    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 24960
#include<stdio.h>
int main() {
  int a[3];
  for (int i=0; i<3; i++){
	  scanf("%d", &a[i]);
  }
  int sum = a[0]+a[1]+a[2];
  int larger = (a[0] > a[1]) ? a[0] : a[1];
  larger = (larger > a[2]) ? larger : a[2];
  
  printf("%d\n", sum-larger);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 n,ww;
    cin >> n >> ww;
    vector<int64> w(n);
    vector<int64> v(n);
    for (int i=0; i<n; i++) cin >> w[i] >> v[i];

    vector<int64> dp(ww+1, 0);

    for (int i=0; i<n; i++) {
        for (int64 j=ww; j-w[i]>=0; j--) {
            dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
        }
    }

    cout << dp[ww] << endl;
}

Measured memory_bytes: 1024
#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if(a+b>m)return (a+b)-m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

int main()
{
    fastio;
    ll k,n;cin>>k>>n;
    vector<ll> a;
    rep(i,0,n)
    {
        ll v;cin>>v;
        a.pb(v);
    }
    rep(i,0,n-1)
        a.pb(a[i]+k);
    ll sz=a.size();
    ll ans=INF;
    rep(i,n-1,sz)
    ans=min(ans,a[i]-a[i-n+1]);
    cout<<ans;
}


Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
#define LOD (24) // LOD : Length of Day
int main(){
  int M = 0;
  cin >> M;
  if(M<1) cout << "入力エラー(制約:1≦M,M≦23)" << endl;
  else cout << LOD * 2 - M << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>


const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

const int MAXN = 1e5 + 10;
int dp[MAXN][4];
int a[MAXN][4];
int n;

void solve() {
    cin >> n;
    for(int i = 1; i <= n; ++i) for(int j = 1; j <= 3; ++j) cin >> a[i][j];
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= 3; ++j) {
            for(int k = 1; k <= 3; ++k) {
                if(j == k) continue;
                dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i][k]);
            }
        }
    }
    cout << max({dp[n][1], dp[n][2], dp[n][3]});
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}


Measured memory_bytes: 6740
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
ll n, a[400000],pref[400000],suf[400000];
signed main(){
	scanf("%lld",&n);
	n*=3; 
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	ll sum=0;
	priority_queue <ll,vector <ll>,greater <ll> > que;
	for(int i=0;i<n;i++){
		que.push(a[i]);
		sum+=a[i];
		if(que.size()>n/3){
			sum-=que.top();
			que.pop();
		}
		pref[i]=sum;
	}
	priority_queue <ll> que2;
	sum=0;
	for(int i=n-1;i>=0;i--)
	{
		que2.push(a[i]);
		sum+=a[i];
		if(que2.size()>n/3)
		{
			sum-=que2.top();
			que2.pop();
		}
		if(i>=1) pref[i-1]-=sum;
	}
	ll ans=pref[n/3-1];
	for(int i=n/3-1;i+n/3<n;i++)ans=max(ans,pref[i]); 
	cout<<ans<<endl; return 0;
}

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

int main(){
  int n,k;
  cin >>n >>k;
  int cnt = 0;
  rep(i,n-(k-1)) cnt++;
  cout << cnt << endl;
  return 0;
}

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll k;
  cin >> n >> k;
  vector<pair<int, int>> c(n);
  for (auto&& [a, b] : c) {
    cin >> a >> b;
  }
  sort(c.begin(), c.end());
  ll cnt = 0;
  int ans;
  for (auto&& [a, b] : c) {
    cnt += b;
    if (cnt >= k) {
      ans = a;
      break;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 4000
import java.util.Scanner;

public class Main{	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s;
		char ch;
		s = sc.nextLine();
		for(int i=0;i<s.length();i++){
			ch = s.charAt(i);
			if((int)ch>=(int)'a'&&(int)ch<=(int)'z'){
				ch+='A'-'a';
			}
			else if((int)ch>=(int)'A'&&(int)ch<=(int)'Z'){
				ch+='a'-'A';
			}
			System.out.print(ch);
		}
		System.out.println();
		sc.close();
	}
}


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

int main() {
    unsigned int n;
    cin >> n;
    string s;
    cin >> s;

    char tmp;
    tmp = s.at(0);
    unsigned int count = 1;
    for(auto e : s) {
        if(e != tmp) {
            ++count;
        }
        tmp = e;
    }
    cout << count;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;


int main(void) {
  int num = 0;
  int N;

  cin >> N;

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

    while (t > 0) cc += t % 6, t /= 6;

    t = N - i;
    while (t > 0) cc += t % 9, t /= 9;
    if (num > cc) num = cc;
  }

  std::cout << num << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
    {
           ll a,b,l,r;
           cin >> l >> r >> a >> b;
           
           ll minA,maxA;
           if(min(l,r)%a==0)
           minA = min(l,r);
           else
           {
           minA = min(l,r)/a;
           minA = (minA+1)*a;
           if(minA>max(l,r))
           minA=0;
           }
           
           
           if(max(l,r)%a==0)
           maxA = max(l,r);
           else
           {
           maxA = max(l,r)/a;
           maxA = (maxA)*a;
           if(maxA<min(l,r))
           maxA=0;
           }
           
           ll minB,maxB;
           if(min(l,r)%b==0)
           minB = min(l,r);
           else
           {
           minB = min(l,r)/b;
           minB = (minB+1)*b;
           if(minB>max(l,r))
           minB=0;
           }
           
           
           if(max(l,r)%b==0)
           maxB = max(l,r);
           else
           {
           maxB = max(l,r)/b;
           maxB = (maxB)*b;
           if(maxB<min(l,r))
           maxB=0;
           }
           
           ll na=0,nb=0;
           
           na = (maxA - minA)/a + 1;
           nb = (maxB - minB)/b + 1;
           
           if(minA==0 && maxA==0)
           na=0;
           if(minB==0 && maxB==0)
           nb=0;
        //   ll pA=0;
        //   pA = na*(maxA+minA)/2;
           
        //   ll pB=0;
        //   pB = nb*(minB+maxB)/2;
           
        //   ll ps = pB + pA;
           
           ll lm = __gcd(a,b);
           lm = (a / lm) *b;
           //cout << lm << endl;
           ll minC,maxC;
           if(min(l,r)%lm==0)
           minC = min(l,r);
           else
           {
           minC = min(l,r)/lm;
           minC = (minC+1)*lm;
           if(minC>max(l,r))
           minC=0;
           }
           if(max(l,r)%lm==0)
           maxC = max(l,r);
           else
           {
           maxC = max(l,r)/lm;
           maxC = (maxC)*lm;
           if(maxC<min(l,r))
           maxC = 0;
           }
           
           ll nc;
           nc = (maxC - minC)/lm + 1;
           if(minC==0 && maxC==0)
           nc=0;
           
          // cout << na << ' ' << nb << ' ' << nc << endl;
           ll abc = na+nb-nc;
           cout << r-l+1-abc;
       }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();

        int min = L;
        int prevTaste = L;
        int sum = L;

        for (int i = 1; i < N; i++) {
            int taste = L + (i + 1) - 1;
            sum += taste;
            if (Math.abs(taste) < Math.abs(prevTaste)) {
                min = taste;
            }
            prevTaste = taste;
        }

        System.out.print(sum - min);

    }

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

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
      int n , k ;
      string s;
      cin >> n >> k >> s;
      vector<int> v;
      char a , b , c;
      a = '0';
      int t = 0;
      for(int i = 0 ; i < n ; i++){
          if(s[i] == a ){
              t += 1;
          }else{
              v.push_back(t);
              a = s[i];
              t = 1;
          }
      }
      v.push_back(t);
      if(s[n-1] == '1'){
          v.push_back(0);
      }
      
      vector<int> sumv;
      sumv.push_back(v[0]);
      for(int i = 1 ; i < v.size(); i++){
          sumv.push_back(sumv[i-1] + v[i]);
      }
      /* 
      if (v.size() > 0){
        cout << v[0];
        for ( int i = 1; i < v.size() ; i++){
          cout << " " << v[i] ;
        }
      cout << endl;
      }
      
      if (sumv.size() > 0){
        cout << sumv[0];
        for ( int i = 1; i < sumv.size() ; i++){
          cout << " " << sumv[i] ;
        }
      cout << endl;
      }
      */
      int j;
      j = sumv.size();
      int ans = 0;
      int temp = 0;
      for(int i = 0 ; i < j ; i = i + 2){
          if(i + 1 < j){
              temp = sumv[i + 1];
          }else{
              temp = sumv[i];
          }
          if(i - 2 * k < 0 ){
              
          }else{
              temp = temp - sumv[i - 2 * k];
          }
          ans = max(ans , temp);
      }
      
      cout << ans << endl;
      return 0;
    }

Measured memory_bytes: 1528
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
using namespace std;

int main()
{
    string s;

    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        cout << 'x';
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

bool solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a < b) return false;
    if (d < b) return false;
    if (c >= (b - 1)) return true;
    ll g = __gcd(b, d);
    ll v = (b - a % g + (g - 1)) / g * g + a % g - g;
    return !(v > c); 
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll t;
    cin >> t;
    rep(i, t) cout << (solve() ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3496
n=int(input())
A=[]
B=[]
for i in range(n):
    a,b=input().split()
    A.append(a)
    B.append(b)
A.reverse()
B.reverse()
A.append(0)
B.append(0)
A=list(map(int,A))
B=list(map(int,B))

x=0
for i in range(0,n):
    cnt=0
    if A[i]%B[i]!=0:
        cnt+=(B[i]-A[i]%B[i])
        A[i]+=(B[i]-A[i]%B[i])
    x+=cnt
    A[i+1]+= x
print(x)



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

using namespace std;

int main()
{
	vector<int> hight(10);
	for(int i=0 ; i<10 ; i++)
		cin >> hight[i];
	
	sort(hight.begin(), hight.end());
	reverse(hight.begin(), hight.end());
	for(int i=0 ; i<3 ; i++)
		cout << hight[i] << endl;
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
    int n;
    scanf("%d",&n);

    char mark,mark2ele['S'+1]={['S']=0,['H']=1,['C']=2,['D']=3},rank2ele[]={'S','H','C','D'};
    int  rank,card[52]={0};

    while(n--)
    {
        scanf(" %c %d",&mark,&rank);
        card[mark2ele[mark]*13+rank-1]=1;
    }

    int i;
    for(i=0;i<52;++i)
    {
        if(!card[i])
        {
            printf("%c %d\n",rank2ele[i/13],i%13+1);
        }
    }

    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

  int a, b; cin >> a >> b;

  for (int i = 1; i <= 16; ++i) {
    if( i % 2 == 0 ) --a;
    else --b;

    if( a <= 0 && b <= 0 ) {
      cout << "Yay!" << endl;
      return 0;
    }
  }

  cout << ":(" << endl;

  return 0;
}

Measured memory_bytes: 256
N = int(input())
data = list(map(int, input().split()))
for i in range(N):
    data[i] -= (i + 1)
ave = sum(data) / N
if ave > 0:
    key = int(ave + 1)
    key1 = int(ave)
else:
    key = int(ave - 1)
    key1 = int(ave)
data.sort()
sumdata = 0
sumdata2 = 0
key = data[int(N / 2) - 1]
key2 = data[int(N / 2)]
for i in data:
    sumdata += abs(i - key)
    sumdata2 += abs(i - key2)

#print(sumdatax)
#print(data)
print(min([sumdata, sumdata2]))

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

#define ll long long

#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define output_s(a) printf("%s\n",(a).c_str())

//library----------------------------------------------


int main(){
    string s; cin>>s;
  	if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
      printf("Bad");
    }else{
      printf("Good");
    }
    
    return 0;
}

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

using namespace std;

long long f(long long x) {
    return (((x+1)/2)%2) ^ (x%2==0 ? x : 0);
}

int main() {
    long long int a, b;
    cin >> a >> b;
    cout << (f(a-1) ^ f(b));

    return 0;
}


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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int x = A;
	A = B;
	B = x;
	int y = A;
	A=C;
	C=y;
	
	cout << A << " " << B << " " << C;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    vector<int> A(N+1);
    for(int i=1; i<N+1; i++){
        cin >> A.at(i);
    }
    ll money=1000;
    ll kabu=0;
    for(int i=1; i<N; i++){
        if(A.at(i)<=A.at(i+1)){
            kabu+=money/A.at(i);
            money=money%A.at(i);
        }else{
            money+=kabu*A.at(i);
            kabu=0;
        }
    }
    money+=kabu*A.at(N);
    cout << money;
    return 0;
}

Measured memory_bytes: 3560
N, K = map(int, input().split())

Q = 998244353
L, R = [], []

for _ in range(K):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
    
L = sorted(L)
R = sorted(R)

P = [0] * N
P[0] = 1

C = [0] * N
C[0] = 1
S = 1

for i in range(1, N):
    for l, r in zip(L, R):
        if l > i:
            break
        
        if r >= i:
            P[i] += C[i-l]
        else:
            s = C[i-l] - C[i-r-1]
            if s < 0:
                s += Q
            P[i] += s

        P[i] = P[i] % Q
    S += P[i]
    S %= Q
    C[i] = S


print(P[-1])

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

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int main() {
  ll n, l, s = -1;
  vector<ll> lo(100001);
  cin >> n >> l;

  rep(i, 0, n) cin >> lo[i];

  rep(i, 0, n - 1) {
    if(lo[i] + lo[i + 1] >= l) {
      s = i;
      break;
    }
  }

  if(s < 0) {
    cout << "Impossible" << endl;
    return 0;
  }

  cout << "Possible" << endl;

  rep(i, 1, s + 1) cout << i << endl;
  dep(i, n - 1, s + 1) cout << i << endl;
}


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

int main() {
  int n,m,k;
  cin >> n >> m >> k;
  vector<string> v(n);
  for(int i = 0;i<n;i++)
  {
    cin >> v[i];
 //   cout << v[i] << endl;
  }
  int result = 0;

  for(int mask_i = 0; mask_i < (1<<n) ; mask_i++)
  {
    for(int mask_j = 0;mask_j < (1 << m);mask_j++)
    {
      int black = 0;
      for(int i = 0;i < n;i++)
      {
        for(int j = 0;j<m;j++)
        {
          if(((mask_i >> i) & 1) == 0 && ((mask_j >> j) & 1) == 0 && v[i][j] == '#' )
            black++;
        }
      }
      if(black == k) result++;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3620
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li == []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long w,h,x,y;
	cin>>w>>h>>x>>y;
	cout<<fixed<<setprecision(12)<<w*h/2.0<<" "<<(w==x*2&&h==y*2?1:0)<<endl;
	return 0;
}


Measured memory_bytes: 256
D = 10 ** 9 + 7
N = int(input())
L= list(map(int, input().split()))

ans = L[0] * L[1] % D
sub = L[0] + L[1]
for n in range(2,N):
    ans += L[n] * sub
    sub += L[n]
    
print(ans % D)

Measured memory_bytes: 94248
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr(i, n) for (ll i = 0; i < (ll)n; i++)
#define frab(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef double ld;

const ll INF = 2e9 + 10;
const ld PI = acos(-1);
const ld EPS = 1e-9;
const ll MOD = 1e9 + 7;
const ll M = 15;
const ll N = 2e3 + 10;

int a[N];
int d[N][N][2];

//map <tuple<int, int, int>, int> dp;

int f(int l, int st, int n, int z, int w) {
    if (l == n) return abs(a[z] - a[w]);
    if (!st) {
        //if (dp.count(make_tuple(l, st, w))) return dp[make_tuple(l, st, w)];
        if (d[l][st][w] != -1) return d[l][st][w];
        int ans = -INF;//abs(a[l] - w);
        for (int j = l; j < n; j++) {
            int tmp = f(j + 1, !st, n, j, w);
            ans = max(ans, tmp);
        }
        //dp[make_tuple(l, st, w)] = ans;
        d[l][st][w] = ans;
        return ans;
    }
    else {
        //if (dp.count(make_tuple(l, st, z))) return dp[make_tuple(l, st, z)];
        if (d[l][st][z] != -1) return d[l][st][z];
        int ans = INF;//abs(a[l] - z);
        for (int j = l; j < n; j++) {
            int tmp = f(j + 1, !st, n, z, j);
            ans = min(ans, tmp);
        }
        //dp[make_tuple(l, st, z)] = ans;
        d[l][st][z] = ans;
        //cout << l << " " << z << " " << w << ' ' << ans << endl;
        return ans;
    }
}


int main() {
    //freopen("a.in", "r", stdin);
    int n, z, w;
    cin >> n >> z >> w;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    a[n] = z;
    a[n + 1] = w;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n + 2; j++)
            for (int k = 0; k < 2; k++)
                d[i][j][k] = -1;
    cout << f(0, 0, n, n, n + 1);
}


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

vector<bool> row(50), col(50);

int n, m, k;
char g[40][40];

int ans = 0;

void go(int i, int j) {
  if(i == n  && j == m) {
    int sum = 0;
    for(int I = 0; I < n; ++I) {
      for(int J = 0; J < m; ++J) {
        if(!row[I] && !col[J] && g[I][J] == '#') sum += 1;
      }
    }
    ans += sum == k;
  } else {
    if(i < n && j < m) {
      row[i] = true;
      col[j] = true;
      go(i + 1, j + 1);
      row[i] = false;
      col[j] = false;
    }
    if(i < n) {
      row[i] = true;
      go(i + 1, j + (j < m));
      row[i] = false;
    }
    if(j < m) {
      col[j] = true;
      go(i + (i < n), j + 1);
      col[j] = false;
    }
    go(i + (i < n), j + (j < m));
  }
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  cin >> n >> m >> k;
  for(int i = 0; i < n; ++i) {
    for(int j = 0; j < m; ++j) {
      cin >> g[i][j];
    }
  }
  go(0, 0);
  cout << ans << '\n';
}

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/a.in", "r", stdin);
//  freopen("../IO/a.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}



void solve(std::istream &in, std::ostream &out) {
  int r;
  in >> r;
  out << fixed << setprecision(10);
  out << 2 * r * M_PI  << '\n';
}


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

int main()
{
    int n,tg;
    int mind=0x7fffffff;
    int ans=-1;
    scanf("%d %d",&n,&tg);
    for(int i=1;i<=n;i++)
    {
        /* int id,dist; */
        /* scanf("%d %d",&id,&dist); */
        /* if(dist<=mind&&id<=tg) */ 
        /* { */
        /*     ans=dist; */
        /*     mind=dist; */
        /* } */
        int a,b;
        scanf("%d %d",&a,&b);
        if(b<=tg&&a<mind)
        {
            mind=a;
            ans=a;
        }
    }
    if(ans==-1)
    {
        printf("TLE");
        return 0;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const Arr = (input.trim()).split("\n");
const N1 = Number(Arr[0]);
const arr1 = Arr[1].split(" ").map(Number);
const arr2 = Arr[3].split(" ").map(Number);

const summing = (a, b) => a + b;
console.log(arr2.map(key => {   
  let mid;
  let left = 0;
  let right = N1;
  if (key < arr1[0] || arr1[N1-1] < key) return 0;
  while (left < right) {
    mid = Math.floor((left + right) / 2);
    if (key < arr1[mid]) right = mid;
    else if (key > arr1[mid]) left = mid + 1;
    else return 1;
  }
  return 0;
}).reduce((a, b) => a + b, 0));



Measured memory_bytes: 34944
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

vi inv(vi a){
	vi b(n);
	for(int i=0;i<n;i++) b[a[i]]=i;
	return b;
}

vi mul(vi a,vi b){
	vi c(n);
	for(int i=0;i<n;i++) c[i]=b[a[i]];
	return c;
}

vi pow(vi a,int p){
	vi b(n);
	for(int i=0;i<n;i++) b[i]=i;
	for(;p>0;p>>=1){
		if(p&1) b=mul(b,a);
		a=mul(a,a);
	}
	return b;
}

int k;
vi a,b,A,B,d;

vi f(int p){
	vi c(n);
	for(int i=0;i<n;i++) c[i]=i;
	if(p<0) return c;
	c=pow(d,p/6);
	c=mul(c,B);
	if(p%6>=1) c=mul(c,a);
	if(p%6>=3) c=mul(c,b);
	if(p%6>=4) c=mul(c,A);
	return c;
}

int main(){
	cin>>n>>k;
	a=b=vi(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		a[i]--;
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
		b[i]--;
	}
	A=inv(a),B=inv(b);
	d=mul(B,mul(a,mul(b,A)));
	vi c;
	if(k==1) c=a;
	else c=mul(f(k-4),inv(f(k-2)));
	for(int i=0;i<n;i++) cout<<c[i]+1<<" \n"[i==n-1];
}

Measured memory_bytes: 5360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using sp = pair<string, p>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int N;
    cin >> N;
    map<string,vector<p>> rest;
    vector<string> city;
    rep(i,N){
        string S;
        int P;
        cin >> S >> P;
        rest[S].push_back(p(P,i));
        city.push_back(S);
    }
    sort(city.begin(),city.end());
    city.erase(unique(city.begin(), city.end()), city.end());
    sort(city.begin(),city.end());
    rep(i, city.size())
    {
        sort(rest[city[i]].begin(), rest[city[i]].end(),greater<p>());
        for (p re : rest[city[i]]){
            cout << re.second+1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;


class Solve
{
  public Solve() { }
  public static int Main()
  {
    new Solve().calc();
    return 0;
  }


  Scanner cin;

  void calc()
  {
    cin = new Scanner();
    long H = cin.nextLong();
    long W = cin.nextLong();

    if (H == 1 || W == 1)
    {
      Console.WriteLine("1");
      return;
    }
     
    bool dividableBy2 = H % 2 == 0 || W % 2 == 0;
    long result = H * W / 2;
    
    if (!dividableBy2)
    {
      result++;
    }

    Console.WriteLine(result.ToString());
  }
}
class Modulo
{
  private const int M = 1000000007;
  private readonly int[] m_facs;
  public int Mul(int a, int b)
  {
    return (int)(Math.BigMul(a, b) % M);
  }
  public Modulo(int n)
  {
    m_facs = new int[n + 1];
    m_facs[0] = 1;
    for (int i = 1; i <= n; ++i)
    {
      m_facs[i] = Mul(m_facs[i - 1], i);
    }
  }
  public int Fac(int n)
  {
    return m_facs[n];
  }
  public int Pow(int a, int m)
  {
    switch (m)
    {
      case 0:
        return 1;
      case 1:
        return a;
      default:
        int p1 = Pow(a, m / 2);
        int p2 = Mul(p1, p1);
        return ((m % 2) == 0) ? p2 : Mul(p2, a);
    }
  }
  public int Div(int a, int b)
  {
    return Mul(a, Pow(b, M - 2));
  }
  public int Ncr(int n, int r)
  {
    if (n < r) { return 0; }
    if (n == r) { return 1; }
    int res = Fac(n);
    res = Div(res, Fac(r));
    res = Div(res, Fac(n - r));
    return res;
  }
}

class Scanner
{
  string[] s;
  int i;

  char[] cs = new char[] { ' ' };

  public Scanner()
  {
    s = new string[0];
    i = 0;
  }

  public string next()
  {
    if (i < s.Length) return s[i++];
    string st = Console.ReadLine();
    while (st == "") st = Console.ReadLine();
    s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
    if (s.Length == 0) return next();
    i = 0;
    return s[i++];
  }

  public int nextInt()
  {
    return int.Parse(next());
  }
  public int[] ArrayInt(int N, int add = 0)
  {
    int[] Array = new int[N];
    for (int i = 0; i < N; i++)
    {
      Array[i] = nextInt() + add;
    }
    return Array;
  }

  public long nextLong()
  {
    return long.Parse(next());
  }

  public long[] ArrayLong(int N, long add = 0)
  {
    long[] Array = new long[N];
    for (int i = 0; i < N; i++)
    {
      Array[i] = nextLong() + add;
    }
    return Array;
  }

  public double nextDouble()
  {
    return double.Parse(next());
  }


  public double[] ArrayDouble(int N, double add = 0)
  {
    double[] Array = new double[N];
    for (int i = 0; i < N; i++)
    {
      Array[i] = nextDouble() + add;
    }
    return Array;
  }
}


Measured memory_bytes: 11092
N = int(input())
S = []
for i in range(N):
    S.append(input())

count = {}
for s in S:
    count[s] = count.get(s, 0) + 1
max_count = max(count.values())
ret = []
for k in count.keys():
    if count[k] == max_count:
        ret.append(k)
ret = sorted(ret)
for r in ret:
    print(r)


Measured memory_bytes: 35220
-- ITP1_1_D : watch
strtoint :: String -> Integer
strtoint xs = read xs :: Integer

watch :: Integer -> [Integer] 
watch n = (h:m:s:[])
    where
      h =  n `div` 3600
      m = (n `mod` 3600) `div` 60
      s = (n `mod` 3600) `mod` 60

watchtostr :: [Integer] -> String
watchtostr (h:m:s:[]) = show h ++ ":" ++ show m ++ ":" ++ show s

main = do
  str <- getLine
  putStrLn $ watchtostr $ watch $ strtoint str

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()

int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;


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

    int t = 1, te = 0;
    // cin>>t;
    while (t--) {
        ll n, a, b;

        cin >> n >> a >> b;

        ll res = (n / (a + b));
        res*=a;

        if(a!=0){
           res += min(n % (a + b),a);  
        }
       

        printf("%lld\n", res);


        //printf("Case %d: ",++te);
    }
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define PrintArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;
#define PrintPairs(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i].fi <<"," << cont[__i].se<<")";} cout<<endl;
#define Print(v) cout<<v<<endl;
#define PDBG() cout<<"Line:"<<__LINE__<<endl;
#define PrintArray2D(cont, fh, th, fw, tw) for(int __i=fh;__i<th;++__i){for(int __j=fw;__j<tw;++__j) {cout<<cont[__i][__j]<<" ";} cout<<endl;}cout<<endl;
#define Resize(cont,W,V) cont.resize(W,V);
#define Resize2D(cont,H,W,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W,V);
#define Resize3D(cont,H,W,D,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W);for(int i=0;i<H;++i)for(int j=0;j<W;++j)cont[i][j].resize(D,V);
/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 * priority_queue<int,vector<int>, greater<int>> Q;
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
/*
struct PairComp{
    int operator()(P l, P r) const {
        return l.fi==r.fi?l.se<r.se:l.fi<r.fi;
    }
};*/
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;

int main() {
    cout.precision(15);
    cout << fixed;
    ll N;
    cin >> N;
    cout<<(1000-(N%1000))%1000<<endl;
}


Measured memory_bytes: 3628
import sys 
sys.setrecursionlimit(10**9)
def recursion(n):
  if n==0:
    return 1
  if n<3:
    return 0
  if n in dp:
    return dp[n]
  cnt=0
  for i in range(3,n+1):
    cnt+=recursion(n-i)
  dp[n]=cnt%mod
  return dp[n]
dp={}
mod=10**9+7
num=int(input())
print(recursion(num)%mod)

Measured memory_bytes: 68448
#include<bits/stdc++.h>
using namespace std;
int a[15]={111,222,333,444,555,666,777,888,999};
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<9;i++){
		if(a[i]>=n){
			printf("%d\n",a[i]);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(a))
#define prq priority_queue
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int n,a[101010];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n;
	fo(i,0,n)cin>>a[i];
	ll ans=0;
	fo(i,0,n-1){
		ans+=a[i]/2;
		if(a[i]%2==1&&a[i+1]>0){
			ans++;
			a[i+1]--;
		}
	}
	cout<<ans+a[n-1]/2<<endl;
	return 0;
}

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

int main()
{
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    ll ans = 100000000000;
    for (int k = 0; k <= 100000; k++)
    {
        ll X2 = max(X - k, ll(0));
        ll Y2 = max(Y - k, ll(0));
        ans = min(ans, X2 * A + Y2 * B + 2 * C * k);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, a, b, c, d;
		int min = Integer.MAX_VALUE;
		int x1, y1, x2, y2;
		int x3, y3, x4, y4;
		
		n = sc.nextInt();
		a = sc.nextInt() - 1;
		b = sc.nextInt() - 1;
		c = sc.nextInt() - 1;
		d = sc.nextInt() - 1;
		
		for (int i = 1; i <= n; i++) {
			x1 = a % i;
			y1 = a / i;
			x2 = b % i;
			y2 = b / i;
			x3 = c % i;
			y3 = c / i;
			x4 = d % i;
			y4 = d / i;
			
			int k1 = Math.abs(x1 - x2) + Math.abs(y1 - y2);
			int k2 = Math.abs(x3 - x4) + Math.abs(y3 - y4);
			min = Math.min(min, k1 + k2);
		}
		
		System.out.println(min);
	}
}

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

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

    vector<int> vs[26], vt[26];
    rep(i, s.length()) vs[s[i] - 'a'].push_back(i);
    rep(i, t.length()) vt[t[i] - 'a'].push_back(i);

    sort(vs, vs + 26);
    sort(vt, vt + 26);

    rep(i, 26) {
        if (vs[i] != vt[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

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

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

typedef long long ll;

#define MAX_N 10000

struct Edge {
    int to;
    int weight;
    Edge(int t, int w)
        : to(t)
        , weight(w)
    {
    }
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    vector<vector<int>> x(N, vector<int>(N));
    vector<vector<int>> y(N, vector<int>(N));
    rep(i, N)
    {
        cin >> A.at(i);
        rep(j, A.at(i))
        {
            int input_x, input_y;
            cin >> input_x >> input_y;
            input_x--;
            x.at(i).at(j) = input_x;
            y.at(i).at(j) = input_y;
        }
    }

    int max = 0;
    for (int temp = 0; temp < (1 << N); temp++) {
        bool exitFlag = false;
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            // i番目の人が正直者だと仮定している
            if (temp & (1 << i)) {
                for (int j = 0; j < A.at(i); j++) {
                    int input_x = x.at(i).at(j); // 証言の対象
                    if (y.at(i).at(j) == 0 && (temp & (1 << input_x))) { //不親切者であると証言しているが実際は正直者
                        exitFlag = true;
                        // cout << "temp:" << temp << endl;
                        // cout << "cnt:" << cnt << endl;
                    }
                    if (y.at(i).at(j) == 1 && !(temp & (1 << input_x))) { //正直者であると証言しているが実際は不親切者
                        exitFlag = true;
                        // cout << "temp:" << temp << endl;
                        // cout << "cnt:" << cnt << endl;
                    }
                    if (exitFlag)
                        break;
                }
                if (exitFlag)
                    break;
                cnt++;
            }
            if (exitFlag)
                break;
        }
        if (exitFlag)
            cnt = 0;
        chmax(max, cnt);
    }

    cout << max << endl;
}


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

int main(void){
	char s[12];
	char t[12];
	int n,l;

	scanf("%s",s);
	scanf("%s",t);


	n = strlen(s);
	l = strlen(t);


	if(	strncmp(s,t,n)==0){
		printf("Yes\n");
	}else{
		printf("No\n");

	}




	return 0;
}

Measured memory_bytes: 1688
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      
      	String a = sc.next();
      
      	String b = a.toLowerCase();
      
      	if(a.equals(b))
          System.out.print("a");
      else 
          System.out.print("A");
    }
}

Measured memory_bytes: 27004
//author: Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    ll a=0,b=0,k=0;
    cin>>a>>b>>k;
    if(k<=a)
      cout<<a-k<<" "<<b;
    else if(k>a+b)
      cout<<0<<" "<<0;
    else
      cout<<0<<" "<<b-(k-a);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int n;cin>>n;
  std::vector<int> a(n),b(n);
  for(int i=0;i<n;i++) cin>>a[i]>>b[i];
  ll dp[n+1][n+1];
  for(int i=0;i<n;i++)for(int j=0;j<n;j++) dp[i][j]=INF;
  for(int i=0;i<n;i++) dp[i][i]=0;
  for(int k=1;k<=n-1;k++){
      for(int i=0;i+k<n;i++){
          for(int j=i;j<i+k;j++){
              ll cost=a[i]*b[j]*a[j+1]*b[i+k];
              dp[i][i+k]=min(dp[i][i+k],dp[i][j]+dp[j+1][i+k]+cost);
          }
      }
  }
  cout<<dp[0][n-1]<<endl;
}

Measured memory_bytes: 3100
a, b, m = map(int, input().split())
a =list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(m)]

aMin = min(a)
bMin = min(b)
ans = aMin + bMin

for xycm in xyc:
    x = xycm[0] - 1
    y = xycm[1] - 1
    c = xycm[2]
    p = a[x] + b[y] - c

    if p < ans:
        ans = p

print(ans)

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

typedef long long ll;

const int MAX_N = 100010;
int par[MAX_N];
int rnk[MAX_N];

void init(int n) {
    rep(i,n) {
        par[i] = i;
        rnk[i] = 0;
    }
}

int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rnk[x] < rnk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int main() {
    ll N, M, X, Y, Z;
    cin >> N >> M;
    init(N);
    rep(i, M) {
        cin >> X >> Y >> Z;
        unite(X - 1, Y - 1);
    }
    vector<int> c(N, 0);
    rep(i, N) {
        c[find(i)] = 1;
    }
    int ans = 0;
    rep(i, N) {
        ans += c[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
arrA = list(map(int,input().split()))

ans = 10001000
for i in range(n):
    num = sum(arrA[:i]) - sum(arrA[i:])
    ans = min(ans,abs(num))

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int x;
    cin>>x;
    vector<int> primes;
    primes.push_back(2);
    int ans;
    while(true){
        int cnt=0;
        for(int i=2;i*i<=x;i++){
            if(0==x%i){
                cnt++;
            }
        }
        if(0==cnt){
            cout<<x<<endl;
            break;
        }
        x++;
    }
    
    return 0;
}

Measured memory_bytes: 256
using System;

public class Test
{
	public static void Main()
	{
            string[] data = Console.ReadLine().Split();
            int a = 0, b = 0;//?¨????????±?
            int ans = 0, amari = 0;//?¨??????????
            double fdou = 0;
            a = int.Parse(data[0]);
            b = int.Parse(data[1]);
            ans = a / b;
            amari = a % b;
            fdou = (double)a / (double)b;
            Console.WriteLine("{0} {1} {2:0.00000}",ans,amari,fdou);
            Console.ReadLine();		
	}
}

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

int r,g,b;

int main(){
  cin >> r >> g >> b;
  int num;
  num = 100*r + 10*g + b;
  if(num % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
A = input()
n = len(A)
alpha_dic = {}

for a in A:
    alpha_dic[a] = 1 + alpha_dic.get(a, 0)

ans = n * (n-1) //2
for key, num in alpha_dic.items():
    ans -= (num * (num-1) // 2)
print(ans+1)


Measured memory_bytes: 3500
N, M = [int(i) for i in input().split()]
corrects = [0 for _ in range(N)]
wrongs = [0 for _ in range(N)]
for m in range(M):
  p, s = input().split()
  p = int(p)
  if corrects[p-1] == 0:
    if s == "WA":
      wrongs[p-1] += 1
    elif s == "AC":
      corrects[p-1] = 1
      corrects.append(p)
  
total_wrongs = 0
total_correct = 0
for i in range(N):
  if corrects[i] > 0:
      total_wrongs += wrongs[i]
      total_correct += 1
  
print(total_correct, total_wrongs)

Measured memory_bytes: 8648