akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env ruby

if __FILE__ == $0 then
	loop do
		m, f, r = gets.split.map(&:to_i)

		if [m, f, r] == [-1, -1, -1] then
			break
		end

		if m == -1 or f == -1 then
			puts 'F'
		else
			puts begin
				case m+f
				when 80..100 then 'A'
				when 65..80 then 'B'
				when 50..65 then 'C'
				when 30..50 then
					if r >= 50
						'C'
					else
						'D'
					end
				else 'F'
				end
			end
		end
	end
end



Measured memory_bytes: 6892
import collections
N,X,Y = list(map(int,input().split()))
A = []
for i in range(1,N+1):
    for j in range(i+1,N+1):
        A.append(min(j-i,abs(X-i)+abs(Y-j)+1,abs(X-j)+abs(Y-i)+1))
c = collections.Counter(A)
for k in range(1,N):
    print(c[k])

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

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

int main(){
    int x;
    cin >> x;
    int ans;
    for(int i=1;i<x;i++){
        int a = (i*i+i)/2;
        if(x == 2){
            ans = 2;
            break;}
        if(a>=x){
            ans = i;
            break;
        }
    }
    if(x == 1)cout << 1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
int main(){
///    2*sqrt(a*b) < c - a - b
    ll a,b,c; cin>>a>>b>>c;
    if(c-a-b<=0) cout<<"No"<<endl;
    else{
        if(4*a*b<(c-a-b)*(c-a-b)) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

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

    ll ans = 0;
    for (int b = 1; b <= N; b++){
        int div = N/b;
        int mod = N%b;
        ans += max(b-K,0) * div;
        if (K >= 1) ans += max(mod-K+1, 0);
        else ans += max(mod-K, 0);
    }

    cout << ans << endl;
}

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

int main() {
  int H, W;
  char x;
  cin >> H >> W;
  for (int i = 0; i < H+2; i++){
    vector<char> picture(W);
    for (int j = 0; j < W+2; j++){
      if (j == 0){
        cout << '#';
      }
      else if (j == W+1){
        cout << '#' << endl;
      }
      else {
        if (i == 0 || i == H+1){
          cout << '#';
        }
        else {
          cin >> x;
          cout << x;
        }
      }
    }
  }
}


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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int a[100005], b[100005];

int main() {
	int n;
	scanf("%d", &n);
	REP(i, n)scanf("%d", &a[i]);
	memcpy(b, a, sizeof(a));
	sort(b, b + n);
	int cnt = 0;
	REP(i, n) {
		auto idx = lower_bound(b, b+n, a[i]) - a;
		if ((idx ^ i) & 1)cnt++;
	}
	cout << cnt / 2 << endl;
	return 0;
}

Measured memory_bytes: 1024
import sys
from bisect import bisect_left, bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    N, *ABC = map(int, read().split())
    A = sorted(ABC[:N])
    B = ABC[N : 2 * N]
    C = sorted(ABC[2 * N : 3 * N])

    ans = sum(bisect_left(A, b) * (N - bisect_right(C, b)) for b in B)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 36292
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int n=a*b;
		
		System.out.println(n);
		sc.close();
	}

}


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

int solve(int n, int x);

int main() {
	int n, x;
	while (cin >> n >> x){
		if (n == 0 && x ==0) break;
		cout << solve(n, x) << endl;
	}
	return 0;
}

int solve(int n, int x){
	int counter = 0;
	for (int i=1; i!= n-1; ++i){
		for (int j=i+1; j<x-i; ++j){
			int k = x - i - j;
			if (k <= j) break;
			if (3 <= k && k <= n && k != j && k!= i){
				++counter;
			}
		}
	}
	return counter;
}

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


ull gcd(ull a,ull b){
	if(!b) return a;
	return gcd(b,a%b);
}


int main(){
	int n,type = 0;
	cin >> n;
	int a[n];
	deque<int> b;
	
	rep(i,0,n){
		cin >> a[i];
	}
	
	rep(i,0,n){
		if(type % 2){
			b.push_back(a[i]);
		}
		else{
			b.push_front(a[i]);
		}
		type++;
	}
	
	rep(i,0,n){
		if(type % 2){
			cout << b[i];
		}
		else{
			cout << b[n-i-1];
		}
		if(i != n-1){
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3840
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	double n;
	cin>>n;
	int a=n;
	if(a%2==0)
	{
		cout<<fixed<<setprecision(10)<<0.5;
	}
	else
	{
		cout<<fixed<<setprecision(10)<<(a/2+1)/n;
	}
	return 0;
}

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

#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
const int MAXN = 2e5+5;
const int MOD= 998244353;
int n,b[MAXN];
struct node{
    int x,y;
}a[MAXN];
bool cmp(node a,node b){
    return a.x<b.x;
}
ll dp[MAXN];
stack<int>st;
int main()
{
    scanf("%d",&n);
    rep(i,1,n){
        scanf("%d%d",&a[i].x,&a[i].y);
        a[i].y+=a[i].x-1;
    }
    sort(a+1,a+n+1,cmp);
    rep(i,1,n)b[i]=a[i].x;
    dp[n+1]=1;
    while(!st.empty())st.pop();
    per(i,n,1){
        int y=a[i].y;
        while(!st.empty()&&y>=a[st.top()].x){
            y=max(y,a[st.top()].y);
            st.pop();
        }
        a[i].y=y;
        if(st.empty())dp[i]=(dp[i+1]+dp[n+1])%MOD;
        else dp[i]=(dp[i+1]+dp[st.top()])%MOD;
        st.push(i);

    }
    printf("%lld\n",dp[1]);
}


Measured memory_bytes: 4608
#include "iostream"
using namespace std;

long long int N, X;
long long int num[100000];
long long int ans;

int main() {
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> num[i];
	}
	if (num[0] > X) {
		ans = num[0] - X;
		num[0] -= ans;
	}
	for (int i = 1; i < N; i++) {
		if (num[i] + num[i - 1] > X) {
			ans += num[i] + num[i - 1] - X;
			num[i] -= (num[i] + num[i - 1] - X);
		}
	}
	cout << ans << "\n";
	return 0;
}

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


using namespace std;
typedef long long ll;
const int MODULO = 1000000000;
const int INF = 2000000000; //1e9 * 2
const double EPS = 1e-7;
const double PI = acos(-1.0);

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

//start

int* table[5000];

int main(){
	FOR(i,5000) table[i] = (int*)calloc((i+1),sizeof(int));

	int n,m; cin>>n>>m;
	FOR(i,m){
		int a,b,x; cin>>a>>b>>x;
		a--;b--;
		table[a][b] = x+1;
	}
	
	for(int i = 1; i < n; i++) FOR(j,i+1){
		if(j==0) table[i][j] = max(table[i][j],table[i-1][j]-1);
		else if(j == i) table[i][j] = max(table[i][j],table[i-1][j-1]-1);
		else table[i][j] = max(table[i][j],max(table[i-1][j],table[i-1][j-1])-1);
	}
	int ans = 0;
	FOR(i,n) FOR(j,i+1) ans += table[i][j] > 0;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 50144
#include <bits/stdc++.h>
using namespace std;
int main ()
{
  set<string> s;
  string word;
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> word;
    s.insert(word);
  }
  cout << s.size();
  return 0;
}
  

Measured memory_bytes: 19104
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
int t1,t2;
int BS(int s,int e){
	if(s==e)return s;
	int m=(s+e)/2+1;
	for(int i=m/2-1;i<=m/2+1;i++){
		if(i<=0||i>m)continue;
		if((ll)(t1+i)*(t1+m-i)>=(ll)t1*t2)return BS(s,m-1);
	}
	return BS(m,e);
}
int main(){
	int q;
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d%d",&t1,&t2);
		if(t1>t2)swap(t1,t2);
		printf("%lld\n",(ll)2*(t1-1)+BS(0,t2-t1));
	}
}

Measured memory_bytes: 256
N = int(input())
s = []
for i in range(N):
    s.append(int(input()))

s = sorted(s)
total = sum(s)

if total%10!=0:
    out=total
    print(out)
else:
    scr=total
    for i in range(N):
        if s[i] %10!=0:
            print(sum(s)-s[i])
            break
        elif i==N-1:
            print(0)
            break

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

using namespace std;

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

#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)


#ifdef LOCAL
#define cerr cout
#else
#endif

#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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(int argv, char* argc[])
{
    FASTIO

    int n,k,cnt=0;
    cin>>n>>k;
    int mp[n+1]={};
    rep(i,k)
    {
        int d;
        cin>>d;
        rep(j,d)
        {
            int x;cin>>x;
            ++mp[x];
        }
    }
    for(int i=1;i<=n;++i)
    {
        if(mp[i]==0)
            ++cnt;
    }
    cout<<cnt;

    return 0;
}


Measured memory_bytes: 3656
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>

using namespace std;

string a, b, c;

int work(int sum) {
	for (int i = 1; i * i <= sum; i++) {
		if (i * i == sum) {
			return 1;
		}
	}
	return 0;
}

int main() {
	cin >> a;
	cin >> b;
	c = a + b;
	int len = c.size();
	int sum = 0;
	for (int i = len - 1; i >= 0; i--) {
		sum += (c[i] - '0') * pow(10, len - i - 1);
	}
	if (work(sum)) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int64_t MOD = 1000000007;

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

int N; cin >> N;
int64_t K; cin >> K;
VI A(N); rep(i, 0, N) cin >> A[i];

int64_t cntK1 = 0;
// K = 1 での順序対数
rep(i,0,N-1) rep(j, i+1, N) {
    if (A[i] > A[j]) ++cntK1;
}
// A の中で A[i]より小さい数の数．
VI Asmall(N, 0); 
int64_t bet = 0;
rep(i, 0, N) {
    rep(j, 0, N){
        if (A[i] > A[j]) ++bet;
    }
}
// int sum = accumulate(ALL(Asmall), 0);

cout << ((cntK1 * K) % MOD  + (bet % MOD) * ((K*(K-1)/2)%MOD) )%MOD << "\n";

}

// 境界，出力文字列 チェック



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

int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  bool ok = true;
  if(a != b && b != c && c != a) ok = false;
  if(a == b && b == c && c == a) ok = false;
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3648
/**************************************************************
	File name: E.cpp
	Author: huhao
	Email: 826538400@qq.com
	Create time: 2019/8/24 下午9:22:27
**************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
const int N=200010;
int n,f[N],w[N],a[N],b[N],v[N],m1,m2,m,r[N];
long long ans;
int cmp(int a,int b)
{
	return v[a]>v[b];
}
int getf(int a)
{
	return a==f[a]?a:f[a]=getf(f[a]);
}
int main()
{
	n=read();
	m1=read();
	m2=read();
	m=m1+m2;
	fr(i,1,n)
	{
		a[i]=read();
		b[i]=read()+m1;
		v[i]=read();
	}
	fr(i,1,m)
	{
		f[i]=i;
		w[i]=1;
	}
	fr(i,1,n)
		r[i]=i;
	sort(r+1,r+n+1,cmp);
	fr(i,1,n)
	{
		int A=getf(a[r[i]]),B=getf(b[r[i]]);
		if(w[A]||w[B])
		{
			if(A!=B)
			{
				w[A]+=w[B];
				f[B]=A;
			}
			w[A]--;
			ans+=v[r[i]];
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4864
N = int(input())
A = input().split()
B = [0]*N

for i in range(N):
  A[i] = int(A[i])
  B[i] = A[i]*A[i]

print( ( ( (sum(A)*sum(A)) - sum(B) ) // 2 ) % ( 10**9 + 7 ) )


Measured memory_bytes: 25140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define mod 1000000007
#define size_f 100002
int main()
{
  int n,x;
  cin>>n>>x;
  ll l[n];

  for(int i=0;i<n;i++)
  {  int q;
      cin>>q;
      if(i==0)
        l[0]=q;
      else
        l[i]=l[i-1]+q;
  }
  int c=1;
  for(int i=0;l[i]<=x;i++)
        c++;

  cout<<c<<"\n";
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.next().reversed()
        val k = sc.nextInt()

        val dp1 = Array(n.length + 1) { Array(k + 1) { 0L } }
        val dp2 = Array(n.length + 1) { Array(k + 1) { 0L } }
        dp1[0][0] = 1L
        dp2[0][0] = 1L
        for (i in 1..n.length) {
            for (j in 0..k) {
                dp1[i][j] += dp1[i - 1][j]
            }
            for (j in 1..k) {
                dp1[i][j] += dp1[i - 1][j - 1] * 9
            }
            for (j in 0..k) {
                dp2[i][j] += if (n[i - 1] == '0') dp2[i - 1][j] else dp1[i - 1][j]
            }
            if (n[i - 1] != '0') {
                for (j in 1..k) {
                    dp2[i][j] += dp1[i - 1][j - 1] * (n[i - 1] - '0' - 1) + dp2[i - 1][j - 1]
                }
            }
        }

        println(dp2[n.length][k])
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 38376
#include<bits/stdc++.h>
#define re register
char ss[100100],sa[100100],ch;
int n,len,I;
void sol(re int l,re int r)
{
	if(l==r){for(re int i=++n;i>l;i--)ss[i]=ss[i-1];ss[l]=ch;return;}
	re int mid=(l+r)/2,nm=0;
	sa[++nm]=ch;
	for(re int i=1;i<mid;i++)if(ss[i]==ch)sa[++nm]=ch;
	for(re int i=mid;i<=n;i++)sa[++nm]=ss[i];
	sa[nm+1]='\0';
	printf("? %s\n",sa+1);
	fflush(stdout);
	re int x;scanf("%d",&x);
	if(len-x==nm)sol(l,mid);
	else sol(mid+1,r);
}
void sss(char ii)
{
	for(re int i=1;i<=128;i++)sa[i]=ii;
	sa[129]='\0';
	printf("? %s\n",sa+1);
	fflush(stdout);
	re int x;scanf("%d",&x);
	x=128-x;
	for(I=1;I<=x;I++)
	{
		ch=ii;
		if(!len)
		{
			sa[1]=ii;sa[2]='\0';
			printf("? %s\n",sa+1);
			fflush(stdout);
			scanf("%d",&len);len++;
		}
		sol(1,n+1);
	}
}
int main()
{
	for(re char ii='0';ii<='9';ii++)sss(ii);
	for(re char ii='a';ii<='z';ii++)sss(ii);
	for(re char ii='A';ii<='Z';ii++)sss(ii);
	printf("! %s\n",ss+1);
	fflush(stdout);
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define vpii vector<pair<int,int> >
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back   
#define PB pop_back
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;

void solve(){
    int n, ans = 0, m, k;
    cin>>n>>m>>k;
    string s[n+4];
    f(i,n)cin>>s[i];
    f(i,1<<n)f(j,1<<m){
        string a[n+4];
        f(x,n)a[x] = s[x];
        f(x,n)if(i & 1<<x){
            f(y,m)a[x][y] = 'p';
        }
        f(y,m)if(j & 1<<y){
            f(x,n)a[x][y] = 'p';
        }
        int cnt = 0;
        f(x,n)f(y,m)cnt += (a[x][y] == '#');
        ans += (cnt == k);
    }
    cout<<ans;
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3632
def main():
    a, b = input().split()

    a = int(a)
    if len(b) == 4:
        b = int(b[0] + b[2] + b[3])
    else:
        b = int(b[0] + b[1] + b[3] + b[4])

    print(a * b // 100)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ld pi = (acos(-1));
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  ll n; cin >> n;
  vector<ll> h(n);
  rep(i,0,n) cin >> h[i];
  ll m=0,res=0;
  rep(i,0,n-1){
    if(h[i]>=h[i+1]) res++;
    else res=0;
    chmax(m,res);
  }
  cout << m << endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	
	int n;
	while(cin >> n, n){
		map<ll, int> mp;
		rep(i, n){
			ll h, m, s;
			scanf("%ld:%ld:%ld", &h, &m, &s);
			mp[h*10000+m*100+s]++;
			scanf("%ld:%ld:%ld", &h, &m, &s);
			mp[h*10000+m*100+s]--;
		}
		
		int cnt = 0;
		int ans = 0;
		for(auto it : mp){
			cnt += it.second;
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;

#define maxn 100005
#define ll long long int
#define db(x) cout<<#x<<" -> "<<x<<" "<<endl
#define db2(x,y) cout<<#x<<"-> "<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<<endl
#define IN freopen("input.txt","r",stdin)
vector< int > g[ maxn ];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN ;
    int n,k;
    cin>>n>>k;
    for(int i = 0; i < n; i++){
        int a,b;
        cin>>a>>b;
        g[ a ].push_back( b );
    }
    multiset< int > ms;
    ll ans = 0LL;
    for(int i = k-1; i >= 0 ; i--){
        for(auto itr : g[ k - i ]){
            ms.insert(itr);
        }
        if(!ms.empty()){
            ans+=*prev(ms.end());
            ms.erase(prev(ms.end()));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 7808
#include<stdio.h>
#include<stdlib.h>

#define NIL NULL

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

typedef struct node * Node;
  
Node root;
  
Node treeMinimum(Node x){
    while(x->left != NIL){
        x=x->left;
    }
    
    return x;
}
  
Node treeMaximum(Node x){
    while(x->right != NIL){
        x=x->right;
    }
    
    return x;
}

Node treeSearch(Node u, int k){
    if(u==NIL || k==u->key) return u;
    
    if(k < u->key) return treeSearch(u->left,k);
    else return treeSearch(u->right,k); 
}
  
Node treeSuccessor(Node x){
    Node y;
    if(x->right != NIL) return treeMinimum(x->right);
    else if(x->left !=NIL ) return treeMaximum(x->left);
  
    y = x->parent;
    while(y != NIL && x == y->right) {
        x = y;
        y = y->parent;
    }
    
    return y;
}
  
void treeDelete(Node z){
    Node y;
    Node x; 
  
    if(z->left == NIL || z->right == NIL) y=z;
    else y = treeSuccessor(z);
  
    if(y->left!=NIL) x = y->left;
    else x = y->right;
  
    if(x != NIL) x->parent = y->parent;
  
    if(y->parent == NIL) root = x;
    else if(y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  
    if(y != z) z->key = y->key;
}
  
void insert(int k){
    Node y = NIL;
    Node x = root;
    Node z;
  
    z = malloc(sizeof(struct node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
  
    while(x != NIL){
        y = x;
        if(z->key < x->key) x = x->left;
        else x = x->right;
    }
    z->parent = y;
  
    if(y == NIL) root = z;
    else if(z->key< y->key) y->left = z;
    else y->right = z;
}
  
void inorder(Node u){
    if(u!=NIL) {
        inorder(u->left);
        printf(" %d",u->key);
        inorder(u->right);
    }
}

void preorder(Node u){
    if(u != NIL){
        printf(" %d", u->key);
        preorder(u->left);
        preorder(u->right);
    }
}
  
int main(){
    int n, i, x;
    char com[20];
    scanf("%d", &n);
  
    for ( i = 0; i < n; i++ ){
        scanf("%s", com);
        if ( com[0] == 'f' ){
            scanf("%d", &x);
            Node t = treeSearch(root, x);
            
            if ( t != NIL ) printf("yes\n");
            else printf("no\n");
        } 
  
        else if ( com[0] == 'i' ){
            scanf("%d", &x);
            insert(x);
        }
   
        else if ( com[0] == 'p' ){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        } 
  
        else if ( com[0] == 'd' ){
            scanf("%d", &x);
            treeDelete(treeSearch(root, x));
        } 
    }
    
    return 0;
}

Measured memory_bytes: 19364
def pat(R,G,B,N):
    output = 0
    for r in range(N//R+1):
        for g in range((N-R*r)//G+1):
            if (N-R*r-G*g) % B == 0:
                output += 1
    return output

def main():
    R,G,B,N = map(int,input().split())

    ans = pat(R,G,B,N)

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
n, x = map(int, input().split())  # 複数数値入力
l = list(map(int, input().split()))  # 複数数値入力(リスト格納)
ans =1
sum =0
for num in l:
    sum += num
    if sum>x:
        break
    else:
        ans+=1

print(ans)

Measured memory_bytes: 3064
#if 0
AOJ??§AC???????????¨????¢?????????????
?????????????????¨???????????¶???????????¨???????????§???????????¨????????????????????????????????° - 1?????????????????????????????????????????¨?????????
?????????????????¶??????????????¢????±?????????????????????¢?????§????????????????????????????????????
??????????????£????????????????????¢??????????????????????????¨?????§?????????

#endif
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int t;
  cin >> t;
  for(int j = 0; j < t; j++){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    vector<int> sa(n-1);
    for(auto &p: x){
      cin >> p;
    }

    for(int i = 0; i < n-1; i++)
      sa[i] = x[i+1] - x[i];

    // ??????????????????????????§
    long long ans = x[n-1] - x[0];

    sort(sa.begin(), sa.end());

    int cnt = min(n-1, k-1);

    for(int i = 0; i < cnt; i++){
      if(!sa.empty()){
        ans -= sa.back();
        sa.pop_back();
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef pair<int,int> pii;
int a,b,c;

main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(a==b&&a!=c) puts("Yes");
	else if(a==c&&a!=b) puts("Yes");
	else if(b==c&&b!=a) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main()
{
	fast;
	string name;
	cin>>name;
	if(name=="ABC")
		cout<<"ARC";
	else
		cout<<"ABC";
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
const int MAX = 100005;
const int NIL = -1;

struct  Node
{
	int key;
	int depth;
	int pa;
	int left;
	int right;
};

Node Tree[MAX];
void print(int n);
void set_depth(int, int);

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		Tree[i].pa = Tree[i].left = Tree[i].right = NIL;
	}

	for (int i = 0; i < n; i++)
	{
		int num, degree;
		cin >> num >> degree;
		for (int j = 0; j < degree; j++)
		{
			int chil, sib;
			cin >> chil;
			
			if (j == 0)
				Tree[num].left = chil;
			else
				Tree[sib].right = chil;
			
			sib = chil;
			Tree[chil].pa = num;
		}
	}

	int root = 0;
	for (int i = 0; i < n; i++)
	{
		if (Tree[i].pa == NIL)
		{
			root = i;
			break;
		}
	}

	set_depth(root, 0);

	for (int i = 0; i < n; i++)
		print(i);

	return 0;
}

void print(int n)
{
	cout << "node " << n << ": parent = " << Tree[n].pa;
	cout << ", depth = " << Tree[n].depth;
	cout << ", ";

	if (Tree[n].pa == NIL)
		cout << "root";
	else if (Tree[n].left == NIL)
		cout << "leaf";
	else
		cout << "internal node";
	cout << ", [";

	int bro = Tree[n].left;
	if (bro != NIL)
	{
		cout << bro;
		int sib = Tree[bro].right;
		while (sib != NIL)
		{
			cout << ", " << sib;
			sib = Tree[sib].right;
		}
	}

	cout << "]" << endl;
	return;
}

void set_depth(int num, int d)
{
	Tree[num].depth = d;
	if (Tree[num].right != NIL)
		set_depth(Tree[num].right, d);
	if (Tree[num].left != NIL)
		set_depth(Tree[num].left, d + 1);
	return;
}

Measured memory_bytes: 8148
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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 gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } 
ll ans[2000];
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout << (a==b&&b==c ? "Yes" : "No") << endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  if (N == 1) cout << "Hello World" << endl;
  else {
    int A, B;
    cin >> A >> B;
    cout << A+B << endl;
  }
}


Measured memory_bytes: 3536
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
#define parity(i,j) (i&(1LL<<j))
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  string s;
  cin >> n >> s;

  int ans = 0;
  REP(i,n) if(s.substr(i,3)=="ABC") ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    char c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            scanf("\n%c",&c[i][j]);
        }
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(i == j){
                printf("%c",c[i][j]);
            }
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 128
A, B, C, D = map(int, input().split())
if B <= C or D <= A:
    print(0)
elif A <= C:
    if B <= D:
        print(B - C)
    else:
        print(D - C)
else:
    if D <= B:
        print(D - A)
    else:
        print(B - A)


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  while (cin >> n) {
    deque<char> q;
    for (int i = 0; i < n; i++) {
      char c;
      cin >> c;
      q.push_back(c);
    }
    while (q.size() > 1) {
      char first = q[0]; q.pop_front();
      char second = q[0]; q.pop_front();
      char res;
      if (first == second) res = 'T';
      else res = 'T' + 'F' - first;
      q.push_front(res);
    }
    cout << q[0] << endl;
  }
  return 0;	
}


Measured memory_bytes: 3252
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n, m = input_list()
  a = input_list()
  b = []
  for i in range(m):
    if i == 0:
      b.append((n - a[-1]) + a[0])
      continue
    b.append(a[i] - a[i-1])
  bm = max(b)
  print(sum(b) - bm)
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Measured memory_bytes: 28432
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  for(int i=0;i<=k/10000;i++){
    for(int j=0;j<=k/5000;j++){
        if(i+j+(k-i*10000-j*5000)/1000 == n && (i*10000+j*5000)<=k){
            printf("%d %d %d\n",i,j,(k-i*10000-j*5000)/1000);
            //("%d+%d+%d = %d\n",i,j,(k-i*10000-j*5000)/1000,i+j+(k-i*10000-j*5000)/1000);
            //printf("10000*%d +5000*%d +1000*%d = %d\n",i*10000,j*5000,(k-i*10000-j*5000),i*10000+j*5000+(k-i*10000-j*5000));
            return 0;
        }
      }
  }
  printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def LIR(n): return [LI() for i in range(n)]
def MI(): return map(int, input().split())

#1
#1_A
"""
x,y,s,t = map(float, input().split())
a = int(input())
s-=x
t-=y
while a:
    a -= 1
    p,q = map(float, input().split())
    p-=x
    q-=y
    ans_x = s*(q*t+p*s)/(t*t+s*s)
    ans_y = t*(q*t+p*s)/(t*t+s*s)
    print(x+ans_x, y+ans_y)
"""

#1_B
"""
p1x,p1y,c,d = MI()
q = II()
if p1x == c:
    f = 0
elif p1y == d:
    f = 1
else:
    f = 2
    m = (d-p1y)/(c-p1x)
for _ in range(q):
    px,py = MI()
    if not f:
        a = 2*p1x-px
        b = py
    elif f == 1:
        a = px
        b = 2*p1y-py
    else:
        a = (2*py+(1/m-m)*px+2*m*p1x-2*p1y)/(m+1/m)
        b = -1/m*(a-px)+py
    print(a,b)
"""

#1_C
def inner_product(a,b):
    return a[0]*b[0]+a[1]*b[1]

def cross_product(a,b):
    return a[0]*b[1]-a[1]*b[0]
p,q,c,d = MI()
a = [c-p,d-q]
r = II()
for _ in range(r):
    c,d = MI()
    b = [c-p,d-q]
    co = inner_product(a,b)
    si = cross_product(a,b)
    if si == 0:
        if co >= 0:
            if a[0]**2+a[1]**2 >= b[0]**2+b[1]**2:
                print("ON_SEGMENT")
            else:
                print("ONLINE_FRONT")
        else:
            print("ONLINE_BACK")
    elif si > 0:
        print("COUNTER_CLOCKWISE")
    else:
        print("CLOCKWISE")



Measured memory_bytes: 5636
'use strict'
function Main(input) {
  const lines = input.split('\n');
  const day = lines[0];
  const days = ['SUN','MON','TUE','WED','THU','FRI','SAT'];

  console.log(7 - days.indexOf(day));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <stdio.h>

void drawing(int H,int W)
{
	int i, j;

	for (i = 0; i < H; i++) {
		
		if (i % 2 == 0) {
			for (j = 0; j < W / 2; j++) {
				printf("#.");
			}
			if (W % 2 == 1) {
				putchar('#');
			}
		}
		
		else {
			for (j = 0; j < W / 2; j++) {
				printf(".#");
			}
			if (W % 2 == 1) {
				putchar('.');
			}
		}

		putchar('\n');

	}

	putchar('\n');

	return;
}

int main(void)
{
	int H, W;

	while (1) {
		scanf("%d %d", &H, &W);

		if (H == 0 && W == 0) {
			break;
		}

		drawing(H, W);
	}

	return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int n,m,c,ans=0; cin >>n >>m >>c;
  int b[m]; for(auto &i:b) cin >>i;
  for(int i=0; i<n; i++){
    int sum=c;
    for(int j=0; j<m; j++){
      int a; cin >>a;
      sum+=a*b[j];
    }
    if(sum>0) ans++;
  }
  cout <<ans;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N; cin >> N;
  int overnum = 0;
  set<int> s;
  int a;
  rep(i,N){
    cin >> a;
    if (a>=3200) overnum++;
    else s.insert(a/400);
  }

  int MIN, MAX;
  if (overnum==0) MIN = s.size(), MAX = s.size();
  else if (s.size()==0) MIN = 1, MAX = overnum;
  else MIN = s.size(), MAX = (int)s.size() + overnum;

  cout << MIN << " " << MAX << endl;

  // cout << fixed << setprecision(6);
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define FINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) ((a) <= (i) && (i) <= (b))
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a > b) { a = b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(begin(a), end(a)); }
template <typename T> inline void REV(T& a) { reverse(begin(a), end(a)); }
template <typename T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <typename S, typename T> inline T LB(S& v, T a) { return *lower_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int LBP(S& v, T a) { return lower_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> inline T UB(S& v, T a) { return *upper_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int UBP(S& v, T a) { return upper_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> ostream& operator << (ostream& os, const pair<S, T>& p) { os << p.first << " " << p.second; return os; }
template <typename S, typename T> istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator >> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int N, M;

void _main() {
    cin >> N >> M;
    cout << N * M << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


Measured memory_bytes: 3160
n, k = map(int, input().split())
mod = 10**9 + 7

cnt = [pow(k // max(i, 1), n, mod) for i in range(k+1)]

for i in range(k, 0, -1):
    for j in range(2*i, k+1, i):
        cnt[i] -= cnt[j]

s = 0
for i in range(k+1):
    s = (s + i*cnt[i]) % mod

print(s)

Measured memory_bytes: 11668
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,k,ans;

signed main(){
	
	int a;
	cin>>a;
	if(a>=30)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}

Measured memory_bytes: 3608
n = gets.to_i
a = (0..n).map {|i| i == 0 ? -1 : Float::INFINITY }
n.times do
  x  = gets.to_i
  i = (0..n).bsearch {|i| a[i] >= x } - 1
  a[i + 1] = x
end
n.downto(0) do |i|
  if a[i] != Float::INFINITY
    p i
    break
  end
end


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

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

    if(m == 1 && n == 1){
        cout << 1 << endl;
        return 0;
    }

    if(m == 1){
        if(n <= 2){
            cout << 0 << endl;
        }
        else {
            cout << n - 2 << endl;
        }
    }
    else if(n == 1){
        if(m <= 2){
            cout << 0 << endl;
        }
        else {
            cout << m - 2 << endl;
        }
    }
    else {
        cout << (m-2) * (n-2) << endl;
    }
}
  


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)

	a := nextInt()
	b := nextInt()
	q := nextInt()

	ss := make([]int, a+2)
	ss[0] = -1e18
	for i := 1; i < a+1; i++ {
		ss[i] = nextInt()
	}
	ss[a+1] = 1e18

	ts := make([]int, b+2)
	ts[0] = -1e18
	for i := 1; i < b+1; i++ {
		ts[i] = nextInt()
	}
	ts[b+1] = 1e18

	for i := 0; i < q; i++ {
		x := nextInt()

		s1 := sort.SearchInts(ss, x)
		t1 := sort.SearchInts(ts, x)
		ans := int(1e18)
		for _, s := range []int{ss[s1], ss[s1-1]} {
			for _, t := range []int{ts[t1], ts[t1-1]} {
				d := min(abs(x-s)+abs(s-t), abs(x-t)+abs(t-s))
				ans = min(ans, d)
			}
		}
		fmt.Println(ans)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 6400
all_count = int(raw_input())

for i in range(all_count):
    dansa_count = int(raw_input())
    lis = raw_input().split(' ')
    dansa_lis = [int(num) for num in lis]
    
    up_lis = []
    down_lis = []
    for i in range(dansa_count-1):
        if dansa_lis[i] <= dansa_lis[i+1]:
            up = dansa_lis[i+1] - dansa_lis[i]
            up_lis.append(up)
        else:
            down = dansa_lis[i] - dansa_lis[i+1]
            down_lis.append(down)
    else:
        up_lis.append(0)
        down_lis.append(0)

    up_lis.sort()
    down_lis.sort()
    
    print up_lis[-1], down_lis[-1]

Measured memory_bytes: 4232