akhauriyash/Code-Regression huggingface dataset:
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let ls = scan_list ~sep:' ' Int.of_string

let () =
  match List.index_of 0 ls with
  | Some i -> Printf.printf "%d\n" @@ succ i
  | _ -> ()


Measured memory_bytes: 5468
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>


using namespace std;

    int main(){
        int N;
        cin>>N;
        for (int i = 1; i <= 9; i++){
            for (int j = 1; j <= 9; j++){
                if (i*j == N){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }

        cout << "No" << endl;

        return 0;
    }




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int H,W,i,j;
	while(cin>>H>>W)
	{
		if(H==0&&W==0)
			break;
		else
		{
			for(i=1;i<=H;i++)
			{
				for(j=1;j<=W;j++)
				{
					cout<<"#";
				}
				cout<<"\n";
			}
			cout<<"\n";
		}
	}
	return 0;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
int main(){
    string S; cin >> S;
    int N; N = S.size();
    ll ans = 0;
    ll dp[100005][13];
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1;

    rep(i,N){
        char c = S[i];
        if(c == '?'){
            rep(j,10){
                rep(k,13){
                    dp[i+1][(k*10+j)%13] += dp[i][k];
                    dp[i+1][(k*10+j)%13] %= mod;
                }
            }
        }else{
            int j = S[i] - '0';
            rep(k,13){
            dp[i+1][(k*10+j)%13] += dp[i][k];
            dp[i+1][(k*10+j)%13] %= mod;
        }
    }
    }

    ans = dp[N][5];
    cout << ans <<endl;
}


Measured memory_bytes: 10624
S = input()
s_size = len(S)
min_remainder = 1000
for i in range(s_size - 2):
    X = int(S[i] + S[i + 1] + S[i + 2])
    tmp_remainder = abs(753 - X)
    if tmp_remainder < min_remainder:
        min_remainder = tmp_remainder

print(min_remainder)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,op,a;
    scanf("%d%d",&n,&op);
    for(int i=1; i<=n; i++)
        scanf("%d",&a);
    int ans=1;
    n-=op;
    op--;
    ans+=(n/op);
    if(n%op)
        ans++;
    printf("%d\n",ans);
}


Measured memory_bytes: 256
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}
ll ans[N],cnt;
int main()
{
    ll a,b,c;
    sl(a);sl(b);sl(c);
    for(ll i = 1;i <= 100;i++)
    {
        if(a%i == 0 && b%i == 0)
            ans[cnt++] = i;
    }
    reverse(ans,ans+cnt);
    printf("%lld\n",ans[c-1]);
    return 0;
}

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

//#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;

signed main() {
	int a[110][110] = {};
	int r[110], c[110];
	for (int n; cin >> n&&n;) {
		rep(i, 0, n) rep(j, 0, n) cin >> a[i][j];
		rep(i, 0, n) r[i] = INF;
		rep(i, 0, n) c[i] = 0;
		
		rep(i, 0, n) rep(j, 0, n) {
			r[i] = min(r[i], a[i][j]);
			c[j] = max(c[j], a[i][j]);
		}

		bool f = true;
		rep(i, 0, n) rep(j, 0, n) {
			if (f&&r[i] == a[i][j] && c[j] == a[i][j]) {
				cout << a[i][j] << endl;
				f = false;
			}
		}
		if (f) cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<int,ll> p;
typedef pair<pii,int> P;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
const ll MOD=1e9+7;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int main(){
    int n,k;cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;++i) cin>>a[i];
    bool ok=false;
    int g=a[0];
    for(int i=0;i<n;++i) g=gcd(g,a[i]);
    for(int i=0;i<n;++i){
        if(k>a[i]) continue;
        if((a[i]-k)%g==0){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int N=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		int sum,SUM=0;
		double a,t;
		for(int i=1;i<=N;i++) {
			sum = (i/10000) + (i%10000)/1000 + (i%1000)/100 + (i%100)/10 +i%10;
			if(sum>=A && sum<=B) SUM+=i;
		}
		System.out.println(SUM);
	}

}


Measured memory_bytes: 21972
#include <stdio.h>

int main()
{
  int j, A[100], N, v, flag, count;

  scanf("%d",&N);
  for(j=0; j<N; j++){
    scanf("%d",&A[j]);
  }

  flag=1;
  count=0;

  while(flag){
    flag=0;
    for(j=N-1;j>=1;j--){
      if(A[j]<A[j-1]){
	v=A[j];
	A[j]=A[j-1];
	A[j-1]=v;
	count++;
	flag=1;
      }
    }
  }
  for(j=0;j<N;j++){
    if(j>0) printf(" ");
    printf("%d",A[j]);
  }
  printf("\n%d\n",count);
  return 0;
}

Measured memory_bytes: 604
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    char[] c = S.toCharArray();

    if (c[2] == c[3] && c[4] == c[5]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23764
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double EPS = 1.0e-10;

class Point
{
public:
    double y, x;
    Point(){
        y = x = 0.0;
    }
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point operator+(const Point& p) const{
        return Point(y + p.y, x + p.x);
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    Point operator*(double a) const{
        return Point(y * a, x * a);
    }
    Point operator/(double a) const{
        return Point(y / a, x / a);
    }
    double length() const{
        return sqrt(y * y + x * x);
    }
    double dist(const Point& p) const{
        return sqrt(pow(y - p.y, 2) + pow(x - p.x, 2));
    }
    double dot(const Point& p) const{
        return y * p.y + x * p.x; // |a|*|b|*cos慮
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x; // |a|*|b|*sin慮
    }
};

int main()
{
    for(;;){
        double d;
        cin >> d;
        if(d < EPS)
            return 0;

        Point p, v;
        cin >> p.x >> p.y >> v.x >> v.y;

        if(abs(p.cross(v)) < EPS){
            double ret;
            if(p.dot(v) > 0)
                ret = 2.0 - p.length();
            else
                ret = p.length();

            if(ret < d - EPS)
                printf("%.10f\n", ret);
            else
                cout << "impossible" << endl;
        }else{
            cout << "impossible" << endl;
        }
    }
}

Measured memory_bytes: 1272
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int N = saori.saori_hayami();
		int M = saori.saori_hayami();
		int X = saori.saori_hayami();
		int Y = saori.saori_hayami();
		int Z = X + 1;
		for(int i = 0; i < N; i++) {
			Z = Math.max(Z, saori.saori_hayami() + 1);
		}
		boolean flag = true;
		for(int i = 0; i < M; i++) {
			flag = flag && saori.saori_hayami() >= Z;
		}
		flag = flag && Y >= Z;
		if(flag) {
			System.out.println("No War");
		} else {
			System.out.println("War");
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21460
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

s=input().rstrip().split("T")
x,y=MI()
#print(s)
lisx=[]
lisy=[]
x-=len(s[0])
for i in range(1,len(s)):
    if i%2==0:
        lisx.append(len(s[i]))
    else:
        lisy.append(len(s[i]))
resx=[[] for i in range(len(lisx)+1)]
resy=[[] for i in range(len(lisy)+1)]
resx[0]=[0]
resy[0]=[0]
#print(lisx)
for i in range(len(lisx)):
    for j in range(len(resx[i])):
        resx[i+1].append(resx[i][j]+lisx[i])
        resx[i+1].append(resx[i][j]-lisx[i])
    resx[i+1]=list(set(resx[i+1]))
#print(resx)
for i in range(len(lisy)):
    for j in range(len(resy[i])):
        resy[i+1].append(resy[i][j]+lisy[i])
        resy[i+1].append(resy[i][j]-lisy[i])
    resy[i+1]=list(set(resy[i+1]))
#print(lisy)
#print(resy)
if x in resx[-1] and y in resy[-1]:
    print("Yes")
else:
    print("No")
    

        
        
        
            
        

                

Measured memory_bytes: 203032
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{

    internal class Solution
    {
        public int N;
        public int[] A;

        public void Run()
        {
            N = Input.ReadInt();
            A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = Input.ReadInt();
            }

            // check
            if (A[0] != 0)
            {
                Console.WriteLine(-1);
                return;
            }

            for (int i = 0; i < N - 1; i++)
            {
                if (A[i + 1] > A[i] + 1)
                {
                    Console.WriteLine(-1);
                    return;
                }
            }

            // solve
            long ret = 0;
            int load = -1;
            for (int i = N - 1; i >= 0; i--)
            {
                if (load != A[i])
                {
                    ret += A[i];
                }

                load = A[i];
                load--;
            }

            Console.WriteLine(ret);

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 17336
#include <bits/stdc++.h>
using namespace std;
// typedef
using ll  = long long;
using str = string;
using PL  = pair<ll, ll>;
using P   = pair<int, int>;
using VL  = vector<ll>;
using VI  = vector<int>;
using VS  = vector<str>;
using VP  = vector<P>;
using VPL = vector<PL>;
using VVL = vector<VL>;
using VVI = vector<VI>;

// const num
const ll INF         = 1e18 + 18;
const ll MAX         = 100005;
const ll MOD         = 1000000007;
const long double PI = acosl(-1.0);

// loop
#define REP(i, a, b) for(ll(i) = (a); (i) <= (b); (i)++)
#define RREP(i, a, b) for(ll(i) = (a); (i) >= (b); (i)--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)

// YesNo
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
// All
#define ALL(v) v.begin(), v.end()
#define deduplicate(v) (v).erase(unique(ALL(d)), (v).end())

int main(void) {
	int n;
	int ans[10100] = {0};

	cin >> n;
	REP(x, 1, 100) {
		REP(y, 1, 100) {
			REP(z, 1, 100) {
				int temp = x * x + y * y + z * z + x * y + y * z + z * x;
				if(temp <= 10010) {
					ans[temp]++;
				}
			}
		}
	}
	REP(i, 1, n) {
		// printf("[%lld]:", i);
		cout << ans[i] << endl;
	}
	return 0;
}

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

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

#define X real()
#define Y imag()

using D = double;
using P = complex<D>;

const D EPS = 1e-10;
namespace std {
  bool operator < (const P& a, const P& b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
};

struct L : array<P, 2> {
  L(const P& a, const P& b) {
    front() = a;
    back() = b;
  }
  P vec() const {
    return back() - front();
  }
};
// struct L : vector<P> {
//   L(const P& a, const P& b) {
//     push_back(a);
//     push_back(b);
//   }
//   P vec() const {
//     return back() - front();
//   }
// };
D dot(const P& a, const P& b) {
  return (conj(a)*b).X;
}
D cross(const P& a, const P& b) {
  return (conj(a)*b).Y;
}
int ccw(P a, P b, P c) {
  b -= a;
  c -= a;
  if(cross(b, c) > 0) return +1; // ccw
  if(cross(b, c) < 0) return -1; // cw
  if(dot(b, c) < 0) return +2; // L c-a-b
  if(norm(b) < norm(c)) return -2; // L a-b-c
  return 0;
}

bool intersectLL(const L& l, const L& m) {
  return abs(cross(l.vec(), m.vec())) > EPS ||
    abs(cross(l[1] - l[0], m[0] - l[0])) < EPS;
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    vector<D> d(8);
    rep(i, 8) cin >> d[i];
    L s{P{d[0], d[1]}, P{d[2], d[3]}}, t{P{d[4], d[5]}, P{d[6], d[7]}};
    if(abs(cross(s.vec(), t.vec())) < EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
    //    cout << s.vec().X << " " << s.vec().Y << endl;
    //    cout << t.vec().X << " " << t.vec().Y << endl;
    //    if(intersectLL(s, t)) cout << "NO" << endl;
    //    else cout << "YES" << endl;
  }
  return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h> 
using namespace std;
#define ld long double 
#define float long double 
#define ll long long
#define int long long
#define vl vector<ll> 
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define endl '\n'
#define cnl cout<<endl;
#define pi  3.141592653589793238
#define ms(x,v) ((x), v, sizeof((x)))
#define MAXN 100009
#define CASET int ___T; scanf("%lld", &___T); for(int cs=1; cs <= ___T; cs++)
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
const int N = 200 * 1000 + 9;
const int  inf = 1e18;
const int mod=1e9+7;
int i,j,k;
void solve(){
   int a[3][3];
   for(i =0;i<3;i++)
    for(j= 0;j<3;j++) cin >> a[i][j];
      ll n;cin >> n;
      vl v(n);
    map<int,int> mpp;
  for(i = 0;i<n;i++) cin >> v[i],mpp[v[i]]++;
   for(i =0;i<3;i++){
     bool flag = true;
     for(j = 0;j<3;j++){
       if(mpp[a[i][j]] == 0){
        flag = false ;
        break;
       }
     }
     if(flag == true){
      cout <<"Yes" << endl;
      return;
     }
   }
 
  for(i =0;i<3;i++){
     bool flag = true;
     for(j = 0;j<3;j++){
       if(mpp[a[j][i]] == 0){
        flag = false ;
        break;
       }
     }
     if(flag == true){
      cout <<"Yes" << endl;
      return;
     }
   }
    if(mpp[a[0][0]] and mpp[a[1][1]] and mpp[a[2][2]]){
      cout << "Yes"<< endl;
      return;
    }
     if(mpp[a[2][0]] and mpp[a[1][1]] and mpp[a[0][2]]){
      cout << "Yes"<< endl;
      return;
    }
    cout << "No" << endl;





 return ;
}
    signed main(){
   
   // CASET
    solve();
    
   
    return 0;
  }


Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let input:Vec<i32> = s.split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect();

    let strings = vec!["ABC","ARC","AGC"];
    let x = match input[0] {
        0...1199 => 0,
        1200...2799 => 1,
        _ => 2,
    };
    println!("{}",strings[x]);
}


Measured memory_bytes: 4352
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)
	h := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}
	ans := 1
	for i := 1; i < n; i++ {
		flag := true
		for j := 0; j < i; j++ {
			if h[j] > h[i] {
				flag = false
				break
			}
		}
		if flag {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W, &H, &x, &y, &r);
    
    if(x<r || x+r>W || y<r || y+r>H){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ll a,b;
	cin>>a>>b;
	ll cha = b-a;
	ll h = cha*(cha+1)/2-b;
	cout<<h<<endl;
	return 0;
} 


Measured memory_bytes: 3608
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	a = list(map(int,input().split()))
	a.sort()
	print(a[2]*10+sum(a[:2]))
	

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()


Measured memory_bytes: 63340
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
    int N, len;
 
    scanf("%d", &N);
    char S[10001];
 
    scanf("%s", S);
    len = strlen(S);
 
    for(int i = 0; i < len; i++){
        printf("%c", 'A' + (((S[i] - 'A') + N) % 26));
    }
    printf("\n");
  
}

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

int main()
{
    int n,i,j,k; cin>>n>>k; int a[n];
    for(i=0;i<n;i++) cin>>a[i];
    
    if(n==k) cout<<1;
    else
    {
        int res=1;n=n-k;
        res+=n/(k-1);
        if(n%(k-1)!=0) res++;
        cout<<res;
    }


}


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


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

  int n,m;
  cin >> n >> m;
  ll sum =0;
  vector<int> a(m);
  rep(i,m){
    cin >> a[i];
    sum += a[i];
  }
  if(sum>n) cout << -1 << endl;
  else cout << n - sum << endl;
  return 0;
    

}


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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define setIO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define trav(e, x) for (const auto &(e) : (x))
#define pb(x) push_back(x)
#define eb(x...) emplace_back(x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define lc(i) 2*i
#define rc(i) 2*i+1
#define int long long
using namespace std;
using ii = pair<int, int>;
using vi = vector<int>;
using vb = vector<bool>;
using vii = vector<ii>;
using vivi = vector<vi>;

const int N = 1e5 + 5, MOD = 1e9 + 7, INF = 1e9 + 5;

signed main() {
    FAST_IO;
//    setIO("input.txt", "output.txt");

    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i < n; i++) {
        for (int j = 1; i * j < n; j++) {
            ans++;
        }
    }
    cout << ans;
}

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

int main() {

	ll l, r; cin >> l >> r;
	const ll mod = 2019;
	ll ans = 10000;
	for (ll x = l; x <= min(l + 2030LL, r - 1) ; x++) {
		for (ll y = x + 1; y <= min(x + 10000LL, r); y++) {
			ans = min(ans, (x * y) % mod);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3576
#include<stdio.h>
#define MAX 100000

int main(){
  int H,i,A[MAX+1];
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=H;i++){
    printf("node %d: ",i);
    printf("key = %d, ",A[i]);
    if(parent(i)>=1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=H)printf("left key = %d, ",A[left(i)]);
    if(right(i)<=H)printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}

int parent(int i){
  return i/2;
}
int left(int i){
  return i*2;
}
int right(int i){
  return i*2+1;
}



Measured memory_bytes: 2048
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;

  if(s[k-1] == 'A') s[k-1] = 'a';
  if(s[k-1] == 'B') s[k-1] = 'b';
  if(s[k-1] == 'C') s[k-1] = 'c';

  cout << s << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

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

        final int N = sc.nextInt();

        final Integer[] a = new Integer[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a, Comparator.reverseOrder());

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < N; i++) {
            if (i % 2 == 0) alice += a[i];
            if (i % 2 != 0) bob += a[i];
        }

        System.out.println(alice - bob);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  ll a, b, c;
  cin >> a >> b >> c;
  if (a - b >= c)
  {
    cout << 0 << endl;
  }
  else
  {
    cout << c - (a - b) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	S, T := ReadString(), ReadString()
	min := 1 << 60
	for i := 0; i <= len(S)-len(T); i++ {
		c := 0
		for j := 0; j < len(T); j++ {
			if S[i+j] != T[j] {
				c++
			}
		}
		if c < min {
			min = c
		}
	}
	fmt.Println(min)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1860
S=input()
n=len(S)
a=[0]*2019
MOD=2019
current=0
a[0]=1
for i in range(n):
  current=(current+int(S[n-1-i])*pow(10,i,MOD))%MOD
  a[current]+=1
ans=0
for i in range(2019):
  ans+=(a[i]*(a[i]-1))//2
print(ans)


Measured memory_bytes: 68300
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
up = [0]
down = [n]
for i in range(n):
    up.append(up[-1] + i+1)
    down.append(down[-1] +(n-i-1))
res = 0

for i in range(k-1,n+1):
    res += down[i] - up[i] + 1
    res %= mod
print(res)

Measured memory_bytes: 105004
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <map>
 
#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
 
using namespace std;
 
using ll = long long;
 
typedef stack<int> IntStack;
typedef queue<int> IntQueue;
typedef vector<int> IntVector;
typedef list<int> IntList;
 
typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll S, W;
  cin >> S >> W;
  
  string ans = "safe";
  if(W >= S){
  	ans = "unsafe";
  }
  cout << ans << endl;   
}

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

int main(){
    int A, B, C;
    cin >> A >> B >> C;

    if (A - B > C) {
        cout << "0" << endl;
    }
    else {
        cout << C - (A - B) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,R[200000],i;
  int MIN,MAX;
  scanf("%d",&n);
  scanf("%d %d",&R[0],&R[1]);
  if(R[0]<R[1]){
    MIN=R[0];
  } else {
    MIN=R[1];
  }
  MAX=R[1]-R[0];
  for(i=2;i<n;i++){
    scanf("%d",&R[i]);
    if(R[i]-MIN>MAX){
      MAX=R[i]-MIN;
    }
    if(R[i]<MIN){
      MIN=R[i];
    }
  }
  printf("%d\n",MAX);
  return 0;
}

Measured memory_bytes: 3484
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  while(1){
    Int n, m;
    cin>>n>>m;
    if(n == 0 && m == 0) break;
    vector<Int> S(n);
    cin>>S;

    auto simulate = [&](Int X){
      Int level = 1;    
      auto getNextMonster = [&](){
	Int i = lower_bound(S.begin(), S.end(), level) - S.begin();
	Int j = i - 1;
	Int res = -1;
	if(0 <= i && i < (Int)S.size() && level + X > S[i]) res = i;
	if(0 <= j && j < (Int)S.size() && level + X > S[j] &&
	   (res == -1 || abs(level - S[i]) > abs(level - S[j]))) res = j;
	return res;
      };
      
      Int cnt = 0;
      while(1){
	cnt++;
	Int nextMonster = getNextMonster();
	if(level + X > S[n-1]) return cnt;
	if(nextMonster == -1) return INF;
	level += max(1LL, X - abs(level - S[nextMonster]) );
      }
      return cnt;
    };


    Int L = 1, R = 1e6 + 100;
    while(L + 1 < R){
      Int M = (L + R) / 2;
      Int cnt = simulate(M);
      (cnt < m)? (R = M):(L = M);
    }
    
    Int ans = L;
    Int cnt = simulate(ans);
    if(cnt < m || cnt == INF) ans = -1;
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3848
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

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

    for(int i = 0; i < s.size(); i++) {
        if(i % 2 == 0) {
            string t = "RUD";
            if(t.find(s[i]) == -1) {
                cout << "No" << endl;
                return 0;
            }
        }
        if(i % 2 != 0) {
            string t = "LUD";
            if(t.find(s[i]) == -1) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,cnt=0;
    cin >> n;
    vl a(n);
    rep(i,n){
        cin >> a[i];
        if(i%2==0&&a[i]%2==1){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3640
#include<stdio.h>

int main(void)
{
  char s[9];//文字列
  int c=0,i=0;
  scanf("%s",s);


  for(i=0;i<3;i++)c+=s[i]=='1';//i番目の文字列が１に一致するならｃに１加算する\\
よ
  printf("%d\n",c);
  return 0;


}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int i,j;
  int n,m;

  while(1){
    scanf("%d%d", &n, &m);

    if(n==0 &&  m==0){
     break;}

    for(i=1;i<=n;i++){   
      if(i%2!=0){
	if(m%2==0){
	  for(j=1;j<=m/2;j++){
	    printf("#.");
	  }
	  printf("\n");
	}

	if(m%2!=0){
	  for(j=1;j<=m/2;j++){
	    printf("#.");
	  }
	  printf("#\n");}
      }
      
      if(i%2==0){
	if(m%2==0){
	  for(j=1;j<=m/2;j++){
	    printf(".#");
	  }
	  printf("\n");
	}
	
	if(m%2!=0){
	  for(j=1;j<=m/2;j++){
	    printf(".#");
	  }
	  printf(".\n");}
      }
      
    }
    printf("\n");
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

const int maxn = 2e5 + 50;
const int mod = 1e9 + 7;

bool d[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int v, u;
		cin >> v >> u;
		d[v] ^= 1;
		d[u] ^= 1;
	}
	for (int i = 1; i <= n; i++)
		if (d[i])
			return cout << "NO\n", 0;
	cout << "YES\n";
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	Scanner sc;
	int N;
	BitSet[] bs;
	long[] c = new long[60];
	long total = 0L;
	long result = 0L;
	
	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		N = sc.nextInt();
		bs = new BitSet[60];
		for (int i = 0; i < 60; i++) {
			bs[i] = new BitSet(N+60);
			bs[i].set(i);
		}
		for (int i = 0; i < N; i++) {
			long a = sc.nextLong();
			total ^= a;
			for (int j = 0; j < 60; j++)
				if ( (a & (1L<<j)) != 0) bs[j].set(i+60);
		}
		for (int i = 0; i < 60; i++)
			if ((total & (1L<<i)) != 0) bs[i].clear();
		try1();
		System.out.println(total+result*2);
	}
	
	private void sweepOut() {
		int i = 0;
		for (int bpos = N+59; bpos >= 0; bpos--) {
			for (int j = i; j < 60; j++) {
				if (!bs[j].get(bpos)) continue;
				BitSet tmp = bs[i]; bs[i] = bs[j]; bs[j] = tmp;
				long t = c[i]; c[i] = c[j]; c[j] = t;
				for (j = 0; j < 60; j++) {
					if (i == j || !bs[j].get(bpos)) continue;
					bs[j].xor(bs[i]);
					c[j] ^= c[i];
				}
				i++;
			}
		}
	}
	
	private void try1() {
	lp:
		for (int i = 59; i >= 0; i--) {
			long bit = 1L<<i;
			if ((total & bit) != 0L) continue;
			for (int j = 0; j < 60; j++) {
				if (bs[j].get(i)) {
					c[j] |= bit;
					bs[j].clear(i);
				}
			}
			sweepOut();
			for (int j = 0; j < 60; j++) {
				if (!bs[j].isEmpty() || (Long.bitCount(c[j])&1)==0) continue;
				for (int k = 0; k < 60; k++) c[k] &= (~bit);
				continue lp;
			}
			result |= bit;
		}
	}
	
	public static void main(String[] args) {
		new Main().calc();
		
	}
}


Measured memory_bytes: 51192
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int P = Integer.parseInt(sc.next());
        int ans = (3*A+P)/2;
        System.out.print(ans);
    }
    }

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

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

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

int sumTable[501][501];

signed main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<P> LR;
  rep(i, M) {
    P p;
    cin >> p.first >> p.second;
    LR.pb(p);
  }

  vector<P> Query;
  rep(i, Q) {
    P p;
    cin >> p.first >> p.second;
    Query.pb(p);
  }

  vector<vector<int>> sumTable(N+1, vector<int>(N+1,0));
  rep(i, M) {
    sumTable[LR[i].first][LR[i].second] ++;
  }
  rep(i,N){
    rep(j, N) {
      sumTable[i+1][j+1] += sumTable[i][j+1];
      sumTable[i+1][j+1] += sumTable[i+1][j];
      sumTable[i+1][j+1] -= sumTable[i][j];
    }
  }
  rep(i, Q) {
    int l = --Query[i].first;
    int r = Query[i].second;
    cout << sumTable[r][r] - sumTable[l][r] - sumTable[r][l] +
                sumTable[l][l]
         << "\n";
  }
  cout << endl;
}

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

typedef long long ll;
typedef long double ld;
const ll init = 1e18+7;

#define mkp make_pair
#define pb push_back
#define pq priority_queue
#define minpq priority_queue <int, vector<int>, greater<int> >
#define vi vector <int> 
#define vll vector <ll>
#define pii pair<int,int>

vll v(1e5+10);
vll dp(1e5+10,init);
int n,k;

ll find_ans(int x){
	if(dp[x]==init){
		for (int i = 1; i <= k; ++i)
		{
			if(x+i>n) break;
			dp[x] = min(dp[x],find_ans(x+i)+abs(v[x]-v[x+i]));
		}
	}
	return dp[x];
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>k;
	for (int i = 1; i <= n; ++i){
		cin>>v[i];
	}
	dp[n]=0;
	dp[1]=find_ans(1);
	cout<<dp[1]<<endl;
    return 0;
} 

Measured memory_bytes: 6528
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	ll a, b; cin >> a >> b;
	ll n = a * pow(10, dig(b, 10)) + b;

	ll c = sqrt(n);
	for (int i = 1; i <= c; i++) {
		if (n%i == 0 && n / i == i) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
}

Measured memory_bytes: 256
def resolve():
    # 整数 1 つ
    x = int(input())
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    a=100
    for i in range(1,10**16):
        a=int(a*1.01)
        if a >= x:
            print(i)
            break

    #print("n")


resolve()


Measured memory_bytes: 63624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1010;
const int INF = 0x3f3f3f3f;
int n,m,h,w,k,ans;
int a[11][N],b[11][N],c[11];
int solve(){
    int rs=0; memset(c,0,sizeof(c));
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j) if(b[i][j]>k) return INF;
    for(int i=1;i<=m;++i){
        bool flg=true;
        for(int j=1;j<=n;++j){
            if(c[j]+b[j][i]>k) flg=false;
        }
        if(flg) for(int j=1;j<=n;++j) c[j]+=b[j][i];
        else{ for(int j=1;j<=n;++j) c[j]=b[j][i]; rs++; }
    }
    return rs;
}
void dfs(int d){
    if(d>h){
        ans=min(ans,n-1+solve());
        return ;
    }
    for(int i=1;i<=m;++i) b[n][i]+=a[d][i];
    if(d<h){ n++; dfs(d+1); n--; } dfs(d+1);
    for(int i=1;i<=m;++i) b[n][i]-=a[d][i];
}

int main(){
    scanf("%d %d %d",&h,&w,&k);
    for(int i=1;i<=h;++i)
        for(int j=1;j<=w;++j) scanf("%1d",&a[i][j]);
    ans=INF; n=1; m=w; dfs(1);
    printf("%d\n",ans);
}

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

#define MAX 100000
#define ll long long

ll arr[MAX+5];
int n, k;
ll dp[MAX+5];

void initialize()
{
    for(int i=0;i<=MAX+5;i++) dp[i] = -1;
}

ll frog(int pos)
{
    if(pos<=1) return 0;

    for(int i=2;i<=k and n;i++)
        if(pos==i)
            return abs(arr[i]- arr[1]);

    if(dp[pos]!=-1) return dp[pos];

    //ll p1 = frog(pos-1)+abs(arr[pos] - arr[pos-1]);
    //ll p2 = frog(pos-2)+abs(arr[pos] - arr[pos-2]);

    ll mn = LLONG_MAX;

    for(int i=1;i<=k and n;i++)
    {
        mn = min(mn, frog(pos-i)+abs(arr[pos] - arr[pos-i]));
    }

    dp[pos] = mn;

    return mn;
}

int main()
{
    initialize();
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>arr[i];

    ll cost = frog(n);

    cout<<cost<<endl;
    return 0;
}


Measured memory_bytes: 12844
while True:
    H, W = map(int, input().split())
    
    if H==0 and W==0:
        break
    elif H>2 and W>2:
        print("#" * W)
        for i in range(H-2):
            print("#" + "."*(W-2) + "#")
        print("#" * W + "\n")
    else:
        for i in range(H):
            print("#" * W)
        print("")


Measured memory_bytes: 5620