akhauriyash/Code-Regression huggingface dataset:
S=input()
T=input()

for i in reversed(range(len(S)-len(T)+1)):
    st=S[i:i+len(T)]
    t=1
    for j in range(len(T)):
        if(st[j]!='?' and st[j]!=T[j]):
            t=0
            break
    if(t==1):
        S=S.replace('?','a')
        print(S[:i]+T+S[i+len(T):])
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
#include <iostream>
#include <string>

using namespace std;

int main(){	
		int n, d, t;
		string a;
		cin >> n;
		a = to_string(n);
		t = a.size();
		for(int i = 0; i < t; i++){	
			if(a[i] == '7'){	
					d++;
			}
		}
		if(d != 0){	
				cout << "Yes";
		}else{	
				cout << "No";
		}
}


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

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    rep(i,N) cin >> S[i];

    long ans = 0;
    int A = 0; // back -> A
    int B = 0; // top -> B
    int AB = 0; // top -> B && back -> A

    rep(i,N){
        bool topB = false;
        rep(j,S[i].size()-1){
            if(S[i][j] == 'A' && S[i][j + 1] == 'B') ans++;
            if(j == 0 && S[i][j] == 'B') B++,topB = true;
            if(j == S[i].size()-2 && S[i][j + 1] == 'A'){
                A++;
                if(topB) AB++,A--,B--;
            }
        }
    }

    if(AB) ans += AB-1;
    if(A && AB) A--,ans++;
    if(B && AB) B--,ans++;
    ans += min(A,B);
    cout << ans << endl;
}


Measured memory_bytes: 768
/////////////////////////////////////////////////////////////////////////////////
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'               `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//  
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$'                   `$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
//$$$'`$$$$$$$$$$$$$'`$$$$$$!                       !$$$$$$'`$$$$$$$$$$$$$'`$$$//
//$$$$  $$$$$$$$$$$  $$$$$$$                         $$$$$$$  $$$$$$$$$$$  $$$$//
//$$$$. `$' \' \$`  $$$$$$$!       $$        $$      !$$$$$$$  '$/ `/ `$' .$$$$//
//$$$$$. !\  i  i .$$$$$$$$       $$$$      $$$$      $$$$$$$$. i  i  /! .$$$$$//
//$$$$$$   `--`--.$$$$$$$$$        $$        $$       $$$$$$$$$.--'--'   $$$$$$//
//$$$$$$L        `$$$$$^^$$                           $$^^$$$$$'        J$$$$$$//
//$$$$$$$.   .'   ""~   $$$    $.                 .$  $$$   ~""   `.   .$$$$$$$//
//$$$$$$$$.  ;      .e$$$$$!    $$.             .$$  !$$$$$e,      ;  .$$$$$$$$//
//$$$$$$$$$   `.$$$$$$$$$$$$     $$$.         .$$$   $$$$$$$$$$$$.'   $$$$$$$$$//
//$$$$$$$$    .$$$$$$$$$$$$$!     $$`$$$$$$$$'$$    !$$$$$$$$$$$$$.    $$$$$$$$//
//$$$$$$$     $$$$$$$$$$$$$$$$.    $    $$    $   .$$$$$$$$$$$$$$$$     $$$$$$$//
//                                 $    $$    $								   //
//                                 $.   $$   .$								   //
//                                `$        $'								   //
//                                 `$$$$$$$$'								   //
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

#include <bits/stdc++.h>
using namespace std;

// Type-Define 
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef std::vector<char> vc;
typedef std::vector< vector<int> > vii;
typedef std::pair<int, int> pii;

// Hash-Define
#define int long long
#define MOD 1000000007
#define debugStart cerr << "\n[DEBUG START]\n"
#define debugStop cerr << "\n[DEBUG STOP]\n"
#define KHATAM cout << std::endl;
#define set_zero(x) memset(x, 0, sizeof(x));
#define ForPrint(x) std::for_each( begin(x), end(x), []( auto const& el ){ std::cout << el << " ";  } )

//Functions 
template<typename T> auto gcd ( T a, T b ) -> int  { return (b==0)?a:gcd(b,a%b); }

const int inf = 1e9 + 5;
const int mod = 1e9 + 7;
signed
main() {

    ios::sync_with_stdio(0);
    cin.tie(0);
    int T = 1; 
    //cin >> T;
    for ( int testcase = 1; testcase <= T; ++testcase ) {
        int N, K;
        std::cin >> N >> K;
        int dp[K + 1];
        int arr[N];
        for( int i = 0; i < N; ++i )
            std::cin >> arr[i]; 

        // dp[i] = number of ways at i candies
        set_zero(dp);
        dp[0] = 1;
        for ( int i = 0; i < N; ++i ) {
            int pre_sum[K+1];
            pre_sum[0] = dp[0];
            for ( int i = 1; i <= K; ++i ) {
                pre_sum[i] = (pre_sum[i-1] + dp[i]) % mod;
            }

            for ( int k = K; k > 0; --k ) {
                dp[k] = dp[k] + (mod +  pre_sum[k-1] - (k - arr[i]-1 >= 0 ?  pre_sum[k - arr[i] - 1] : 0) )%mod;
            }
        }
        std::cout << dp[K] % mod;
        KHATAM;
    }
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

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

        sc.close();
    }
}

Measured memory_bytes: 21716
h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
t = [[(s[i][j] == '.') for j in range(w)] for i in range(h)]
flag = True
for i in range(1,h):
	for j in range(w):
		if s[i-1][j] == '#' and s[i][j] == '#':
			t[i-1][j] = True
			t[i][j] = True
for i in range(h):
	for j in range(1,w):
		if s[i][j-1] == '#' and s[i][j] == '#':
			t[i][j-1] = True
			t[i][j] = True
for i in range(h):
	for j in range(w):
		if not t[i][j]:
			flag = False
print("Yes" if flag else "No")


Measured memory_bytes: 3064
def digits_sum(n):
    d = 0
    m = n
    while m:
        d += m % 10
        m //= 10
    return d


def is_harshad_number(n):
    if n % digits_sum(n) == 0:
        return True
    else:
        return False


N = int(input())

if is_harshad_number(N):
    print('Yes')
else:
    print('No')

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

int top, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop() {
  top--;
  return S[top+1];
}

int main() {
  int a, b;
  top = 0;
  char s[100];
  
  while ( scanf("%s", s) != EOF ) {
    if ( s[0] == '+' ) {
      a = pop();
      b = pop();
      push(a + b);
    } else if ( s[0] == '-' ) {
      b = pop();
      a = pop();
      push(a - b);
    } else if ( s[0] == '*' ) {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
  
  printf("%d\n", pop());
  
  return 0;
}


Measured memory_bytes: 2132
using System;

class Program
{
    static void Main(string[] args) {
        string s = Console.ReadLine();
        Console.WriteLine(solve1(s) == true && solve2(s) == true && solve3(s) == true ? "AC" : "WA");
    }
    static bool solve1(string s) {
        return s[0]=='A';
    }
    static bool solve2(string s) {
        for (int i = 2; i < s.Length-1; i ++) {
            if (s[i]=='C') return true;
        }
        return false;
    }
    static bool solve3(string s) {
        int count = 0;
        for (int i = 0; i < s.Length; i ++) {
            if(char.IsUpper(s[i])) count ++;
        }
        return count == 2;
    }
}

Measured memory_bytes: 11092
import itertools

def main():
    N = map(int, input().split())
    L = list(map(int, input().split()))
    L.sort()

    if len(L) < 3:
        print(0)
        exit()

    cnt = 0
    for a, b, c in itertools.combinations(L, 3):
        if a==b or b==c or c==a:
            continue
        if a + b > c:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

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

int main(){
  int N;
  cin >>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >>A.at(i);
  }
  int count_A =0;
  for(int x:A){
    if((x%2 ==0)&(x%3 == 0||x%5 ==0)){
      count_A ++;
    }
  }
  int count_B =0;
  for(int x:A){
    if(x%2 == 0){
      count_B ++;
    }
  }
  if(count_A ==count_B){
    cout <<"APPROVED"<<endl;
  }
  else{
    cout <<"DENIED"<<endl;
  }
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(*args):
    print(*args,file=sys.stderr)

def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
     
#input

def resolve():
    N,=pin()
    ans=1
    
    mod=7+(pow(10,9))
    for i in range(1,N+1):
        ans*=i        
        ans%=mod
    print(ans)
    
        #print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
#if __name__=="__main__":resolve()

"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """10"""
        output = """3628800"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """100000"""
        output = """457992974"""
        self.assertIO(input, output)

if __name__=="__main__":resolve()

Measured memory_bytes: 83308
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long int
#define LL_MAX 9223372036854775807
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define vl vector<ll>
#define bs(v, x) binary_search(v.begin(), v.end(), x)
#define popf pop_front
#define p() cout << '\n'
#define p0(x) cout << x << " "
#define p1(x) cout << x << '\n'
#define p2(x, y) cout << x << " " << y << '\n'
#define p3(x, y, z) cout << x << " " << y << " " << z << '\n'
#define printv(v)                   \
  for (ll i = 0; i < v.size(); ++i) \
    cout << v[i] << " ";            \
  cout << '\n'
#define pr1(x) cout << fixed << setprecision(15) << x << '\n'
#define mod 1000000007
#define mod1 998244353
#define fio                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define get(n) \
  ll n;        \
  cin >> n
#define getvec(v, n)         \
  vector<ll> v(n);           \
  for (ll i = 0; i < n; i++) \
    cin >> v[i];
#define getstr(s) \
  string s;       \
  cin >> s
#define all(x) x.begin(), x.end()
#define countBits(x) __builtin_popcount(x)
using namespace std;

void mainSolve()
{
  get(n);
  getvec(v, n);
  ll ans = 0;
  for (int i = 0; i < n; i += 2)
  {
    if (v[i] % 2 == 1)
      ++ans;
  }
  p1(ans);
}

int main()
{
  fio;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  // get(t);
  ll t = 1;
  while (t--)
  {
    mainSolve();
  }
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N,A,B;
  cin>>N>>A>>B;
  if(N*A<B) {
    cout<<N*A<<endl;
  }
else {
cout<<B<<endl;
}
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    for (int i=0; i<k; i++) {
        if (a >= b) {
            b *= 2;
        } else if (b >= c) {
            c *= 2;
        }
    }
    
    cout << (a<b&&b<c?"Yes":"No") << endl;
}


Measured memory_bytes: 3128
#include<stdio.h>
int main()
{
	int i, j;
	int H, W;
	
	
    scanf("%d%d", &H, &W);

	while (H != 0 || W != 0) {
		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) {
				printf("#");
			}printf("\n");
		}
		printf("\n");
		scanf("%d%d", &H, &W);
	}


}

Measured memory_bytes: 572
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    count = 0
    for a in range(0, A + 1):
        for b in range(0, B + 1):
            for c in range(0, C + 1):
                total = 500 * a + 100 * b + 50 * c
                if total == X:
                    count += 1
    print(count)

main()


Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int N,a[200000],flag=1;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	scanf("%d",&a[i]);
	sort(a,a+N);
	for(int i=1;i<N;i++)
	{
		if(a[i]==a[i-1])
		{
			flag=0;
			break;
		}
	}
	if(flag==1)	printf("YES\n");
	else	printf("NO\n");
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        UL N; cin >> N;
        UL a = 0, b = 0;
        rep(i, N) {
            string S, T; cin >> S >> T;
            if (S < T) b += 3;
            else if (S == T) { a += 1; b += 1; }
            else a += 3;
        }
        cout << a << " " << b << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



Measured memory_bytes: 3172
K = int(input())

A = list(map(int, input().split()))

# ここの上でK=1の場合を書いてしまったので無限にWAだした
if A[-1] != 2:
    print(-1)
    exit()

big = 2
small = 2
for i in reversed(range(K)):
    """
    smallのときにai人組つくると脱落者なし
    bigのときにai人組作るとai-1人脱落

    """


    # smallは元のsmall以上かつ、脱落者なし
    """
    ・smallはaiで割り切れる（脱落者なし）
    ・元のsmall以上の値
    """

    if small // A[i] > 0 and small % A[i] > 0:
        small = (small // A[i] + 1) * A[i]
    elif small // A[i] > 0 and small % A[i] == 0:
        small = small
    elif small // A[i] == 0:
        small = A[i] 
        
    # bigは元のbig以上かつ、脱落者がai-1
    big = (big // A[i]) * A[i] + A[i] - 1

    if big < small:
        print(-1)
        exit()


print(small, big)


Measured memory_bytes: 14324
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,m = readInts()
    # 各電球 i について、 si1, si2, ..., sik のうち、 onのスイッチが何個かを数える
    # それが偶数か奇数かによって、電球 i が付いているかどうかが分かる
    A = []
    for i in range(m):
        A.append(list(map(lambda x: int(x) - 1, input().split()))[1:])
    P = readInts()
    ans = 0

    for bit in range(1 << n):
        ok = True
        for i in range(m):
            con = 0
            for v in A[i]:
                #print(v)
                if bit & 1 << v:
                    con += 1
            if con % 2 != P[i]:
                ok = False
        if ok:
            ans += 1
    print(ans)


if __name__ == '__main__':
  main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,sum,p,x,y;
  cin >> N;
  sum = x = 0;
  p=100000000;
  for (int i = 0;i<N; i++){
    cin >> y;
    sum =0;
      for(int j = 0;j<p;j++){
        if(y % 2 == 0){
          y /= 2;
        sum++;
        }
        else{
          p = sum;
        break;
      }
      }
  }
  cout << p << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n = s.size();

    int p[256] = {};
    for (int i = 0; i < n; i++) {
        p[s[i]]++;
    }

    int b = 0;
    for (int j = 0; j < 256; j++) {
        if (p[j] == 2) b++;
    }

    cout << (b == 2 ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 17;

bool vis[maxN];
char out[maxN];

void solve()
{
	int n, m;
	scanf ("%d%d", &n, &m);
	
	if (n == 1 and m == 0)
	{
		printf("0\n");
		return;
	}
	
	out[n] = 0;
	bool fail = false;
	while (m--)
	{
		int a, b;
		scanf ("%d%d", &a, &b);
		a--;
		if (vis[a] and (out[a] - '0') != b)
			fail = true;
		else
			out[a] = ('0' + b), vis[a] = true;
	}
	
	if (n != 1 and vis[0] and out[0] == '0')
		fail = true;
		
	FOR(i, 0, n)
	 	if (!vis[i])
	 		out[i] = i == 0 ? '1' : '0';
	 if (fail)
	 	printf("-1\n");
	 else
	 	printf("%s\n", out);
} 
 
int main()
{
    int t;
    t = 1;//scanf ("%d", &t);
    while (t--)
    	solve();
    return 0;    
}




Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  double v=0;
  double t,y;
  int N;
  while(scanf("%lf",&v)!=EOF){
    t=0; y=0; N=0;
    t = v/9.8;
    y = 4.9*t*t;
    for(N=1;;N++){
      if(y <= (5*N-5)){break;}
    }
    printf("%d\n",N);
  }
  return 0;
}



Measured memory_bytes: 1984
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int X, N;
	cin >> X >> N;
	set<int> st;
	REP(i, N) {
		int p;
		cin >> p;
		st.insert(p);
	}
	int res = 0;
	int diff = INT_MAX;
	REP(i, 102) {
		if (!st.count(i) && abs(X - i) < diff) {
			diff = abs(X - i);
			res = i;
		}
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 3644
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
cnt = 0
for i in range(1, n+1):
    if len(str(i))&1:
        cnt += 1
print(cnt)











Measured memory_bytes: 26452
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

const int MAX = 5100000;
const int MOD = 1000000007;

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

    ll tmp = 1;
    ll tmp2 = 1;
    for(int i=1; i<=n; i++){
        tmp *= i;
        tmp %= MOD;
    }

    for(int i=1; i<=m; i++){
        tmp2 *= i;
        tmp2 %= MOD;
    }

    if(n==m){
        tmp *= tmp2;
        dump(tmp);
        tmp %= MOD;
        tmp *= 2LL;
        tmp %= MOD;
    }
    else {
        if(abs(n-m)==1){
            tmp *= tmp2;
            tmp %= MOD; 
        }
        else{
            cout << 0 << endl;
            return 0;
        }
    }

    cout << tmp << endl;

    return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
ans = 0
for i in range(2 ** (n - 1)):
    tmp = s[0]
    for j in range(n - 1):
        if ((i >> j) & 1):
            tmp += '+'
        tmp += s[j+1]
    ans += eval(tmp)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  int a[n],b[n],c[n-1];
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n-1;i++)cin>>c[i];
  for(int i=0;i<n;i++)a[i]--;
  int ans=0;
  for(int i=0;i<n;i++){
    ans+=b[a[i]];
  }
  for(int i=0;i<n-1;i++){
    if(a[i]+1==a[i+1])ans+=c[a[i]];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n = int(input())
al = list(map(int, input().split()))
t = al[0]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


for i in range(1, n):
    t = gcd(t, al[i])  # a,bの最大公約数


print(t)


Measured memory_bytes: 62704
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

const double EPS = 1e-8;

int calc(double x, double a, int n, int w) {
  int ret = 0;
  if (w>a||n==0) return 0;
//  printf("%d, %lf, %lf, %d\n", n, x,a,w);  
  for(double i=w; i<=a;i++) {
    if (x-1/i>EPS) {
      ret += calc(x-1/i, a/i, n-1, i);
    }
    if (abs(x-1/i)<EPS) {
      //    printf("%d, %lf, %lf, %d, %lf\n", n, x,a,w,i);  
      ret++;
    }
  }
  return ret;
}

int main() {
  int p,q,a,n;
  while(cin>>p>>q>>a>>n,a+p+q+n) {
    cout << calc((double)p/q,a,n,1) << endl;
  }
}

Measured memory_bytes: 868
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) ((int)x.size())
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> pos;
    vector<ll> neg;
    vector<ll> zer;
    F0R(i, n)
    {
        int tmp;
        cin >> tmp;
        if(tmp > 0) pos.pb(tmp);
        if(tmp < 0) neg.pb(tmp);
        if(tmp == 0) zer.pb(tmp);
    }
    vector<ll> v;
    int p = sz(pos), ne = sz(neg), z = sz(zer);
    F0R(i, sz(pos)) v.pb(pos[i]);
    F0R(i, sz(neg)) v.pb(-1 * neg[i]);
    F0R(i, sz(zer)) v.pb(0);
    ll xres = 0;
    if(p > 0 && ne > 0 || z > 0)
    {
        F0R(i, n)
        {
            xres += v[i];
        }
    }
    else
    {
        sort(v.begin(), v.end());
        FOR(i, 1, n)
        {
            xres += v[i];
        }
        xres -= v[0];
    }
    cout << xres << "\n";
    if(sz(neg) == 0 && sz(zer) != 0) neg = zer;
    else
    {
        F0R(i, sz(zer)) pos.pb(zer[i]);
    }
    if(sz(pos) > 0 && sz(neg) > 0)
    {
        ll pres = neg[0], nres = pos[0];
        FOR(i, 1, sz(pos))
        {
            cout << pres << " " << pos[i] << "\n";
            pres -= pos[i];
        }
        FOR(i, 1, sz(neg))
        {
            cout << nres << " " << neg[i] << "\n";
            nres -= neg[i]; 
        }
        cout << nres << " " << pres;
    }
    else
    {
        if(sz(pos) > 0)
        {
            sort(pos.begin(), pos.end());
            ll res = pos[0];
            FOR(i, 1, sz(pos) - 1)
            {  
                cout << res << " " << pos[i] << "\n";
                res -= pos[i];
            }
            cout << pos[sz(pos) - 1] << " " << res << "\n";
        }
        else
        {
            sort(neg.begin(), neg.end(), greater<int>());
            ll res = neg[0];
            FOR(i, 1, sz(neg))
            {  
                cout << res << " " << neg[i] << "\n";
                res -= neg[i];
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4852
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
ll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans.sz+1;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol(const vector<int>& v1, 
               const vector<int>& v2){ 
 return v1[0] < v2[0]; } 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }

vll s()
{
	ll N=10000000;
	vll cnt(N,0);
	for(ll i=1;i<=N;i++)
		for(ll j=i;j<=N;j+=i)
			cnt[j]++;
	return cnt;
}

void solve()
{	
	
	ll n,ans=0;
	vll cnt=s();
	cin>>n;
	for(ll i=1;i<=n;i++)
		ans+=(i*cnt[i]);
	cout<<ans;
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


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

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    vector<ll> a,b,c;
    for(ll i=0;i<n;i++){
        if(s[i] == 'R')
            a.pb(i);
        else if(s[i]=='G')b.pb(i);
        else c.pb(i);
    }    
    map<ll,ll> MAP_c,MAP_a,MAP_b;
    for(auto it : c)
        MAP_c[it]++;
    for(auto it : a)
        MAP_a[it]++;
    for(auto it : b)
        MAP_b[it]++;
        
    ll tot=0;
    for(ll i=0;i<a.size();i++){
        for(ll j=0;j<b.size();j++){
            if(a[i] > b[j])
                continue;
            ll no = 2*b[j] - a[i];
            auto it = upper_bound(c.begin(),c.end(),b[j]);
            ll cnt = c.end() - it;

            if(MAP_c[no])
                tot += cnt - 1;
            else tot += cnt;
        }
    }
    //cout << tot << " ";
    for(ll i=0;i<b.size();i++){
        for(ll j=0;j<a.size();j++){
            if(b[i] > a[j])
                continue;
            ll no = 2*a[j] - b[i];
            auto it = upper_bound(c.begin(),c.end(),a[j]);
            ll cnt = c.end() - it;

            if(MAP_c[no])
                tot += cnt - 1;
            else tot += cnt;
        }
    }


    for(ll i=0;i<a.size();i++){
        for(ll j=0;j<c.size();j++){
            if(a[i] > c[j])
                continue;
            ll no = 2*c[j] - a[i];
            auto it = upper_bound(b.begin(),b.end(),c[j]);
            ll cnt = b.end() - it;
            //cout << "askjdjh " << cnt << " ask";
            if(MAP_b[no])
                tot += cnt - 1;
            else tot += cnt;
        }
    }
    //cout << tot << " ";
    for(ll i=0;i<c.size();i++){
        for(ll j=0;j<a.size();j++){
            if(c[i] > a[j])
                continue;
            ll no = 2*a[j] - c[i];
            auto it = upper_bound(b.begin(),b.end(),a[j]);
            ll cnt = b.end() - it;

            if(MAP_b[no])
                tot += cnt - 1;
            else tot += cnt;
        }
    }
    
    for(ll i=0;i<b.size();i++){
        for(ll j=0;j<c.size();j++){
            if(b[i] > c[j])
                continue;
            ll no = 2*c[j] - b[i];
            auto it = upper_bound(a.begin(),a.end(),c[j]);
            ll cnt = a.end() - it;

            if(MAP_a[no])
                tot += cnt - 1;
            else tot += cnt;
        }
    }
    //cout << tot << " ";
    for(ll i=0;i<c.size();i++){
        for(ll j=0;j<b.size();j++){
            if(c[i] > b[j])
                continue;
            ll no = 2*b[j] - c[i];
            auto it = upper_bound(a.begin(),a.end(),b[j]);
            ll cnt = a.end() - it;

            if(MAP_a[no])
                tot += cnt - 1;
            else tot += cnt;
        }
    }

    cout << tot ;
}

int main(){
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 5076
from bisect import bisect_left, bisect_right
n,d,a=map(int,input().split())
l=[]
ans=0
for i in range(n):
    x,h=map(int,input().split())
    l.append((x,-(-h//a)))
l.sort()
back=[-1]
rui=[0]
for x,h in l:
    i=bisect_left(back,x)
    h-=rui[-1]-rui[i-1]
    if h<=0:
        continue
    ans+=h
    back.append(x+d*2)
    rui.append(rui[-1]+h)
print(ans)

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

typedef long long int lli;
typedef vector<int> vi;
typedef vector<lli> vii;
typedef priority_queue <lli, vii, greater<lli>> min_heap;
typedef tree<lli, null_type, less_equal<lli>, rb_tree_tag, tree_order_statistics_node_update> order_set;
// find_by_order() returns an iterator to the k-th largest element (counting from zero)
// order_of_key() returns the number of items in a set that are strictly smaller than our item

#define INF 1LL << 40 

 
lli power(lli x, lli y) 
{ 
    lli temp; 
    if( y == 0)    return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0)  return (temp*temp); 
    else           return (x*temp*temp); 
} 
 
lli power_mod(lli x, lli y, lli n) 
{ 
    lli temp; 
    if( y == 0)    return 1; 
    temp = power_mod(x, y/2, n)%n; 
    if (y%2 == 0)  return (temp*temp)%n; 
    else           return (x*((temp*temp)%n))%n; 
}  
 
lli gcd(lli a, lli b) 
{ 
    if (b == 0)   return a; 
    return gcd(b, a % b);        
} 
  
lli factorial(int n)
{
    int ans = 1;
    for(int i=n;i>=1;i--)  ans *= i;
    return ans;
}
 
// functions to calculate fibonacci numbers begin......
void matrix_multiply(lli F[2][2], lli M[2][2]) 
{ 
  lli n = 1000000007;
  lli x =  ((F[0][0]*M[0][0])%n + (F[0][1]*M[1][0])%n)%n; 
  lli y =  ((F[0][0]*M[0][1])%n + (F[0][1]*M[1][1])%n)%n; 
  lli z =  ((F[1][0]*M[0][0])%n + (F[1][1]*M[1][0])%n)%n; 
  lli w =  ((F[1][0]*M[0][1])%n + (F[1][1]*M[1][1])%n)%n; 
  
  F[0][0] = x; 
  F[0][1] = y; 
  F[1][0] = z; 
  F[1][1] = w; 
} 
 
void matrix_power(lli F[2][2], lli n) 
{ 
  if( n == 0 || n == 1)   return; 
  lli M[2][2] = {{1,1},{1,0}}; 
  matrix_power(F, n/2); 
  matrix_multiply(F, F); 
  if (n%2 != 0)   matrix_multiply(F, M); 
} 
  
lli fib(lli n) 
{ 
  lli F[2][2] = {{1,1},{1,0}}; 
  if (n == 0)  return 0; 
  matrix_power(F, n-1); 
  return F[0][0]; 
} 
 
//functions to calculate fibonacci numbers ends.....

lli dp[100001]; 
 
int main()
{   
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
 
  lli n,W;
  cin >> n >> W;
  lli w[n], v[n], V=0;
  for(int i=0;i<n;i++)
  {
    cin >> w[i] >> v[i];
    V += v[i];
  }
  for(int i=0;i<=V;i++)  dp[i] = INF;
  dp[0]=0;
  for(int i=0;i<n;i++)
     for(int j=V;j>=v[i];j--)   dp[j] = min(dp[j], dp[j-v[i]]+w[i]);
  for(int i=V;i>=0;i--)
     if(dp[i]<=W)   {cout << i; return 0;}       
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std ; 
int main()
{
  int n , temp ; 
  cin>>n ; 
  temp = n  ; 
  int su = 0 ; 
  while(n> 0 )
  {
    su += n%10 ; 
    n/=10 ; 
  }
  if(temp % su == 0 )
    	cout << "Yes"  ; 
  else
    	cout <<"No" ; 
}

Measured memory_bytes: 256
//author Eterna
#define Hello the_cruel_world!
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<cmath>
#include<climits>
#include<deque>
#include<functional>
#include<numeric>
#include<unordered_map>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define ABS(x) ((x) >= 0 ? (x) : (-(x)))
#define pb(x) push_back(x)
#define lowbit(x) (x & -x)
#define FRIN freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\in.txt", "r", stdin)
#define FROUT freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\out.txt", "w", stdout)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define outd(x) printf("%d\n", x)
#define outld(x) printf("%lld\n", x)
#define il inline
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 1e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
inline int read_int() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll read_ll() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
int n;
vector<pii> res;
int main()
{
	n = read_int();
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j) {
			if ((n & 1) && i + j != n)res.push_back(pii(i, j)); 
			if (!(n & 1) && i + j != n + 1)res.push_back(pii(i, j));
		}
	cout << res.size() << endl;
	for (int i = 0; i < res.size(); ++i)cout << res[i].first << " " << res[i].second << endl;
	//system("pause");
	return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, M; cin >> N >> M;
	int Q; cin >> Q;
	vector<int>L(M), R(M); rep(i, 0, M) { cin >> L[i] >> R[i]; }
	vector<int>p(Q), q(Q); rep(i, 0, Q) { cin >> p[i] >> q[i]; }


	vector<vector<int>>dp(550, vector<int>(550));
	rep(i, 0, M) {
		dp[L[i]][R[i]]++;
	}
	rep(i, 1, dp.size()) {
		rep(j, 1, dp.size()) {
			dp[i][j] += dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
		}
	}

	rep(i, 0, Q) {
		cout << dp[dp.size() - 1][q[i]] - dp[p[i] - 1][q[i]] << endl;
	}




	return 0;
}


Measured memory_bytes: 8064
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;

string s;
LL flg = 1;

int main(){
	LL len;
	cin >> s; len = s.length();
	if(len & 1) flg = 0;
	for(LL i = 0;i < len;i ++){
		if((i % 2 == 1) && s[i] != 'i') flg = 0;
		if((i % 2 == 0) && s[i] != 'h') flg = 0;
	}
	cout << (flg ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    string s;
    bool ans = true;
    cin >> s;
    if(s[2]!=s[3]){
        ans = false;
    }
    if(s[4]!=s[5]){
        ans = false;
    }
    if(ans==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main(void){
    int n, c[20], v[20], result = 0;
    cin >> n;
    
    for(int i = 0; i < n; i++) cin >>v[i];
    for(int i = 0; i < n; i++) cin >>c[i];

    for(int i = 0; i < n; i++){
        if((v[i] - c[i]) > 0) result += (v[i] - c[i]);
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#pragma comment(linker, "/STACK:250000000")

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <complex>
#include <functional>
#include <numeric>
#include <random>
#include <cstring>
#include <ctime>
#include <cassert>

#define y1 klfjvkldfngldf

using namespace std;

typedef long long LL;

int n, m, h, w;

int a[500][500];
LL s[501][501];

bool check()
{
	memset(s, 0, sizeof(s));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			s[i + 1][j + 1] = s[i][j + 1] + s[i + 1][j] - s[i][j] + a[i][j];

	bool bad = 0;
	for (int i = 0; i <= n - h; ++i)
	{
		for (int j = 0; j <= m - w; ++j)
		{
			LL sum = s[i + h][j + w] - s[i + h][j] - s[i][j + w] + s[i][j];
			bad |= sum >= 0;
		}
	}

	bad |= s[n][m] <= 0;
	return !bad;
}

int main()
{
	cin >> n >> m >> h >> w;

	if (h == 1 && w == 1)
	{
		cout << "No\n";
		return 0;
	}

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			a[i][j] = 1;

	for (int i = h - 1; i < n; i += h)
		for (int j = w - 1; j < m; j += w)
			a[i][j] = -(int)1e9;

	for (int i = 0; i < n; i += h)
		for (int j = 0; j < m; j += w)
			a[i][j] = (int)1e9 - (h * w - 2) - 1;

	if (check())
	{
		cout << "Yes\n";
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < m; ++j)
				cout << a[i][j] << " ";
			cout << '\n';
		}
		return 0;
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 5888
program abc094b
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,a_max, ha1,ha2, d, ii
    integer(int32), allocatable:: a(:)

    read*, n
    allocate(a(n))
    read*, a(:)
    a_max = maxval(a)
    ha1 = a_max/2
    ha2 = ha1 + mod(a_max,2)
    d = 1000000000
    ii = 0
    do i=1,n
        if (d <= abs(ha1-a(i)) .and. d <= abs(ha2-a(i))) cycle
        if (a_max <= a(i)) cycle
        d = min(abs(ha1-a(i)), abs(ha2-a(i)))
        ii = i
    end do

    print'(*(i0,1x))', a_max, a(ii)
end program abc094b

Measured memory_bytes: 1536
# N は 1 以上 100 以下の整数
n = int(input())
flag = False
for a in range(int(100/4)+1):
    if flag:
        break

    for b in range(int(100/7)+1):
        # print("4*{}+7*{} = {}".format(a, b, 4*a+7*b))
        if 4*a+7*b == n:
            flag = True
            break
        if 4*a+7*b > n:
            next

print('Yes' if flag else 'No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int doit()
{
    int h, w;
    cin >> h >> w;
    char array[h][w];
    for (int i = 0; i < h;i++){
        for (int j = 0; j < w;j++){
            cin >> array[i][j];

        }
    }
    for (int i = 0; i < h;i++){
        for (int j = 0; j < w;j++){
            if(array[i][j] == '.'){
                continue;
            }
            int a = 0;
            if (i > 0 && array[i-1][j] == '#'){
                continue;
            }
            if (j > 0 && array[i][j-1] == '#'){
                continue;
            }
            if (j < w - 1 && array[i][j+1] == '#'){
                continue;
            }
            if (i < h-1&& array[i+1][j] == '#'){
                continue;
            }
            return 1;
        }
    }
    return 0;
}

int main()
{
    if(doit() == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String str_scan = scan.nextLine();
    // int型へ変換
    var ans = Integer.parseInt(str_scan);

    if (ans == 1){
      ans = 0;
    } else {
      ans = 1;
    }

    System.out.println(ans);
    scan.close();
  }
}

Measured memory_bytes: 35540
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int n, m, i, j, k, ans;
	cin >> n >> m;
	vector<int> a(m);
	for (i = 0; i < m; i++) cin >> a[i];
	sort(a.begin(), a.end());
	priority_queue<int> pq;
	for (i = 1; i < m; i++) pq.push(a[i] - a[i - 1]);
	ans = a[m - 1] - a[0];
	for (i = 0; i < n - 1; i++) {
		if (!pq.empty()) {
			ans -= pq.top();
			pq.pop();
		}
	}

	cout << ans << "\n";
		
	return 0;
}

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

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

    if (S == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if (S == "Cloudy"){
        cout << "Rainy" << endl;
    }
    else if (S == "Rainy"){
        cout << "Sunny" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// #define int long long
using namespace std;
vector <int> dp;
vector<int> h;
int n;
int recurr(int pos){
    if(pos == n-1){
        return 0;
    }
    if (pos >= n)
        return 10000000;
    if(dp[pos] != -1)
        return dp[pos];
    return dp[pos] = min(abs(h[pos+1]-h[pos])+abs(recurr(pos+1)), abs(h[pos+2]-h[pos])+abs(recurr(pos+2)));
}
 
int main(){
    int cost = 0;
    int el;
    scanf("%d", &n);
    for(int i=0; i < n; i++){
        scanf("%intd", &el);
        h.push_back(el);
    }
    dp.resize(n,-1);
    printf("%d", recurr(0));
    return 0;
}

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

int main(){
   int n,k,q; cin>>n>>k>>q;
   vector<int> a(q);
   rep(i,q) cin>>a[i];
   vector<int> ans(n);
   rep(i,n) ans[i]=k-q;
   rep(i,q){
      ans[a[i]-1]++;
   }
   rep(i,n){
      if(ans[i]>0) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
   }
   return 0;
}


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

typedef long long int ll; 

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

	unordered_map <char,ll> umap;

	for(ll i=0;i<3;i++)
	{
		umap[s[i]]++;
	}
	if(umap['R'] != 2)
		cout << umap['R'] << endl;
	else if(umap['R'] == 2)
	{
		if(s[1] == 'R')
			cout << 2 << endl;
		else
			cout << 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fi first
#define se second 
using namespace std;
using ll = long long;

constexpr int M = 1000000000 + 7;
void add(ll& a, ll b) {
  a += b;
  a %= M;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<int> cnt(62);
  ll ans = 0;
  for(int i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    for(int j = 0; j < 61; ++j) {
      if(1ll << j & a) {
        add(ans, (1ll << j) % M * (i - cnt[j]) % M);
      } else {
        add(ans, (1ll << j) % M * cnt[j] % M);
      }
      cnt[j] += bool((1ll << j) & a);
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

void output_yoko(vector<char> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

vector<bool> seen;
vector<int> gnum;
void dfs(vector<vector<int>> &G, int v, int group) {
    seen[v] = true;
    gnum[v] = group;
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue;
        dfs(G, next_v, group); // 再帰的に探索
    }
}

signed main() {
    int n,m; cin>>n>>m;
    vector<vector<int>> friends(n);

    for(int i=0;i<m;i++){
        int ai,bi; cin>>ai>>bi;
        ai--; bi--;
        friends.at(ai).push_back(bi);
        friends.at(bi).push_back(ai);
    }

    seen.assign(n,false);
    gnum.assign(n,0);
    int group = 0;

    for(int v=0;v<n;v++){
        if(seen[v]) continue;
        group++;
        dfs(friends,v,group);
    }

    vector<int> num(group,0);
    for(int i=0;i<n;i++){
        num[gnum[i]-1]++;
    }

    int ans = 0;
    for(int i=0;i<group;i++){
        ans = max(ans,num[i]);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 25168