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

int main () {
	
	int n=0;
	string s1="", s2="";

	cin >> n >> s1 >> s2;

	long long int res = 1;

	int idx=0, ant=0;

	if (s1[0] == s2[0]) { res = 3; idx=1; ant=1;}
	else {res=6; idx=2; ant=2;}

	for (int i=idx; i<n; i++) {

		if (s1[i] == s2[i]) {

			if (ant == 1) res*=2;
			else res*=1;

			ant=1;
		}
		else {

			if (ant == 1) res*=2;
			else res*=3;

			ant=2;
			i++;
		}

	}

	cout << res%1000000007 << endl;



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define DBG false
using namespace std;
 
int main(){
    int n;
    long long cr=0, cg=0, cb=0;
    cin >> n; 
 
    string s;
    cin >> s;
 
    for(int i=0; i<n; i++){
        if(s[i] == 'R') cr++;
        if(s[i] == 'G') cg++;
        if(s[i] == 'B') cb++;
    }
    long long sum = cr * cg * cb;
 
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int k = j + (j - i);
            if(k >= n) break;
            if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) sum--;
        }
    }
 
    cout << sum << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstring>
#include<cstdio>
using namespace std;
unsigned long long N,a[110],X;
unsigned long long ji(unsigned long long x)
{
	if(a[x]) return a[x];
	if(x>0)
	a[x]=ji(x-1)*2+2;
}
int main()
{
	
	 cin>>X;
	 a[0]=2;
	 ji(X);
     cout<<a[X]<<endl;
    return 0;	
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull; 
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, x, a;
    cin >> n >> m >> x;
    vi v(n+1);
    FOR(i,0,m){
        cin >> a;
        v[a]++;
    }
    int c1 = 0, c2 = 0;
    FOR(i,x,n+1){
        c1 += v[i];
    }
    for(int i = x; i >= 0; i--){
        c2 += v[i];
    }
    cout << min(c1,c2) << endl;
}   

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>

#define sint(i) scanf("%d",&i);
#define sintt(i,j) scanf("%d%d",&i,&j);
#define sinttt(i,j,k) scanf("%d%d%d",&i,&j,&k);
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int mato[501501];

int main(){
	while(1){
		int n,m;
		sintt(n,m);
		
		if(n==0)break;
		
		int mat[1001];
		mat[0]=0;
		rep(i,n){
			sint(mat[i+1]);
		}
		n++;
		int cn=0;
		rep(i,n){
			rep(j,n-i){
				mato[cn]=mat[j]+mat[j+i];
				cn++;
			}
		}
		
		sort(mato,mato+cn);
		
		/*
		rep(i,cn){
			printf("%d ",mato[i]);
		}puts("");
		*/
		int maxi=0;
		rep(i,cn){
			int *nn=lower_bound(mato,mato+cn,m-mato[i])-1;
			if(*nn+mato[i]>m){
				break;
			}
			maxi=max(maxi,mato[i]+*nn);
		}
		printf("%d\n",maxi);
	}
}

Measured memory_bytes: 2832
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: u64, b: u64, c: u64
    }

    let ret = if a * c > b {
        b / a
    } else {
        c
    };
    println!("{}", ret);
}

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

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  int area[4] = {0, w, 0, h};
  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1 || a == 3)
      area[a-1] = max(area[a-1], a < 3 ? x : y);
    else
      area[a-1] = min(area[a-1], a < 3 ? x : y);
  }
  int x = max(0, (area[1] - area[0]));
  int y = max(0, (area[3] - area[2]));
  cout << x * y << endl;
}

Measured memory_bytes: 256
#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 vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



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


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

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

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	int t=1;
	// cin>>t;
	while(t--)
	{
		int a, b;
		cin>>a>>b;
		if(a==1)
		{
			a=14;
		}
		if(b==1)
			b=14;
		// cout<<a<<" "<<b<<endl;
		
			if(a>b)
			{
				cout<<"Alice";
			}
			else if(a==b)
			{
				cout<<"Draw";
			}
			else
			{
				cout<<"Bob";
			}
		
	}
	return 0;
}

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


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

    int N;
    cin >> N;
    int P[N];
    rep(i,N){
        cin >> P[i];
    }    
    int x=200000;
    int ans=0;
    rep(i,N){
        if(P[i]<=x){
            ans++;
            x=P[i];
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 1024
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]
t = [int(input()) for i in range(d)]
now = [0]*26

score = [0]*26
for i in range(d):
    
    now[t[i]-1] = i+1
    ind = t[i]-1
    for j in range(26):
        if j == ind:
            score[j] += s[i][ind]
        else:
            x = (i+1-now[j])*c[j]
            score[j]-= x
m = int(input())
l = [list(map(int,input().split())) for i in range(m)]
ans = sum(score)
for i in range(m):
    x,y = l[i]
    be = t[x-1]
    be -= 1
    now1 =  0
    now2 = 0
    t[x-1] = y
    y -= 1
    count1 = 0
    count2 = 0
    for j in range(d):
        if be == t[j]-1:
            now1 = j+1
            count1 +=s[j][be]
        else:
            count1 -= (j+1-now1)*c[be]
        if y == t[j]-1:
            now2 = j+1
            count2 +=s[j][y]
        else:
            count2 -= (j+1-now2)*c[y]

    ans += count1+count2-score[be]-score[y]
    print(ans)
    score[be] = count1
    score[y] = count2




    


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class FIntervalRunning {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll t1, t2; cin >> t1 >> t2;
      ll a1, a2; cin >> a1 >> a2;
      ll b1, b2; cin >> b1 >> b2;

      ll alla = t1*a1+t2*a2;
      ll allb = t1*b1+t2*b2;

      if (alla == allb) {
        cout << "infinity" << endl;
        return;
      }

      if (alla < allb) {
        swap(alla, allb);
        swap(a1, b1);
        swap(a2, b2);
      }

      //

      if (a1 > b1) {
        cout << 0 << endl;
      } else {
        ll k1 = (t1*b1-t1*a1)/(alla-allb);
        ll ret = k1*2 + 1;
        if ((t1*b1-t1*a1)%(alla-allb)==0) {
          ret--;
        }
        cout << ret << endl;
      }
    }
};

signed main() {
  FIntervalRunning solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char* argv[])
{

	int N,i;
	cin>>N;
	double x=0;
	double A;
	for (i=0;i<N;i++){
		cin>>A;
		x+=1.0/A;
	}
	x=1.0/x;
	printf("%.14lf",x);
	return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> skewer(2 * n);
  for (int i = 0; i < 2 * n; i++) cin >> skewer[i];
  
  sort(skewer.begin(), skewer.end());
  
  int ans = 0;
  for (int i = 0; i < 2 * n; i += 2) ans += skewer[i];
  
  cout << ans << endl;
}

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

typedef struct node{
  int key;
  struct node *parent;
  struct node *left;
  struct node *right;
}Node;

typedef Node * NodePointer;

void insert(int);
void inorderPrint(NodePointer);
void preorderPrint(NodePointer);
int find(NodePointer, int);
NodePointer createNode();

NodePointer root = NULL;

main(){
  int order, key, i;
  char command[7];

  scanf("%d", &order);

  for( i = 0; i < order; i++){
    scanf("%s", command);

    if( strcmp(command, "insert") == 0 ){
      scanf("%d", &key);
      insert(key);
    }
    else if( strcmp(command, "find") == 0 ){
      scanf("%d", &key);
      if( find(root, key) == 1 ) printf("yes\n");
      if( find(root, key) == 0 ) printf("no\n");
    }
    else if( strcmp(command, "print") == 0 ){
      inorderPrint(root);
      printf("\n");
      preorderPrint(root);
      printf("\n");
    }
  }

  return 0;

}


void insert(int key){
  NodePointer x = root;
  NodePointer y = NULL;
  NodePointer z = createNode();

  z->key = key;

  while( x != NULL){
    y = x;
    if( z->key < x->key ) x = x->left;
    else x = x->right;
  }

  z->parent = y;

  if( y == NULL ) root = z;
  else if( z->key < y->key ) y->left = z;
  else y->right = z;

}


void inorderPrint(NodePointer x){
  
  if( x != NULL ){
    inorderPrint(x->left);
    printf(" %d", x->key);
    inorderPrint(x->right);
  }
  
}


void preorderPrint(NodePointer x){

  if( x != NULL ){
  printf(" %d", x->key);
  preorderPrint(x->left);
  preorderPrint(x->right);
  }

}


int find(NodePointer x, int key){

  if( x == NULL ) return 0;
  else if( key == x->key ) return 1;

  if( key < x->key ) return find(x->left, key);
  else return find(x->right, key);

}


NodePointer createNode(){
  NodePointer x;

  x = malloc(sizeof(Node));
  x->key = 0;
  x->parent = NULL;
  x->left = NULL;
  x->right = NULL;

  return x;

}

Measured memory_bytes: 19364
#include<iostream>

using namespace std;

void print_output(int array[3][10]){
    int i,j;
    for(int i=0; i<3; i++){
        for(int j=0; j<10; j++){
            cout<<" "<<array[i][j]<<flush;
        }
            cout<<endl;
    }
}

int main(){
    int n,b[300],f[300],r[300],v[300],i,j;
    cin>>n;
    for(i=0; i<n; i++){
        cin>>b[i]>>f[i]>>r[i]>>v[i];
    }
    int aa[3][10]={},bb[3][10]={},cc[3][10]={},dd[3][10]={};
    for(int i=0; i<n; i++){
        switch(b[i]){
            case 1:
                if(v[i]<0){
                    if(aa[f[i]-1][r[i]-1]+v[i]<0){
                        aa[f[i]-1][r[i]-1]=0;
                    }
                    else{
                        aa[f[i]-1][r[i]-1]+=v[i];
                    }
                }    
                else{
                    aa[f[i]-1][r[i]-1]+=v[i];
                }
                break;
            case 2:
                if(v[i]<0){
                    if(bb[f[i]-1][r[i]-1]+v[i]<0){
                        bb[f[i]-1][r[i]-1]=0;
                    }
                    else{
                        bb[f[i]-1][r[i]-1]+=v[i];
                    }
                }
                else{
                    bb[f[i]-1][r[i]-1]+=v[i];
                }
                break;
            case 3:
                if(v[i]<0){
                    if(cc[f[i]-1][r[i]-1]+v[i]<0){
                        cc[f[i]-1][r[i]-1]=0;
                    }
                    else{
                        cc[f[i]-1][r[i]-1]+=v[i];
                    }
                }
                else{
                    cc[f[i]-1][r[i]-1]+=v[i];
                }
                break;
            case 4:
                if(v[i]<0){
                    if(dd[f[i]-1][r[i]-1]+v[i]<0){
                    dd[f[i]-1][r[i]-1]=0;
                    }
                    else{
                        dd[f[i]-1][r[i]-1]+=v[i];
                    }
                }
                else{
                    dd[f[i]-1][r[i]-1]+=v[i];
                }
                break;
            deafult:
                break;
        }
    }
    print_output(aa);
    cout<<"####################"<<endl;
    print_output(bb);
    cout<<"####################"<<endl;
    print_output(cc);
    cout<<"####################"<<endl;
    print_output(dd);
}



Measured memory_bytes: 3096
#include <algorithm>
#include <iostream>

using namespace std;

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

    int q = 0, r = 0, s = 0;
    for (int i = 0; i < n; i++) {
        int p;
        cin >> p;

        if (p <= a) {
            q++;
        } else if (p <= b) {
            r++;
        } else {
            s++;
        }
    }

    cout << min({ q, r, s }) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
// for文短縮類
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
// iteratorのbeginとendをまとめて渡す
#define ALL(x) (x).begin(), (x).end()
//略
#define PB push_back  // vectorヘの挿入
#define MP make_pair  // pairのコンストラクタ
#define F first       // pairの一つ目の要素
#define S second      // pairの二つ目の要素
//出力
#define COUT(x) cout << (x) << endl
#define SCOUT(x) cout << (x) << " "
#define ENDL cout << endl
int main(int argc, char *argv[]) {
  // input高速化。cinとcoutの結合解除。scanfとprintfは使えない。
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  char a;
  cin >> a;
  if(a <= 90){
      cout << 'A' << endl;
  }else{
      cout << 'a' << endl;
  }
}

Measured memory_bytes: 3612
# 素因数だけをnまで計算する
class EnumElements
  def initialize(n)
    @sieve = []
    @elements = {}
    (2..n).each do |i|
      next if @elements[i]
      @sieve << i
      @elements[i] = [i]

      sieve_target = i * 2
      while sieve_target <= n do
        if @elements[sieve_target]
          @elements[sieve_target].push(i)
        else
          @elements[sieve_target] = [i]
        end
        sieve_target += i
      end
    end
  end

  def elements(num)
    @elements[num] || []
  end
end

_n = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_i)

divisor = EnumElements.new(1_000_000)
common_elms = divisor.elements(arr[0])
all_elms = {}
common_elms.each do |i|
  all_elms[i] = true
end

pair = true
set = false
arr[1..-1].each do |i|
  crr_elms = divisor.elements(i)
  if pair
    crr_elms.each do |i|
      break pair = false if all_elms[i]
      all_elms[i] = true
    end
  end
  if !set
    common_elms = (common_elms & crr_elms)
    set = common_elms.empty?
  end
end

if pair
  puts "pairwise coprime"
elsif set
  puts "setwise coprime"
else
  puts "not coprime"
end

Measured memory_bytes: 232956
#include<bits/stdc++.h>
#include<vector>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007

using namespace std;


int main(void){
    int n;
    cin>>n;
    VI A(n);
    rep(i,n)cin>>A[i];
    deque<int> d;
    rep(i,n){
        int p=lower_bound(d.begin(),d.end(),A[i])-d.begin();
        if(p==0){
            d.push_front(A[i]);
        }else{
            d[p-1]=A[i];
        }
        
    }
    int ans=d.size();
    cout<<ans<<endl;

}



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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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 (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,m,x;
cin>>n>>m>>x;
vector<int>c(n);
vector<vector<int>>a(n,vector<int>(m,0));
rep(i,n){
    cin>>c[i];
    rep(j,m){            
        cin>>a[i][j];
    }
}
int bit=(1<<n);
ll min_cost=(ll)1e10;
reps(b,bit,1){
    ll cost=0;
    vector<int> skil(m,0);
    rep(i,n){
        if(b&(1<<i)){
            rep(j,m){
                skil[j]+=a[i][j];
            }
            cost+=c[i];
        }
    }
    bool ok=true;
    rep(j,m){
        if(skil[j]<x){
            ok=false;
            break;
        }
    }
    if(ok){
        min_cost=min(min_cost,cost);
    }
}
if(min_cost==(ll)1e10){
    min_cost=-1;
}
cout<<min_cost<<endl;
return 0;
}

Measured memory_bytes: 3680
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC118A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = ReadInt;
            int B = ReadInt;

            if (B % A == 0) Console.WriteLine(A + B);
            else Console.WriteLine(B - A);




        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        static public void Draw2D(int[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            int[,] map2 = new int[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0;
                    else if (i == 0) map2[i, j] = j - 1;
                    else if (j == 0) map2[i, j] = i - 1;
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 11220
from copy import deepcopy
N, K = [int(i) for i in input().split()]
wvs = [(int(w), int(v)) for w,v in [input().split() for _ in range(N)]]
dp = [0]*(K)
for i, wv in enumerate(wvs):
  w,v = wv
  tmp_dp = deepcopy(dp)
  for j in range(i,K):
    if (j+w) <= K:
      tmp_dp[j+w-1] = max(dp[j+w-1], dp[j-1] + v)
  dp = tmp_dp
print(max(dp))

Measured memory_bytes: 123888
#pdf見た
n = int(input())
q = [0]*n
for i in range(n):
    p = int(input())-1
    q[p] = i
    
s=f=0
c = set()
for i in range(1,n):
    if q[i]<q[i-1]:
        f=i-1
        c.add(f-s+1)
        s=i
if c==set():
    print(0)
else:
    print(n-max(c))

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

int main()
{
    int i,j,k,m;
    while(cin>>m)
    {
        i=m/100;
        m%=100;
        j=m/10;
        k=m%10;
        if(i==k) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] m = new int[n];
        for(int i = 0; i < n; i++){
            m[i] = sc.nextInt();
        }
        int sum = 0;
        for(int i = 0; i < n; i++){
            sum = sum + m[i];
        }
        Arrays.sort(m);
        System.out.print(n+(x-sum)/m[0]);
    }
}

Measured memory_bytes: 21972
#include<cstdio>

typedef long long int lli;
int main(void) {
    lli n,m,r;
    scanf("%lld%lld",&n,&m);
    if(n==1){printf("%d\n", m); return 0;}
    for(lli i=1; i*n<=m && i<=m; i++) {
        if(m % i == 0)
            r = i;
    }
    printf("%lld\n", r);
}


Measured memory_bytes: 128
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
int main(){
    int i=0;
	int x[200];
	char t[100];
	int nt;
	int ans=0;
	while(scanf("%s",t)!=EOF){
	    if(t[0] == '+'){
	       ans = x[i-1] +x[i-2];
	       i -= 2;
	       x[i] = ans;
	    }else if(t[0] == '-'){
	       ans = x[i-2] - x[i-1];
	       i -= 2;
	       x[i] =ans;
	    }else if(t[0] == '*'){
	       ans = x[i-1] * x[i-2];
	       i -= 2;
	       x[i] = ans;
	    }else{
	   		 x[i] = atoi(t);
	    }
		i++;
#ifdef DBG
		for(int j = 0;j<=i;j++){
			printf("%d ", x[j]);	
		}
		printf("\n");
#endif
	}
	cout << x[0] << endl;
}



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

int main(){
  long long int n;
  cin >> n;
  vector<long long int> v;
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    v.push_back(a);
  }
  long long int max_no = v[0];
  long long int max_no2 = v[1];
  long long int num = 0;
  for(long long int i = 1;i < n;i++){
    if(max_no <= v[i])
    {
      max_no2 = max_no;
      max_no = v[i];
      num = i;
    }
    else if(max_no > v[i] && max_no2 <= v[i])
    {
      max_no2 = v[i];
    }
  }
  for(long long int i = 0;i < n;i++){
    if(i == num){
      cout << max_no2 << endl;
    }
    else{
      cout << max_no << endl;
    }
  }
}


Measured memory_bytes: 3312
// AOL Q.0071
// YAMADA Terushige 2013.6.4.
 
#include<iostream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
 
using namespace std;
char c[9][9]; 

void bomb(int x,int y){
  if(0<x && x<9 && 0<y && y<9){
    if(c[y][x]=='1'){
      c[y][x]='0';
      bomb(x-3,y);
      bomb(x-2,y);
      bomb(x-1,y);
      bomb(x+1,y);
      bomb(x+2,y);
      bomb(x+3,y);
      bomb(x,y-3);
      bomb(x,y-2);
      bomb(x,y-1);
      bomb(x,y+1);
      bomb(x,y+2);
      bomb(x,y+3);
    }
  }
}
 
int main(){
 
  int n;
  string s;

  cin >> n;

  for(int k=1;k<=n;k++){

    for (int i=1;i<9;i++){
      cin >> s;
      for(int j=0;j<8;j++)
	c[i][j+1]=s.at(j);
    }

    int x,y;
    cin >> x >> y;
    bomb(x,y);

    cout << "Data " << k << ':' << endl;
    for(int i=1;i<9;i++){
      for(int j=1;j<9;j++){
	cout<<c[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <set>
using namespace std;
 
int main() {
    int n,i;
    string op,str;
    set<string> dict;
    cin>>n;
    for (i=0;i<n;i++) {
        cin>>op>>str;
        if (op == "insert") {
            dict.insert(str);
        } else if (op == "find") {
            if (dict.count(str)>0) {
                cout<<"yes"<<endl;
            } else {
                cout<<"no"<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 32572
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c) 
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

const int max_h=100,max_w=100;
int h,w;
char a[max_h+1][max_w+1];

void solve(){
    priority_queue<int,vector<int>,greater<int>> H,W;
    queue<int> que;
    bool flag=false;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]=='#') break;
            else if(j==w-1 && a[i][j]!='#')
            H.push(i);
        }
    }
    for(int i=0;i<w;i++){
        for(int j=0;j<h;j++){
            if(a[j][i]=='#') break;
            else if(j==h-1 && a[j][i]!='#')
            W.push(i);
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(!H.empty() || !W.empty()){
                if(i==H.top()){
                    H.pop();
                    flag=true;
                    break;
                }else if(j==W.top()){
                    que.push(W.top());
                    W.pop();
                }else cout << a[i][j];
            }else cout << a[i][j];
        }
        while(!que.empty()){
            W.push(que.front());
            que.pop();
        }
        if(!flag) cout << endl;
        else flag=false;
    }
}

int main(){
    cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> a[i][j];
        }
    }
    solve();
}

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

int main()
{
    ll n, m;
    cin >> n >> m;
    priority_queue<ll, vector<ll>, greater<ll>> A;
    priority_queue<ll> C;
    map<ll, ll> B;
    //vector<ll> C(m);
    rep(i, n)
    {
        ll k;
        cin >> k;
        A.push(k);
    }
    rep(i, m)
    {
        ll b, c;
        cin >> b >> c;
        C.push(c); //これに対応するのをmapで選んでおく。
        B[c] += b; //＋＝なら問題ない
    }
    //方針として、もしより大きなものに変えられるのなら変えた方が良い
    //枚数制限があるので小さい数から変えて行く。
    //小さいものを一番大きいものとかえる
    while (A.top() < C.top())
    { //Cが空の場合とかも考える？
        //Aのトップを決してC.topを入れる。
        A.pop();
        A.push(C.top());
        B[C.top()] -= 1;
        if (B[C.top()] == 0)
        {
            ll f = C.top();
            C.pop(); //
            while (C.empty() != 1 && f == C.top())
            {
                C.pop();
            }
        }
        if (C.empty() == 1)
        {
            break;
        }
    }
    ll count = 0;
    while (A.empty() != 1)
    {
        count += A.top();
        A.pop();
    }
    cout << count << endl;
}

Measured memory_bytes: 8052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	int a,b,c,s=0;
	Scanner scan = new Scanner(System.in);
	
	a= Integer.parseInt(scan.next());
	b= Integer.parseInt(scan.next());
	c= Integer.parseInt(scan.next());

	for(;a<=b;a++) {
		if(c%a==0)
			s++;
	}
	System.out.println(s);
	}
	
}

Measured memory_bytes: 26292
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

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

    cout << min(n*a, b) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <set>
#include <cmath>
using namespace std;

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

    set<int> st;
    st.insert(s);

    for(int i=2; i<=1000000; i++){
        if(s%2==0) s = s/2;
        else s = 3*s+1;
        if(st.find(s) != st.end()){
            cout << i << endl;
            return 0;
        }
        st.insert(s);
    }

    return 0;
}


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

int main()
{
    int a,p;
    cin >> a >> p;
    p += 3*a;
    cout << p/2 << endl;
    return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

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

    int n;
    cin >> n;
    vector<int> a;
    for(int i=0; i<n; i++){
        int t;
        cin >> t;
        a.pb(t);
    }

    ll ans = 0;
    for(int i=1; i<n; i++){
        if(a[i-1] == i && a[i] == i+1){
            int t= a[i];
            a[i] = a[i-1];
            a[i-1] = t;
            ans++;
        }
    }

    if(a[0] == 1){
        int t= a[1];
        a[1] = a[0];
        a[0] = t;
        ans++;
    }

    for(int i=1; i<n; i++){
        if(a[i] == i+1){
            int t= a[i];
            a[i] = a[i-1];
            a[i-1] = t;
            ans++;
        }
    }

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


Measured memory_bytes: 892
#include<stdio.h>
#include<stdlib.h>
int asc(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}
int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int a[100005];
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    qsort(a, n, sizeof(int), asc);
    if (n % 2 == 0)
    {
        for (i = 0; i < n; i++)
        {
            if (a[i] != 2 * (int)(i / 2) + 1)
            {
                printf("0\n");
                return 0;
            }
        }
    }
    else
    {
        for (i = 0; i < n; i++)
        {
            if (a[i] != 2 * (int)((i + 1) / 2))
            {
                printf("0\n");
                return 0;
            }
        }
    }
    int ans = 1;
    for (i = 0; i < n / 2; i++)
    {
        ans *= 2;
        ans %= 1000000007;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, s, n) for(int i = s; i < n; i++)
#define rRep(i, n) for(int i = n - 1; i >= 0; i--)
#define pii pair<int, int>
#define vii vector<pair<int, int>>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define endl "\n"

int n, m, x;
int arr[20][20], cost[20];
int dp[20][20], temp[20];

bool chck(int temp[20]) {
	REP(i, 0, m) {
		if(temp[i] < x)
			return false;
	}
	return true;
}

int get(int cur) {
	if(cur == n) {
		if(chck(temp))
			return 0;
		else 
			return -1;
	}

	// include
	REP(i, 0, m) {
		temp[i] += arr[cur][i];
	}
	int a = get(cur + 1);
	if(a != -1) {
		a += cost[cur];
	}
	REP(i, 0, m)
		temp[i] -= arr[cur][i];
	int b = get(cur + 1);
	if(a == -1)
		return b;
	else if(b == -1)
		return a;
	else return min(a, b);

}

int32_t main() {
	FAST
	//ofstream fout ("test.out");
    //ifstream fin ("test.in");
 
    cin >> n >> m >> x;
    memset(dp, -1, sizeof(dp));
    REP(i, 0, n) {
    	cin >> cost[i];
    	REP(j, 0, m)
    		cin >> arr[i][j];
    }
    int fin[20];
    memset(fin, 0, sizeof(fin));
    REP(i, 0, n) {
    	REP(j, 0, m)
    		fin[j] += arr[i][j];
    }

    REP(i, 0, m) {
    	if(fin[i] < x) {
    		cout << -1 << endl;
    		return 0;
    	}
    }

    int ans = get(0);
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	string s,alt="CODEFESTIVAL2016";
	int n=0;
	cin>>s;
	rep(i,s.size()){
		if(s[i]!=alt[i])n++;
	}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC169
{
    class MainClass
    {

        static int[] s;
        static long[] a;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            a = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            long ans = 1;
            long temp = 1;
            bool overflowflg = false;
            bool zeroflg = false;
            for (int i = 0; i < s[0]; i++)
            {
                temp *= a[i];
                // WriteLine(temp);
                // WriteLine((long)Pow(10,18));
                if (a[i] == 0)
                {
                    zeroflg = true;

                }
                if ((a[i] != 0 && temp < ans) || temp > (long)Pow(10, 18))
                {
                    overflowflg = true;
                }
                ans = temp;
            }
            if (overflowflg && !zeroflg)
            {
                WriteLine(-1);
                // WriteLine(ans);
            }
            else
            {
                WriteLine(ans);
                // WriteLine(overflowflg);
            }
        }
    }
}


Measured memory_bytes: 42464
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;


const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };
int memo[10][10][10][10];
int W, H;
int gx, gy;


struct aa {
	int mx, my;
	int cx, cy;
	int time;
};
class Compare {
public:
	bool operator()(const aa&l, const aa&r) {
		return l.time > r.time;
	}
};

int main() {
	while (1) {
		for (int i = 0; i < 10; ++i) {
			for (int j = 0; j < 10; ++j) {
				for (int k = 0; k < 10; ++k) {
					for (int l = 0; l < 10; ++l) {
						memo[i][j][k][l] = 1e8;
					}
				}
			}
		} cin >> W >> H;
		if (!W)break;
		int smx, smy, scx, scy;
		vector<vector<int>>field(H+2, vector<int>(W+2,1));
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				int n; cin >> n;
				if (n == 2) {
					scx = j + 1, scy = i + 1;
					field[i + 1][j + 1] = 0;
				}
				else if (n == 3) {
					gx = j + 1, gy = i + 1;
					field[i + 1][j + 1] = 0;
				}
				else if (n == 4) {
					smx = j + 1, smy = i + 1;
					field[i + 1][j + 1] = 0;
				}
				else {
					field[i + 1][j + 1] = n;
				}
			}
		}
		memo[smx][smy][scx][scy] = 0;
		priority_queue<aa,vector<aa>,Compare>que;
		que.push(aa{ smx,smy,scx,scy,0 });
		int ans = -1;
		while (!que.empty()) {
			aa atop(que.top());
			que.pop();
			const int nowmx = atop.mx;
			const int nowmy = atop.my;
			const int nowcx = atop.cx;
			const int nowcy = atop.cy;
			const int nowtime = atop.time;
			if (nowcx == gx&&nowcy == gy) {
				ans = nowtime;
				break;
			}
			for (int way = 0; way < 4; ++way) {
				const int nextmx = nowmx + dx[way];
				const int nextmy = nowmy + dy[way];
				if (field[nextmy][nextmx])continue;
				else if (nextmx == nowcx&&nextmy == nowcy) {
					const int nextcx = nowcx + dx[way];
					const int nextcy = nowcy + dy[way];
					if (field[nextcy][nextcx])continue;
					else {
						const int nexttime = nowtime + 1;
						if (memo[nextmx][nextmy][nextcx][nextcy]>nexttime) {
							memo[nextmx][nextmy][nextcx][nextcy] = nexttime;
							que.push(aa{ nextmx,nextmy,nextcx,nextcy,nexttime });
						}
					}
				}
				else {
					const int nextcx = nowcx;
					const int nextcy = nowcy;
					const int nexttime = nowtime;
					{
						if (memo[nextmx][nextmy][nextcx][nextcy]>nexttime) {
							memo[nextmx][nextmy][nextcx][nextcy] = nexttime;
							que.push(aa{ nextmx,nextmy,nextcx,nextcy,nexttime });
						}
					}
				}
			}
		}
		cout << ans << endl;

	}
	return 0;
}

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

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;

int main(){
	int n; cin >> n;
	int d = 0, a[n+2], b[n]; a[0] = a[n+1] = 0;
	Rep(i, n){
		int t; cin >> t;
		a[i+1] = t;
		d += abs(a[i+1] - a[i]);
	}
	Rep(i, n){
		int t = i + 1;
		b[i] = abs(a[t+1] - a[t-1]) - (abs(a[t+1] - a[t]) + abs(a[t] - a[t-1]));
	}
	d += abs(a[n+1] - a[n]);
	Rep(i, n){
		cout << d + b[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 2048
use std::collections::{HashMap, VecDeque};
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//struct Main {
//    x: i32,
//    y: i32,
//    z: i32,
//}
//impl Main {
//    fn invoke(&mut self) {
//        println!("{} {} {}", self.z, self.x, self.y);
//    }
//}

fn main() {
    let n: usize = read();
    let m: i32 = read();

    let mut a = vec![0; n];
    for i in 0..n {
        a[i] = read();
    }

    let per = 1.0 / (4.0 * m as f64);
//    println!("per: {}", per);

    let sum: i32 = a.iter().sum();
//    println!("sum: {}", sum);
    let mut cnt = 0;
    for &a_one in a.iter() {
        let a_per= a_one as f64 / sum as f64;
//        println!("a_per: {}", a_per);
        if a_per >= per {
            cnt += 1;
        }
    }

//    println!("cnt: {}", cnt);

    if cnt >= m {
        println!("Yes");
    } else {
        println!("No");
    }

//    Main { x: x, y: y, z: z }.invoke()
}


Measured memory_bytes: 4352
import sys
from collections import deque
input = sys.stdin.readline

def main():
    n, m = map(int, input().split())
    
    tree = [[] for _ in range(n)]
    for i in range(m):
        a, b = map(int, input().split())
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    
    judge = True
    dist = [0]*n
    already = [False]*n
    not_yet = deque([0])
    already[0] = True
    while not_yet:
        key = not_yet.popleft()
        for v in tree[key]:
            if already[v]:
                if dist[v] != (dist[key] + 1) % 2:
                    judge = False
                continue
            already[v] = True
            dist[v] = (dist[key] + 1) % 2
            not_yet.append(v)
    
    if judge:
        sub = sum(dist)
        ans = sub * (n - sub) - m
    else:
        ans = n * (n - 1) // 2 - m
    
    print(ans)
    
    
    
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 27528
x,y,deg = 0,0,90
while line = gets do
	l,d = line.split(",").map(&:to_f)
	x += l*Math.cos(deg/180.0*Math::PI)
	y += l*Math.sin(deg/180.0*Math::PI)
	deg -= d
end
puts "#{x.to_i}\n#{y.to_i}"

Measured memory_bytes: 8948
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> cs(3, vector<int>(3)); cin >> cs;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            if(cs[i][j] - cs[i + 1][j] != cs[i][2] - cs[i + 1][2]){
                cout << "No" << '\n';
                return 0;
            }
        }
    }
    cout << "Yes" << '\n';
}


Measured memory_bytes: 256
import collections
q = collections.deque()
n = int(input())
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        q.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            q.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        q.popleft()
    elif com[0] == 'deleteLast':
        q.pop()
print(*q)

Measured memory_bytes: 48120
#include<iostream>
#include<algorithm>
using namespace std;
long long dp[2009][2009], dp2[4019][2009], c[2009][2009], A, B, mod = 1000000007;
long long ncr_rng(long long n, long long l, long long r) {
	if (n < 0 || l > r)return 0;
	l = max(l, 0LL); r = min(r, 2008LL);
	long long V = dp2[n][r]; if (l >= 1)V -= dp2[n][l - 1]; V %= mod;
	return V;
}
long long ncr(long long n, long long r) {
	if (r < 0 || n < r)return 0;
	return dp[n - r][r];
}
long long solve(long long a, long long b, long long c) {
	return ncr(a + b, b) - ncr(min(a, c) + b, b);
}
int main() {
	cin >> A >> B;
	for (int i = 0; i <= 2008; i++) {
		for (int j = 0; j <= 2008; j++) {
			if (i == 0 || j == 0)dp[i][j] = 1; else dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] %= mod; dp2[i + j][j] = dp[i][j];
		}
	}
	for (int i = 0; i <= 4008; i++) {
		for (int j = 1; j <= 2008; j++)dp2[i][j] += dp2[i][j - 1];
	}
	for (int i = 1; i <= A; i++) {
		for (int j = 1; j <= B; j++) {
			c[i][j] = ncr_rng(j - 1, (j - (i - 1)), (j - 1));
		}
	}
	for (int i = 1; i <= A; i++) {
		for (int j = 0; j <= B; j++) { c[i][j] += c[i - 1][j]; c[i][j] %= mod; }
	}
	for (int i = 1; i <= A; i++) {
		for (int j = B; j >= 1; j--)c[i][j] = c[i][j - 1]; c[i][0] = 0;
	}
	long long ans = 0;
	for (int i = 0; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			int T = i + j;
			long long V = solve(A - i, B - j, T - i - 1);
			ans += c[i][j] * solve(A - i, B - j, T - i - 1); ans %= mod;
		}
	}
	cout << (ncr(A + B, B) - ans + mod) % mod << endl;
	return 0;
}

Measured memory_bytes: 126336
import java.util.*;
public class Main {

	public static void main(String[] args) {
		int MOD = 1_000_000_007;
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S1 = sc.next().toCharArray();
		char[] S2 = sc.next().toCharArray();
		boolean v = true;
		long ans;
		int t = 1;
		if(S1[0] == S2[0])
			ans = 3;
		else {
			ans = 6;
			t = 2;
			v = false;
		}	
		for(int i = t; i < N; i++) {
			if(S1[i] == S2[i]) {
				if(v)
					ans *= 2;
				else
					v = true;
			}
			else {
				if(v)
					ans *= 2;
				else
					ans *= 3;
				i++;
				v = false;
			}
			ans %= 1_000_000_007;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 25172
import collections
import itertools

def prime_factor(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
#-------------------------------------------------------------------------
# テスト
N = int(input())
if N == 1:
    print(0)
    exit()
PP = prime_factor(N)
#print(PP)
Pri = collections.Counter(PP)
values, counts = zip(*Pri.most_common())
#print("counts = ",counts)
#print("values = ",values)
L = max(counts)

num = range(L+1)
acu = list(itertools.accumulate(num))
#print(acu)

ans = 0
for i in counts:
    for k in range(L+1):
        if acu[k] == i:
            ans += k
            break
        elif acu[k] > i:
            ans += k-1
            break
print(ans)

Measured memory_bytes: 65972
#include<bits/stdc++.h>
using namespace std;
long int dp[101][100001];
long int func(long int W,long int wt[],long int val[],long int n) 
{ 
    long int i,w;
   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               dp[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 dp[i][w] = max(val[i-1] + dp[i-1][w-wt[i-1]],  dp[i-1][w]); 
           else
                 dp[i][w] = dp[i-1][w]; 
       } 
   } 
  
   return dp[n][W]; 
} 
int main()
{   long int n,w;
    cin>>n>>w;
    long int weight[n];
    long int value[n];
    long int i,j;
    for(i=0;i<n;i++)
    {  
        cin>>weight[i]>>value[i];
    }
    long int ans=func(w,weight,value,n);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 79104