akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fname "B"
#define bug(x) cerr << (#x) << " = " << (x) << endl
#define ll long long
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define ARR0(a, n) {cerr <<(#a)<< ": ["; REP0(i, n) cerr<< ' ' << a[i] <<','; cerr<<']'<<endl;}
#define ARR1(a, n) {cerr <<(#a)<< ": ["; REP1(i, n) cerr<< ' ' << a[i] <<','; cerr<<']'<<endl;}
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define LB lower_bound
#define UB upper_bound
#define X first
#define Y second

using namespace std;
template<typename T, typename V>
inline void bugp(const pair<T, V> &x) {cerr << '{' << x.X << ", " << x.Y << '}' << endl;}
template<typename T, typename U, typename V>
inline void bugpp(const pair<T, pair<U, V> > &x) {cerr << '{' << x.X << ", {" << x.Y.X << ", " << x.Y.Y << "}}" << endl;}
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ll, int> li;
typedef pair<ll, ii> lii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
    int n, arr[101];
    cin >> n;
    REP1(i, n) cin >> arr[i];
    int cnt = 0;
    REP1(i, n - 2)
        FOR(j, i + 1, n - 1)
            FOR(k, j + 1, n)
                if(arr[i] + arr[j] > arr[k] && arr[i] + arr[k] > arr[j] && arr[j] + arr[k] > arr[i] && arr[i] != arr[j] && arr[j] != arr[k] && arr[i] != arr[k]) ++cnt;
    cout << cnt;
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <math.h>
#include <map>
#include <list>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
#include <string.h>
// #include <limits.h>

#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long        ll;
typedef unsigned long long    ull;

#define INTMAX  99999999

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

string X;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> X;

	bool updated = true;
	int numS = X.size()/2;
	int numT = X.size()/2;
	while(updated) {
		updated = false;
		FOR(i,X.size()) {
			if(X[i]=='S') {
				if(X[i+1]=='T') {
					X.erase(i,2);
					updated = true;
					numS--;
					numT--;
					if(X[i]=='T') {
						i-=2;
					}
				}
				else { // 'S'
					// NOP
					numS--;
				}
			}
			else { // 'T'
				// NOP
				numT--;
			}
		}
	}

	cout << X.size() << endl;

	return 0;
}
 


Measured memory_bytes: 720
n=int(input())

cnt={}
ans=[]

for i in range(n):
    s=input()
    if s in cnt.keys():
        cnt[s] += 1
    else:
        cnt[s] = 1

m=max(cnt.values())
key = sorted(cnt.keys())

for a in key:
    if cnt[a] == m:
        print(a)

Measured memory_bytes: 32096
using System;
using System.Collections.Generic;
using System.Linq;


namespace ABC121D
{
    class MainClass
    {
        static long[] s;
        static int[] n;
        public static void Main(string[] args)
        {

            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), long.Parse);
            long ans = 0;
            long diff = s[1] - s[0];
            if (s[0] % 2 == 0 && s[1] % 2 == 0)
            {
                ans = diff / 2 % 2 + s[1];
            }else if (s[0] % 2 == 0 && s[1] % 2 == 1)
            {
                ans = (diff + 1) / 2 % 2;
            }else if (s[0] % 2 == 1 && s[1] % 2 == 1)
            {
                ans = s[0] - (diff / 2 % 2);
            }
            else
            {
                ans = (s[0] - ((diff - 1) / 2 % 2)) ^ s[1];
            }
            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13268
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        foreach(var c in input.ReadLine().Split(' ')) {
            if (c == "Y") return "Four";
        }
        return "Three";
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 11092
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll x = n / 200;
    cout << 10 - x << "\n";
}

Measured memory_bytes: 3640
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var s = next();
  var output = new Array(s.length).fill("x").join("");
  myout(output);
}



Measured memory_bytes: 30076
#include <iostream>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <utility>
#define ull unsigned long long int
#define ll long long int 
#define pb push_back
#define mp make_pair
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector <int>
#define vl vector <long long int>
#define vc vector <char>
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
int main()
{

	ll a,b,c,i,j,k;

	cin>>a>>k;

	ll arr[a];ll cost[a];

	for(i=0;i<a;i++)
		cin>>arr[i];

	cost[0] = 0;
	cost[1] = abs(arr[1]-arr[0]);ll min;ll price;

	for(i=2;i<a;i++)
	{
		min = cost[i-1]+abs(arr[i]-arr[i-1]);

		for(j=2;j<=k && j<=i;j++)
		{
			price = cost[i-j]+abs(arr[i]-arr[i-j]);
			if(price<min)
				min = price;
		}

		cost[i] = min;
	}

	cout<<cost[a-1]<<endl;

}

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

int main() {
    int n, ans=0;
    cin >> n;
    vector<int> vec(n);

    for(int i=0; i<n; i++) {
        cin >> vec.at(i);
    }

    for(int i=0; i<=n-2; i++) {
        for(int j=i+1; j<=n-1; j++) {
            ans += vec.at(i) * vec.at(j);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
while 1:
  n=int(input())
  if n==0: break
  a,b,i=[0]*n,0,0
  for c in input():
    if c=="M": a[i]+=1
    elif c=="S": a[i],b=0,b+1+a[i]
    elif c=="L": a[i],b=a[i]+1+b,0
    i=(i+1)%n
  a.sort()
  print(" ".join(map(str,a+[b])))

Measured memory_bytes: 6724
#include <cstdlib>
#include <iostream>
#include <string>
#include <stack>
#include <sstream>
using namespace std;
int main() {
    stack<int> expr;
    string input;
    while (cin >> input) {
        if (input == "+") {
            int a = expr.top(); expr.pop();
            int b = expr.top(); expr.pop();
            expr.push(a + b);
        } else if (input == "-") {
            int a = expr.top(); expr.pop();
            int b = expr.top(); expr.pop();
            expr.push(b - a);
        } else if (input == "*") {
            int a = expr.top(); expr.pop();
            int b = expr.top(); expr.pop();
            expr.push(a * b);
        } else {
            expr.push(atoi(input.c_str()));
        }
    }
    cout << expr.top() << "\n";
    return 0;
}

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

#define fast                     ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll                       long long 
#define mk                       make_pair
#define pb                       push_back
#define pob                      pop_back
#define pii                      pair<int,int>
#define vi                       vector<int>
#define vii                      vector<pii>
#define mi                       map<int,int>
#define mii                      map<pii,int>
#define all(a)                   (a).begin(),(a).end()
#define x                        first
#define y                        second
#define sz(x)                    (int)x.size()
#define endl                     '\n'
#define MOD                      1000000007
#define loop(i,a,b)              for(int (i)=(a);(i)<(b);(i)++)
#define rloop(i,a,b)             for(int (i)=(a);(i)>=(b);(i)--)
#define Unique(A)                (A).resize(distance((A).begin(),unique(all((A)))));
#define mxe(A)                   *max_element(all(A))
#define mne(A)                   *min_element(all(A))
#define debv(x)                  for(auto i : (x)) cout << i << ' ';cout << endl;
#define SP(x,y)                  cout << fixed << setprecision((y)) << (x) << endl;
#define setBits(x)               __builtin_popcountll(x)
#define zroBits(x)               __builtin_ctzll(x)
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define Max(x,y,z)               max(x,max(y,z))
#define Min(x,y,z)               min(x,min(y,z))
#define clr(x)                   memset(x,0,sizeof(x)) // not sure work for 2D arrya or not

using namespace std;

double p[3100] , dp[3100][3100];

int main(){
    int n ; cin >> n ;
    loop(i,1,n+1) cin >> p[i];
    dp[0][0] = 1;
    
    loop(i,1,n+1){
        loop(j,0,i+1){
            if(j) dp[i][j] += dp[i-1][j-1]*p[i];
            dp[i][j] += dp[i-1][j]*(1-p[i]);
        }
    }
    double ans = 0 ;
    loop(i,0,n+1) if(i>n-i) ans += dp[n][i];
    SP(ans,12);
    return 0;
}

Measured memory_bytes: 72320
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int k,s;
	vector<int>a(n);//n個のスイッチがどの電球を点灯させるかを記録する配列
	repp(i, 0, m) {
		cin >> k;//i個めの電球につながっているスイッチの数
		repp(j, 0, k) {
			cin >> s;//i個目の電球が何番のスイッチにつながっているか
			s--;
			a[s] |= 1 << i;//それぞれのスイッチがどの電球を点灯させるかを各電球ごとに見ていくことで記録する(だから|=)
		}
	}int p;
	repp(i, 0, m) {
		int x;
		cin >> x;
		p |= x << i;//電球の最終点灯状態
	}
	int ans = 0;
	for (int bit = 0; bit < (1 << n); ++bit) {//スイッチの押し方について全探索
		int t = 0;
		for (int i = 0; i < n; ++i) {//それぞれのスイッチについて
			if (bit & 1 << i) {//そのスイッチを押していれば
				t ^= a[i];//xor演算子でスイッチを押した後どうなるかをシミュレート
			}
		}
		if (t == p)++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 10000
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int dp1[502][2][10][500][3], dp2[502][2][10][500][3], m;
void solve(int dp[][2][10][500][3], string&a) {
	dp[0][0][0][0][0] = 1;
	rep(i, a.size())rep(j, 2)rep(k, 10)rep(l, m)rep(d, 3) {
		int s, g, p = a[i] - '0';
		if (d == 1) { s = k + 1; g = (j ? 9 : p); }
		else if (d == 2) { s = 0; g = (j ? k - 1 : min(k - 1, p)); }
		else { s = 0; g = (j ? 9 : p); }
		for (int x = s; x <= g; x++) {
			if (x&&k == x)continue;
			int y;
			if (d == 1)y = 2;
			else if (d == 2)y = 1;
			else {
				if (k == 0)y = 0;
				else if (x < k)y = 1;
				else y = 2;
			}
			(dp[i + 1][j || x < p][x][(l * 10 + x) % m][y] += dp[i][j][k][l][d]) %= MOD;
		}
	}
}
int main() {
	string a, b; cin >> a >> b >> m;
	int d = a.size() - 1;
	while (a[d] == '0') {
		a[d] = '9'; d--;
	}
	a[d]--;
	solve(dp1, a); solve(dp2, b);
	int sum1 = 0, sum2 = 0;
	rep(i, 2)rep(j, 10)rep(t, 3) {
		(sum1 += dp1[a.size()][i][j][0][t]) %= MOD;
		(sum2 += dp2[b.size()][i][j][0][t]) %= MOD;
	}
	printf("%d\n", (sum2 + MOD - sum1) % MOD);
}

Measured memory_bytes: 73848
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Array.Reverse(A);
		int ma = 0;
		int cnt = 1;
		for(int i=1;i<N;i++){
			if(A[i] >= A[i - 1]){
				cnt++;
			} else {
				ma = Math.Max(cnt, ma);
				cnt = 1;
			}
		}
		ma = Math.Max(ma, cnt);
		
		Console.WriteLine(ma - 1);
		
		
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 23004
#include <stdio.h>
int main(void)
{
  char S[4];
  int i;
  int n = 0;

  scanf("%s", S);

  for(i = 0; S[i] != '\0'; i++){
    if(S[i] == S[i + 1]){
      n++;
    }
  }

  if(n == 0){
    printf("Good");
  }

  else {
    printf("Bad");
  }

  return(0);
}


Measured memory_bytes: 128
a,b,c,x,y=map(int,input().split())
hand=[]
hand.append(x*a+y*b)
if x>y:
    hand.append(y*c*2+(x-y)*a)
    hand.append(x*c*2)
elif x==y:
    hand.append(x*c*2)
else:
    hand.append(x*c*2+(y-x)*b)
    hand.append(y*c*2)
print(min(hand))

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

signed main(){
    int n; cin >> n;
    int ans = 0;
    vector<int> s(n+1);
    s[n] = 0;
    
    rep(i,n){
        cin >> s[i];
        ans += s[i];
    }
    
    sort(ALL(s));
    for(int i : s){
        if((ans - i) % 10 != 0){
            cout << ans - i << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}

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

#define REP(i,n) for(int i = 0;i < n;i++)
#define REPR(i,n) for(int i = n-1;i >= 0;i--)
#define FOR(i,m,n) for(int i = m;i < n;i++)
#define INF 2e9
#define ALL(v) v.begin(),v.end()
#define ll long long
#define GREATER greater<int>()

using namespace std;

string pop_back(string s){
    string t = s.substr(0,s.size()-1);
    return t;
}

int gcd(int max,int min){
    
    if(max<min){
        int tmp=max;
        max=min;
        min=tmp;
    }

    if(max%min==0)return min;
    else return gcd(min,max%min);

}

int main(void){

    int a,b,k;
    cin>>a>>b>>k;

    for(int i=a;i<=b;i++){
        if(i-a<k||b-i<k)cout<<i<<endl;
    }

    return 0;
}




Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans=0
for i in range(n):
    a = list(map(int,input().split()))
    d = c
    for k in range(m):
        d+=a[k]*b[k]
    if d>0:
        ans+=1
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
import java.io.*;

public class Main{
    public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 
        try { 
            Scanner sc = new Scanner(System.in);
        while(true){
            String str = reader.readLine();
            if(str.equals("0")){
                break;
            }
            int m=0;
            for(int i=0;i<str.length();i++){
            char c = str.charAt(i); 
                 if(c == '1'){
                     m=m+1;
                 }else if(c == '2'){
                     m=m+2;
                 }else if(c == '3'){
                     m=m+3;
                 }else if(c == '4'){
                     m=m+4;
                 }else if(c == '5'){
                     m=m+5;
                 }else if(c == '6'){
                     m=m+6;
                 }else if(c == '7'){
                     m=m+7;
                 }else if(c == '8'){
                     m=m+8;
                 }else if(c == '9'){
                     m=m+9;
                 }
                 }
                 System.out.println(m);
                 }
                 } catch (IOException e) { 
                 System.out.println(e); 
                 }
        }
    }


Measured memory_bytes: 26240
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

string s, t[] = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };

int main() {
	cin >> s;
	
	inc(i, 7) {
		if(s == t[i]) { cout << 7 - i << endl; }
	}
	
	return 0;
}


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

int n;
int ans=0;

void check(ll x) {
  bitset<3> used;
  int d = log10(x) + 1;
  int t1 = x, tmp;
  for (int i=0; i<d; i++) {
    tmp = t1 % 10;
    if (tmp == 7) used[2]=true;
    else if (tmp == 5) used[1]=true;
    else if (tmp == 3) used[0]=true;
    t1 /= 10;
  }
  if (used.all() && (n >= x)) ans ++;
}

void dfs(ll x) {
  check(x);
  if (x < 1000000000) {
    dfs(10 * x + 3);
    dfs(10 * x + 5);
    dfs(10 * x + 7);
  }
}

int main() {
	cin >> n;
  	dfs(0);
  	cout << ans << endl;
  	return 0;
	
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int d;
  cin >> d;
  
  for (int i = 0; i < d; i++) cout << (rand() % 26) + 1 << '\n';
}

Measured memory_bytes: 3696
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
s = [input() for _ in range(H)]
s2 = []

for x in s:
	if x == "." * W:
		continue
	s2.append(x)

#print(s2)

check = [1]*W

for i in range(len(s2)):
	for j in range(W):
		if s2[i][j] == "#":
			check[j] *= 0
#print(check)

for i in range(len(s2)):
	for j in range(W):
		if check[j] == 0:
			print(s2[i][j], end = "")
	print()

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

vector<int> dp;

int mc(int* arr,int step,int n)
{
	if(step>=n-1)
	return 0;
	
	if(dp[step]!=-1)
	return dp[step];
	
	int ans=min(abs(arr[step]-arr[step+1])+mc(arr,step+1,n),abs(arr[step]-arr[step+2])+mc(arr,step+2,n));
	
	return dp[step]= ans;
}

int main() {
	// your code goes here
	
	int n;
	
	cin>>n;
	
	int arr[n];
	
	for(int i=0;i<n;i++)
	cin>>arr[i];
	
	dp.assign(n+1, -1);
	
	int ans=mc(arr,0,n);
	
	cout<<ans<<endl;
	
	return 0;
}

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

int main(void)
{
	char ring[21];
	char search[11];
	int len;
	int s_len;
	int out = 0;
	int no;
	int i;
	
	scanf("%10s", search);
	scanf("%d", &no);
	
	while (no--){
		scanf("%10s", ring);
		
		len = strlen(ring);
		memmove(&ring[len], ring, len + 1);
		
		s_len = strlen(search);
		
		for (i = 0; i < len; i++){
			if(memcmp(&ring[i], search, s_len) == 0){
				out++;
				break;
			}
		}
	}
	
	printf("%d\n", out);
	
	return (0);
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt(), W = sc.nextInt();
		int h = sc.nextInt(), w = sc.nextInt();
		System.out.println((H-h)*(W-w));
		sc.close();
	}
}

Measured memory_bytes: 23124
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

inline string chmax(string &lhs, string rhs) {

	if (lhs.size() > rhs.size()) return lhs;
	else if (lhs.size() < rhs.size()) return rhs;
	else return lhs > rhs ? lhs : rhs;

}

int main() {

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

	int N, M;
	cin >> N >> M;

	vector<int> m_num({ 2,5,5,4,5,6,3,7,6 });
	vector<int> A(M);
	for (int i = 0; i < M; i++) cin >> A[i];

	int idx;
	vector<string> dp(N + 1);
	for (int m = 0; m <= N; m++) {
		for (int i = 0; i < M; i++) {

			idx = m - m_num[A[i] - 1];
			if (idx >= 0 && (dp[idx] != "" | idx == 0)) {
				dp[m] = chmax(dp[m], dp[idx] + to_string(A[i]));
			}

		}
	}

	cout << dp[N] << "\n";

	return 0;
}

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


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

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

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

const int MAX = 1e6+1;
const int MOD = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


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

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

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

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}

long long modpow(long long res,long long a, long long n, long long mod) {
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//sieve(MAX);でベクトルIsPrimeに「MAXまでの数値の素数の真偽」を格納する。
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}
// ここから開始
int N,A,B,C;
int finans = 0;
int l[8];

int dfs(int x,int a, int b, int c){
  if(x==N){
    if(a*b*c!=0){
      return abs(A-a)+abs(B-b)+abs(C-c)-30;
    }
    else return 100000000;
  }
  else{
    int res = min(dfs(x+1,a,b,c),dfs(x+1,a+l[x],b,c)+10);
    res = min(dfs(x+1,a,b+l[x],c)+10,res);
    res = min(dfs(x+1,a,b,c+l[x])+10,res);
    return res;
  }
}

int main(){
  cin>>N>>A>>B>>C;
  for(int i = 0; i < N; i++){
    cin>>l[i];
  }
  cout<<dfs(0,0,0,0)<<endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long signed int ll;
int main(){
	ll a,b;
  	cin>>a>>b;
	if(a<=0 && b>=0) cout<<"Zero";
	else if(a>0 && b>0) cout<<"Positive";
	else if((b-a+1)%2==0) cout<<"Positive";
	else cout<<"Negative";
	return 0;
}
	

Measured memory_bytes: 256
//
// Created by Knight_F on 2019-08-18.
//

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
double a[60];
int main(){
    int n; cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(int i=2;i<=n;i++){
        a[i]=(a[i]+a[i-1])/2.0;
    }
    printf("%.5f",a[n]);
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
long long dp[4];
int main()
{
    string s;
    cin >> s;
    int l = (int)s.length();
    dp[0] = 1;
    for(int i = 0; i < l; ++i)
    {
        switch(s[i])
        {
            case 'A':
                (dp[1] += dp[0]) %= 1000000007;
                break;
            case 'B':
                (dp[2] += dp[1]) %= 1000000007;
                break;
            case 'C':
                (dp[3] += dp[2]) %= 1000000007;
                break;
            case '?':
                (dp[3] *= 3) %= 1000000007;
                for(int j = 2; j >= 0; --j)
                {
                    (dp[j + 1] += dp[j]) %= 1000000007;
                    (dp[j] *= 3) %= 1000000007;
                }
                break;
        }
    }
    cout << dp[3] << "\n";
}


Measured memory_bytes: 512
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main _ =
    let N = read int
    let S = read string |> Seq.toArray |> Array.map (string >> int)

    let dp = Array3D.create (N + 1) 4 1000 false
    dp.[0,0,0] <- true

    for i in 0 .. N - 1 do
        for j in 0 .. 3 do
            for k in 0 .. 999 do
                if dp.[i,j,k] then
                    dp.[i+1,j,k] <- true
                    let s = S.[i]
                    if j + 1 <= 3 && k * 10 + s <= 999 then
                        dp.[i+1,j+1,k*10+s] <- true

    seq { for i in 0 .. 999 -> dp.[N,3,i] }
    |> Seq.filter ((=) true)
    |> Seq.length
    |> printfn "%i"

    0

Measured memory_bytes: 130652
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n, k;
int a[1010];

int main()
{
	scanf("%d%d", &n, &k);
	
	for (int i = 0 ; i < n ; i++)
		scanf("%d", &(a[i]));
		
	sort(a, a + n);
	int sum = 0;
	for (int i = 0 ; i < k ; i++)
		sum = sum + a[i];
	printf("%d\n", sum);
		
	return 0;
}


Measured memory_bytes: 1740
# 約分して、互いに素な(1,3) (3,1)のようなペアを作りカウントする
# 正のグループと負のグループを別々に管理
# 正のグループの相手が負のグループに存在した場合、
# どちらかのグループから好きなだけ選ぶか、どちらも選ばないかしかない
# 誰ともペアにならなかったグループの個数を全て足してP個だとして、2^P通りを掛ける
# (0,0)については、その中から1つ選ぶか、選ばないかしかない

import sys
readline = sys.stdin.readline

N = int(readline())
import math

zeropair = 0
zeroa = 0
zerob = 0
from collections import defaultdict
pluspair = defaultdict(int)
minuspair = defaultdict(int)
for i in range(N):
  a,b = map(int,readline().split())
  if a == 0 and b == 0:
    zeropair += 1
    continue
  if a == 0:
    zeroa += 1
    continue
  if b == 0:
    zerob += 1
    continue
  absa = abs(a)
  absb = abs(b)
  g = math.gcd(absa,absb)
  absa,absb = absa//g,absb//g
  if a * b > 0:
    pluspair[(absa,absb)] += 1
  else:
    minuspair[(absa,absb)] += 1

DIV = 1000000007
ans = 1
# zeroa,zerobから選ぶパターンは、どちらから好きなだけ選ぶか、どちらも選ばないか
ans *= (pow(2,zeroa,DIV) + pow(2,zerob,DIV) - 1) % DIV
ans %= DIV

# 誰とでもペアになれるものをカウント
allcnt = 0

# plusから選ぶパターンで、minusにある対応ペアを探す
for item in pluspair.items():
  a,b = item[0]
  cnt = item[1]
  if (b,a) in minuspair:
    ans *= (pow(2,cnt,DIV) + pow(2,minuspair[(b,a)]) - 1) % DIV
    ans %= DIV
    del minuspair[(b,a)]
  else:
    allcnt += cnt

for val in minuspair.values():
  allcnt += val

ans = (ans * pow(2,allcnt,DIV)) % DIV
# zeropairから選んだ場合、今までのパターンとは独立
ans += zeropair
print((ans - 1) % DIV)

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

int main()
{
    char B;
    cin >> B;
    if(B=='A') cout<<'T'<<endl;
    if(B=='C') cout<<'G'<<endl;
    if(B=='G') cout<<'C'<<endl;
    if(B=='T') cout<<'A'<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string str;
  map<string,vector<int> > dic;
  while((cin >> str)){
    int p;cin >> p;
    dic[str].push_back(p);
  }
  map<string,vector<int> >::iterator it = dic.begin();
  while( it != dic.end() ){
    cout << (*it).first << endl;
    sort((*it).second.begin(),(*it).second.end());
    cout << (*it).second[0];
    for(int i = 1;i < (*it).second.size();i++){
      cout << " " <<(*it).second[i];
    }
    cout << endl;
    ++it;
  }
  return 0;
}

Measured memory_bytes: 1244
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)    for(int i=0;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define w(t)          int t;cin>>t;while(t--)
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int k;
    string s;
    cin>>k>>s;
    for(int i=0;i<SZ(s);i++)
    {
        if(k>0)cout<<s[i];
        else {cout<<"...";break;}
        k--;
    }
    cout<<nl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc =  new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        sc.close();
        int mod = 1000000007;
        Map<Integer,Integer> map = prime_factor(m);
        MOD.COMinit(200000);

        long res=1;
        
        for(Integer count: map.values()){
            res*=MOD.nCkMod2(n-1+count, count);
            res%=mod;
        }
        System.out.println(res);

    }

    public static Map<Integer,Integer> prime_factor(int l){

        Map<Integer,Integer> map = new HashMap<>();

        int count;
        for(int i=2;i*i<=l;i++){
            if(l%i==0){
                count = 0;
                while(l%i==0){
                    count++;
                    l/=i;
                }
                map.put(i,count);
            }
        }
        if(l!=1)map.put(l,1);
        return map;
    }
}class MOD {
    static long[] fac,inv,finv;
    static int mod = 1000000007;

    public static long getPowMod(long a, long x,long mod){
        long res = 1;
        while(x > 0){
            if((x&1)==1){
                res = (res*a)%mod;
            }
            x>>=1;
            a = (a*a)%mod;
        }
        return res;
    }
    public static long getFactorialMod(long n,long mod){
        if(n==0){
            return 1;
        }else{
            return (n*getFactorialMod(n-1, mod))%mod;
        }
    }

    public static long nCkMod(long n,long k,long mod){
        if(n < k){
            return 0;
        }else{
            long nMod = getFactorialMod(n, mod);
            long kinvMod = getPowMod(getFactorialMod(k, mod), mod-2, mod);
            long n_kinvMod = getPowMod(getFactorialMod(n-k, mod), mod-2, mod);
            long x = (nMod*kinvMod)%mod;
            return (x*n_kinvMod)%mod;
        }
    }

    public static void COMinit(int max){
        fac = new long[max];
        inv = new long[max];
        finv = new long[max];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for(int i=2;i<max;i++){
            fac[i] = fac[i-1]*i%mod;
            inv[i] = mod-inv[mod%i]*(mod/i)%mod;
            finv[i] = finv[i-1]*inv[i]%mod;
        }
    }
    public static long nCkMod2(int n,int k){
        if(n < k)return 0;
        return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
    }
}


Measured memory_bytes: 26068
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

enum{N=100023};

struct Edge{ int nxt,to; } bow[N*2];
int head[N],tot_e;
il void add(int x,int y){
	tot_e++;
	bow[tot_e<<1]=(Edge){head[x],y};
	bow[tot_e<<1|1]=(Edge){head[y],x};
	head[y]=(head[x]=tot_e<<1)|1;
}

int fa[N];
int depth[N],mxd[N];
void dfs(int u){
	mxd[u]=depth[u];
	each(i,u){
		int v= bow[i].to;
		if( v==fa[u] ) continue;
		fa[v]= u;
		depth[v]= depth[u]+1;
		dfs(v);
		mxd[u]= max(mxd[u],mxd[v]);
	}
}

int main(){
	int n=ci(),t=ci(),s=ci();
	rep(i,1,n-1){
		int x=ci(), y=ci();
		add(x,y);
	}
	dfs(s);
//	rep(i,1,n) printf("%d ",fa[i]); pt('\n');
//	rep(i,1,n) printf("%d ",mxd[i]); pt('\n');
	int k= (depth[t]-1)/2;
//	printf("k %d dep %d\n",k,depth[t]);
	while( k-- ) t=fa[t];
//	printf("k_fa %d\n",t);
	printf("%d\n",mxd[t]-1);
	return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int d, n;
    cin >> d >> n;
    int ans = 0;
    if (d == 0)
    {
        if (n == 100)
            ans = 101;

        else
            ans = n;
    }
    else if (d == 1)
    {
        if (n == 100)
            ans = 101 * 100;
        else
            ans = 100 * n;
    }
    else
    {
        if (n == 100)
            ans = 100 * 100 * 101;

        else
            ans = 10000 * n;
    }
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main(){
    int n; cin >> n;
    vector<ll> dp(n),h(n);
    rep(i,n) cin >> h[i];
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    rep2(i,n-1){
        dp[i+1]=min(dp[i]+abs(h[i]-h[i+1]),dp[i-1]+abs(h[i-1]-h[i+1]));
    }
    cout << dp[n-1] << endl;
}

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

int N;
ll A[100000],T;

int main(){
	cin>>N;
	T=1;
	for(int i=0;i<N;i++){
		cin>>A[i];	
	}
	sort(A,A+N);
	if(A[0]==0){
		cout<<0<<endl;
		return 0;
	}
	for(int i=0;i<N;i++){
		if(2e18/A[i]<=T){
			puts("-1");
			return 0;
		}
		T*=A[i];
	}
	if(T>1000000000000000000)T=-1;
	cout<<T<<endl;
}


Measured memory_bytes: 4352
#include<stdio.h>

#define MAX_LENGTH 32

int main(void)
{
        char line[MAX_LENGTH];
        int data;
        int i = 0;




        while (i <= 10000) {
                fgets(line, sizeof(line), stdin);
                sscanf(line, "%d", &data);
                if (data == 0)
                        break;
                printf("Case %d: %d\n", ++i, data);

        }

        return 0;
}

Measured memory_bytes: 612
object Main {
  def main(args: Array[String]): Unit = {
    val in = new java.util.Scanner(System.in)
    val a = in.nextInt
    val b = in.nextInt
    if(a < b){
      println("a < b")
    }else if(a == b){
      println("a == b")
    }else{
      println("a > b")
    }
    
  }
}

Measured memory_bytes: 44968
import sys


def prepare(n, MOD):
    facts = [1]
    t = 1
    for i in range(1, n + 1):
        t = t * i % MOD
        facts.append(t)
    invs = [1] * (n + 1)
    invs[n] = t
    for i in range(n, 1, -1):
        t = t * i % MOD
        invs[i - 1] = t
    return facts, invs


MOD = 1000003
facts, factinvs = prepare(MOD - 1, MOD)

q = int(input())
ans = []
for line in sys.stdin:
    x, d, n = map(int, line.split())

    if x == 0:
        ans.append(0)
        continue
    if d == 0:
        ans.append(pow(x, n, MOD))
        continue

    invd = pow(d, MOD - 2, MOD)

    xd = x * invd % MOD
    limit = MOD - xd

    if n > limit:
        ans.append(0)
        continue

    r = xd + n - 1
    l = xd - 1
    dn = pow(d, n, MOD)
    ans.append(facts[r] * factinvs[l] * dn % MOD)

print('\n'.join(map(str, ans)))


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

int main() {
    string str, t, ans;
    cin >> str >> t;
    bool flag = false;
    for(int i = str.length() - t.length(); i >= 0; i--) {
        rep(j, t.length()) {
            if(str.at(i + j) != t.at(j) && str.at(i + j) != '?') break;
            if(j == t.length() - 1) flag = true;
        }
        if(flag) {
            rep(j, i) {
                if(str.at(j) == '?') ans += 'a';
                else ans += str.at(j);
            }
            ans += t;
            int temp = ans.length();
            rep(j, str.length() - temp) {
                if(str.at(j + temp) == '?') ans += 'a';
                else ans += str.at(j + temp);
            }
            break;
        }
    }
    if(flag) cout << ans << endl;
    else cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
def main():
    H, W = map(int, input().split())
    if H == 1 or W == 1:
        print(1)
        exit()
    ans = (H // 2) * (W // 2)
    yoko = W // 2 if W % 2 == 0 else W // 2 + 1
    tate = H // 2 if H % 2 == 0 else H // 2 + 1
    ans += tate * yoko
    print(ans)



if __name__ == "__main__":
    main()

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define inf 1000000100

int main()
{
    int n;
    ll k;
    cin >> n >> k;
    map<int, ll> mp;
    int ans = -1;
    while(n--)
    {
        int a, b;
        cin >> a >> b;
        mp[a] += b;
    }
    for(auto x: mp)
    {
        if (k - x.second <= 0)
        {
            ans = x.first;
            break;
        }
        k -= x.second;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4224
using System;

class Program
{
    static void Main(string[] args)
    {
        var nmxy = Console.ReadLine().Split(' ');
        var n = int.Parse(nmxy[0]);
        var m = int.Parse(nmxy[1]);
        var X = int.Parse(nmxy[2]);
        var Y = int.Parse(nmxy[3]);

        var s = Console.ReadLine().Split(' ');
        var max = int.MinValue;
        for (int i = 0; i < n; i++)
        {
            max = Math.Max(max, int.Parse(s[i]));
        }

        s = Console.ReadLine().Split(' ');
        var min = int.MaxValue;
        for (int i = 0; i < m; i++)
        {
            min = Math.Min(min, int.Parse(s[i]));
        }

        if (X < Y && X < min && max < Y && max < min)
        {
            Console.WriteLine("No War");
        }
        else
        {
            Console.WriteLine("War");
        }
    }
}


Measured memory_bytes: 13140
k, n = map(int, input().split())
a = list(map(int, input().split()))
# amax=max(a)
# amin=min(a)

# amin-amax

# 2の場合
if n ==2:
    f=a[0]-a[1]
    if f > k//2:
        ans =k-f
    else:
        ans=f
else:
    a.sort
    a.append(a[0]+k)

    # print(range(len(a[:-1])))
    f=0
    for i in range(len(a[:-1])):
        if (a[i+1] - a[i]) > f:
            f=a[i+1] - a[i]

    ans = k-f
    # if f > k//2:
    #     ans = k -f
    # else:
    #     ans=f

print(ans)

Measured memory_bytes: 77516
import sys

def parse(inp):
    a,b=map(int,next(inp).split())
    return a,b
  
def main(inp):
    N,K=parse(inp)
#     print(int(N/2))
    
    if(N >= 2*K-1):
        return """YES
"""
    else: return """NO
"""
    
print(main(sys.stdin))

Measured memory_bytes: 2940
/* 
    HARSHAD VAGHASIYA

        @DAIICT
    
          H_M_Vaghasiya
    
  */
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAX_INT 100000
#define ld long double
int main()
{
   ll n,i,j,d,x,y;
   cin>>n;
   ld sum=0,k;
   for(i=0;i<n;i++){
       cin>>k;
       sum+=(1/k);
       }
       ld kk=(1/sum);
       if(floor(kk)==kk)
       cout<<(1/sum)<<endl;
       else {
           cout<<setprecision(15)<<(1/sum)<<endl;
       }
    return 0;
}

Measured memory_bytes: 256