akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  int n, x;
  cin >> n >> x;
  vi l(n+1);
  REP(i, n) cin >> l[i];
  int d = 0;
  int ans = n+1;
  REP(i, n+1) {
    if (d > x) {
      ans = i;
      break;
    }
    d += l[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll inf=1e18;

int main(void){
	ll N,M,R,r[10],A,B,C,d[210][210],ans=inf;
	scanf("%lld%lld%lld",&N,&M,&R);
	reg(i,1,R)scanf("%lld",&r[i]);
	reg(i,1,N){
		reg(j,1,N)d[i][j]=inf;
		d[i][i]=0;
	}
	rep(i,M){
		scanf("%lld%lld%lld",&A,&B,&C);
		d[A][B]=min(C,d[A][B]);
		d[B][A]=min(C,d[B][A]);
	}
	//ワーシャル・フロイトで全点間の距離求める
	reg(k,1,N){
		reg(i,1,N){
			reg(j,1,N){
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
	// cout<<"---"<<endl;;
	// reg(i,1,N){
	// 	reg(j,1,N){
	// 		cout<<d[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	//R!通り全てを調べる
	//next_permutation
    vector<int> v(R);
    iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
    do {
        ll sum=0;
		rep(i,R-1)sum+=d[r[v[i]]][r[v[i+1]]];
		ans=min(ans,sum);
    } while( next_permutation(v.begin(), v.end()) );     // 次の順列を生成

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

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
//stack<int> st;
// cout << << endl;
// cin >> ;
template<typename T>
T gcd(T a, T b){
	return b != 0 ? gcd(b, a % b) : a;
}    

template<typename T>
vector<pair<T, int>> prime_factorization(T n) {
    vector<pair<T, int>> res;
    for (T i = 2; i*i <= n; i++) {
        int cnt = 0;
        while (n % i == 0) {
            n /= i;
            cnt++;
        }
        if (cnt > 0) res.push_back(make_pair(i,cnt));
    }
    if (n > 1) res.push_back(make_pair(n,1));
    return res;
}

int main(){
    ll a,b,x=0,y=0,d=0,n,h,w,k,max=-100,ans=0,ptr=0,sum=0;
    string s;
    cin >> a >> b;
    a = gcd(a,b);
    cout << prime_factorization(a).size()+1 << endl;
    return 0;
}

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

int main() {
	string s;
	cin >> s;
	string now = "";
	for (char c : s) {
		if (c == '0' || c == '1') now.push_back(c);
		else if (now != "") now.pop_back();
	}
	cout << now << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int d,l,x,y;
  cin>>d>>l;
  x=d/l;
  y=d%l;
  if(d>l){
    cout<<x+y<<endl;  
  }
  else if(d<l){
      cout<<y<<endl;
  }
  else{
      cout<<x<<endl;
  }
  

  
  

}


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

int main() {
  int X, Y;
  cin >> X >> Y;
  bool q = true;
  
  for (int i = 0; i <= X; i++) {
    for (int j = 0; j <= X - i; j++) {
      if (i * 2 + j * 4 == Y && i + j == X) {
        q = false;
      }
    }
  }
  
  if (!q) {
    cout << "Yes" << endl;
  } else if (q) {
    cout << "No" << endl;
  }
}


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

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

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

    sort(a, a + n);

    ll ans = 1;
    ll e = 10e17;

    for(int i = 0; i < n; i++){
        if(ans != 0 && a[i] > e / ans){
            ans = -1;
            break;
        }

        ans *= a[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 4416
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    while(N>=0){
      if(N %4 == 0 || N %7 == 0){
        System.out.println("Yes");
        return;
      }
      N -= 11;
    }
    System.out.println("No");
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <utility>
#include <stdint.h>
#include <cmath>

using namespace std;

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

  if (N==1)
    cout << 1 << endl;
  else
    cout << ceil(log(N)/log(K)) << endl;

  return 0;
}


Measured memory_bytes: 256
//F5で実行 Shift+F5で停止
//F9でブレークポイント
#include<cmath>
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
//Shift+PageUpで上部の大半を選択できる
// 1e18 = 10の18乗

int N;
int A[100];
int K, M;
string S;
int ans;

//ｎ科目のテスト、ｋ点満点、目標ｍ点以上
//ｎ－１科目のテストはすでに受けて、Ai点だった。
//あと１科目のテストが何点なら、平均点がｍ点以上になるか
void _main() {
	cin >> N >> S;
	
	ans = 0;
	string c = "ABC";

	rep(i, 0, N - 2) {
		if (S.substr(i, 3) == c) ans++;
	}
	
	

	cout << ans << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = 1000000007

zeros = []
pluss = []
minuss = []

for i in range(N):
    if A[i]>0:
        pluss.append(A[i])
    elif A[i]==0:
        zeros.append(A[i])
    else:
        minuss.append(A[i])

pluss = sorted(pluss, reverse = True)
minuss = sorted(minuss)

if len(pluss) + (min(len(minuss), K)//2)*2 >= K:
    answer_type = 1
elif len(zeros) > 0:
    answer_type = 2
else:
    answer_type = 3


rest = K
if answer_type == 1:
    plus_now = 0
    minus_now = 0
    minus_counter = 0
    answer = 1
    for i in range(K):
        if plus_now < len(pluss):
            plus_target = pluss[plus_now]
        else:
            plus_target = -1000000000000
        
        if minus_now < len(minuss):
            minus_target = -minuss[minus_now]
        else:
            minus_target = -1000000000000
        
        if plus_target >= minus_target:
            answer = (answer*plus_target)%mod
            plus_now += 1
        else:
            answer = (answer*minus_target)%mod
            minus_now += 1
            minus_counter += 1

    if minus_counter%2 == 1:
        #★インデックスの有効範囲をよく考えること、勝手に-1とかなっちゃう★
        if minus_now >= len(minuss) or plus_now == 0:
            answer = answer * pow(-minuss[minus_now-1],mod-2,mod)
            answer = (answer * pluss[plus_now])%mod
        elif plus_now >= len(pluss) or minus_now == 0:
            answer = answer * pow(pluss[plus_now-1],mod-2,mod)
            answer = (answer * -minuss[minus_now])%mod
        #★割り算の時は有効桁数よく考えること★
        elif pluss[plus_now]*pluss[plus_now-1] > -minuss[minus_now]*(-minuss[minus_now-1]):
            answer = answer * pow(-minuss[minus_now-1],mod-2,mod)
            answer = (answer * pluss[plus_now])%mod
        else:
            answer = answer * pow(pluss[plus_now-1],mod-2,mod)
            answer = (answer * -minuss[minus_now])%mod

elif answer_type == 2:
    answer = 0
elif answer_type == 3:
    minuss = sorted(minuss, reverse = True)
    pluss = sorted(pluss)
    plus_now = 0
    minus_now = 0
    answer = 1
    for i in range(K):
        if plus_now < len(pluss):
            plus_target = pluss[plus_now]
        else:
            plus_target = 10000000000000
        
        if minus_now < len(minuss):
            minus_target = -minuss[minus_now]
        else:
            minus_target = 10000000000000  
        
        if plus_target <= minus_target:
            answer = (answer*plus_target)%mod
            plus_now += 1
        else:
            answer = (answer*minus_target)%mod
            minus_now += 1
    answer = answer * -1
print(answer%mod)

Measured memory_bytes: 31772
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  vector<int>L(N+2),R(N+2);
  for(int i=0;i<N;i++){
    L[i+1]=__gcd(A[i],L[i]);//cout<<L[i+1]<<" ";
  }//cout<<endl;
  for(int i=N;i>=1;i--){
    R[i]=__gcd(A[i-1],R[i+1]);//cout<<R[i]<<" ";
  }//cout<<endl;
  int MAX=0;
  for(int i=1;i<=N;i++){
    chmax(MAX,__gcd(L[i-1],R[i+1]));
  }
  cout<<MAX<<endl;
  return 0;
}

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

long long dp[35];
int main()
{
	for (auto &x : dp) x = 0;
	dp[0] = 1;
	dp[1] = 1;
	dp[2] = 2;
	for (int i = 3; i < 31; i++){
		dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
	}
	while (1){
		int n;
		cin >> n;
		if (n == 0) return 0;
		cout << dp[n] / 3650 + (dp[n]%3650 ? 1 : 0) << endl;
	}
}



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

int n,t,tarr[51],total,totalnot;
string s,x,arr[51];

int main(){
	cin>>n;
	for(int i = 1;i <= n;i++){
		cin>>s>>t;
		arr[i] = s;
		tarr[i] = t;
		total = total + t;
	}
	cin>>x;
	for(int i = 1;i <= n;i++){
		if(arr[i] != x){
			totalnot = totalnot + tarr[i];
		}else{
			totalnot = totalnot + tarr[i];
			break;
		}
	}
	cout<<total - totalnot<<endl;
}


Measured memory_bytes: 256
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var temp = toIntArr(input[0].split(' '));
	var n = temp[0];
	var x = temp[1];
	var as = toIntArr(input[1].split(' ')).sort((a,b)=>a-b);
	var ans = 0;
	for(var i = 0; i < n; i++){
		if((i===n-1 && x===as[i]) || (i<n-1 && x>=as[i])){
			ans++;
			x -= as[i];
		}else{
			break;
		}
	}
	console.log(ans);
}

Measured memory_bytes: 21192
S = input()
flg = True
for s in range(0,len(S)):
    
    if s%2 == 0 and S[s] == "L":
       
        flg = False
    elif s%2 != 0 and S[s] == "R":
        flg = False
    
if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
N, T = map(int, input().split())
min_cost = 10**9
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    else:
        min_cost = min(min_cost, c)
if min_cost != 10**9:
    print(min_cost)
else:
    print("TLE")


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

int main()
{
  string S;
  cin >> S;
  reverse(S.begin(), S.end());
  while (S.size() > 0)
  {
    if (S.size() <= 7)
    {
      if (S == "esare" || S == "maerd" || S == "resare" || S == "remaerd")
      {
        cout << "YES" << endl;
      }
      else
      {
        cout << "NO" << endl;
      }
      break;
    }
    else
    {
      if (S.substr(0, 5) == "esare" || S.substr(0, 5) == "maerd")
      {
        S = S.substr(5, S.size() - 5);
      }
      else if (S.substr(0, 6) == "resare")
      {
        S = S.substr(6, S.size() - 6);
      }
      else if (S.substr(0, 7) == "remaerd")
      {
        S = S.substr(7, S.size() - 7);
      }
      else
      {
        cout << "NO" << endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};

const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; 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;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/
string S;
int main(){
  cin >> S;
  vector<bool> used(26, 0);
  vector<ll> Rank(S.size());
  ll sum = 0;
  ll rank = 1;
  revrep(i, S.size()){
    Rank[i] = rank;
    if(used[S[i] - 'a'] == 0){
      sum++;
      used[S[i] - 'a'] = 1;
      if(sum == 26){
        rep(j, 26) used[j] = 0;
        rank++;
        sum = 0;
      }
    }
  }
  vector<ll> A[26];
  rep(i, S.size()){
    A[S[i] - 'a'].pb(i);
  }
  string ans = "";
  ll at = -1;
  ll now = rank;
  while(now){
    rep(i, 26){
      if(A[i].size() == 0 || A[i].back() <= at){
        ans += 'a' + i;
        now--;
        break;
      }
      ll next_at = *upper_bound(A[i].begin(), A[i].end(), at);
      if(Rank[next_at] < now){
        ans += 'a' + i;
        now--;
        at = next_at;
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3972
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    #print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        if i+k < len(S):
            while S[i+k] in AGCT:
                #print('k=', k)
                #print('i+k=',i+k)
                agct_tmp += S[i+k]
                if i+k+1 < len(S):
                    k +=1
                else:
                    break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')
    
    

Measured memory_bytes: 9008
void main() {
	auto N = ri;
	if(N == 1) {
		writeln("Hello World");
	} else {
		auto A = ri, B = ri;
		writeln(A + B);
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include<stdio.h>
    
    int main(){
    	int n,k,i,j,sum = 0,temp;
    	scanf("%d%d",&n,&k);
        int a[n];
    	for(i = 0;i < n;i++)
    	scanf("%d",&a[i]);
    	for(i = 0;i < n-1;i++){
            j = i;
            while (j >= 0 && a[j+1] > a[j]) {
                temp = a[j+1];
                a[j+1] = a[j];
                a[j] = temp;
                j--;
            }
    	}
    	for(i = 0;i < k;i++)
    	sum = sum + a[i];
    	printf("%d",sum);
    	
    }

Measured memory_bytes: 128
N,M=list(map(int,input().split()))
a=""
sw=[]
pattern=[]
def bit(i,turn):
    if i==N:
        pattern.append(list(turn))
    else:
        bit(i+1,turn+"0")
        bit(i+1,turn+"1")
for i in range(M):
    k=list(map(int,input().split()))
    sw.append(k)
hantei=list(map(int,input().split()))
bit(0,a)
count=0
ans=0
for i in pattern:
    sw_list=[0]*(N+1)
    for j in range(M):
        k=sw[j]
        for l in k[1:]:
            if i[l-1]=="1":
                sw_list[j]+=1
    for m in range(M):
        if sw_list[m]%2!=hantei[m]:break
    else:ans+=1
print(ans)


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

int main() {
	int a, b, wa;
	char s[13];
	cin >> a >> b;
	cin >> s;
	for (int i = 0; i < a; i++) {
	    if ('0' > s[i] || s[i] > '9') wa++;
	}
	if (s[a] != '-') wa++;
	for (int i = a + 1; i < a + b + 1; i++) {
	    if ('0' > s[i] || s[i] > '9') wa++;
	}
	if (wa == 0) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

_x, _y = map(int, input().split())


def nCk(n, k, m=10 ** 9 + 7):
    a = b = 1
    k = min(k, n - k)
    for i in range(k):
        a = (a * (n - i)) % m
        b = (b * (i + 1)) % m

    return (a * pow(b, m - 2, m)) % m


def chker(x, y):
    if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x:
        print(0)
        return

    if x == y:
        b = x // 3
        print(nCk(2 * b, b))
        return

    x, y = (x, y) if x < y else (y, x)

    b = 2 * x - y
    if b % 3 != 0:
        print(0)
        return

    d1, d2 = b // 3, x - 2 * (b // 3)
    u = d1 + d2

    print(nCk(u, d1))


chker(_x, _y)


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> cnt(n, 0);
  for(int i = 1; i < n; ++i)
  {
    if (s[i - 1] == 'A' && s[i] == 'C') { cnt[i]++; }
  }
  for(int i = 0; i < n - 1; ++i)
  {
    cnt[i + 1] += cnt[i];
  }

  int l, r;
  for(int i = 0; i < q; ++i)
  {
    cin >> l >> r;
    l--; r--;
    cout << cnt[r] - cnt[l] << endl;
  }

}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3740
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int d, t, s;
    cin >> d >> t >> s;
    int dist = t * s;
    cout << (dist >= d ? "Yes\n" : "No\n");
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	int n, m; std::cin >> n >> m;
	std::vector<int> a(n), b(m); for (auto& ai : a) std::cin >> ai; for (auto& bi : b) std::cin >> bi;
	std::vector<long long int> count_a(200001, 0), count_b(200001, 0);
	long long int result = 0LL;
	long long int sum = std::accumulate(a.begin(), a.end(), 0LL);
	for (const auto ai : a) count_a[ai]++;
	for (const auto bi : b) count_b[bi]++;
	for (auto i = 1; i < count_a.size(); ++i) count_a[count_a.size() - i - 1] += count_a[count_a.size() - i];
	for (auto i = 0; i < count_b.size(); ++i) if (count_b[i] != 0) {
		if (i * i <= count_a.size()) {
			for (const auto ai: a) result += ai % i * count_b[i];
		}
		else {
			result += sum * count_b[i];
			for (auto j = 1; i * j < count_a.size(); ++j) result -= count_a[i * j] * i * count_b[i];
		}
	}
	std::cout << result << std::endl;
}


Measured memory_bytes: 7592
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }



signed main() {
	int A, B;
	cin >> A >> B;
	cin >> A >> B;
	if (B % A == 0) {
		cout << A + B << "\n";
	}
	else {
		cout << B - A << "\n";
	}

	return 0;
}

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


int main() {
    long long n,q ;
    cin >> n >> q ;
    string s ;
    cin >> s ;

    int l[q] ;
    int r[q] ;

    for(int i=0;i<q;i++) cin >> l[i] >> r[i];

    vector<int> sum(n+1,0) ;

    for(int i=0;i<n-1;i++){
        sum[i+1] = sum[i] ;
        if(s[i]=='A' && s[i+1]=='C'){
            sum[i+1]++ ;
        }
    }


    for(int i=0;i<q;i++)
    {
        int ans = sum[r[i]-1]-sum[l[i]-1];
        cout << ans << endl ;
    }

  
	return 0;
}



Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	int[] data=new int[3];

    	int sum=0;
    	for(int i=0;i<3;i++) {

    		data[i]=sc.nextInt();
    		sum+=data[i];
    	}

    	Arrays.sort(data);


    	if(sum-data[2]==sum/2) {
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}

    }
}


Measured memory_bytes: 21844
S = str(input())
T = str(input())

s = len(S)
t = len(T)

import re

if t > s:
	print("UNRESTORABLE")
	exit()

pos = -1
wani = 0

for i in range (0, s-t+1):
	wani = 0
	for j in range (0,t):
		if	S[i+j] != T[j] and S[i+j] !='?':
			wani = 1
	if wani == 0:
		pos = i        
        
if pos == -1:
	print("UNRESTORABLE")
	exit()

A = []
for i in range (0, s):
	A.append(S[i])

for i in range (0, t):
	A[pos+i] = T[i]

for i in range (0, s):
	if A[i] == '?':
		A[i] = 'a'

print(*A, sep='')

Measured memory_bytes: 9756
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll a,b;cin>>a>>b;
  b--;a--;
  cout<<(a+b-1)/a<<endl;
}
  

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define  dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, m, src, dst;
    cin >> n >> m;
    vector<vector<int> > vvi;
    vector<set<int> > parents;
    vvi.resize(n+1);
    parents.resize(n+1);
    int parent[n+1] = {0};
    bool isRoot[n+1] = {0};
    int visited[n+1] = {0};
    for(int i=0;i<=n;++i)
    {
        parent[i] = -1;
        isRoot[i] = true;
    } 

    for(int i=0;i<(n+m-1);++i)
    {
        cin >> src >> dst;
        // dump(src);
        // dump(dst);
        isRoot[dst] = false;
        vvi[src].push_back(dst);
        parents[dst].insert(src);
    }

    // find root
    int root = 0;
    for(int i=1;i<=n;++i)
    {
        if(isRoot[i])
        {
            root = i;
        }
    }
    // cerr << "root is " << root << endl;

    // BFS from root
    deque<int> q;
    q.push_back(root);

    while(!q.empty())
    {
        int node = q.front();
        q.pop_front();
        // dump(node);
        for(auto &node_dst : vvi[node])
        {
            visited[node_dst] += 1;

            if(parents[node_dst].size() == visited[node_dst] && !vvi[node_dst].empty())
            {
                q.push_back(node_dst);
            }
            parent[node_dst] = node;
        }
    }

    for(int i=1;i<=n;i++)
    {
        if(parent[i] == -1)
        {
            cout << 0 << endl;
        }
        else
        {
            cout << parent[i] << endl;
        }
        
    }
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int H, W;
	cin >>H >>W;
	vector<VI> c(10, VI(10));
	rep(i, 10) rep(j, 10) cin >>c[i][j];
	vector<VI> a(H, VI(W));
	rep(i, H) rep(j, W) cin >>a[i][j];
	
	rep(k,10) rep(i,10) rep(j,10) c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
	
	ll ans =0;
	rep(i,H) rep(j,W) if(a[i][j] !=1 && a[i][j] !=-1){
		ans += c[a[i][j]][1];
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<tuple>
#include<sstream>
#include<functional>
#include<list>
#include<queue>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
typedef pair<ll, ll> p;
typedef vector<int> vec;
using Graph = vector<vector<int>>;
using graph = vector<vector<ll>>;

const int inf = 1e9+7;
const long long MOD = 1000000007;

// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const vector<ll>& S) {
        int n = (int)S.size();
        hash1.assign(n + 1, 0);
        hash2.assign(n + 1, 0);
        power1.assign(n + 1, 1);
        power2.assign(n + 1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i + 1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i + 1] = (power1[i] * base1) % mod1;
            power2[i + 1] = (power2[i] * base2) % mod2;
        }
    }

    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r - l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r - l] % mod2;
        if (res2 < 0) res2 += mod2;
        return { res1, res2 };
    }
};


int main() {
    int n;
    vector<int> k;
    cin >> n;
    vector<ll> a(n), b(n), A(n*2), B(n);
    rep(i, n) cin >> a[i];
     rep(i, n)cin >> b[i];
    rep(i, n-1) {
        A[i] = a[i] ^ a[i + 1];
        B[i] = b[i] ^ b[i + 1];
        A[i+n]= a[i] ^ a[i + 1];
    }
    A[n - 1] = a[n - 1] ^ a[0];
    B[n - 1] = b[n - 1] ^ b[0];
    A[2*n-1]= a[n - 1] ^ a[0];
    RollingHash rha(A),rhb(B);
    p pb = rhb.get(0, n);
    rep(i, n) {
        if (pb == rha.get(i, i + n)) {
            k.push_back(i);
        }
    }
    rep(i, k.size()) {
        int x = a[k[i]] ^ b[0];
        bool flg = true;
        
        if (flg)cout << k[i] << " " << x << endl;
    }
    return 0;
}

Measured memory_bytes: 31212
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        String f = "CODEFESTIVAL2016";
        String S = ns();

        int cnt = 0;
        for (int i = 0; i < f.length(); i++) {
            if (S.charAt(i) != f.charAt(i)) cnt++;
        }

        out.println(cnt);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8276
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n;
	ll h, w;
	cin >> n >> h >> w;
	vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];
	int cnt = 0;
	rep(i, n) {
		if (a[i] >= h&&b[i] >= w) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

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

	int v[100100];
	rep(i, 100000) v[i] = 0;

	for (int i = 0; i < 10000; i += (a + b)){
		reps(j, i, i + a) v[j] = 1;
	}

	int cnt = 0;
	for (int i = c - 1; i <= 10000; i += 60){
		cnt++;
		if(v[i] == 1){
			printf("%d\n", c + ((cnt - 1) * 60));
			return 0;
		}
	}

	printf("-1\n");
	return 0;
}

Measured memory_bytes: 3612
#include <queue>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef unsigned long long ull;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 2005, MAXL = 2005 / 64 + 2;

bitset <MAX> ne_rel[MAX];
ull ne_rel_ull[MAX][MAXL];
bitset <MAX> manji[MAX];
bitset <MAX> smije;
bitset <MAX> ostalo;
int n;
int p[MAX];
int rje[MAX];
int done[MAX];
int indk[MAX], brk;

void bfs()
{
  ull nodovi[MAXL];
  REP(i, n)
    if (!done[i])
      nodovi[i/64] |= ((ull) 1) << (i % 64);

  queue <int> Q;

  brk = 0;
  REP(i, n) {
    if (nodovi[i/64] & ((ull) 1) << (i % 64)) {
      nodovi[i/64] ^= ((ull) 1) << (i % 64);
      Q.push(i);
      
      for (; !Q.empty();) {
	int tmp = Q.front(); Q.pop();
	indk[tmp] = brk;
	//	TRACE(tmp _ brk);

	REP(j, MAXL) {
	  ull val = nodovi[j] & ne_rel_ull[tmp][j];
	  for (; val; ) {
	    ull koji = val & (-val);
	    int ind = __builtin_ctzll(koji);
	    
	    nodovi[j] ^= ((ull) 1) << ind;
	    val ^= ((ull) 1) << ind;
	    Q.push(64 * j + ind);
	  }
	}
      }
      
      brk++;
    }
  }  
}

int main()
{
  scanf("%d", &n);
  REP(i, n) scanf("%d", &p[i]);

  sort(p, p + n);

  REP(i, n)
    REP(j, n)
    if (__gcd(p[i], p[j]) > 1) {
      ne_rel_ull[i][j/64] |= ((ull) 1) << (j % 64);    
      ne_rel[i][j] = 1;
    }

  REP(i, n) smije[i] = 1;
  REP(i, n) ostalo[i] = 1;

  REP(i, n) {
    bfs();

    int ima[MAX];
    memset(ima, 0, sizeof ima);
    int poklopio = 0;

    //    TRACE(brk);
    

    int ind = -1;
    REP(j, n) {
      if (done[j]) continue;
      if (smije[j]) {
	//	TRACE(j _ smije[j]);

	if (!ima[indk[j]]) {
	  ima[indk[j]] = 1;
	  poklopio++;
	}

	if (poklopio == brk) {
	  ind = j;
	  break;
	}
      }
    }

    assert(ind != -1);

    //postavi ind
    done[ind] = 1;
    smije[ind] = 0;
    rje[i] = ind;
    //    TRACE(i _ p[rje[i]]);      

    REP(k, n) {
      if (ne_rel[ind][k])
	smije[k] = 1;
      else if (smije[k] && k < ind)
	smije[k] = 1;
      else
	smije[k] = 0;
    }      
  }    

  REP(i, n)
    printf("%d ", p[rje[i]]);
  printf("\n");

  return 0;
}


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

using namespace std;

int main(){
    string s;
    cin >> s;
    int len = s.size();
    if(len%2==1){
        len -= 1;
    }else{
        len -= 2;
    }
    while(1){
            bool ok = true;
        for (int i = 0; i < len/2;i++){
            if(s[i]!=s[len/2+i])
                ok = false;
        }
        if(ok){
            cout << len;
            return 0;
        }
        len -= 2;
    }
}

Measured memory_bytes: 256
n = int(input())
la = [int(w) for w in input().split()]

ans = sum([abs(w)for w in la])
if len([w for w in la if w < 0]) % 2 == 0:
    print(ans)
    exit()

sla = sorted([abs(w)for w in la])
ans -= sla[0]*2
print(ans)


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



int main() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	

	printf("%d", (a + b)*c / 2);




}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll anss=0;

int main()
{
ll n,m;
cin >> n>>m;

bool t[10][10]={};
ll k;
rep(i,m){
    
    cin >> k;
    rep(j,k){
        ll a;
        cin >> a;
        t[i][a-1]=true;
    }
}

ll ans[m];

rep(i,m){
    ll ki;
    cin >> ki;
    ans[i]=ki;
}

//0から2^d乗まで
for (int bit = 0; bit < (1<<n); ++bit) {

    ll ch[m]={};
    
//各ビットを下から見ていく
    rep(j,n){

//jビット目が1なら処理を行う
        if(bit>>j&1){
            rep(ii,m){
                if(t[ii][j])ch[ii]++;
            }
            
        }
    }
    bool chh=1;
    rep(i,m){
        if(ans[i]!=ch[i]%2)chh=0;
    }
    if(chh)anss++;
}
cout << anss << endl;
return 0;
}

Measured memory_bytes: 256
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if V - W > 0:
  if abs(B - A) - T * abs(V - W) <= 0:
    result = "YES"
  else:
    result = "NO"
else:
  result = "NO"
print(result)

Measured memory_bytes: 9184
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,c=INTM()
    print(c//a*b)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main(){
		new AOJ1141().doIt();
	}
	
	class AOJ1141{
		int a,d,n;
		
		boolean prime[];
		int MAX = 1000000;
		
		void solve(){
			int cnt = 0;
			int result = -1;
			for(int i=a;i<MAX;i+=d){
				if(prime[i])cnt++;
				if(cnt==n){
					result = i;
					break;
				}
			}
			System.out.println(result);
		}
		
		void doIt(){
//			System.out.println(MAX);
			prime = new boolean[MAX];
			Arrays.fill(prime, true);prime[0] = false;prime[1] = false;
			for(int i=0;i<MAX;i++)if(prime[i]){
				for(int s=i+i;s<MAX;s+=i)prime[s] = false;
			}
			while(in.hasNext()){
				a = in.nextInt();
				d = in.nextInt();
				n = in.nextInt();
				if(a+d+n==0)break;
				solve();
			}
		}
	}
	
}

Measured memory_bytes: 23212
def main():
    n, k = [int(x) for x in input().split()]
    scores = [int(x) for x in input().split()]
    # zip にすると2つのリストを作るのか，これよりも少し時間とメモリ増。
    print('\n'.join('Yes' if scores[index] < new else 'No'
                    for index, new in enumerate(scores[k:])))


if __name__ == '__main__':
    main()


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

int main(void){
	int i;
	int N;
	int A[100001];
	int hoge[100001]={0};
	int cnt=0;

	scanf("%d",&N);
	int ans = N;
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
		hoge[A[i]]++;
	}

	for(i=1;i<100001;i++){
		if(hoge[i]>1)cnt+=(hoge[i] - 1);
	}

	if(cnt%2==0){ans -= cnt;}
	else{ans -= cnt+1;}
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List
import Control.Monad

f :: Int -> (Int,Int) -> Maybe Int
f aa (a,b) =
    let aa' = aa + a
      in if aa' <= b then Just aa' else Nothing

main :: IO ()
main = do
    _ <- getLine
    ab <- map ((\[a,b] -> (a,b)) . map (fst . fromJust . BS.readInt) . BS.words)
        . BS.lines <$> BS.getContents :: IO [(Int,Int)]
    putStrLn $
        case foldM f 0 $ sortOn snd ab of
            Just _  -> "Yes"; Nothing -> "No"

Measured memory_bytes: 83580
import math
import sys

_num_inversions = 0

def merge_sort(A, left, right):
    """数列 A を in place に昇順にソートする。

    left は A の先頭のインデックス、right は末尾のインデックスのひとつ後ろ。
    """
    if left + 1 < right:
        mid = (left  + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)

def merge(A, left, mid, right):
    """ソート済みの部分列をマージする。

    数列 A の left から mid - 1 の要素、mid から right - 1 までの
    ２つの部分列はソート済みである。これをマージして、left から right - 1 まで
    ソートする。
    """
    first = A[left:mid]
    first.append(math.inf)  # 番兵
    second = A[mid:right]
    second.append(math.inf) # 番兵

    global _num_inversions
    i = j = 0
    for k in range(left, right):
        if first[i] <= second[j]:
            A[k] = first[i]
            i += 1
        else:
            A[k] = second[j]
            j += 1
            _num_inversions += len(first) - i - 1


if __name__ == '__main__':
    n = int(input())
    A = list(map(int, sys.stdin.readline().split()))

    merge_sort(A, 0, n)
    print(_num_inversions)


Measured memory_bytes: 29072
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

enum Loc{
	Left,
	Right,
	Top,
	Bottom,
};

struct Info{
	int x,y;
};

int N,unite_count;
int* boss,*height;

int get_boss(int id){
	if(boss[id] == id)return id;
	else{
		return boss[id] = get_boss(boss[id]);
	}
}

int isSame(int x,int y){
	return get_boss(x) == get_boss(y);
}

void unite(int x,int y){
	x = get_boss(x);
	y = get_boss(y);

	if(x == y)return;

	if(height[x] > height[y]){

		boss[y] = x;

	}else if(height[x] < height[y]){

		boss[x] = y;

	}else{ //height[x] == height[y]

		boss[y] = x;
		height[x]++;
	}

	unite_count++;
}

int main(){

	int N,W,H;
	scanf("%d %d %d",&N,&W,&H);

	boss = new int[N];
	height = new int[N];

	for(int i = 0; i < N; i++){
		boss[i] = i;
		height[i] = 0;
	}

	Info* info = (Info*)malloc(sizeof(Info)*(N));
	vector<int> X[W+1],Y[H+1];

	int min_x = BIG_NUM,min_y=BIG_NUM,max_x=0,max_y=0;

	for(int id = 0; id < N; id++){
		scanf("%d %d",&info[id].x,&info[id].y);
		X[info[id].x].push_back(id);
		Y[info[id].y].push_back(id);
		min_x = min(min_x,info[id].x);
		min_y = min(min_y,info[id].y);
		max_x = max(max_x,info[id].x);
		max_y = max(max_y,info[id].y);
	}

	for(int i = 1; i <= W;i++){

		if(X[i].size() <= 1)continue;
		for(int k = 0; k < X[i].size()-1;k++){
			for(int p = k+1; p < X[i].size();p++){
				unite(X[i][k],X[i][p]);
			}
		}
	}

	for(int i = 1; i <= H; i++){

		if(Y[i].size() <= 1)continue;
		for(int k = 0; k < Y[i].size()-1;k++){
			for(int p = k+1; p < Y[i].size();p++){
				unite(Y[i][k],Y[i][p]);
			}
		}
	}

	int group_num = 0;
	for(int i = 0; i < N; i++){
		if(boss[i] == i){
			group_num++;
		}
	}

	int kabe_num = 0,tmp;
	if(min_x == 1 || max_x == W || min_y == 1 || max_y == H){
		kabe_num = 1;
	}

	int ans = unite_count;

	if(group_num != 1){
		tmp = group_num-kabe_num;

		ans += tmp + group_num-1;
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 10132
n, a = map(int, input().split())
x = list(map(int, input().split()))
M = max(x)
M = max(M, a)
dp = [[[0]*(n*M+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for j in range(n):
    for k in range(n+1):
        for s in range(n*M+1):
            if dp[j][k][s]:
                dp[j+1][k][s] += dp[j][k][s]
                dp[j+1][k+1][s + x[j]] += dp[j][k][s]

ans = 0
for k in range(1, n+1):
    ans += dp[n][k][k*a]
print(ans)


Measured memory_bytes: 62960
t1, t2 = list(map(int, input().split()))
a1, a2 = list(map(int, input().split()))
b1, b2 = list(map(int, input().split()))

a1 *= t1
a2 *= t2
b1 *= t1
b2 *= t2

if a1 > b1:
    l1 = a1
    l2 = a2
    s1 = b1
    s2 = b2
else:
    l1 = b1
    l2 = b2
    s1 = a1
    s2 = a2


if l1 + l2 == s1 + s2:
    print('infinity')
elif l1 + l2 < s1 + s2:
    lim = l1 - s1
    if lim % (s1+s2-l1-l2):
        print(1 + 2 * (lim // (s1+s2-l1-l2)))
    else:
        print(2 * (lim // (s1+s2-l1-l2)))
else:
    print(0)


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

int main() {
	int n, d;
	cin >> n >> d;
	vector<vector<int>> v(n, vector<int>(d));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> v[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int a = 0;
			for (int k = 0; k < d; k++) {
				int diff = abs(v[i][k] - v[j][k]);
				a += diff * diff;
			}

			bool flag = false;
			for (int k = 0; k <= a; k++) {
				if (k * k == a) {
					flag = true;
				}
			}
			if (flag) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
N,L=map(int,input().split())
taste=0
if L>=0:
    for i in range(2,N+1):
        taste=taste+L+i-1
elif L+N-1>=0:
    for i in range(1,N+1):
        taste=taste+L+i-1
else:
    for i in range(1,N):
        taste=taste+L+i-1

print(taste)

Measured memory_bytes: 3060