akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string S;
  cin >> S;
  sort(ALL(S));
  REP(i, 0, S.length() - 1) {
    if (S[i] != S[i + 1]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


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

int main(){
    int i,j,k,l;
    int a,b,c;

    cin>>c;
    cin>>a>>b;
    if(c==1) cout<<"OK"<<endl;
    else if(a==b && a%c==0)cout<<"OK"<<endl;
  	else if(a%c==0 || b%c==0) cout<<"OK"<<endl;
    else if(a/c != b/c) cout<<"OK"<<endl;
    
    else cout<<"NG"<<endl;
}


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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a)
#define INF 1e16
#define mod 1e9+7
//vvll v(n,vll(m)) n行m列
//A.erase(A.begin()+i) 配列Aのi番目を消せる

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n;
  cin>>n;
  ll x1,y1,x2,y2,x3,y3;
  x1=0,y1=0,y2=1;
  x2=sqrt(n)+1;
  if(x2==1000000001){
    x2--;
  }
  //co(x2);
  y3=x2;
  ll a=x2*y3-n;
  //co(a);
  if(n==1){
    n=10;
  }
  FOR(i,0,n){
    if(i==a){
      x3=i;
      break;
    }
  }
  //ll b=1000000001*1000000001;
  //co(b);
  co(x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<x3<<" "<<y3);
}


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

int main(void) {
	int N, D, X, A;

	cin >> N >> D >> X;
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A;
		for (int j = 0; j * A + 1 <= D; ++j)
			++ans;
	}
	ans += X;

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
while(True):
  n, x = map(int, input().split())
  if(n == 0):
    break
  ans = 0
  for i1 in range(1, n+1):
    for i2 in range(i1+1, n+1):
      for i3 in range(i2+1, n+1):
        if(i1 + i2 + i3 == x):
          ans += 1
          
  print(ans)


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

using namespace std;

struct node{
  unsigned int key;
  node *next;
  node *prev;
};

typedef struct node* NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer n;
  for(n = nil->next; n != nil; n = n->next){
    if(n->key == key){
      return n;
    }
  }
  return nil;
}

void init(){
  nil = (NodePointer)malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0 )  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  //NodePointer n;
  //for(n = nil->next; n != nil; n = n->next);
  deleteNode(nil->prev);
}

void todelete(int key){
  deleteNode(listSearch(key));
}

void insert(int key){
  NodePointer x;
  x = (NodePointer)malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  x->prev = nil;
  
  nil->next->prev = x;
  nil->next = x;
}

int main(){
  int n;
  int key;
  string comma;

  scanf("%d", &n);
  init();
  
  for (int i = 0; i < n; i++ ){
    cin >> comma;
    scanf("%d", &key);
    if ( comma == "insert" ) insert(key);
    else if ( comma == "delete" ) todelete(key);
    else if ( comma == "deleteFirst" ) deleteFirst();
    else if ( comma == "deleteLast" ) deleteLast();
  }
  
  printList();
  return 0;
}



Measured memory_bytes: 34436
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a , m , n;
  cin >> n >> a;
  m = n % 500;
  
  if (m <= a) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main() {
  int n, i, count = 0, add = 0;
  string s;
  cin >> n >> s;
  
  for(i = 0; i < s.size(); i++){
    if(s.at(i) == ')'){
      count++;
      add = max(add, count);
    }
    else{
      count--;
      add = max(add, count);
    }
  }
  
  for(i = 0; i < add; i++){
    cout << "(";
  }
  cout << s;
  for(i = 0; i < add - count; i++){
    cout << ")";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  int ma = 0;
  int mab;
  REP(i,n) {
    int a,b;
    cin >> a >> b;
    if (ma < a) { ma = a; mab = b; }
  }
  COUT(ma + mab);

  return 0;
}


Measured memory_bytes: 3652
from collections import deque
S = deque(list(input()))
Q = int(input())

flag = 0
for i in range(Q):
    query = input().split()
    if query[0] == '1':
        flag = flag ^ 1
    elif query[0] == '2':
        if flag == 0:
            if query[1] == '1':
                S.appendleft(query[2])
            else:
                S.append(query[2])
        else:
            if query[1] == '1':
                S.append(query[2])
            else:
                S.appendleft(query[2])
if flag == 0:
    print(''.join(S))
else:
    # deque型はスライスで取り出せない print(''.join(S[::-1]))
    S.reverse()
    print(''.join(S))

Measured memory_bytes: 8548
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
    cin>>s;
    unsigned len=s.size();
    if(s[0]==s[len-1]){if(len%2==1) cout << "Second\n";
        else cout<<"First\n";}
    else{if(len%2==1)cout << "First\n";
        else cout<<"Second\n";}
    return 0;
}

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

double dp[3003][3003];
signed main(){
  int n;
  cin>>n;
  dp[0][0]=1;
  r(i,n){
    double x;
    cin>>x;
    r(j,n){
      dp[i+1][j+1]+=dp[i][j]*x;
      dp[i+1][j]+=dp[i][j]*(1.0-x);
    }
  }
  double sum=0;
  for(int i=0;i<n+1;i++){
    if(i>n/2)sum+=dp[n][i];
  }
  printf("%.12f\n",sum);
}

Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss; 

int main() {
  while(1) {
    ll h,w;
    cin >> w >> h;
    if(w==0&&h==0) {
      break;
    }
    vector<vector<ll>> bv(h,vector<ll> (w-1));
    vector<vector<ll>> bh(h-1,vector<ll> (w));
    for(ll i=0;i<2*h-1;i++) {
      if(i%2) {
        for(ll j=0;j<w;j++) {
          cin >> bh[i/2][j];
        }
      }
      else {
        for(ll j=0;j<w-1;j++) {
          cin >> bv[i/2][j];
        }
      }
    }
    vector<vector<ll>> ans(h,vector<ll> (w,-1));
    ans[0][0]=1;
    queue<pll> q;
    q.push(pll(0,0));
    while(q.size()) {
      ll y=q.front().first;
      ll x=q.front().second;
      q.pop();
      for(ll i=0;i<2;i++) {
        ll nx=x-1+i;
        if(nx>-1&&nx<w-1&&bv[y][nx]==0) {
          if(nx==x) {
            nx++;
          }
          if(ans[y][nx]<0) {
            ans[y][nx]=ans[y][x]+1;
            q.push(pll(y,nx));
          }
        }
      }
      for(ll i=0;i<2;i++) {
        ll ny=y-1+i;
        if(ny>-1&&ny<h-1&&bh[ny][x]==0) {
          if(ny==y) {
            ny++;
          }
          if(ans[ny][x]<0) {
            ans[ny][x]=ans[y][x]+1;
            q.push(pll(ny,x));
          }
        }
      }
    }
    if(ans[h-1][w-1]<0) {
      ans[h-1][w-1]=0;
    }
    cout << ans[h-1][w-1] << endl;
  }
}


Measured memory_bytes: 3036
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;
bool check(vector<string>v, char x) {
	rep(i, 0, 3)if (v[i][0] == x&&v[i][1] == x&&v[i][2] == x || v[0][i] == x&&v[1][i] == x&&v[2][i] == x)return true;
	if (v[0][0] == x&&v[1][1] == x&&v[2][2] == x || v[0][2] == x&&v[1][1] == x&&v[2][0] == x)return true;
	return false;
}
signed main() {
	vector<string>v(3);
	while (cin >> v[0], v[0] != "0") {
		cin >> v[1] >> v[2];
		if (check(v, 'b'))cout << 'b' << endl;
		else if (check(v, 'w'))cout << "w" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=INT_MAX;
struct segtree
{
    vector<int> node;
    vector<int> lazy;
    vector<bool> lflg;
    int n;
    segtree(int sz)
    {
        n=1;while(n<sz) n*=2;
        node.resize(2*n,INF);
        lazy.resize(2*n,0);
        lflg.resize(2*n,false);
    }
    void lazyupdate(int k, int l, int r)
    {
        if(lflg[k])
        {
            node[k]=lazy[k];
            push(lazy[k],k,l,r);
            lazy[k]=0;
            lflg[k]=false;
        }
    }
    void push(int v,int k,int l,int r)
    {
        if(r-l>0)
        {
            lazy[2*k]=lazy[2*k+1]=v;
            lflg[2*k]=lflg[2*k+1]=true;
        }
    }
    void update(int qa, int qb, int v, int k=1, int l=1,int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k, l, r);
        if(qb<l||r<qa) return;
        if(qa<=l&&r<=qb)
        {
            node[k]=v;
            push(v,k,l,r);
        }
        else
        {
            int m=(l+r)/2;
            update(qa,qb,v,2*k,l,m);
            update(qa,qb,v,2*k+1,m+1,r);
            node[k]=node[2*k]+node[2*k+1];
        }
    }
    int get(int qa, int qb, int k=1, int l=1, int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k ,l, r);
        if(qb<l||r<qa) return INF;
        if(qa<=l&&r<=qb) return node[k];
        else
        {
            int m=(l+r)/2;
            int lv=get(qa, qb, 2*k, l, m);
            int rv=get(qa, qb, 2*k+1, m+1, r);
            return min(lv,rv);
        }
    }
};

int main()
{
    int n,q;
    scanf("%d %d",&n,&q);
    segtree tree(n);
    for(int i=0;i<q;i++){
        int c;
        scanf("%d",&c);
        if(c){
            int x;
            scanf("%d",&x);
            cout<<tree.get(x+1,x+1)<<endl;
        }else{
            int s,t,v;
            scanf("%d %d %d",&s,&t,&v);
            tree.update(s+1,t+1,v);
        }
    }
}


Measured memory_bytes: 4960
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  int a,b;
  cin>>a>>b;
  double area=a*b;
  printf("%f\n",area/3.305785);
  return 0;
}

Measured memory_bytes: 3196
/*input
4 10 4
1110010010
1000101110
0011101001
1101000111
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-6;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a)%MOD;
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
const ll maxn=1e5+5;
const ll maxlg=__lg(maxn)+2; 
char arr[15][1005];
int cnt[15];
int main(){
	int h,w,k;
	cin>>h>>w>>k;
	REP(i,h) REP(j,w) cin>>arr[i][j];
	int ans=INF;
	REP(i,(1<<h)){
		REP(j,h) cnt[j]=0;
		int need=__builtin_popcount(i);
		REP(j,w){
			int on=0;
			REP(z,h){
				if(arr[z][j]=='1') cnt[on]++;
				if(i&(1<<z)){
					++on;
				}
			}
			bool o=0;
			REP(z,h){
				if(cnt[z]>k){
					++need;
					o=1;
					break;
				}
			}
			if(o){
				REP(z,h) cnt[z]=0;
                on=0;
				REP(z,h){
					if(arr[z][j]=='1') cnt[on]++;
					if(i&(1<<z)){
						++on;
					}
				}
				REP(z,h){
					if(cnt[z]>k){
						need=INF;
						break;
					}
				}
			}
		}
		//cout<<need<<'\n';
		MNTO(ans,need);
	}
	cout<<ans;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    private static final int INF = 1_000_000_000;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();

        int[] C = new int[N];
        int[][] A = new int[N][M];
        for (int i = 0; i < N; i++) {
            C[i] = sc.nextInt();
            for (int j = 0; j < M; j++) {
                A[i][j] = sc.nextInt();
            }
        }

        int min = INF;
        int bit = 1 << N;
        for (int b = 0; b < bit; b++) {
            int price = 0;
            int i = 0;
            int[] sum = new int[M];
            while (i < N) {
                int mask = 1 << i;
                if ((b&mask) > 0) {
                    price += C[i];
                    for (int j = 0; j < M; j++) {
                        sum[j] += A[i][j];
                    }
                }
                i++;
            }
            boolean ok = true;
            for (int j = 0; j < M; j++) {
                if (sum[j] < X) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                min = Math.min(min, price);
            }
        }

        System.out.println(min == INF ? -1 : min);
    }
}



Measured memory_bytes: 37408
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <set>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int K;
	string s;
	cin >> K >> s;
	if (s.size() <= K) cout << s << endl;
	else {
		for(int i = 0; i < K; i++) cout << s[i];
		cout << "..." << endl;
	}
	return 0;
}


Measured memory_bytes: 3620
#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 rep(i,n) for(int i=0; i<(int)(n); i++)
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 ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

int K;

char check(ll n) {
#ifdef LOCAL
  if ((n > K) ^ (to_string(n) > to_string(K))) {
    return 'N';
  } else {
    return 'Y';
  }
#else
  cout << "? " << n << endl;
  char c; cin >> c;
  return c;
#endif
}

char check(vector<int> vec) {
  ll n = 0;
  for(auto e: vec) {
    n *= 10;
    n += e;
  }
  return check(n);
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  #ifdef LOCAL
  // debug
  cin >> K;
  #endif

  vector<int> ans;
  int ok = 9;
  int ng = 0;
  while(ng+1<ok) {
    ll med = (ok+ng)/2;
    ll nine = med*(1e+9)+999999999;
    char c;
    c = check(nine);
    if (c == 'Y') {
      ok = med;
    } else {
      ng = med;
    }
  }
  ans.push_back(ok);

  while(ans.size() <= 9) {
    ok = 9;
    ng = -1;
    while(ng+1 < ok) {
      int med = (ok+ng)/2;
      vector<int> n;
      for(auto e: ans) {
        n.push_back(e);
      }
      n.push_back(med);
      while(n.size() < 12) {
        n.push_back(9);
      }
      char c;
      c = check(n);
      if (c == 'Y') {
        ok = med;
      } else {
        ng = med;
      }
    }
    ans.push_back(ok);
  }

  // special case: 1000...
  bool flag = true;
  if (ans[0] != 1) flag = false;
  for(int i=1; i<=9; i++) {
    if (ans[i] != 0) {
      flag = false;
    }
  }

  if (flag) {
    int ret = 1e+9;
    while (ret > 1) {
      char c;
      c = check(ret-1);
      if (c == 'N') {
        cout << "! " << ret << endl;
        return 0;
      }
      ret /= 10;
    }
    cout << "! " << ret << endl;
    return 0;
  }
  // special case end

  ll ret = ans[0];
  for(int i=1; i<9; i++) {
    ret *= 10;
    ret += ans[i];
  }

  ll before;
  while(ret > 0) {
    char c;
    c = check((ret-1)*10);
    if (c == 'Y') {
      cout << "! " << before << endl;
      return 0;
    }
    before = ret;
    ret /= 10;
  }
  cout << "! " << before << endl;
  return 0;
}

Measured memory_bytes: 596
def main():
	arr =[]
	for i in range(int(input())):
		arr.append(int(input()))
	ans = 0
	now = 0
	for i in arr:
		if i==0:
			ans = ans +(now//2)
			now = 0
		else:
			now = now+i
	ans= ans+(now//2)
	print(ans)
if __name__ =="__main__":
	main()

Measured memory_bytes: 80776
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define MOD 1000000007
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	string str[4]={"maerd","remaerd","esare","resare"};
	string emp="",check="";
	char S[100001];
	cin>>S;
	int len;
	for(len=0;S[len]!='\0';len++);
	for(int i=len-1;i>=0;i--){
		check+=S[i];
		for(int j=0;j<4;j++){
			if(check==str[j]){
				check=emp;
			}
		}
	}
	if(check==emp)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 512
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

s = ns()
s = list(s)
flag = 1
while len(s) != 0:
    if s[-5:] == list("dream") or s[-5:] == list("erase"):
        del s[-5:]
        continue
    elif s[-6:] == list("eraser"):
        del s[-6:]
        continue
    elif s[-7:] == list("dreamer"):
        del s[-7:]
        continue
    else:
        flag = 0
        break

if flag:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3956
n = int(input())
a = list(map(int, input().split()))
ans = 0

if n<3:
    print(0)
    exit()

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if a[i]==a[j] or a[j]==a[k] or a[k]==a[i]:
                continue
            if a[i]+a[j]<=a[k] or a[j]+a[k]<=a[i] or a[k]+a[i]<=a[j]:
                continue
            ans += 1

print(ans)

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

int main(){fastio
    string k;cin>>k;
    ll d;cin>>d;
    ll dp[k.size()+1][d];
    dp[k.size()][0]=1;
    rep(i,1,d-1)dp[k.size()][i]=0;
    rep(i,0,k.size()-1){
        rep(j,0,d-1){
            dp[i][j]=0;
        }
    }
    /*
    rep(i,0,min(stoll(k),9)){
        dp[k.size()-1][i%d]++;
        dp[k.size()-1][i%d]=dp[k.size()-1][i%d]%i_7;
    }
    if(stoll(k)<=9){
        cout<<max(0,dp[0][0]-1)<<endl;
        return 0;
    }*/
    for(ll i=(ll)k.size()-1;i>=0;i--){
        rep(j,0,d-1){
            rep(k,0,9){
                dp[i][j]=mod(dp[i][j]+dp[i+1][((j-k)%d+d)%d]);
            }
        }
    }
    /*
    rep(i,0,d-1){
        rep(j,0,k.size()){
            cout<<dp[j][i]<<' ';
        }
        cout<<endl;
    }*/
    ll ans=0;
    ll tot=0;
    rep(i,0,k.size()-1){
        rep(j,0,(ll)(k[i]-'0')-1){
            ans=mod(ans+dp[i+1][((-(tot+j))%d+d)%d]);
        }
        tot=(tot+(k[i]-'0'))%d;
    }
    if(tot%d==0){
        ans++;
    }
    cout<<mod(ans-1)<<endl;
    
    
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    llint N, K;
    cin >> N >> K;
    llint ans = 0;
    if(K == 0) ans = N*N;
    else{
        FOR(b, K+1, N+1){
            ans += (llint)N/b*(b-K);
            ans += max((llint)0, N%b-K+1);
        }
    }
    cout << ans << "\n";
    return 0;
}

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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

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

  int count = 0;
  vector<int> r;
  for (int i = 1; i <= min(a, b); ++i) {
    if (a % i == 0 && b % i == 0) {
      count++;
      r.push_back(i);
    }
  }

  p(r[r.size() - c]);
}

Measured memory_bytes: 256
N, M, C =map(int,input().split())
count = sum = 0
B = list(map(int,input().split()))
for i in range(0,N,1):
  A = list(map(int,input().split()))
  for j in range(0,M,1):
    sum += A[j]*B[j]
  if sum+C > 0:
    count += 1
  sum = 0
print(count)

Measured memory_bytes: 3064
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    K = int(input())
    ans = [49 + K // 50] * 50
    rest = K % 50
    for i in range(50):
        if i < rest:
            ans[i] += 1
        else:
            ans[i] -= rest
    
    print(50)
    print(*ans, sep=" ")


if __name__ == '__main__':
    main()


Measured memory_bytes: 4072
N, W = map(int, input().split())
dp = [0] * (W + 1)
def dp_opt(n, w):
    for _ in range(N):
        w, v = map(int, input().split())
        for j in range(W, w-1, -1):
            tmp = dp[j-w] + v
            if tmp > dp[j]:
                dp[j] = tmp
    print(dp[-1])
dp_opt(N,W)

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

int main() {
	// your code goes here
	long long k,i,j,a[400005],b[200005],c[200005]={0},d[200005],s[200005],pp[200005],g[200005],w[200005],gg[200005];
	vector<int> p[200005];
	bool u[400005]={0};
	int n,nn,nnn,note,cs=0,m=0;
	cin >> n >> k;
	nn=n;
	for(i=0;i<n;i++) {
		cin >> a[i];
		c[a[i]]++;
		p[a[i]].push_back(i);
		w[i]=p[a[i]].size()-1;
	}
	g[0]=-1;
	while(1){
		cs++;
		s[cs]=(g[cs-1]+1)%n;
		g[cs]=p[a[s[cs]]][((w[s[cs]]+1)%c[a[s[cs]]])];
		if(s[cs]>=g[cs]) {
			m++;
			gg[m]=g[cs-1];
		}
		if(g[cs]==n-1) break;
	}
	m++;
	k=k%m;
	if(k==0){
		cout << endl;
		return 0;
	}
	nn=n-gg[k]-1;
	for(i=gg[k]+1;i<n;i++) {
		if(u[a[i]]){
			for(j=pp[a[i]];j<=i;j++){
				u[a[j]]=0;
				if(a[j]!=0) nn--;
				a[j]=0;
			}
			u[a[i]]=0;
		} else {
			u[a[i]]=1;
			pp[a[i]]=i;
		}
	}
	j=0;
	for(i=gg[k]+1;i<n;i++){
		if(a[i]!=0){
			b[j]=a[i];
			j++;
		}
	}
	for(i=0;i<nn;i++){
		cout << b[i];
		if(i!=nn-1) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 25344
#include<stdio.h>

#define N 8
#define free -1
#define notfree 1
#define FALSE 2
#define TRUE 3

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
int X[N][N];

void initialize(void);
void printboard(void);
void recursive(int);

int main(){
  int i,j,k,r,c;

  initialize();

  for(i=0;i<N;i++)
    for(j=0;j<N;j++)
      X[i][j] = FALSE;

  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d %d",&r,&c);
    X[r][c] = TRUE;
  }

  recursive(0);

  return 0;
}

void initialize(){
  int i;

  for(i=0;i<N;i++){
    row[i] = free;
    col[i] = free;
  }

  for(i=0;i<2*N-1;i++){
    dpos[i] = free;
    dneg[i] = free;
  }
}

void printboard(){
  int i,j;

  for(i=0;i<N;i++)
    for(j=0;j<N;j++)
      if(X[i][j] == TRUE){
	if(row[i] != j)return;
      }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i] == j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;

  if(i == N){
    printboard();
    return;
  }

  for(j=0;j<N;j++){
    if(notfree == col[j] || notfree == dpos[i+j] || notfree == dneg[i-j+N-1])continue;
    row[i] =j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = notfree;
    recursive(i+1);
    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = free;
  }
}


Measured memory_bytes: 2108
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	int w, h;
	cin >> w >> h;
	bool build[128][128];
	CLEAR(build, 0);
	for (int y = 0; y < h; ++y)
	{
		for (int x = 0; x < w; ++x)
		{
			int t;
			cin >> t;
			build[y + 3][x + 3] = t == 1;
		}
	}

	bool visit[128][128];
	CLEAR(visit, 0);
	int res = 0;
	queue<pint> q;
	q.push(pint(0, 0));
	visit[0][0] = true;
	while (!q.empty())
	{
		pint tt = q.front(); q.pop();
		int x = tt.first, y = tt.second;

		static const int dx[] = { -1, 0, 1 };
		static const int dy[] = { -1, 0, 1 };
		for (int i = 0; i < 3; ++i)
		{
			for (int j = 0; j < 3; ++j)
			{
				int tx = x + dx[i], ty = y + dy[j];
				if (tx < 0 || tx > w + 3 || ty < 0 || ty > h + 3
					|| (dy[j] && (
						(y % 2 == 1 && dx[i] == -1)
						|| (y % 2 == 0 && dx[i] == 1))))
					continue;

				if (build[ty][tx])
					++res;
				else if (!visit[ty][tx])
				{
					visit[ty][tx] = true;
					q.push(pint(tx, ty));
				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    long long n,m;
    cin>>n>>m;
    vector<vector<long long>>dp(n+1,vector<long long>(100002,10010010000001));
    vector<pair<int,int>>theval;
    for(long long i=0;i<n;i++){
        long long a,b;
        cin>>a>>b;
        theval.push_back({a,b});
    }
    long long output=0;
    for(long long i=0;i<n;i++){
        if(i==0){dp[i][theval[i].second]=theval[i].first;dp[0][0]=0;continue;}
        
        for(long long j=0;j<=100001;j++){
            if(j-theval[i].second>=0)dp[i][j]=min(dp[i][j],dp[i-1][j-theval[i].second]+theval[i].first);
            dp[i][j]=min(dp[i][j],dp[i-1][j]);
            
        }
    }
    for(long long j=0;j<=100001;j++){
       // cout<<dp[n][j]<<endl;
            if(dp[n-1][j]<=m){output=max(output,j);}
            
        }
        cout<<output<<endl;
}


Measured memory_bytes: 80256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, K;
    cin >> N >> K;
    int x[100];
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> x[i];
        if (x[i] <= (K + 2 - 1) / 2)
        {
            sum += 2 * x[i];
        }else
        {
            sum += 2 * (K - x[i]);
        }
        
    }

    cout << sum << endl;
    
    return 0;
}


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

int main() {

  int K; cin >> K;

  vector<int> vec(32); // int型の配列変数vecを宣言

  vec = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 

  cout << vec.at(K-1) << endl; 
}


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

int main()
{
	int N,M;
	scanf("%d %d",&N,&M);
	int board[N+1];
	memset(board,0,sizeof(board));
	while(M--)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		board[a]++;
		board[b]++;
	}
	for(int i=1 ; i<=N ; i++)
	{
		printf("%d\n",board[i]);
	}
	return 0;
}

Measured memory_bytes: 128
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k <= a) {
		cout << k;
	}
	else if (k > a && k <= (a + b)) {
		cout << a;
	}
	else if (k > (a + b) && k <= (a + b + c)) {
		cout << a - (k - (a + b));
	}
	else {
		cout << a - b;
	}
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<int, pii> pipii;

ll l[100005];
void solve() {
  int n;
  cin >> n;
  ll all = 0;
  for(int i = 0; i < n; i++) {
    cin >> l[i];
    all += l[i];
  }
  sort(l, l+n);
  int ret = 1;
  for(int i = n-1; i > 0; i--) {
    all -= l[i];
    if(2*all >= l[i]) ret++; else break;
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////





int main() {

	ll N;
	cin >> N;
	
	ll ans = 1;

	repn(i, N) {
		ans *= i;
		ans %= MOD;
	}

	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 504
H,M = map(int,input().split())

array = [input() for i in range(H)]

ans = [[0 for j in range(M)] for i in range(H)]

for i in range(H):
  for j in range(M):
    if array[i][j] == '.':
      if i != 0 and array[i-1][j] == '#':
        ans[i][j] += 1
      if i != 0 and j != 0 and array[i-1][j-1] == '#':
        ans[i][j] += 1
      if i != 0 and j != M-1 and array[i-1][j+1] == '#':
        ans[i][j] += 1
      if j != 0 and array[i][j-1] == '#':
        ans[i][j] += 1
      if j != M-1 and array[i][j+1] == '#':
        ans[i][j] += 1
      if i != H-1 and array[i+1][j] == '#':
        ans[i][j] += 1
      if i != H-1 and j != 0 and array[i+1][j-1] == '#':
        ans[i][j] += 1
      if i != H-1 and j != M-1 and array[i+1][j+1] == '#':
        ans[i][j] += 1
    else:
      ans[i][j] = '#'
for i in range(H):
  print(''.join(list(map(str,ans[i]))))

Measured memory_bytes: 3064
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    N = int(input())
    A = list(map(int, input().split()))

    #output
    A = sorted(A, reverse = True)
    if A[-1] == 0:
        print(0)
        exit()
        
    answer = 1
    limit = pow(10, 18)
    for i in range(N):
        answer *= A[i]
        if answer > limit:
            print(-1)
            exit()
        else:
            continue

    print(answer)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Measured memory_bytes: 84696
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
struct edge {
    int to, cost;
};

int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}

auto factor(int n){
  map<int,int>res;
  for(int i=2;i*i<=n;i++){
      for(; n%i==0;n/=i) res[i]++;
  }
  if(n>1)res[n]++;
  return res;
}
////////////////////////////////////////////////////////////
signed main() {
  int n,m;
  cin>>n>>m;
  cout<<pow(2,m)*((n-m)*100+m*1900)<<endl;
}


Measured memory_bytes: 4216
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define PI 3.14159265358979
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};
vector<long long> divisor(long long n)
{
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end()); // 昇順に並べる
  return ret;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (auto &it : A)
    cin >> it;
  sort(A.begin(), A.end());
  set<ll> st;
  if (N == 1)
    cout << 1 << endl;
  else
  {
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
      vector<ll> div = divisor(A[i]);
      bool exist = false;
      for (auto it : div)
      {
        if (st.find(it) != st.end())
          exist = true;
      }
      if (!exist)
        if (i == N - 1 || A[i] != A[i + 1])
          cnt++;
      st.insert(A[i]);
    }
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 14276
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
int main(){
	fast;
	int t,n; cin>>n;
	map<string,int> mp;
	while(n--){
		string s; cin>>s;
		++mp[s];
	}
	cout<<"AC x "<<mp["AC"]<<'\n';
	cout<<"WA x "<<mp["WA"]<<'\n';
	cout<<"TLE x "<<mp["TLE"]<<'\n';
	cout<<"RE x "<<mp["RE"]<<'\n';
	return 0;
}

Measured memory_bytes: 3652
a = [int(input()) for i in range(6)]

# アンテナと距離に分ける
i = [a[0], a[1], a[2], a[3], a[4]]
k = a[5]

flag = False
itr = 0
while True:
  x = itr
  while True:
    x+=1
    if x >= 5:
      break
    elif(i[x] - i[itr]) > k:
      flag = True
  itr+=1
  if itr == 5:
    break
    
if flag:
  print(":(")
else:
  print("Yay!")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  ll N; cin >> N;
  for (ll h = 1; h <= 3500; ++h) {
    for (ll n = 1; n <= 3500; ++n) {
      auto a = N*h*n;
      auto b = 4*h*n - N*(h+n);
      if (!b) continue;
      if (a % b == 0) {
        auto w = a / b;
        if (w > 0) {
          cout << h << SPACE;
          cout << n << SPACE;
          cout << w << CRLF;
          return;
        }
      }
    }
  }
  abort();
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		
		int H = sc.nextInt();
		int W = sc.nextInt();
		
		while (H != 0 && W != 0) {
			display(H, W);
			H = sc.nextInt();
			W = sc.nextInt();
		}
	}

	private static void display(int h, int w) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ((i + 1) % 2 == 0) {
					if ((j + 1) % 2 == 0) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}					
				} else {
					if ((j + 1) % 2 == 0) {
						System.out.print(".");
					} else {
						System.out.print("#");
					}
				}
			}
			System.out.println();
		}
		System.out.println();
	}
}

Measured memory_bytes: 35552
using System;
using System.Linq;

namespace arc079_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool[] maeflag = new bool[x[0] + 1];
            bool[] usiroflag = new bool[x[0] + 1];
            for (int i = 0; i < x[1]; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (a[0] == 1) maeflag[a[1]] = true;
                if (a[1] == x[0]) usiroflag[a[0]] = true;
            }
            bool ret = false;
            for (int i = 0; i <= x[0]; i++)
            {
                if (maeflag[i] && usiroflag[i]) ret = true;
            }
            Console.WriteLine(ret ? "POSSIBLE" : "IMPOSSIBLE");
        }
    }
}

Measured memory_bytes: 17628
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <chrono> //1e+9で割る auto end= chrono::system_clock::now()-st;  cout<<end.count()%1e+9<<endl;
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef long double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)
ll N,M;
ll x,y;
const ll mod=1e+9+7;
vector<ll> xs;
ll yoko,tate;

ll calc(){
	ll res=0;
	sort(xs.begin(),xs.end());
	ll s=xs.size();
	rep(i,s-1){
		res=(res+ (xs[i+1]-xs[i])*(i+1)*(s-1-i) )%mod;
	}
	return res;
}

int main()
{
	cin>>N>>M;
	rep(i,N){
		cin>>x;
		xs.pb(x);
	}
	ll ans=calc();
	N=M;
	xs.clear();
	rep(i,N){
		cin>>x;
		xs.pb(x);
	}
	ans=(ans*calc())%mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 1400