akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

ll gcd(ll a, ll b) {
    if (b > a)
        swap(a, b);
    return a % b != 0 ? gcd(b, a % b) : b;
}

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

int main() {
    int N;
    cin >> N;
    ll ans = 1;
    for (int i = 0; i < N; ++i) {
        ll t;
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

int main(){
    int N;
    string S[2];
    cin>>N>>S[0]>>S[1];
    ll ans=1ll;
    int col=0;
    bool tate=false;
    if(S[0][0]==S[1][0]){
        ans*=3;
        tate=true;
        col=1;
    }else{
        ans*=6;
        col=2;
    }

    while(col<N){
        if(S[0][col]==S[1][col]){
            if(tate){
                (ans*=2)%=MOD;
            }
            tate=true;
            col++;
        }else{
            if(tate){
                (ans*=2)%=MOD;
            }else{
                (ans*=3)%=MOD;
            }
            tate=false;
            col+=2;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#two alpinist
N = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
mod = 10**9+7
 
#fixed[i]: i 山の高さが確定してる
fix_a= [0]*(N)
fix_b= [0]*(N)
fix_a[0] = A[0]
fix_b[-1] = B[-1]
for i in range(N-1):
    if A[i+1]>A[i]:
        fix_a[i+1] = A[i+1]
    if B[-(i+2)]>B[-(i+1)]:
        fix_b[-(i+2)] = B[-(i+2)]

ans = 1
for i in range(N):
    if fix_a[i]:
        if B[i]<fix_a[i]:
            ans = 0
            break
    if fix_b[i]:
        if A[i]<fix_b[i]:
            ans = 0
            break
            
for i in range(N):
    if fix_a[i] or fix_b[i]:
        continue
    ans *= min(A[i], B[i])
    ans %= mod
    
if A[-1] != B[0]:
    ans = 0
    
print(ans)



Measured memory_bytes: 19140
#include <bits/stdc++.h> 
using namespace std;
#define pb push_back
#define ll long long int
#define vi vector<int>
#define ii pair<int,int>
#define vli vector<ll>
#define graph vector<vector< int > >
#define vpi vector<pair<int ,int> >
#define vpli vector<pair<ll ,ll> >
#define mp make_pair
#define F first
#define S second
#define mod 998244353
#define INF (ll)1e10
#define wh(a) cout<<#a<<"  is  "<<a<<endl;
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define INI(a) memset(a,0,sizeof(a))
#define LIMIT 200006
 
void solve(){
    int n;
    cin>>n;
    string s[n];
    vpi ans1,ans2;
    vi ans;
    for(int i=0;i<n;++i){
        cin>>s[i];
        int cur=0;
        int minbal=0;
        for(int j=0;j<s[i].size();++j){
            if(s[i][j]=='(') cur++;
            else cur--;
            minbal=MIN(cur,minbal);
        }
        if(cur>0){
            ans1.pb({minbal,i});
        }
        else{
            int cur=0;
            int minbal=0;
            for(int j=(int)s[i].size()-1;j>=0;--j){
                if(s[i][j]=='(') cur++;
                else cur--;
                minbal=MAX(cur,minbal);
            }   
            ans2.pb({minbal,i});
        }
    }
    sort(ans1.begin(),ans1.end());
    sort(ans2.begin(),ans2.end());
    string fin="";
    for(int i=(int)ans1.size()-1;i>=0;--i){
        fin+=s[ans1[i].S];
        ans.pb(ans1[i].S);
    }
    for(int i=(int)ans2.size()-1;i>=0;--i){
        fin+=s[ans2[i].S];
        ans.pb(ans2[i].S);
    }
    int cur=0;
    for(int i=0;i<fin.size();++i){
        if(fin[i]=='(') cur++;
        else cur--;
        if(cur<0){
            cout<<"No"<<endl;
            return;
        }
    }
    if(cur==0){
        cout<<"Yes"<<endl;
        
    }
    else{
        cout<<"No"<<endl;
    }
}
 
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // #endif
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 50144
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */
namespace utils{

    class Repeater{
        int st;
        int ed;
        int d;
    public:
        class rep_iterator{
            int i; int d;
        public:
            rep_iterator(int x, int pd) :i(x), d(pd) {}

            int& operator*(){ return i; }
            bool operator==(const rep_iterator& k) const { return i == k.i; }
            bool operator!=(const rep_iterator& k) const { return i != k.i; }
            rep_iterator& operator++(){ i+=d; return *this; }
        };

        explicit Repeater(int N) :st(0), ed(N), d(1) {}
        Repeater(int b, int e) :st(b), ed(e), d(1) {if(st > ed){ st--; ed--; d = -1; } }

        rep_iterator begin() const{ return rep_iterator(st, d); }
        rep_iterator end() const{ return rep_iterator(ed, d); }

    };

    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll N;
    is >> N;
    if(!is) return;
    vector<double> p(N);
    for (auto &&x : p) {
        is >> x;
    } // end x
    vector<vector<double>> dp(N+1, vector<double>(N+1, 1));
    for (int i = 1; i <= N; ++i) {
        for (int win = 0; win <= i; ++win) {
            int lose = i - win;
            double pi = p[i-1];
            double wp = win > 0 ? dp[win-1][lose] * pi : 0;
            double lp = lose > 0 ? dp[win][lose-1] * (1-pi) : 0;
            dp[win][lose] = wp + lp;
        } // end win
    } // end i

    double sum = 0;
    for (int win = N / 2+1; win <= N; ++win) {
        sum += dp[win][N-win];
    } // end win

    cout << sum << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16);
#ifdef DEBUG
    string test_cases = "test_I.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 70784
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
P = inp.shift().split(' ').map(x => x-0)
Q = inp.shift().split(' ').map(x => x-0)
p = 0
q = 0

for (i=0; i<N; i++) {
    a = 0
    b = 0
    
    x = P[i]

    d = 0
    for (j=i+1; j<N; j++) {
       if (x > P[j]) {
           d++
       }
    }

    if (d > 0) {
        a = 1
        a *= d
        c = 1
        for (x = N - i - 1;x > 1; x--) {
            c *= x
        }
        p += a * c
    }


    x = Q[i]
    d = 0
    for (j=i+1; j<N; j++) {
       if (x > Q[j]) {
           d++
       }
    }

    if (d > 0) {
        a = 1
        a *= d
        c = 1
        for (x = N - i - 1;x > 1; x--) {
            c *= x
        }
        q += a * c
    }
}
console.log(Math.abs(p - q))


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];

  vector<int> b(N);
  for (int i = 0; i < N; ++i)
    ++b[A[i]];

  bool flag = true;
  for (int i = (N + 1) % 2; i < N; i += 2)
    if (!(i == 0 && b[i] == 1) && !(i != 0 && b[i] == 2))
      flag = false;

  long long ans = 1;
  for (int i = 0; i < N / 2; ++i)
    ans = (ans * 2) % 1000000007;

  if (flag)
    cout << ans << endl;
  else
    cout << 0 << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define Little 1
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,w=0,n=INF,m=0,o=0;
  std::cin >> x>>y;
  rep(i,y){
    std::cin >> z>>w;
    if(n>=w)n=w;
    if(m<=z)m=z;
  }
  if(m>n)std::cout << 0 << '\n';
  else std::cout << n-m+1 << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<math.h>
using namespace std;

int main(){

    int n;
    int i = 0;

    cin >> n;
    int an[n-1];

    while(i != n){
        cin >> an[i];
        i++;
    }

    i -= 1;

    while(i != 0){
        cout << an[i] << ' ';
        i--; 
    }

    cout << an[0] << endl;

    return 0;
}


Measured memory_bytes: 3076
N, M = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0

for i in range(2 ** N):
	x = bin(i)[2:].rjust(N, "0")
	flag = True
	for j in range(M):
		tmp = 0
		for k in range(1, s[j][0] + 1):
			index = s[j][k]
			if x[index - 1] == "1":
				tmp += 1
		if tmp % 2 != p[j] % 2:
			flag = False
	if flag:
		ans += 1
print(ans)


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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ldb long double 
#define db double
#define int long long

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >

#define mi map<int,int>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const int INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

int power_md(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res=(res%md*a%md)%md;
  a=(a%md*a%md)%md;
  n/=2;
}
res%=md;
return res;
}

int power(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a=a*a;
  n/=2;
}
return res;
}

int abst(int a)
{
 return ((a<0)?(-1*a):(a));
}

class cmp_set{
public:
	bool operator() (int a, int b){
		return a > b;
	}
};

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif



int froot(int x,int root[])
{
    if(x==root[x])
     return x;
     else
      return root[x]=froot(root[x],root);
}

int32_t main()
{
     fast;
    int n,m;
    cin>>n>>m;
    int root[n+1],cnt[n+1];
    for(int i=0;i<=n;i++)
    root[i]=i,cnt[i]=1;
    vpi v;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        v.pb({a,b});
    }
    reverse(v.begin(),v.end());
    vi res;
    int tmp=(n*(n-1))/2;
    res.pb(tmp);
    for(int i=0;i<v.size()-1;i++)
    {
         int t1=0;
        int a=v[i].first;
        int b=v[i].second;
        a=froot(a,root);
        b=froot(b,root);
        if(a<b)
        {
           root[b]=a;
           t1=cnt[a]*cnt[b]; 
           cnt[a]+=cnt[b];
        }
        else if(b<a)
        {
            root[a]=b;
            t1=cnt[b]*cnt[a];
            cnt[b]+=cnt[a];
        }
        tmp-=t1;
        res.pb(tmp);
    }
    reverse(res.begin(),res.end());
    for(int i=0;i<res.size();i++)
     cout<<res[i]<<"\n";
     
    return 0;
}

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

using namespace std;

#define F first
#define S second
typedef long long ll;
typedef long double ld;

int32_t main(){
	int a[] = {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};
	int k;
	cin >> k;
	cout << a[k - 1];
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    public static final PrintStream out = System.out;

    public static void main(String[] args) {
        String S = in.next();
        int N = S.length();

        int l = 0, c = 0;
        int[] result = new int[N];
        for (int i = 1; i < N; i++) {
            if (S.charAt(i) == 'R' && S.charAt(i - 1) == 'L') {
                int L = c - l, R = i - c;
                System.err.println("l: " + l + ", c: " + c + "L: " + L + ", R: " + R);

                result[c - 1] += L / 2 + L % 2;
                result[c - 1] += R / 2;
                result[c] += L / 2;
                result[c] += R / 2 + R % 2;

                l = i;
            } else if (S.charAt(i) == 'L' && S.charAt(i - 1) == 'R') {
                c = i;
            }
        }

        int L = c - l, R = N - c;
        System.err.println("l: " + l + "c: " + c + "L: " + L + ", R: " + R);

        result[c - 1] += L / 2 + L % 2;
        result[c - 1] += R / 2;
        result[c] += L / 2;
        result[c] += R / 2 + R % 2;

        for (int i : result) {
            out.print(i);
            out.print(" ");
        }
    }
}


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

public class Main {
	int A,B,C,D;
	public void solve() {
		A = nextInt();
		B = nextInt();
		C = nextInt();
		D = nextInt();

		out.println(Math.max(A*B,C*D));
	}
	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

#define pb push_back
#define ppp pop_back
#define pii pair<int,int>
#define fi first
#define se second

vector<int> solve(int n, int a, int b) {
	if (n == 1){
		return {a, b};
	}
	assert(__builtin_popcount(a) != __builtin_popcount(b));
	int x;
	for (int i=0; i<n; i++) {
		if ((a & (1<<i)) != (b & (1<<i))) {
			x = i;
			break;
		}
	}
	int a1=0, b1=0;
	for (int i=0; i<x; i++) {
		a1 |= a & (1<<i);
		b1 |= b & (1<<i);
	}
	for (int i=x+1; i<n; i++) {
		a1 |= (a & (1<<i))>>1;
		b1 |= (b & (1<<i))>>1;
	}
	int c = a1 ^ 1;
	vector<int> res1 = solve(n-1, a1, c);
	vector<int> res2 = solve(n-1, c, b1);
	vector<int> res;
	for (int y : res1) {
		int cur = a & (1<<x);
		for (int i=0; i<x; i++) {
			cur |= y & (1<<i);
		}
		for (int i=x; i<n-1; i++) {
			cur |= (y & (1<<i))<<1;
		}
		res.pb(cur);
	}
	for (int y : res2) {
		int cur = b & (1<<x);
		for (int i=0; i<x; i++) {
			cur |= y & (1<<i);
		}
		for (int i=x; i<n-1; i++) {
			cur |= (y & (1<<i))<<1;
		}
		res.pb(cur);
	}
	return res;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n, a, b;
	cin >> n >> a >> b;
	if (__builtin_popcount(a) % 2 == __builtin_popcount(b) % 2) {
		cout << "NO\n";
		return 0;
	}
	vector<int> ans = solve(n, a, b);
	cout << "YES\n";
	for (int cur : ans) {
		cout << cur << " ";
	}
	cout << "\n";
    return 0;
}


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

using namespace std;
typedef pair <int, int> ii;

const int N = 4005;
int a[N], b[N], n1, n2, n, r_idx[N][2], dp[N][N], f[N][N], g[N][N];
vector <int> ind[N];

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> n;
	for (int i = 1; i <= 2 * n; ++i) {
		char type; int x;
		cin >> type >> x;
		if (type == 'W') a[++n1] = x, r_idx[n1][0] = i;
		else b[++n2] = x, r_idx[n2][1] = i;
	}
	vector <ii> A(n + 5, {0, 0}), B(n + 5, {0, 0});
	A[0] = {N, N}; for (int i = n + 1; i <= n + 4; ++i) A[i] = {N, N};
	for (int i = 1; i <= n; ++i) {
		f[a[i]][r_idx[i][0]] = 1;
		A[i] = {a[i], r_idx[i][0]};
	}
	sort(A.begin() + 1, A.end());
	B[0] = {N, N}; for (int i = n + 1; i <= n + 4; ++i) B[i] = {N, N};
	for (int i = 1; i <= n; ++i) {
		g[b[i]][r_idx[i][1]] = 1;
		B[i] = {b[i], r_idx[i][1]};
	}
	sort(B.begin() + 1, B.end());
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= 2 * n; ++j) {
			f[i][j] += f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1];
			g[i][j] += g[i - 1][j] + g[i][j - 1] - g[i - 1][j - 1];
		}
	}
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= n; ++j)
			dp[i][j] = N * N;
	}
	dp[0][0] = 0;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= n; ++j) {
			if (i + j == 0) continue;
			int ind1 = A[i].second, aa = A[i].first, ind2 = B[j].second, bb = B[j].first;
			int cost_a, cost_b; cost_a = cost_b = N;
			if (i != 0) cost_a = (i - 1 - f[i - 1][ind1]) + (j - g[j][ind1]);
			if (j != 0) cost_b = (i - f[i][ind2]) + (j - 1 - g[j - 1][ind2]);
			if (i != 0) dp[i][j] = dp[i - 1][j] + cost_a;
			if (j != 0) dp[i][j] = min(dp[i][j], dp[i][j - 1] + cost_b);
			// cerr << "dp[" << i << "][" << j << "] : " << dp[i][j] << endl;
		}
	}
	cout << dp[n][n] << endl;
	return 0;
}

Measured memory_bytes: 98688
import java.util.*;
public class Main{
	public static void main(String[] args) {
    	Scanner itr = new Scanner(System.in);
      	int h = itr.nextInt();
      	int w = itr.nextInt();
      	
 		long row1 = (long)(w + 1) / 2;
      	long row2 = (long)w / 2;
      
      
      	if (h == 1 || w == 1) {
        	System.out.println(1);
          	return;
        }
      	int i = 1;
      	long res = 0;
      	
      	
      	while (i <= h) {
        	if (i % 2 == 1) res += row1;
          	else res += row2;
        	i++;
        }
      
      	System.out.println(res);
    }
}


Measured memory_bytes: 20692
N=int(input())
H=list(map(int,input().split()))
a=[]
a.append(0)
n=0
for i in range(len(H)-1):
    if H[i]>=H[i+1]:
        a[n]+=1
    elif H[i]<H[i+1]:
        a.append(0)
        n+=1
a.sort()
a.reverse()
print(a[0])

Measured memory_bytes: 14228
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>
#include <complex>

using namespace std;

#define mod 1000000007

int main()
{
	int r;
	cin >> r;
	cout << r * r << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n;
 cin>>n;
 vector<ll> p(n);
 for(ll i=0;i<n;i++) cin>>p[i];
 ll now = 0;
 priority_queue<mp,vector<mp>,greater<mp> > q;
 vector<ll> dp(n,inf);
 q.push( mp( 0 , 0 ) );
 while( !q.empty() ){
  mp now = q.top();
  q.pop();
  ll nn = now.second;
  ll cost = now.first;
  if( dp[nn] <=  cost ) continue;
  //cout<<nn<<' '<<cost<<endl;
  dp[nn] = cost;
  if( nn == n-1 ) continue;
  if( p[nn] == 0 ){
   for(ll i=1;i<=6;i++){
    ll next = min(n-1,nn + i);
    //if( next >= n-1 ){
     //cout<<cost+1<<endl;
     //return 0;
    //}
    q.push( mp( cost + 1, next ) );
   }
  }else{
   /*if( nn + p[nn] >= n-1 ){
    cout<<cost<<endl;
    return 0;
   }*/
   ll next = min(n-1,nn+p[nn] );
   q.push( mp( cost , next ) );
  }
 }
 cout<<dp[n-1]<<endl;
    return 0;
}



Measured memory_bytes: 4416
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string.h>
using namespace std;

typedef struct _jewels{
	int value;
	int price;
} jewels;

int main(void) {
	int N, answer = 0;
	jewels j[20];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> j[i].value;
	}
	for (int i = 0; i < N; i++) {
		cin >> j[i].price;
	}
	for (int i = 0; i < N; i++) {
		if (j[i].value > j[i].price)
		{
			answer += j[i].value - j[i].price;
		}
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>
int main(){
  int N;
  scanf("%d", &N);
  std::vector<int > b(N);
  for (int i=0; i<N; i++){
    scanf("%d", &b[i]);
  }
  std::vector<int > ans;
  for (int i=0; i<N; i++){
    int hit_index = -1;
    for (int j=0; j<b.size(); j++){
      if (b[j]==j+1){
        hit_index=j;
      }
    }
    if (hit_index==-1){
      printf("-1\n");
      return 0;
    }
    ans.push_back(hit_index+1);
    b.erase(b.begin()+hit_index);
  }
  std::reverse(ans.begin(), ans.end());
  for (int i=0; i<ans.size(); i++){
    std::cout << ans[i] << std::endl;
  }
  return 0;
}


Measured memory_bytes: 888
#include <iostream>

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

    for (int i = 0; i <= n; i++) {
        int j = 0;
        for (j = 0; j < n - i; j++) {
            if (s[j+i] != t[j]) {
                break;
            }
        }
        if (j >= n - i) {
            std::cout << (n - i) + i * 2 << std::endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
MOD = 1000000007

def fastpow(a, n):
    x = a
    ans = 1
    while n:
        if n & 1:
            ans = (ans*x)%MOD
        n>>=1
        x = (x*x)%MOD;
    return ans

def inv(a):
    return fastpow(a, MOD-2)

def comb(n,r):
    ret = 1
    for i in range(r):
        ret = (ret*(n-i))%MOD
        ret = (ret*inv(i+1))%MOD
    return ret

n,a,b = map(int,input().split()) 
ans = fastpow(2,n)-1-comb(n,a)-comb(n,b)
while ans < 0:
    ans += MOD
print(ans)

Measured memory_bytes: 41196
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x,x2;
  cin >> x;
  x2 = x;
  int f = 0;
  while(x2>0){
    f += x2%10;
    x2 /= 10;
  }
  cout << (x%f==0 ? "Yes" : "No") << endl;
  return 0;
}

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

using namespace std;
const long long INF=1e18;

int main(){
  long long a, b, q, s[100009], t[100009];
  cin >> a >> b >> q;
  s[0]=-INF;
  t[0]=-INF;
  for(int i=1;i<=a;i++)cin >> s[i];
  for(int i=1;i<=b;i++)cin >> t[i];
  s[a+1]=INF;
  t[b+1]=INF;
  for(int i=0;i<q;i++){
    long long x; cin >> x;
    auto sub = upper_bound(s, s+a+2, x);
    auto tub = upper_bound(t, t+b+2, x);
    long long mn=INF;
    for(long long S: {*(sub-1), *sub}){
      for(long long T: {*(tub-1), *tub}){
        long long d1 = abs(S-x) + abs(T-S);
        long long d2 = abs(T-x) + abs(S-T);
        mn = min({mn, d1, d2});
      }
    }
    cout << mn << endl;
  }
}



Measured memory_bytes: 5196
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

if P == Q:
  print(0)
  exit(0)
  
import itertools as it

S = list(it.permutations(range(1,N+1)))
pi,qi = -10,-10
for i in range(len(S)):
  if S[i] == P:
    pi = i
  elif S[i] == Q:
    qi = i
  if pi >= 0 and qi >= 0:
    break

ans = abs(pi-qi)
print(ans)

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

long int M = 1e+9+7;
int main(void){
    string s,t;
    cin >> s >> t;
    int dp[3001][3001];
    //cout << s.size() << endl;
    rep(i,s.size()+1){
        rep(j,t.size()){
            dp[i][j] = 0;
        }
    }
    //stringの添え字-1
    srep(i,1,s.size()+1){
      srep(j,1,t.size()+1){
          dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
          if(s[i-1] == t[j-1]){
              chmax(dp[i][j] , dp[i-1][j-1]+1);
          }
      }  
    }
    
    vector<char> ans;
    
    int i = s.size();
    int j = t.size();
    //cout << s.size() << endl;
    while(dp[i][j] != 0){
        if(i > 0 && dp[i-1][j] == dp[i][j]){
            i--;
        }else if(j > 0 && dp[i][j-1] == dp[i][j]){
            j--;
        }else{
            ans.push_back(s[i-1]);
            i--; j--;
        }
        //i--; j--;
        
    }
    for(int i = ans.size()-1; i>=0; i--){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 35456
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int q;
    cin >> q;
    rep(i, q){
        int com, b, e;
        cin >> com >> b >> e;
        if(com==0) cout << *min_element(a.begin()+b, a.begin()+e) << endl;
        else cout << *max_element(a.begin()+b, a.begin()+e) << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <climits>
#include <cmath>
using namespace std;

int main(){
    int D, G;
    int p[15], c[15], point[15];
    int currS, currB, currlim, currANS;
    int ANS = INT_MAX;

    cin >> D >> G;
    for(int i=0; i<D; i++){
        cin >> p[i] >> c[i];
        point[i] = 100*(i+1)*p[i] + c[i];
    }

    for(int bit=0; bit<(1<<D); bit++){
        currS = 0;
        currB = 0;
        currlim = 0;
        currANS = 0;
        
        for(int i=0; i<D; i++){
            if(bit & (1<<i)){
                currS += point[i];
                currANS += p[i];
            }else{
                currB = 100*(i+1);
                currlim = p[i];
            }
        }

        if(currS<G){
            currANS += (G-currS+currB-1)/currB;
            if((G-currS+currB-1)/currB < currlim) ANS = min(ANS, currANS);
        }else{
            ANS = min(ANS, currANS);
        }
    }

    cout << ANS << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll n, m;
    string s;
    cin >> n >> m >> s;
    vector<vector<ll>> g(n), c(n, vector<ll>(2));
    REP(i, m){
        ll a, b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
        c[a][s[b] - 'A']++;
        c[b][s[a] - 'A']++;
    }
    
    queue<ll> que;
    vector<bool> used(n);
    REP(i, n){
        if(c[i][0] == 0 || c[i][1] == 0){
            que.push(i);
            used[i] = true;
        }
    }
    
    ll cnt = que.size();
    while(!que.empty()){
        ll u = que.front(); que.pop();
        REP(i, g[u].size()){
            ll v = g[u][i];
            c[v][s[u] - 'A']--;
            if(c[v][s[u] - 'A'] == 0 && !used[v]){
                que.push(v);
                cnt++;
                used[v] = true;
            }
        }
    }
    cout << ((cnt != n)? "Yes" : "No") << endl;
}


Measured memory_bytes: 22916
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
bs = gets.chomp.split.map(&:to_i)
ans = 0
n.times do |i|
  ans += [as[i] + as[i+1], bs[i]].min
  if as[i] + as[i+1] > bs[i]
    as[i+1] -= [bs[i] - as[i], 0].max
  else
    as[i+1] = 0
  end
end
puts ans

Measured memory_bytes: 21772
#include<stdio.h>
  int main()
  {   int a,b,c,ans=0;
      scanf("%d %d %d",&a,&b,&c);
      if(a%b==0)
        ans=a/b;
       else
         ans=(a/b)+1;
       printf("%d",ans*c);
      
    
    
  }

Measured memory_bytes: 1728
#include <iostream>


using namespace std;


int main()
{
  int n, p[100], x=0, maxv=0;
  char s[100];

  cin >> n;
  cin >> s;
  for (int i=0; i<n; i++){
    if (s[i] == 'I') x++;
    else if (s[i] == 'D') x--;
    if (x > maxv) maxv = x;
  }
  cout << maxv << endl;
  
  return 0;
}


Measured memory_bytes: 256
N,M,X = map(int,input().split())
A = [int(i) for i in input().split()]

counterToN,counterToX = 0,0

for i in A:
    if i - 1 < X :
        counterToN += 1
    else :
        counterToX += 1

print(min([counterToN,counterToX]))

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


enum Type{
	Friend,
	Enemy,
	Undefined,
};


struct Info{
	int value,adj_num;
	char name[17];
};

int N,ans;
Info info[40];
int adj_table[40][40];
char adj_name_table[40][40][17];


bool strCmp(char* base, char* comp){
	int length1,length2;
	for(length1=0;base[length1] != '\0';length1++);
	for(length2=0;comp[length2] != '\0';length2++);
	if(length1 != length2)return false;

	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i])return false;
	}
	return true;
}

void strcpy(char* to,char* str){
	for(int i=0;str[i] != '\0';i++){
		to[i] = str[i];
		to[i+1] = '\0';
	}
}

void recursive(Type type[40],int index,int sum){

	if(index == N-1){
		ans = max(ans,sum);
		return;
	}

	int check = sum;
	for(int i = 0; i < N; i++){
		if(type[i] == Undefined){
			check += info[i].value;
		}
	}
	if(check <= ans)return;

	Type next_type[40];
	for(int i = 0; i < N; i++)next_type[i] = type[i];

	next_type[index+1] = Enemy;
	recursive(next_type,index+1,sum);

	if(type[index+1] == Undefined){
		Type next_type2[40];
		for(int i = 0; i < N; i++)next_type2[i] = type[i];
		next_type2[index+1] = Friend;

		for(int i = 0; i < info[index+1].adj_num; i++){
			next_type2[adj_table[index+1][i]] = Enemy;
		}
		recursive(next_type2,index+1,sum+info[index+1].value);
	}
}

void func(){

	for(int i = 0; i < N; i++){
		scanf("%s %d %d",info[i].name,&info[i].value,&info[i].adj_num);
		for(int k = 0; k < info[i].adj_num; k++){
			scanf("%s",adj_name_table[i][k]);
		}
	}

	for(int i = 0; i < N; i++){
		for(int k = 0; k < info[i].adj_num; k++){
			for(int p = 0; p < N; p++){
				if(strCmp(info[p].name,adj_name_table[i][k])){
					adj_table[i][k] = p;
					break;
				}
			}
		}
	}

	ans = info[0].value;
	Type first_type[40];
	for(int i = 0; i < N; i++)first_type[i] = Undefined;
	first_type[0] = Friend;

	for(int i = 0; i < info[0].adj_num; i++){
		first_type[adj_table[0][i]] = Enemy;
	}

	recursive(first_type,0,info[0].value);

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


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}




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

signed main(){
	int sx,sy,tx,ty;
	cin>>sx>>sy>>tx>>ty;
	rep(i,tx-sx)cout<<"R";
	rep(i,ty-sy)cout<<"U";
	rep(i,tx-sx)cout<<"L";
	rep(i,ty-sy)cout<<"D";
	cout<<"D";
	rep(i,tx-sx+1)cout<<"R";
	rep(i,ty-sy+1)cout<<"U";
	cout<<"L";
	cout<<"U";
	rep(i,tx-sx+1)cout<<"L";
	rep(i,ty-sy+1)cout<<"D";
	cout<<"R";
	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
x1 = 0
x2 = 0
x3 = 0
x4 = 0
x5 = 0
x6 = 0
x7 = 0
x8 = 0
c = 0

for i in range(N):
	if a[i] < 400:
		x1 = 1
	elif a[i] < 800:
		x2 = 1
	elif a[i] < 1200:
		x3 = 1
	elif a[i] < 1600:
		x4 = 1
	elif a[i] < 2000:
		x5 = 1
	elif a[i] < 2400:
		x6 = 1
	elif a[i] < 2800:
		x7 = 1
	elif a[i] < 3200:
		x8 = 1
	else:
		c += 1
s = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8
if s == 0:
	print(1, c)
else:
	print(s, s + c)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
using namespace std;

using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    // vector<ll> A;
    multiset<ll> A;
    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        // A.push_back(a);
        A.insert(a);
    }
    // cout << *A.rbegin() << endl;
    // sort(A.begin(), A.end(), greater<ll>());
    // for (int i = 0; i < M; i++) {
    //     A[0] /= 2;
    //     int j = 0;
    //     while (A[j] < A[j + 1]) {
    //         swap(A[j], A[j + 1]);
    //         j++;
    //     }

    // }
    for (int i = 0; i < M; i++) {
        // vector<ll>::iterator max_it = max_element(A.begin(), A.end());
        // size_t max_id = distance(A.begin(), max_it);
        ll max_value = *A.rbegin();
        A.erase(A.lower_bound(max_value));
        ll new_value = max_value / 2;
        A.insert(new_value);
        // A[max_id] /= 2;
    }
    
    ll sum = accumulate(A.begin(), A.end(), 0LL);
    cout << sum << endl;
}

Measured memory_bytes: 4992
def hit(n, m, goal, d, dans)
  h = 0
  until h == d
    yoko = dans[h]
    if m != n - 1 and yoko[m] == 1
      m += 1
    elsif m.nonzero? and yoko[m - 1] == 1
      m -= 1
    end
    h += 1
  end
  goal == m
end

until (n = $<.gets.to_i).zero?
  m    = $<.gets.to_i - 1
  goal = $<.gets.to_i - 1
  d    = $<.gets.to_i
  dans = Array.new(d) { $<.gets.chomp.chars.map(&:to_i) }
  
  if hit(n, m, goal, d, dans)
    puts 0
  else
    try = ->{
      d.times do |h|
        ([0] + dans[h] + [0]).each_cons(3).with_index do |a, x|
          if a.sum.zero?
            dans[h][x] = 1
            return "#{h + 1} #{x + 1}" if hit(n, m, goal, d, dans)
            dans[h][x] = 0
          end
        end
      end
      1
    }
    puts try.()
  end
end


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

int main() {
    int n; cin >> n;
    vector<int> x(n), ans(n * n);
    for(int i = 0; i < n; ++i) {
        cin >> x[i];
        ans[--x[i]] = i + 1;
    }

    vector<int> cnt(n + 1), ok;
    for(int i = 0; i < n * n; ++i) {
        if(ans[i] != 0) {
            const int val = ans[i];
            if(cnt[val] != val - 1) {
                ans.clear();
                break;
            }
            cnt[val] = -1;
            for(int j = 0; j < n - val; ++j) {
                ok.push_back(val);
            }
        } else {
            int use = -1;
            auto calc = [&] (int val) {
                return x[val - 1] - i - (val - cnt[val]);
            };
            for(int j = 1; j <= n; ++j) {
                if(cnt[j] == -1 || cnt[j] + 1 == j) continue;
                if(use == -1 || calc(j) < calc(use)) {
                    use = j;
                }
            }
            if(use == -1) {
                if(ok.empty()) {
                    ans.clear();
                    break;
                }
                ans[i] = ok.back();
                ok.pop_back();
            } else {
                ans[i] = use;
                ++cnt[use];
            }
        }
    }

    if(ans.empty()) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
        for(int i = 0; i < n * n; ++i) {
            cout << ans[i] << " \n"[i + 1 == n * n];
        }
    }
}


Measured memory_bytes: 2812
#include"bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const int N = 1e6 + 5 ;
const int MOD = 1e9+7;
typedef long long int ll;
vector< pair< ll , ll > > vp;
map<ll , ll > mp , mpp;
vector < ll > v , v1 , v2 ;
ll dp[N] , visit[N] ;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<"  ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int a[N] ;
ll go(int n) {
	int x = 1e9 + 5 , y = 1e9 + 5 ;
	if(dp[n] != - 1) return dp[n] ;
	if(n <= 1) return 0 ;
	if(n > 2) x = abs(a[n] - a[n - 2]) + go(n - 2) ;
	if(n > 1) y = abs(a[n] - a[n - 1]) + go(n  - 1) ;
	return dp[n] = min(x , y ) ;
}
int main()
{ fast;
   ll n, m, val, k, d, mi=1e9, mx(0) ;
   ll sum(0), ct(0), p(0), q(0);
   string s ;
   cin >> n ;
   memset(dp , -1 , sizeof(dp)) ;
   for(int i = 1;  i <= n; i++ ) cin >> a[i] ;
   cout << go(n) ;
}


Measured memory_bytes: 11520
a,b = map(int, input().split())
t = [["."]*100 for _ in range(50)] + [["#"]*100 for _ in range(50)]
j = 0
for i in range(b-1):
  j += 3
  if j%100 == 0 or j%100 == 99:
    j += 3
  t[j//100][j%100] = "#"
j = 100*100-1
for i in range(a-1):
  j -= 3
  if j%100 == 0 or j%100 == 99:
    j -= 3
  t[j//100][j%100] = "."
print(100,100)
for x in t:
  print("".join(x))

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

using namespace std;

int main()
{


  int n,m;
  cin >> n >> m;
  vector<int > ar(m);

  int count =0;
  for (int i = 0; i < m; ++i)
  {
  	/* code */
  	cin >> ar[i];
  	count = count + ar[i];
  }

  if(count > n)
  	cout << "-1" << endl;
  else{
  	cout << n -count << endl;
  }




}


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

bool check (string s){
  int n = s.length();
  if (n%2==1){
    return false;
  }
  else {
    return (s.substr(0,n/2-1)==s.substr(n/2));
  }
}

int main(){
  long long x, y;
  cin >> x >> y;

  int cnt = 0;
  long long index = x;
  while (index<=y){
    index *= 2;
    cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
double maxn = 114514.1919;
int T, D, a, b, c, d;
int main() {
	cin >> T >> D >> a >> b >> c >> d;
	for (int i = 0; i <= D; i += c) {
		for (int j = 0; j <= D; j += d) {
			if (i + j >= 1 && i + j <= D) {
				maxn = min(maxn, abs(T - (double)(a*i + b*j) / (i + j)));
			}
		}
	}
	cout << fixed << setprecision(15) << maxn << endl;
	return 0;
}

Measured memory_bytes: 1240
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    n,m=map(int,input().split())
    XY=[tuple(map(int,input().split())) for i in range(m)]
    graph=[[]for _ in range(n)]
    deg=[0]*n #頂点iの入次数
    for x,y in XY:
        graph[x-1].append(y-1)
        deg[y-1]+=1
    que=deque()
    for v in range(n):
        if deg[v]==0:
            que.append(v)
    dp=[0]*n
    while que:
        v=que.popleft()
        for nv in graph[v]:
            deg[nv]-=1
            if deg[nv]==0:
                que.append(nv)
                dp[nv]=max(dp[nv],dp[v]+1)
    ans=0
    for v in range(n):
        ans=max(ans,dp[v])
    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 36448
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
constexpr long long LINF = 1000100010001000100LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll rui(ll a,ll b){
     ll ans=1;
     while(b>0){
        if(b&1) ans=ans*a%MOD;
        a=a*a%MOD;
        b/=2;
    }
     return ans % MOD;
}

ll COM(ll a, ll b){
    ll ans = 1;
    for(ll i=a; i>a-b; i--){
        ans = ans * i % MOD;
    }
    for(ll i=1; i<=b; i++){
        ans =(ans*rui(i, MOD-2)) % MOD;
    }
    return ans;
}

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

    ll res = rui(2, n) - 1+ MOD*3 - COM(n,a) - COM(n,b);
    cout << res % MOD << ln;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	int ans = 0;
	for (int i = 0; i < 18; i++) {
		M = N / pow(10, i);
		if (!M) {
			continue;
		}
		int box = 9 * i;
		while (M) {
			box += M % 10;
			M /= 10;
		}
		if (i) {
			box--;
		}
		ans = max(ans, box);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define lp(i, x, y) for(int i = x ; i < y ; i++)
#define lp_rev(i, x, y) for(int i = x ; i >= y ; i--)
#define ff first
#define ss second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(v)  v.begin(), v.end()
#define vll vector<long long int>
#define vi vector<int>
#define Fasttt ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
typedef unsigned long long ull;
typedef long long ll;
#define endl "\n"
ll mod = 1000000007;

int main()
{
	int a, b;
	cin>> a>> b;
	if(a > 9  or  b > 9)
		cout<< -1;
	else
		cout<< a*b;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
ll N, K;
ll fact[2010], fact_inv[2010];

// 逆元を求める
long long mod_inv(long long value) {

	long long b = MOD, u = 1, v = 0;

	while (b) {
		long long t = value / b;
		value -= t * b;
		swap(value, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) u += MOD;

	return u;
}

void calc_fact() {
	fact[0] = 1; fact_inv[0] = 1;
	for (int i = 1; i < 2010; i++) {
		fact[i] = i * fact[i - 1];
		fact[i] %=  MOD;
		fact_inv[i] = mod_inv(fact[i]);
	}
}

ll comb(ll n, ll r) {
	if (r == 0) return 1;
	return fact[n] * fact_inv[r] % MOD * fact_inv[n - r] % MOD;
}

void solve() {

	cin >> N >> K;

	calc_fact();

	for (int i = 1; i <= K; i++) {
		if (N - K + 1 < i) {
			cout << 0 << endl;
			continue;
		}
		ll ans = comb(K - 1, i - 1) * comb(N - K + 1, i) % MOD;
		cout << ans << endl;

	}

	return;

}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 256