akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

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;
}

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

const int N = 105;
int a[N * N];
int b[N][N];
void solve(){
	int h, w, n;
	cin >> h >> w >> n;
	fr(i, 1, n){
		cin >> a[i];
	}
	int x = 1, y = 1;
	bool bb = 0;
	fr(i, 1, n){
		while(a[i]--){
			b[x][y] = i;
			if(!bb)
				y++;
			else
				y--;
			if(y > w){
				y = w;
				x++;
				bb = 1;
			}
			if(y < 1){
				y = 1;
				x++;
				bb = 0;
			}
		}
	}
	fr(i, 1, h){
		fr(j, 1, w){
			cout << b[i][j] << " ";
		}
		cout << endl;
	}
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

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

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

    if (a > 12){
        cout << b << endl;
    }
    else if (a > 5){
        cout << b / 2 << endl;
    }
    else{
        cout << "0" << endl;
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int n,k;
int p2[maxn];
int a[maxn], b[maxn];
main() {
    int i,pos,bit;
    long long sum,ans;
    scanf("%d%d",&n,&k);
    for(i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
    p2[0] = 1;
    for(i=1;i<=30;i++) p2[i] = p2[i-1]*2;
    ans = 0;
    for(pos=0;pos<30;pos++) {
        if(k&p2[pos]) {
            bit = (k-p2[pos])|(p2[pos]-1);
            sum = 0;
            for(i=1;i<=n;i++) if((bit&a[i])==a[i]) sum += b[i];
            ans = max(ans,sum);
        }
    }
    sum = 0;
    for(i=1;i<=n;i++) if((k&a[i])==a[i]) sum += b[i];
    ans = max(ans,sum);
    printf("%lld",ans);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// rep(i, 1, 5) --> {1,2,3,4}
// rep(i, 5, 1) --> {4,3,2,1}
// rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    ll n, w;
    cin >> n >> w;
    vector<ll> W(n+1);
    vector<ll> V(n+1);
    rep(i, 1, n+1)
        cin >> W[i] >> V[i];
    vector<vector<ll>> dp(n+1, vector<ll>(w+1,0)); // A ajouter fel tips
    rep(i, 1, n+1)
    {
        rep(j, 1, w+1)
        {
            if (W[i] > j)
                dp[i][j] = dp[i-1][j];
            else 
                dp[i][j] = max(dp[i-1][j], V[i]+dp[i-1][j-W[i]]);
        }
    }
    cout << dp[n][w];
    return 0;
}

Measured memory_bytes: 80256
import java.util.Scanner;

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

		int ans = 0;

		for (int i=1; i<=n; i++) {
			if (kisuKeta(i)) ans++;
		}
		System.out.println(ans);
	}

	private static boolean kisuKeta(int i)
	{
		if (i <10) return true;
		if (i < 100) return false;
		if (i < 1000) return true;
		if (i < 10000) return false;
		if (i < 100000) return true;
		return false;
	}
}


Measured memory_bytes: 21844
n, x = map(int, input().split())
x -= 1


def main(n, x):
    if n == 0:
        if x >= 0:
            return 1
        else:
            return 0
    if x == 0:
        return 0
    if x == 2 ** (n + 1) - 2:
        return 2 ** n
    if x < 2 ** (n + 1) - 2:
        return main(n - 1, x - 1)
    return 2 ** n + main(n - 1, x - (2 ** (n + 1) - 1))


print(main(n, x))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main()
{
 int aj,am,as,ae;
 int bj,bm,bs,be;
 int s=0,t=0;

 cin >> aj >> am >> as >> ae;
 cin >> bj >> bm >> bs >> be;

 s = aj+am+as+ae;
 t = bj+bm+bs+be;

 if(s>=t){
    cout << s << endl;
 }
 else if(t>s)
    cout << t << endl;

return 0;
}

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

using namespace std;
int a[110000];
int main() {
	int n;
	cin >> n;
	for(int i = 0;i < n; i ++){
		cin >> a[i];
	}
	int gcd = a[0];
	for(int i = 1;i < n; i++){
		gcd = __gcd(gcd, a[i]);
		if(gcd == 1) break;
	}
	cout << gcd << endl;
	return 0;
}

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

int main() {
	int a,b,ans;
	cin >> a >> b;
	ans = 0;
	for(int i = 0; i < 2; i++){
		if(a > b){
			ans += a;
			a--;
		}
		else{
			ans += b;
			b--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt(),k=s.nextInt();
		long[]a=new long[n+1];
		for(int i=1;i<=n;++i)
			a[i]=s.nextInt();
		Arrays.parallelPrefix(a,Long::sum);
		HashMap<Long,Long>m=new HashMap<>();
		for(long i:a)
			m.merge(i%k,1L,Long::sum);
		System.out.println(
				m.values().stream()
				.mapToLong(i->i*(i-1)/2)
				.sum()
				);
	}
}

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

int main() {
	string s;
	cin >> s;

	string mae;
	string ato;

	mae = s.substr(0,2);
	ato = s.substr(2,2);
  
	int num1 = stoi(mae);
	int num2 = stoi(ato);

	if ( 1 <= num1 && num1 <= 12 && 1 <= num2 && num2 <= 12 )
	{
		cout << "AMBIGUOUS" << endl;
	}
	else if ( 1 <= num1 && num1 <= 12 && 0 <= num2 && num2 <= 99 )
	{
		cout << "MMYY" << endl;
	}
	else if ( 0 <= num1 && num1 <= 99 && 1 <= num2 && num2 <= 12 )
	{
		cout << "YYMM" << endl;
	}
	else {
		cout << "NA" << endl;
	}

	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 rep1(i, N) for (int i = 1; i <= N; i++)
const int intinf = numeric_limits<int>::max();

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define MOD 1000000007

void solve()
{
    int N, M;
    cin >> N >> M;
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
}

void solveB()
{
    string S;
    cin >> S;
    int N = S.length();
    string S0 = S;
    reverse(S0.begin(), S0.end());
    string S1 = S.substr(0, (N - 1) / 2);
    reverse(S1.begin(), S1.end());
    string S2 = S.substr((N - 1) / 2 + 1, (N - 1) / 2);
    reverse(S2.begin(), S2.end());
    if (S != S0 or S.substr(0, (N - 1) / 2) != S1 or S.substr((N - 1) / 2 + 1, (N - 1) / 2) != S2)
    {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl
 
#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
 
#define INF 1000000000000000000

ll n;
ld p[3000];
ld dp[3000][3000];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cout << fixed;
    cout << setprecision(10);
    
    dp[0][0] = 1;

    cin >> n;
    fr(i,1,n)
    {
        cin >> p[i];
    }

    dp[1][1] = p[1];
    dp[1][0] = 1-p[1];

    fr(i,2,n)
    {
        fr(j,0,i)
        {
            if(j==0)
                dp[i][j] = dp[i-1][j]*(1-p[i]);
            else
                dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]);
        }
    }

    ll x = n/2;
    x++;
    ld ans = 0;

    fr(i,x,n)
    {
        ans = ans + dp[n][i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 68992
// ~/Remember,remember the 6th of March
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include<complex>
#include <unordered_map>
#include<unordered_set>
#include <numeric>
#include <string>
#include<iostream>
#include <fstream>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include<cmath>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-9;
const ll MOD = 100000000;
const int N = 2e6 + 10;
void fast()
{
	std::ios_base::sync_with_stdio(0);
}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt","w",stdout);
#endif*/
	ll n;
	cin >> n;
	vector<ll>arr(5);
	for (ll &i : arr)cin >> i;
	ll v = *min_element(arr.begin(), arr.end());
	cout << (n + v - 1) / v + 4;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
const ll MOD=1e+7;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int main(){
    ll l,n;cin>>l>>n;
    vector<ll> x(n+10),s1(n+10),s2(n+10);
    for(int i=1;i<=n;i++)cin>>x[i];
    if(n==1){
        cout<<max(x[1],l-x[1])<<endl;
        return 0;
    }
    for(int i=1;i<=n;i++)s1[i]=s1[i-1]+x[i];
    for(int i=n;i>=0;i--)s2[i]=s2[i+1]+(l-x[i]);
    ll ans=0;
    for(int k=1;k<n;k++){
        ll s;
        int a=k+(n-k)/2+1;
        int b=a-1;
        s=x[k];
        if(k<n-1)s+=x[k]+2LL*(s1[b-1]-s1[k]+s2[a+1]);
        if((n-k)%2){
            s+=(k<n-1?x[b]:0LL)+max(abs(x[b]-x[a]),l-abs(x[b]-x[a]));
        }else{
            s+=(k<n-1?l-x[a]:0LL)+max(abs(x[b]-x[a]),l-abs(x[b]-x[a]));
        }
        ans=max(ans,s);
        s=l-x[n-k+1];
        if(k<n-1)s+=l-x[n-k+1]+2LL*(s1[n-a]+s2[n-b+2]-s2[n-k+1]);
        if((n-k)%2){
            s+=(k<n-1?l-x[n-b+1]:0LL)+max(abs(x[n-b+1]-x[n-a+1]),l-abs(x[n-b+1]-x[n-a+1]));
        }else{
            s+=(k<n-1?x[n-a+1]:0LL)+max(abs(x[n-b+1]-x[n-a+1]),l-abs(x[n-b+1]-x[n-a+1]));
        }    
        ans=max(ans,s);
    }
    cout<<ans<<endl;
}   


Measured memory_bytes: 4992
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    Block[] blocks = new Block[N];
    for (int i = 0; i < N; i++) {
      blocks[i] = new Block(scanner.nextInt(), scanner.nextInt(), scanner.nextInt());
    }

    Arrays.sort(blocks, (b1, b2) -> b2.s + b2.w - b1.s - b1.w);

    final int MAX_S = 20_000;
    long[][] dp = new long[N + 1][MAX_S + 1];
    for (int i = 1; i <= N; i++) {
      Block b = blocks[i - 1];
      for (int j = 0; j <= MAX_S; j++) {
        if (j + b.w <= MAX_S && j <= b.s) {
          dp[i][j] = Math.max(dp[i - 1][j + b.w] + b.v, dp[i - 1][j]);
        } else {
          dp[i][j] = dp[i - 1][j];
        }
      }
    }

    long max = 0;
    for (int i = 0; i <= MAX_S; i++) {
      max = Math.max(max, dp[N][i]);
    }
    System.out.println(max);
  }

  private static class Block {
    public final int w;
    public final int s;
    public final int v;

    private Block(int w, int s, int v) {
      this.w = w;
      this.s = s;
      this.v = v;
    }
  }
}


Measured memory_bytes: 251952
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
// using namespace boost::multiprecision;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define ers erase
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

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; }

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;

void Main() {
    string N;
    cin >> N;

    ll n = 0;
    rep (i, N.size()) {
        ll r = (N[i]-'0')%9;
        n += r;
    }

    string ans = n%9 == 0 ? "Yes" : "No";

    cout << ans << endl;
}

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


Measured memory_bytes: 3696
N = int(input())
H = list(map(int, input().split()))
judge = False
for i in range(1, len(H)):
  if H[i] - H[i-1] >= 1:
    H[i] -= 1
  elif H[i] - H[i-1] < 0:
    judge = True
    break
print('No' if judge else 'Yes')

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

main(){
  pair<int, pair<int, int> > y1, y2;
  cin >> y1.first >> y1.second.first >> y1.second.second;
  cin >> y2.first >> y2.second.first >> y2.second.second;

  if ( y1 > y2 ) swap(y1, y2);
  cout <<  y2.first - y1.first + (y1.second < y2.second ? 1 : 0) << endl;
}



Measured memory_bytes: 3124
s = input()

test = 0
check = 0

if s[0]=='A':
	for i in range(2,len(s)-1):
		if s[i]=='C':
			test = test + 1
			
	if test == 1:
		for j in range(len(s)):
			if s[j]=='A':
				pass
			elif s[j]=='C':
				pass
			elif s[j].isupper():
				pass
			else:
				check = check +1
			
		if check == len(s)-2:	
			print('AC')
		else:
			print('WA')
		
	else:
		print('WA')

else:
	print('WA')


Measured memory_bytes: 3064
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
//#include <unordered_map>

#define fast_read ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef unsigned long long ULL;

const int N = 203, INF = 0x3f3f3f3f, MOD1 = 1e9 + 7, MOD2 = 998244353;

int n, a[N];

bool cmp(int a, int b) {
    return a > b;
}

void solve() {
    cin >> n;
    for(int i = 0; i < n; i++)  cin >> a[i];
    sort(a, a + n);
    int ans = 0;
    for(int i = 0; i < n; i++)
        for(int j = i + 1; j < n; j++)
            for(int k = j + 1; k < n; k++)
                if(a[i] != a[j] && a[j] != a[k] && a[i] + a[j] > a[k])  ans++;
    cout << ans;
}

int main() {
    fast_read

    solve();

    return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int dp[200005];
int main()
{
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
    cin>>a[i];
    int i,j,k;
    dp[1]=0;
    dp[2]=abs(a[2]-a[1]);
    for(i=3;i<=n;i++)
    {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n];
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int RSOne(int k) {
	return k&(-k);
}

class Fenwick {
public:
	int N;
	Fenwick(int M) {
		N = M;
		V.resize(N + 1);
	}
	vector<long long int> V;

	long long int query(int k) {
		long long int ret=0;
		while (k > 0) {
			ret = max(ret, V[k]);
			k -= RSOne(k);
		}
		return ret;
	}

    void  update(int j, long long int val) {
		while (j<=N) {
			V[j] = max(V[j], val);
			j += RSOne(j);
	   }
	}

};

int h[200006];
long long int a[200006];

int main(void) {

	int N;

	cin >> N;

	Fenwick FT(N);

	for (int i = 1; i <= N; i++) {
		cin >> h[i];
	}

	for (int i = 1; i <= N; i++) {
		cin >> a[i];
	}

	//FT.update(1, h[1]);

	for (int i = 1; i <= N; i++) {
		long long int tmp;
		tmp = FT.query(h[i] - 1);// cout << "tmp= " << tmp << endl;
		FT.update(h[i], tmp + a[i]);
	}

	cout << FT.query(N) << endl;


	//system("pause");
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
lli mod = 1000000007;

unsigned long long power(unsigned long long x,
                         int y, int p)
{
    unsigned long long res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while (y > 0) {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
unsigned long long modInverse(unsigned long long n, int p)
{
    return power(n, p - 2, p);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    lli n;
    cin>>n;
    lli x;
    lli sum = 0;
    lli sos = 0;
    for (int i=0;i<n;i++)
    {
        cin>>x;
        sum = (sum + x)%mod;
        sos = (sos + (x*x))%mod;
    }

    lli y = (sum * sum)%mod;
    lli ans = (((y - sos + mod)%mod) * modInverse(2, mod))%mod;
    cout<<ans<<"\n";
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <set>
using namespace std;
int dp[400010] = {};
set<int> st;
int main(){
    int i,n,k,c;
    string s;
    cin >> n >> k >> c >> s;
    for(i=n - 1;i>=0;i--){
        if(s[i]=='o'){
            dp[i] = dp[i + c + 1] + 1;
        }else{
            dp[i] = dp[i + 1];
        }
    }
    int p = 0,cnt = 0;
    for(i=0;i<n;i++){
        if(p==0 && s[i]=='o'){
            cnt++;
            p = c;
            st.insert(i);
        }else{
            if(p) p--;
        }
    }
    for(i=0;i<n;i++){
        if(st.count(i)!=0){
            if(cnt - dp[i] + dp[i + 1]<k){
                cout << i + 1<< endl;
            }
        }
    }
}

Measured memory_bytes: 11908
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<int64_t> r(a),g(b),m(c);
    rep(i,a){
        cin>>r[i];
    }
    rep(i,b){
        cin>>g[i];
    }
    rep(i,c){
        cin>>m[i];
    }
    all(r);
    all(g);
    all(m);
    Re(r);
    Re(g);
    int64_t sum=0;
    priority_queue<int> pq;
    //最大値を素早く取り出せる
    rep(i,x){
        pq.push(r[i]);
    }
    rep(i,y){
        pq.push(g[i]);
    }
    rep(i,c){
        pq.push(m[i]);
    }

    rep(i,x+y){
        sum += pq.top();
        //先頭の値にアクセス
        pq.pop();
        //先頭の値を削除
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 4724
// lcm、__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define ll long long
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll i,j,k,l,m,n,maxi=0,f=0,mini=1e10,sum=0;
    string str;
    cin>>n>>m;
    sum=n;
    if(m==1){
        cout<<0;
        return 0;
    }
    rep(i,1e10){
        if(sum>=m){
            cout<<i+1<<endl;
            return 0;
        }
        sum+=n-1;
    }

    return 0;
}

Measured memory_bytes: 256
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut ans = false;
    let n: usize = read();
    let mut map_a = HashMap::new();
    for _ in 0..n {
        let count = map_a.entry(read::<usize>()).or_insert(0);
        *count += 1;
    }

    if map_a.len() == 1 {
        if let Some(_x) = map_a.get(&0) {
            ans = true;
        }
    } else if map_a.len() == 2 {
        let mut values: Vec<usize> = map_a.values().map(|i| *i).collect();
        values.sort();
        if *map_a.get(&0).unwrap() == n / 3 && values[1] == (n / 3) * 2 {
            ans = true;
        }
    } else if map_a.len() == 3 {
        let values: Vec<usize> = map_a.values().map(|i| *i).collect();
        let keys: Vec<usize> = map_a.keys().map(|i| *i).collect();
        if values[0] == n / 3 && values[1] == n / 3 && values[2] == n / 3 {
            if keys[0] ^ keys[1] ^ keys[2] == 0 {
                ans = true;
            }
        }
    }

    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 5496
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
int r;
int main(){
	scanf("%d",&r);
	if(r < 1200) puts("ABC");
	else if(r < 2800) puts("ARC");
	else puts("AGC");
	return 0;
}


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

using namespace std;

int main()
{
	int N;
	cin >> N;
	auto cards = make_unique<int[]>(N+1);
	for (int i = 0; i < N; i++) {
		cin >> cards[i];
	}

	auto printCards = [&]() {
		cout << cards[0];
		for (int i = 1; i < N; i++) {
			cout << " " << cards[i];
		}
		cout << endl;
	};

	printCards();

	for (int i = 1; i < N; i++) {
		int v = cards[i];
		int j = i - 1;

		while (j >= 0 && cards[j] > v) {
			cards[j + 1] = cards[j];
			j--;
		}

		cards[j + 1] = v;

		printCards();
	}

	return 0;
}


Measured memory_bytes: 3116
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
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> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	vector<ll> v(3);

	REP(i, 3) {
		cin >> v[i];
	}

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

	ll ans = 0;

	ans += v[1] - v[0];
	ans += v[2] - v[1];

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define vvl vector<vector<ll>>
#define vl  vector<ll>
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
int n;
ll ans;

signed main(){
	acc_io;
	cin>>n;
	ans=0;
	cout<<(n+1)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    n = inp()
    a = inpl()
    a.sort()
    for i in range(n-1):
        if a[i]==a[i+1]:
            print('NO')
            return
    print('YES')
    
if __name__ == "__main__":
    main()

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

using namespace std;

int main() {
	cin.sync_with_stdio(false);
	
	int N, M;
	cin >> N >> M;
	char A[50][50],B[50][50];
	for (int i = 0;i < N;i++) {
		for (int j = 0;j < N;j++) {
			cin >> A[i][j];
		}
	}
	for (int i = 0;i < M;i++) {
		for (int j = 0;j < M;j++) {
			cin >> B[i][j];
		}
	}
	int flag;
	for (int i = 0;i <= N - M;i++) {
		for (int j = 0;j <= N - M;j++) {
			flag = true;
			for (int k = 0;k < M;k++) {
				for (int l = 0;l < M;l++) {
					if (A[i + k][j + l] != B[k][l]) {
						flag = false;
						break;
					}
				}
				if (!flag) {
					break;
				}
			}
			if (flag) {
				cout << "Yes" << endl;
				break;
			}
		}
		if (flag) {
			break;
		}
	}
	if (!flag) {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a, b;
	while(scanf("%d %d", &a, &b) != -1){
		if(a+b < 10){
			printf("1\n");
		} else if(a+b < 100){
			printf("2\n");
		} else if(a+b < 1000){
			printf("3\n");
		} else if(a+b < 10000){
			printf("4\n");
		} else if(a+b < 100000){
			printf("5\n");
		} else if(a+b < 1000000){
			printf("6\n");
		} else if(a+b < 10000000){
			printf("7\n");
		}
	}
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <queue>
#include <vector>
#include <string>

using namespace std;

#define HERE (cerr << "LINE: " << __LINE__ << " " << __FUNCTION__ << endl)

#define DBG(x) cerr << #x << ": " << x << endl

constexpr int64_t M = 1000000007;

int64_t perm(int n,int k) {
  if (k < 0 || k > n)
    return 0;
  
  int64_t o = 1;
  for (int i=0; i<k; i++)
    o = o * (n-i) % M;

  return o;
}

int main() {
  int n, k;
  cin >> n >> k;

  vector<vector<int>> adjs(n);

  for (int i=0; i<n-1; i++) {
    int a, b;
    cin >> a >> b;
    a --;
    b --;
    adjs[a].push_back(b);
    adjs[b].push_back(a);
  }
    
  int root = 0;
  int64_t cnt = perm(k, adjs[root].size() + 1) % M;
  DBG(cnt);

  queue<int> que;
  vector<bool> visited(n);
  visited[root] = true;
  for (const auto& u : adjs[root])
    que.push(u);

  while (!que.empty()) {
    auto u = que.front();
    que.pop();
    if (visited[u])
      continue;
    visited[u] = true;

    cnt = cnt * perm(k-2, adjs[u].size() - 1) % M;
    for (const auto& v : adjs[u])
      if (!visited[v])
	que.push(v);
  }

  cout << cnt << endl;
    
}


Measured memory_bytes: 6520
S = input()
for i in range(len(S)):
    if i % 2 == 1 and S[i] in ["L", "U", "D"]:
        continue
    elif i % 2 == 0 and S[i] in ["R", "U", "D"]:
        continue
    else:
        print('No')
        exit()
print('Yes') 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define rrep(i, a, b) for(int i=(a); i>=(b); i--)
typedef long long ll;
const ll mod = 1000000007;

const int MAX = 2100000;
ll fac[MAX], finv[MAX], inv[MAX];

void cominit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll i=2; i<MAX; i++) {
    fac[i] = fac[i-1] * i % mod;
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}

ll com(ll n, ll k)
{
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main()
{
  ll r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  cominit();
  ll ans = 0;
  ans += com(r2+c2+2, c2+1);
  ans -= com(r1+c2+1, r1);
  ans -= com(r2+c1+1, r2+1);
  ans += com(r1+c1, r1);
  ans = (ans + mod) % mod;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 49536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum[200000];
ll getval(int l,int r)
{
	if(l==0)
		return sum[r];
	return (sum[r]-sum[l-1]);
}
int check(int l,int r,int mid,ll &a,ll &b)
{
	ll ck[4];
	a=ck[0]=getval(l,mid);
	b=ck[1]=getval(mid+1,r);
	if(ck[0]==ck[1])//相等已经最优 	
		return 0;	
	else if(ck[0]>ck[1])//大于，要求mid向前移动 	
		return -1;
	if((mid+2)>r)
	{//mid已经移动到倒数第二个 
		if(ck[0]<ck[1])//还小，说明前面总和小于最后一个			
			return 0;		
		return -1;//mid前移 
	}
	ck[2]=getval(l,mid+1);
	ck[3]=getval(mid+2,r);
	if(ck[2]==ck[3])
	{//相等已经最优 
		a=ck[2];
		b=ck[3];
		return 0;	
	}		
	if(ck[2]<ck[3])// //mid后移 
		return 1;		
	if((ck[1]-ck[0])>=(ck[2]-ck[3]))	//下面说明由小转大，判别哪个差值小 
	{
		a=ck[2];
		b=ck[3];
	}
	return 0;
}
void find(int l,int r,ll &a,ll &b)
{
	int x=l,y=r;
	int mid,ret;
	while(x<y)
	{
		mid=(x+y)/2;
		ret=check(l,r,mid,a,b);
		if(ret==0)	
			return;		
		else if(ret==1)		
			x=mid;
		else
			y=mid;
	}
	a=getval(l,l);
	b=getval(l+1,r);
}
int main(void)
{
	int n;
	ll tt=0;
	ll res=1e15;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int tmp;
		cin>>tmp;
		tt+=tmp;
		sum[i]=tt;
	}
	for(int i=2;i<n-1;i++)
	{
		ll  a[4];
		find(0,i-1,a[0],a[1]);
		find(i,n-1,a[2],a[3]);					
		sort(a,a+4);
		res=min(res,a[3]-a[0]);
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  string S,T;
  cin >> S >> T;
  vector<string>A;
  if(S.size() >= T.size()){
  for(int i=0; i <= S.size()-T.size(); i++){
    string ss = S.substr(i, T.size());
    bool b = true;
    for(int j=0; j < T.size(); j++){
      if(ss[j] == '?')
	continue;
      if(ss[j] != T[j]){
	b = false;
	break;
      }
    }
  
  string SS = S;
    if(b){
      for(int k=0; k < S.size(); k++){
	if(k >= i && k < i+T.size())
	  SS[k] = T[k-i];
	else if(SS[k] == '?')
	  SS[k] = 'a';
      }
      A.push_back(SS);
    }
  }
  if(A.size() > 0){
    sort(A.begin(), A.end());
    cout << A[0] << endl;
  }else{
    cout << "UNRESTORABLE" << endl;
  }
  }else{
    cout << "UNRESTORABLE" << endl;

  }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e3 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int h, w;
ll k, ans, connect, blockcnt, rconnect, ANS, CONNECT, BLOCKCNT, RCONNECT;
char s[maxn][maxn], fixed_s[maxn][maxn];

ll powmod(ll a, ll b)
{
	if (b == 1)
		return a;
	ll tmp = powmod(a, b / 2);
	tmp = tmp * tmp % mod;
	if (b & 1)
		tmp = tmp * a % mod;
	return tmp;
}

void handle()
{
	ans = (ans * BLOCKCNT % mod - CONNECT * rconnect % mod + mod) % mod;
	connect = (connect * BLOCKCNT % mod + CONNECT * rconnect % mod) % mod;
	blockcnt = blockcnt * BLOCKCNT % mod;
	rconnect = rconnect * RCONNECT % mod;
}

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

	cin >> h >> w >> k;
	for (int i = 0; i < h; i++)
		cin >> s[i];

	ll cnt = 0;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			cnt += (s[i][j] == '#');
	
	bool hConnect = false, vConnect = false;
	for (int i = 0; i < h; i++)
		hConnect |= (s[i][0] == '#' && s[i][w - 1] == '#');
	for (int i = 0; i < w; i++)
		vConnect |= (s[0][i] == '#' && s[h - 1][i] == '#');
	if (hConnect && vConnect)
		cout << 1 << endl;
	else if (!hConnect && !vConnect)
	{
		if (k < 2)
			cout << 1 << endl;
		else
			cout << powmod(cnt, k - 1) << endl;
	}
	else
	{
		if (k <= 1)
		{
			cout << 1 << endl;
			return 0;
		}
		if (vConnect)
		{
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					fixed_s[j][i] = s[i][j];
			swap(h, w);
		}
		else
			swap(s, fixed_s);

		ANS = ans = 1;
		BLOCKCNT = blockcnt = cnt;
		for (int i = 0; i < h; i++)
			for (int j = 0; j < w - 1; j++)
				CONNECT += (fixed_s[i][j] == '#' && fixed_s[i][j + 1] == '#');
		connect = CONNECT;
		for (int i = 0; i < h; i++)
			RCONNECT += (fixed_s[i][0] == '#' && fixed_s[i][w - 1] == '#');
		rconnect = RCONNECT;

		ans = BLOCKCNT - CONNECT;
		k -= 2;
		
		for (int bit = 0; bit < 63; bit++)
		{
			if ((k >> bit) & 1)
				handle();
			CONNECT = (CONNECT * BLOCKCNT % mod + CONNECT * RCONNECT % mod) % mod;
			BLOCKCNT = BLOCKCNT * BLOCKCNT % mod;
			RCONNECT = RCONNECT * RCONNECT % mod;
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

const int inf = numeric_limits<int>::max(),
          MAX = 1e6,
          MOD = 1e9 + 7;


int32_t main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    int n, w; cin >> n >> w;
    vector<int> weights(n), values(n);

    for (int i = 0; i < n; ++i)
        cin >> weights[i] >> values[i];

    vector<vector<int>> dp(n + 1, vector<int>(w + 1, 0));

    for (int i = 1; i <= n; ++i)
        for (int j = 0; j <= w; ++j)
            if (j - weights[i - 1] >= 0)
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - weights[i - 1]] + values[i - 1]);
            else
                dp[i][j] = dp[i - 1][j];

    cout << dp[n][w] << "\n";
    return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
#define Sort(v) sort((v).begin(), (v).end())
using veci = vector<int>;
using vecs = vector<string>;
using vecd = vector<double>;
using vecl = vector<long long>;
using G = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
ll lINF = LLONG_MAX; ll lmINF = LLONG_MIN;
int INF = INT_MAX; int mINF = INT_MIN;
int main(){
    int n;
    cin >> n;
    while(n>0){
        n = n - 1000;
    }
    n = n*(-1);
    cout << n << endl;
}

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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	string a,b,c;
	cin >> a >> b >> c;
	if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}


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

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

long long MOD = 1000000000 + 7;
template<typename T>
map<T, ll> prime_factorize(T x){
  map<T, ll> res;
  while(x%2==0){
    x/=2;
    res[2]++;
  }
  for(ll i=3;i*i<=x;i+=2){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

int main(){
  cout << setprecision(10);
  ll X;
  cin >> X;
  
  ll A,B;
  ll ans_a;
  bool minus_flg = false;
  for(B = -200; B <= 200; B++){
    A = X + B*B*B*B*B;
    ans_a = 1;
    // cerr << "A: " << A << " B: " << B  << endl;

    if(A < 0){
      minus_flg = true;
      A = -A;
    } else {
      minus_flg = false;
    }

    if(A == 0){
      ans_a = 0;
      break;
    } else if(A==1){
      ans_a = 1;
      break;
    } else { 
      // Aが5乗数かどうか判定する
      auto a = prime_factorize(A);
      bool flg = true;
      for(auto x: a){
        if(x.second % 5 != 0){
          flg = false;
          break;
        } else { 
          ll tmp = x.second / 5;
          ans_a *= pow(x.first, tmp);
        }
      }

      if(flg){
        break;
      } 
    }
  }

  if(minus_flg){
    ans_a = -ans_a;
  }
  cout << ans_a << " " << B << endl;
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var x = a[0];
            var y = a[0];
            long z = (0);
            foreach(var i in Enumerable.Range(0,n-1))
            {
                if(x>a[i+1])
                {
                    x = a[i + 1];
                }
            }
            foreach(var i in Enumerable.Range(0,n-1))
            {
                if (y < a[i + 1])
                {
                    y = a[i + 1];
                }
            }
            foreach(var i in Enumerable.Range(0,n))
            {
                z = z + a[i];
            }
            Console.WriteLine("{0} {1} {2}",x,y,z);
        }
    }
}

Measured memory_bytes: 10392
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long hxtype;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=10005,inf=1000000000;
int dp[N];
int main(){
	int h,n,a,b,i,ans=inf;
	scanf("%d%d",&h,&n);
	REP(i,1,h)dp[i]=inf;
	while(n--){
		scanf("%d%d",&a,&b);
		REP(i,      a   ,h)cmin(dp[i],dp[i-a]+b);
		REP(i,max(h-a,0),h)cmin(ans  ,dp[i  ]+b);
//		REP(i, 0 ,h)printf("%d ",dp[i]);printf("ans=%d\n",ans);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC141
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = CIN.String();
            for (int i = 0; i < S.Length; i++)
            {
                if (i % 2 == 1 && S[i] == 'R')
                {
                    Console.WriteLine("No");
                    return;
                }

                if (i % 2 == 0 && S[i] == 'L')
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }
    }

    internal static class CIN
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int GCD = 0;
long total = 0;
int main(){
  int k;
  cin >> k;
  for(int a=0;a<k;a++){
    for(int b=0;b<k;b++){
      for(int c=0;c<k;c++){
        total += gcd(gcd(a+1,b+1),c+1);
      }
    }
  }
  cout << total;
}


Measured memory_bytes: 3632
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
    s=input()
    if s=="AC":
        ac+=1
    elif s=="WA":
        wa+=1
    elif s=="TLE":
        tle+=1
    else:
        re+=1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

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

using namespace std;
long long v[100002];
int main()
{
    int n;
    long long prod=1;
    bool ver=false;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>v[i];
        if(v[i]==0){
            ver=true;
        }
    }
    if(ver==true){
        cout<<"0";
        return 0;
    }
    for(int i=0;i<n;i++){
        if(1000000000000000000/v[i]<prod){
            cout<<"-1";
            return 0;
        }
        prod*=v[i];
    }
    cout<<prod;
    return 0;
}


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

int main(){
  char a, b, c;
  cin >> a >> b >> c;
  
  int price = 700;
  
  if(a =='o') price += 100;
  if(b =='o') price += 100;
  if(c =='o') price += 100;
  
  cout << price << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

string test(int k, int a, int b) {
  for (int d = a; d <= b; d++){
    if (d % k == 0) {
      return "OK";
    }
  }
    return "NG";
}

int main() {
  int k;
  int a, b;

  cin >> k;

  cin >> a >> b;

  cout << endl;
  cout <<  test(k, a, b) << endl;

  return 0;
}


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

    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846

    void solve(){
        int l,r,d;
        cin>>l>>r>>d;
        int total=0;
        for(int i=l;i<=r;i++){
            if(i%d==0)
                total++;
        }
        cout<<total;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


Measured memory_bytes: 3616
import scala.io.StdIn.readLine

object Main {
  def getTime(s:String) = {
    val t = s.split(" ").map(_.toInt)
    t(3)*3600 + t(4)*60 + t(5)- (t(0)*3600 + t(1)*60 + t(2))
  }

  def main(args:Array[String]) = {
    (1 to 3).foreach { _ =>
      val t = getTime(readLine)
      println((t/3600) + " " + ((t/60)%60) + " " + (t%60))
    }
  }
}

Measured memory_bytes: 43380
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int N, M, x;
priority_queue<int> pq;

int main() {
	cin >> N >> M;
	for (int i=0; i<N; i++) {
		cin >> x; pq.push(x);
	}

	for (int i=0; i<M; i++) {
		int tmp = pq.top(); pq.pop();
		pq.push(tmp/2);
	}

	ll ans = 0;
	while (!pq.empty()) {
		ans += (ll)pq.top(); pq.pop();
	}

	cout << ans;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
double e[1001][51001];
double optimalBST(double p[],double q[],int n){
    double w[1001][1001];
    for(int i=1;i<=n+1;i++){
        e[i][i-1]=q[i-1];
        w[i][i-1]=q[i-1];
    }
    for(int l=1;l<=n;l++){
        for(int i=1;i<=n-l+1;i++){
            int j=i+l-1;
            e[i][j]=1000.0;
            w[i][j]=w[i][j-1]+p[j]+q[j];
            for(int r=i;r<=j;r++){
                double t=e[i][r-1]+e[r+1][j]+w[i][j];
                if(t<e[i][j]){
                    e[i][j]=t;
                }
            }
        }
    }
    return e[1][n];
}
int main(){
    int n;
    double p[1001],q[1001];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    for(int i=0;i<=n;i++){
        cin>>q[i];
    }
    

    printf("%.8lf\n", optimalBST(p,q,n)); 

    return 0;
}


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

unsigned int get_answer ( const int n ) {
	if(n <= 2) return 1;
	unsigned int now, pre1 = 2, pre2 = 1, pre3 = 1;

	for ( int i = 3; i <= n; i++ ) {
		now = pre1 + pre2 + pre3;
		pre3 = pre2;
		pre2 = pre1;
		pre1 = now;
	}

	return now / (365 * 10) + 1;
}

int main(void){
	int n;

	while ( cin>>n && n ) {
		cout << get_answer(n) << endl;
	}

	return 0;
}

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

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

int main(){
    int a,b,c;cin>>a>>b>>c;
    if (a+b==c||b+c==a||a+c==b)
    {
        /* code */
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    
 
    }

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	var answer int
	m := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&m[i])
		x = x - m[i]
		if x < 0 {
			answer = i + 1
			break
		}
		answer = i + 1
	}
	sort.Ints(m)
	answer = answer + x/m[0]
	fmt.Println(answer)
}


Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
using namespace std;
int a[100010];
int main(){
	int n,ans=0; scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<=n;++i) if(a[i]==i){
		++ans;
		if(i!=n) swap(a[i],a[i+1]); else swap(a[i],a[i-1]);
	}
	printf("%d",ans); return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+100;
int n,m,dg[N],vi[N],tag[N];
int tot,first[N],nxt[N*2],point[N*2],id[N*2];
struct node
{
	int u,v,dir;
}e[N];
inline void add_edge(int x,int y,int z)
{
	tot++;
	nxt[tot]=first[x];
	first[x]=tot;
	point[tot]=y;
	id[tot]=z;
}
void dfs(int x,int last)
{
	vi[x]=1;
	if (dg[x]&1) tag[x]++;
	for (int i=first[x];i!=-1;i=nxt[i])
	{
		int u=point[i];
		if (vi[u]) continue;
		dfs(u,id[i]);
		tag[x]+=tag[u];
	}
	if (tag[x]&1) e[last].dir^=1;
}
int main()
{
	tot=-1;
	memset(first,-1,sizeof(first));
	memset(nxt,-1,sizeof(nxt));
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		scanf("%d%d",&e[i].u,&e[i].v);
		dg[e[i].u]++;
		e[i].dir=1;
		add_edge(e[i].u,e[i].v,i);
		add_edge(e[i].v,e[i].u,i);
	}
	int cnt=0;
	for (int i=1;i<=n;i++) cnt+=(dg[i]&1);
	if (cnt&1)
	{
		printf("-1\n");
		return 0;
	}
	dfs(1,0);
	for (int i=1;i<=m;i++) if (e[i].dir==0) swap(e[i].u,e[i].v);
	for (int i=1;i<=m;i++) printf("%d %d\n",e[i].u,e[i].v);
}

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

int main() {
  int a, b, n, m;
  while(cin>>a>>b){
    m=0;
    n=a+b;

    while(n!=0){
      n/=10;
      m++;
    }

    cout << m << endl;
  }
  return 0;
}




Measured memory_bytes: 3080