akhauriyash/Code-Regression huggingface dataset:
S=input()
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])
if A+B+C+D==7:
    print(A,'+',B,'+',C,'+',D,'=7',sep='')
elif A-B+C+D==7:
    print(A,'-',B,'+',C,'+',D,'=7',sep='')
elif A-B-C+D==7:
    print(A,'-',B,'-',C,'+',D,'=7',sep='')
elif A-B-C-D==7:
    print(A,'-',B,'-',C,'-',D,'=7',sep='')
elif A+B-C-D==7:
    print(A,'+',B,'-',C,'-',D,'=7',sep='')
elif A+B+C-D==7:
    print(A,'+',B,'+',C,'-',D,'=7',sep='')
elif A-B+C-D==7:
    print(A,'-',B,'+',C,'-',D,'=7',sep='')
elif A+B-C+D==7:
    print(A,'+',B,'-',C,'+',D,'=7',sep='')

Measured memory_bytes: 9216
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
deque<int> deq;
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

vector<ll> a; 
vector<ll> c;

int main(){
    int n;
    cin >> n;
    ll s=0;
    ll temp=0;
    rep(i,n){
        ll b;
        cin >> b;
        s+=b;
        a.push_back(b);
        c.push_back(temp+a[i]);
        temp+=a[i];
    }
    //sort(a.begin(),a.end());
    /*
    rep(i,n){
        cerr<<a[i]<<endl;
    }
    */
    
    ll p;
    if(s%2==0){
        p=s/2;
    }else{
        p=(s+1)/2;
    }
    ll k=lower_bound(c.begin(),c.end(),p)-c.begin();
    ll right=c[n-1]-c[k];
    ll left=c[k-1];
    ll want=abs(right-left);
    ll ans=abs(c[k]-c[k-1]-want);
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3564
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()

	// ans := make([][]rune,0)
	var fn func(idx,ma int, a []int)
	fn = func(idx, ma int, a []int) {
		if idx == n {
			r := make([]rune, n)

			for i := 0; i < n; i++ {
				r[i] = rune(a[i]+'a')
			}
			fmt.Fprintln(wr, string(r))
			// fmt.Fprintln(wr, a)
			return
		}

		for i := 0; i < ma+1; i++ {
			a[idx] = i
			if i==ma {
				fn(idx+1, i+1,a)
			} else {
				fn(idx+1, ma,a)
			}
		}
	}

	arr := make([]int, n)
	fn(0,0,arr)
}


Measured memory_bytes: 6656
import sys
sys.setrecursionlimit(1000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *

N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
xyh.sort(key = lambda z: -z[2])
for cx in range(101):
    for cy in range(101):
        x, y, h = xyh[0]
        H = h+abs(cx-x)+abs(cy-y)
        for x, y, h in xyh[1:]:
            _h = max(H-abs(cx-x)-abs(cy-y), 0)
            if h != _h:
                break
        else:
            print(cx, cy, H)
            exit()


Measured memory_bytes: 3316
n = int(input())
a = list(map(int, input().split()))
onecnts = []

for i in a:
    j = 0
    while i > 0:
        if len(onecnts) - 1 < j:
            onecnts.append(0)
        if i % 2 != 0:
            onecnts[j] += 1
        j += 1
        i >>= 1

ans = 0
mod = 10**9+7

for i, onecnt in enumerate(onecnts):
    ans += onecnt * (n-onecnt) * (2**i)
    ans %= mod
print(ans)

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

#define ii pair<int, int>
#define vi vector<int>
#define LL long long int 
#define VLL vector<LL>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define INF int(1e9)

using namespace std;

int main () {
    ios_base::sync_with_stdio(false);
    LL A, B, K;
    cin >> A >> B >> K;

    if(K<=A){
        cout << A-K << " " << B << endl;
    }else{
        K-=A;
        if(K<=B)
            cout << 0 <<" " << B-K << endl;
        else cout << "0 0" << endl;
    }
    return 0;
}

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

int main()
{
  int64_t H, W, d1 = INF, d2 = INF, d3 = INF, d4 = INF;
  cin >> H >> W;

  // 1. 縦に3分割
  if (W >= 3)
  {
    d1 = (W % 3 == 0) ? 0 : H;
    if (d1 == 0)
    {
      cout << 0 << endl;
      return 0;
    }
  }

  // 2. 横に3分割
  if (H >= 3)
  {
    d2 = (H % 3 == 0) ? 0 : W;
    if (d2 == 0)
    {
      cout << 0 << endl;
      return 0;
    }
  }

  // 3. 縦に1回分割(1/3)。大きい方を横に分割(1/2)
  int64_t s1, s2, s3, h, w;
  for (int w = 1; w < W; w++)
  {
    s1 = w * H;
    h = H / 2;
    s2 = (W - w) * h;
    s3 = (W - w) * (H - h);
    d3 = min(d3, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
  }

  // 4. 横に1回分割(1/3)。大きい方を縦に分割(1/2)
  for (int h = 1; h < H; h++)
  {
    s1 = h * W;
    w = W / 2;
    s2 = (H - h) * w;
    s3 = (W - w) * (H - h);
    d4 = min(d4, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
  }

  cout << min(min(d1, d2), min(d3, d4)) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int x,y;
  while(1){
    scanf("%d %d",&x,&y);
    if(x==0&&y==0){
      break;
    }
    if(x>y){
      printf("%d %d\n",y,x);
    }
    if(x<y||x==y){
      printf("%d %d\n",x,y);
    }
  }
  return(0);
}

  

Measured memory_bytes: 1028
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<string>
#include<map>
#include<list>

using namespace std;

using llint = long long int ;


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

    string s;

    cin >> s;
    llint len = s.length();

    vector<llint> num(len, 0);
    vector<llint> pos(len, 0);
    llint num_size = 0;

    for(llint i=1; i<len; i++){
        if(s[i-1]=='<' && s[i]=='>'){
            num_size++;
            num[num_size]=num[num_size-1]+(i-pos[num_size-1]);
            pos[num_size] = i;
        }else if(s[i-1]=='>' && s[i]=='<'){
            num_size++;
            num[num_size]=0;
            num[num_size-1]=max(num[num_size-1],i-pos[num_size-1]);
            pos[num_size] = i;
        }
    }
    num_size++;
    {
        llint i=len-1;
        if(s[i]=='<'){
            num[num_size]=num[num_size-1]+(i-pos[num_size-1]+1);
            pos[num_size] = len;
        }else if(s[i]=='>'){
            num[num_size]=0;
            num[num_size-1]=max(num[num_size-1],i-pos[num_size-1]+1);
            pos[num_size] = len;
        }
    }
    num_size++;

    llint ans = 0;
    for(llint i=0; i<num_size-1; i++){
        llint p = pos[i], p2=pos[i+1];
        llint n = num[i], n2=num[i+1];

        if(s[p]=='>'){
            if(p2-p>n)
                ans+=n*(n+1)/2;
            else{
                llint nn = p2-p-1;
                ans+=nn*(nn+1)/2+n;
            }
        }else if(s[p]=='<'){
            llint pp = p2-p-1;
            ans+=pp*(pp+1)/2;
        }
    }
    if(num[num_size-1]!=0){
        llint n = num[num_size-1];
        ans+=n;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8696
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<string> a,b;
bool gazou(int i,int j){
  int k,l;
  for(k=0;k<b.size();k++){
    for(l=0;l<b.size();l++){
      if(a[i+k][j+l]!=b[k][l]) return false;
    }
  }
  return true;
}

int main(void){
  int m,n;
  cin>>n>>m;
  a.resize(n);
  b.resize(m);
  int i,j;

  for(i=0;i<n;i++) cin>>a[i];
  for(i=0;i<m;i++) cin>>b[i];
  int flag=0;
  int k,l;
  for(i=0;i<=n-m;i++){
    for(j=0;j<=n-m;j++){
      if(gazou(i,j)) {cout<<"Yes"<<endl;return 0;}
    }
  }
  cout<<"No"<<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 repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<ll, ll >;
const int mod = 1e9+7;
// const int INF = 2e9;
const ll INF = 1e15;
const int MAX = 1e6;

struct edge {int to, yen, snuuk;}; // 辺
vector<edge> graph[MAX]; // 隣接リスト
// bool visited[MAX]; // 訪問状況
ll dist_yen[MAX], dist_snuuk[MAX];

void dijkstra(int s) {
    fill(dist_yen, dist_yen+MAX, INF);
    dist_yen[s] = 0;
    priority_queue<pll, vector<pll>, greater<pll>> pq;
    pq.push({dist_yen[s], s});
    while (not pq.empty()) {
        int cur = pq.top().second;
        pq.pop();
        for (edge e : graph[cur]) {
            if (dist_yen[e.to] > dist_yen[cur] + e.yen) {
                dist_yen[e.to] = dist_yen[cur] + e.yen;
                pq.push({dist_yen[e.to], e.to});
            }
        }
    }
}

void r_dijkstra(int s) {
    fill(dist_snuuk, dist_snuuk+MAX, INF);
    dist_snuuk[s] = 0;
    priority_queue<pll, vector<pll>, greater<pll>> pq;
    pq.push({dist_snuuk[s], s});
    while (not pq.empty()) {
        int cur = pq.top().second;
        pq.pop();
        for (edge e : graph[cur]) {
            if (dist_snuuk[e.to] > dist_snuuk[cur] + e.snuuk) {
                dist_snuuk[e.to] = dist_snuuk[cur] + e.snuuk;
                pq.push({dist_snuuk[e.to], e.to});
            }
        }
    }
}


int main() {
    // input
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    rep(i, m) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        graph[u].push_back({v, a, b});
        graph[v].push_back({u, a, b});
    }
    // solve
    dijkstra(s); // sからyenを使った各都市までの最短経路
    r_dijkstra(t); // tからsnuukを使った各都市までの最短経路
    ll min_cost = INF;
    vector<ll> ans(n);
    repr(i, n) {
        ll cost = dist_yen[i] + dist_snuuk[i];
        min_cost = min(min_cost, cost);
        ans[i] = INF - min_cost;
    }
    // output
    rep(i, n) {
        cout << ans[i] << "\n";
    }
}

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

int main() {
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    if (a + b > n + 1 || 1LL * a * b < n) {
        return printf("-1\n"), 0;
    }
    for (int i = b; i >= 1; --i) printf("%d ", i);
    int idx = b, l = n - b - a + 1;
    for (int i = 1; i <= a - 1; ++i) {
        int ww = min(l, b - 1); l -= ww;
        for (int j = idx + ww + 1; j > idx; --j) printf("%d ", j); idx += ww + 1;
    }
    putchar('\n');
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  bool frag=true;
  int n=s.size();
  for(int i=0;i<((n+1)/4)-1;i++){
    if(s.at(i)!=s.at(((n-1)/2)-1-i)){
      frag=false;
      break;
    }
  }
  for(int i=0;i<((n+1)/2)-1;i++){
    if(s.at(i)!=s.at(((n+1)/2)+i)){
      frag=false;
      break;
    }
  }
  if(frag==true){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

const string DAY[7] = {"SUN", "MON", "TUE","WED", "THU", "FRI", "SAT"};

string s;

signed main(){
	cin >> s;
	int id = -1;
	for(int i=0;i< 7; ++i) if(DAY[i] == s){
		id = i;
		break;
	}
	for(int ans = 1; ans <= 7; ++ans){
		if(DAY[(id+ans)%7] == "SUN"){
			cout << ans;
			return 0;
		}
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
public class ABC140B {
    public static void Main() {
        int N, ans = 0;
        N = int.Parse(Console.ReadLine());
        List<int> A = new List<int>();
        List<int> B = new List<int>();
        List<int> C = new List<int>();
        string[] str = Console.ReadLine().Split(' ');
        for (int i = 0; i < str.Length; i++) {
            A.Add(int.Parse(str[i]));
        }
        str = Console.ReadLine().Split(' ');
        for (int i = 0; i < str.Length; i++) {
            B.Add(int.Parse(str[i]));
        }
        str = Console.ReadLine().Split(' ');
        for (int i = 0; i < str.Length; i++) {
            C.Add(int.Parse(str[i]));
        }
        
        ans += B[A[0] - 1];
        for (int i = 1; i < N; i++) {
            ans += B[A[i] - 1];
            if (A[i] == A[i - 1] + 1) ans += C[A[i - 1] - 1];
        }
        
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pi acos(-1)
#define mod 1000000007
using namespace std;

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

    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n == 2){
        cout << abs(a[1] - a[0]);
        return 0;
    }
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    for(int i = 2; i < n; i++){
        dp[i] = 1e9;
        for(int j = i - 1; j >= max(0, i - k); j--){
            dp[i] = min(dp[i], dp[j] + abs(a[i] - a[j]));
        }
    }
    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
import math

def main():
    X = int(input())
    current = X
    while not isPrime(current):
        current += 1
    
    print(current)

def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    # nの平方根まで計算する
    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
    return True


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

vi G[100005], tp;
int vis[100005];

void dfs(int u) {
	vis[u] = 1;
	for(int v:G[u])
		if(!vis[v])
			dfs(v);
	tp.PB(u);
}

int dp[100005];

int main()
{
	IO_OP;
	
	int n, m;
	cin >> n >> m;
	for(int i=0;i<m;i++) {
		int u, v;
		cin >> u >> v;
		G[u].PB(v);
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
			dfs(i);
	int ans = 0;
	for(int u:tp) {
		for(int v:G[u])
			dp[u] = max(dp[u], dp[v]+1);
		ans = max(ans, dp[u]);
	}
	cout << ans << endl;
}



Measured memory_bytes: 9080
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

int32_t N;
std::string S[100];
int main()
{
	using std::endl;

	std::cin >> N;
	for (int i = 0; i < N; i++)
	{
		std::cin >> S[i];
	}
	
	if (std::find_if(S, S + N, [](const std::string& s) { return s == "Y"; }) == S + N) {
	//if (std::find(S, S + N, "Y") == S + N) {
		std::cout << "Three" << endl;
	}
	else {
		std::cout << "Four" << endl;
	}

	return 0;
}
#endif


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int main()
{
	while (1)
	{
		int n;
		cin >> n;
		if (n == 0)
		{
			break;
		}

		vector<ll> dp(n + 1);
		dp.at(0) = 1;

		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= 3; j++)
			{
				if (i - j >= 0)
				{
					dp.at(i) = (dp.at(i) + dp.at(i - j));
				}
			}
		}

		cout << (dp.at(n) + 3650 + 1) / 3650 << endl;
	}

}


Measured memory_bytes: 2964
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A1,A2,A3;
  	cin >> A1 >> A2 >> A3;
  	if (A1 + A2 + A3 <= 21){
    cout << "win" << endl;
    }
  	else{
    cout << "bust" << endl;
    }
	return 0;
}


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



int main() {
	char S[101];
	int length = 0;
	int count = 0;

	cin >> S;
	length = strlen(S);

	for (int n = 0; n < length / 2; n++) {
		if (S[n] != S[length - n - 1])count++;
	}

	cout << count << endl;

}

Measured memory_bytes: 256
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"YES"<<'\n';
#define no cout<<"NO"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,k,l,n;
    string a,b;
    cin>>a>>b;
    reverse(a.begin(),a.end());
    if(a==b)
        yes
    else
        no


            return 0;
}





Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	for(int i = 0; i < n; i++){
    		int a = sc.nextInt();
    		if(a % 2 == 0){
    			if(a % 3 != 0 && a % 5 != 0){
    				System.out.println("DENIED");
            		return;
    			}
        	}else{
        		continue;
        	}
    	}
    	sc.close();
    	System.out.println("APPROVED");
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll a,b,c,d;
    d=n%10;
    n=n/10;
    c=n%10;
    n=n/10;
    b=n%10;
    n=n/10;
    a=n%10;
    ll ans[3];
    bool an=false;
    ll sum;
    for(ll i=0;i<2;i++){
        for(ll j=0;j<2;j++){
            for(ll k=0;k<2;k++){
                if(i==0){
                    sum=a+b;
                }else{
                    sum=a-b;
                }
                if(j==0){
                    sum=sum+c;
                }else{
                    sum=sum-c;
                }
                if(k==0){
                    sum=sum+d;
                }else{
                    sum=sum-d;
                }
                if(sum==7){
                    an=true;
                    ans[0]=i;
                    ans[1]=j;
                    ans[2]=k;
                }
            }
        }
    }
    
    if(an){
        cout<<a;
        for(ll i=0;i<3;i++){
            if(ans[i]==0){
                cout<<'+';
            }else{
                cout<<'-';
            }
            if(i==0){
                cout<<b;
            }else if(i==1){
                cout<<c;
            }else{
                cout<<d;
            }
        }
        cout<<"=7"<<endl;;
    }else{
        
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN 100001

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

    ll n, m;
    cin>>n>>m;
    ll a[n];
    loop(i,0,n) cin>>a[i];
    sort(a, a+n);
    // reverse(a, a+n);
    ll ptr=0;
    pll p[m];
    loop(i,0,m){
        ll b, c;
        cin>>b>>c;
        p[i].fi=c;
        p[i].se=b;
    }

    sort(p,p+m);
    reverse(p,p+m);
    for(ll i=0; i<m && ptr<n; i++){
        while(a[ptr]<p[i].fi && p[i].se>0){
            a[ptr] = p[i].fi;
            p[i].se--;
            ptr++;
        }
    }
    ll ans=0;
    loop(i,0,n){
        ans+=a[i];
    }
    print(ans);


    
}



Measured memory_bytes: 2560
#include<stdio.h>

int main(void){
  int n,num=0,i,j;
  int p[1000001];

  for(i = 2;i<=1000000;i++){
     p[i]=0;
       for(j = 2;j*j<=i;j++){
         if(!(i%j))break;
   }
   if(j*j>i)num++;
   p[i] = num;
  }
  while(scanf("%d",&n)!=EOF){
    printf("%d\n",p[n]);
  }

return (0);
}



Measured memory_bytes: 5636
def main():
    MOD = 10 ** 9 + 7

    N, K = map(int, input().split())
    *A, = map(int, input().split())

    A.sort(key=abs, reverse=True)

    ans = 1
    sgn = 1

    lm, lp = None, None
    for i, x in enumerate(A[:K]):
        if x < 0:
            sgn = -sgn
            lm = x
        else:
            lp = x
        ans = ans * x % MOD

    if K == N or sgn == 1 or ans == 0:
        print(ans)
        return

    fm, fp, z = None, None, False
    for i, x in enumerate(A[K:]):
        if x < 0:
            if fm is None:
                fm = x
        elif x == 0:
            z = True
        else:
            if fp is None:
                fp = x

    # 交換できる場合
    if lp is None:
        # マイナスが奇数個のみ
        if fp is not None:
            ans = ((ans * pow(lm, MOD - 2, MOD)) % MOD) * fp % MOD
            print(ans)
            return

        if z:
            print(0)
            return

        A.sort(key=abs)
        ans = 1
        for i, x in enumerate(A[:K]):
            ans = ans * x % MOD
        print(ans)
        return

    else:
        if fp is not None and fm is not None:
            if fm * lm >= fp * lp:
                ans = ((ans * pow(lp, MOD - 2, MOD)) % MOD) * fm % MOD
                print(ans % MOD)
                return
            else:
                ans = ((ans * pow(lm, MOD - 2, MOD)) % MOD) * fp % MOD
                print(ans % MOD)
                return

        if fp is not None:
            ans = ((ans * pow(lm, MOD - 2, MOD)) % MOD) * fp % MOD
            print(ans)
            return

        if fm is not None:
            ans = ((ans * pow(lp, MOD - 2, MOD)) % MOD) * fm % MOD
            print(ans)
            return


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 31848
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,R;cin>>N>>R;
    if(N>=10) cout<<R<<endl;
    else cout<<R+100*(10-N)<<endl;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	string ans = "No";
	string s, p; cin >> s >> p;
	s = s + s;
	rep(i, s.size()) {
		bool flag = true;
		rep(j, p.size()) {
			if (s[i+j] != p[j]) {
				flag = false;
				break;
			}
		}
		if (flag)ans = "Yes";
	}
	cout << ans << endl;

}


Measured memory_bytes: 3216
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}
func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

//var done []bool = make([]bool, 10)
//var memo []int = make([]int, 10)

type Group struct {
	Depth int
	Value string
}

type Job struct {
	No     int
	S      int
	E      int
	Worker string
}

type Res struct {
	No int
}

func Abs(a int64, b int64) int64 {
	res := a - b
	if a-b < 0 {
		res = -res
	}
	return res
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	n := next()
	for _, v := range n {
		if v == '7' {
			fmt.Fprintln(out, fmt.Sprint("Yes"))
			return
		}
	}
	fmt.Fprintln(out, fmt.Sprint("No"))
}


Measured memory_bytes: 1760
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if(x < y){
			System.out.println("a < b");
		}else if(x > y){
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}
	}
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    ll score = 0;
    REP(i, N)
    {
        if (S[i] == 'R')
        {
            if (i + 1 <= N - 1 && S[i + 1] == 'R') score++;
        }
        else if (S[i] == 'L')
        {
            if (i - 1 >= 0 && S[i - 1] == 'L') score++;
        }
    }

    ll right = 0, rightTail = 0;
    ll start;
    bool flag = false;
    REP(i, N)
    {
        if (flag)
        {
            if (S[i] == 'L')
            {
                if (start != 0) right++;
                else rightTail++;
                flag = false;
            }
        }
        else
        {
            if (S[i] == 'R')
            {
                flag = true;
                start = i;
            }
        }
    }
    if (flag && start != 0) rightTail++;

    ll left = 0, leftTail = 0;
    flag = false;
    REP(i, N)
    {
        if (flag)
        {
            if (S[i] == 'R')
            {
                if (start != 0) left++;
                else leftTail++;
                flag = false;
            }
        }
        else
        {
            if (S[i] == 'L')
            {
                flag = true;
                start = i;
            }
        }
    }
    if (flag && start != 0) leftTail++;

    ll scoreRight = score;
    REP(i, K)
    {
        if (i < right)
        {
            scoreRight += 2;
        }
        else if (i - right < rightTail)
        {
            scoreRight++;
        }
    }

    ll scoreLeft = score;
    REP(i, K)
    {
        ll st, len;
        if (i < left)
        {
            scoreLeft += 2;
        }
        else if (i - left < leftTail)
        {
            scoreLeft++;
        }
    }

    ll ans = max(scoreRight, scoreLeft);

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
 
LL mod = 1000000007;
const LL maxn = 100004;

int main()
{
	LL n, k, r, s, p;
	cin >> n >> k >> r >> s >> p;

	string t;
	cin >> t;

	LL pt = 0;

	string m(t);

	vector<LL> win(n, 0);

	for (LL i = 0; i < k; ++i) {
		if (m[i] == 'r') {
			m[i] = 'p';
			pt += p;
		}
		else if (m[i] == 's') {
			m[i] = 'r';
			pt += r;
		}
		else {
			m[i] = 's';
			pt += s;
		}
		win[i] = 1;
	}

	for (LL i = k; i < n; ++i) {
		char prev = m[i-k];
		if (m[i] == 'r') {
			m[i] = 'p';
			//pt += p;
		}
		else if (m[i] == 's') {
			m[i] = 'r';
			//pt += r;
		}
		else {
			m[i] = 's';
			//pt += s;
		}
		if (m[i] == prev && win[i-k]) {
			m[i] = t[i];
		}
		else {
			win[i] = 1;
			if (m[i] == 'r') {
				pt += r;
			}
			else if (m[i] == 'p') {
				pt += p;
			}
			else {
				pt += s;
			}
		}
	}

	cout << pt << endl;



}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

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

    vector<int> c(n);
    vector<vector<int>> color(1e6);
    for(int i=0; i<n; i++){
        cin >> c[i];
        color[c[i]].push_back(i);
    }
    
    vector<long long int> dp(n+1);
    dp[0] = 1;
    for(int i=0; i<n; i++){
        dp[i+1] += dp[i];

        int j = lower_bound(color[c[i]].begin(), color[c[i]].end(), i) - color[c[i]].begin();
        if(j >= 1 && color[c[i]][j-1] < i-1) dp[i+1] += dp[color[c[i]][j-1] + 1];

        dp[i+1] %= MOD;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 35128
import numpy as np
from itertools import product
import sys
input = sys.stdin.readline

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0]*n
    
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.par[x] = y
            else:
                self.par[y] = x
            
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
uf = UnionFind(H*W)

for i, j in product(range(H), range(W-1)):
    if S[i][j] != S[i][j+1]:
        uf.unite(i*W+j, i*W+j+1)

for i, j in product(range(H-1), range(W)):
    if S[i][j] != S[i+1][j]:
        uf.unite(i*W+j, (i+1)*W+j)

whitecnt = np.zeros(H*W, dtype=int)
blackcnt = np.zeros(H*W, dtype=int)

for i, j in product(range(H), range(W)):
    if S[i][j] == '.':
        whitecnt[uf.find(i*W+j)] += 1
    else:
        blackcnt[uf.find(i*W+j)] += 1

print(np.sum(whitecnt*blackcnt))

Measured memory_bytes: 24956
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sum = 0, count = 0;
        while (true) {
            int n = sc.nextInt();
            int x = sc.nextInt();
            if(n==0 && x==0){
                break;
            }
            for (int i = 1; i <= n; i++) {
                for (int j = i+1; j <= n; j++) {
                    for (int k = j+1; k <= n; k++) {
                        sum=0;
                        if (i == j || i == k || j == k) {
                            
                        } else {
                            sum = i + j + k;
                           
                            if (sum == x){
                                count++;
                            }
                            
                        }
                    }
                }
            }
            System.out.printf("%d\n",count);
            count=0;
        }
        sc.close();
    }
}


Measured memory_bytes: 27184
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int a[2];
  for (int i = 0;i<3;i++) cin >> a[i];
  sort(a,a+3);
  int sum;
  sum = a[0]+a[1]+a[2];
  int dif;
  dif = a[2]*3 - sum;
  if (dif%2 == 0) cout << int(dif/2) << endl;
  else
    cout << int(dif/2)+2 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 300;

int n;
int a[MaxN + 5];
//typedef pair <int, int> Pi;

int main()
{
	while(scanf("%d", &n) != EOF)
	{
		vector < pair<int, int> > ans;
		int Max = 0, Maxpos = 1;
		for(int i = 1; i <= n; i++) {
			scanf("%d", &a[i]);
			if(abs(a[i]) > abs(Max)) {
				Max = a[i];
				Maxpos = i;
			}
		}
		//printf("Max = %d Maxpos = %d\n", Max, Maxpos);
		for(int i = 1; i <= n; i++) {
			if(i == Maxpos) continue;
			ans.push_back(make_pair(Maxpos, i));
		}
		if(Max > 0) {
			for(int i = 2; i <= n; i++)
				ans.push_back(make_pair(i - 1, i));
		}
		else if(Max < 0) {
			for(int i = n - 1; i >= 1; i--)
				ans.push_back(make_pair(i + 1, i));
		}
		printf("%d\n", ans.size());
		for(int i = 0; i < ans.size(); i++)
			printf("%d %d\n", ans[i].first, ans[i].second);
	}
	return 0;
}

Measured memory_bytes: 256
solver::Int->[(Int,Int,Int)]->Int
solver now [] =now
solver now ((c,s,f):sche) = let (r,q)=divMod now f in
                            solver ((max ((r + (if q == 0 then 0 else 1))*f) s)+c) sche

total_solver::[(Int,Int,Int)]->[Int]
total_solver [] = [0]
total_solver sche = (solver 0 sche):(total_solver (tail sche))

n_triple_getter::Int->IO [(Int,Int,Int)]
n_triple_getter 0 = return []
n_triple_getter n = do
  d<-getLine
  let c:s:f:[]=map read (words d)
  rest<-n_triple_getter (n-1)
  return ((c,s,f):rest)

ls_printer::[Int]->IO()
ls_printer [] = return ()
ls_printer (x:xs) = do
  print x
  ls_printer xs

main::IO()
main=do
  nc<-getLine
  let n=read nc
  dat<-n_triple_getter (n-1)
  ls_printer (total_solver dat)

Measured memory_bytes: 1404
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 3e5 + 7;
const int mod = 1e9 + 7;
inline int add(int x, int y) {int res = x + y; if (res >= mod) res -= mod; return res;}
inline int mul(int x, int y) {ll res = (ll)x * y; res -= res / mod * mod; return res;}
int cnt[60][2];
int main()
{
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        ll x; scanf("%lld", &x);
        for (int j = 0; j < 60; j++) cnt[j][x & 1]++, x /= 2;
    }
    int base = 1, ans = 0;
    for (int j = 0; j < 60; j++) ans = add(ans, mul(mul(cnt[j][0], cnt[j][1]), base)), base = mul(base, 2); 
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin>>S;
  
  int A=0,B=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='0')A++;
    else B++;
  }
  cout<< ((A>B)?B*2:A*2) <<endl;
  
}

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

int main(){
int A,B,K;
  cin>>A>>B>>K;
  
  int count=0;
  for(int i=min(A,B); i>=1; i--){
   if(A%i==0 && B%i==0){
     count++;
     if(count==K){cout<<i; return 0;}
   }
  }
  
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

#define EPS (1e-10)

int main(void)
{
  double x1, y1, x2, y2;
  double x3, y3, x4, y4;

  while (~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)){
    if (fabs((x2 - x1) * (x4 - x3) + (y2 - y1) * (y4 - y3)) < EPS){
      puts("YES");
    } else {
      puts("NO");
    }
  }

  return 0;
}

Measured memory_bytes: 612
from math import sqrt


def prime_facts(n: int) -> dict:
    res = {}
    d = 2
    while d * d <= n:
        if n % d == 0:
            res[d] = 1
            n //= d

            while n % d == 0:
                res[d] += 1
                n //= d

        if d == 2:
            d += 1
        else:
            d += 2

    if n > 1:
        res[n] = 1

    return res


def factorization(N: int, M: int) -> int:
    """以下の説明において、F(N, M) はこの関数と同値。

    `a1 x a2 x ... x aN = M (式 1)`
    となる数列 {aN} の組み合わせ数を F(N, M) とする。

    まず、(式 1)より {aN} は全て M の約数であることは明らか。

    ここで、M の約数列を {dm} とする。今、aN = di とすると、
    `a1 x a2 x ... x a{N-1} = M // di`
    が成り立ち、これを満たす数列 {a{N-1}} の組み合わせ数は F(N-1, M//di) である。

    aN は任意の di を取れるので、結局、
    `F(N, M) = sigma{di} F(N-1, M//di) = sigma{di} F(N-1, M)` (式 2)
    が成り立つ。

    さらに、M を場合分けして考える。

    M = 1 のとき、(式 2)より
    `F(N, 1) = F(N-1, 1) = ... = F(1, 1) = 1` (式 3)
    が成り立つ。

    M = p (p は素数)のとき、(式 2)と(式 3)より、
    `F(N, p) = F(N-1, p) + F(N-1, 1) = F(N-1, p) + 1`
    が成り立つ。この漸化式をとけば、
    `F(N, p) = N`
    が成り立つ。

    M = p^k (p は素数)の時、めんどくさい計算の果てに
    `F(N, p^k) = PI{i=0}{k-1}(N+i) / k!`
    が成り立つ。

    M = p1...pk (pi は全て異なる素数)の時、めんどくさい計算の果てに
    `F(N,p1...pk) = N^k`

    M = p1^k1 ... pm^km (pi は全て異なる素数)の時、めんどくさい計算の果てに
    `F(N,p1^k1...pm^km) = F(N,p1^k1)...F(N,pm^km)`
    が成り立つ。
    """
    # pi と fact の初期化
    pi = [1] * 101
    fact = [1] * 101
    for i in range(1, 101):
        pi[i] = (N+i-1) * pi[i-1]
        fact[i] = i * fact[i-1]

    primes = prime_facts(M)
    ret = 1
    for k in primes.values():
        ret *= pi[k] // fact[k]

    return ret % 1000000007


if __name__ == "__main__":
    N, M = map(int, input().split())
    ans = factorization(N, M)
    print(ans)


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

inline long long in() {long long n = 0; char ch = getchar(); bool x = 0;
	while (!isdigit(ch)) x |= (ch == '-'), ch = getchar(); while (isdigit(ch))
	n = (n << 3) + (n << 1) + (ch ^ 48), ch = getchar(); return x ? -n : n;
} inline string instr() {string ret = ""; char ch = getchar();
	while (ch == ' ' || ch == '\n') ch = getchar(); while (ch != ' ' && ch != '\n')
	ret += ch, ch = getchar(); return ret;
}

#ifdef spec
	freopen(".in", "r", stdin);
	freopen(".out", "w", stdout);
#endif

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

	string s = instr();
	long long n = in(), len = s.length();
	if (len == 1)
	{
		printf("%lld\n", n / 2);
		return 0;
	}
	long long t = 1, x = 0;
	for (int i = 1; i < len; i++)
	{
		if (s[i] == s[i - 1]) t++;
		else x += (t / 2), t = 1; 
	}
	if (t == len)
	{
		printf("%lld\n", len * n / 2);
		return 0;
	}
	x += (t / 2);
	x *= n;
	int l = 0, r = 0;
	for (int i = 0; i < len; i++)
		if (s[i] == s[len - 1]) l++;
		else break; 
	for (int i = len - 1; i >= 0; i--)
		if (s[i] == s[0]) r++;
		else break; 
	if (l % 2 && r % 2) x += n - 1;
	printf("%lld\n", x);

  return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
#ディスカバリーチャンネルコードコンテスト2020 B

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
s = sum(a)
l = list(accumulate(a))
m = inf
for i in range(n):
    m = min(m,abs(l[i] - (l[-1]-l[i])))
print(m)

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;

int main(){
	char c;
	cin >> c;
	c += 1;
	cout << c << 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 P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI acos(-1.0)
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int a,b,x;cin>>a>>b>>x;
  if(a<=x && x<=(a+b)){
    P("YES");
  }else{
    P("NO");
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
                    
                    
int main(){
    long N, D, X, Y, ans;
    ans = 0;
    cin >> N >> D;
    for(int i = 0; i < N; i++) {
        cin >> X >> Y;
        if(sqrt(pow(X, 2) + pow(Y, 2)) <= D) {
            ans++;
        }
    }

    cout << ans << endl;
            
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;

const ll maxn=2050;
const ll mod=924844033;
const ll inf=1e9+500;

ll fac[maxn];
ll f[maxn][maxn][4];

ll ch[maxn];

int main(){
    fac[0]=1;
    for(ll i=1;i<maxn;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    ll n,k;
    cin>>n>>k;
    for(ll i=1;i<=n;i++){
        ch[i%k]++;
    }
    f[1][0][0]=1;
    for(ll i=2;i<=n;i++){
        bool yal_be_ghabli=1;
        ll pr=0;
        for(ll j=0;j<k;j++){
            pr+=ch[j];
            if(i==pr+1){
                yal_be_ghabli=0;
            }
        }
        for(ll a=0;a<=n;a++){
            if(yal_be_ghabli){
                f[i][a][0]=(f[i-1][a][0]+f[i-1][a][1]+f[i-1][a][2]+f[i-1][a][3])%mod;
                if(a>=1)
                    f[i][a][1]=(f[i-1][a-1][0]+f[i-1][a-1][1])%mod;
                if(a>=1)
                    f[i][a][2]=(f[i-1][a-1][0]+f[i-1][a-1][2])%mod;
                if(a>=2)
                    f[i][a][3]=(f[i-1][a-2][0])%mod;
            }
            else{
                f[i][a][0]=(f[i-1][a][0]+f[i-1][a][1]+f[i-1][a][2]+f[i-1][a][3])%mod;
            }
        }
    }
    ll ans=fac[n];
    for(ll i=1;i<=n;i++){
        ll z;
        if(i%2==1)z=-1;
        else      z=+1;

        ans+=z*((fac[n-i]*(f[n][i][0]+f[n][i][1]+f[n][i][2]+f[n][i][3]))%mod);
        ans%=mod;
    }
    ans+=mod;
    ans%=mod;
    cout<<ans;
}


Measured memory_bytes: 129152
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

int main() {
	//六日目

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

	int n = 0, m = 0;

	cin >> n >> m;
	
	int a, b;
	bool connect[10][10] = { false };
	

	rep(i, m) {
		cin >> a >> b;
		//接続を保存(順番は問わない) 1 true
		connect[a - 1][b - 1] = true;
		connect[b - 1][a - 1] = true;	
	}
	vector<int> permu(n);
	rep(i, n) {
		permu[i] = i;
	}

	int ans = 0;

	do{
		int isconnect = true;

		if (permu[0] == 1) {
			break; // 一番左(スタート)が、0(実際の数値だと１)でなくなった時点で終了
		}

		rep(i, n - 1) {
			if (connect[permu[i]][permu[i + 1]] == false) {
				isconnect = false;
			}
		}

		if (isconnect == true) {
			ans++;
		}

	} while (next_permutation(permu.begin(), permu.end()));

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <iomanip>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int INF = 0x3f3f3f3f;

inline int read () {
	register int s = 0, w = 1;
	register char ch = getchar ();
	while (! isdigit (ch)) {if (ch == '-') w = -1; ch = getchar ();}
	while (isdigit (ch)) {s = (s << 3) + (s << 1) + (ch ^ 48); ch = getchar ();}
	return s * w;
}


int main() {
	IOS;
	//freopen("D:\\in.txt","r",stdin);
	//freopen("D:\\out2.txt","w",stdout);
	string s;
	int n;
	cin>>n>>s;
	int len=s.size();
	int cnt=0;
	for(int i=0;i<len-2;i++){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
			cnt++;
			i+=2;
		}
	}
	cout<<cnt<<endl;
	


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
typedef pair<long long int,long long int> pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
#define  MAX 200000
long long int MOD=998244353;
long long int INF=1e18;
/*    :-]  */

int main()
{
         ios_base::sync_with_stdio(false);
         cin.tie(NULL);
         cout.tie(NULL);
         long long int i,j,k=0,l=0,r=0,m=0,n,c,p=0,cnt=0,cnt1=0,x,y,z=0,a,b,low,mid,high,ans=0,maxi=0,mini=INF,t,x1,y1;
         cin>>n;
         string s;
         cin>>s;
         low=1;
         high=n-1;
         ans=0;
    while(low<=high)
    {
        mid=(low+high)/2;
        string s1="";
        string s2="";
        x=0;
        map<string,long long int>ma;
        for(i=0;i<mid;i++)
        {
            s1.push_back(s[i]);
        }
        ma[s1]=i-mid;

        for(i=mid;i<n;i++)
        {
            s1.erase(s1.begin());
            s1.push_back(s[i]);

            if(ma.find(s1)!=ma.end())
            {
                if(ma[s1]+mid<=i-mid+1)
                {
                    x=1;
                }
            }
            else
                ma[s1]=i-mid+1;
        }
        if(x==0)
        {
            high=mid-1;
        }
        else
        {
            ans=max(ans,mid);
            low=mid+1;
        }
    }
    cout<<ans<<endl;



}


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

signed main(){
	int N, i, mcount = 0, sum = 0, m = 1000000000;
	cin >> N;
	vector<int> A = vector<int>(N);
	for(i = 0; i < N; i++){
		cin >> A[i];
		if(A[i] < 0){
			mcount++;
			A[i] = -A[i];
		}
		sum += A[i];
		m = min(m, A[i]);
	}
//	printf("sum = %lld\n", sum);
//	printf("m = %lld\n", m);
	if(mcount % 2 == 0){
		cout << sum << endl;
	}
	else{
		cout << sum - 2 * m << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    int x;
    cin >> x;
    int t = x/500;
    x -= t*500;
    int x2 = x / 5;
    cout << t*1000 + x2 * 5 << endl;
    return 0;
}

Measured memory_bytes: 256