akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    String s = str[0];
    String t = str[1];
    StringTokenizer st = new StringTokenizer(in.readLine());
    int a = Integer.parseInt(st.nextToken());
    int b = Integer.parseInt(st.nextToken());
    String u = in.readLine();
    if(s.equals(u))
      a--;
    else
      b--; 
    System.out.println(a + " " + b);
  }
}

Measured memory_bytes: 22356
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;

signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int k,x;
	cin>>k>>x;
	if(500*k>=x) cout<<"Yes\n";
	else cout<<"No\n";
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iA = int.Parse(sS[1]);
            int iB = int.Parse(sS[2]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 0;
            for (int i = 1; i <= iN; i++)
            {
                int iNum = i;
                int iSum = 0;
                while (iNum > 0)                                        // 各桁の和
                {
                    iSum += iNum % 10;
                    iNum /= 10;
                }
                if (iA <= iSum && iSum <= iB ) { iOut += i; }
            }

            // 出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n;cin>>n;
	vector<ll> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll x = a[0];
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		if (x >= a[i]){
			ans++;
			x = min(x,a[i]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    var data = List.empty[(Double, Double)]
    while (sc.hasNext) {
      data :+= (sc.nextDouble(), sc.nextDouble())
    }
    println(data.filter(a => a._1 >= 1.1).length + " " + data.filter(a => a._2 >= 1.1).length)
    println(data.filter(a => 1.1 > a._1 && a._1 >= 0.6).length + " " + data.filter(a => 1.1 > a._2 && a._2 >= 0.6).length)
    println(data.filter(a => 0.6 > a._1 && a._1 >= 0.2).length + " " + data.filter(a => 0.6 > a._2 && a._2 >= 0.2).length)
    println(data.filter(a => 0.2 > a._1).length + " " + data.filter(a => 0.2 > a._2).length)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 46144
module Main where

import Data.Functor

main :: IO ()
main = do
  { [x] <- getInts
  ; putInts [x^3]
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

Measured memory_bytes: 3612
import math

NX=[int(i) for i in input().split()]
m=[]
for i in range(NX[0]):
    m.append(int(input()))

mini=m[0]
ass=0
for i in m:
    ass+=i
    if i<mini:
        mini=i

NX[1]-=ass

print(str(math.floor(NX[1]/mini)+len(m)))

Measured memory_bytes: 3064
#pragma once
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#define REP(i,e) for(long long i = 0;i < (e);i++)
typedef long long i64;
using namespace std;
int main() {

	i64 N, C;
	cin >> N >> C;
	i64  x[100001];
	i64 v[100001];
	REP(i, N) {
		cin >> x[i];
		cin >> v[i];
	}
	i64 mf[100001];
	mf[0] = 0;

	i64 mb[100001];
	mb[0] = 0;
	i64 vf = 0;
	i64 vb = 0;
	REP(i, N) {
		vf += v[i];
		mf[i + 1] = max(mf[i],vf - x[i]);
		vb += v[N - i - 1] ;
		mb[i + 1] = max(mb[i], vb - (C - x[N - i - 1]));
	}
	i64 res = 0;
	REP(i, N + 1) {
		i64 tm = mf[i] + mb[N - i];
		i64 f = tm - ((i == 0) ? 0 : x[i - 1]);
		i64 f2 = tm - ((i == N) ? 0 : (C - x[i]));
		res = max(res, max(f, f2));
	}
	cout << res << "\n";
}

Measured memory_bytes: 3328
A = []
for _ in range(3):
    A += list((map(int, input().split())))
    
N = int(input())

for _ in range(N):
    B = int(input())
    if B in A:
        A[A.index(B)] = 0

if A[0] == A[3] == A[6] == 0:
    print('Yes')
elif A[1] == A[4] == A[7] == 0:
    print('Yes')
elif A[2] == A[5] == A[8] == 0:
    print('Yes')
elif sum(A[:3]) == 0:
    print('Yes')
elif sum(A[3:6]) == 0:
    print('Yes')
elif sum(A[6:9]) == 0:
    print('Yes')
elif A[0] == A[4] == A[8] == 0:
    print('Yes')
elif A[2] == A[4] == A[6] == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9252
#include <iostream>
#include <string>    
#include <fstream>   

using namespace std;

int main() {

	string str1, str2;
	cin >> str1;
	cin >> str2;
	
	int len1 = str1.length();
	int len2 = str2.length();

	int count = 0;
	int result = len1;

	for (int top = 0; top <= len1 - len2; top++) {
		count = 0;
		int idx = 0;
		for (int now = top; now < top + len2; now++) {
			//cout << now;
			if (str1[now] != str2[idx]) {
				count++;
			}
			idx++;
		}
		//cout << endl;
		if (count < result) {
			result = count;
		}
	}

	cout << result;

	return 0;
}

Measured memory_bytes: 3592
import bisect
N, K = map(int, input().split())
V = list(map(int, input().split()))
num_get = min(N, K)
ans = -float('inf')
for left in range(0, num_get+1):
    for right in range(N-1, N-1 - (num_get+1 - left), -1):
        inhand = sorted(V[0:left] + V[right+1:N])
        zero_idx = bisect.bisect_left(inhand, 0)
        tmp_ans = sum(inhand[min(zero_idx, max(K - len(inhand), 0)):])
        ans = max(ans, tmp_ans)
print(ans)

Measured memory_bytes: 3188
a,b = map(int, input().split())
count=0
for i in range(a):
    s1 = 2*i + 4*(a-i)
    s2 = 2*(a-i) + 4*i
    if s1 == b or s2 == b:
        count+=1
if count>0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
long long mem[11][10][2];
long long ct(int id, int s, int z){
    if (id == 0) return 1;
    if (mem[id][s][z] != -1) return mem[id][s][z];
    int ans = 0;
    if (!z){
        if (s-1 >= 0) ans += ct(id-1,s-1,z);
        ans += ct(id-1,s,z);
        if (s+1 <= 9) ans += ct(id-1,s+1,z);
    }
    else{
        for (int i = 0; i <= 9; i++){
            ans += ct(id-1,i,z&&(i==0));
        }
    }
    return mem[id][s][z] = ans;
}
int main(){
    int n;
    scanf("%d",&n);
    n++;
    memset(mem,-1,sizeof(mem));
    int cur = 0;
    long long ans = 0;
    int z = 1;
    int last = 0;
    for (int i = 1; i <= 10; i++){
        z &= (last == 0);
        if (z){
            for (int j = 0; j <= 9; j++){
                int x = ct(10-i,j,z&&(j==0));
                //printf("%d digit %d: %d %d\n",i,j,cur,x);
                if (cur + x < n){
                    cur += x;
                }
                else {
                    ans *= 10;
                    last = j;
                    ans += j;
                    break;
                }
            }
        }
        else{
            //printf("settling last digit %d\n",last);
            if (last-1 >= 0){
                int x = ct(10-i,last-1,0);
                if (cur + x < n){
                    cur += x;
                }
                else {
                    ans *= 10;
                    ans += last-1;
                    last--;
                    continue;
                }
            }
            int x = ct(10-i,last,0);
            if (cur + x < n){
                cur += x;
            }
            else {
                ans *= 10;
                ans += last;
                continue;
            }
            if (last+1 <= 9){
                int x = ct(10-i,last+1,0);
                if (cur + x < n){
                    cur += x;
                }
                else {
                    ans *= 10;
                    ans += last+1;
                    last++;
                    continue;
                }
            }
        }
    }
    printf("%lld",ans);


}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3)
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3)
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
ll n,W,wt[N],p[N],dp[N];
ll knapsack()
{
    ll mx=-1;
    int i,j;
    rep0(i,n)
    {
        for(j=W;j>=0;j--)
        {
            if(j-wt[i]>=0)
            {
                dp[j]=max(dp[j],dp[j-wt[i]]+p[i]);
                mx=max(mx,dp[j]);
            }
        }
    }
    return mx;
}
int main()
{
    sll(n,W);
    int i;
    rep0(i,n)
        sll(wt[i],p[i]);
    pf("%lld\n",knapsack());

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc158/abc158_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll n, a, b;
  cin >> n >> a >> b;

  ll c = n / (a + b);
  ll m = n % (a + b);
  if (m > a) {
    m = a;
  }

  cout << a * c + m << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int n,m,flag=0;
	cin>>n>>m;
	for(int i=1;i<=3;i++)
	{
		 int h=i*n*m;
		 if(h%2)
		 {
		 	 flag=1;
		 	 printf("Yes\n");
		 	return 0;
		 }
		
		 
	}
	printf("No\n");
} 

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for(int i=0; i<N-2; i++){
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C'){
       ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define DEKAI 1000000007
#define INF (1<<28)
#define int long long
/* ┗(^o^)┛ｗｗｗｗｗ┏(^o^)┓ﾄﾞｺﾄﾞｺﾄﾞｺﾄﾞｺｗｗｗｗｗ */
int z[200001];
	int a[26],b[26];
signed main(){
	string x,y;
	cin>>x>>y;
	lp(i,x.size()){
		a[x[i]-'a']++;
	}
	lp(i,y.size()){
		b[y[i]-'a']++;
	}
	lp(i,26){
		z[a[i]]++;
	}
	string ans="Yes";
	lp(i,26){
		if(b[i]==0) continue;
		if(z[b[i]]>0) z[b[i]]--;
		else ans="No";
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 1e5 + 10;
int dp[N][4];
int arr[N][3];
int n;

int solve(int idx, int prev)
{
	if(idx == n)
		return 0;
	int &ans = dp[idx][prev];
	if(ans != -1)
		return ans;
	ans = 0;
	for(int i = 0; i < 3; i++)
	{
		if(i + 1 != prev)
			ans = max(ans, solve(idx + 1, i + 1) + arr[idx][i]);
	}
	return ans;
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < 3; j++)
			cin >> arr[i][j];
	memset(dp, -1, sizeof(dp));
	cout << solve(0, 0);
	return 0;
}

Measured memory_bytes: 10752
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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


Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int i,n;
	long long a[10005],b[10005],suma,sumb,t,count=0,s1=0,s2=0,s3=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	 scanf("%lld",&a[i]);
	for(i=0;i<n;i++)
	 scanf("%lld",&b[i]);
    for(i=0;i<n;i++)
    {
    	if(a[i]!=b[i]) break;
	}
	if(i==n)  count=1;
	else
	{
		suma=0;sumb=0;
	  for(i=0;i<n;i++)
	  {
	  	suma+=a[i];
	  	sumb+=b[i];
	  }
	  t=sumb-suma;
	  if(t<=0) count=-1;
	  else
	  {
	  	 for(i=0;i<n;i++)
	  	 {
	  	 	if(a[i]<b[i])
	  	 	{
	  	 	  s1=s1+(b[i]-a[i])/2;
			  if((b[i]-a[i])%2!=0) 
			  {
			  	 s1++; s2++;
			  }
			}
		 }
		 if(s1>t) count=-1;
		 else
		 {
		 	s2=s1-s2;
		 	for(i=0;i<n;i++)
		 	{
		 		if(a[i]>b[i])
		 		{
		 			s3+=a[i]-b[i];
				}		 		 
			}
			if(s3>s2) count=-1;
			else count=1;
		 }
	  }
	}
  if(count==-1)  printf("No\n");
  else  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 256
S = list(input())

cnt = [0] * len(S)

R = []
for i,s in enumerate(S):
    if s == "L":
        for r in R:
            if (i - r) % 2 == 0:
                cnt[i] += 1
            else:
                cnt[i-1] += 1
        R = []
    else:
        R.append(i)

L = []
for i in range(len(S)-1, -1, -1):
    s = S[i]
    if s == "R":
        for l in L:
            if (l - i) % 2 == 0:
                cnt[i] += 1
            else:
                cnt[i+1] += 1
        L = []
    else:
        L.append(i)

print(*cnt,sep=" ")

Measured memory_bytes: 8616
n,x=map(int,input().split())
A=list(map(int,input().split()))+[0]
c=0
for i in range(n):
  a=max(0,A[i]+A[i+1]-x)
  c+=a
  A[i+1]-=a
  if A[i+1]<0:
    A[i]+=A[i+1]
    A[i+1]=0
print(c)

Measured memory_bytes: 14152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	ll a, b;
	cin >> a >> b;
	
	ll g = __gcd(a, b);
	
	ll ans = a * b / g;
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;



int main()
{
  ll N;
  cin >> N;

  ll sum = 0;
  FOR(i,1,N+1){
    sum+=(1+N/i)*(N/i)*i/2;
  }

  cout << sum << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>

using namespace std;

int main(void){
	int n, m, i, j, t, c;
	vector<int> targets;
	vector<int> scores;

	cin >> n;
	cin >> m;	

	for(i = 0;i < m;++i){
		cin >> t;
		targets.push_back(t);
	}
	for(i = 0;i < n;++i) scores.push_back(0);

	for(i = 0;i < m;++i){
		c = 0;
		for(j = 0;j < n;++j){
			cin >> t;
			if(t == targets[i]){
				scores[j]++;
			}else{
				++c;
			}
		}
		scores[targets[i]-1] += c;
	}

	for(i = 0;i < n;++i) cout << scores[i] << endl;
	
	return 0;	
}

Measured memory_bytes: 3164
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
          int n=sc.nextInt();
          int m=sc.nextInt();
          int l=sc.nextInt();
           
          long[][] a =new long[n][m];
          long[][] b =new long[m][l];
          long[][] c =new long[n][l];
        
       	  for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
                    a[i][j]+=sc.nextInt();
                }
            }
        for(int i=0;i<m;i++){
                for(int j=0;j<l;j++){
                    b[i][j]+=sc.nextInt();
                }
            }
        for(int i=0;i<n;i++){
                for(int j=0;j<l;j++){
                     for(int k=0;k<m;k++){
                    c[i][j]+=a[i][k]*b[k][j];
                }
            }           
        }
     	for(int i=0;i<n;i++){
           for(int j=0;j<l;j++){
              System.out.print(c[i][j]);
              if(j!=l-1)System.out.print(" ");
           }
         System.out.println();
        }
        sc.close(); 
                }
          }


Measured memory_bytes: 54164
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int L,R;
int ans=INF;

signed main(){
    cin>>L>>R;
    if(R-L>=2019)cout<<0<<endl;
    else {
        int h=R-L;
        L%=2019,R%=2019;
        for(int i=L,t=0;t<h;i=(i+1)%2019,t++){
            for(int j=(i+1)%2019,k=0;k<h-t;j=(j+1)%2019,k++){
                ans=min((i*j)%2019,ans);
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
n , s = map(int,input().split())
a = list(map(int,input().split()))
dp = [[0 for j in range(s+1)] for i in range(n+1)]
mod = 998244353
for i in range(1,n+1):
    if 0 <= a[i-1] <= s:
        if dp[i][a[i-1]] == 0:
            dp[i][a[i-1]] += pow(2,i-1,mod)
    for j in range(0,s+1):
        dp[i][j] += (dp[i-1][j]*2)%mod
        if j - a[i-1] >= 0:
            dp[i][j] += dp[i-1][j-a[i-1]]
        dp[i][j] %= mod

print(dp[n][s])
    

Measured memory_bytes: 147008
/*
ID: jerrywcy
TASK: AtCoder ABC 109 Problem D
LINK: https://abc109.contest.atcoder.jp/tasks/abc109_d
LANG: C++
*/
#include<iostream>

using namespace std;

int h,w,a[555][555];
int n=0,x1[200000],x2[200000],y1[200000],y2[200000];

int main(){
	int i,j;
	cin>>h>>w;
	for(i=1;i<=h;i++){
		for(j=1;j<=w;j++)
			cin>>a[i][j];
	}
	for(i=1;i<=h;i++){
		for(j=1;j<w;j++){
			if(a[i][j]%2==1){
				y1[n]=i;
				y2[n]=i;
				x1[n]=j;
				x2[n]=j+1;
				n++;
				a[i][j]--;
				a[i][j+1]++;
			}
		}
	}
	for(i=1;i<h;i++){
		if(a[i][w]%2==1){
			y1[n]=i;
			y2[n]=i+1;
			x1[n]=w;
			x2[n]=w;
			n++;
			a[i][w]--;
			a[i+1][w]++;
		}
	}
	cout<<n<<endl;
	for(i=0;i<n;i++)
		cout<<y1[i]<<' '<<x1[i]<<' '<<y2[i]<<' '<<x2[i]<<endl;
	return 0;
}


Measured memory_bytes: 5760
// ABC088D
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <functional>
#include <set>
#include <iterator>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int H, W;
char s[55][55];

int main() {
   cin >> H >> W;
   for (int i=0;i<H;i++) {
      cin >> s[i];
   }
   //bool ret = true;
   for (int i=0;i<H;i++) {
      for (int j=0;j<W;j++) {
         if (s[i][j] == '#') {
            bool ret = false;
            if (i >= 1 && s[i-1][j] == '#') {
               ret = true;
            }
            if (j >= 1 && s[i][j-1] == '#') {
               ret = true;
            }
            if (i < H-1 && s[i+1][j] == '#') {
               ret = true;
            }
            if (j < W-1 && s[i][j+1] == '#') {
               ret = true;
            }
            if (ret == false) {
               printf("No\n");
               return 0;
            }
         }
      }
   }
   printf("Yes");
}

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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<double,double>
#define PLD pair<long double, long double>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1000000007;
const int N = 300555;
const int M = 1155;

void solve() {
    VI v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;
    
    cout << v[k-1];

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int x, y, z;
   cin >> x >> y >> z;

   x -= z;
   int ans = 0;
   // x >= 0 とすると、x = 0のときに x-=(y+z)されるので,
   // while(x >= y + z)とする.
   while(x >= y + z){
      x -= (y + z);
      ans++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int s,t;
  cin >> s >> t;
  int i,count=0;
  for(i=s;i<=t;i++){
    string u=to_string(i);
    int k=0;
    for(int j=0;j<u.size()/2;j++){
      if(u.at(j)==u.at(u.size()-j-1)){
        k++;
      }
      if(k==u.size()/2){
        count++;
      }
    }
  }
  cout << count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
bool check(int x) 
{
    int a[3]={x/100,(x%100)/10,x%10};
    int cnt = 0;
    for(char c: s) 
	{
        int d=c-'0';
        if(d==a[cnt]) cnt++;
        if(cnt==3) return true;
    }
    return false;
}
int main() 
{
    int n;
    cin>>n>>s;
    int ans=0;
    for (int i=0;i<1000;i++) ans+=check(i);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
// はい
package main

import "fmt"

func main() {
	var Sx, Sy, Tx, Ty int
	fmt.Scan(&Sx, &Sy, &Tx, &Ty)
	ans := ""
	for i := 0; i < Tx-Sx; i++ {
		ans += "R"
	}
	for i := 0; i < Ty-Sy; i++ {
		ans += "U"
	}
	for i := 0; i < Tx-Sx; i++ {
		ans += "L"
	}
	for i := 0; i < Ty-Sy; i++ {
		ans += "D"
	}
	ans += "D"
	for i := 0; i < Tx-Sx+1; i++ {
		ans += "R"
	}
	for i := 0; i < Ty-Sy+1; i++ {
		ans += "U"
	}
	ans += "L"
	ans += "U"
	for i := 0; i < Tx-Sx+1; i++ {
		ans += "L"
	}
	for i := 0; i < Ty-Sy+1; i++ {
		ans += "D"
	}
	ans += "R"
	fmt.Println(ans)
}


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

int main() 
{
	// freopen("./input.txt", "r", stdin);	
	int N, K;
	cin >> N >> K;
		
	int mod0, modk;
	bool even = (K % 2 == 0);
	int k = K / 2;
	mod0 = modk = 0;
	for (int i = 1; i <= N; i++) {
		if (i % K == 0) mod0++;
		if (even && i % K == k) modk++;
	}
	cout.precision(0);
	cout << setiosflags(ios::fixed) << pow(mod0, 3) + pow(modk, 3) << "\n";	
	
	return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;

class Point {
public:
	int x;
	int y;

	Point() {
		x = y = 0;
	}
	Point(int x, int y) {
		this->x = x; this->y = y;
	}

	friend std::ostream& operator << (std::ostream& ostr, const Point& p) {
		std::cout << "{" << p.x << ", " << p.y << "}";
		return ostr;
	}
};

bool field[10][10];
int dx[12] = { -1, 0, 1, -2, 2, -2, 2, -2, 2, -1, 0, 1};
int dy[12] = { -2, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 2 };

void init() {
	REP(y, 10) {
		REP(x, 10) {
			field[y][x] = false;
		}
	}
}

void print() {
	REP(y, 10) {
		REP(x, 10) {
			cout << (field[y][x] ? "???" : "???") << " ";
		}
		cout << endl;
	}
	cout << endl;
}

//p ???????????£????????§???????????????1???
void reach(Point p) {
	int x, y;
	x = p.x; y = p.y;

	REP(i, 12) {
		int nx, ny;
		nx = x + dx[i];
		ny = y + dy[i];
		if (nx < 0 || nx >= 10 || ny < 0 || ny >= 10) continue;
		field[ny][nx] = true;
	}
}

//?????????????????????????±????????????\??????0???
void range(Point s)
{
	int sx, sy;
	sx = s.x; sy = s.y;

	REP(y, 10) {
		REP(x, 10) {
			if (x < sx - 1 || x > sx + 1 || y < sy - 1 || y > sy + 1) {
				field[y][x] = false;
			}
		}
	}
}

//?????????????????? (??´????????§?¨???????, ???????????????????????§?¨?)
vector<Point> habitable(vector<Point> p, Point s)
{
	vector<Point> np;
	init();

	REP(i, p.size()) {
		reach(p[i]);
	}

	range(s);
	
	REP(y, 10) {
		REP(x, 10) {
			if (field[y][x]) {
				np.push_back(Point(x, y));
			}
		}
	}

	return np;
}

bool AOJ0122()
{
	Point p;
	int n;

	cin >> p.x >> p.y;
	if (p.x + p.y == 0) return false;

	cin >> n;

	Point s[10];

	REP(i, n) {
		cin >> s[i].x >> s[i].y;
	}

	vector<Point> h;
	h.push_back(Point(p.x, p.y));

	REP(i, n) {
		h = habitable(h, s[i]);
		if (h.size() == 0) {
			cout << "NA" << endl;
			return true;
		}
	}
	cout << "OK" << endl;
	return true;
}

int main()
{

	while (AOJ0122()) {

	}

	return 0;
}

Measured memory_bytes: 3068
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int n = Integer.parseInt(strArr[0]);
            int x = Integer.parseInt(strArr[1]);
            int min = -1;
            for (int i = 0; i < n; i++) {
                int temp = Integer.parseInt(br.readLine());
                x -= temp;
                if (min == -1 || min > temp) {
                    min = temp;
                }
            }
            n += x / min;
            System.out.println(n);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 21460
#include<iostream>

using namespace std;
int fib(int n);

int memo[45];
int main(){
  int n;
  cin >> n;
  cout << fib(n) << endl;
  return 0;
}

int fib(int n){
  
  if(n == 0){
    return 1;
  }else if(n == 1){
    return 1;
  }else if(memo[n] != 0){
    return memo[n];
  }else{
    return memo[n]= fib(n-1) + fib(n-2);
  }
  
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int n,a[300],al,bo;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=n;i>=1;i--){
        if(i%2 == n%2){al+=a[i];}
        else{bo+=a[i];}
    }
    cout<<al-bo<<newl;
}


Measured memory_bytes: 256
import numpy as np
import copy

def kaijo(n):
    if n == 1:
        return n
    return n * kaijo(n-1)

def search(dist,x0,x):
    global res,N,pos
    if len(x)==0:
        res+=dist
        #print(dist)
        return
    #print(x)
    #print(x,x0)
    #xx=copy.deepcopy(x)

    for k in range(len(x)):

        # if k>=1:
        #     xx=x[:(k-1)]
        # else:
        #     xx=[]
        # xx.extend(x[k+1:])

        tmp=x.pop(k)
        search(dist+np.linalg.norm(x0-pos[tmp]),pos[tmp],x)
        #x.append(tmp)
        x.insert(k,tmp)


N=int(input())
def acinput():
    return list(map(int, input().split(" ")))

dist=0
pos=[]
for i in range(N):
    pos.append(np.array(acinput()))

res=0

x=list(range(N))
for k in x:
    xx=copy.deepcopy(x)
    del xx[k]
    search(0,pos[k],xx)

print(res/(kaijo(N)))

Measured memory_bytes: 12516
#include <iostream>

using namespace std;
typedef long long ll;
const int MAX = 100010;
ll inv[MAX],fact[MAX],fi[MAX],mod = 1000000007;

void inverse(){
	int i;
	inv[1] = 1;
	for(i=2;i<MAX;i++){
		inv[i] = mod - (mod/i)*inv[mod%i]%mod;
	}
	fact[0] = fi[0] = 1;
	for(i=1;i<MAX;i++){
		fact[i] = fact[i-1]*i%mod;
		fi[i] = (fi[i-1]*inv[i])%mod;
	}
}

ll comb(int n,int k){
	if(n<0 || k<0 || n<k){
		return 0;
	}else{
		return fact[n]%mod*fi[k]%mod*fi[n-k]%mod;
	}
}

ll a[1010],dp[1010][1010];
int main(){
	ll i,j,n,k,l;
	cin >> n >> k;
	for(i=0;i<k;i++){
		cin >> a[i];
	}
	inverse();
	dp[k][0] = 1;
	for(i=k - 1;i>=0;i--){
		for(j=0;j<=n;j++){
			ll s = 0;
			for(l=0;l<=j;l++){
				(s += dp[i + 1][j - l]*comb(j,l)%mod*comb(n - l,a[i] - l)%mod) %= mod;
			}
			(dp[i][j] += s) %= mod;
		}
	}
	cout << dp[0][n] << endl;
}
	

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1') s[i]='9';
        else s[i]='1';
    }
    cout<<s<<endl;

}



Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

using namespace std;

int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    if(a==b)
        cout<<c<<endl;
    else if(a==c)
        cout<<b<<endl;
    else if(b==c)
        cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i, j , n, w[101], s1 = 0, s2 = 0, t = 0, min = 99999;

	scanf("%d", &n);

	for (i = 1; i <= n; i++) {
		scanf("%d", &w[i]);
	}

	for (i = 1; i <= n; i++) {
		s1 = 0;
		s2 = 0;
		t = 0;
		for (j = 1; j <= n; j++) {
			if (j <= i) {
				s1 += w[j];
			} else {
				s2 += w[j];
			}
		}
		t = s1 - s2;
		if (t <= -1) t *= -1;
		if (t <= min) min = t;
	}

	printf("%d\n", min);

	return 0;
}

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

int main(void) {
	
	int W, H;
	int x, y, r;
	cin >> W >> H >> x >> y >> r;
	if(x - r < 0
		|| y- r < 0
		|| x + r > W
		|| y + r > H) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}

	return 0;
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  for(int i=0;i<s.size();i++){
    char a=(int)s.at(i)+n;
    while(a>90){
      a-=26;
    }
    cout << a;
  }
  cout << endl;
}

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

using namespace std ;

void printarray( int *a , int n )
{
    for( int i = 0 ; i < n ; i++ )
        cout << a[ i ] << " " ;
}

void scanarray( int *a , int n )
{
    for( int i = 0 ; i < n ; i++ )
        cin >> a[ i ] ;
}

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

    int a[ 200000 ] ;
    scanarray( a , n ) ;

    int maxx = a[ 0 ] ;
    long long s = 0 ;
    for( int i = 1 ; i < n ; i++ )
    {
        if( a[ i ] < maxx )
            s += ( maxx - a[ i ] ) ;
        else
            maxx = a[ i ] ;
    }

    cout << s ;
}



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

#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < int(n); i++)

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int MOD = 1000000007;

std::vector<int> graph[100001];
ll dp[100001][2];

ll fun(int node, int parent_color, int parent) {
    if(dp[node][parent_color] != -1) return dp[node][parent_color];
    ll ans = 1;
    for(int x : graph[node]) {
        if(x != parent) {
            ans *= fun(x, 0, node);
            ans %= MOD;
        }
    }
    if(parent_color == 1) return dp[node][parent_color] = ans;
    ll ans1 = 1;
    for(int x : graph[node]) {
        if(x != parent) {
            ans1 *= fun(x, 1, node);
            ans1 %= MOD;
        }
    }
    ans += ans1;
    ans %= MOD;
    return dp[node][parent_color] = ans;
}

int main() {
    IOS;
    memset(dp, -1, sizeof(dp));
    int n, u, v;
    cin >> n;
    rep(i, n - 1) {
        cin >> u >> v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    cout << fun(1, -1, 0) ;
    return 0;
}

Measured memory_bytes: 15616
s = input()
len_s = len(s)
sum_s = 0
for i in range(1 << (len_s - 1)):
    end = len_s
    for j in range(len_s - 1):
        if (i >> j) & 1:
            sum_s += int(s[(len_s - 1) - j:end])
            end = (len_s - 1) - j
    sum_s += int(s[0:end])
            
print(sum_s)

Measured memory_bytes: 3060
N=10**6
l=[0]*(N+1)
for i in range(1,N+1):
    c=0
    x=i
    while x%2==0:
        c+=1
        x//=2
    l[i]=c
for i in range(N):
    l[i+1]+=l[i]
def nCr(n,r):
    if l[n]>l[r]+l[n-r]:
        return 0
    else:
        return 1
n=int(input())
A=list(input())
for i in range(n):
  	A[i]=int(A[i])
AA=[0]*(n-1)
flag=0
for i in range(n-1):
    AA[i]=abs(A[i+1]-A[i])
    if AA[i]==1:
        flag=1
if flag==0:
    for i in range(n-1):
        AA[i]//=2
ans=0
for i in range(n-1):
    ans=(ans+nCr(n-2,i)*AA[i])%2
if flag==1:
    print(ans)
else:
    print(ans*2)

Measured memory_bytes: 138560
#include <cstdio>

void binarywrite(int n){
	for(int i=6;i>=0;i--){
		printf("%d", (n >> i & 1));
	}
	puts("");
}

int main(){
	int lights[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
	int n = 0;
	while(scanf("%d", &n), ~n){
		int prev_light = 0;
		for(int i=n;i;i--){
			int j;
			scanf("%d", &j);
			binarywrite(prev_light ^ lights[j]);
			prev_light = lights[j];
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#define m 1000000007
using namespace std;
long long int log_pow_2(int x)
{
  long long int ans = 1, save = 2;
  while( x > 0 )
  {
  	if( x % 2 == 1 )
      ans = (ans * save) % m;
    save *= save;
    save %= m;
    x /= 2;
  }
  return ans;
}
int main()
{
  
  int n;
  cin >> n;
  
  int odd_even = (n+1) % 2;
  int tab_length = n % 2 == 0 ? n / 2 : n / 2 + 1;
  int tab[ tab_length ]{}, sum = 0, tmp;
  bool check = false;
  for(int i = 0; i < n; i++)
  {
    cin >> tmp;
    if( tmp % 2 != odd_even )
    	check = true;
    tab[ tmp/2 ]++;
    if( tab [ tmp/2 ] == 2 )
      sum++;
  }
  if( check )
  	cout << 0;
  else{
  	if( odd_even == 1 )
	{
	  	if( sum < n/2 )
	  		cout << 0;
	  	else
			cout << log_pow_2(n/2);
	}else{
	  	if( sum == n/2 and tab[0] == 1 )
	  		cout << log_pow_2(n/2);
	  	else
	  		cout << 0;
	}
  }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
// string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=0;
  cin>>x>>n;
  if(x<n)
    c(0);
  else
  cout<<10<<" ";
}

signed main(){

      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


Measured memory_bytes: 256
func main() {
    func readInts() -> [Int] {
        return readLine()!.split(separator: " ").map { Int($0)! }
    }
    
    let S = Array(readLine()!)
    let T = Array(readLine()!)
    
    //print((0..<S.count).compactMap { S.index[$0] == T.index[$0] ? 0 : 1 }.reduce(0) { $0 + $1 })
    print((0..<S.count).map { S[$0] == T[$0] ? 0 : 1 }.reduce(0, +))
}

main()


Measured memory_bytes: 14704
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

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


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll s = 0;
  for(auto &it : a) {
    cin >> it;
    s+=it;
  }
  ll ans = inf;
  ll curr = 0;
  for(ll i = 0; i < n; i++) {
    curr+= a[i];
    ll xx = s - curr;
    ans = min(ans, abs(xx-curr));
  }
  cout << ans << endl;
  return 0;
} //good night.

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define MAX 5005
int mod=1e9+7;

int add(int a,int b){
  return (a+b)%mod;
}

int N,L;
int x[MAX],a[MAX];
int dp[2][MAX];
int main(){
  cin>>N>>L;
  for(int i=0;i<N;i++)cin>>x[i],x[i]++;
  for(int i=0;i<N;i++)cin>>a[i];

  int ans=0;
  dp[1][0]=1;
  for(int i=0;i<N;i++){
    int ai=i&1,bi=1-ai;
    int sum=dp[bi][0];
    
    dp[ai][0]=0;
    for(int j=1;j<=L;j++){
      if(j<x[i]){
        dp[ai][j]=0;
      }else if(a[i]==0&&j!=x[i]){
        dp[ai][j]=0;
      }else if(a[i]>0&&(j-x[i])%a[i]!=0){
        dp[ai][j]=0;
      }else{
        dp[ai][j]=sum;
      }
      sum=add(sum,dp[bi][j]);

      if(i==N-1){
        ans=add(ans,dp[ai][j]);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
const int MAX_N=30;
char ary[MAX_N][MAX_N];
char testAry[MAX_N][MAX_N];
bool deadAry[MAX_N][MAX_N];
int h,w,n;

void drop(){
  for(int i=h-2;i>=0;i--){
    REP(j,w){
      if(testAry[i][j]!='.'){
	int dst=i+1;
	for(;dst<h&&testAry[dst][j]=='.';dst++);
	swap(testAry[i][j],testAry[dst-1][j]);
      }
    }
  }
}
bool checkClear(){
  REP(i,w)if(testAry[h-1][i]!='.')return false;
  return true;
}
bool checkDeadR(char c,int y,int x,int depth=1){
  if((x+1<w&&testAry[y][x+1]==c&&checkDeadR(c,y,x+1,depth+1))||depth>=n){
      deadAry[y][x]=true;
      return true;
  }
  return false;
}
bool checkDeadD(char c,int y,int x,int depth=1){
  if((y+1<h&&testAry[y+1][x]==c&&checkDeadD(c,y+1,x,depth+1))||depth>=n){
      deadAry[y][x]=true;
      return true;
  }
  return false;
}
bool checkDead(){
  bool result=false;
  REP(i,h)REP(j,w)deadAry[i][j]=false;
  REP(i,h)REP(j,w){
    if(testAry[i][j]=='.')continue;
    result=checkDeadR(testAry[i][j],i,j)||result;
    result=checkDeadD(testAry[i][j],i,j)||result;
  }
  return result;
}
void die(){
  REP(i,h)REP(j,w)if(deadAry[i][j])testAry[i][j]='.';
}
bool canClear(int y,int x){
  REP(i,h)REP(j,w)testAry[i][j]=ary[i][j];
  swap(testAry[y][x],testAry[y][x+1]);
  drop();
  while(!checkClear()){
    if(!checkDead())return false;
    die();
    drop();
  }
  return true;
}
int main(){ _;
  cin>>h>>w>>n;
  REP(i,h)REP(j,w)cin>>ary[i][j];
  REP(i,h)REP(j,w-1){
    if(canClear(i,j)){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}

Measured memory_bytes: 1196
#!/usr/bin/env python
# coding: utf-8

# In[5]:


h,w,m = map(int, input().split())
hw_list = []
for _ in range(m):
    hw_list.append(list(map(int, input().split())))


# In[6]:


def solve(h,w,m,hw_list):
    h_count = [0]*(h+1)
    w_count = [0]*(w+1)
    for h_,w_ in hw_list:
        h_count[h_] += 1
        w_count[w_] += 1
        
    h_max = max(h_count)
    w_max = max(w_count)
    ans = h_max + w_max
    
    h_max_count = 0
    w_max_count = 0
    for i in range(h+1):
        if h_count[i] == h_max:
            h_max_count += 1
    for j in range(w+1):
        if w_count[j] == w_max:
            w_max_count += 1
    
    max_count = h_max_count*w_max_count
    max_count_cross = 0
    for h_,w_ in hw_list:
        if h_count[h_] == h_max and w_count[w_] == w_max:
            max_count_cross += 1
    
    if max_count_cross == max_count:
        ans -= 1
    
    return ans


# In[7]:


ans = solve(h,w,m,hw_list)
print(ans)


# In[ ]:






Measured memory_bytes: 68344
def rep_pow(a, k, p=10**9+7):
    # calculate exponentiation: a^k mod p
    ans = 1
    while k > 0:
        if k & 1:
            ans = ans * a % p
        a = a * a % p
        k >>= 1
    return ans

m, n = map(int, input().split())
print(rep_pow(m, n))


Measured memory_bytes: 5600
#include<stdio.h>

int a,b,c,n;

int main(){
    scanf("%d %d %d", &a, &b, &c);
    for(n = 0; a <= b; a++){
        if(c < a) break;
        if(c % a == 0) n++;
    }
    printf("%d\n", n);
    return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  int N, M;
  cin >> N >> M;
  string num(N, '.');
  for (int i = 0; i < M; i++) {
    int c, s;
    cin >> s >> c;
    if (N > 1 && s == 1 && c == 0) {
      cout << -1 << endl;
      return 0;
    }
    if (num[s - 1] != '.' && num[s - 1] != (char)(c + '0')) {
      cout << -1 << endl;
      return 0;
    }
    num[s - 1] = (char)(c + '0');
  }
  for (char &ch : num) {
    if (ch == '.') {
      ch = '0';
    }
  }
  if (num[0] == '0') {
    if (N == 1) {
      cout << 0 << endl;
      return 0;
    } else {
    }
    num[0] = '1';
  }
  int min_num = stoi(num);
  cout << min_num << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        System.out.println(solve(N, A, B));

        sc.close();
    }

    static int solve(int N, int A, int B) {
        return IntStream.rangeClosed(1, N).filter(x -> {
            int digitSum = String.valueOf(x).chars().map(ch -> ch - '0').sum();

            return digitSum >= A && digitSum <= B;
        }).sum();
    }
}

Measured memory_bytes: 29648
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//const int INF = 1e9;//INT_MAX=1<<31-1=2147483647
const ll INF = (ll)1e18;//1<<63-1=9223372036854775807
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/



signed main() {
	ll N,K;
	cin>>N>>K;
	if(K==0){
		p(N*N);
		return 0;
	}
	ll ans=0;
	for(ll b=K+1;b<=N;b++){
		ll plus=b-K;
		ll kosu=N/b;
		ans+=plus*kosu;
		ll t=N%b-K+1;
		if(t>0)ans+=t;
		debug(plus*kosu);
		debug(t);
	}

	p(ans);

	return 0;
}


Measured memory_bytes: 256