akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

const int N = 200020;

int a[N];

int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]), a[i] -= i;
	sort(a + 1, a + 1 + n);
	long long ans = 0;
	for(int i = 1; i <= n; i++)
		ans += abs(a[i] - a[(n + 1) / 2]);
	printf("%lld\n", ans);
}

Measured memory_bytes: 1024
from collections import OrderedDict
N = int(input())

rest = OrderedDict()
num = {}
for i in range(N):
    s = input().split()
    rest.setdefault(s[0],[]).append(int(s[1]))
    num[s[0] +s[1]] = i + 1

book = OrderedDict(sorted(rest.items(), key=lambda t: t[0]))

for k,v in book.items():
    a = list(v)
    a.sort(reverse=True)
    for i in a:
        print(num[k + str(i)])

Measured memory_bytes: 3316
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (n, l) = readIntegerList()
    val ans = List(n) { br.readLine()!! }.sorted().joinToString("")
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 38992
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

//最大公約数
template<class T>
inline T GCD(T m, T n)
{
	T temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
template<class T>
inline T LCM(T m, T n)
{
	return m * n / GCD(m, n);
}



int main()
{
	int n, q; string s;
	cin >> n >> q >> s;
	vector<int> index;
	
	for (int i = 0; i < n-1; i++)
	{
		if (s[i] == 'A' && s[i + 1] == 'C') { index.push_back(i); }
	}

	for (int i = 0; i < q; i++)
	{
		int first, last; cin >> first >> last;
		int num = 0;

		for (auto it : index)
		{
			if (first - 1 <= it && it + 1 <= last-1)
			{
				num++;
			}
		}

		cout << num << endl;
	}

	return 0;
}

Measured memory_bytes: 1212
import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

"""
# 文字列（数値変換も含む）
n = readline().rstrip() # １行に１文字列のみ
lis = readline().rstrip().split() # # １行に複数の文字列

# 数値（文字変換も含む）
n = int(readline().rstrip()) # １行に数値１個のみ
a, b, c = map(int,readline().rstrip().split()) # １行に複数の数値
A = list(map(int,readline().rstrip().split()))  # １行に複数の数値（リスト受け取り）
lis = [readline().rstrip().split() for _ in range(n)] # １行に複数の数値(m個)かつ、n行続く場合（出力は二次元リスト：[['1', '2'], ['4', '5']]）

# 一行に文字列が一個 * n行
s_lis=[readline().rstrip().decode() for _ in range(n)] # .decodeはバイト列から文字列へ変換
# 一行に文字列が一個 * n行で文字列をアルファベット順に変換
s_lis=["".join(sorted(readline().rstrip().decode())) for _ in range(n)]
# 一行に文字列が複数個 * n行
s_lis=[readline().rstrip().split().decode() for _ in range(n)] # .decodeはバイト列から文字列へ変換

# 一行に数値が一個 * n行
s_lis=[int(readline().rstrip()) for _ in range(n)] 
# 一行に数値が複数個 * n行
s_lis=[int(readline().rstrip().split()) for _ in range(n)]

# dとAの行が交互に並んでいる場合
s = sys.stdin.readlines()
n, k=map(int, s[0].split())
d=[]
A=[]
for i in s[1:2*k:2]:
    d.append(int(i))
for i in s[2:2*k+1:2]:
    A.append(list(map(int, i.split())))
"""

# @taxfree-python
n, m, x = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(n)]

costs = []
for i in range(2 ** n):
    flag = True
    cost = 0
    algos = [0] * m # 理解度のリスト作成
    op = [False] * n # 買う書籍をTrueとしてリスト作成、初期:[False, False, .. ,False]
    for j in range(n):
        if ((i >> j) & 1): # ビット演算
            op[n - j - 1] = True # ex) [False, True, .. ,False]
    # print(op)

    for j in range(n):
        if op[j]: # opの各インデックスにおいて True の場合
            # 引数にリスト指定したenumerate関数のループ：https://note.nkmk.me/python-enumerate-start/
            for ind, el in enumerate(ca[j][1:]): # 
                algos[ind] += el
            cost += ca[j][0]
            #print(algos)
    for j in algos:
        if j < x:
            flag = False
    if flag:
        costs.append(cost)

if len(costs) == 0:
    print(-1)
else:
    print(min(costs))



Measured memory_bytes: 9300
package main

import (
	"fmt"
)

func main() {
	var N, M, X, Y int
	fmt.Scanf("%d%d%d%d", &N, &M, &X, &Y)
	xmax, ymin := X, Y
	for i := 0; i < N; i++ {
		var x int
		fmt.Scanf("%d", &x)
		if xmax < x {
			xmax = x
		}
	}
	for i := 0; i < M; i++ {
		var y int
		fmt.Scanf("%d", &y)
		if ymin > y {
			ymin = y
		}
	}
	if xmax < ymin {
		fmt.Println("No War")
	} else {
		fmt.Println("War")
	}
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int l=0, u=0, count=0, num=0;
        String s=sc.next();
        if(s.length()>=6)	count++;
        for(int i=0; i<s.length(); i++) {
        	if(Character.isUpperCase(s.charAt(i)))
        		u++;
        	if(Character.isLowerCase(s.charAt(i)))
        		l++;
        	if(s.charAt(i)== '0'|| s.charAt(i)== '1'||s.charAt(i)== '2'||s.charAt(i)== '3'||s.charAt(i)== '4'||s.charAt(i)== '5'||s.charAt(i)== '6'||s.charAt(i)== '7'||s.charAt(i)== '8'||s.charAt(i)== '9')
        		num++;
        }
        if(l==0 || u==0 || count==0 || num==0)
         System.out.println("INVALID");
        else
        	System.out.println("VALID");
    }
}


Measured memory_bytes: 26304
import sys
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))

r = 0
tmp = 0
ans = 0
for l in range(N):
    while r < N:
        if tmp ^ A[r] == tmp + A[r]:
            tmp += A[r]
            r += 1
        else:
            ans += r - l
            tmp -= A[l]
            break
    else:
        ans += r - l
print(ans)

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

typedef long long ll;

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

    int h,w,cnt=0;
    cin >> h >> w;
    char a[10][10];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> a[i][j];
            if(a[i][j]=='#') cnt++;
        }
    }
    if(cnt==h+w-1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{int n;
 cin>>n;
 string s[n];int p[n];int a[n];string t;int m,q;
 for(int i=0;i<n;i++)
 { cin>>s[i]>>p[i];a[i]=i+1;}
for(int i=0;i<n-1;i++)
for(int j=i+1;j<n;j++)
{ if((s[i]>s[j])||((s[i]==s[j])&&(p[i]<p[j])))
     {t=s[i];m=a[i];q=p[i];
     s[i]=s[j];a[i]=a[j];p[i]=p[j];
     s[j]=t;a[j]=m;p[j]=q;
     }
}for(int k=0;k<n;k++)
     cout<<a[k]<<endl;}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int k = Integer.parseInt(a+b);

    for (int i = 0; i < k; i++) {
      if (Math.pow(i,2) == k) {
        System.out.println("Yes");
        return;
      }
    }

    System.out.println("No");
    
  }

}


Measured memory_bytes: 23892
#include<iostream>
#include<math.h>
using namespace std;
int a[5];
int main()
{
    int k;
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;
    for(int i=0;i<5;i++)
    {
        for(int j=i+1;j<5;j++)
        {
            int sum=(a[i]-a[j])>=0?(a[i]-a[j]):-(a[i]-a[j]);
            if(sum>k)
            {
                cout<<":("<<endl;
                return 0;
            }
        }
    }
    cout<<"Yay!"<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var (A, B) = ReadLine().Split(' ').Select(int.Parse).ToArray();

        var ans = A <= 8 && B <= 8 ? "Yay!" : ":(";

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 28188
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n = sc.nextInt();
        int x = sc.nextInt();
        long d=0,ans=1;
        for (int i = 0; i < n; i++) {
			d+=sc.nextLong();
			if(d<=x)ans++;
		}
        out.println(ans);
        out.flush();
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}
//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    double c;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    	this.c=(double)b/a;
//    }
//
//    public int compareTo(P p){
//        return Double.compare(p.c,c);
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 21204
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FS reader = new FS();
		// write reader
		long a = reader.nextLong();
		long b = reader.nextLong();
		long c = reader.nextLong();
		long d = reader.nextLong();
		
		solver(a, b, c, d);
	}
	
	public static void solver(long a, long b, long c, long d) {
		// write logic
		System.out.println(Math.max(Math.max(a*c, b*d), Math.max(a*d, b*c)));
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}

Measured memory_bytes: 32124
l=[0]*5
for i in range(5):
    l[i]=input()

odr=[]
ans=0
for x in l:
    if int(x)%10==0:
        ans+=int(x)
    else:
        odr.append(x)
odr=sorted(odr,key=lambda x:x[-1],reverse=True)

for i in range(len(odr)):
    if i==len(odr)-1:
        ans+=int(odr[i])
    else:
        ans += int(odr[i]) + (10-int(odr[i])%10)
print(ans)




Measured memory_bytes: 3064
import java.util.*;
import java.io.*;

public class Main
{
  public static void main(String args[])throws IOException
  {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int size = Integer.parseInt(br.readLine());
    int[] arr = new int[size];
    int j=0;
    StringTokenizer tokenizer1 = new StringTokenizer(br.readLine());
    while(tokenizer1.hasMoreTokens())
    {
      arr[j] = Integer.parseInt(tokenizer1.nextToken());
      j++;
    }
    
    Arrays.sort(arr);
    
    double ans = 0.0;
    ans = arr[0] + arr[1];
    int k = 1;
    for(int i=2;i<size;i++)
    {
      ans += arr[i] * Math.pow(2,k);
      k++;
    }
    double ans2 = ans/Math.pow(2,size-1);
    int ans3 = (int)ans2;
    System.out.println(ans2);
  }
}

Measured memory_bytes: 22996
sx,sy,tx,ty=gets.split.map(&:to_i)
dx=tx-sx
dy=ty-sy
puts "R"*dx+"U"*dy+"L"*dx+"D"*(dy+1)+"R"*(dx+1)+"U"*(dy+1)+"L"+"U"+"L"*(dx+1)+"D"*(dy+1)+"R"


Measured memory_bytes: 1916
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main(int argc, char const *argv[]){
    string s;
    bool step = true;
    cin >> s;

    for (int i = 0; i < s.size(); i++)
    {
        char tar = s[i];
        if (i%2 == 0) {
            if (tar == 'L') {
                step = false;
            }
        }
        else {
            if (tar == 'R') {
                step = false;
            }
        }
    }
    
    if (step) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl; 
    }

    return 0;
}


Measured memory_bytes: 888
L, R = map(int, input().split())

if R - L >= 2019:
    print(0)
else:
    mod_l = L%2019
    mod_r = R%2019
    ans = 2019
    for i in range(mod_l, mod_r):
        for j in range(i+1, mod_r+1):
            if (i * j)%2019 == 0:
                ans = 0
                break
            ans = min(ans, (i * j)%2019)
        else:
            continue
        break
    print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

// [A+1, B-1]

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

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        if (!(a <= t && t < b)) {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
n,k = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
F = [int(i) for i in input().split()]
F.sort(reverse=True)

left = -1
right = 10**12
def f(x):
    cnt = 0
    for i in range(n): cnt += max(A[i]-x//F[i],0)
    return cnt <= k
    
while right - left > 1:
    mid = (left+right)//2
    if f(mid): right = mid
    else: left = mid
print(right)

Measured memory_bytes: 119500
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int n, k; cin >> n >> k;
    vector<int> A(n);   

    int cnt = 0, pos = 0;
    while(pos < n-1){
        pos += k-1;
        cnt++;
    }
    cout << cnt << ln;
}

Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, u, v;
    cin >> n >> u >> v;
    u--; v--;
    vector<set<int>> edges(n);
    vector<int> dist_u(n, -1);
    vector<int> dist_v(n, -1);
    for(int i=0;i<n-1;++i)
    {
        int a, b;
        cin >> a >> b;
        edges[a-1].insert(b-1);
        edges[b-1].insert(a-1);
    }
    int dist_u_v = 0;
    deque<pair<int,int>> q;
    q.push_back(MP(u, 0));
    while(!q.empty())
    {
        int current = q.front().first;
        int dist = q.front().second;
        q.pop_front();
        dist_u[current] = dist;
        for(const auto& nxt: edges[current]) {
            if(dist_u[nxt] == -1) q.push_back(MP(nxt, dist + 1));
        }
    }

    q.push_back(MP(v, 0));
    while(!q.empty())
    {
        int current = q.front().first;
        int dist = q.front().second;
        q.pop_front();
        dist_v[current] = dist;
        for(const auto& nxt: edges[current]) {
            if(dist_v[nxt] == -1) q.push_back(MP(nxt, dist + 1));
        }
    }
    int cand = -1;
    for(int i=0;i<n;++i)
    {
        if(dist_u[i] < dist_v[i]) {
            cand = max(cand, dist_u[i] + (dist_v[i] - dist_u[i] - 1));
        }
    }

    cout << cand << endl;
}

Measured memory_bytes: 15232
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        long[] num = new long[210];
        for(int i = 0; i < n; i++) num[i] = sc.nextLong();
        boolean odd = false;
        int ans = 0;
        lp: while(!odd) {
            for(int i = 0; i < n; i++) {
                if(num[i] % 2 == 1) {
                    odd = true;
                    break lp;
                }
                num[i] /= 2;
            }
            ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int n,k,vals[101],dp[100001][2];

int main(){
	cin >> n >> k;
	for(int i = 0 ; i < n ; i += 1){
		cin >> vals[i];
	}
	sort(vals,vals+n);
	for(int i = 0 ; i < vals[0] ; i += 1){
		dp[i][0] = false;
		dp[i][1] = true;
	}
	for(int i = vals[0] ; i <= k ; i += 1){
		bool ret1 = false , ret2 = true;
		for(int pos = 0 ; pos < n ; pos += 1){
			if(vals[pos] > i){
				break;
			}
			if(dp[i-vals[pos]][1] == true){
				ret1 = true;
			}
			if(dp[i-vals[pos]][0] == false){
				ret2 = false;
			}
		}
		dp[i][0] = ret1;
		dp[i][1] = ret2;
	}
	if(dp[k][0]){
		cout << "First" << endl;
	}else{
		cout << "Second" << endl;
	}
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

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

  int digs = 0;
  int tmp = N;
  while(tmp != 0){
    digs += tmp%10;
    tmp /= 10;
  }

  if(N%digs == 0)
    cout << "Yes"<<endl;
  else
    cout<<"No"<<endl;


  return 0;
}


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

namespace AtTest.ABC_147
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            List<int[]>[] xys = new List<int[]>[n];
            for(int i = 0; i < n; i++)
            {
                int a = ReadInt();
                xys[i] = new List<int[]>();
                for(int j = 0; j < a; j++)
                {
                    xys[i].Add(ReadInts());
                }
            }

            int all = 1 << 15;
            int res = 0;
            for(int i = 0; i < all; i++)
            {
                int[] honests = new int[n];
                int cnt = 0;
                for(int j = 0; j < n; j++)
                {
                    honests[j] = (i & (1 << j)) > 0 ? 1 : 0;
                    if (honests[j]==1) cnt++;
                }

                bool ok = true;
                for(int j = 0; j < n; j++)
                {
                    if (honests[j] == 0) continue;
                    for(int k = 0; k < xys[j].Count; k++)
                    {
                        if (honests[xys[j][k][0]-1]!=xys[j][k][1])
                        {
                            ok = false;
                            break;
                        }
                    }
                    if (!ok) break;
                }
                if (ok) res = Max(res, cnt);
            }
            WriteLine(res);
        }

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


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
}
 vi adj[100005];
 int ind[100005];
 int dis[100005];
int32_t main()
{
    c_p_c();
    int n;
    int m;
    cin>>n>>m;
    memset(ind,0,sizeof(ind));
     memset(dis,0,sizeof(dis));
    for(int i=0;i<m;i++)
    {  int v,u;
       cin>>u>>v;
        adj[u].pb(v);
        ind[v]++;
    }
    vector<int> srcs;
    queue<int> q;
    for(int i=1;i<=n;i++)
     {
         if(ind[i]==0)
         {
             srcs.pb(i);
             q.push(i);
         }
     }
    int ans=0; 
     while(!q.empty())
     {
         
         int cu=q.front();
         q.pop();
         
         for(auto v:adj[cu])
         {
             dis[v]=max(dis[v],dis[cu]+1);
             ans=max(ans,dis[v]);
             ind[v]--;
             if(ind[v]==0)
             {
                 q.push(v);
             }
         }
     }
     cout<<ans;
     
    
    return 0;
}

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

using namespace std;

template<class T>
int Levenshtein(const T& a, const T& b) {
    vector<vector<int>> dp(a.size() + 1, vector<int>(b.size() + 1, INT_MAX));
    for (int i = 0; i <= a.size(); i++) dp[i][0] = i;
    for (int i = 0; i <= b.size(); i++) dp[0][i] = i;
    for (int i = 0; i < a.size(); i++) {
        for (int j = 0; j < b.size(); j++) {
			dp[i+1][j+1] = min({dp[i+1][j] + 1, dp[i][j+1] + 1, dp[i][j] + (a[i] != b[j])});
        }
    }
    return dp[a.size()][b.size()];
}

int main() {
    string a, b;
	cin >> a >> b;
	cout << Levenshtein(a, b) << endl;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int INF = 1e9;
const ll lINF = 1e18;
const int MOD = 1e9+7;
const int SIZE = 100;


int main() {

	vector<pair<ll, int> > p;
	ll a[4];
	ll ans = 0;
	for (int i = 0; i < 4; i++) {
		cin >> a[i];
		p.push_back(make_pair(a[i], i));
	}
	ll n;
	cin >> n;
	for (int i = 0; i < 4; i++) {
		p[i].first *= (1 << (3 - i));
	}
	sort(p.begin(), p.end());

	for (int i = 0; i < 4; i++) {
		p[i].first /= (1 << (3 - p[i].second));
	}

	if (p[0].second == 3) {
		ans += (n / 2) * p[0].first;
		n %= 2;
		ans += n * p[1].first * (1 << (2 - p[1].second)); 
	} else {
		ans += n * p[0].first * (1 << (2 - p[0].second)); 
	}

	cout << ans << endl;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003;

int main(){
    
    int N;cin>>N;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i];
    }
    int ans=0;
    for(int i=2;i<N;i++){
        if(S[i-2]<S[i-1]&&S[i-1]<S[i]) ans++;
        if(S[i-1]>S[i]&&S[i-2]>S[i-1]) ans++;
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 256
MOD = 1000000007
n, m = gets.split.map(&:to_i)
a = m.times.map{gets.to_i} if m > 0

spls = Array.new(0)
fib = Array.new(n+1)
fib[0] = fib[1] = 1
for i in 2..n
  fib[i] = fib[i-1] + fib[i-2]
end

flag = 0
if m > 0
  for i in 0..(m-1)
    if i == 0
      if a[i] == 1
        spls.push(1)
      else
        spls.push(a[i] - 1)
      end
    else
      if a[i] - a[i-1] == 1
        flag = 1
        break
      else
        spls.push(a[i] - a[i-1] - 2)
      end
    end
  end
  if n - a[i] > 1
    spls.push(n - a[i] - 1)
  end
else
  spls.push(n)
end

ans = 1
if flag > 0
  puts 0
else
  spls.each do |sp|
    ans = (ans*fib[sp]) % MOD
  end
  puts ans
end

Measured memory_bytes: 445988
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e3+5,mod=924844033;
int n,k,cnt;
int jc[N],a[N],dp[N][N][2][2];
bool vis[N];
signed main(){
//	freopen("permutation.in","r",stdin);
//	freopen("permutation.out","w",stdout);
	scanf("%lld %lld",&n,&k);
	jc[0]=1;
	for(int i=1;i<=n;++i)jc[i]=jc[i-1]*i%mod;
	for(int i=1;i<=n;++i)
		if(!vis[i])
			for(int j=i;j<=n;j+=k){
				if(vis[j])break;
				else a[++cnt]=j,vis[j]=true;
			}
	dp[0][0][0][0]=1;
	a[0]=-(1<<30);
	for(int i=1;i<=n;++i){
		dp[i][0][0][0]=1;	
		for(int j=1;j<=i;++j){
			dp[i][j][0][0]=(dp[i-1][j][1][0]+dp[i-1][j][0][0])%mod;
			dp[i][j][1][0]=(dp[i-1][j][0][1]+dp[i-1][j][1][1])%mod;
			if(a[i+1]-a[i]==k){
				dp[i][j][0][1]=(dp[i-1][j-1][1][0]+dp[i-1][j-1][0][0])%mod;
				dp[i][j][1][1]=(dp[i-1][j-1][0][1]+dp[i-1][j-1][1][1])%mod;
			}
			if(a[i]-a[i-1]==k){
				(dp[i][j][0][0]+=dp[i-1][j-1][0][0])%=mod;
				(dp[i][j][1][0]+=dp[i-1][j-1][0][1])%=mod;
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;++i){
		int g=(dp[n][i][0][0]+dp[n][i][0][1]+dp[n][i][1][0]+dp[n][i][1][1])%mod;
		if(i&1)(ans+=mod-g*jc[n-i]%mod)%=mod;
		else (ans+=g*jc[n-i]%mod)%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 123776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    char C;
    cin >> C;
    printf("%c\n",C+1);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int h, w, a[514][514];
int cnt;
vector < pair<pair<int, int>, pair<int, int>>> ans;

signed main() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w)cin >> a[i][j];
	}
    if(h==1&&w==1){
		cout<<0<<endl;
    	return 0;
    }
  	rep(i, h) {
		if (i % 2 == 0) {
			rep(j, w) {
				if (a[i][j] % 2) {
					cnt++;
					if (j == w - 1) {
						ans.push_back({ { i + 1, j + 1 }, { i + 2, j + 1 } });
						a[i + 1][j]++;
					}
					else {
						ans.push_back({ {i + 1, j + 1}, {i + 1, j + 2} });
						a[i][j + 1]++;
					}
				}
				if (i == h - 1 && j == w - 2)break;
			}
		}
		else {
			for (int j = w - 1; j >= 0; j--) {
				if (a[i][j] % 2) {
					cnt++;
					if (j == 0) {
						ans.push_back({ {i + 1,j + 1},{i + 2,j + 1} });
						a[i + 1][j]++;
					}
					else {
						ans.push_back({ {i + 1,j + 1},{i + 1,j} });
						a[i][j - 1]++;
					}
				}
				if (i == h - 1 && j == 1)break;
			}
		}
	}
	cout << cnt << endl;
	rep(i, (int)ans.size()) {
		cout << ans[i].first.first << " " << ans[i].first.second << " " << ans[i].second.first << " " << ans[i].second.second << endl;
	}
}


Measured memory_bytes: 8172
#include<bits/stdc++.h>
#define oo 1000000007
using namespace std;
long long k;
long long dp[10005][105][2];
string s;
vector<long long>num;
long long solve(long long idx, long long sum, long long tight)
{
    if (idx == num.size())
        return (sum%k==0);
    if (dp[idx][sum][tight] != -1)
        return dp[idx][sum][tight];
    long long res = 0;
    long long biggest=(tight)?num[idx]:9;
    for (int i = 0; i <= biggest; i++)
    {
        long long newtight = ((num[idx])== i) ? tight : 0;
        res =(res+solve(idx + 1, (sum + i) % k, newtight))%oo;
    }
    return dp[idx][sum][tight] = res;
}
long long khoitao(string s)
{

    for(long long i=0;i<s.size();i++)
        num.push_back(s[i]-'0');
    return solve(0,0,1);
}
main()
{
    num.clear();
    memset(dp,-1,sizeof(dp));
    cin>>s>>k;
    cout<<(khoitao(s)-1+oo)%oo;
    return 0;
}


Measured memory_bytes: 17664
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val height = sc.nextInt()
    val width = sc.nextInt()

    val grid = Array(height) { sc.next().toCharArray() }


    val dx = arrayOf(-1, -1, -1, 0, 0, 1, 1, 1)
    val dy = arrayOf(-1, 0, 1, -1, 1, -1, 0, 1)
    for (x in 0 until width) {
        for (y in 0 until height) {
            var sum = 0
            if (grid[y][x] != '.') continue
            for (d in 0..7) {
                val nx = x + dx[d]
                val ny = y + dy[d]

                if (nx < 0 || ny < 0 || nx >= width || ny >= height) continue
                if (grid[ny][nx] == '#') sum += 1
            }
            grid[y][x] = '0' + sum
        }
    }
    grid.forEach { println(String(it)) }
}


class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}




Measured memory_bytes: 31268
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n;
	cin >> n;
	Vec t(n), a(n);
	rep(i, n) cin >> t[i];
	rep(i, n) cin >> a[i];

	Vec h(n);
	rep(i, n){
		if(!i || t[i] != t[i-1]) h[i] = t[i];
	}
	repr(i, n){
		if(h[i] && a[i] < h[i]){
			co(0);
			return 0;
		}
		if(i == n-1 || a[i] != a[i+1]){
			if(!h[i] || h[i] == a[i]) h[i] = a[i];
			else{
				co(0);
				return 0;
			}
		}
	}

	ll ans = 1;
	rep(i, n){
		if(!h[i]){
			ans *= min(a[i], t[i]);
			ans %= MOD;
		}
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 2560
n, a, b = map( int, input().split() )
h = [ int(input()) for _ in range(n) ]

def judge(k):
    _sum = 0
    for hh in h:
        t = hh-k*b
        if t > 0:
            _sum += (t+a-b-1) // (a-b)
            if _sum > k:
                return False;
    return True


high, low = int(1e9+9), 0

while low < high:
    mid = int((high + low) / 2)
    if judge(mid):
        high = mid;
    else:
        low = mid+1;

print(low)


Measured memory_bytes: 7072
#include<stdio.h>
int main(void)
{
	float i,j,n,y,b,r,t,X,S,x;
	while(1){
		scanf("%f",&n);
		if(n==0) break;
		X=0; S=0;
		scanf("%f",&y);
		for(i=0;i<n;i++){
			scanf("%f%f%f",&b,&r,&t);
			if(t==1){
				x=10000*(1+y*(r/100));
			}
			else{
				x=1;
				r=1+(r/100);
				for(j=0;j<y;j++){
					x*=r;
				}
				x=x*10000;
			}
			if(X<x){
				X=x;
				S=b;
			}
		}
		printf("%.0f\n",S);
	}
	return 0;
}

Measured memory_bytes: 1076
#include<bits/stdc++.h>
#define DIST(x1,x2, y1, y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
#define DIST3D(x1,x2, y1, y2, z1, z2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)))
#define CLR(a) a.clear()
#define VCLR(a, n) for(int i=0; i<=n+3; i++) a[i].clear()
#define SIZE(a) a.size()
#define ERASE(a, b) memset(a, b, sizeof a)
#define PB(a, b) a.push_back(b)
#define PB2(a,i,b) a[i].push_back(b)
#define LL long long
#define DBG cout<<"I Am Here"<<endl
#define DBGA(a) cout<<a<<endl
#define DBGI(b,a) cout<<b<<' '<<a<<endl
#define DBGL(i,s,e,b) or(int i=s; i<=e; i++) cout<<b<<endl
#define INF 1e9
#define INV 1e-6
#define sll(a) scanf("%I64d", &a)
#define pll(a) printf("%I64d\n", a)
#define si(a) scanf("%d", &a)
#define pii pair<int,int>
#define MAX 600005
#define CASE(i) printf("Case %d: ", i);
#define PI acos(-1)
#define piis pair<int, string>
#define fast1 ios_base::sync_with_stdio(false);
#define fast2 cin.tie(0)

using namespace std;

LL arr[100003];

int main()
{
    int n;
    scanf("%d", &n);

    vector<int>vec;
    for(int i=0; i<2*n; i++)
    {
        int x;
        scanf("%d", &x);
        vec.push_back(x);
    }

    sort(vec.begin(), vec.end(), greater<int>());

    int tot = 0;
    for(int i=0; i<2*n; i=i+2)
    {
        tot = tot + min(vec[i], vec[i+1]);
    }

    printf("%d", tot);
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cctype>
#include<cstdio>
//#include <string>
using namespace std;
int main(){
    while(true){
    string str;
    cin>>str;
    if(str[0]=='0'&&str.size()==1)break;
    int ans=0;
    for(int i=0;i<str.size();i++){
        ans+=str[i]-'0';
    }
    cout<<ans<<endl;
    
    }
    return 0;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007

using namespace std;

int dp[1001][1001];
char mp[1000][1001];

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

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

    for (int i = 0; i < h; i++)
        if (mp[i][0] == '#')
            break;
        else
            dp[i][0] = 1;
    for (int i = 0; i < w; i++)
        if (mp[0][i] == '#')
            break;
        else
            dp[0][i] = 1;

    for (int i = 1; i < h; i++)
        for (int j = 1; j < w; j++)
            if (mp[i][j] == '.')
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
    cout << dp[h - 1][w - 1] << '\n';


    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(a,n) for(int i = int(a); i<int(n); i++)
#define ll long long
#define pb push_back
#define pocetak begin
#define kraj end
using namespace std;



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


   /* ll t,a,b;
    ll k1,k2;
    cin>>t;
    while(t--)
    {

    }
*/
    ll n,i;
    cin>>n;
    set<string> s;
    string u;
    for(i=0;i<n;i++)
        {
            cin>>u;
            s.insert(u);
        }
    cout<<s.size();

   return 0;

}



Measured memory_bytes: 19252
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };



int main() {
	int N;
	char S[105];
	scanf("%d%s", &N,&S);

	int len = strlen(S);

	int ans = 0;

	for (int i = 1; i < len; i++) {
		int X[30] = { 0 };
		int Y[30] = { 0 };
		
		for (int j = 0; j < len; j++) {
			if (j < i)X[int(S[j])-97]++;
			else Y[int(S[j])-97]++;
		}

		int count = 0;
		for (int j = 0; j < 26; j++) {
			if (X[j] && Y[j])count++;
		}

		ans = max(ans, count);
	}

	printf("%d", ans);

}





/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

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

using namespace std;
#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 rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define ll long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int a, b;
	cin >> a >> b;
	print(a*b);
}

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

using namespace std;

template<typename T, typename U>
void primeFactorization(map<T, U> &primes, T N) {
  T n = N;
  U num = 0;
  while (n%2 == 0) {
    num++;
    n /= 2;
  }
  if (num != 0) {
    primes.emplace(2, num);
  }

  for (T i = 3; i*i <= N && i <= n; i += 2) {
    num = 0;
    while (n%i == 0) {
      num++;
      n /= i;
    }

    if (num != 0) {
      primes.emplace(i, num);
    }
  }

  if (n != 1) {
    primes.emplace(n, 1);
  }
}

int main(void) {
  long long N; cin >> N;
  int ans = 0;

  map<long long, int> primes;
  primeFactorization(primes, N);
  
  for (auto it = primes.begin(); it != primes.end(); ++it) {
    for (int i = 1, t = 0; i + t <= it->second; i++) {
      ans++;
      t += i;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxN = 2e3+7;
const int maxM = 1e5+7;
const int maxV = 90010;
//const int INF = 1e9+9;
//const ll INF = (1ll)<<60;
const int INF = 2e9+9;
const int MOD = 1e9+7;

ll A,B,C,D,z;
ll gcd(ll x,ll y)
{
	if( y == 0)
		return x;
	return gcd(y,x%y);	
} 
ll get(ll x)
{
	ll p = x/C;
	ll q = x/D;
	ll f = x/z;
	return x - (p+q-f);
}
int main()
{
	scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
	z = C*D/gcd(C,D);
	ll ans = get(B) - get(A-1);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	string s ;
	cin >> s;
	if(isupper(s[0])) cout << 'A' << endl;
	else cout << 'a' << endl;
	
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3652
def solve(K, S):
    count = 0
    for i in range(K+1):
        for j in range(K+1):
            if 0 <= S - i - j <= K:
                count += 1
    return count
def main():
    K, S = map(int, input().split())
    count = solve(K, S)
    print(count)
main()

Measured memory_bytes: 2940
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N,W = imn()
weight = []
value = []
for _ in range(N):
    w,v = imn()
    weight.append(w)
    value.append(v)

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight[i]]+value[i])
print(max(dp[N]))

Measured memory_bytes: 181312