akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 5005;

bool dp[MAX_N][MAX_N];
int a[MAX_N];
ll sm[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    dp[0][0] = true;
    rep(i,n){
        cin >> a[i];
    }
    sort(a,a+n,greater<int>());
    rep(i,n){
        sm[i+1] = sm[i] + a[n-1-i];
    }
    int ans = 0;
    rep(i,n){
        bool flag = false;
        if(K-sm[n-i]+a[i] > 0){
            srep(j,max(0LL,K-sm[n-i]),min((ll)K,K-sm[n-i]+a[i])){
                flag |= dp[i][j];
            }
            ans += !flag;
        }
        rrep(j,K){
            if(dp[i][j]){
                dp[i+1][j] = dp[i][j];
                if(j + a[i] >= K) continue;
                dp[i+1][j+a[i]] = true;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


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

#define int long long

using namespace std;

const int N = 2e5 + 123;

int n;

int a[N], cnt[N], ans;

main () {
    cin >> n;
    for (int i = 1;i <= n;i ++) {
        cin >> a[i];
        cnt[a[i]] ++;
    }
    for (int i = 1;i <= 2e5;i ++) {
        ans += (cnt[i] * (cnt[i] - 1)) / 2;
    }
    for (int i = 1;i <= n;i ++) {
        cout << ans - cnt[a[i]] + 1 << '\n';
    }
}


Measured memory_bytes: 4736
#include <stdio.h>

int main(void) {
    int a, count = 0;
    scanf("%d",&a);
    int s[4];
    s[0] = a/1000;
    s[1] = a/100 - s[0]*10;
    s[2] = a/10 - s[0]*100 - s[1]*10;
    s[3] = a - s[0]*1000 - s[1]*100 -s[2]*10;
    for(int i = 0; i < 3; i++) {
        int hantei = s[i];
        if(hantei == s[i+1]) {
            count++;
        }
    }
    if(count > 0) {
        printf("Bad\n");
    } else {
        printf("Good\n");
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll M=1e9+7;
typedef vector<ll> Vec;
typedef vector<Vec> Mat;

int main()
{
    int n,k;
    while(cin>>n>>k)
    {
        if(n<k)
        {
            cout<<0<<endl;
            continue;
        }
        Mat dp(n+1,Vec(k+1));
        for(int i=0;i<=k;i++)
        {
            dp[0][i]=1;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=k;j++)
            {
                if(i>=j) dp[i][j]+=dp[i-j][j];
                dp[i][j]+=dp[i][j-1];
                dp[i][j]%=M;
            }
        }
        cout<<dp[n-k][k]<<endl;
    }

    return 0;
}






Measured memory_bytes: 10724
import java.util.*;

class Main {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        String ret = "";
        if (s.equals("Sunny")) {
            ret = "Cloudy";
        } else if (s.equals("Cloudy")) {
            ret = "Rainy";
        } else {
            ret = "Sunny";
        }
        System.out.println(ret);
    }
}


Measured memory_bytes: 21844
use std::io;
use std::str;

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Scanner {
            reader: reader,
            buffer: Vec::new(),
        }
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("failed to parse token");
            }
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("failed to read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

use io::Write;
fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut stdout = io::BufWriter::new(stdout);
    let mut scanner = Scanner::new(stdin.lock());

    let s: Vec<char> = scanner.token::<String>().chars().collect();
    let t: Vec<char> = scanner.token::<String>().chars().collect();
    let mut flag: bool = true;
    for i in 0..s.len() {
        if s[i] != t[i] {
            flag = false;
            break;
        } else {
            continue;
        }
    }
    if flag {
        writeln!(&mut stdout, "Yes");
    } else {
        writeln!(&mut stdout, "No");
    }
}


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

int main() {
    int a,b,c,tmp;

    std::cin>>a>>b>>c;

    if(b<a){
    	tmp = a;
    	a = b;
    	b = tmp;
    }
    if(c<a){
    	tmp = a;
    	a = c;
    	c = tmp;
    }
    if(c<b){
    	tmp = c;
    	c = b;
    	b = tmp;
    }


    std::cout<<a<<" "<<b<<" "<<c<<std::endl;



}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,d;
	cin>>n>>d;
	for (int i=n;i>=1;i--)
	{
		if (n>i*(2*d+1))
		{
			cout<<i+1<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <string>
#include <algorithm>
using namespace std;
int solve(void){
    int N;
    string S;
    cin >> N >> S;
    int white=0,black=0;
    for(int i=0;i<N;i++){
        if(S[i] == '.')white++;
        else black++;
    }
    if(white == N || black == N){
        return 0;
    }
    int ans = min(white,black);
    black = 0;
    for(int i=0;i+1<N;i++){
        if(S[i] == '.')white--;
        if(S[i] == '#')black++;
        if(S[i] == '.' && S[i+1] == '#'){
            ans = min(ans,white+black);
        }
    }
    return ans;
    
}
int main(void){
    int ans = solve();
    cout << ans << endl;
}


Measured memory_bytes: 3392
/*
ID: Sho10
LANG: C++
TASK:race
*/
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,ans;
int32_t main(){
CODE_START;
cin>>n;
ans=1;
while(ans<=n){
    ans=ans*2;
}
cout<<ans-1<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define Test int T;cin>>T;while(T--)
#define ls lower_bound
#define up upper_bound
#define bs binary_search
#define S second
#define F first
#define vi vector<int>  
#define pii pair<int,int>
#define vpi vector<pii>
#define vvi vector<vi>
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define m_n(v) *min_element(all(v))
#define m_x(v) *max_element(all(v))
#define ___(a) for(auto &i:a) cin>>i
#define __(a)  for(auto i:a) cout<<i<<" "
#define nl cout<<"\n";
#define momo(k) memset(k,0,sizof(k))
#define momi(k) memset(k,-1,sizeof(k))
/* 
#include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
*/
int power(int x, int y,int mod){
    int res = 1;
    while (y)
    {
        if (y & 1)
        res = (res*x)%mod;
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
int modInverse(int a, int m){
    int m0 = m;
    int y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
int binomial(int n,int k){
    int res = 1;
    if ( k > n - k )
        k = n - k;

    for (int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}

// vector<int> prime;
// void sieve(){
//     bool arr[300000]={0};
//     prime.pb(2);
//     for(int i=3;i<300000;i+=2){
//         if(arr[i])continue;
//         for(int j=i*i;j<300000;j+=i) arr[j]=1;
//         prime.pb(i);
//     }
// }
// const int N=1e18+2;
const int mod = 1e9+7;
const int N = 3e3+2;
int n,m;
string s,t;
int dp[N][N];

// int solve(int i,int j){
//     if( i<0 or j<0) return 0ll;
//     int &ans = dp[i][j];
//     if(ans != -1) return ans;
//     if(s[i] == t[j]){
//         ans = 1+solve(i-1,j-1);
//         return ans; 
//     }
//     return ans = max(solve(i-1,j),solve(i,j-1));
// }

int solve(int i,int j){
    if(i==n or j==m) return 0ll;
    int &ans = dp[i][j];
    if(ans != -1) return ans;
    if(s[i] == t[j]){
        ans = 1 + solve(i+1,j+1);
    }
    else{
        ans = max( solve(i+1,j) , solve(i,j+1) );
    }
    return ans;
}

void path(int i,int j){
    if( i==n or j==m) return ;
	int ans=solve(i, j);
	if(s[i]==t[j])
	{
		cout<<s[i];
		return path(i+1, j+1);
	}
	else
	{
		if(ans==solve(i+1, j))
			return path(i+1, j);
		return path(i, j+1);
	}
}

int32_t main() {
    IOS;
    momi(dp);
    cin>>s>>t;
    n = s.size();
    m = t.size();
    int f=solve(0,0);
    // for(int i=0;i<n;i++){
    //     for(int j=0;j<m;j++){
    //         cout<<dp[i][j]<<" ";
    //     }
    //     nl;
    // }
    // cout<<solve(n,m);
    path(0,0);
    return 0;
}

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

class BIT{
  int bit_size;
  int b[200001];
public:
  BIT(int n){
    bit_size = n;
  }
  void reset(){
    memset(b, 0, bit_size * sizeof(*b));
  }
  int sum(int x){
    int ret = 0;
    for ( ;x > 0; x -= x & -x)
      ret += b[x];
    return ret;
  }
  void add(int x,int n){
    for( ;x <= bit_size; x+= x & -x)
      b[x] += n;
  }
};

int PAD;
int a[100001];
BIT *bit;
long N;

int check(int n){
  int x = PAD;
  long res = 0;

  bit->reset();
  bit->add(x, 1);
  for(int i = 1; i <= N; ++i){
    x += a[i] >= n ? 1: -1;
    res += bit->sum(x);
    bit->add(x, 1);
  }
  if(res >= (1 + N) * N / 2 - (1 + N) * N / 4){
    return 1;
  }else{
    return 0;
  }
}

int main(){
  int l = 1;
  int r = 1000000000;
  int mid;

  cin >> N;
  bit = new BIT(N * 2 + 1);
  PAD = N + 1;

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

  while(l <= r){
    mid = (l + r) / 2;
    if(check(mid)){
      l = mid + 1;
    }else{
      r = mid - 1;
    }
  }
  cout << r << endl;
}

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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i=(a);i>=(b);i--)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    int n,k;
    cin >> n >> k;
    ll A[100005],dp[100005];

    FOR(i,0,n)
        cin >> A[i];

    dp[0]=0;

    FOR(i,1,n){
        dp[i]=1e18;
        FORN(j,1,k){
            if(i-j>=0)
                dp[i]=min(dp[i],dp[i-j]+abs(A[i]-A[i-j]));
        }
    }

    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1792
N = int(input())
l = [0] * 10 ** 5
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            n = (pow(x + y,2) + pow(y + z,2) + pow(z + x,2)) // 2
            l[n] += 1
for n in range(1,N + 1):
    print(l[n])

Measured memory_bytes: 75088
#include<iostream>
#include <math.h>
#include <algorithm>
#include<queue>
#include <bits/stdc++.h>


using namespace std;

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

main(){
    int A, P;
    int piece, pie;
    cin >> A >> P;
    piece = P + 3 * A;
    pie = piece / 2;
    cout << pie << endl;
}


Measured memory_bytes: 256
import java.io.*;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    int sum = 0;
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '+') {
          sum++;
      } else if (str.charAt(i) == '-') {
          sum--;
      } else {
        // 何もしない
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 20948
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>

unsigned depth(const std::vector<std::list<unsigned>> &a, unsigned index) {
  if (a[index].empty()) {
    return 0u;
  }
  std::vector<unsigned> tmp;
  for (auto &i : a[index]) {
    tmp.push_back(depth(a, i));
  }
  std::sort(tmp.begin(), tmp.end());
  unsigned max = 0u;
  unsigned dep = 0u;
  for (unsigned long i = tmp.size(); i-- > 0;) {
    max = std::max(max, dep + tmp[i]);
    ++dep;
  }
  return max + 1;
}

int main() {
  unsigned N;
  std::cin >> N;
  std::vector<std::list<unsigned>> a(N + 1);
  for (unsigned i = 2; i <= N; ++i) {
    unsigned tmp;
    std::cin >> tmp;
    a[tmp].push_back(i);
  }
  std::cout << depth(a, 1);
  return 0;
}

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

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

    if (s.at(a) != '-') {
		cout << "No" << endl;
		return 0;
	}

	string ans = "Yes";

	for (int i = 0; i < a + b + 1; i++) {

		if (i != a) {
			
			if (!(s.at(i) == '0' || s.at(i) == '1' || s.at(i) == '2' || s.at(i) == '3' || s.at(i) == '4' || s.at(i) == '5' || s.at(i) == '6' || s.at(i) == '7' || s.at(i) == '8' || s.at(i) == '9'))
				ans = "No";
		}

	}

	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A <= C&&C <= B){cout<<"Yes";}
  else{cout<<"No";}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
int z=0,x=0,n,m,a[1000000],b[1000000]={},c[1000000]={};
  string s[1000000];
  cin>>n>>m;
  for(int i=0;i<m;i++){
	cin>>a[i]>>s[i];
  }
  for(int i=0;i<m;i++){
	if(s[i]=="AC" && b[a[i]]==0){
      z++;
      b[a[i]]++;
      x += c[a[i]];
    }
    if(s[i]=="WA" && b[a[i]]==0){
	c[a[i]]++;
    } 
  }
  cout<<z<<" "<<x<<"\n";
}

Measured memory_bytes: 24448
#include <iostream>
#include <climits>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 9000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N, K;
  cin >> N >> K;
  vector<P> v;
  vector<ll> x(N), y(N);
  REP(i, N) {
    ll xi, yi; cin >> xi >> yi;
    v.PB(MP(xi, yi));
    x[i] = xi;
    y[i] = yi;
  }
  sort(ALL(x), greater<ll>());
  sort(ALL(y), greater<ll>());

  ll ans = LLINF;
  for (int ibx = 0; ibx < N; ibx++) {
    for (int isx = ibx + 1; isx < N; isx++) {
      for (int iby = 0; iby < N; iby++) {
        for (int isy = iby + 1; isy < N; isy++) {
          ll bx = x[ibx], sx = x[isx];
          ll by = y[iby], sy = y[isy];
          //cout << bx << ' ' << sx << ' ' << by << ' ' << sy << ' ' << endl;
          int cnt = 0;
          REP(i, N) {
            //cout << "#" << sx << " <= " << v[i].FI << " <= " << bx << endl;
            //cout << sy << " <= " << v[i].SE << " <= " << by << endl;;
            if (sx <= v[i].FI && v[i].FI <= bx &&
                sy <= v[i].SE && v[i].SE <= by) {
              cnt++;
            }
          }
          if (cnt >= K) ans = min(ans, (bx-sx) * (by-sy));
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}



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

Amax = max(A)
if A.count(Amax) > 1:
    for i in range(N):
        print(Amax)

else:
    for i in A:
        if i != Amax:
            print(Amax)
        else:
            print(sorted(A)[-2])

Measured memory_bytes: 14224
import java.util.*;
import java.io.*;
import java.time.*;

class Main {

	void solve() {

		int a = in.nextInt(), b = in.nextInt();
		out.println(b%a==0 ? a+b : b-a);
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 22996
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
judge = 'Yes'

for i in range(1, N+1):
    t[i], x[i], y[i] = map(int,input().split())

for i in range(1, N+1):
    if t[i]-t[i-1] < abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]):
        judge = 'No'
        break
    elif t[i] % 2 != (x[i] + y[i]) % 2:
        judge = 'No'
        break

print(judge)

Measured memory_bytes: 11636
a,b=input().split()
a=int(a)
b=int(b)
x=10
y=int(x*8/100)
z=int(x*10/100)
i=0
while x<10000:
  if int(x*8/100)==a and int(x*10/100)==b:
    print(x)
    break
  else:
    x=x+1
if x==10000:
  print("-1")

Measured memory_bytes: 9044
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int N,K;
    cin >>N >>K;
    vector<int> A(N);
    rep(i,N){
        cin>>A[i];
    }
    int flag=1, t=0;
    while(flag){
        flag=0;
        vector<int> B(N+1);
        rep(i,N){
            int mmin=max(0,i-A[i]);
            int mmax=min(N,i+A[i]+1);
            B[mmin]+=1; B[mmax]-=1;
        }
        A[0]=B[0];
        for(int i=1; i<N; ++i){
            A[i] = A[i-1] + B[i];
        }
        if(++t==K) break;
        rep(i,N){
            if(A[i]!=N){
                flag=1;
                break;            
            }
        }
    }

    rep(i,N){
        cout << A[i] << " ";
    }
    cout << endl;

    return 0;
}


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

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (c it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(x...) " [" #x ": " << (x) << "] "

const int mod = 1e9 + 7;
int potmod(long long x, int m) {
  long long res = 1;
  while (m > 0) {
    if (m & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    m /= 2;
  }
  return res;
}

const int N = 1e5;
int sil[N + 7];
int odwr[N + 7];
int coef[N + 7];
int tab[N + 7];
int n;

int sums[N + 7];

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> tab[i];
  
  sil[0] = 1;
  for (int i = 1; i <= n; ++i) sil[i] = ((long long) i * sil[i - 1]) % mod;
  
  for (int i = 1; i <= n; ++i) odwr[i] = potmod(i, mod - 2);

  long long ns = sil[n];
  
  for (int i = 1; i <= n; ++i) {
    sums[i] = sums[i - 1] + (ns * odwr[i]) % mod;
    sums[i] %= mod;
  }

  for (int i = 1; i <= n; ++i) {
    long long ww = sums[n - i + 1];
    ww += sums[i];
    ww += mod - ns;
    coef[i] = ww % mod;
  }
 
  long long wynik = 0;
  for (int i = 1; i <= n; ++i) wynik += ((long long) tab[i] * coef[i]) % mod;
  cout << wynik % mod << endl;
  return 0;
}

Measured memory_bytes: 2176
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <stack>

using namespace std;

int main()
{
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, l, ans = 0;
	cin >> n >> l;
	vector<int>x(n + 1);
	if (l >= 0)
	{
		for (int i = 2; i <= n; ++i)
		{
			ans += l + i - 1;
		}
		cout << ans;
	}
	else
	{
		if (n >= abs(l - 1))
		{
			for (int i = 1; i <= n; ++i)
			{
				ans += l + i - 1;
			}
			cout << ans;
		}
		else
		{
			for (int i = 1; i < n; ++i)
			{
				ans += l + i - 1;
			}
			cout << ans;
		}
	}
	return 0;
}

Measured memory_bytes: 256
//ABC044B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	string s;
	cin >> s;
	for(char i='a';i<='z';i++){
		int count = 0;
		for(int j=0;j<s.size();j++){
			if(i == s.at(j)){
			count++;
			}
		}
		if(count%2 != 0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

int main() {
    int N; cin >> N;
    bool ans = false;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            if (4*i+7*j == N) ans = true;
        }
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 384
#coding: utf-8
from collections import Counter
N = int(input())
S = input()
ans = 0
for i in range(1, N):
    cnt = 0
    left, right = S[:i], S[i:]
    longer, shorter = max(left, right), min(left, right)
    for j in range(len(longer)):
        if longer[j] in shorter and longer[j] not in longer[:j]:
            cnt += 1
    ans = max(ans, cnt)
print(ans)

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

char mp[22][22];
ll dist[22*22][22*22];

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

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

	REP(i, 22)REP(j, 22)mp[i][j] = '#';
	REP(i, 22*22)REP(j, 22*22)if(i!=j)dist[i][j] = INF;
	ll h, w;cin >> h >> w;
	REP(i, h){
		REP(j, w){
			cin >> mp[i+1][j+1];
		}
	}

	REP(i, h){
		REP(j, w){
			int x = j+1;
			int y = i+1;
			if(mp[y][x] == '#')continue;
			REP(k, 4){
				int xx = x + dx[k];
				int yy = y + dy[k];
				if(mp[yy][xx] == '.'){
					dist[y*(h+2)+x][yy*(h+2)+xx] = 1;
					dist[yy*(h+2)+xx][y*(h+2)+x] = 1;
				}
			}
		}
	}

	REP(k, 22*22)REP(i, 22*22)REP(j, 22*22){
		dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
	}

	ll ans = 0;
	REP(i, 22*22)REP(j, 22*22){
		if(dist[i][j] != INF){
			ans = max(ans, dist[i][j]);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<algorithm>
int A,B,C,X;
int ans=0;
bool memo[51][51][51]={};
void search(int sa,int sb,int sc,int sx){
    memo[sa][sb][sc]=true;
    //std::printf("%d %d %d %d\n",sa,sb,sc,sx);
    if(sx==X)ans++;
    else{
        if(sx+500<=X&&sa+1<=A&&memo[sa+1][sb][sc]==false){
            search(sa+1,sb,sc,sx+500);
        }
        if(sx+100<=X&&sb+1<=B&&memo[sa][sb+1][sc]==false){
            search(sa,sb+1,sc,sx+100);
        }
        if(sx+50<=X&&sc+1<=C&&memo[sa][sb][sc+1]==false){
            search(sa,sb,sc+1,sx+50);
        }
    }
}

int main(void){
	std::cin>>A>>B>>C>>X;
    search(0,0,0,0);
    std::cout<<ans<<std::endl;
    return 0;
}


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

int main(){
	string s, str1, str2;
	int maxn = 0, maxl = 0;
	map<string, int> mp;
	while(cin >> s){
		
		
		//if(s == "0")break;
		
		
		mp[s]++;
		if(mp[s] > maxn){maxn = mp[s];str1 = s;}
		int si1 = s.size();int si2 = str2.size();
		if(si1 > si2){str2 = s;}
		//cout << s << " ";
	}
	
	//cout << mp["have"];
	cout << str1 << " " << str2 << endl;
	return 0; 
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k,m;
string s;

vi f(){
	vi a;
	for(int i=0;i<n;i++) if(s[i]=='o'){
		if(a.empty()||i-a.back()>m) a.push_back(i);
	}
	reverse(s.begin(),s.end());
	return a;
}

int main(){
	cin>>n>>k>>m>>s;
	vi a=f(),b=f();
	int sa=a.size(),sb=b.size();
	for(int i=0;i<sb;i++) b[i]=n-b[i]-1;
	reverse(b.begin(),b.end());
	for(int i=0;i<n;i++) if(s[i]=='o'){
		int l=lower_bound(a.begin(),a.end(),i)-a.begin()-1;
		int r=upper_bound(b.begin(),b.end(),i)-b.begin();
		if((l+1)+(sb-r)-(l>=0&&r<sb&&b[r]-a[l]<=m?1:0)<k) cout<<i+1<<endl;
	}
}

Measured memory_bytes: 3448
#include <bits/stdc++.h>
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
 
using namespace std;
 
auto main() -> int
{
	int X; cin >> X;
    int N = 0;
    N += int(X / 500) * 1000;
	X %= 500;
    N += int(X / 5) * 5;
    
    cout << N << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,x,y,z,w;
    char op;
    while(1){
        cin>>a>>op>>b;
        if(op=='?'){
            break;
        }
        else{
           if(op=='+'){
               x=a+b;
               cout<<x<<endl;
           } 
           else if(op=='-'){
               y=a-b;
               cout<<y<<endl;
           }
           else if(op=='*'){
               z=a*b;
               cout<<z<<endl;
           }
           else if(op=='/'){
               w=a/b;
               cout<<w<<endl;
           }
        }
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
  int n;
  cin>>n;
  rep(i,n){
      string s,t;
      cin>>s>>t;
      
      vvll dp(s.size()+1,vll(t.size()+1));
      rep(j,s.size()+1)dp.at(j).at(0)=0;
      rep(j,t.size()+1)dp.at(0).at(j)=0;
      
      rep(j,s.size()){
          rep(k,t.size()){
              if(s.at(j)==t.at(k))dp.at(j+1).at(k+1)=dp.at(j).at(k)+1;
              else dp.at(j+1).at(k+1)=max(dp.at(j+1).at(k),dp.at(j).at(k+1));
          }
      }
      cout<<dp.at(s.size()).at(t.size())<<endl;
  }
}
  

   
    

   



Measured memory_bytes: 10760
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String t = sc.nextLine();
		StringBuilder t1 = new StringBuilder(t);
		
		for(int i=0; i<t1.length();i++) {
			if(t1.charAt(i)=='?') {
				t1.setCharAt(i,'D');
			}
		}
		System.out.println(t1.toString());
	}
}

Measured memory_bytes: 41644
#include<bits/stdc++.h>
#define ll long long
#define N 100010
using namespace std;
int n,a[N];
ll s[N],ans,no=1;
int main(){
	cin>>n;
	for (int i=0;i<=n;i++)cin>>a[i];
	for (int i=n;i>=0;i--)s[i]=s[i+1]+a[i];
	for (int i=0;i<=n;i++){
		ans+=no;
		no=no-a[i];
		if (no<0){
            puts("-1");
            return 0;
        }
		no=min(no*2,s[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4804
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var pqr = ReadInts();
            Array.Sort(pqr);
            WriteLine(pqr[0] + pqr[1]);
        }
        

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


Measured memory_bytes: 11220
#include<iostream>                          
#include<vector>                    
 #include<bits/stdc++.h>

#define mod 998244353
#define pi 3.14159265358979
#define  PRE(x,p) cout<<setprecision(x)<<p; 
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl "\n"
#define high INT_MAX
#define low INT_MIN
#define ll long long int
using namespace std;
ll z;
ll a[1000001],n,spf[1000001];
vector<ll>v; 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<1000001; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<1000006; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<=1000001; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            
            for (int j=i*i; j<1000001; j+=i) 
  
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
void solve() 
{ 
  ll n,i,g,x;
  cin>>n;
  sieve();
  
  for(i=1;i<=n;i++)
  {
          cin>>a[i];
         
          if(i==1)
          g=a[i];
          else
          g=__gcd(g,a[i]);
  }
//   for(i=1;i<=20;i++)
//    cout<<spf[i]<<' ';
  if(g!=1)
 { cout<<"not coprime";
  return;}
  
  
  map<ll,ll>ma;
  for(i=1;i<=n;i++)
  {
          x=a[i];
            while (x != 1) 
        {  if(ma.count(spf[x])>0)
           {cout<<"setwise coprime";
           return;}
           
           else
           {   ll divi=spf[x];
                   ma[spf[x]]=1;
                 while(x%divi==0 && x>=1)
                 x=x/divi;
           }
         
        } 
  }
  cout<<"pairwise coprime";
}
 
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t=1;
//cin>>t;
for(z=1;z<=t;z++)
solve();
 
return 0;
}

Measured memory_bytes: 19224
#include <stdio.h>

int main(void)
{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	if((x + r) <= W && 0 <= (x -r) && 0 <= (y - r) && (y + r) <= H)
	{
		printf("Yes\n");
	}
	else{
	printf("No\n");
	}
	return 0;
}





Measured memory_bytes: 2140
<?php
$n = intval(trim(fgets(STDIN)));
$yn = 'No';

for($i = 0; $i <= $n/4; $i++) {
  for($j = 0; $j <= $n/7; $j++) {
    if(($n - $i * 4 - $j * 7) === 0) {
      $yn = 'Yes';
    }
  }
}
echo $yn."\n";

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

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

    if(s.size() <= k)
    {
        cout << s << endl;
    }
    else
    {
        cout << s.substr(0, k) << "..." << endl;
    }

    return 0;
}



Measured memory_bytes: 3628
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  ll n;
  cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll ans=0;
  rep(i,n)ans+=a[i]-1;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce, lru_cache
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = MAP()
uf = UnionFind(n) # 初期化

for i in range(m):
    x, y, z = MAP1()
    uf.union(x, y) # グループを併合

print(uf.group_count())

Measured memory_bytes: 14880
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp> 
using namespace std;

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

    string S;
    cin >> S;

    if (S[0] == S[1] && S[1] == S[2]){
        cout << "No\n";
    }
    else {
        cout << "Yes\n";
    }

    return 0;
}

Measured memory_bytes: 256
_ = input()
a = list(map(int, input().split()))

flag = 1
counter = 0

while flag:
    flag = 0

    for j in range(len(a)-1, 0, -1):
        if a[j] < a[j-1]:
            a[j], a[j-1] = a[j-1], a[j]
            flag = 1
            counter += 1
 
print(" ".join(map(str, a)))
print(counter)


Measured memory_bytes: 5596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

// str中にあるcを省いて切り詰めるてdestに入れる
// cがスペースの場合、"1 2 3" -> "123"
void ommit(char* src, char c, char* dest){
	int len = strlen(src);
	memset(dest, 0, len+1);
	char *p = dest;
	for(int i=0; i<len; i++){
		if(src[i] != c){
			*p = src[i];
			p++;
		}
	}
}

LL calcStr(char* src){
	char dest[22] = {0};
	ommit(src, ' ', dest);
	char *p;
	long long ret = 0;
	
	p = strtok(dest, "+");
	ret += atoll(p);
	while(p !=NULL){
		p = strtok(NULL, "+");
		if(p != NULL){
			ret += atoll(p);
		}
	}
	return ret;
}

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

	string s;
	int len;
	cin >> s;
	len = (int)s.size();
	string S;
	for(int i=0; i<s.size(); i++){
		S += s[i];
		S += ' ';
	}

	long long ans = 0;
	for(int b = 0; b < (1<<(len-1)); b++){
		string ws = S;
		for(int i=0; i<len-1; i++){
			if(b & (1<<i)){
				ws[i*2+1] = '+';
			}
		}
		ans += calcStr((char*)ws.c_str());
	}
	printf("%lld\n", ans);
	return 0;
}

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

bool win(char a, char b) {
    if (a == 'r' and b == 's') return true;
    if (a == 's' and b == 'p') return true;
    if (a == 'p' and b == 'r') return true;
    return false;
}

string g[101010];
ll dp[101010][3];

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> v(3);
    rep(i, 3) cin >> v[i];
    string T;
    cin >> T;
    rep(i, T.size()) {
        g[i%K] += T[i];
    }
    ll ans = 0;
    rep(i, K) {
        rep(j, g[i].size()) {
            dp[j+1][0] = max(dp[j][1], dp[j][2]) + (win('r', g[i][j]) ? v[0] : 0);
            dp[j+1][1] = max(dp[j][0], dp[j][2]) + (win('s', g[i][j]) ? v[1] : 0);
            dp[j+1][2] = max(dp[j][0], dp[j][1]) + (win('p', g[i][j]) ? v[2] : 0);
        }
        ans += max({dp[(int)g[i].size()][0], dp[(int)g[i].size()][1], dp[(int)g[i].size()][2]});
    }
    cout << ans << endl;
}


Measured memory_bytes: 5248
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;
const ll MAX = 3030;

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

ll dp[MAX][MAX];

bool comp_p(const pll& l, const pll& r) {
	return l.first > r.first;
}

int main() {
	ll i, j;
	ll A, B, K;
	cin >> A >> B >> K;
	if (K <= A) {
		cout << A - K << " " << B << endl;
	}
	else if (K <= A + B) {
		cout << 0 << " " << A + B - K << endl;
	}
	else {
		cout << "0 0" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        if (A <= 5) {
            System.out.println(0);
        } else if (A <= 12) {
            System.out.println(B/2);
        } else {
            System.out.println(B);
        }
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 105
#define MAX_L 2005
int N,M,L;
int a[MAX_N][MAX_N];
int t[MAX_L],u[MAX_L];

vector<int> G[MAX_L];
bool used[MAX_L];
int match[MAX_L];

bool dfs(int v){
  used[v]=true;
  for(int i=0;i<(int)G[v].size();i++){
    int u=G[v][i],w=match[u];
    if(w==-1||(!used[w]&&dfs(w))){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}

int matching(){
  memset(match,-1,sizeof(match));
  int res=0;
  for(int i=0;i<L;i++){
    if(match[i]==-1){
      memset(used,false,sizeof(used));
      if(dfs(i))res++;
    }
  }
  return res;
}

void init(){
  for(int i=0;i<MAX_N;i++)
    for(int j=0;j<MAX_N;j++)
      a[i][j]=(i==j?0:1e9);
  for(int i=0;i<MAX_L;i++)G[i].clear();
}

int main(){
  while(1){
    cin>>N>>M>>L;
    if(N==0&&M==0&&L==0)break;
    init();
    for(int i=0;i<M;i++){
      int from,to,cost;
      cin>>from>>to>>cost;
      a[from][to]=min(a[from][to],cost);
      a[to][from]=min(a[to][from],cost);
    }
    for(int k=0;k<N;k++)
      for(int i=0;i<N;i++)
        for(int j=0;j<N;j++)
          a[i][j]=min(a[i][j],a[i][k]+a[k][j]);

    
    for(int i=0;i<L;i++){
      cin>>t[i]>>u[i];
      for(int j=0;j<i;j++){
        int from=i,to=j;
        if(u[from]>u[to])swap(from,to);
        if(u[from]+a[t[from]][t[to]]<=u[to]){
          G[from].push_back(to+L);
          G[to+L].push_back(from);
        }
      }
    }
    cout<<L-matching()<<endl;
  }
}

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

using namespace std;

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int res=0;
    for(int i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        if(t>=k) res++;
    }
    printf("%d\n",res);
    return 0;
}


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

#define ll long long
using namespace std;

int main() {
    ll n, p;
    cin >> n >> p;
    ll bsum = 0;
    vector<vector<ll>> x(n, vector<ll>(3));
    for (int i = 0; i < n; i++) {
        cin >> x[i][1] >> x[i][2];
        bsum += x[i][2];
        x[i][0] = x[i][1] * (100 - p) + x[i][2] * p;
    }
    sort(x.begin(), x.end());
    reverse(x.begin(), x.end());
    int ret = 0;
    ll wsum = 0;
    while (true) {
        bsum -= x[ret][2];
        wsum += x[ret][1];
        ret++;
        if (wsum * 100 >= p * (wsum + bsum))break;
    }
    cout << ret << endl;

    /*vector<vector<ll>> dp(n + 1, vector<ll>(2));//w and all
    for (int i = 1; i <= n; i++)dp[i][1] = 1145141919810;
    for (int i = 0; i < n; i++) {
        int w, b;
        cin >> w >> b;
        for (int j = i + 1; j >= 0; j--) {
            if (j > 0 && dp[j][0] * (dp[j - 1][1] + w)
                         < (dp[j - 1][0] + w) * (dp[j][1] + b)) {
                dp[j][0] = dp[j - 1][0] + w;
                dp[j][1] = dp[j - 1][1] + w;
            } else dp[j][1] += b;
        }
    }
    for (int i = 1; true; i++) {
        if (dp[i][0] * 100 >= p * dp[i][1]) {
            cout << i << endl;
            break;
        }
    }*/
    return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
 
 
signed main(){
 
 	lli m;
 	cin>>m;

 	cout<<24-m+24<<endl;

	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FIO ios_base::sync_with_stdio(false); cin.tie(0);
#define trav(x,a) for (auto& x: a)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define mem(a,v) memset((a), (v), sizeof (a))
#define endl "\n"
#define case(t) cout << "Case #" << (t) << ": "
#define reada(a, n) for (int _i = 0; _i < (n); _i++) read(a[_i])
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
const double eps = 1e-9;

template<class T> void read(T& x) { cin >> x; }
template<class X, class Y> void read(pair<X,Y>& a) { read(a.first), read(a.second); }
template<class T> void read(vector<T>& x) { trav(y, x) read(y); }
template<class T, class... O> void read(T& x, O&... y) { read(x), read(y...); }

string to_string(const char& x) { return string(1,x); }
string to_string(const char*& x) { return (string)x; }
string to_string(const string& x) { return x; }
template<class T, class U> string to_string(const pair<T,U>& x) { return to_string(x.first) + " " + to_string(x.second); }
template<class T> string to_string(const vector<T>& x) { string ret = ""; bool f = 0; trav(y, x) ret += (!f ? "" : " ") + to_string(y), f = 1; return ret; }
void print() { cout << endl; }
template<class T> void pr(const T& x) { cout << to_string(x); }
template<class T, class... O> void print(const T& x, const O&... y) { pr(x); if (sizeof...(y)) pr(" "); print(y...); }

int main() {
  FIO
  int n; read(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int x, y; read(x,y);
    if (x == y) {
      cnt++;
    } else 
    cnt = 0;
    if (cnt == 3) {
      print("Yes");
      return 0;
    }
  }
  print("No");
  return 0;
}


Measured memory_bytes: 3652