akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(S: int):
    pattern = []
    size = len(str(S))
    for i in range(0, size - 1):
        if i < size - 2:
            pattern.append(int(str(S)[i : i + 3]))

    ans = min([abs(p - 753) for p in pattern])
    print(ans)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int n, a;
  cin >> n >> a;
  int ans = n % 500;
  if(ans <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3600
/*
ID: Nipun Paul
LANG: C++
PROB: God knows
*/

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

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

    int a;
    string b;
    cin>>a;
    cin>>b;
    if(a>=3200)
    {
        cout<<b<<endl;
    }
    else
    {
        cout<<"red"<<endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        for (int n = a; n <= b; n++) {
            if (c % n == 0) count++;
        }
        System.out.println(count);
    }
}

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

n=int(input())
s=input()
dic={"R":[],"G":[],"B":[]}
for i in range(n):
    if not s[i] in dic:
        dic[s[i]]=[i]
    else:
        dic[s[i]].append(i)
# print(dic)
se=set(dic["B"])
# print(se)
ans=len(dic["R"])*len(dic["G"])*len(dic["B"])
for i in range(len(dic["R"])):
    for j in range(len(dic["G"])):
        l,r=min(dic["R"][i],dic["G"][j]),max(dic["R"][i],dic["G"][j])
        if r+(r-l) in se:
            ans-=1
        if l-(r-l) in se:
            ans-=1
        if (r-l)%2==0 and l+(r-l)//2 in se:
            ans-=1
print(ans)


Measured memory_bytes: 9788
package main

import (
	"fmt"
	"sort"
)

func main() {
  const MAX_INT = int(^uint(0) >> 1)
  const MIN_INT = -MAX_INT - 1

  var k, x int
	fmt.Scan(&k, &x)

	seed := []int{}
	for index := 0; index < k; index++ {
		if(index == 0){
			seed = append(seed, x)
		}else{
			seed = append(seed, x + index)
			seed = append(seed, x - index)
		}
	}

	filtered_seed := Filter(seed, func(v int) bool {
			return MIN_INT < v && v < MAX_INT
	})
	sort.Ints(filtered_seed)
	PrintIntArray(filtered_seed, " ")
  return
}

func Filter(target_array []int, f func(int) bool) []int {
	return_array := []int{}
	for _, target_item := range target_array {
		if f(target_item) {
      return_array= append(return_array, target_item)
		}
	}
	return return_array
}

func PrintIntArray(nums []int, separator string) {
	for i := 0; i < len(nums); i++ { //looping from 0 to the length of the array
		fmt.Printf("%d", nums[i])
		if(i < len(nums) - 1){
			fmt.Printf(separator)
		}
	}
}

Measured memory_bytes: 512
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
int H[100000] ;
vector<vector<int>>g(100000);
bool vis[100000] ;
void dfs(int ver){
	for(int node : g[ver]){
		if(!vis[node]){
			if(H[node]>H[ver]){
				continue;
			}
			else if(H[node] == H[ver]){
				vis[ver] = true;
				vis[node] = true;
				dfs(node);
			}
			else{
				vis[node] = true ;
				dfs(node) ;
			}
		}
	}
}
void solve()
{
	int x ; 
	cin>>x ;
	repu(i , -118 , 119){
		repu(j , -119 , 118){
			if(i*i*i*i*i - j*j*j*j*j == x){
				cout<<i<<" "<<j;
				return ;
			}
		}
	}
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 5480
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+8+7;
ll n,m,l;
string s,t;
ll d[100010],dp[500][500];

int par[200000];
int uni_rank[200000];

void init(int n){
  rep(i,0,n){
    par[i] = i;
    uni_rank[i] = 0;
  }
  return;
}

int find(int x){
  if(par[x] == x)return x;
  int p = par[x];
  par[x] = find(par[x]);
  uni_rank[x] += uni_rank[p];
  return par[p];
}

bool unite(int x,int y,int p){
  int a = find(x);
  int b = find(y);
  if(a == b){
    if(uni_rank[x]+p != uni_rank[y])return false;
    return true;
  }
  // if(uni_rank[x] < uni_rank[y])par[x] = y;
  // else{
  //   par[y] = x;
  //   if(uni_rank[x] == uni_rank[y])uni_rank[x]++;
  // }
  par[b] = a;
  uni_rank[b] = uni_rank[x] + p - uni_rank[y];
  return true;
}

bool same(int x,int y){
  return find(x) == find(y);
}

int main(){
  cin >> n >> m;
  init(n);
  rep(i,0,m){
    int a,b,c;
    cin >> a >> b >> c;
    if(!unite(a,b,c)){
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 2680
use std::io::{Read, stdin};
use std::str::FromStr;
use std::cmp::max;

fn main() {
    let _n: usize = read();
    let s: String = read();
    let mut cnt: i64 = 0;
    let mut ans: i64 = 0;
    for ss in s.as_str().chars() {
        if ss == 'I' {
            cnt += 1;
        } else {
            cnt -= 1;
        }
        ans = max(ans, cnt);
    }
    println!("{}", ans);
}


fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n>>m;

	((n+m)%3==0 || n%3==0 || m%3==0)?cout<<"Possible"<<endl:cout<<"Impossible"<<endl;



}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
long long n,a,b,k,fac[400000],r,s,e[400000];
long long p=998244353;
long long binp(long long h,long long j)
{
    if(j==0)
        return 1;
    if(j%2==1)
        return ((binp(h,j-1))%p*h)%p;
    else
    {
        long long u=binp(h,j/2)%p;
        return (u*u)%p;
    }
}
long long C(long long h,long long j)
{
    if(h<j)
        return 0;
    if(j==0 || j==h)
        return 1;
    long long c=h-j;
    c=fac[c];
    h=fac[h];
    j=fac[j];
    j=binp(j,p-2);
    c=binp(c,p-2);
    return (((h*j)%p)*c)%p;
}
int main()
{
    cin>>n>>a>>b>>k;
    if(a>b)
        swap(a,b);
    if(n*(a+b)<k)
    {
        cout<<0<<endl;
        return 0;
    }
    fac[0]=1;
    for(long long i=1;i<=n;i++)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=p;
    }
    for(long long i=0;i<=n/2;i++)
    {
        e[i]=C(n,i);
        e[n-i]=e[i];
    }
    r=0;
    for(long long i=0;r<=k;i++)
    {
        if((k-r)%a==0)
        {
            long long y=i;
            long long x=(k-r)/a;
            if(x<=n && y<=n)
                s+=(e[x]*e[y])%p;
            s%=p;
        }
        r+=b;
    }
    cout<<(s+p)%p<<endl;
    return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define ll long long
#define pi 3.1415926535897932384626433832795
#define fin(a,n)  for(ll i=0;i<n;i++) cin>>a[i];
#define fout(a,n)  for(ll i=0;i<n;i++) cout<<a[i]<<" ";
int N = 1000000007;
using namespace std;

int main() 
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); cout.tie(NULL);
	deque <ll> d;
	for(int i=1;i<=9;i++)
		d.push_back(i);		
	ll x,k;
	cin>>k;
	for(int i=0;i<k;i++)
	{
		x = d.front();
		if(i == k-1){
			cout<<x<<'\n';
		}
		d.pop_front();
		if(x%10 != 0)
			d.push_back(10*x + (x%10) - 1);
		d.push_back(10*x + (x%10));
		if(x%10 != 9)
			d.push_back(10*x + (x%10) + 1);
	}
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(){
  int a1,a2,b1,b2,c1,c2,d1,d2,e1,e2,summax;
  while(1){
    summax=0;
    scanf("%d%d",&a1,&a2);
    if(a1==0&&a2==0){
      break;
    }
    scanf("%d%d",&b1,&b2);
    scanf("%d%d",&c1,&c2);
    scanf("%d%d",&d1,&d2);
    scanf("%d%d",&e1,&e2);

    if(summax<a1+a2){
      summax=a1+a2;
    }
    if(summax<b1+b2){
      summax=b1+b2;
    }
    if(summax<c1+c2){
      summax=c1+c2;
    }
    if(summax<d1+d2){
      summax=d1+d2;
    }
    if(summax<e1+e2){
      summax=e1+e2;
    }

    if(summax==a1+a2){
      printf("A ");
    }
    if(summax==b1+b2){
      printf("B ");
    }
    if(summax==c1+c2){
      printf("C ");
    }
    if(summax==d1+d2){
      printf("D ");
    }
    if(summax==e1+e2){
      printf("E ");
    }
    printf("%d\n",summax);
  }
  return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m, f, r;
        while (true) {
            m = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
            if (m == -1 && f == -1 && r == -1) break;
            if (m < 0 || f < 0) System.out.println("F");
            else if (m + f >= 80) System.out.println("A");
            else if (m + f >= 65 && m + f < 80) System.out.println("B");
            else if (m + f >= 50 && m + f < 65) System.out.println("C");
            else if (m + f >= 30 && m + f < 50) {
                if (r >= 50) System.out.println("C");
                else System.out.println("D");
            }
            else if (m + f < 30) System.out.println("F");
        }
    }
}


Measured memory_bytes: 26328
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct object
{
    int weight, value;
    object(){};
    int operator<(const object &O)
    {
        if (value == O.value)
        {
            return (weight < O.weight);
        }
        return (value > O.value);
    }
};

int main()
{
    int no_of_objects, capacity;
    cin >> no_of_objects >> capacity;

    vector<object> O(no_of_objects + 1);
    for (int i = 1; i <= no_of_objects; i++)
    {
        cin >> O[i].weight >> O[i].value;
    }

    long long total_value = 0;
    for (int i = 1; i <= no_of_objects; i++)
    {
        total_value += O[i].value;
    }

    int answer = 0;
    vector<long long> minimum_weight(total_value + 1, -1);
    total_value = 0;
    minimum_weight[0] = 0;

    for (int i = 1; i <= no_of_objects; i++)
    {
        total_value += O[i].value;

        for (int v = total_value; v >= O[i].value; v--)
        {
            if (minimum_weight[v - O[i].value] != -1)
            {
                long long weight_required = minimum_weight[v - O[i].value] + O[i].weight;

                if (weight_required <= capacity)
                {
                    answer = max(answer, v);
                }

                if (minimum_weight[v] == -1 || minimum_weight[v] > weight_required)
                {
                    minimum_weight[v] = weight_required;
                }
            }
        }
    }

    cout << answer;

    return 0;
}


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

int main(){
	int n, q, l, r, pre[201234] = {0};
	string s;
	cin >> n >> q;
	cin >> s;
	for(int i = 1 ; i < n ; i++){
		pre[i] = pre[i-1];
		if(s[i-1] == 'A' && s[i] == 'C')
			pre[i]++;
	}

	for(int i = 0 ; i < q ; i++){
		cin >> l >> r;
		cout << pre[r-1]-pre[l-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int a[5], i , j, copy;
	
	for (i = 0; i < 5; i++)
	{
		scanf("%d", &a[i]);
	}
	
	for (i = 0; i < 5; i++){
		for (j = 0; j < 5; j++){
			if (a[j] < a[i]){
				copy = a[j];
				a[j] = a[i];
				a[i] = copy;
			}
		}
	}
	for (i = 0; i < 5; i++){
		if (i == 0){
			printf("%d", a[i]);
		}
		else {
			printf(" %d", a[i]);
		}
	}
	printf("\n");
	return (0);
}

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

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

  set<int> x;
  int ans=0,sum=0;
  for(int i=0; i<n; i++){
    int z;
    cin>>z;
    ans+=z;
    if(z%10!=0){
      sum+=z;
      x.insert(z);
    }
  }

    if(sum%10==0 && sum!=0)cout<<ans-*x.begin()<<endl;
    else if(sum==0)cout<<0<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 256
/** author: __nishad__ **/

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


typedef long long ll ;
typedef vector<ll> vll ;

#define Fast_IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#define loop2(i,a,b) for(int i=(a);i<=(b);++i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define pb push_back
#define pi 3.14159265358979323
#define endl "\n"

int main()
{
    Fast_IOS;

    ll a, b, k;
    cin>>a>>b>>k;

    for(int i=a; i<=b; i++){
        if(abs(i-a) <k || abs(i-b) <k)
            cout<<i<<" ";
    }



}








Measured memory_bytes: 256
n = int(input())

words = {}
for i in range(n):
    str = input()
    if words.get(str) is None:
        words[str] = 1
    else:
        words[str] += 1
        
max_num = max(words.values())
max_items = []

for x in words.items():
    if x[1] >= max_num:
        max_items.append(x[0])

for i in sorted(max_items):
    print(i)

Measured memory_bytes: 32988
n, money = map(int, input().split())

x = 0
y = 0
z = int(money/1000)
n_sum = x + y + z

if z < n:
    print("-1 -1 -1")
elif n_sum == n:
    print(x, y, z)
else:
    div1000 = min(int((n_sum-n)/4), int(z/5))
    z = z - (5*div1000)
    y += div1000
    n_sum = x+y+z
    if n_sum == n:
        print(x, y, z)
    else:
        if int(y/2) >= n_sum-n:
            y -= (n_sum-n)*2
            x += (n_sum-n)
            print(x, y, z)
        else:
            print("-1 -1 -1")


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

int main() {
    cin.tie();
    ios::sync_with_stdio(false);
    
    // input
    string N;
    cin >> N;
    
    cout << "ABC" + N << "\n";
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;

int n, a[100];

int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i];
  }
  int res = 1000000000;
  for(int y = -100; y <= 100; y++){
    int sum = 0;
    rep(i, n){
      int cost = abs(a[i] - y);
      cost = pow(cost, 2);
      sum += cost;
    }
    //cerr << y <<" "<<sum << endl;
    res = min(sum, res);
  }
  cout << res << endl;
}


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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int N,Q; cin >> N >> Q;
    VI A(N); REP(i,N) cin >> A[i];
    VL S(N+1,0),S0(N+1,0),S1(N+1,0); REP(i,N) S[i+1] = S[i] + A[i];
    REP(i,N){
        if(i%2) S0[i+1] = S0[i-1] + A[i];
        else{
            if(i==0) S1[i+1] = A[i];
            else S1[i+1] = S1[i-1] + A[i];
        }
    }

    REP(_,Q){
        int x; cin >> x;
        int al = 0, ar = max(abs(x-A[0]), abs(A[N-1]-x))+1;
        int xl,xr;
        while(ar-al>1){
            int k = (al+ar)/2;
            int l=-1, r=N;
            while(r-l>1){
                int n = (l+r)/2;
                if(x-A[n]<=k) r = n;
                else l = n;
            }
            xl = r;

            l = -1; r = N;
            while(r-l>1){
                int n = (l+r)/2;
                if(A[n]-x<=k) l = n;
                else r = n;
            }
            xr = r;

            if(xr-xl <= N-xr) al = k;
            else ar = k;
        }

        int l=-1, r=N;
        while(r-l>1){
            int n = (l+r)/2;
            if(x-A[n]<=al) r = n;
            else l = n;
        }
        xl = r;
        l = -1; r = N;
        while(r-l>1){
            int n = (l+r)/2;
            if(A[n]-x<=al) l = n;
            else r = n;
        }
        xr = r;

        ll ans = S[N] - S[xr];
        l = max(0,xr-(N-xr));
        if(l%2) ans += S1[l];
        else ans += S0[l];
        cout << ans << en;
    }
    return;
}

int main(void){
    cin.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t){
        Main();
    }
    return 0;
}

Measured memory_bytes: 4480
def nl(): return list(map(int, input().split()))
def gcd(x, y):
    if x < y:
        # x >= y とする
        x, y = y, x
    while True:
        r = x % y
        if r == 0:
            break
        else:
            x, y = y, r
    return y

N, X = nl()
x = nl()
x2 = list(map(abs, (map(lambda v: v - X, x))))

g = x2[0]
for i in range(1, N):
    g = gcd(g, x2[i])
print(g)

Measured memory_bytes: 14480
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,j,i,k;
	scanf("%d %d",&a,&s);
	if(a==0){
		if(1989<=s) printf("H%d\n",s-1988);
		else if(1926<=s) printf("S%d\n",s-1925);
		else if(1912<=s) printf("T%d\n",s-1911);
		else if(1868<=s) printf("M%d\n",s-1867);
	}
	else if(a==4) printf("%d\n",1988+s);
	else if(a==3) printf("%d\n",1925+s);
	else if(a==2) printf("%d\n",1911+s);
	else if(a==1) printf("%d\n",1867+s);
	return 0;
}

Measured memory_bytes: 2736
def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    m = t = sum(p[:K])
    for i in range(N-K):
        t -= p[i]
        t += p[i + K]
        m = max(m, t)
    return (m + K)/2
print(main())


Measured memory_bytes: 71792
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#define R register
#define MN 505
bool b[MN][MN],r[MN][MN];
int n,m;
inline char gc(){R char c;while((c=getchar())!='.'&&c!='#');return c;}
int main(){
	scanf("%d%d",&n,&m);
	for (R int i=1; i<=n; i+=2)
		for (R int j=2; j<m; ++j)
			b[i][j]=1;
	for (R int i=2; i<=n; i+=2)
		for (R int j=2; j<m; ++j)
			r[i][j]=1;
	for (R int i=1; i<=n; ++i)
		b[i][1]=r[i][m]=1;
	for (R int i=1; i<=n; ++i)
		for (R int j=1; j<=m; ++j)
			if (gc()=='#')
				b[i][j]=r[i][j]=1;
	for (R int i=1; i<=n; puts(""),++i)
		for (R int j=1; j<=m; ++j)
			if (r[i][j]) putchar('#');
			else putchar('.');
	puts("");
	for (R int i=1; i<=n; puts(""),++i)
		for (R int j=1; j<=m; ++j)
			if (b[i][j]) putchar('#');
			else putchar('.');
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    VI cnt(26);
    cin >> s;
    for (char &c: s) cnt[c-'a']++;
    int len = s.size();
    LL ans = 1LL * len * (len + 1) / 2;
    REP(i,0,26) ans -= 1LL * cnt[i] * (cnt[i] + 1) / 2;
    cout << ans + 1 << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N, M, X, Y;
  std::cin >> N >> M >> X >> Y;
  std::vector<i64> x;
  tools::read(x, N);
  std::vector<i64> y;
  tools::read(y, M);

  x.push_back(X);
  y.push_back(Y);
  std::cout << (*std::max_element(x.begin(), x.end()) < *std::min_element(y.begin(), y.end()) ? "No War" : "War") << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll> adj[100005];
ll ans[100005];
ll vis[100005]={0};
ll bfs(ll s, ll n)
{
	vis[s]=1;
	queue<ll> q;
	q.push(1);
	while(!q.empty())
	{
		ll node=q.front();
		q.pop();
		for(auto i=adj[node].begin();i!=adj[node].end();i++)
		{
			if(vis[*i]==0)
			{
				vis[*i]=1;
			ans[*i]=node;
			 
			q.push(*i);
			}
		}
	}
	for(ll i=1;i<=n;i++)
	{
		if(vis[i]==0)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	return 1;
}


int main() {
	ll n,m;
	cin>>n>>m;
	for(ll i=0;i<m;i++)
	{
		ll a1,b1;
		cin>>a1>>b1;
		adj[a1].push_back(b1);
		adj[b1].push_back(a1);
	}
	if(bfs(1,n))
	{
		cout<<"Yes"<<endl;
	for(ll i=2;i<=n;i++)
	{
		cout<<ans[i]<<endl;
	}
	}
	return 0;
}

Measured memory_bytes: 13676
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


#define INF 1000000000000

signed main()
 {
int n,m;
cin>>n>>m;
int a[m],b[m];
vector<int>chu1(0);
vector<int>chu2(0);
rep(i,m){
  cin>>a[i]>>b[i];
  if(a[i]==1){chu1.push_back(b[i]);}
  if(b[i]==n){chu2.push_back(a[i]);}
}

sort(chu1.begin(),chu1.end());
sort(chu2.begin(),chu2.end());
int l=0,r=0;
while(l<chu1.size()&&r<chu2.size()){
  if(chu1[l]==chu2[r]){
    cout<<"POSSIBLE";
    exit(0);
  }
  else if(chu1[l]<chu2[r]){l++;}
  else r++;
}
cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 5076
#!/usr/bin/python3
# -*- coding: utf-8 -*-


def solve():
  S = str(input())
  for i,c in enumerate(S):
    if i%2==0:
      if c not in "RUD":
        return False
    else:
      if c not in "LUD":
        return False
  return True

if solve():
  print("Yes")
else:
  print("No")


Measured memory_bytes: 38384
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    for i in range(1,a+1):
        if i == 1:
            print('#' * b)
        elif i == a:
            print('#' * b)    
        elif i != 0:
            print('#' + '.'*(b-2) + '#')
    print()

Measured memory_bytes: 7604
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}

int main(){
	int n;
	cin >> n;
	vector<int> x(n);
	vector<int> y(n);
	vector<int> h(n);
	for (int i = 0; i < n; i++){
		cin >> x[i] >> y[i] >> h[i];
	}

	for (int i = 0; i <= 100; i++){
		for (int j = 0; j <= 100; j++){
			int tmph;
			for (int k = 0; k < n; k++){
				if (h[k] != 0){
					tmph = h[k] + abs(x[k]-i) + abs(y[k]-j);
					break;
				}
			}
			for (int k = 0; k < n; k++){
				if (h[k] != max(tmph - abs(x[k]-i) - abs(y[k]-j), 0)){
					break;
				}
				if (k == n-1){
					cout << i << " " << j << " " << tmph << endl;
					return 0;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
        int n,m;
        int i,j;
        int vektor[100][100];
        int b[100],c[100]={};
        scanf("%d %d ",&n,&m);

        for(i=0;i<n;i++){
                for(j=0;j<m;j++)
                        scanf("%d",&vektor[i][j]);
        }
        for(i=0;i<m;i++)
                scanf("%d",&b[i]);
                
        for(i=0;i<n;i++){
            for(j=0;j<m;j++)
                c[i] += vektor[i][j]*b[j];
        }
        for(i=0;i<n;i++)
                printf("%d\n",c[i]);
                
        return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,C,D[30][30],c[500][500];
    ll ans[3][30]={0},m=1e18;
    cin>>n>>C;
    rep(i,C)rep(j,C) cin>>D[i][j];
    rep(i,n)rep(j,n) cin>>c[i][j];
    rep(i,3){
        rep(j,C){
            rep(k,n)rep(l,n)if((k+l)%3==i) ans[i][j]+=D[c[k][l]-1][j];
        }
    }
    rep(i,C)rep(j,C)rep(k,C)if(i!=j&&j!=k&&k!=i) m=min(m,ans[0][i]+ans[1][j]+ans[2][k]);
    cout<<m;
}

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

int main(){
  int n;cin >> n;
  vector<int> p(n);
  int cnt = 0;
  for(int i=0;i<n;i++)cin >> p[i];
  int amin=p[0];
  for(int i=0;i<n;i++){
    if(amin>=p[i]){
      cnt++;
    }
    amin = min(amin,p[i]);
  }
  cout << cnt << endl;
} 

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

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define HASH 1000003

typedef struct List {
	struct List *next;
	char *s;
} list;

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

int hash_string(char* s)
{
	int i, x = 0;
	for (i = 0; s[i] != 0; i++) x = ((x << 5) + s[i] - 'a') % HASH;
	return x;
}

int lex_smaller(char* s1, char* s2)
{
	int i;
	for (i = 0; s1[i] != 0 && s2[i] != 0; i++) {
		if (s1[i] < s2[i]) return 1;
		else if (s1[i] > s2[i]) return -1;
	}
	if (s1[i] == s2[i]) return 0;
	else if (s1[i] == 0) return 1;
	else return -1;
}

int main()
{
	int i, j, l[200001], N;
	char *S[200001], T[1000001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%s", T);
		for (l[i] = 0; T[l[i]] != 0; l[i]++);
		S[i] = (char*)malloc(sizeof(char) * (l[i] + 1));
		for (j = 0; j <= l[i]; j++) S[i][j] = T[j];
	}
	
	int h[200001];
	list *p, *hash[HASH], d[200001];
	for (i = 1; i <= N; i++) {
		h[i] = hash_string(S[i]);
		d[i].s = S[i];
		d[i].next = hash[h[i]];
		hash[h[i]] = &(d[i]);
	}
	
	int k, m, dp[2][26];
	long long ans = 0, tmp, pow[32];
	const long long inv = div_mod(1, 32, HASH);
	for (k = 1, pow[0] = 32; k < 32; k++) pow[k] = pow[k-1] * pow[k-1] % HASH;
	for (i = 1; i <= N; i++) {
		if (l[i] <= 1) continue;
		for (j = 0; j <= l[i]; j++) T[j] = S[i][j];
		for (j = l[i] - 1, k = 0, tmp = 1; j > 0; j >>= 1, k++) if ((j & 1) == 1) tmp = tmp * pow[k] % HASH;
		h[i] = (h[i] - tmp * (T[0] - 'a') % HASH + HASH) % HASH;
		tmp = tmp * inv % HASH;
		h[i] = (h[i] - tmp * (T[1] - 'a') % HASH + HASH) % HASH;
		for (j = 0; j < 26; j++) dp[0][j] = 0;
		dp[0][S[i][0] - 'a'] = 1;
		dp[1][0] = S[i][0] - 'a';
		for (j = 1, m = 1; j < l[i]; j++) {
			if (dp[0][S[i][j] - 'a'] == 0) {
				dp[0][S[i][j] - 'a'] = 1;
				dp[1][m++] = S[i][j] - 'a';
			}
			for (k = 0; k < m; k++) {
				T[j] = 'a' + dp[1][k];
				h[0] = (tmp * dp[1][k] + h[i]) % HASH;
				for (p = hash[h[0]]; p != NULL; p = p->next) if (lex_smaller(p->s, &(T[j])) == 0) break;
				if (p != NULL) ans++;
			}
			tmp = tmp * inv % HASH;
			h[i] = (h[i] - tmp * (S[i][j+1] - 'a') % HASH + HASH) % HASH;
		}
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 22024
n = str(input())

if n[0] == "9":
  ans = 100
elif n[0] == "1":
  ans = 900
  
if n[1] == "9":
  ans = ans + 10
elif n[1] == "1":
  ans = ans + 90

if n[2] == "9":
  ans = ans + 1
elif n[2] == "1":
  ans = ans + 9
  
print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000

bool v[11];
char a[N];
int b[11];
char dp[20][N];
int dp2[20];
int n, k, m;

void co(int x, int y){
	if (dp2[x + b[y]] > (dp2[x] + 1))return;
	else if (dp2[x + b[y]] < (dp2[x] + 1)){
		f(i, dp2[x])dp[x + b[y]][i] = dp[x][i];
		dp[x + b[y]][dp2[x]] = '0' + y;
		dp2[x + b[y]] = (dp2[x] + 1);
		return;
	}
	else{
		f(i, dp2[x] + 1){
			if (i < dp2[x]){
				if (dp[x + b[y]][i] > dp[x][i])return;
				else if (dp[x + b[y]][i] < dp[x][i]){
					f(j, dp2[x])dp[x + b[y]][j] = dp[x][j];
					dp[x + b[y]][dp2[x]] = '0' + y;
					dp2[x + b[y]] = (dp2[x] + 1);
					return;
				}
			}
			else{
				if (dp[x + b[y]][i] >= ('0' + y))return;
				else{
					f(j, dp2[x])dp[x + b[y]][j] = dp[x][j];
					dp[x + b[y]][dp2[x]] = '0' + y;
					dp2[x + b[y]] = (dp2[x] + 1);
					return;
				}
			}
		}
	}
	return;
}

int main(){

	f(i, N){
		a[i] = 0;
		f(j, 20)dp[j][i] = 0;
	}
	f(j, 20)dp2[j] = -1;
	f(i, 11)v[i] = false;
	scanf("%d", &n);
	scanf("%d", &m);
	f(i, m){
		scanf("%d", &k);
		v[k] = true;
	}

	b[1] = 2;
	b[2] = 5;
	b[3] = 5;
	b[4] = 4;
	b[5] = 5;
	b[6] = 6;
	b[7] = 3;
	b[8] = 7;
	b[9] = 6;

	k = n / 10;
	dp2[0] = 0;
	f(q, k + 1){
		f(i, 10){
			if (dp2[i] >= 0){
				f(j, 10){
					if (v[j]){
						co(i, j);
					}
				}
			}
		}
		if (q < k){
			f(i, 10){
				f(j, dp2[i + 10]){
					dp[i][j] = dp[i + 10][j];
					dp[i + 10][j] = 0;
				}
				dp2[i] = dp2[i + 10];
				dp2[i + 10] = -1;
			}
		}
	}
	printf("%s", dp[n % 10]);

	return 0;
}

Measured memory_bytes: 4224
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

H,W = I()
maze = [list(s()) for _ in range(H)]
visited = [[-1]*W for _ in range(H)]

def dfs(x,y):
    if x < 0 or y < 0 or x >= H or y >= W:
        return
    if visited[x][y] != -1:
        return
    if maze[x][y] == '.':
        return
    visited[x][y] = 1
    dfs(x+1,y)
    dfs(x,y+1)

dfs(0,0)
cnt = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '#':
            cnt += 1
if visited[-1][-1] == -1:
    print('Impossible')
elif cnt == H+W-1:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 10052
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
max_profit = a[1] - a[0]
min_val = min(a[1],a[0])
for i in range(2,N):
	if a[i] < min_val:
		min_val = a[i]
	elif a[i] - min_val > max_profit:
		max_profit = a[i] - min_val
print(str(max_profit))

Measured memory_bytes: 15584
#include<stdio.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

int main(){
	int n,i,p[20],ans=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&p[i]);
	for(i=1;i<n-1;i++){
		int mn=min(p[i-1],p[i+1]),mx=max(p[i-1],p[i+1]);
		if(p[i]>mn&&p[i]<=mx)ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long int ll;
using namespace std;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll A,B;
cin>>A>>B;
double tmp_K=(A+B)/2.0;
if(tmp_K-ll(tmp_K)==0)cout<<ll(tmp_K)<<endl;
else cout<<"IMPOSSIBLE"<<endl;

//system("pause");
return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
nt, nx, ny = [0]*3
cant = False
for i in range(int(input())):
	t, x, y = map(int, input().split())
	a = abs(x-nx)+abs(y-ny)
	if a>t or (t-nt-a)%2: cant = True
	nt, nx, ny = t, x, y
print("YNeos"[cant::2])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int N; cin >> N;
VI a(N); rep(i, 0, N) cin >> a[i];

// 周期の最小公倍数で最大値が重なる．

cout << accumulate(ALL(a), 0) - N << endl;
}

// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define __STDC_LIMIT_MACROS
#include <stdint.h>
using namespace std;
#define int             long long

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
 
    }
    return true;
}

void c_p_c()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

}
int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //c_p_c();
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0) cout<<1<<endl;
    else if(b==0) cout<<2<<endl;
    else if(c==0) cout<<3<<endl;
    else if(d==0) cout<<4<<endl;
    else cout<<5<<endl;

}   


Measured memory_bytes: 3584
#include <algorithm>
#include <iostream>
#include <vector>
int main() {
    // input
    auto n = std::size_t(0);
    std::cin >> n;

    auto input_vec = [&n]() {
        auto v = std::vector<std::uint64_t>();
        v.reserve(n);
        for (auto i_ = std::size_t(0); i_ < n; ++i_) {
            auto l = 0;
            std::cin >> l;
            v.emplace_back(l);
        }

        std::sort(v.begin(), v.end());

        return v;
    };

    const auto a = input_vec();
    const auto b = input_vec();
    const auto c = input_vec();

    auto counter = std::uint64_t(0);
    /*
    for (const auto& middle : b) {
        auto upper_itr = std::lower_bound(a.begin(), a.end(), middle);
        const auto upper_candidate = std::distance(a.begin(), upper_itr);

        auto lower_itr = std::upper_bound(c.begin(), c.end(), middle);
        const auto lower_candidate = std::distance(lower_itr, c.end());

        counter += static_cast<std::uint64_t>(upper_candidate * lower_candidate);
    }
    */

    auto upper_itr = a.begin();
    auto lower_itr = c.begin();
    for (const auto& middle : b) {
        while ((upper_itr != a.end()) && (*upper_itr < middle)) upper_itr++;
        while ((lower_itr != c.end()) && (*lower_itr <= middle)) lower_itr++;

        const auto upper_candidate = std::distance(a.begin(), upper_itr);
        const auto lower_candidate = std::distance(lower_itr, c.end());

        counter += static_cast<std::uint64_t>(upper_candidate * lower_candidate);
    }
    std::cout << counter << std::endl;

    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
class Main {
     
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
         
        int n = scanner.nextInt();
        int min, max;
        min = max = 0;
        long sum = 0;
         
        for( int i = 0; i < n; i++  ) {
             
        	int num = scanner.nextInt();
            if(i == 0) {
                min = num;
                max = num;
            }
            if(min > num){
                min = num;
            }
            if(max < num){
                max = num;
            }
            sum += num;
        }   
        System.out.println(min+" "+max+" "+sum);
    }
}

Measured memory_bytes: 42076
D = int(input())
C = list(map(int, input().split()))
S = []
N = 26
for d in range(D):
    S += [list(map(int, input().split()))]
#print(C)
#print(S)
myans = [d%N for d in range(D)]
for d in range(D):
  print(myans[d]+1)

Measured memory_bytes: 9400
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

map <int, int> M;

void solve() {
	int n; scanf("%d", &n);
	rep(i, n) {
		int x; scanf("%d", &x);
		M[x]++;
	}
	int ans = 0;
	for(pii e : M) { if(e.Fi <= e.Se) ans += e.Se - e.Fi; else ans += e.Se; }
	printf("%d\n", ans);
}

int main(){
	int Tc = 1; // scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}




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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};

int N, M;
vector<llong int> sum[8];


int main(){
	cin >> N >> M;
	llong int x,y,z;
	for(int i = 0; i < N; i++){
		cin >> x >> y >> z;
		sum[0].pb(x+y+z);
		sum[1].pb(x+y-z);
		sum[2].pb(x-y+z);
		sum[3].pb(x-y-z);
		sum[4].pb(-x+y+z);
		sum[5].pb(-x+y-z);
		sum[6].pb(-x-y+z);
		sum[7].pb(-x-y-z);
	}
	for(int i = 0; i < 8; i++){
		sort(sum[i].begin(), sum[i].end(), greater<llong int>());
	}
	llong int ans = -inf;
	for(int i = 0; i < 8; i++){
		llong int ret = 0;
		for(int j = 0; j < M; j++){
			ret += sum[i][j];
		}
		// if(ans < ret){
		// 	cout << i << endl;
		// 	for(int j = 0; j < M; j++){
		// 		cout << sum[i][j] << " ";
		// 	}
		// 	cout << endl;
		// }
		ans = max(ans, ret);
	}
	cout << ans << endl;

	return 0;
}

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


int main () {
	int N;
	cin >> N;
	int icards[N];
	for (int i = 0; i < N; ++i)
	{
		/* code */
		cin >> icards[i];
	}
	sort(icards,icards+N,std::greater<int>() );


//	for (int i = 0; i < N; ++i)
//	{
//		/* code */
//		cout << icards[i] << endl;
//	} 

	int ans=0;
	for (int i = 0; i < N; ++i)
	{
		if (i%2 == 0) {
			ans += icards[i];
		} else {
			ans -= icards[i];
		}
	}

	cout << ans << endl;

}

Measured memory_bytes: 256