akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(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(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { 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 int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int H,W;
  cin >> H >> W;
  vector<string> S(H);
  cin >> S;
  auto cnt = make_v<int>(H, W);
  fill_v(cnt, 0);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') continue;
      for (int k = 0; k < 8; k++) {
        int ny = i + dy[k];
        int nx = j + dx[k];
        if (IN(ny,0,H-1) && IN(nx,0,W-1)) {
          cnt[i][j] += (S[ny][nx] == '#');
        }
      }
    }
  }
  REP(i,H) {
    REP(j,W) {
      if (S[i][j] == '#') cout << '#';
      else cout << cnt[i][j];
    }
    cout << endl;
  }


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define trace1(a) cout << a << 'n';
#define trace2(a, b) cout << a << ' ' << b << 'n';
#define trace3(a, b, c) cout << a << ' ' << b << ' ' << c << 'n';
#define trace4(a, b, c, d) cout << a << ' ' << b << ' ' << c << ' ' << d << 'n';
#define trace5(a, b, c, d, e) cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << 'n';
#define trace6(a, b, c, d, e, f) cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << ' ' << f << 'n';
#define range(n) for(int i = 0; i < n; i++)
#define printArr(harry, tam) range(tam) cout << harry[i] << " n"[i == tam -1];
#define maxn -2000000 //negative value to break code and force you to put right constraint
#define mod 998244353
#define md(x) (x) % mod;
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define prt(x) cout << (#x) << " is " << (x) << endl
#define EPS 1e-9
#define INF 1000000000
#define INFd 1e9
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<double> vd;

ll binpow(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b=b>>1;
	}
	return res;
}
int main()
{
	ll n;
	cin>>n;
	map<ll,ll> m;
	ll M=-1;
	vector<ll> v(n);
	for(ll i=0;i<n;i++)
	{
		cin>>v[i];
		M=max(M,v[i]);
		m[v[i]]++;
	}
	if(m[0]!=1||v[0]!=0)
	{
		cout<<0;
	}
	else
	{
		ll ans=1,i;
		for(i=1;i<=M;i++)
		{

			if(m[i]==0)
			{
				cout<<0;
				break;
			}
			else
			{
				ans=(ans*binpow(m[i-1],m[i]))%mod;
			}

		}
		if(i==(M+1))
		cout<<ans;
	}
}

Measured memory_bytes: 7296
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>



using namespace std;

int p[1000];
int n,k;
int ans=0;
int main(){
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    sort(p,p+n);
    for(int i=0;i<k;i++){
        ans += p[i];
    }
    cout << ans << endl;


return 0;
}

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

using namespace std;

int main() {
    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double alpha = (H * 60 + M) / 720 * (M_PI * 2);
    double beta = (M / 60) * (M_PI * 2);
    double theta = alpha - beta;
    double ans = sqrt(A * A + B * B - 2 * A * B * cos(theta));
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 4216
#include<stdio.h>
#include<string.h>
#include<math.h>
#define anD &&
#define oR ||
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define rep(i,n) for((i)=0;(i)<(n);(i)++)

void doswap(int*p,int *q,int *r) {
	int tmp;
	tmp = *p;
	*p = *q;
	*q = tmp;
	*r=*r+1 ;
}



int main(void) {
	int n, num = 0;
	scanf("%d", &n);
	int a[101] ;
	int i,j;
	rep(i,n) {
		scanf("%d", &a[i]);
	}


	rep(i,n) {
		for (j = (n- 1); j >i; j--) {
			if (a[j] < a[j - 1]) {
				doswap(&a[j], &a[j - 1], &num);

			}
		}
	}
	rep(i,n) {
		if (i > 0) printf(" ");
		printf("%d", a[i]);
	}
	printf("\n%d\n", num);
	return 0;
}

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

typedef long long int ll;
typedef long double ld;
typedef vector< int > vi;
typedef vector< ll > vl;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef vector< pii > vpii;     
typedef vector< pll > vpll;         typedef map<int,int> mii;
#define endl '\n'
#define forn(i,n) for(int i=0; i<n; i++)
#define rforn(i,n) for(int i=n-1; i>=0; i--)
#define all(x) x.begin(), x.end()
#define pr(x) cout << #x << "=" << x << endl
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define in insert

const ld eps=1e-7;

void solve()
{
    int a, b;
    cin >> a >> b;
    cout << a*b << endl;
    return;
}
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

vector<ll> yak;
void yakusuu(ll x){
    for(ll i=1;i*i<=x;i++){
        if(x%i==0){
            yak.push_back(i);
            if(i*i!=x){
                yak.push_back(x/i);
            }
        }
    }
    sort(yak.begin(),yak.end(),greater<ll>());
}

int main(){fastio
    ll n,k;cin>>n>>k;
    ll a[n];
    ll a_sum=0;
    rep(i,0,n-1){
        cin>>a[i];
        a_sum+=a[i];
    }
    yakusuu(a_sum);
    rep(i,0,yak.size()-1){
        vector<ll> q;
        rep(j,0,n-1){
            if(a[j]%yak[i]!=0){
                q.pb((a[j]%yak[i]+yak[i])%yak[i]);
            }
        }
        if(q.size()==0){
            cout<<yak[i]<<endl;
            return 0;
        }
        sort(q.begin(),q.end());
        ll q_sum=0;
        rep(i,0,q.size()-1){
            q_sum+=q[i];
        }
        ll d=q_sum/yak[i];
        ll sco=0;
        rep(i,0,(ll)q.size()-d-1){
            sco+=q[i];
        }
        if(sco<=k){
            cout<<yak[i]<<endl;
            return 0;
        }
    }
    
    
    return 0;
}





Measured memory_bytes: 3660
#include <stdio.h>
int main(){
	int a[30]={ 0 },i,j;
	for(i=0;i<28;i++){
		scanf("%d",&j);
		a[j-1]=1;
	}
	for(i=0;i<30;i++){
		if(a[i]==0)
		printf("%d\n",i+1);
	}
	return 0;
}

Measured memory_bytes: 2760
use std::io::stdin;

fn main() {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    
    let words: Vec<i64> = line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    let n = words[0];
    let r = words[1];

    if n >= 10 {
        println!("{}", r);
    } else {
        println!("{}", r + 100 * (10 - n))
    }
}


Measured memory_bytes: 4352
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        while(true){
            c = c - b;
            if(c<=0){
                System.out.println("Yes");
                break;
            }
            a = a-d;
            if(a <=0){
               System.out.println("No");
               break;
            }
        }
    }

}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  string s;
  cin >> s;
  set<char> d;
  for (char c = 'a'; c <= 'z'; c++) d.insert(c);
  for (auto &i : s) d.erase(i);
  if (d.size()) {
    s += *d.begin();
    cout << s << '\n';
    return;
  }
  set<char> g;
  while (s.size()) {
    char c = s.back();
    s.pop_back();
    auto it = g.upper_bound(c);
    if (it != g.end()) {
      s += *it;
      cout << s << '\n';
      return;
    }
    g.insert(c);
  }
  cout << -1 << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3620
H, W = [int(x) for x in input().split(" ")]

d = {}

for h in range(H):
    row = input()
    for a in list(row):
        if a in d:
            d[a] += 1
        else:
            d[a] = 1


res = False

if H % 2 == 0 and W % 2 == 0:
    for v in d.values():
        if v % 4 != 0:
            res = True
            break
    res = not res

elif H % 2 == 1 and W % 2 == 0:
    cnt4 = (W // 2) * ((H - 1) // 2)
    cnt2 = (W // 2)
    temp4 = 0
    temp2 = 0
    f = True
    for v in d.values():
        if v % 2 != 0:
            f = False
            break

        temp4 += v // 4
        temp2 += 1 if v % 4 != 0 else 0
    
    if f and cnt2 >= temp2 and (cnt2 - temp2) % 2 == 0:
        res = True
elif H % 2 == 0 and W % 2 == 1:
    cnt4 = (H // 2) * ((W - 1) // 2)
    cnt2 = (H // 2)
    temp4 = 0
    temp2 = 0
    f = True
    for v in d.values():
        if v % 2 != 0:
            f = False
            break

        temp4 += v // 4
        temp2 += 1 if v % 4 != 0 else 0
    
    if f and cnt2 >= temp2 and (cnt2 - temp2) % 2 == 0:
        res = True
else:
    cnt4 = ((H - 1) // 2) * ((W - 1) // 2)
    cnt2 = ((H - 1) // 2) + ((W - 1) // 2)
    temp4 = 0
    temp2 = 0
    temp1 = 0

    for v in d.values():
        temp4 += v // 4
        temp2 += (v % 4) // 2
        temp1 += (v % 2)
    
    if temp1 == 1 and cnt2 >= temp2 and (cnt2 - temp2) % 2 == 0:
        res = True

print("Yes" if res else "No")

Measured memory_bytes: 3192
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define all(a)	begin(a),end(a)
#define mp(a,b)	make_pair(a,b)
#define fst	first
#define scn second

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;

int main() {
	while (true) {
		string s = "";	cin >> s;
		if (s == "0")	break;
		int sum = 0;
		vint cnt(11, 0);
		cnt[0] = 1;
		int ret = 0;
		rrep(i, s.size()) {
			sum += 11 + (i & 1 ? -1 : 1)*(s[i] - '0');
			sum %= 11;
			if (s[i] != '0')	ret += cnt[sum];
			cnt[sum]++;
		}
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 3264
# import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
e1,e2,e3 = map(int,input().split())
#f = list(map(int,input().split()))
# g = [input() for _ in range(15)]
# zoro = int(a[0]*len(a))
A=e1+e2
B=e2+e3
C=e1+e3
print(min(A,B,C))

Measured memory_bytes: 9076
#include<bits/stdc++.h>
using namespace std;
typedef long long giant;
inline char nchar() {
	static const int bufl=1<<20;
	static char buf[bufl],*a=NULL,*b=NULL;
	return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
inline int read() {
	int x=0,f=1;
	char c=nchar();
	for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
	for (;isdigit(c);c=nchar()) x=x*10+c-'0';
	return x*f;
}
const int maxn=5e5+10;
int n,m;
giant a[maxn],no[maxn],p[maxn];
int main() {
	n=read(),p[0]=read();
	for (int i=1;i<=n;++i) {
		giant &x=a[i]=read();
		p[i]=min(p[i-1],abs(p[i-1]-x));
	}
	no[n+1]=0;
	for (int i=n;i;--i) {
		giant &x=no[i+1],k=min(x,a[i]/2);
		if (a[i]-k>k+1) no[i]=k; else no[i]=a[i]+x;
	}
	int q=read();
	while (q--) {
		int x=read();
		puts(p[x-1]>no[x+1]?"YES":"NO");
	}
	return 0;
}


Measured memory_bytes: 14720
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    Set<Integer> set = new HashSet<>();

    for (int i = 1; i <= 9 ; i++) {
      for (int j = 1; j <= 9 ; j++) {
        set.add(i*j);
      }
    }

    if(set.contains(N)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }

}

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

int main() {
  	string s;
  	int p = 700;
  	for(int i = 0; i < 3; i++){
    	cin >> s;
    }
  	for(int i = 0; i < 3; i++){
    	if(s.at(i) == 'o') {
          p += 100;
        }
    }
  	cout << p << endl;
  	return 0;
}


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

using namespace std;

typedef long long ll;

int main()
{
  vector<ll> vs(7);
  for(int i = 0; i < 7; i++)
  {
	cin >> vs[i];
  }

  ll k = 2 * vs[1];
  vector<int> is = {0, 3, 4};
  for(int i : is)
  {
	ll num = vs[i] <= 2 ? 0 : vs[i] % 2 == 0 ? vs[i] - 2 : vs[i] - 1;
	k += 2 * num;
	vs[i] -= num;
  }
  
  vector<int> table = {0, 0, 4, 0, 0, 4, 4, 4, 8, 0, 0, 4, 0, 6, 6, 4, 6, 8, 4, 0, 8, 4, 6, 8, 8, 8, 12};
  int index = 9 * vs[0] + 3 * vs[3] + vs[4];
  k += table[index];
  cout << k / 2 << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <ios>
#include <iostream>
#include <vector>

#define ll long long

using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;
    A %= 3;
    B %= 3;
    if (A * B == 0 || (A + B) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}

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

int main(){
	int n,k=0;
  	cin >> n;
  	for (int i=0; i<n; i++){
    int j,l;
      cin >> j >> l;
      k += (l-j+1) ; 
    }
  cout << k << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
struct P{
    long long a,b,d;
    char c;
    string e;
    const bool operator < (const P &t){
        if(a!=t.a) return a<t.a;
        if(b!=t.b) return b<t.b;
        if(c!=t.c) return c<t.c;
        if(d!=t.d) return d<t.d;
         return e<t.e;

    }
};
int main()
{
   int n;
   cin>>n;
   P p[n];
   for(int i=0;i<n;i++){cin>>p[i].a>>p[i].b>>p[i].c>>p[i].d>>p[i].e;}
   sort(p,p+n);
   for(int i=0;i<n;i++){cout<<p[i].a<<" "<<p[i].b<<" "<<p[i].c<<" "<<p[i].d<<" "<<p[i].e<<"\n";}


}


Measured memory_bytes: 13216
public class Main {

  private static void solve() {
    int n = ni();
    int k = ni();
    int[] h = na(n);

    int cnt = 0;
    for (int v : h) {
      if (v >= k) {
        cnt++;
      }
    }
    System.out.println(cnt);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 30320
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;

            for (; (line = Console.ReadLine()) != "";)
            {
                string[] sArr = line.Split(' ');
                int h = int.Parse(sArr[0]);
                int w = int.Parse(sArr[1]);

                if (h == 0 && w == 0)
                {
                    break;
                }

                string r = new string('#', w);
                for (int i = 0; i < h; i++)
                {
                    Console.WriteLine(r);
                }

                Console.WriteLine();
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 8944
#include <iostream>

using namespace std;

int main(){
  unsigned long long int S, C;
  cin >> S >> C;
  
  unsigned long long int ans;
  if(S > C / 2){
    ans = C / 2;
  }else{
    unsigned long long int d = C - S*2;
    if(d < 3LL) ans = C / 2;
    else ans = S + d / 4;
  }
  cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'
#define y1 y12312123
#define int ll

using namespace std;

const int N = 3e5 + 3;
const int inf = 1e9 + 3;
int n, a, b;

main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int l, r;
    int ans = inf;
    cin >> l >> r;
    for(int i = l; i <= r; ++i){
        for(int j = i + 1; j <= r; ++j){
            ans = min(ans, i * j % 2019);
            if(ans == 0){
                cout << ans;
                return 0;
            }
        }
    }
    cout << ans;

}


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

#define forn(i, a, b) for (int i = a; i <= b; ++i)

using namespace std;

const int N = (int)2e5 + 1;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int a, b;
int main (){
  scanf ("%d %d", &a, &b);
  a--, b--;
  printf ("%d\n", a * b);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int T = sc.nextInt();

		int A = 0;

		if (N%X >0) A = 1;

		System.out.println((N/X + A) * T);
		sc.close();
	}
}


Measured memory_bytes: 35628
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B_Tag solver = new B_Tag();
        solver.solve(1, in, out);
        out.close();
    }

    static class B_Tag {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long a = in.nextInt();
            long v = in.nextInt();
            long b = in.nextInt();
            long w = in.nextInt();
            long t = in.nextInt();
            a = Math.abs(a - b);
            v = Math.max(v - w, 0);
            out.println(t * v >= a ? "YES" : "NO");
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 32876
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <vector>
#include <tuple>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
typedef tuple<int, int, int> T;

int INF = 1e+9;
int w, h;
char s[60][31];
int dp[60][30][2];	//left:0, right:1

int solve() {
	int i, j, k;
	queue<T> que;
	
	rep(i, h) rep(j, w) rep(k, 2) dp[i][j][k] = INF;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == 'S') {
				rep(k, 2) {
					dp[i][j][k] = 0;
					que.push(T(i, j, k));
				}
			}
		}
	}
	
	while (!que.empty()) {
		T now = que.front(); que.pop();
		int y = get<0>(now);
		int x = get<1>(now);
		int d = get<2>(now);
		int cst = dp[y][x][d];
		
		for (i = -2; i <= 2; i++) {
			for (j = 1; j <= 3; j++) {
				if (abs(i) + abs(j) > 3) continue;
				int ny = y + i;
				int nx = x;
				if (d == 0) nx += j;
				else nx -= j;
				if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
				if (s[ny][nx] == 'X') continue;
				
				int ncst = 0;
				if ('0' <= s[ny][nx] && s[ny][nx] <= '9') {
					ncst = s[ny][nx] - '0';
				}
				ncst += cst;
				int nd = !d;
				
				if (dp[ny][nx][nd] > ncst) {
					dp[ny][nx][nd] = ncst;
					que.push(T(ny, nx, nd));
				}
			}
		}
	}
	
	int ans = INF;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == 'T') {
				rep(k, 2) {
					ans = min(ans, dp[i][j][k]);
				}
			}
		}
	}
	if (ans >= INF) return -1;
	return ans;
}

int main() {
	while (cin >> w >> h) {
		if (!w) { break; }
		int i, j;
		rep(i, h) rep(j, w) cin >> s[i][j];
		int res = solve();
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 3032
import java.io.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();

        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

int main()
{
  string S;
  cin >> S;
  int count = 0;
  for(int i = 0;i < 3;i++){
    if(S[i] == 'o') count += 1;
  }
  cout << (700 + 100*count) << endl;

  return 0;
}


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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  ll sum = 0;
  for (ll i = 1; i <= N; i++) {
    if (i % 3 == 0 || i % 5 == 0) continue;
    sum += i;
  }
  cout << sum << endl;

  return 0;
}



Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

int main()
{
	int H = 0, N = 0;
	int ans = 0;
	std::cin >>H >> N;

	std::vector<int> A(N), B(N);
	for (int i = 0; i < N; i++)
	{
		std::cin >> A[i] >> B[i];
	}
	
	std::vector<int> DP(H + 1);
	int inf = 1e9;

	for (int i = 1; i <= H; i++)
	{
		DP[i] = inf;
		for (int j = 0; j < N; j++)
		{
			int tmp = (i - A[j] < 0) ? 0 : DP[i - A[j]];
			DP[i] = std::min(B[j] + tmp, DP[i]);
		}
	}

	std::cout << DP[H] << std::endl;

	return 0;
}

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

#define ll long long

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
    if (n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if (n % 2 == 1) x *= 2;
    return x;
}

mint choose(int n, int a) {
    mint x = 1, y = 1;
    for(int i=0; i<a; ++i) {
        x *= (n-i);
        y *= (i+1);
    }
    return x / y;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    mint ans = f(n);
    ans -= 1;
    ans -= choose(n, a);
    ans -= choose(n, b);
    cout << ans.x << endl;

    return 0;
}

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

using namespace std;

int main(){
    long long int A,B,K;
    cin >> A >> B >> K;
    if(A<=K){
        cout << 0 << " " << max(B-(K-A),(long long int)0) << endl;
    }else{
        cout << A-K << " " << B << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(void) {
  int X, A;
  cin >> X >> A;
  
  if (X < A) {
    cout << 0 << endl;
  } else if (X > A) {
    cout << 10 << endl;
  } else if (X == A) {
    cout << 10 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

ll step(ll n)
{
  if(n==2)return 2;
  if(n==1)return 1;
  if(n==0)return 1;

  ll a=step(n-1)+step(n-2)+step(n-3);

  return a;
}

int main()
{
  int n;
  int i,j;
  while(1){
    cin>>n;
    if(n==0)break;

    ll day=(step(n)+9)/10;

    cout<<(day+364)/365<<endl;

  }
}

Measured memory_bytes: 1156
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int[] count = new int[26];
        while(sc.hasNext()) {
        	String str = sc.nextLine();
            
            for(int i1 = 0; i1 < str.length(); i1++) {
            	char c = str.charAt(i1);
            	for(int i2 = 0; i2 < 26; i2++) {
            		if((int)c == (int)'a'+i2 || (int)c == (int)'A'+i2) {
            			count[i2]++;
            		}
            	}
            }
            
            
        }
        
        for(int i2 = 0; i2 < 26; i2++) {
        	System.out.println((char)('a'+i2) + " : " + count[i2]);
        }
    }
}


Measured memory_bytes: 26112
#include <iostream>
#include <algorithm>
#include <vector>
#define INF 1e9+7
using namespace std;
typedef long long int ll;

int main() {

	int a, b, c;
	cin >> a >> b >> c;

	int a1, b1, c1;
	a1 = min(abs(b - a) + abs(c - b), abs(c - a) + abs(b - c));
	b1 = min(abs(a - b) + abs(c - a), abs(c - b) + abs(a - c));
	c1 = min(abs(a - c) + abs(b - a), abs(b - c) + abs(a - b));

	cout << min(c1, min(a1, b1)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=3e5+10;
int a[N],n,B,W;
int sum[N];
bool check(int x) {
	int mi=0;
	for(int i=2;i<n;i+=2)
		if(mi+x<=sum[i-1]) mi=min(mi,sum[i]);
	return mi+x<=sum[n];
}
int main() {
	rd(n);
	for(int i=1;i<=n;++i) {
		rd(a[i]),sum[i]=sum[i-1];
		if(i&1) B+=a[i],sum[i]+=a[i];
		else W+=a[i],sum[i]-=a[i];
	}
	if(!(n&1)) {
		printf("%d %d",max(B,W),min(B,W));
		return 0;
	}
	int lb=-3e8,rb=3e8;
	while(lb<rb) {
		int mid=lb+rb+1>>1;
		if(check(mid)) lb=mid;
		else rb=mid-1;
	}
	int ans=max(W+lb,B);
	printf("%d %d",ans,W+B-ans);
	return 0;
}

Measured memory_bytes: 2560
def isU(y):
    if y % 4 == 0:
        if y % 100 == 0:
            if y % 400 == 0:
                return True
            else:
                return False
        else:
            return True
    else:
        return False

def dd(y,m,d):
    a = 0
    mm = [0,31,28,31,30,31,30,31,31,30,31,30,31]
    if isU(y):
        mm[2] = 29

    for i in range(m):
        a += mm[i]
    a += d
    return a

def dy(y1, y2):
    y = 0
    for i in range(y1, y2):
        if isU(i):
            y += 366
        else:
            y += 365
    return y

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

while True:
    y1,m1,d1,y2,m2,d2 = [int(i) for i in input().split()]
    if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0:
        break
    ans = 0
    ans += dy(y1,y2)
    ans -= dd(y1,m1,d1)
    ans += dd(y2,m2,d2)
    print(ans)



Measured memory_bytes: 5612
use std::io;
use std::str::FromStr;
use std::collections::HashSet;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
      a
    } else {
      gcd(b, a % b)
    }
}

fn dru(n: u64, m: u64) -> u64 {
    if n % m == 0 {
        return n / m;
    } 
    n / m + 1
}

fn main() {
    let (n, m) = input_tuple();
    let mut a_vec = input_vec();
    for a in &mut a_vec {
        *a /= 2;
    }
    let mut lcm = a_vec[0];
    for i in 1..a_vec.len() {
        lcm = lcm * a_vec[i] / gcd(lcm, a_vec[i]);
    }
    for a in a_vec {
        if lcm / a % 2 == 0 {
            println!("0");
            return;
        }
    }
    if lcm > m {
        println!("0");
        return;
    }
    println!("{}", dru(m / lcm, 2));
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (auto& s : S) cin >> s;

  const int dy[4] = {0, 1, 0, -1};
  const int dx[4] = {1, 0, -1, 0};
  const int inf = 1e18;
  auto bfs = [&](int sy, int sx, int gy, int gx){
    // cerr << sy <<  " " << sx << " " << gy << " " << gx << endl;
    vector<vector<int>> G(H, vector<int> (W, -1));
    queue<pair<int, int>> q;
    q.push({sy, sx});
    G[sy][sx] = 0;
    while (q.size()) {
      auto p = q.front();
      q.pop();
      int y = p.first;
      int x = p.second;
      for (int i = 0; i < 4; i++) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (ny < 0 || ny >= H) continue;
        if (nx < 0 || nx >= W) continue;
        if (S[ny][nx] == '#') continue;
        if (G[ny][nx] != -1) continue;
        q.push({ny, nx});
        G[ny][nx] = G[y][x] + 1;
      }
    }
    // for (auto v : G) {for (auto x : v) cerr << x << " "; cerr << endl;}
    return G[gy][gx];
  };

  int ans = 0;
  for (int start = 0; start < H * W; start++) {
    for (int goal = 0; goal < H * W; goal++) {
      int sy = start / W;
      int sx = start % W;
      int gy = goal / W;
      int gx = goal % W;
      if (S[sy][sx] == '#' || S[gy][gx] == '#') continue;
      int t = bfs(sy, sx, gy, gx);
      // cerr << t << endl;
      ans = max(ans, t);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
  	int n;cin >>n;
  	int arr[n+1];
  	for(int i=1;i<=n;i++)
    {
    	cin >>arr[i];
    }
  	int dp[n+1];
    memset(dp,0,(n+1)*sizeof(int));
  	dp[1]=0;
  	dp[2]=abs(arr[2]-arr[1]);
  	for(int i=3;i<=n;i++)
    {
    	dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
    }
  	cout <<dp[n];
	return 0;
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int s; cin >> s;

    int val = 1000000000;
    
    int x = (val - s%val);
    if(x == val) x = 0;
    int y = (x+s)/val;

    printf("0 0 %lld 1 %lld %lld\n", val, x, y);
    
    return 0;
}


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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

template<typename T> struct SparseTable{
	vector< vector<int> > table;
	vector<T> dat;
	vector<int> logTable;
	void init(vector<T> _dat,bool rev = false){
		dat = _dat;
		int n = dat.size();
		if(rev) for(int i = 0;i < n;i++) dat [i] *= -1;
		logTable.assign(n + 1,0);
		for(int i = 2;i <= n;i++){
			logTable [i] = logTable [i / 2] + 1;
		}
		table.assign(logTable [n] + 1,vector<int>(n,0));
		for(int i = 0;i < n;i++) table [0] [i] = i;
		for(int i = 1;i <= logTable [n];i++){
			for(int j = 0;j + (1 << i) <= n;j++){
				if(dat [table [i - 1] [j]] < dat [table [i - 1] [j + (1 << (i - 1))]]){
					table [i] [j] = table [i - 1] [j];
				}
				else{
					table [i] [j] = table [i - 1] [j + (1 << (i - 1))];
				}
			}
		}
	}
	int get_min(int l,int r){
		int lg = logTable [r - l];
		if(dat [table [lg] [l]] < dat [table [lg] [r - (1 << lg)]]){
			return table [lg] [l];
		}
		return table [lg] [r - (1 << lg)];
	}
};

int N;
const int MAX_N = 200000;
vector<int> A [2];
SparseTable<int> st [2];
vector<int> edge [MAX_N];
pair<int,int> node [MAX_N];
int deg [MAX_N];
const int INF = 1e9;
int nNode;

int new_node()
{
	return nNode++;
}

void dfs(int l,int r,int prev = -1)
{
	if(l == r) return;
	int curr = new_node();
	int x = st [l % 2].get_min(l,r);
	int y = st [l % 2 == 0].get_min(x + 1,r);
	node [curr] = make_pair(A [l % 2] [x],A [l % 2 == 0] [y]);
	if(prev != -1){
		edge [prev].push_back(curr);
		deg [curr]++;
	}
	dfs(l,x,prev);
	dfs(x + 1,y,curr);
	dfs(y + 1,r,prev);
}

int main()
{
	scanf("%d",&N);
	A [0].assign(N,INF);
	A [1].assign(N,INF);
	FOR(i,0,N){
		scanf("%d",&A [i % 2] [i]);
	}
	st [0].init(A [0]);
	st [1].init(A [1]);

	dfs(0,N);

	priority_queue< pair< pair<int,int>,int >,vector< pair< pair<int,int>,int > >,greater< pair< pair<int,int>,int > > > pq;
	FOR(i,0,nNode) if(deg [i] == 0){
		pq.push(make_pair(node [i],i));
	}

	vector<int> ans;
	while(pq.empty() == false){
		int curr = pq.top().second;
		ans.push_back(pq.top().first.first);
		ans.push_back(pq.top().first.second);
		pq.pop();

		for(const auto& it : edge [curr]){
			if(--deg [it] == 0){
				pq.push(make_pair(node [it],it));
			}
		}
	}

	FOR(i,0,N){
		printf("%d%s",ans [i],i + 1 == N ? "\n" : " ");
	}

	return 0;
}


Measured memory_bytes: 54880
n = int(input())
a = list(map(int, input().split()))
s = 0
ans = 0
for i in range(len(a)):
  s += a[i]
for i in range(len(a)-1):
  s -= a[i]
  if s<0:
    s += 1000000007
  ans += s*a[i]
  ans %= 1000000007
print(int(ans))

Measured memory_bytes: 31468
s = list(input())
l = int(s[0]+s[1])
r = int(s[2]+s[3])
if 1 <= l <= 12 and 1 <= r <= 12:
    print("AMBIGUOUS")
elif 1 <= l <= 12:
    print("MMYY")
elif 1 <= r <= 12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 38256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm> // sort

using namespace std;

void Main()
{
    string S;
    cin >> S;
    if (S == "SUN") cout << 7 << endl;
    if (S == "MON") cout << 6 << endl;
    if (S == "TUE") cout << 5 << endl;
    if (S == "WED") cout << 4 << endl;
    if (S == "THU") cout << 3 << endl;
    if (S == "FRI") cout << 2 << endl;
    if (S == "SAT") cout << 1 << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll k;
set<ll>tr;
int main(){
    scanf("%lld",&k);
    ll v = 7 % k;
    int cnt=1;
    if(v == 0) return printf("1\n"),0;
    while(v != 0) {
        if(tr.find(v) != tr.end()) {
            return printf("-1\n"),0;
        }
        tr.insert(v);
        v = v * 10 + 7;
        v %= k;
        cnt ++;
        if(v == 0) return printf("%lld\n",cnt),0;
    }
    return 0;
}

Measured memory_bytes: 50628
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long A = sc.nextLong(),B = sc.nextLong();
		double k = 0;
		k = (A+B)/2;

		if((A+B)%2==0) {
			System.out.println((int)k);
		}else {
			System.out.println("IMPOSSIBLE");
		}
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int N,A,B,C;
vector<int> l;
int32_t INF=1e9; 
int dfs(int n,int a,int b,int c){
  if(n==N){
    return min({a,b,c})>0? abs(a-A)+abs(b-B)+abs(c-C)-30:INF;
  }
  int tmp0=dfs(n+1,a,b,c);
  int tmp1=dfs(n+1,a+l[n],b,c)+10;
  int tmp2=dfs(n+1,a,b+l[n],c)+10;
  int tmp3=dfs(n+1,a,b,c+l[n])+10;
  return min({tmp0,tmp1,tmp2,tmp3});
}

int main()
{
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++){
    int k;
    cin>>k;
    l.push_back(k);
  }
  cout<<dfs(0,0,0,0);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int N;
	cin >> N;
	cout << N / 3 << endl;

	return 0;
}


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

class Program
{
    static string l;
    static int n;
    static long mod = (long)1e9 + 7;

    static void Main()
    {
        l = Console.ReadLine();
        n = l.Length;

        long[,] dp = new long[n, 2];
        dp[0, 0] = 2;
        dp[0, 1] = 1;
        for (int i = 1; i < n; i++)
        {
            if (l[i] == '1')
            {
                dp[i, 0] = (2 * dp[i - 1, 0]) % mod;
                dp[i, 1] = dp[i - 1, 0];
                dp[i, 1] += (3 * dp[i - 1, 1]) % mod;
                dp[i, 1] %= mod;
                continue;
            }
            dp[i, 0] = dp[i - 1, 0];
            dp[i, 1] = 3 * dp[i - 1, 1] % mod;
        }
        Console.WriteLine((dp[n - 1, 0] + dp[n - 1, 1]) % mod);
    }
}

Measured memory_bytes: 13636
import sys
input = sys.stdin.readline
from collections import defaultdict

def compress(l):
    l = list(set(l))
    l.sort()
    d1 = defaultdict(int)
    d2 = defaultdict(int)
    
    for i in range(len(l)):
        d1[l[i]] = i
        d2[i] = l[i]
    
    return d1, d2

class BIT:#0-indexed
    def __init__(self, n):
        self.n = n
        self.bit = [0]*(n+1)
    
    def acc(self, i):#a0+...+ai
        i += 1
        s = 0
        
        while i>0:
            s += self.bit[i]
            i -= i&(-i)
        
        return s
    
    def add(self, i, x):#ai += x
        i += 1
        
        while i<=self.n:
            self.bit[i] += x
            i += i&(-i)

def binary_search(c):
    l, r = 0, L-1
    
    while l<=r:
        m = (l+r)//2
        
        if bit.acc(m)>=(c+1)//2:
            r = m-1
        else:
            l = m+1
    
    return l
    
Q = int(input())
que = []
l = []

for _ in range(Q):
    que_i = tuple(map(int, input().split()))
    
    if len(que_i)==3:
        l.append(que_i[1])
    
    que.append(que_i)

d1, d2 = compress(l)
L = len(list(d1.keys()))
bit = BIT(L)
bit2 = BIT(L)
cnt = 0
b_acc = 0

for que_i in que:
    if len(que_i)==3:
        a, b = que_i[1], que_i[2]
        bit.add(d1[a], 1)
        bit2.add(d1[a], a)
        b_acc += b
        cnt += 1
    else:
        med_idx = binary_search(cnt)
        med = d2[med_idx]
        s = bit.acc(med_idx)*med-bit2.acc(med_idx)+(bit2.acc(L-1)-bit2.acc(med_idx))-(bit.acc(L-1)-bit.acc(med_idx))*med
        s += b_acc
        print(med, s)

Measured memory_bytes: 120916
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=100009;
 
// Happy Coding!


void solve(){
    int n;
    cin>>n;
    double x=(n*100.0)/108;
    int xx=ceil(x);    
    // cout<<x<<" "<<xx<<" "<<(int)xx*1.08<<" ";
    int val=xx*(1.08);
    // cout<<val<<endl;
    if(val==n){
        cout<<xx;
    }
    else{
        cout<<":(";
    }
}

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pii pair<int,int>
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int a[3];
  rep(i,0,3) cin>>a[i];
  sort(a,a+3);
  co(a[0]<<" "<<a[1]<<" "<<a[2]);
  
  return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ss(x) (int) x.size()
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)

using ll = long long;
using namespace std;

const int N = 3e5 + 100;
const int MOD = 998244353;

int n, type[N], cnt[3];
char s[N];
vector <int> g[3];

int main() {
	scanf ("%d%s", &n, s + 1);
	rep(i, 1, 3 * n) {
		if (s[i] == 'R') g[0].pb(i);
		if (s[i] == 'G') g[1].pb(i);
		if (s[i] == 'B') g[2].pb(i);
	}
	rep(i, 0, n - 1) {
		vector <int> v;
		rep(j, 0, 2)
			v.pb(g[j][i]);
		sort(v.begin(), v.end());
		rep(j, 0, 2)
			type[v[j]] = j;
	}
	ll res = 1;
	rep(i, 1, 3 * n) {
		if (type[i] == 0) res = res * (n - cnt[0]) % MOD;
		if (type[i] == 1) res = res * (cnt[0] - cnt[1]) % MOD;
		if (type[i] == 2) res = res * (cnt[1] - cnt[2]) % MOD;
		cnt[type[i]]++;
	}
	printf ("%lld\n", res);
	return 0;
}


Measured memory_bytes: 5924
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define Graph vector<vector<ll>>
#define INF (ll)(1ll<<60)
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}

int main(){
	ll n;cin>>n;

	ll num=1;
	while(num<=n){
		num*=2;
	}

	cout<<num/2<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double n = Double.parseDouble(sc.next());
		double d = Double.parseDouble(sc.next());

		System.out.println((int)Math.ceil(n / (d*2+1)));
	}
}

Measured memory_bytes: 21844