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

int main() {
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    long long ans = 0;
    int x = min(A, C);
    ans += x, A -= x, C -= x;
    x = min(B, C);
    ans += x + x;
    B -= x, C -= x;
    ans += B;
    if(C) ans++;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 768
// Package main provides
//
// File:  c.go
// Author: ymiyamoto
//
// Created on Mon Jan  7 02:12:06 2019
//
package main

import "fmt"

type route struct {
	to    int
	valid bool
}

type node struct {
	routes []route
}

type nodes []node

func dfs(n int, graph nodes, visited []bool) {
	visited[n] = true

	rs := graph[n].routes
	for _, r := range rs {
		if r.valid && !visited[r.to] {
			dfs(r.to, graph, visited)
		}
	}
}

func checkNodes(graph nodes) bool {
	visited := make([]bool, len(graph))
	dfs(0, graph, visited)

	for i := range visited {
		if !visited[i] {
			return false
		}
	}
	return true
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)

	graph := make(nodes, N)
	for i := 0; i < M; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		graph[a-1].routes = append(graph[a-1].routes, route{to: b - 1, valid: true})
		graph[b-1].routes = append(graph[b-1].routes, route{to: a - 1, valid: true})
	}

	ans := 0
	for i := range graph {
		for j := range graph[i].routes {
			graph[i].routes[j].valid = false
			if !checkNodes(graph) {
				ans++
			}
			graph[i].routes[j].valid = true
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
import java.util.*;
import java.math.*;

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

        for (int i = 0; i < 3; i++) {
            s[i] = scan.next();
        }

        int[] idx = new int[3];
        int nextTurn = 0;
        while (idx[nextTurn] < s[nextTurn].length()) {
            char nextCard = s[nextTurn].charAt(idx[nextTurn]);
            idx[nextTurn]++;
            nextTurn = nextCard - 'a';
        }

        char winner = 'A';
        winner += nextTurn;
        System.out.println(Character.toUpperCase(winner));
    }
}


Measured memory_bytes: 21844
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
a = [INT() for _ in range(M)]
is_broken = [0]*(N+1)
for x in a:
	is_broken[x] = 1

dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1

for i in range(2, N+1):
	if not is_broken[i-1]:
		dp[i] += dp[i-1]
	if not is_broken[i-2]:
		dp[i] += dp[i-2]
	dp[i] %= mod

print(dp[N])

Measured memory_bytes: 11580
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Objects;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DMegalomania solver = new DMegalomania();
        solver.solve(1, in, out);
        out.close();
    }

    static class DMegalomania {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            Job[] jobs = new Job[n];
            for (int i = 0; i < n; i++) {
                jobs[i] = new Job(in.nextInt(), in.nextInt());
            }
            Arrays.sort(jobs);
            long time = 0;
            for (int i = 0; i < n; i++) {
                time += jobs[i].a;
                if (time > jobs[i].b) {
                    out.print("No");
                    return;
                }
            }
            out.print("Yes");
        }

        class Job implements Comparable<Job> {
            int a;
            int b;

            public Job(int a, int b) {
                this.a = a;
                this.b = b;
            }

            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                Job job = (Job) o;
                return a == job.a &&
                        b == job.b;
            }

            public int hashCode() {
                return Objects.hash(a, b);
            }

            public int compareTo(Job o) {
                return this.b == o.b ? Integer.compare(this.a, this.a) : Integer.compare(this.b, o.b);
            }

        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 48704
#include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;

#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)

#define STRESS 0
using lint = long long;

vector<pair<int, int>> g[111111];
lint h[111111];

void dfs(int v, int p, lint c) {
    h[v] = c;
    for (auto& i : g[v]) {
        if (i.first == p) {
            continue;
        }
        dfs(i.first, v, c + i.second);
    }
}

void solve(istream& cin, ostream& cout) {
    int n;
    cin >> n;
    rep(i, 1, n) {
        int x, y, z;
        cin >> x >> y >> z;
        --x; --y;
        g[x].push_back({y, z});
        g[y].push_back({x, z});
    }

    int q, k;
    cin >> q >> k;
    --k;
    dfs(k, -1, 0);
    rep(iq, 0, q) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        cout << h[x] + h[y] << "\n";
    }
}

int main() {
#if !defined(JLOCAL) || !STRESS
#ifdef JLOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve(cin, cout);
#else
    srand();
    for (int ti = 0; ti < 100; ti++) {
        stress::gen();
        stress::stupid();
        ifstream in("input.txt");
        ofstream out("output.txt");
        solve(in, out);
        out.flush();
        stress::check();
    }
    cout << "ok" << endl;
#endif
    return 0;
}


Measured memory_bytes: 13056
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll X, K, D;
    cin >> X >> K >> D;
    if (X < 0) X *= -1;
    ll Y = X / D;
    if (K < Y){
        cout << X - K * D << endl;
    }
    else{
        if (Y % 2 == K % 2) cout << X - Y * D << endl;
        else cout << D - X + D * Y << endl;
    }
}

Measured memory_bytes: 3628
import java.util.*;

class Animal
{
    String name;
    String genus;
    int region;

    public Animal(String name, String genus, int region)
    {
        this.name = name;
        this.genus = genus;
        this.region = region;
    }

    public int getRegion()
    {
        return this.region;
    }

    public String getGenus()
    {
        return this.genus;
    }

    public String getName()
    {
        return this.name;
    }
}

class Human extends Animal
{
    String sex;
    String bloodGroup;

    public Human(String sex, String bloodGroup)
    {
        super("HS", "homo", 1);
        this.sex = sex;
        this.bloodGroup = bloodGroup;
    }

    public String getSex()
    {
        return sex;
    }

    public String getBloodGroup()
    {
        return bloodGroup;
    }
}

public class Main
{

    public static Scanner in = new Scanner(System.in);

    public void print(int[] a)
    {
        for (int i = 0; i <a.length-1 ; i++)
        {
            System.out.print(a[i]+" ");
        }
        System.out.println(a[a.length-1]);
    }

    public int[] insert(int[] a)
    {

        for (int i = 0; i <a.length ; i++)
        {
            int key=a[i];
            int j=i-1;

            while (j>=0 && a[j]>key)
            {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;
            new Main().print(a);
        }
        return a;

    }

    public int gcd(int a, int b)
    {
        if(b==0)
        {
            return a;
        }
        else
        {
            return gcd(b, a%b);
        }
    }

    public void go()
    {
        int a = in.nextInt();
        int b = in.nextInt();

        int value = new Main().gcd(a, b);

        System.out.println(value);

    }

    public static void main(String[] args)
    {
        new Main().go();


    }
}

Measured memory_bytes: 26168
//start of jonathanirvings' template v3.0.3 (BETA)

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

typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;

double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

#ifdef TESTING
  #define DEBUG fprintf(stderr,"====TESTING====\n")
  #define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
  #define debug(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DEBUG 
  #define VALUE(x)
  #define debug(...)
#endif

#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)

inline string IntToString(LL a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}

inline LL StringToInt(string a){
  char x[100]; LL res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}

inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

inline string uppercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}

inline string lowercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}

inline void OPEN (string s) {
  #ifndef TESTING
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
  #endif
}

//end of jonathanirvings' template v3.0.3 (BETA)

string a,b,c;

int main()
{
  a = GetString();
  b = GetString();
  c = GetString();
  printf("%c%c%c\n",a[0]-'a'+'A',b[0]-'a'+'A',c[0]-'a'+'A');
  return 0;
}










Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = n / 1000 + 1;
		n = (t * 1000) - n;
		if(n == 1000){
			n = 0;
		}
		System.out.println(n);
	}
}

Measured memory_bytes: 35668
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define deb(x)          cout<<#x<<" "<<x<<endl
#define ar 				array
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int32_t main()
{
	Raghav();
	int n, flag = 0;
	cin >> n;
	int val;
	val = 7;
	if (val % n == 0)
	{
		cout << 1;
		return 0;
	}
	for (int i = 1; i < 1e7; i++)
	{
		if (val == 0)
		{
			cout << i;
			flag = 1;
			break;
		}
		val = (val * 10 + 7) % n;
	}
	if (!flag)
		cout << -1;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;

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


int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };

const ll MOD = 1000000007;
const ll INF = 1000000000;

int n;
int T[3];
int ans = INF;
int a[10];
int v[10];
void dfs(int i){
    if (i == n){
        int sum = 0;
        int take[3] = { 0, 0, 0 };
        for (int j = 0; j < n; j++){
            if (v[j] == 3) continue;
            if (take[v[j]] > 0) sum += 10;
            take[v[j]] += a[j];
        }
        if (take[0] > 0 && take[1] > 0 && take[2] > 0){
            for (int j = 0; j < 3; j++) sum += abs(take[j] - T[j]);
            ans = min(ans, sum);
        }
        return;
    }

    for (int j = 0; j < 4; j++){
        v[i] = j;
        dfs(i + 1);
    }


}


int main(void){
    cin >> n >> T[0] >> T[1] >> T[2];
    for (int i = 0; i < n; i++) cin >> a[i];
    dfs(0);
    cout << ans << endl;



}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int N;
  int b[10];
  int min[10];
  int i,j;
  int min_tmp, max_tmp;
  
  scanf("%d",&N);
  
  for(i=0; i<N; i++){    
    scanf("%d%d%d%d%d%d%d%d%d%d",
          b,b+1,b+2,b+3,b+4,b+5,b+6,b+7,b+8,b+9);
    
    min_tmp = b[9];
    min[8] = b[9];    
    for(j=7; j>0; j--){
      min_tmp = (b[j+1] < min_tmp)? b[j+1] : min_tmp;
      min[j] = min_tmp;
    }
    max_tmp = b[0];
    if((min[1] < b[1] ) && (b[1] < max_tmp)) j=1;
    else{
      for(j=2; j<9; j++){
        max_tmp = (b[j-1] > max_tmp)? b[j-1] : max_tmp;
        if(b[j] <= min[j]) continue;
        if(b[j] >= max_tmp) continue;
        break;
      }
    }
    if(j==9) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <cmath>

int n;
int dp[3001][3001] = {};
int temp;

int main() {
	std::string s;
	std::string t;
	std::cin >> s >> t;
	for (int i = 1; i <= s.size(); i++) {
		for (int j = 1; j <= t.size(); j++) {
			if (s[i - 1] == t[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
			else if (dp[i - 1][j] > dp[i][j - 1]) dp[i][j] = dp[i - 1][j];
			else dp[i][j] = dp[i][j - 1];
		}
	}
	int len = dp[s.size()][t.size()];
	std::string gyakuans = "";
	/*for (int i = 0; i <= s.size(); i++) {
		for (int j = 0; j <= t.size(); j++) {
			std::cout << dp[i][j] << " ";
		}
		std::cout << std::endl;
	}*/
	int i = s.size();
	int j = t.size();
	while (len > 0) {
		if (s[i-1]==t[j-1]) {
			gyakuans += s[i - 1];
			len--;
			i--;
			j--;
		}
		else if (dp[i][j] == dp[i][j - 1])j--;
		else i--;
	}
	//std::cout << gyakuans << std::endl;
	for (int i = gyakuans.size() - 1; i >= 0; i--) {
		std::cout << gyakuans[i];
	}
	std::cout << std::endl;
}


Measured memory_bytes: 38792
N, A, B, C, D = map(int, input().split())
S = input()

A -= 1
B -= 1
C -= 1
D -= 1

if '##' in S[A:C+1] or '##' in S[B:D+1]:
    print('No')
else:
    if C < D:
        print('Yes')
    else:
        if '...' in S[B-1:D+2]:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 3572
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        int a[] = in.nextIntArray(n);
        int f=0;
        for(int i:a){
            if(i%2==0){
                if(!(i%3==0 || i%5==0)) f=1;
            }
        }
        out.println(f==0?"APPROVED":"DENIED");
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = 1e18;
int main(){
  int V, E, r;
  cin >> V >> E >> r;
  vector<vector<P>> g(V);
  rep(i,E) {
    int u, v, c;
    cin >> u >> v >> c;
    g[u].emplace_back(make_pair(v,c));
  }
  
  auto dijkstra = [&](int s) {
    vector<ll> d(V,INF);
    priority_queue<pair<ll,int>, vector<pair<ll,int>>, greater<pair<ll,int>>> que;
    que.push(make_pair(0LL,s));
    d[s] = 0LL;
    while (!que.empty()) {
      auto p = que.top(); que.pop();
      int u = p.second;
      if (d[u] < p.first) continue;
      for (auto v : g[u]) {
        if (d[u] + v.second < d[v.first]) {
          que.push(make_pair(d[u] + v.second, v.first));
          d[v.first] = d[u] + v.second;
        }
      }
    }
    return d;
  };

  auto res = dijkstra(r);

  for (auto ans : res) {
    if (ans == INF) cout << "INF" << endl;
    else cout << ans << endl;
  }
  return 0;
} 


Measured memory_bytes: 14348
#include<bits/stdc++.h>
using namespace std;
bool cmp(int x,int y){
	return x>y;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int a[110];
	int sum = 0;
	for(int i = 1; i<= n; i++){
		scanf("%d",&a[i]);
		sum += a[i];
	}
	sort(a+1,a+n+1,cmp);
	double x = sum*1.0/(4*m);
	if(a[m]<x) printf("No\n");
	else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker,"/stack:200000000")
#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define print(x) return cout<<x<<endl,0
#define watch(x) cerr<<#x<<"-> "<<x<<endl
#define CLEAR(x,val) memset(x,val,sizeof(x))
// #define int long long

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int INF = 1000000000;
const int MOD = 1000000007; //998244353

signed main()
{	
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	cin.tie(0), cout.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	print(n*n);
	return 0;
}

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

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

	int resp = 0;

	for(int i = 0; i < s.size()/2; i++) {
		if(s[i] != s[s.size() - 1 - i]) resp++;
	}

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

	return 0;
}


Measured memory_bytes: 256
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1

arr = []
for (i=0; i<N; i++) {
  l = lines[i].split(' ')
  c = l[0]
  s = l[1] * 1
  arr.push({c:c, s:s, i: i+1})
}

arr.sort((a, b) => {
   if (a.c == b.c) {
       return b.s - a.s
   } else {
       return a.c < b.c ? -1 : 1
   }
})

arr.forEach((a) => {
    console.log(a.i)
}) 


Measured memory_bytes: 7628
// 072-c
// +1,0,-1を全てmapに足し、最大値を出す


#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

map<ll,ll> M;

int main(){
  ll N,A[100007],ma=0,kazu;cin >> N;
  rep(i,N){
    cin >> A[i];
    if(A[i]!=0){
      M[A[i]]++;
      M[A[i]-1]++;
      M[A[i]+1]++;
    }
    else{
      M[A[i]]++;
      M[A[i]+1]++;
    }
  }
  for(auto P :M){
    if(ma<P.second){
      ma=P.second;
    }
  }
  cout << ma << endl;
}


Measured memory_bytes: 6912
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	
	 static Scanner in = new Scanner(System.in);
	 
   
	public static void main(String args[])throws IOException  {
   
    	
        String s=in.nextLine(); 
        int len1=s.length();
        String s1=s;
        String str="keyence";
        int len=str.length();
        int pos=s.indexOf(str);
        if(pos!=-1&&(pos==0||pos==len1-len))
        {
    		System.out.println("YES");
    		return ;
    	}
        int t=len1-len;
        for(int i=1;i<len1-t;i++)
        {
        	s=s.substring(0,i)+s.substring(i+t,len1);
        	if(s.equals(str))
        	{
        		System.out.println("YES");
        		return ;
        	}
        	s=s1;
        }
    		System.out.println("NO");	
     	
    }

	
	
 
	
}

Measured memory_bytes: 22612
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long[] a = new long[n];

		long x = 0L;

		for ( int i=0; i<n; i++ ) {
			a[i] = sc.nextLong();
			x = x^a[i];
		}

		String[] s = new String[n];
		for ( int i=0; i<n; i++ ) {
			s[i] = String.valueOf(x^a[i]);
		}

		System.out.println(String.join(" ", s));
	}
}


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

int d;
vector<int> c;
vector<vector<int>> s;

template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

pair<int, int> from_b_a(set<int> &s, int k) {
    auto before = s.lower_bound(k);
    before--;
    auto after = s.lower_bound(k);
    after++;
    return {*before, *after};
}

pair<int, int> next_b_a(set<int> &s, int k) {
    auto before = s.lower_bound(k);
    before--;
    auto after = s.lower_bound(k);
    return {*before, *after};
}

int main() {
    cin >> d;
    c.resize(26);
    s.resize(d, vector<int>(26));
    for (int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int> last(26, -1);
    vector<int> ans(d);
    for (int i = 0; i < d; i++) {
        int happiness_max = INT_MIN;
        for (int j = 0; j < 26; j++) {
            int happiness = 0;
            for (int k = 0; k < 26; k++) {
                if (j == k) {
                    happiness += s[i][k];
                } else {
                    happiness -= c[k] * (i - last[k]);
                }
            }
            if (chmax(happiness_max, happiness)) {
                ans[i] = j;
            }
        }
    }
    vector<set<int>> contests(26);
    for (int i = 0; i < 26; i++) {
        contests[i].insert(-1);
        contests[i].insert(d);
    }
    for (int i = 0; i < d; i++) {
        contests[ans[i]].insert(i);
    }
    int iter = 10000000;
    while (iter--) {
        int day = rand() % d;
        int from = ans[day];
        int next = rand() % 26;
        if (ans[day] == next) {
            next = (next + 1) % 26;
        }
        auto fromba = from_b_a(contests[from], day);
        auto nextba = next_b_a(contests[next], day);
        int gain = s[day][next] + c[next] * (nextba.second - day) * (day - nextba.first);
        int loss = s[day][from] + c[from] * (fromba.second - day) * (day - fromba.first);
        if (gain > loss) {
            contests[from].erase(day);
            contests[next].insert(day);
            ans[day] = next;
        }
    }
    for (int i = 0; i < d; i++) {
        cout << ans[i] + 1 << endl;
    }
}

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

using namespace std;

int main()
{
    string s1, s2, s3; cin >> s1 >> s2 >> s3;
    cout << char(s1[0] -32) << char(s2[0] - 32) << char(s3[0] - 32) << endl;

    return 0;
}

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

bool is_hard_to_type(const std::string& s)
{
  for (int i = 1; i < 4; i++) {
    if (s.at(i) == s.at(i-1)) {
      return true;
    }
  }
  return false;
}

int main()
{
  std::string s;
  std::cin >> s;
  if (is_hard_to_type(s)) {
    std::cout << "Bad\n";
  } else {
    std::cout << "Good\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iterator>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vector<int> > 
#define vl vector<long long>
#define vpi vector<pair<int,int> >
#define ll long long 
#define sz(a) int(a.size())
#define forn(i,n) for(int i = 0 ; i < int(n) ; i++)
#define all(x) x.begin(),x.end()
#define vpl vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pci pair<char,int>
#define len(s) s.length()
#define un unsigned
# define M_PI           3.14159265358979323846  /* pi */
#define modulo 998244353ll
#define mod 1000000007ll
#define MAXN  1000001 
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}




void solve()
{
    int n;
    cin>>n;
    vi a(n+1,0);
    forn(i,n)
    {
        int x;
        cin>>x;
        a[i+1] = a[i]+x;
    }
    int ans = INT_MAX;
    forn(i,n-1)
    {
        ans = min(ans,abs(a[n]-2*a[i+1]));
    }
    cout<<ans<<endl;
}



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

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

using pii = pair<int, int>;
using ll = long long;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;

constexpr int M = 1e9 + 7;

int main() {
    int N, M; cin >> N >> M;
    vector<string> v(N);
    for(int i = 0; i < N; ++i) {
        cin >> v[i];
    }
    int ans = INF;
    for(int i = 0; i < N - 2; ++i) {
        for(int j = i + 1; j < N - 1; ++j) {
            int t = 0;
            for(int k = 0; k <= i; ++k) {
                for(int l = 0; l < M; ++l) {
                    t += v[k][l] != 'W';
                }
            }
            for(int k = i + 1; k <= j; ++k) {
                for(int l = 0; l < M; ++l) {
                    t += v[k][l] != 'B';
                }
            }
            for(int k = j + 1; k < N; ++k) {
                for(int l = 0; l < M; ++l) {
                    t += v[k][l] != 'R';
                }
            }
            ans = min(ans, t);
        }
    }
    cout << ans << endl;
}



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

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

    long ans = 0;
    for(int i = 1; i <= n; i++){
        if(i % 3 != 0 && i % 5 != 0)
            ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

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

	    int N=gi();
	    long[] A=new long[N];
	    long[] B=new long[N];

        for(int i=0; i<N;i++) {
            A[i]=gl();
            B[i]=gl();
	    }
	    long c=0;
	    for(int i=N-1; i>=0;i--) {
            A[i]+=c;
            c+=(B[i]-(A[i]%B[i]))%B[i];
	    }

        System.out.println(c);

		//System.out.println();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 61800
main :: IO ()
main = do
  _  <- getLine
  as <- map read . words <$> getLine :: IO [Int]
  print . f $ as

f :: [Int] -> Int
f (a:b:bs) 
  | a < b     = g (a,b) bs
  | otherwise = g (b,a) bs

g :: (Int,Int) -> [Int] -> Int
g (s,l) [] = l-s
g sl@(s,l) (x:xs)
  | x < s = g (x,l) xs
  | l < x = g (s,x) xs
  | otherwise = g sl xs

Measured memory_bytes: 1020
def solve():
  N = int(input())
  ABC = [[int(i) for i in input().split()] for i in range(N)]
  dp = [[0, 0, 0] for i in range(N)]
  dp[0] = ABC[0]
  for i in range(1, N):
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + ABC[i][0]
    dp[i][1] = max(dp[i - 1][2], dp[i - 1][0]) + ABC[i][1]
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + ABC[i][2]
  return max(dp[N - 1])

print(solve())


Measured memory_bytes: 44148
using System;


class AOJ
{

    public static void Main()
    {
        while (true)
        {
            string ss = Console.ReadLine();
            if (ss == null) break;

            string[] s = ss.Split(' ');

            int[] a = new int[2];
            int[] b = new int[2];

            for (int i = 0; i < 2; i++)
            {
                a[i] = int.Parse(s[i]);
                b[i] = int.Parse(s[i]);
            }

            int w;

            Array.Sort(a);

            while (true)
            {
                w = a[1] % a[0];
                a[1] = a[0];
                if (w == 0) break;
                a[0] = w;
                
            }

            Console.WriteLine("{0} {1}", a[0], (long)b[0] * b[1] / a[0]);
        }
    }
}
        
      

Measured memory_bytes: 5700
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int main(void) {
	long long int a, b, l, m, n;
	int i, j, k;
	cin >> n >> m >> l >> a;
	if (a > n) {
		if (a > n + m) {
			b = n - a + n + m;
		}
		else b = n;
	}
	else {
		b = a;
	}
		cout << b << endl;
			
	return 0;
}

Measured memory_bytes: 3676
#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> pint;

const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int h, n; cin >> h >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];

    vector<vector<int>> dp(n+1, vector<int> (h+10010, INF));
    dp[0][0] = 0;

    rep(i, n) rep(j, h+10001) {
        if (j >= a[i]) dp[i+1][j] = min(dp[i][j], dp[i+1][j-a[i]] + b[i]);
        else dp[i+1][j] = dp[i][j];
    }

    int ans = INF;
    for (int j = h; j < h + 10001; ++j) {
        ans = min(ans, dp[n][j]);
    }

    cout << ans << endl;

    
    return 0;
}


    


Measured memory_bytes: 78592
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1<<29
#define LLINF 1LL<<60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}

ll N;
ll fact[100010];
ll ifact[100010];

ll modcomb(ll n, ll k){
    if(k < 0 || k > n) return 0;
    ll ans = fact[n];
    ans = ans * ifact[k] % MOD;
    ans = ans * ifact[n-k] % MOD;
    return ans;
}

int main() {
    cin >> N;
    vector<ll> cnt(N+1, -1);
    ll a, d1, d2;
    REP(i, N) {
        scanf("%llu", &a);
        if(cnt[a] != -1) {
            d1 = min(cnt[a], ll(i));
            d2 = max(cnt[a], ll(i));
            break;
        }
        cnt[a] = i;
    }
    fact[0] = 1;
    ifact[0] = 1;
    FOR(i, 1, N+2) {
        fact[i] = fact[i-1] * i % MOD;
        ifact[i] = modpow(fact[i], MOD-2);
    }

    ll ans;
    printf("%lld\n", N);
    FOR(k, 2, N) {
        ans = modcomb(N-1, k) % MOD;
        ans = (ans + 2 * modcomb(N-1, k-1)) % MOD;        
        ans = (ans - modcomb(N-1-(d2-d1-1), k-1) + MOD) % MOD;
        ans = (ans + modcomb(N-1, k-2)) % MOD;
        printf("%llu\n", ans);
    }
    printf("1\n");
 	return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) REP((i),0,(n))
#define RREP(i,a,b) for(int i=(int)(b-1);i>=(int)(a);i--)
#define rrep(i,n) RREP(i,n,0)
#define each(it,X) for(__typeof((X).begin())  it=(X).begin();it!=(X).end();it++)
#define all(v) ((v).begin(),(v).end())
#define rall(v) ((v).rbegin(),(v).rend())
#define fi first
#define se second
#define pb push_back
typedef long long LL;
typedef pair<int,int>P;
typedef pair<P,int>PI;
typedef pair<int,P>IP;
typedef vector<int>VI;
typedef vector<VI>VVI;
typedef vector<string>VS;


struct D{
    int id,u,a,p;

    D(int id,int u,int a,int p):id(id),u(u),a(a),p(p){}
    D(){}

    bool operator<(const D &d)const{
        if(a!=d.a)return a<d.a;
        if(p!=d.p)return p>d.p;
        return id>d.id;
    }
};



int main(){
    int N;
    while(cin>>N,N){
        vector<D>V(N);
        for(int i=0;i<N;i++){
            int a,b,c,d;
            cin>>a>>b>>c>>d;
            V[i]=D(a,b-1,c,d);
        }

        sort(V.rbegin(),V.rend());
        int U[1000]={0};
        int cnt=0;
        for(int i=0;i<N;i++){
            if(U[V[i].u]<(cnt<10?3:(cnt<20?2:(cnt<26?1:0)))){
                cout<<V[i].id<<endl;
                U[V[i].u]++;
                cnt++;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n=700,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b>>c>>d;
	if(a+b>c+d){cout<<"Left";}
	else if(a+b<c+d){cout<<"Right";}
	else {cout<<"Balanced";}




	cout<<endl;
} 


Measured memory_bytes: 256
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int a,b,c,d,e,f,k,l,m,n,x,y,z;
	int ans;
	String[] S;

	Main(){
		// 整数の入力
		a = sc.nextInt();
		b = sc.nextInt();

		// 出力
		System.out.println(Math.max(a+b,Math.max(a-b,a*b)));
	}

	public static void main(String[] args){
		new Main();
	}
}

Measured memory_bytes: 21716
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
T, A = mapint()
Hs = list(mapint())
ths = [(abs(A-(T-(x*0.006))), i+1) for i, x in enumerate(Hs)]
ths.sort()

print(ths[0][1])

Measured memory_bytes: 9320
#include <iostream>
using namespace std;
int main()
{
  string C1, C2;
  cin >> C1 >> C2;
  string ans = "NO";
  if (C1.at(0) == C2.at(2) && C1.at(1) == C2.at(1) && C1.at(2) == C2.at(0))
  {
    ans = "YES";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	int x,a,b;
	cin >> x >> a >> b;
	if(abs(a-x)>=abs(b-x)) cout << "B" << endl;
	else cout << "A" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int sum[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    string S; cin >> S;
    rep(i, N - 1) {
        if(S[i] == 'A' && S[i + 1] == 'C') sum[i + 2]++;
    }
    rep(i, N) sum[i + 1] += sum[i];
    while(Q--) {
        int l, r;
        cin >> l >> r;
        cout << sum[r] - sum[l] << endl;
    }


    return 0;
}


Measured memory_bytes: 4140
n,m = map(int, input().split())
l = [i for i in range(1,m+1)]
l2 = []
for _ in range(n):
    k = list(map(int, input().split()))
    del k[0]
    for i in range(len(l)):
        if l[i] not in k:
            l2.append(l[i])
l2 = list(set(l2))
print(len(l)-len(l2))

Measured memory_bytes: 9140
#C問題
N = int(input())

M = 3500
flag = 0
for k in range(1,3500):
    for h in range(1,3500):
        bunbo = 4*k*h-k*N-h*N
        bunshi = N*k*h
        if bunbo != 0 and bunshi%bunbo == 0:
            w = bunshi//bunbo
            if w >= 0:
            	print(k,h,w)
            	flag = 1
            	break
    if flag == 1:
        break
            


Measured memory_bytes: 41436
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <bitset>
#include <string>
#include <utility>
#include <queue>

using namespace std;
long long int bign = 1000000007;
long long int countans(int n,int ind);
// long long int mpown(long long int m,long long int n);
vector<long long int> pow3(100005);
string s;
int main()
{
    
    cin >> s;
    // cout << s.length() << endl;
    // if(s=="1")cout << 3 << endl;
    // long long int ans=mpown(3,s.length()-1);
    
    int n=s.length();
    pow3.at(0)=1;
    
    for(int i=1;i<n+1;i++){
        pow3.at(i)=(pow3.at(i-1)*3)%bign;
    }
    cout << countans(n,0) << endl;
    return 0;
}
// long long int mpown(long long int m,long long int n){
//     if(n==0)return 1;
//     if(n==1)return m%bign;
//     else{
//         long long int temp=mpown(m,n/2);
//         return (((temp*temp)%bign )*(n&1?m:1))%bign;
//     }
// }
long long int countans(int n,int ind){
    if(n==ind)return 1;
    if(s.at(ind)=='1'){
        return (pow3.at(n-ind-1)+(2*countans(n,ind+1))%bign)%bign;
    }else{
        return countans(n,ind+1);
    }
}

Measured memory_bytes: 6908
N,M=map(int,input().split())
students=[0]*N
checkpoints=[0]*M
for i in range(N):
  a,b=map(int,input().split())
  students[i] = [a,b]
for i in range(M):
  c,d=map(int,input().split())
  checkpoints[i] = [c,d]

for i in students:
  d_min=100000000000000000000
  p=0
  for j in checkpoints:
    p+=1
    d = abs(i[0] - j[0])+abs(i[1] - j[1])
    if d < d_min:
      d_min = d
      point=p
  print(point)

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

int main()
{
    string str;
    cin>>str;
    bool flag;

    if(str[2]==str[3] && str[4]==str[5] )
    {
        flag=true;
    }
    else
    {
        flag=false;
    }
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[]
c=[0]*n
for i in range(n):
    a.append(int(input()))

count=1
ans=0

while c[1]==0:

    if c[count-1] != 0:
        print(-1)
        exit()
    else:
        c[count-1]=1
        count=a[count-1]
        ans += 1


print(ans-1)



    


Measured memory_bytes: 7852
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int a, b, c, d;
	while(scanf("%d%d%d%d", &a, &b, &c, &d)==4)
	{
		bool ans=true;

		for(;;)
		{
			if((c-=b)<=0)
			{
				ans=true;
				break;
			}
			if((a-=d)<=0)
			{
				ans=false;
				break;
			}
		}
		printf("%s\n", ans?"Yes":"No");
	}
	return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, M;
	cin >> N >> M;

	if (N == M)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.*;
public class Main{
        public static void main(String[] args) {
                // TODO Auto-generated method stub
    double[] p1=new double[2],p2=new double[2]; //[0]=x,[1]=y
    Scanner sca =new Scanner(System.in);
     int n=sca.nextInt();
     p1[0]=0.0;
     p2[0]=100.0;
     p1[1]=0.0;
     p2[1]=0.0;
     System.out.println(p1[0]+" "+p1[1]);
     koho(p1,p2,n);
     System.out.println(p2[0]+" "+p2[1]);
        }
    public static void koho(double p1[],double p2[],int n){
	if(n<1)return;
	double subx,suby;
	//referenced textbook method(use vectors)
	double[]beffro=new double[2],befback=new double[2];//(x,y)=([0],[1]);
	double[]afrote=new double[2];//Rotated vector
	double rotation = Math.toRadians(60);//require to rotate vectors(60 degree)
	beffro[0]=(2.0*p1[0]+p2[0])/3.0;//take dividing points
	beffro[1]=(2.0*p1[1]+p2[1])/3.0;
        befback[0]=(p1[0]+2.0*p2[0])/3.0;
	befback[1]=(p1[1]+2.0*p2[1])/3.0;
	subx=befback[0]-beffro[0];
	suby=befback[1]-beffro[1];
	afrote[0]=subx*Math.cos(rotation)-suby*Math.sin(rotation)+beffro[0];
	afrote[1]=subx*Math.sin(rotation)+suby*Math.cos(rotation)+beffro[1];
	//referenced rot formula.;
	koho(p1,beffro,n-1);
        System.out.println(beffro[0]+" "+beffro[1]);
	koho(beffro,afrote,n-1);
        System.out.println(afrote[0]+" "+afrote[1]);
	koho(afrote,befback,n-1);
        System.out.println(befback[0]+" "+befback[1]);
	koho(befback,p2,n-1);
    }
}



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

int main(){
  ll N,cnt=0;
  ll D;
  cin >>N>>D;
  vector<ll> a(N);
  vector<ll> b(N);
  for(int i=0;i<N;i++){
    cin >>a[i];
    cin >>b[i];
  }
  for(int i=0;i<N;i++){
    if(D*D>=a[i]*a[i]+b[i]*b[i]){
      cnt++;
    }
  }
  cout << cnt <<endl;
}

  

Measured memory_bytes: 6432
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define sz(A) int(A.size())
#define FIFO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(A) begin(A),end(A)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<pair<int,int>> vii;
int main() {
	ll a, b;
	cin >> a >> b;
	cout << a * b << "\n";
	return 0;
}


Measured memory_bytes: 3636