akhauriyash/Code-Regression huggingface dataset:
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    auto dp = new long[][](4, S.length + 1);
    dp[0][0] = 1;
    foreach (i; 0 .. S.length)
    {
        dp[0][i + 1] = dp[0][i];
        dp[1][i + 1] = dp[1][i];
        dp[2][i + 1] = dp[2][i];
        dp[3][i + 1] = dp[3][i];
        if (S[i] == 'A')
        {
            dp[1][i + 1] += dp[0][i];
        }
        if (S[i] == 'B')
        {
            dp[2][i + 1] += dp[1][i];
        }
        if (S[i] == 'C')
        {
            dp[3][i + 1] += dp[2][i];
        }
        if (S[i] == '?')
        {
            // writeln(i);
            dp[1][i + 1] += dp[0][i];
            dp[2][i + 1] += dp[1][i];
            dp[3][i + 1] += dp[2][i];

            dp[0][i + 1] += dp[0][i] * 2;
            dp[1][i + 1] += dp[1][i] * 2;
            dp[2][i + 1] += dp[2][i] * 2;
            dp[3][i + 1] += dp[3][i] * 2;
        }
        dp[0][i + 1] %= MOD;
        dp[1][i + 1] %= MOD;
        dp[2][i + 1] %= MOD;
        dp[3][i + 1] %= MOD;
    }
    // writeln(dp[0]);
    // writeln(dp[1]);
    // writeln(dp[2]);
    // writeln(dp[3]);
    writeln(dp[3][S.length]);
}


Measured memory_bytes: 4248
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){
    int a,b ;
    cin >> a >> b;
    if (a<=0 and b>=0) cout << "Zero" << endl;
    else if (a>0 or (abs(a-b)%2==1)) cout << "Positive" << endl;
    else cout << "Negative" << endl;
    
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

typedef pair<double, int64_t> P;

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

    deque<P> que;
    double heat = 0;
    int volume = 0;

    cout << fixed << setprecision(10);

    for(int i=0; i<N; i++){
        double t;
        int v;
        cin >> t >> v;
        heat += t*v;
        volume += v;

        while(volume > L){
            auto p = que.front();
            if(p.second <= volume-L){
                heat -= p.first * p.second;
                volume -= p.second;
                que.pop_front();
            }else{
                heat -= p.first * (volume-L);
                que.front().second -= volume-L;
                volume = L;
            }
        }

        while(que.size() > 0){
            auto p = que.back();
            if(p.first < t){
                break;
            }else{
                t = (p.first*p.second + t*v) / (p.second + v);
                v += p.second;
                que.pop_back();
            }
        }
        
        que.push_back({t, v});
        double ans = heat / L;
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 18704
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> xy_t;

const xy_t INF_VECT = xy_t(100, 100);
const xy_t ZERO_VECT = xy_t(0, 0);
const double ERR = 0.00001;

xy_t center(xy_t p, xy_t q);

int main()
{
//    ifstream fin("1132_input.txt");

    int num;
    while(1){
        cin >> num;
//        fin >> num;
        if(num == 0) break;
        
        xy_t point[num];
        for(int i = 0; i < num; i++){
            double x, y;
            cin >> x >> y;
//            fin >> x >> y;
            point[i] = xy_t(x, y);
        }

        if(num == 1){
            cout << "1" << endl;
        }

        else if(num > 1){
            int max = 1;
            for(int i = 0; i < num-1; i++){
                for(int j = i+1; j < num; j++){
                    xy_t vec = center(point[i], point[j]);
                    if(vec != INF_VECT){
                        xy_t mid = (point[i] + point[j]) * xy_t(0.5, 0);
                        xy_t cent = mid + vec;
                        
                        int cnt = 0;
                        for(int k = 0; k < num; k++){
                            xy_t r = point[k] - cent;
                            if(abs(r) <= 1 + ERR) cnt++;
                        }
                        if(cnt > max) max = cnt;

                        cent = mid - vec;
                        cnt = 0;
                        for(int k = 0; k < num; k++){
                            xy_t r = point[k] - cent;
                            if(abs(r) <= 1 + ERR) cnt++;
                        }
                        if(cnt > max) max = cnt;
                    }
                }
            }
            cout << max << endl;
        }
    }
    return 0;
}


xy_t center(xy_t p, xy_t q)
{    
    xy_t r = q-p;
    double d = abs(r);

    if(d > 2){
        return INF_VECT;
    }
    else if(d == 2){
        return ZERO_VECT;
    }
    else{
        double l = sqrt(4 - d*d) / 2;
        xy_t r_ = r * xy_t(0, 1);
        r_ *= xy_t(l/d, 0);
        return r_;
   }
}

Measured memory_bytes: 1260
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL <<60;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始
int a [502][502];
vector<pair<int,int> > v;

int main(){
  int N;
  cin>>N;
  vector<int> a(N,0);
  for(int i = 0; i < N; i++) cin>>a[i];
  for(int i = 0; i < N; i++) {
    
    if(a[i]%2!=0){
      cout<<"first"<<endl;
      return 0;
    }
  }
  cout<<"second"<<endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

void solve()
{
    int n;
    cin >> n;
    list<pair<int, int>> red, bule;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        red.push_back(make_pair(a, b));
    }
    REP(i, n) {
        int c, d;
        cin >> c >> d;
        bule.push_back(make_pair(c, d));
    }
    bule.sort();
    int ans = 0;
    for(auto b : bule){
        int y = -1;
        auto removeItem = red.end();
        for(auto itr = red.begin(); itr != red.end(); ++itr){
            if(b.first > (*itr).first && b.second > (*itr).second) {
                if(y < (*itr).second) {
                    y = (*itr).second;
                    removeItem = itr;
                }
            }
        }
        if(removeItem != red.end()) {
            red.erase(removeItem);
            ans++;
        }
    }
    cout << ans << "\n";
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
from collections import defaultdict
n, m = map(int, input().split())
py = []
dict_p = defaultdict(list)
for i in range(m):
    p, y = map(int, input().split())
    py.append((p, y))
    dict_p[p].append(y)
#print(dict_p)
for values in dict_p.values():
    values.sort()

for p, y in py:
    x = bisect_left(dict_p[p], y)
    ans = "{:006}".format(p) + "{:006}".format(x+1)
    print(ans)


Measured memory_bytes: 80088
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }

int main(){
    int n; cin >> n;
    int ma = 0, sum = 0;
    rep(i,n){
        int x; cin >> x;
        ma = max(ma, x);
        sum += x;
    }
    cout << sum - ma/2 << endl;
    return 0;
}


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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int t = sc.nextInt();
		int s = sc.nextInt();
		if(s*t>=d)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}


Measured memory_bytes: 35672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;cin >> a >> b >> c;
	if(a<b){
		if(a<c && c<b) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else{
		if(b<c && c<a) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int dig(ll p) {
    return floor(log10(p)) + 1;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> divisors;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            divisors.push_back(i);
        }
        if (n % i == 0 && i * i != n) {
            divisors.push_back(n / i);
        }
    }
    int ans = 1000;
    for (auto e: divisors) {
        int tmp = max(dig(e), dig(n/e));
        chmin(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

struct state{
	  int x,y;
	  int s;
	  int t;
	  int dir;
	  state(int xi, int yi, int score,int time){
			x = xi; y = yi; s = score; t = time;
//			dir = abs((ll)xi*(ll)yi*(ll)time ) % 6 ;
			dir = abs((ll)xi*(ll)yi*(ll)time % 6 ) ;
	  }
	  bool operator > (const state& tgt) const {
			return s > tgt.s;
	  }
	  bool operator < (const state& tgt) const {
			return s < tgt.s;
	  }
	  bool operator == (const state& tgt) const {
			if(x == tgt.x and y == tgt.y)
				  return true;
			else
				  return false;
	  }
	  
};

const int dx[2][7] = {{ 0, 1, 1, 0,-1,-1, 0}, { 0, 1, 1, 0,-1,-1, 0}};
const int dy[2][7] = {{ 1, 0,-1,-1,-1, 0, 0}, { 1, 1, 0,-1, 0, 1, 0}};
int sx,sy,gx,gy;
int lx,ly;
int n;
int used[300][300][6];
vvi board;

void dijk(){

	  state ini = state(sx,sy,0,0);
	  priority_queue<state,vector<state>,greater<state> > q;
	  q.push(ini);

	  state corr = state(0,0,0,0);
	  while(q.size()){
			corr = q.top();		q.pop();

			if(corr == state(gx,gy,0,0)) break; // ??´??????
			if(used[corr.y+150][corr.x+150][corr.t%6] != -1)  continue; // ??¢?´¢??????
//			cout << "    POP (" << corr.x << "," << corr.y << ") "<< corr.s << "s ," << corr.t << "t" << endl;

			used[corr.y+150][corr.x+150][corr.t%6] = 1; // ??¢?´¢??????

			for(int i=0; i<7; i++){
				  int tmp = (corr.x + 300) % 2;
				  int nx  = corr.x + dx[tmp][i];
				  int ny  = corr.y + dy[tmp][i];
				  if(abs(nx) > lx || abs(ny) > ly)  continue; // ?£????
				  if(board[ny+150][nx+150] == 1)	continue; // ??¶???
				  
				  int score = corr.s;
				  if(corr.dir != i) score += 1; // ???????????????????????´???
//				  cout << "      PUSH (" << nx << "," << ny << ") "<< score <<"s ," << corr.t+1 << "t" << endl;
				  state next = state(nx, ny, score, corr.t+1); 
				  if(used[ny+150][nx+150][next.t%6] != 1)
						q.push(next);
			}
	  }
	  if(corr == state(gx,gy,0,0)) // ??´??????
			cout << corr.s << endl;
	  else
			cout << -1 << endl;
}


int main(){
	  int x = -11;
	  int mod = 5;
//	  cout << x % mod << endl;
//	  cout << (x % mod + mod) % mod << " " << abs(x) % mod << endl;
	  cin >> sx >> sy >> gx >> gy;
	  cin >> n;
	  board = vvi(300,vi(300,0));
	  memset(used,-1,sizeof(used));
	  for(int i=0; i<n; i++){
			int xi,yi; cin >> xi >> yi;
			board[yi+150][xi+150] = 1;
	  }
	  cin >> lx >> ly;
	  dijk();
	  
}

Measured memory_bytes: 4440
#include <cstdio>
#include <cstring>
using namespace std;

const int md = 1000000007;

const int N = 2000000;
int fact[N + 1], factinv[N + 1];

inline int add(int a, int b) 
{
	a += b;
	if (a >= md) a -= md;
	return a;
}
inline int mul(int a, int b) 
{
	return (int)((long long)a * b % md);
}
inline int po(int a, int b) 
{
	int r = 1;
	while (b) {
		if (b & 1) r = mul(r, a);
		a = mul(a, a);
		b >>= 1;
	}
	return r;
}
inline int inv(int a) 
{
	return po(a, md - 2);
}
inline int di(int a, int b) 
{
	return mul(a, inv(b));
}
void init() 
{
	fact[0] = factinv[0] = 1;
	for (int i = 1; i <= N; ++i) {
		fact[i] = mul(fact[i - 1], i);
		factinv[i] = inv(fact[i]);
	}
}
inline int Cnk(int a, int b) 
{
	return mul(fact[a], mul(factinv[b], factinv[a - b]));
}

char s[N + 1];

int main() 
{
	init();
	int n;
	scanf("%d%s", &n, s);
	int k = strlen(s);
	int ans = 0;
	for (int i = k; i <= n + k; ++i) ans = add(ans, mul(po(26, n + k - i), mul(Cnk(i - 1, k - 1), po(25, i - k))));
	printf("%d\n", ans);
	return 0;
}


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

int main(){
	char word[13];
	scanf ("%s", word);
	int X = strlen(word);
	int save[11] = {0};
	int B=0;
	
	for (int i=0; i<=X; i++){
		if (word[i]=='B'){
			B++;
			continue;
		}
		else if (word[i]!='B'){
			int remo = 0;
			remo = B*2;
			for (int j=1; j<=remo; j++){
				if (i-j >= 0){
					save[i-j] = 1;
				}
				else{
					break;
				}
			}
			B=0;
		}
	}
	
	for (int p=0; p<X; p++){
		if (save[p] == 0){
		printf("%c", word[p]);
		}
	}
	return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    cout << "x";
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

int main() {
    int N;
    cin >> N;
    long long res = 0;
    vector<vector<long long>> num(10, vector<long long>(10, 0));
    for (int n = 1; n <= N; ++n) {
        vector<int> d;
        int nn = n;
        while (nn) {
            d.push_back(nn % 10);
            nn /= 10;
        }
        int a = d[0];
        int b = d.back();
        if (!a || !b) continue;
        ++num[a][b];
    }
    for (int a = 1; a < 10; ++a) {
        for (int b = 1; b < 10; ++b) {
            res += num[a][b] * num[b][a];
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int m,f,r;
    char ev;
    while(true){
        scanf("%d %d %d",&m,&f,&r);
        if(m == -1 && f == -1 && r == -1) break;
        if(m == -1 || f == -1){
            ev = 'F';
        }else if(m+f >= 80){
            ev = 'A';
        }else if(m+f >= 65){
            ev = 'B';
        }else if(m+f >= 50){
            ev = 'C';
        }else if(m+f >= 30){
            ev = 'D';
            if(r >= 50) ev = 'C';
        }else {
            ev = 'F';
        }
        printf("%c\n",ev);
    }
}


Measured memory_bytes: 2760
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void){
    ll k, t;
    cin >> k >> t;
    ll a[t];
    for(ll i = 0; i < t; i++){
        cin >> a[i];
    }
    ll sum = 0;
    sort(a, a+t);
    for(ll i = 0; i < t-1; i++)
        sum += a[i];
    ll ans = 0;
    if(sum < a[t-1])
        ans = a[t-1]-sum-1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#C Lower
n=int(input())
h=list(map(int,input().split()))
ma=[]
m=0
for i in range(n-1):
    if h[i]>=h[i+1]:
        m+=1
    else:
        ma.append(m)
        m=0
ma.append(m)
print(max(ma))

Measured memory_bytes: 14252
//RoundUptheMean.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		double a=sc.nextInt();
        double b=sc.nextInt();
        double average=(a+b)/2;
        double sum=Math.ceil(average);
        int ans=(int)sum;

        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int curr_max = arr[0], res = 0;
	for (int i = 1; i < n; i++) {
		if (arr[i] < curr_max)
			res += curr_max - arr[i];
		curr_max = max(curr_max, arr[i]);
	}
	cout << res;
	return 0;
}


Measured memory_bytes: 5124
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;

struct Node {
    int key = INT_MAX;
    Node* left = NULL;
    Node* right = NULL;
    Node() {}
    Node(int key) : key(key) {}
    void preprint() {
        cout<<" "<<this->key;
        if (left != NULL) {
            left->preprint();
        }
        if (right != NULL) {
            right->preprint();
        }
    }
    void inprint() {
        if (left != NULL) {
            left->inprint();
        }
        cout<<" "<<this->key;
        if (right != NULL) {
            right->inprint();
        }
    }
    void insert(int key) {
        if (key < this->key) {
            if (left == NULL) left = new Node(key);
            else left->insert(key);
        }
        else {
            if (right == NULL) right = new Node(key);
            else right->insert(key);
        }
    }
    bool find(int key) {
        if (key == this->key) return true;
        if (key < this->key) {
            if (left == NULL) return false;
            return left->find(key);
        }
        if (right == NULL) return false;
        return right->find(key);
    }
};

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

    int n;
    cin>>n;
    Node root = Node();
    rep(i, n) {
        string ins;
        cin>>ins;
        if (ins == "print") {
            root.inprint();
            cout<<endl;
            root.preprint();
            cout<<endl;
            continue;
        }

        int key;
        cin>>key;
        if (ins == "find") {
            bool f = root.find(key);
            if (f) cout<<"yes"<<endl;
            else cout<<"no"<<endl;
            continue;
        }
        
        if (root.key == INT_MAX) {
            root.key = key;
            continue;
        }
        root.insert(key);
    }
}


Measured memory_bytes: 15712
import itertools
n=int(input())
mylist=[0]*n
a=1
while(6*(a**2)<n):
    a+=1
l=list(range(1,3*a-1))
for c in itertools.product(l,repeat=3):
    sum_num=sum(c)**2-(c[0]*c[1]+c[1]*c[2]+c[2]*c[0])
    if sum_num<=n:
        mylist[sum_num-1]+=1
for i in mylist:
    print(i)

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

constexpr int inf = 1e9;

int main() {
    int d, w;
    while(cin >> d >> w, d) {
        vector<vector<int>> e(d, vector<int>(w));
        for(int i = 0; i < d; ++i) {
            for(int j = 0; j < w; ++j) {
                cin >> e[i][j];
            }
        }
        int ans = 0;
        for(int ly = 0; ly + 2 < d; ++ly) {
            for(int lx = 0; lx + 2 < w; ++lx) {
                for(int ry = ly + 2; ry < d; ++ry) {
                    for(int rx = lx + 2; rx < w; ++rx) {
                        int mini = inf;
                        for(int i = lx; i <= rx; ++i) {
                            mini = min({mini, e[ly][i], e[ry][i]});
                        }
                        for(int i = ly; i <= ry; ++i) {
                            mini = min({mini, e[i][lx], e[i][rx]});
                        }
                        int tans = 0;
                        for(int i = ly + 1; i <= ry - 1; ++i) {
                            for(int j = lx + 1; j <= rx - 1; ++j) {
                                if(e[i][j] >= mini) {
                                    tans = -inf;
                                }
                                tans += mini - e[i][j];
                            }
                        }
                        ans = max(ans, tans);
                    }
                }
            }
        }

        cout << ans << endl;
    }
}



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

const ll MAX = 10000000;  // TLEならば小さくする
const ll MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(ll n, ll 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 x, y; cin >> x >> y;	
	if (y > 2 * x || y < x / 2 || (x + y) % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	ll num = (x + y) / 3;
	ll num_x = (2 * x - y) / 3;
	ll num_y = (-x + 2 * y) / 3;
		
	if (num_x < 0 || num_y < 0) {
		cout << 0 << endl;
		return 0;
	}

	COMinit(); // 前処理
	cout << COM(num, num_y) << endl;	
	return 0;
}

Measured memory_bytes: 234624
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        outside: while (true) {
            String[] inputs = br.readLine().split(" ");
            int a = Integer.parseInt(inputs[0]);
            char op = inputs[1].charAt(0);
            int b = Integer.parseInt(inputs[2]);

            switch (op) {
                case '+':
                System.out.println(a+b);
                break;
                case '-':
                System.out.println(a-b);
                break;
                case '*':
                System.out.println(a*b);
                break;
                case '/':
                System.out.println(a/b);
                break;
                case '?':
                break outside;
            }
        }
    }
}

Measured memory_bytes: 24340
#include<stdio.h>
#include<stdlib.h>
int empty();
int full();
void push(int);
int pop(void);
#define N 200
int top=0;
int Stack[N];
int main(){
  int i;
  char input[N][8];
  i=0;
  while(scanf("%s",input[i])!=EOF){
       if(input[i][0]=='*'){Stack[top-1]=Stack[top-1]*Stack[top]; top-=1;}
       if(input[i][0]=='+'){Stack[top-1]=Stack[top-1]+Stack[top]; top-=1;}
       if(input[i][0]=='-'){Stack[top-1]=Stack[top-1]-Stack[top]; top-=1;}
       if(input[i][0]>='0'&&input[i][0]<='9')push(atoi(input[i]));
       i++;
  }
  printf("%d\n",Stack[top]);
  return 0;
}
    int empty(){
      if(top<0)return 1;
      return 0;
    }
    int full(){
      if(top>=N-1)return 1;
      return 0;
    }

    void push(int x){
      if(full()==1){
	printf("overflow\n");
      }
      top++;
      Stack[top]=x;
    }

    int pop(){
      if(empty()==1){
	printf("underflow\n"); return 0;
      }
	top--;
	return Stack[top+1];
      }



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

const int MAX_T=1e5+10;

int T,D,L,x,ans;
vector<int> cnt(MAX_T);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> T >> D >> L,T){
        for (int i=0;i<=T;++i) cnt[i]=0;
        for (int i=1;i<=T;++i){
            cin >> x;
            if (x<L) continue;
            ++cnt[i];
            if (i+D<=T) --cnt[i+D];
        }
        ans=0;
        for (int i=0;i<T-1;++i){
            cnt[i+1]+=cnt[i];
            if (cnt[i+1]) ++ans;
        }
        cout << ans << '\n';
    }
}


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

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

    int n = (N > 1) ? N * (N-1) / 2 : 0;
    int m = (M > 1) ? M * (M-1) / 2 : 0;


    cout << (n +m);
    
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 19:03:42 2019
ABC128C
@author: maezawa
"""
import itertools
n, m = list(map(int, input().split()))
lamp = []
for _ in range(m):
    kin = list(map(int, input().split()))
    kin.pop(0)
    lamp.append(kin)
p = list(map(int, input().split()))
cntall = 0
for kbin in itertools.product(range(2), repeat=n):
    for i in range(m):
        cnt = 0
        for j in lamp[i-1]:
            if kbin[j-1] == 1:
                cnt += 1
        if cnt % 2 != p[i-1]:
            #print(j,i-1)
            break
    else:
        cntall += 1
        #print(kbin)

print(cntall)
            
    
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    ll tmp = max({a, b, c});
    if((a%2==0&&b%2==0&&c%2==0)||(a%2==1&&b%2==1&&c%2==1)){
        cout << (tmp - a) / 2 + (tmp - b) / 2 + (tmp - c) / 2 << endl;
    }
    else{
        if((3*tmp%2==0&&(a+b+c)%2==0)||(3*tmp%2==1&&(a+b+c)%2==1))cout << (tmp - a) / 2 + (tmp - b) / 2 + (tmp - c) / 2 +1<< endl;
        else cout << (tmp - a+1) / 2 + (tmp - b+1) / 2 + (tmp - c+1) / 2+1 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll MOD = ll(1e9 + 7);
string A, B, C;

int N;
ll dp[51][2][2];

int main(){
    while(cin >> A, A != "0"){
        cin >> B >> C;
        reverse(A.begin(), A.end());
        reverse(B.begin(), B.end());
        reverse(C.begin(), C.end());

        N = A.size();
        memset(dp, 0, sizeof dp);
        int sle = 1;
        dp[0][0][sle] = 1;
        for(int i = 0; i < N; i++){
            for(int c = 0; c < 2; c++){
                for(int le = 0; le < 2; le++){
                    //cerr << i << " " << c << " " << le << " " << dp[i][c][le] << endl;

                    if(dp[i][c][le] == 0) continue;

                    int fixa = -1, fixb = -1;
                    if(isdigit(A[i])) fixa = A[i] - '0';
                    if(isdigit(B[i])) fixb = B[i] - '0';
                    for(int a = 0; a < 10; a++){
                        if(fixa != -1 && a != fixa) continue;
                        if(i == N - 1 && a == 0) continue;
                        for(int b = 0; b < 10; b++){
                            if(fixb != -1 && b != fixb) continue;
                            if(i == N - 1 && b == 0) continue;

                            int s = a + b + c;
                            int x = s % 10;

                            //cerr << "\t" <<  a << " " << b << " " << x << endl;
                            if(isdigit(C[i]) && C[i] - '0' != x) continue;
                            int cc = isdigit(C[i]) ? C[i] - '0' : 9;

                            int ncarry = s / 10;
                            int nle = 0;
                            if(le){
                                nle = (x <= cc);
                            }
                            else{
                                nle = (x < cc);
                            }
                            

                            dp[i + 1][ncarry][nle] += dp[i][c][le];
                            dp[i + 1][ncarry][nle] %= MOD;
                        }
                    }
                }
            }
        }

        cout << dp[N][0][1] << endl;
        //return 0;
    }
    return 0;
}

Measured memory_bytes: 3024
#include <cstdio>
  #include <iostream>
  #include <string.h>
  #include <cstring>
  #include <cmath>
  #include <math.h>
  #include <algorithm>
  #include <iomanip>
  #include <map>
  #include <set>
  #include <vector>
  #include <sstream>
  #include <queue>  
  #include <bitset>
#define MAX 100005
#define INF 9999999999999
#define pb push_back
using namespace std;
typedef long long int ll;
 typedef pair<ll,ll> ii;
 typedef vector<ii> vii;
 typedef vector <ll > vi;
vector <vii> adj(MAX);
int main()
{
 // freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,a,cnt=0;
  int arr[10]={0};
  cin>>n;
  for(ll i=0;i<n;i++)
  {
    cin>>a;
    if(a<=399)
      arr[0]++;
    else if(a>=400 && a<=799)
      arr[1]++;
    else if(a>=800 && a<=1199)
      arr[2]++;
    else if(a>=1200 && a<=1599)
      arr[3]++;
    else if(a>=1600 && a<=1999)
      arr[4]++;
    else if(a>=2000 && a<=2399)
      arr[5]++;
    else if(a>=2400 && a<=2799)
      arr[6]++;
    else if(a>=2800 && a<=3199)
      arr[7]++;
    else
      arr[8]++;
  }
  int f=0;
for(ll i=0;i<=7;i++)
{
  if(arr[i]!=0)
  {
    f=1;
    cnt++;
  }
}
if(f==1)
cout<<cnt<<" "<<cnt+arr[8]<<endl;
else
cout<<1<<" "<<arr[8]<<endl;
 return 0;

}

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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(s==u) a--;
    else b--;

    cout << a << ' ' << b << endl;

}

Measured memory_bytes: 256
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

s = ns().split()

print(s[0][0] + s[1][0] + s[2][0])



Measured memory_bytes: 5076
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

int a,n;

void solve(){
  cin >> n;
  double ans=2*M_PI*n;
  printf("%.10f\n",ans);
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin>>n;
	map<ll, ll> p;
	rep(i, n){
		ll temp; cin>>temp;
		p.ins(mp(temp, i));
	}

	vll q;
	q.pb(-1); q.pb(-1);
	q.pb(n); q.pb(n);

	ll ans=0;
	for(int i=n; i>=1; i--){
		/*ll left=0, right=q.size()-1;
		while(right-left>1){
			int mid = (right+left)/2;
			if (q[mid]>p[i]){
				right = mid;
			}else{
				left = mid;
			}
		}
		ans+=i*(q[left]-q[left-1])*(q[right]-p[i]);
		ans+=i*(p[i]-q[left])*(q[right+1]-q[right]);
		q.ins(q.begin()+right, p[i]);
		*/
		auto right = lower_bound(q.begin(), q.end(), p[i]);
		auto left = right-1;
		ans+=i*(*left-*(left-1))*(*right-p[i]);
		ans+=i*(p[i]-*left)*(*(right+1)-*right);
		q.ins(right, p[i]);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long int lld;
#define sq(x) x*x
#define fr(i,m,n) for(i=m;i<n;i++)
#define vec vector<int>
#define sint set<int>
#define qint queue<int>
#define mip map<int,int>
#define pint priority_queue<int>
#define pb push_back
#define pp pop_back()
#define ft first
#define sd second
#define full(v) v.begin(),v.end()

int main()
{
    int i,j,k,a,b,c,x,y,z,n,m,t;
    string s,u,v;
    cin>>n;
    x=(n/500)*1000;
    n-=(x/1000)*500;
    x+=(n/5)*5;
    cout<<x<<endl;
}


Measured memory_bytes: 3640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String answer = "";
        for(int i = 0; i < line.length(); i++) {
            if(i == 3) {
                answer += '8';
            } else {
                answer += line.charAt(i);
            }
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 21712
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inf 1145141919810893364
#define PI 3.141592653589
#define int long long
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<(n);i++)

signed main(){
  int n,l;
  cin >> n >> l;
  int sum = l*n+(n*(n-1)/2);
  if(l > 0)
    sum -= l;
  else if(l+n-1<0)
    sum -= l+n-1;
  cout << sum << endl;
}


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

int main() {
  int num, point, num_ques, i;

  cin >> num >> point >> num_ques;

  std::vector<int>  a(num, point - num_ques);

  int ans_index;
  for(i = 0; i < num_ques; i++){
    cin >> ans_index;
    a[ans_index - 1]++;
  }

  for(i = 0; i < num; i++){
    if((a[i]) > 0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }

}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846

int main(){
    int n;
    cin >> n;
    static int a[100000];
    REP(i,n){
        cin >> a[i];
    }
    int point = 0;//境目
    REP(i,n){
        if(a[i] <= a[n-1]){
            swap(a[i],a[point]);
            point++;
        }
    }
    REP(i,n){
        if(i==point-1)cout << "[";
        cout << a[i];
        if(i==point-1)cout << "]";
        if(i!=n-1)cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3376
#include <iostream>
#define MOD 1000000007
using namespace std;

int main(){
	int n;
	int retu[100000] = {};
	cin >> n;
	for(int i = 0;i < n;i++){
		int t;
		cin >> t;
		if(t % 2 == n % 2){
			cout << 0 << endl;
			return 0;
		}
		retu[t]++;
	}
	for(int i = 0;i < n;i++){
		if(n % 2 == 1){
			if(i == 0 && retu[i] != 1){
				cout << 0 << endl;
				return 0;
			}
			else if(i != 0 && retu[i] != 0 && retu[i] != 2){
				cout << 0 << endl;
				return 0;
			}
		}
		else if(retu[i] != 0 && retu[i] != 2){
	        cout << 0 << endl;
		    return 0;
		}
	}
	long long int res = 1;
	for(int i = 0;i < n / 2;i++){
		res = res * 2 % MOD;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int w,h,x,y;
  cin>>w>>h>>x>>y;
  cout<<((double)w*(double)h)/2<<" ";
  if(x+x==w && y+y==h)
    cout<<"1";
  else
    cout<<"0";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int count = 0;
    for (int i = 0; i < n - 2; ++i) {
        if(a[i] == a[i + 1] && a[i + 1] == a[i + 2]){
            count++;
            a[i + 1] = 0;
        }else if(a[i] == a[i + 1] && a[i] != a[i + 2]){
            count++;
            a[i + 1] = 0;
        }
    }
    if(a[n - 2] == a[n - 1])count++;
    print(count);
}



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

using namespace std;

#define ll long long 
#define Coming ios_base :: sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define mod 1000000007

int main()
{
	Coming 
	
	int a, n, m, b;
	
	cin >> n >> m;
	
	map<int,int>mapp;
	
	for(int i = 1; i <= n; i++)
	{
	    cin >> a;
	    
	    for(int i = 1; i <= a; i++)
	    {
			cin >> b;
			
			mapp[b]++;
		}
	}
	
	int coun = 0;
	
	for(auto it : mapp)
	{
		if(it.second == n) coun++;
	}
	
	cout << coun << endl;
	
	mapp.clear();
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	int H,W,h,w;
	cin >> H >> W >> h >> w;
	if(H%h == 0 && W%w == 0){
		puts("No");
		return 0;
	}
	puts("Yes");
	bool bo = 0;
	if(H%h == 0){
		swap(H,W);
		swap(h,w);
		bo = 1;
	}
	vector<vi> ans(H, vi(W));
	int x = 1e9-1;
	while((x-1)%(h-1)) --x;
	int y = (x-1)/(h-1);
	rep(i,0,H){
		int val;
		if(i%h == h-1){
			val = -x;
		} else {
			val = y;
		}
		rep(j,0,W) ans[i][j] = val;
	}
	if(bo){
		rep(j,0,W){
			rep(i,0,H) cout << ans[i][j] << ' ';
			cout << endl;
		}
	} else {
		rep(i,0,H){
			rep(j,0,W) cout << ans[i][j] << ' ';
			cout << endl;
		}
	}
}

Measured memory_bytes: 3840
#include <cstdio>
#include <cmath>

int main() {
    int a, b, C;
    scanf("%d %d %d", &a, &b, &C);
    
    double PI = acos(-1);
    double radC = C * PI / 180;
    double S = a * b * sin(radC) / 2;
    double L = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(radC));
    double h = 2 * S / a;
    printf("%.5lf\n%.5lf\n%.5lf\n", S, L, h);
}


Measured memory_bytes: 3000
def main():
    s = input()
    ans1 = -1
    ans2 = -1

    for i in range(len(s)-1):
        if s[i]==s[i+1]:
            ans1 = i+1
            ans2 = i+2
            break
        elif i < len(s)-2 and s[i]==s[i+2]:
            ans1 = i+1
            ans2 = i+3
            break
        else:
            continue

    print(ans1, ans2)

if __name__ == '__main__':
    main()

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

int main()
{
	int N;
	string str;

	cin >> N >> str;
	
	vector<bool> res(N);
	bool tests[][2] = { {true, true}, {true, false}, {false, true}, {false, false} };

	bool result;
	for (int i = 0; i < 4; i++) {
		res[0] = tests[i][0];
		res[1] = tests[i][1];

		for (int k = 1; k < N-1; k++) {
			if (str[k] == 'o') {
				if (res[k])
					res[k + 1] = res[k - 1];
				else
					res[k + 1] = !res[k - 1];
			}
			else {
				if (res[k])
					res[k + 1] = !res[k - 1];
				else
					res[k + 1] = res[k - 1];
			}		
		}

		if (str[0] == 'o') {
			if (res[0])
				result = (res[1] == res[N - 1]);
			else
				result = !(res[1] == res[N - 1]);
		}
		else {
			if (res[0])
				result = !(res[1] == res[N - 1]);
			else
				result = (res[1] == res[N - 1]);
		}

		if (result) {
			if (str[N - 1] == 'o') {
				if (res[N - 1])
					result = (res[0] == res[N - 2]);
				else
					result = !(res[0] == res[N - 2]);
			}
			else {
				if (res[N - 1])
					result = !(res[0] == res[N - 2]);
				else
					result = (res[0] == res[N - 2]);
			}
		}

		if (result)
			break;
	}

	if (!result)
		cout << -1 << endl;
	else {
		string str = string(N, ' ');
		for (int i = 0; i < N; i++)
			str[i] = (res[i] ? 'S' : 'W');
		cout << str << endl;
	}
}

Measured memory_bytes: 512
//
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;
template<size_t SIZE, class T> inline size_t array_size(T (&arr)[SIZE]) {
    return SIZE;
}

//約数の列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
#if LOCAL&0
  	std::ifstream in("input.txt");
  	std::cin.rdbuf(in.rdbuf());
#endif
    lli N=8;
    cin>>N;
    lli ans=0;
    lli i=1;
    auto lst=divisor(N); //k(m+1)=N なので約数-1を調べる
    for (const auto& d:lst){
        auto m=d-1;
        if(m>0&&N/m==N%m){
            ans+=m; 
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
n,m,x=map(int,input().split())
c=[list(map(int,input().split())) for _ in range(n)]
result=-1
for i in range(2**n):
  t=[0]*m
  money=0
  for j in range(n):
    if (i>>j)&1==0:
      continue
    money+=c[j][0]
    for k in range(1,m+1):
      t[k-1]+=c[j][k]
  if all(xx>=x for xx in t):
    if result==-1:
      result=money
    else:
      result=min(result,money)
print(result)

Measured memory_bytes: 9160
#include<bits/stdc++.h>
#define fo(a,x,y) for(register int a=x;a<=y;a++)
#define dfo(a,x,y) for(register int a=x;a>=y;a--)
int f[101][10001],m,t,w[10001],v[10001]; 
using namespace std;
int main ()
{
	scanf("%d%d",&m,&t);
	fo(i,1,m)
	scanf("%d%d",&v[i],&w[i]);
	fo(i,1,m)
	{
		fo(j,0,t)
		{
			if (j-w[i]>=0)f[i][j]=max(f[i-1][j-w[i]]+v[i],f[i-1][j]);else f[i][j]=f[i-1][j];
		}
	}
	printf("%d\n",f[m][t]);	
	return 0;
}



Measured memory_bytes: 7124
# include <bits/stdc++.h>
     
    using namespace std;
     
    #define sim template < class c
    #define ris return * this
    #define dor > debug & operator <<
    #define eni(x) sim > typename \
      enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
    sim > struct rge { c b, e; };
    sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
    sim > auto dud(c* x) -> decltype(cerr << *x, 0);
    sim > char dud(...);
    struct debug {
    #ifdef LOCAL
        ~debug() { cerr << endl; }
        eni(!=) cerr << boolalpha << i; ris; }
        eni(==) ris << range(begin(i), end(i)); }
        sim, class b dor(pair < b, c > d) {
        ris << "(" << d.first << ", " << d.second << ")";
        }
        sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
            *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
        }
    #else
    sim dor(const c&) { ris; }
    #endif
    };
    #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
     
    # define forn(i, n) for (ll i = 0; i < int(n); i++)
    # define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
    # define all(V) V.begin(), V.end()
    # define rall(V) V.rbegin(), V.rend()
    # define len(V) (int)V.size()
    # define ll long long
    # define ld long double
    # define ff first
    # define ss second
    # define pb push_back
    # define mp make_pair
    # define endl '\n'
    # define M_PI 3.14159265358979323846
     
    void solve()
    {
        ll res = 0;
        int n, m, c; cin >> n >> m >> c;
        int arr[n + 1][m];
        forn(i, n + 1) { forn(j, m) cin >> arr[i][j]; }
        for(int i = 1; i < n + 1; ++i)
        {
                int cnt = 0;
                for(int j = 0; j < m; ++j)
                {
                    cnt += (arr[i][j] * arr[0][j]);
                }
                cnt += c;
                if(cnt > 0) res++;
        }
        cout << res << endl;
    }
     
    int main()
    {
            ios_base::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            solve();
    }

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int a[1000001] = { 0 };
  int n;
  scanf("%d", &n);
  for(int i = 1;i * i < n;i++) {
    a[i * i] += 1;
    for(int j = i+1;i * j < n;j++) {
      a[i*j] += 2;
    }
  }
  int ret = 0;
  for(int i = 1;i < n;i++) {
    ret += a[i];
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 5960