akhauriyash/Code-Regression huggingface dataset:
import java.io.{PrintWriter, _}
import java.util
import java.util._


object Main {
  def main(args: Array[String]): Unit = {
    val inputStream = System.in
    val outputStream = System.out
    val in = new InputReader(inputStream)
    val out = new PrintWriter(outputStream)
    val solver = new Task
    solver.solve(1, in, out)
    out.close()
  }

  class Task {
    def solve(testNumber: Int, in: InputReader, out: PrintWriter): Unit = {
      val a = in.nextInt
      val b = in.nextInt
      out.println(math.max(a - b, 0))
    }
  }

  class InputReader(val stream: InputStream) extends AutoCloseable {
    //reader = new BufferedReader(new FileReader(stream), 32768);
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer = new StringTokenizer("")


    def next: String = {
      while ( {
        tokenizer == null || !tokenizer.hasMoreTokens
      }) try
        tokenizer = new StringTokenizer(reader.readLine)
      catch {
        case e: IOException =>
          throw new RuntimeException(e)
      }
      tokenizer.nextToken
    }

    def nextLine: String = {
      try
        return reader.readLine
      catch {
        case e: IOException =>
          e.printStackTrace()
      }
      ""
    }

    def nextInt: Int = next.toInt

    def nextLong: Long = next.toLong

    override def close(): Unit = {
    }
  }

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

bool find(vector<string> &a, int ai, int aj, vector<string> &b) {
	for(int i=0;i<b.size();i++) {
		for(int j=0;j<(int)b[i].length();j++) {
			if(a[ai+i][aj+j]!=b[i][j])return false;
		}
	}
	return true;
}

void solve(int test_case) {
	int an,bn;
	cin>>an>>bn;
	vector<string> a(an),b(bn);
	for(string &s:a)cin>>s;
	for(string &s:b)cin>>s;
	bool ans = false;
	for(int i=0;i<=an-bn;i++){
		for(int j=0;j<=an-bn;j++){
			ans=find(a,i,j,b);
			if(ans)break;
		}
		if(ans)break;
	}
	if(ans)cout<<"Yes";
	else cout<<"No";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

int dist(string &a, string &b) {
	int cnt = 0;
	for(int i = 0; i < a.length(); i++) {
		if(a[i] != b[i]) cnt++;
	}
	
	return cnt;
}

void solve() {
	string s, t;
	cin >> s >> t;
	
	int ans = t.length();
	for(int i = 0; i <= s.length() - t.length(); i++) {
		string a = s.substr(i, t.length());
		ans = min(ans, dist(a, t));
	}
	
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 3652
import java.util.*;
import java.io.*;
/**
 *  @author citizen11
 *  AtCoder Regular Contest 78
 *  Task D - Fennec VS. Snuke
 */
public class Main {
    public static void main(String[] args) {
        Reader.init(System.in);
        try {
            int n = Reader.nextInt();
            List<int[]> A = new ArrayList<>();
            for (int i = 0; i < n-1; i++) {
                A.add(new int[] {Reader.nextInt(), Reader.nextInt()});
            }
            System.out.println(solve(n, A));
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static String solve(int n, List<int[]> A) {
        Map<Integer, List<Integer>> graph = constructGraph(n, A);
        int[] fenecDist = new int[n + 1];
        Arrays.fill(fenecDist, -1);
        int[] snukeDist = new int[n + 1];
        Arrays.fill(snukeDist, -1);
        dfs(graph, fenecDist, 1, 0);
        dfs(graph, snukeDist, n, 0);

        int[] fscore = new int[n + 1];
        for (int i = 1; i < n + 1; i++) {
            if (fenecDist[i] <= snukeDist[i])
                fscore[i] = 1;
        }
        return Arrays.stream(fscore).sum() > n / 2 ? "Fennec" : "Snuke";
    }

    private static void dfs(Map<Integer, List<Integer>> graph, int[] dist, int start, int depth) {
        if (dist[start] > -1)
            return;
        dist[start] = depth;
        for (int i : graph.get(start)) {
            dfs(graph, dist, i, depth + 1);
        }
    }

    private static Map<Integer, List<Integer>> constructGraph(int n, List<int[]> A) {
        Map<Integer, List<Integer>> graph = new HashMap<>();
        for (int i = 0; i <= n; i++) {
            graph.put(i, new ArrayList<Integer>());
        }
        for (int i = 0; i < A.size(); i++) {
            int[] edge = A.get(i);
            graph.get(edge[0]).add(edge[1]);
            graph.get(edge[1]).add(edge[0]);
        }
        return graph;
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(
                   reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 81444
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

constexpr int mpow(const int &a, int n) noexcept {
   if(n == 0) return 1;
   auto t = mpow(a, n / 2);
   t = t * t;
   if(n & 1) t = t * a;
   return t;
}
  
signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
  
  int n;
  cin >> n;

  cout << mpow(n, 3) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAXN 11

int main()
{
    char s[MAXN], t[MAXN], u[MAXN];
    long long i, j, a, b;
    scanf("%s%s", s, t);
    scanf("%lld%lld", &a, &b);
    scanf("%s", u);

    for(i = 0; s[i]; i++)
    {
      for(j = 0; u[j] && s[i + j] && u[j] == s[i + j]; j++);
      if(!u[j]) { a = a ? a - 1 : a; break; }
    }

    for(i = 0; t[i]; i++)
    {
      for(j = 0; u[j] && t[i + j] && u[j] == t[i + j]; j++);
      if(!u[j]) { b = b ? b - 1 : b; break; }
    }
    printf("%lld %lld\n", a, b);

    return 0;
}

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

#define sz(x) static_cast<int>((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using ld = long double;

template<class T> bool cmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool cmx(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	cout << ((n + 1) * n) / 2 << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int pattern[7][4][2] = {
					{ { 0, 0 }, { 0, 1 }, { 1, 0 }, { 1, 1 } },	// A
					{ { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 } },	// B
					{ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 } },	// C
					{ { 0, 0 }, { 1, 0 }, { 1,-1 }, { 2,-1 } },	// D
					{ { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 2 } },	// E
					{ { 0, 0 }, { 1, 0 }, { 1, 1 }, { 2, 1 } },	// F
					{ { 0, 0 }, { 0, 1 }, {-1, 1 }, {-1, 2 } }};	// G
int grid[8][8];

int main()
{
//	cut here before submit 
//	freopen ("testcase.FS", "r", stdin );
	bool end = false;
	while (1 ){
		memset (grid, 0, sizeof (grid ) );
		string str = "";
		rep (i, 8 ){
			if (getline (cin, str ) ){
				rep (j, 8 ){
					grid[i][j] = (int)(str[j] - '0' );
				} // end rep
			}else{
				end = true;
				break;
			} // end if
		} // end rep
		if (end ) break;
		int res = 0;
		bool found = false;
		rep (row, 8 ){
			rep (col, 8 ){
				if (grid[row][col] == 1 ){
					rep (p, 7 ){
						bool ok = true;
						rep (k, 4 ){
							int nr = row + pattern[p][k][0];
							int nc = col + pattern[p][k][1];
							if (nr < 0 || nr >= 8 || nc < 0 || nc >= 8 || grid[nr][nc] == 0 ){
								ok = false;
								break;						
							} // end if
						} // end rep
						if (ok ){
							res = p;
							found = true;
							break;
						} // end if
					} // end rep
				} // end if
				if (found ) break;
			} // end rep
			if (found ) break;
		} // end rep

		cout << (char)(res + 'A' ) << endl;
		getline (cin, str );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <array>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
const int  INF=10e7;

typedef  pair<int,int> P;


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



     cout<<setprecision(10)<<a/b<<endl;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: String = iterator.next().unwrap().to_string();
    return format!("{} {}", &s[0..4], &s[4..12]);
}


Measured memory_bytes: 2116
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N = int(input())
Alist = inpl()

i = 0
j = 1
x = 0
y = 0
while i + j != N+1 :
    if y >= x:
        x += Alist[i]
        i += 1
    elif y < x:
        y += Alist[-j]
        j += 1

print(abs(x-y))

Measured memory_bytes: 26928
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int k, a, b;
  cin >> k >> a >> b;
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();
		int min = 0;
		int count = 0;

		if (A < B) {
			min = A;
		} else {
			min = B;
		}

		for (int i = min; i >= 1; i--) {
			if(A%i==0 && B%i==0) {
				count++;
				if(count==K) {
					System.out.println(i);
					break;
				}
			}
		}
		scan.close();
	}
}


Measured memory_bytes: 21716
import math
from collections import deque
def main():
    n,a,b = tuple([int(t)for t in input().split()])

    if b == 0:
        print(n)
    else:
        t = a+b
        res = (n // t)*a+min(n%t,a) 
        print(res)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

typedef struct StkKey {
    int b4;
    int area;
} StkKey;
typedef struct StkDat {
    StkKey key;
    struct StkDat *next;
} StkDat;
typedef struct Stack {
    size_t len;
    StkDat *top;
} Stack;
#define stk_init(s) ((s) ? ((s)->len = 0, (s)->top = NULL) : 0)
#define stk_len(s) ((s) ? (s)->len : 0)
#define stk_top(s) ((s)->top->key)
StkKey stk_pop(Stack *stk_hdr) {
    assert(stk_hdr->len != 0);
    stk_hdr->len--;
    StkKey key = stk_hdr->top->key;
    StkDat *old_head = stk_hdr->top;
    stk_hdr->top = stk_hdr->top->next;
    free(old_head);
    return key;
}
void stk_push(Stack *stk_hdr, const StkKey key) {
    StkDat *new_dat = (StkDat *)malloc(sizeof(StkDat));
    new_dat->key = key;
    new_dat->next = stk_hdr->top;
    stk_hdr->top = new_dat;
    stk_hdr->len++;
}

int main(int argc, char **argv) {
    Stack stk_index;
    stk_init(&stk_index);
    Stack stk_area;
    stk_init(&stk_area);
    char c;
    StkKey key;
    for(int i = 0; ~scanf("%c", &c); ++i) {
        switch(c) {
        case '\\':
            stk_push(&stk_index, (StkKey){i, 0});
            break;
        case '/':
            if(stk_len(&stk_index) == 0) break;
            key = stk_pop(&stk_index);
            while(stk_len(&stk_area) && key.b4 < stk_top(&stk_area).b4) {
                key.area += stk_pop(&stk_area).area;
            }
            stk_push(&stk_area, (StkKey){key.b4, i - key.b4 + key.area});
            break;
        default:
            break;
        }
    }
    int rstack[10000];
    int area = 0;
    int stk_len = (int)stk_len(&stk_area);
    for(size_t i = 0; i < stk_len; ++i) {
        rstack[i] = stk_pop(&stk_area).area;
        area += rstack[i];
    }
    printf("%d\n", area);
    printf("%d", stk_len);
    for(int i = stk_len - 1; i >= 0; --i) {
        printf(" %d", rstack[i]);
    }
    printf("\n");
}



Measured memory_bytes: 2484
#include <stdio.h>
#include <string.h>

int main(void) {
  char p[101], s[101];
  int i, pptr, sptr, plen, slen, flag;
  scanf("%s %s", &p, &s);
  plen = strlen(p);
  slen = strlen(s);
  i = 0;
  flag = 0;
  while (i < plen) {
    for (sptr = 0; sptr < slen; sptr++) {
      if (i + sptr >= plen) {
    	  pptr = i + sptr - plen;
      } else {
    	  pptr = i + sptr;
      }
      if (p[pptr] != s[sptr]) {
        break;
      }
    }
    if (sptr == slen) {
      flag = 1;
      break;
    }
    i++;
  }
  if (flag == 1) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x=3;
    while(x--)
    {
        string s;
        cin>>s;
        char c=s[0]-'a'+'A';
        cout<<c;

    }
    cout<<endl;
    
    return 0;   
}




 
 


Measured memory_bytes: 256
temp = list(map(int, input().split()))
temp.sort()
a, b, c = temp[0], temp[1], temp[2]
count = 0

while(c - b > 1):
    b += 2
    count += 1

while(b - a > 1):
    a += 2
    count += 1

if a == b == c: print(count)
elif c - b == 1 and b - a == 1: print(count + 3)
elif c - b == 1 and b - a == 0: print(count + 1)
else: print(count + 2)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-8;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int x, y, z;
	while (scanf("%d%d%d", &x, &y, &z), x|y|z)
	{
		double p = 1.0 / x;
		int v[4], e[51], a[51];
		for (int i = 0; i < x; ++i)
			scanf("%d", v + i);
		memset(e, 0, sizeof(e));
		for (int i = 0; i < z; ++i)
		{
			int t;
			scanf("%d", &t);
			scanf("%d%d", e + t, a + t);
		}

		static double dp[51][5001];
		for (int i = 0; i <= y; ++i)
			for (int j = 0; j <= 5000; ++j)
				dp[i][j] = 0;
		dp[0][0] = 1;
		for (int i = 0; i < y; ++i)
		{
			for (int j = 0; j <= 5000; ++j)
			{
				for (int k = 0; k < x; ++k)
				{
					int to = min(y, i + v[k]);
					int money = j;
					if (e[to] == 1)
						to = min(y, to + a[to]);
					else if (e[to] == 2)
						money = min(5000, money + a[to]);
					else if (e[to] == 3)
						money = max(0, money - a[to]);

					dp[to][money] += dp[i][j] * p;
				}
			}
		}

		double res = 0;
		for (int i = 0; i <= 5000; ++i)
			res += i * dp[y][i];

		printf("%d\n", (int)res);
	}

	return 0;
}

Measured memory_bytes: 2868
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var A = Slist();
            var an = new List<KeyValuePair<long, long>>();
            for (var i = 0; i < N; ++i)
                an.Add(new KeyValuePair<long, long>(A[i], i + 1));
            an.Sort((l, r) => (int)(l.Key - r.Key));
            for (var i = 0; i < N; ++i)
                Write(an[i].Value + " ");
                
        }
    }
}

Measured memory_bytes: 32056
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=2e5+100;
LL a[N];
vector<char>V;
int main()
{
	string str;
	while(cin>>str)
	{
		int len=str.length();
		if(str[0]==str[len-1])
		{
			int tmp=len-2-1;
			if(tmp&1)
			{
				cout<<"First"<<endl;
			}
			else
			{
				cout<<"Second"<<endl;
			}
		}
		else
		{
			int tmp=len-2;
			if(tmp&1)
			{
				cout<<"First"<<endl;
			}
			else
			{
				cout<<"Second"<<endl;
			}
		}
		
	}
	
	return 0;
} 

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var x = IO.RInt;
            int i = 1;
            int sum = 0;
            while (sum <= 1001001001)
            {
                sum += i;
                if (x <= sum)
                {
                    WriteLine(i);
                    return;
                }
                i++;
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, X[105], P[105];

int main(){
  cin >> N;
  for (int i = 0; i < N; i++) cin >> X[i];

  for (int i = 0; i <= 100; i++){
    for (int j = 0; j < N; j++){
      P[i] += (i - X[j]) * (i - X[j]);
    }
  }
  sort(P, P + 101);
  cout << P[0] << endl;

  return 0;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;

int main()
{
    int n, m;
    VI v;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    int total = accumulate(v.begin(), v.end(), 0);
    int popular = 0;
    for (int e : v) {
        if (double(e) / (double)total >= 1.0 / (4.0 * double(m))) {
            popular++;
        }
    }
    cout << (popular >= m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int w, h , x , y , r;
   
   cin >> w >> h >> x >> y >> r;
   
   if(x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
   
   return 0;
}


Measured memory_bytes: 3116
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int n, k;
int main() {
	int a, b;
	cin >> a >>b;
	int ans;
	ans = max(a + b, a - b);
	ans = max(ans,a*b);
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}

int calc(int x,int y,string s){
    if(s == "+") return x+y;
    if(s == "-") return x-y;
    if(s == "*") return x*y;
    return 0;
}

int main(){
    stack<int>a;
    string s;
    while(cin >> s){
        //if(cin.eof()) break;
        
        if(s=="+"||s=="-"||s=="*"){
            int numA = a.top(); a.pop();
            int numB = a.top(); a.pop();
            
            a.push(calc(numB,numA,s));
        }else{
            int x = stoi(s);
            a.push(x);
            
        }
        
        if(getchar()=='\n') break;
        
    }
    
    cout << a.top() << endl;
    
    
    
}




Measured memory_bytes: 3156
using System;

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            if (s[2] == s[3] && s[4] == s[5])
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<string> S(N+1),sub,sub2;   
    for(int i = 0;i < N+1;i++){
        cin >> S[i];
        if(S[i].find("?") == -1)sub.push_back(S[i]);
        else    sub2.push_back(S[i]);
    }
    //cout << sub.size() << endl;//
    int l = 0,r = 1;
    if(sub.size() != 1){
        sort(sub.begin(),sub.end());
        auto itl = lower_bound(sub.begin(),sub.end(),S.back());
        auto itr = upper_bound(sub.begin(),sub.end(),S.back());
        //cout << *itl << endl << *itr << endl;//
        l = distance(sub.begin(), itl);
        r = distance(sub.begin(), itr);
    }
    
    //cout << l << " " << r << endl;
    if(sub2.size()){
        for(auto ss:sub2){
            //cout << ss << endl;
            bool lf,rf;//左にある　右にある
            string str = ss;
            for(char &c :str)if(c == '?')c = 'a';
            //cout << str << endl;//
            lf = (S.back() < str);

            str = ss;
            for(char &c :str)if(c == '?')c = 'z';
            //cout << str << endl;//
            rf = (S.back() > str);

            if(!lf && rf){
                l++,r++;
            }else if(!lf && !rf){
                r++;
            }
        }
    }
    for(int i = l;i < r;i++){
        cout << i+1 << (i+1 == r ? "\n" : " ");
    }
//    cout << l << " " << r << endl;
}

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

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define FI first
#define SE second
using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}

template <typename T>
struct Graph_ {
  int n;
  vector<vector<T> > d;
  vector<vector<int> > path;
  Graph_(int ns) {
    n = ns;
    d = vector<vector<T> >(n, vector<T>(n, numeric_limits<T>::max() / 10));
    path = vector<vector<int> >(n, vector<int>(n, -1));
    for(int i = 0; i < n; i++)d[i][i] = 0;
  }
  void warshall_floyd(){
    for(int k = 0; k < n; k++){
      for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
          if(d[i][j] > d[i][k] + d[k][j]){
            d[i][j] = d[i][k] + d[k][j];
            path[i][j] = k;
          }
        }
      }
    }
  }
  void adde(int at, int to, T cost){
    d[at][to] = cost;
  }
};

typedef struct Graph_<int> GraphI;
typedef struct Graph_<ll> GraphL;


int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  GraphL graph(n);
  rep(i, m){
    int a, b, d;
    cin >> a >> b >> d;
    graph.adde(a, b, d);
  }
  graph.warshall_floyd();
  rep(i, n){
    if(graph.d[i][i] < 0){
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }
  rep(i, n){
    rep(j, n){
      if(graph.d[i][j] >= numeric_limits<ll>::max() / 100)cout << "INF";
      else cout << graph.d[i][j];
      cout << "\n "[j + 1 != n];
    }
  }
	return 0;
}



Measured memory_bytes: 3336
s = input()

cnt = 0
maxc = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
    cnt += 1
  else:
    cnt = 0

  if maxc < cnt:
    maxc = cnt

print(maxc)

Measured memory_bytes: 38256
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    string test = "RC";
    string s;
    cin>>s;
    if(s == "ABC")
        cout<<"ARC";
    else
        cout<<"ABC";
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

const int INF = 1001001001;

int main(){
  int n, m, R;
  cin >> n >> m >> R;
  vector<int> r(R);
  rep(i, R){
    int a;
    cin >> a;
    a--;
    r.at(i) = a;
  }
  vector<vector<int>> gr(n, vector<int>(n, INF));
  rep(i, m){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    gr.at(a).at(b) = c;
    gr.at(b).at(a) = c;
  }
  rep(i, n) gr.at(i).at(i) = 0;

  rep(k, n)rep(i, n)rep(j, n){
    gr.at(i).at(j) = min(gr.at(i).at(j), gr.at(i).at(k) + gr.at(k).at(j));
  }

  sort(r.begin(), r.end());
  ll ans = 1e18;
  do{
    ll add = 0;
    int now = r.at(0);
    rep2(i, 1, R){
      int nx = r.at(i);
      add += gr.at(now).at(nx);
      now = nx;
    }
    // cerr << add << endl;
    ans = min(ans, add);
  }while(next_permutation(r.begin(), r.end()));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxv = 1e5+5;
int vis[maxv];
vector<int> G[maxv];

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    int N;
    while (cin >> N) {
        memset(vis,0,sizeof(vis));
        FOR(i,1,N+1)
            G[i].clear();
        FOR(_,0,N-1) {
            int u,v; cin >> u >> v;
            G[u].push_back(v); G[v].push_back(u);
        }
        queue<int> Q; Q.push(1); vis[1]++;
        stack<int> S;
        while (Q.size()) {
            const int u = Q.front(); Q.pop(); S.push(u);
            FOR_ALL(v,G[u]) if (!vis[*v]) {
                Q.push(*v); vis[*v]++;
            }
        }
        memset(vis,0,sizeof(vis));
        string ans = "Second";
        while (S.size() && ans != "First") {
            const int u = S.top(); S.pop();
            if (!vis[u]) {
                int i = 0; const int n = G[u].size();
                for (; i < n; i++) {
                    const int v = G[u][i];
                    if (!vis[v]) {
                        vis[v]++; break;
                    }
                }
                if (i == n)
                    ans = "First";
                vis[u]++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 6656
S = input()
s = list(S)

count = 0
max_count = 0

for i in s:
    if i == "R":
        count += 1
    else: 
        if max_count <= count:
            max_count = max(max_count,count) 
        count =0
if max_count <= count:
    max_count = count
print(max_count)


Measured memory_bytes: 8920
#include <stdio.h>

#define N 100000
int S[N],T[N],count=0,n,q,i,j,minj,temp,left,right,mid;
int binarySearch(int);
int main(){

  scanf("%d",&n);
  i=0;
  while(i<n){
    scanf("%d",&S[i]);
    i++;
  }

  scanf("%d",&q);
  i=0;
  while(i<q){
    scanf("%d",&T[i]);
    if(binarySearch(T[i])==1){
      count++;
    }
    i++;
  }
  printf("%d\n",count);

  return 0;
}

int binarySearch(int key){
  left = 0;
  right = n;
  while(left<right){
    mid = (left+right)/2;
    if(S[mid] == key){
      return 1;
    }else if(key < S[mid]){
      right = mid;
    }else{
      left = mid + 1;
    }
  }
  return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ii pair<int,int>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

const int maxn = 1e5+10;
const int mod = 1e9+7;

string s;
string vs[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>s;
	int ans=0;
	int i=0;
	while(vs[i]!=s)++i;
	while(vs[i]!="SUN"){
		++ans;
		i=(i+1)%7;
	}
	cout<<(ans==0?7:ans)<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


int main(){
    int N; cin >> N;
    vector<VI> cnt(10, VI(10, 0));
    FORS(k, 1, N){
        int kk = k;
        int i, j = k % 10;
        while(kk){
            i = kk; kk /= 10;
        }
        ++cnt[i][j];
    }
    ll ans = 0;
    REP(i, 10){
        REP(j, 10)
            ans += (ll)cnt[i][j] * cnt[j][i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N;
    cin >> N;
    vector<ll> arr(N, 0);
    for(int i = 0; i < N; i++) {
        cin >> arr[i];
        arr[i] *= 2;
    }
    vector<ll> ans = {0};
    for(int i = 0; i < N; i++) {
        ans.push_back(arr[i] - ans.back());
    }
    ll diff = (ans.back() - ans[0]) / 2;
    for(int i = 0; i < N; i++) {
        if (i % 2 == 0)
            ans[i] += diff;
        else
            ans[i] -= diff;
        cout << ans[i] << " ";
    }
    return 0;
}


Measured memory_bytes: 3060
#include<stdio.h>

int main(void) {
	int n[26];
	char s;
	int i;
	
	for(i = 0; i < 26; i++) {
		n[i] = 0;
	}
	
	while(scanf("%c", &s) != EOF) {
		if(s >= 65 && s <= 90) {
			n[s-'A']++;
		} else if(s >= 97 && s <= 122) {
			n[s-'a']++;
		}
	}
	
	for(i = 0; i < 26; i++) {
		printf("%c : %d\n", i+97, n[i]);
	}
	
	return 0;
}

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

int main(){
    int H, W = 0;
    cin >> H >> W;
    char C[H][W];
    for (int i = 0; i < H;i++)
    {
        for (int j = 0; j < W;j++)
        {
            cin >> C[i][j];
        }
        for (int k = 0; k < W;k++)
        {
            cout << C[i][k];
        }
        cout << endl;
        for (int l = 0; l < W; l++)
        {
            cout << C[i][l];
        }
        cout << endl;
    }
}


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


#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;


using namespace std;

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

    int n, rem;
    cin >> n;
    rem = n % 1000;
    if (!rem)
        cout << 0;
    else
        cout << 1000 - rem;

    return 0;
}


Measured memory_bytes: 3648
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from decimal import Decimal
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


s=S()
t=S()

l = len(s)
j=0
if s != t:
    for i in range(l):
        if s[i]!=t[i]:
            j+=1
print(j)

Measured memory_bytes: 27372
#include <iostream>
#include <cstdio>
#include <vector>
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define fastio() ios::sync_with_stdio(0),cin.tie(0)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int inf = 0x3c3c3c3c;
const ll infl = 0x3c3c3c3c3c3c3c3c;

int N;
int A[100003];
int bck[100003];
int main() {
	fastio();
	cin >> N;
	for(int i = 0 ; i < N; i++) {
		cin >> A[i];
		A[i]--;
		bck[i] = A[i];
	}
	int ans = 0;
	for(int i = 0 ; i < N - 1; i++){
		if(A[i] == i) swap(A[i], A[i + 1]), ans++;
	}
	if(A[N - 1] == N - 1) ans++;
	int ans1 = ans;
	ans = 0;
	for(int i = 0 ; i < N; i++) A[i] = bck[i];
	for(int i = 0 ; i < N - 1; i++){
		if(A[i + 1] == i + 1) swap(A[i], A[i + 1]), ans++;
	}
	if(A[0] == 0) ans++;
	cout << min(ans1, ans);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll l;cin>>l;
    double a=l/3.0;
    cout<<fixed<<setprecision(10)<<a*a*a<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
using namespace std;
#define N 100009
#define ll long long

int main(){
    string a;
    cin>>a;
    int l=a.size();
    bool ans=true;
    int q=0;
    int p=1;
    while(p<l){
        if (a[p]!='L' && a[p]!='U' && a[p]!='D') ans=false;
        p+=2;
    }
    while(q<l){
        if (a[q]!='R' && a[q]!='U' && a[q]!='D') ans=false;
        q+=2;
    }
    if (ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val)
{
    std::fill((T *)array, (T *)(array + N), val);
}


int main()
{
    ll x;
    cin >> x;
    ll ans = 0;
    ll sum = 100;
    while (sum < x)
    {
        // sum += sum/100;
        sum *= 1.01;
        // cout << sum << "\n";
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;

int main()
{
    ll l,r;
    ll ans=5000;
    while(~scanf("%lld%lld",&l,&r))
    {
        ans=5000;
        if(l/2019<r/2019)
        {
            printf("0\n");
        }
        else
        {
            for(ll i=l;i<=r-1;i++)
                for(ll j=i+1;j<=r;j++)
                {
                    ans=(i%2019)*(j%2019)%2019<ans?(i%2019)*(j%2019)%2019:ans;
                }
            printf("%lld\n",ans);
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
const int INF = 1000100100;
 
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
 
int V, E;
int G[20][20];  // グラフ
int dp[50000][20];
// メモ化再帰
int rec(int S, int v) {  
    if (S == 0) {
        if (v == 0) {
            return 0;
        } else {
            return INF;
        }
    }
    if ((S & (1 << v)) == 0) {  // Sに{v}が含まれていない
        return INF;
    }
 
    int &ret = dp[S][v];
    if (ret != 0) return ret;
 
    ret = INF;
    REP(u, V) { chmin(ret, rec(S ^ (1 << v), u) + G[u][v]); }
    return ret;
}
 
int main() {
    cin >> V >> E;
 
    // グラフの初期化
    REP(i, 20) {
        REP(j, 20) { G[i][j] = INF; }
    }
    REP(i, E) {
        int s, t, d;
        cin >> s >> t >> d;
        G[s][t] = d;
    }
 
    int ans = rec((1 << V) - 1, 0);
 
    if (ans != INF) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
 
    return 0;
}


Measured memory_bytes: 5624