akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC127().SolveC(new ConsoleInput(Console.In, ' '));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
  class ABC127
    {
    	public void SolveC(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var m = cin.ReadInt;
            var L = new int[m];
            var R = new int[m];
            for (int i = 0; i < m; i++)
            {
                L[i] = cin.ReadInt;
                R[i] = cin.ReadInt;
            }
            int min = L[0];
            int max = R[0];
            for (int i = 1; i < m; i++)
            {
                if (min < L[i]) min = L[i];
                if (max > R[i]) max = R[i];
            }
            if (max < min) WriteLine(0);
            else WriteLine(max - min + 1);
            ReadLine();
        }
    }
}


Measured memory_bytes: 17376
H,W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
i = 0
s = ["" for j in range(H)]
for y in range(H):
    for x in range(W):
        if x != 0: s[y] = s[y] + " "
        s[y] = s[y] + str(i+1)
        a[i] = a[i] - 1
        if a[i] == 0:
            i = i+1
    if y%2 == 0 : print(s[y])
    else:
        print(" ".join(s[y].split()[::-1]))

Measured memory_bytes: 3316
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define v_sum(a)         accumulate(a.begin(),a.end(),0)
#define v_max(a)         *max_element(a.begin(),a.end())
#define v_min(a)         *min_element(a.begin(),a.end())
#define v_uni(a)         a.erase(unique(a.begin(),a.end()),a.end())

using namespace std;



int main()
{
	Nayon;
	ll n,x,y,t,i,b,c,d,cz;
	string s;
	cin>>s;
	ll sum=0;
	for(i=0;i<s.size();i++){
		sum=sum+(s[i]-'0');
	}
	if(sum%9==0){
		cout<<"Yes"<<nl;
	}
	else{
		cout<<"No"<<nl;
	}
	return 0;

}

//Happy Coding........

Measured memory_bytes: 3760
#include <iostream>

 

using namespace std;

 

int main() 
{
    int a, b, c, i, ans;
    cin >> a >> b >> c;
    ans = 0;
    for(i=a; i<=b; i++)
    {
        if(c % i == 0)
            ans++;
    }
    cout << ans << endl;
}


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

int main(){
    ll n;
    cin>>n;
    string ans="No";
    for(ll i=1;i<=9;++i){
        for(ll j=1;j<=9;++j){
            if(i*j==n){
                ans="Yes";
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
//ABC153.cpp
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric> //accumulateに必要
#include <iomanip> //setprecision(桁数指定)に必要
using namespace std;

int main(){
	int H,A,ans;
	cin>>H>>A;
	ans = H/A;
	if(H%A==0);
	else ans += 1;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
		
	}
	
	public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		for(int i = 0; i < check.length; i++) {
			if(query == check[i]) containsInt = true;
		}
		
		return containsInt;
		
	}

}


Measured memory_bytes: 49456
n = int(input())
string = input()

left = string[:0]
right = string[0:]
w, r = left.count("W"), right.count("R")
count = max(w,r)

for i in range(1,n+1):
    next_str = string[i-1]
    if next_str == "W":
        w +=1
    else:
        r -= 1
    tmp = max(w,r)
    if tmp < count:
        count = tmp
        
print(count)

Measured memory_bytes: 9484
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <limits>
typedef long long ll;
#define REP(i,n)   for(int i=0; i<(int)(n); ++i)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); ++i)

#define in cin
#define out cout
#define pb push_back
using namespace std;
int main() {
	int n;
	while (in >> n) {
		if (!n)break;
		int a[100], b[100];
		int id = 0;
		REP(i, n) { in>>a[i] ; }
		FOR(i, 1, n * 2) {
			int c = 0;
			REP(j, n) {
				if (a[j] == i) {
					c = 1;
					break;
				}
			}
			if (!c) {
				b[id++] = i;
			}
		}
		int ba = 0, te = 0;

		while (1) {
			int dasita = 0;
			sort(a, a + n);
			sort(b, b + n);
			if (a[0] == 999 || b[0] == 999)break;
			if (!ba) {
				if (!te) {
					ba = a[0];
					te ^= 1;
					a[0] = 999;
				}
				else {
					ba = b[0];
					te ^= 1;
					b[0] = 999;
				}
			}
			else {
				if (!te) {
					REP(i, n) {
						if (ba < a[i] && a[i] != 999) {
							ba = a[i];
							a[i] = 999;
							dasita = 1;
							break;
						}
					}
					if (!dasita) ba = 0;

					te ^= 1;
				}
				else {
					REP(i, n) {
						if (ba < b[i] && b[i] != 999) {
							ba = b[i];
							b[i] = 999;
							dasita = 1;
							break;
						}
					}
					if (!dasita)ba = 0;
					te ^= 1;
				}
			}
		}
		int ac = 0, bc = 0;
		REP(i, n) {
			if (a[i] != 999)ac++;
			if (b[i] != 999)bc++;
		}
		out << bc << endl << ac << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
N, K = map(int,input().split())
h = []
for i in range(N):
    h.append(int(input()))
h.sort()
ans = 10e9
for i in range(N-K+1):
    if (h[i+K-1]-h[i])<ans:
        ans = h[i+K-1]-h[i]
print(ans)
        



Measured memory_bytes: 7384
Public Class Program
  Shared Sub Main()
    Dim kx As Integer() = Cin.IntArr()
    Dim k As Integer = kx(0)
    Dim x As Integer = kx(1)
    Console.WriteLine(If(500 * k >= x, "Yes", "No"))
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

Measured memory_bytes: 11220
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a,b=map(int,input().split())
print(a*b)

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

int main()
{
  int x, y, z;
  vector<int> box;

  cin >> x >> y >> z;

  box.push_back(z);
  box.push_back(x);
  box.push_back(y);

  cout << box.at(0) << " " << box.at(1) << " " << box.at(2) << endl;


  return 0;
}

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

#define rep(i,n) for(int i = 0;i < (n);i++)

using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
	
	int X, Y;
	bool flag = false;
	
	cin >> X >> Y;
	
	for(int i = 0;i <= X;i++){
		if( i * 2 + (X - i) * 4 == Y ){
			flag = true;
			break;
		}
	}
	
	if(flag){
		cout << "Yes";
	}
	else{
		cout << "No";
	}

	return 0;
	
}

Measured memory_bytes: 3620
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int h = in.nextInt() - 1;
        int w = in.nextInt() - 1;
        System.out.println(h * w);
    }
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException {super(System.out);}
}
class ContestScanner implements Closeable {
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 21588
import java.util.*;

public class Main {

	public Main() {
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int k = scanner.nextInt();
		int c = 0;
		for(int i = 1;;i++) {
			c = c + i;
			if(k <= c) {
				System.out.println(i);
				break;
			}
		}
	}

}


Measured memory_bytes: 22868
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;
const ll MAX_N = 55555;

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }
template<typename V> void printVec(V v) {ll i=0;for(auto x : v){std::cout << " [" << i++ << "] " << x;} print();}

bool is_prime[MAX_N + 1];

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

  ll N;
  std::cin >> N;

  for (ll i = 0; i <= MAX_N; i++) {
    is_prime[i] = true;
  }

  is_prime[0] = false;
  is_prime[1] = false;
  is_prime[2] = true;
  for (ll i = 2; i <= MAX_N; i++) {
    if (!is_prime[i]) continue;
    for (ll j = i * 2; j <= MAX_N; j += i) {
      is_prime[j] = false;
    }
  }

  std::vector<ll> va;
  for (ll i = 0; i <= MAX_N; i++) {
    if (is_prime[i] && i % 5 == 1) va.push_back(i);
  }

  for (ll i = 0; i < N; i++) {
    std::cout << va[i] << " ";
  }
  print();

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define I64 "%I64d"
#define RAN(v)v.begin(),v.end()
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
template<class T>
inline void upd1(T&a,T b){a>b?a=b:0;}
template<class T>
inline void upd2(T&a,T b){a<b?a=b:0;}
struct ano{
	operator ll(){
		ll x=0,y=0,c=getchar();
		while(c<48)
			y=c==45,c=getchar();
		while(c>47)
			x=x*10+c-48,c=getchar();
		return y?-x:x;
	}
}buf;
int main(){
	int n=buf,m=buf,k=buf;
	for(int i=0;i<n;++i){
		for(int j=0;j<m;++j)
			putchar("RYGB"[(i+j)/k%2*2+(i-j+m)/k%2]);
		puts("");
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n; cin>>n;
    if(n%2==0){
        vector<ll> a(n);
        rep(i,n) cin>>a[i];
        ll tmp=0;
        for(ll i=0; i<n; i+=2){
            tmp+=a[i];
        }
        vector<ll> right(n/2+1);
        for(ll i=0; i<n/2; i++){
            if(i==0) right[n/2-1]=a[n-1]-a[n-2];
            else right[n/2-1-i]=right[n/2-i]+a[n-1-2*i]-a[n-2-2*i];
        }
        rep(i,n/2){
            //chmax(left[i+1], left[i]);
            chmax(right[n/2-1-i], right[n/2-i]);
        }
        ll res=tmp;
        chmax(res, tmp+right[0]);
        for(ll i=0; i<n/2; i++){
            chmax(res, tmp+right[i+1]);
        }
        //rep(i,n/2+1) cout<<right[i]<<' '; cout<<endl;
        //rep(i,n/2) cout<<left[i]<<' '; cout<<endl;
        cout<<res<<endl;
    }else{
        vector<ll> a(n);
        rep(i,n) cin>>a[i];
        ll tmp=0;
        for(ll i=1; i<n; i+=2){
            tmp+=a[i];
        }
        vector<ll> left(n/2), right(n/2+1);
        for(ll i=0; i<n/2; i++){
            if(i==0) left[0]=a[0]-a[1];
            else left[i]=left[i-1]+a[2*i]-a[2*i+1];

            if(i==0) right[n/2-1]=a[n-1]-a[n-2];
            else right[n/2-1-i]=right[n/2-i]+a[n-1-2*i]-a[n-2-2*i];
        }
        rep(i,n/2){
            //chmax(left[i+1], left[i]);
            chmax(right[n/2-1-i], right[n/2-i]);
        }
        ll res=tmp;
        chmax(res, tmp+right[0]);
        for(ll i=0; i<n/2; i++){
            chmax(res, tmp+left[i]+right[i+1]);
        }
        //rep(i,n/2+1) cout<<right[i]<<' '; cout<<endl;
        //rep(i,n/2) cout<<left[i]<<' '; cout<<endl;
        cout<<res<<endl;
    }
    return 0;
}

Measured memory_bytes: 6364
from typing import List
import sys


def solution(inp: List) -> str:
    D = int(inp[0])
    T = int(inp[1])
    S = int(inp[2])
    if D/S <= T:
        return "Yes"
    return "No"


inp: List = []
for j in sys.stdin:
    inp += j.split()
print(solution(inp))


Measured memory_bytes: 10248
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

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

    int n = gi();
    int nb = 0;
    for (int i = 0; i < n; i++)
        if (gi() != i+1)
            nb++;
    printf(nb == 0 || nb == 2 ? "YES\n" : "NO\n");

    return 0;
}


Measured memory_bytes: 256
s = input()
q = int(input())
count = 0
a = []
b = []

for _ in range(q):
    Q = list(map(str, input().split()))
    if Q[0] == "1":
        count += 1
    else:
        if (int(Q[1])+count)%2 == 1:
            a.append(Q[2])
        else:
            b.append(Q[2])
    
        
a = "".join(a[::-1])
b = "".join(b)
s = a + s + b
if count%2 == 1 and count != 0:
    s = s[::-1]
print("".join(s))

Measured memory_bytes: 12116
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int M=0, S=0;
  cin >> N;
  int L[N];
  for(int i=0; i<N; i++) {
    cin >> L[i];
    if(M<L[i]) {
      M=L[i];
    }
  }
  for(int i=0; i<N; i++) {
    S+=L[i];
  }
  S-=M;
  if(M<S) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

public class E
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		if(N < 2 || N % 2 == 1)
		{
			WriteLine(0);
			return;
		}

		WriteLine(Min(cntFactor(N / 2, 2) + 1, cntFactor(N / 2, 5)));
	}

	private long cntFactor(long N, long p)
	{
		long K = 0;
		long tmp = N;
		while(tmp > 0)
		{
			K++;
			tmp /= p;
		}
		var pow = new long[K];
		pow[0] = p;
		for(int i = 1; i < K; i++)
			pow[i] = pow[i - 1] * p;

		long res = 0;
		for(int i = 0; i < K; i++)
			res += N / pow[i];

		return res;
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 13140
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  lines.shift();
  const arr = lines.shift().split(' ').map(Number);
  buildMaxHeap(arr);
  console.log(arr.reduce((s, e) => s += ' ' + e, ''));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  const maxHeapify = (i) => {
    let left, right, largest;
    left = 2 * i + 1;
    right = 2 * i + 2;
    largest = left < n && arr[left] > arr[i] ? left : i;
    if (right < n && arr[right] > arr[largest]) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(arr.length / 2); i >= 0; i--) maxHeapify(i);
}



Measured memory_bytes: 140172
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
long long num[100000];
int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		for(int j=i+1;j<s.length();j++){
			if(s[i]==s[j]){
				cout<<"no"<<endl;
				return 0;
			}
		}
	}
	cout<<"yes"<<endl;
	return 0;
}

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

using Int = __int128_t;
Int abs128(Int val){return val<0?-val:val;}

ostream &operator<<(ostream &os,Int val){
  if(ostream::sentry(os)){
    __uint128_t tmp=abs128(val);
    char buf[64];
    char *d=end(buf);
    do{
      --d;
      *d=char(tmp%10+'0');
      tmp/=10;
    }while(tmp);
    if(val<0) *--d='-';
    Int len=end(buf)-d;
    if(os.rdbuf()->sputn(d,len)!=len){
      os.setstate(ios_base::badbit);
    }
  }
  return os;
}

istream &operator>>(istream &is,Int &val){
  string s;
  is>>s;
  val=0;
  for(Int i=0;i<(Int)s.size();i++)
    if(isdigit(s[i])) val=val*10+s[i]-'0';
  if(s[0]=='-') val*=-1;
  return is;
}


//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  vector<Int> w(n),d(n);
  for(Int i=0;i<n;i++) cin>>w[i]>>d[i];
  auto check=[&](Int x){
    Int res=0;
    for(Int i=0;i<n;i++){
      if(w[i]>x) continue;
      Int y=x-w[i];
      res+=1+y/d[i];
    }
    //cout<<x<<" "<<res<<endl;
    return res;
  };
  
  Int l=0,r=1;
  for(Int i=0;i<30;i++) r*=10;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(check(m)>=k) r=m;
    else l=m;
  }
  cout<<r<<endl;
  return 0;
}


Measured memory_bytes: 3328
// Lec08-A Toggling Cases
#include<iostream>
#include<string>
int main(){
  std::string str;
  std::getline(std::cin, str);
  for(int i=0; i<str.length(); i++){
    if(str[i] >= 'A' && str[i] <= 'z') str[i]>='A'&&str[i]<='Z' ? str[i] += 32 : str[i] -= 32;
  }
  std::cout << str << std::endl;
  return 0;
}

Measured memory_bytes: 3196
from heapq import heappush, heappop, heapify

import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    N = int(readline())
    P = []; Q = []
    E = []; R = {}
    L = N + 20000
    for i in range(N):
        s, a = readline().split(); a = int(a) * L + i
        E.append(s)
        Q.append((-a, i))
        R[s] = (i, a)
    heapify(Q)
    for i in range(N // 5):
        b, i = heappop(Q)
        P.append((-b, i))
    heapify(P)

    pn = len(P); qn = len(Q)
    ln = N

    cur = N
    M = int(readline())
    for i in range(M):
        p, *g = readline().split()
        db = dk = -1
        if p == "+":
            t, b = g; b = int(b) * L + cur
            E.append(t)
            R[t] = (cur, b)
            ln += 1
            if ln >= 5 and -Q[0][0] < b:
                da = 1
                pn += 1
                heappush(P, (b, cur))
                if pn > ln // 5:
                    while 1:
                        c, k = heappop(P)
                        if E[k] is not None:
                            if c == b:
                                da = 0
                            else:
                                db = 0
                                dk = k
                            heappush(Q, (-c, k))
                            break
                    pn -= 1; qn += 1
            else:
                da = 0
                qn += 1
                heappush(Q, (-b, cur))
                if pn < ln // 5:
                    while 1:
                        c, k = heappop(Q)
                        if E[k] is not None:
                            if -b == c:
                                da = 1
                            else:
                                db = 1
                                dk = k
                            heappush(P, (-c, k))
                            break
                    pn += 1; qn -= 1
            if da:
                write("%s is working hard now.\n" % t)
            else:
                write("%s is not working now.\n" % t)
            cur += 1
        else:
            t, = g
            j, b = R[t]
            E[j] = None
            ln -= 1
            if P and P[0][0] <= b:
                pn -= 1
                if pn < ln // 5:
                    while 1:
                        c, k = heappop(Q)
                        if E[k] is not None:
                            heappush(P, (-c, k))
                            db = 1; dk = k
                            break
                    pn += 1; qn -= 1
            else:
                qn -= 1
                if pn > ln // 5:
                    while 1:
                        c, k = heappop(P)
                        if E[k] is not None:
                            heappush(Q, (-c, k))
                            db = 0; dk = k
                            break
                    qn += 1; pn -= 1
        if db != -1:
            if db:
                write("%s is working hard now.\n" % E[dk])
            else:
                write("%s is not working now.\n" % E[dk])
solve()



Measured memory_bytes: 26444
/*
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 VecVec = vector<Vec>;
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 repe(i, n) REPN(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>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void coVec(const Vec1<T> &v){for(T i : v) cosp(i); cout << endl;}
template <typename T>
void ce(const T n){cerr << n << endl;}
template <typename T>
void cesp(const T n){cerr << n << ' ';}
template <typename T>
void ceVec(const Vec1<T> &v){for(T i : v) cesp(i); cerr << 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, a;
	cin >> n >> a;
	Vec x(n+1);
	repn(i, n) cin >> x[i];

	ll zero = 0;
	repn(i, n) x[i] -= a;

	Vec2<ll> dp1(n+1, Vec(2505)), dp2(n+1, Vec(2505));
	dp1[0][0] = 1, dp2[0][0] = 1;
	repn(i, n){
		rep(j, 2505) dp1[i][j] = dp1[i-1][j];
		rep(j, 2505) dp2[i][j] = dp2[i-1][j];
		if(x[i] == 0) zero++;
		else if(x[i] > 0){
			rep(j, 2505) if(j >= x[i]) dp1[i][j] += dp1[i-1][j-x[i]]; 
		}else{
			rep(j, 2505) if(j >= -x[i]) dp2[i][j] += dp2[i-1][j+x[i]];
		}
	}

	ll ans = 0;
	rep(i, 2505) ans += dp1[n][i]*dp2[n][i];

	ans <<= zero;
	ans--;
	co(ans);

	return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int a, b; cin >> a >> b;
	for(int i = 1; i <= 3; i++) if(i != a && i != b) cout << i << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;
// const double PI = M_PI;

int N;
int ans[10001];

int f(int x, int y, int z) { return x * x + y * y + z * z + x * y + y * z + z * x; }

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

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int sum = f(x, y, z);
        if (sum <= N) {
          ans[sum]++;
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3132
package main

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

func main() {
	fsc := NewFastScanner()
	N, M := fsc.NextInt(), fsc.NextInt()
	N--
	M--
	fmt.Println(N * M)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


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


int main() {
        string s;
        cin >> s;
        int ans = 0;
        int cnt = 0;
        int n = s.size();
        rep(i,n){
                if(cnt == 0){
                        if(s[i] == 'g')cnt ++;
                        else {
                                cnt ++;
                                ans --;
                        }
                }
                else{
                        if(s[i] =='g'){
                                cnt --;
                                ans ++;
                        }
                        else{
                                cnt --;
                        }
                }
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(void){
	int r, g, b;
	scanf("%d%d%d", &r, &b, &g);
	int res = b*10 + g;
	if(res % 4 == 0){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	k := getNextInt(scanner)
	uf := make([]int, n)
	ans := make([]int, n)
	aa := make([]int, m)
	bb := make([]int, m)
	cc := make([]int, k)
	dd := make([]int, k)
	for i := 0; i < n; i++ {
		uf[i] = i
	}
	for i := 0; i < m; i++ {
		aa[i] = getNextInt(scanner) - 1
		bb[i] = getNextInt(scanner) - 1
		ra := root(aa[i], uf)
		rb := root(bb[i], uf)
		if ra == rb {
			continue
		}
		uf[rb] = ra
	}
	for i := 0; i < n; i++ {
		ans[root(i, uf)]++
	}
	for i := 0; i < n; i++ {
		ans[i] = ans[root(i, uf)]
	}
	for i := 0; i < m; i++ {
		if root(aa[i], uf) != root(bb[i], uf) {
			continue
		}
		ans[aa[i]]--
		ans[bb[i]]--
	}
	for i := 0; i < k; i++ {
		cc[i] = getNextInt(scanner) - 1
		dd[i] = getNextInt(scanner) - 1
		if root(cc[i], uf) != root(dd[i], uf) {
			continue
		}
		ans[cc[i]]--
		ans[dd[i]]--
	}
	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, ans[i]-1)
	}
}
func root(i int, uf []int) int {
	if i == uf[i] {
		return i
	}

	uf[i] = root(uf[i], uf)
	return uf[i]
}


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

int gcd(int x,int y){
int r;
if(y>x) swap(x,y);
while(y>0){
r=x%y;
x=y;
y=r;
}
return x;
}
int main(){
int a,b;
cin >>a >>b;
cout << gcd(a,b) <<endl;
return 0;
}

Measured memory_bytes: 3096
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

            // main.solveA(sc);
            main.solveB(sc);

        }
    }

    void solveB(Scanner sc) {
        char[] s = sc.next().toCharArray();
        int[] count = new int['z' - 'a' + 1];
        if (s.length == 1) {
            System.out.println("-1 -1");
            return;
        } else if (s.length == 2) {
            if (s[0] == s[1]) {
                System.out.println("1 2");
            } else {
                System.out.println("-1 -1");
            }
            return;
        }

        for (int i = 0; i < s.length; i++) {
            int c = s[i] - 'a';
            count[c]++;
            if (i < 2)
                continue;
            for (int cou : count) {
                if (cou >= 2) {
                    System.out.println(i - 1 + " " + (i + 1));
                    return;
                }
            }
            int m = s[i - 2] - 'a';
            count[m]--;
        }
        System.out.println("-1 -1");

    }

    void solveA(Scanner sc) {
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }

        int min = Integer.MAX_VALUE;
        for (int i = -100; i <= 100; i++) {
            int sum = 0;
            for (int num : list) {
                sum += Math.pow(num - i, 2);
            }
            min = Math.min(min, sum);
        }
        System.out.println(min);
    }

}


Measured memory_bytes: 13348
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	ll ans = 0;
	for(int b = 1; b <= n; b++){
		ans += (n/b) * max(0, b-k);
		ans += max(0, n%b - k + 1);
	}
	if(k == 0) ans -= n;
	cout << ans << endl;
    return 0;
}

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

int main() {
    int x, y;
    cin >> x >> y;
    string ans = "No";
    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            if(i + j == x && 2*i + 4*j == y){
                ans = "Yes";
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> x(N);
  for (int i = 0; i < N; i++){
    cin >> x.at(i);
  }
  int ans = 4*pow(10, 8);
  for (int i = 0; i < N-K+1; i++){
    if (x.at(i) <= 0 && x.at(i+K-1) >= 0){
      int a = min(x.at(i)*(-2)+x.at(i+K-1), x.at(i)*(-1)+x.at(i+K-1)*2);
      ans = min(ans, a);
    } else if (x.at(i) < 0 && x.at(i+K-1) < 0){
      ans = min(ans, x.at(i)*(-1));
    } else if (x.at(i) > 0 && x.at(i+K-1) > 0){
      ans = min(ans, x.at(i+K-1));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

  int n;
  cin>>n;
  vi data(n);
  rep(i,n){
    int tmp;
    cin>>tmp;
    data.at(i)=tmp;
  }
  

  vi place(n+1,n);
  place.at(0)=-1;
  
  for (int i=1;i<=n;i++){
    for (int j=place.at(i-1)+1;j<n;j++){
      if (data.at(j)==i){
        place.at(i)=j;
        break;
      }
    }
  }
  
  
  int answer=n;
  
  if (place.at(1)==n){
    answer=-1;
  }
  else {
    for (int i=1;i<=n;i++){
      if (place.at(i)==n){
        break;
      }
      answer+=-1;
    }
  }
  
  cout<<answer<<endl;
      


}




















Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll x;
  cin >> x;

  int year = 0;
  ll n = 100;
  while (1) {
    n += 0.01*n;
    year++;
    if (n >= x) {
      cout << year << endl;
      return 0;
    }
  }
}

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

int main() {
  string s;
  cin>>s;
  int kazu=0;
  if(s.size()<15)kazu+=15-s.size();
  for(int i=0;i<s.size();i++){
    if(s[i]=='o')kazu++;
  }
  if(kazu>=8)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int main(){
	int a[3];
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	std::sort(a,a+3);
	if(a[0]==5&&a[1]==5&&a[2]==7)printf("YES\n");
	else printf("NO\n");
	return 0;
}

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

int main(){
  int N,M,l,r,sml=0,lar=1000000;
  cin >> N >> M;
  for(int i=0;i<M;i++){
    cin >> l >> r;
    sml=max(sml,l);
    lar=min(lar,r);
  }
  if(lar-sml+1>=0)
  cout << lar-sml+1 << endl;
  
  else
    cout << 0 << endl;
}

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


int main() {
    int N;
    cin>>N;
    vector<int> A(N);
    vector<int> cp(N);
    for(int i=0;i<N;i++){
        int a;
        cin>>A.at(i);
        cp.at(i) = A.at(i);
    }

    sort(cp.begin(),cp.end(),greater<>());

    int ft,sd;

    ft = cp.at(0);
    sd = cp.at(1);

    for(int i=0;i<N;i++){
        if(ft==A.at(i)){
            cout<<sd<<endl;
        }else{
            cout<<ft<<endl;
        }
    }

    return 0;



}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


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

    string ans;

    while (n>0)
    {
        n--;
        ll mod = n%26;
        ans=(char)('a'+mod)+ans;
        n/=26;
    }
    

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

Measured memory_bytes: 3620
//
//  main.cpp
//  1
//
//  Created by RISHAV SINGH MEHTA on 31/01/20.
//  Copyright © 2020 RISHAV SINGH MEHTA. All rights reserved.
//

#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
int main(int argc, const char * argv[]) {
    // insert code here...
    ll int T,i,j,k,l,H,A;
    cin>>H>>A;
    if (H%A == 0){
        cout<<H/A;
    }else{
        cout<< H/A + 1;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <vector>
#include <limits.h>
#include <stack>
#include <queue>

using namespace std;

#define PI 3.14159265359
#define INF LLONG_MAX


int main(int argc, char const *argv[])
{
    int X, nA, nB, nC;
    cin >> nA >> nB >> nC >> X;
    int A = 500;
    int B = 100;
    int C = 50;

    // all search
    int cnt = 0;
    int sum = 0;

    for (int i = 0; i <= nA; ++i) {
        for (int j = 0; j <= nB; ++j) {
            for (int k = 0; k <= nC; ++k) {
                sum = A*i + B*j + C*k;
                if (sum == X) {
                    ++cnt;
                }
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
while True:
    h,w = map(int,input().split())
    if h==0 and w==0:
        break
    for hh in range(h):
        for ww in range(w):
            if hh%2==0 and ww%2==0:
                print("#",end="")
            elif hh%2==0 and ww%2==1:
                print(".",end="")
            elif hh%2==1 and ww%2==0:
                print(".",end="")
            elif hh%2==1 and ww%2==1:
                print("#",end="")
        print()

    print()



Measured memory_bytes: 7004
#include<stdio.h>

int main(void){
    long int l, r;
    long int ans = 0;
    long int i, j;
    long int mod = 2018;
    scanf("%ld %ld",&l, &r);
    if(r-l-1 >= 2019){
        ans = 0;
        printf("%ld\n",ans);
        return 0;
    }

    for(i=l;i<r;i++){
        for(j=i+1;j<=r;j++){
            if((i*j)%2019 < mod){
            mod = (i*j)%2019;
            }
        }
    }
    ans = mod;
    printf("%ld\n",ans);
    return 0;
    
}


Measured memory_bytes: 128
diagram = gets.chomp.chars

upper_skip = ->{
  loop do
    a = diagram[0]
    return false if a == "\\"
    return true unless a
    diagram.shift
  end
}

downer_skip = ->(target_depth) {
  depth = 0
  index = 0
  until depth == target_depth
    depth -= 1 if diagram.shift == "\\"
    index += 1
  end
  index
}

highest = ->{
  max_index = height = 0
  max_height = -Float::INFINITY 
  0.upto(diagram.size - 1) do |j|
    case diagram[j]
    when "\\"
      height -= 1
    when "/"
      height += 1
      max_height, max_index = height, j if max_height < height
      return [0, j] if height.zero?
    end
  end
  [max_height, max_index]
}

calc = ->(from, to) {
  depth = area = 0
  from.upto(to) do
    case diagram.shift
    when "\\"
      area += depth + 1/2r
      depth += 1
    when "_"
      area += depth
    when "/"
      depth -= 1
      area += depth + 1/2r
    end
  end
  area.to_i
}

pools = []
loop do
  break if upper_skip.()
  height, index = highest.()
  if height.zero?
    pools << calc.(0, index)
  elsif height == -Float::INFINITY
    break
  else
    first_index = downer_skip.(height)
    pools << calc.(first_index, index)
  end
  break if diagram.size.zero?
end
if pools.empty?
  puts 0
  puts 0
else
  puts pools.inject(&:+)
  puts pools.size.to_s + " " + pools.join(" ")
end


Measured memory_bytes: 8036
using System;

namespace Atcoder
{
    class ABC117_A
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int t = int.Parse(str[0]);
            int x = int.Parse(str[1]);
            Console.Write((double)t / x);
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
 
using namespace std;
 
int main(){
  int A,B;
  cin >> A >> B;
  if (0<A && A<10 && 0<B && B<10){
  	cout << A*B << endl;
  }else{
  	cout <<"-1"<<endl;
  }
 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz 10000002
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define P push
#define VEC(n) ll int x; vector<ll int>v;for(int i=0;i<n;i++){cin>>x;v.pb(x);}
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll divisor[10000000];

int main()
{
    FAST();
    ll int n,m,res=0;
    cin>>n;

    for( int i=1;i<=n;i++)
    {
        for(int j=1;(ll)j*i<=n;j++)
        {
            divisor[i*j]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        res+=i*divisor[i];
    }
    cout<<res<<endl;

}




Measured memory_bytes: 81716