akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Iroha
{
    public Iroha() { }
    public static int Main()
    {
        new Iroha().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        long K = cin.nextLong();
        for (int i = 0; i < K; i++)
        {
            if(S[i] != '1')
            {
                Console.WriteLine(S[i]);
                return;
            }
        }
        Console.WriteLine(1);
    }
    


}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;++i)
#define mkp make_pair
#define F first
#define S second
int main(){
	int h,w;
	while(cin>>h>>w,h||w){
		vector<vector<int> > vv(h,vector<int>(w));
		// cout<<vv.size()<<" "<<vv[0].size()<<endl;
		pair<int,int> pos=mkp(0,0);
		vector<string> vs(h);
		rep(i,h){
			rep(j,w){
				vv[i][j]=1;
			}
		}
		rep(i,h) cin>>vs[i];
		bool flag=true;
		while(vv[pos.F][pos.S]){
			// cout<<vs[pos.F][pos.S]<<endl;
			vv[pos.F][pos.S]=0;
			int x=pos.F,y=pos.S;
			if(vs[x][y]=='.'){
				cout<<y<<" "<<x<<endl;
				flag=false;
				break;
			}
			if(vs[x][y]=='<') pos.S--;
			else if(vs[x][y]=='>') pos.S++;
			else if(vs[x][y]=='^') pos.F--;
			else pos.F++;
		}
		if(flag) cout<<"LOOP\n";
	}
	return 0;
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
#include<time.h>
typedef long long ll;
using namespace std;
int main()
{
    int n,flag=0;
    map<ll,ll>m;
    cin>>n;
    ll ara[n+5];
    for(int i=0;i<n;i++)
    {
        cin>>ara[i];
        m[ara[i]]++;
    }
    for(auto it=m.begin();it!=m.end();it++)
    {
        if((it->second)>1)
        {
            flag=1;
            break;
        }
    }
    if(flag)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 14336
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<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()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let K: usize = read();
    // Kが偶数の場合は a, b, cはK/2 の倍数
    //  その場合、K/2 + n * K の個数の3乗 + m * K の個数の3乗
    // Kが奇数の場合はa, b, cはKの倍数
    // Kの倍数の個数の3乗
    let ans = if K % 2 == 0 {
        let count_1 = N / K;
        let count_2 = (N + K / 2) / K;
        count_1.pow(3) + count_2.pow(3)
    } else {
        let count = N / K;
        count.pow(3)
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    ll n,k;cin>>n>>k;
    if(n%k==0)cout<<0;
    else {
        ll rem=n%k;
        ll x=(k*(n/k+1))-n;
        cout<<min(rem,x);
    }
    return 0;  
} 





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

typedef pair<int, int> P;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define ALL(x) x.begin(), x.end()

int main() {
#ifdef LOCAL
    std::ifstream in("../arg.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

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

    vector<P> D;
    REP(i, M){
        int a,b;
        cin >> a >> b;
        D.emplace_back(P(a,b));
    }
    D.emplace_back(P(N,N));
    sort(ALL(D));

    int ans = 0;
    int tmp = N + 1;
    for (auto p: D){
        if (tmp <= p.first) {
            ans++;
            tmp = p.second;
        } else {
            tmp = min(tmp, p.second);
        }
    }

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




Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cassert>
#include <random>
#include <time.h>
#define fi first
#define se second
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define re return
#define mp make_pair

using namespace std;

typedef long long ll;

const double pi = 3.14159265;
const ll mod = 1e9 + 7;
const ll N = 1e3 + 5;
const int OMG = 9e6 + 5;
const ll P0 = 281;
const ll P1 = 257;

int h, n, a[N], b[N], was[10005];

int din (int kol)
{
    if(kol <= 0)
        return 0;
    if(was[kol])
        return was[kol];
    int an = mod;
    for (int i = 0; i < n; i++)
        an = min(an, b[i] + din(kol - a[i]));
    was[kol] = an;
    return an;
}

int main()
{
    //freopen("ladder.in ", "r", stdin);
    //freopen("OMOMOMMG.txt", "w", stdout);
    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> h >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    cout << din(h);

}




Measured memory_bytes: 768
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	ll n, k;
	cin >> n >> k;
	ll answer = 0;

	for (ll b = k + 1; b <= n; b++) {
		
		//for (ll a = k; a <= k + b -1;a++)
		//{
		//	if (a%b >= k) {
		//		ll num;
		//		num = (n - a) / b + 1;
		//		if (a == 0) {
		//			num--;
		//		}
		//		answer += num;
		//	}
		//}
		
		ll mod = n%b;
		ll add = (n + 1) / b*(b - k);
		if ((n+1)%b > k) {
			add += (n+1)%b- k;
		}
		if (k == 0) {
			add--;
		}
		
		answer += add;
	}
	cout << answer << endl;

	return 0;
}

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

int main() {
  while(1) {
    string str;
    int m;
    cin >> str;
    if(str == "-") break;
    cin >> m;
    
    rep(i, m) {
      int h;
      cin >> h;
      str = str.substr(h) + str.substr(0, h);
    }

    cout << str << endl;
  }
  return 0;
}



Measured memory_bytes: 3144
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            Println(ReadInt() % 500 <= ReadInt() ? "Yes" : "No");
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
double dp[301][301][301];
double solve(int x,int y,int z,int &n){
	if(x<0||y<0||z<0){
		return 433;
	}
	if(x==0&&y==0&&z==0){
		return 0;
	}
	if(dp[x][y][z]>-0.9){
		return dp[x][y][z];
	}
	
	double exp = n+x*(solve(x-1,y,z,n))+y*solve(x+1,y-1,z,n)+z*solve(x,y+1,z-1,n);
	
	return dp[x][y][z]=exp/(x+y+z);
	
}
int main(){
	int n;
	cin>>n;
	int ar[n];
	memset(dp,-1,sizeof dp);
	int one=0,two=0,three=0;
	for(int i=0;i<n;i++){
		cin>>ar[i];
		if(ar[i]==1){
			one++;
		}
		else if(ar[i]==2){
			two++;
		}
		else{
			three++;
		}
	}

	cout<<fixed<<setprecision(15)<<solve(one,two,three,n)<<endl;
	return 0;
}

Measured memory_bytes: 213376
#include<bits/stdc++.h>
using namespace std;
int a[5];
int main()
{
    int x,y;
    cin>>x>>y;a[x]++;a[y]++;
    cin>>x>>y;a[x]++;a[y]++;
    cin>>x>>y;a[x]++;a[y]++;
    bool flag=true;
    for(int i=1;i<=4;i++) if(a[i]>=3) flag=false;
    if(flag) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll water_A, water_B, suger_C, suger_D, E, F;
  cin >> water_A >> water_B >> suger_C >> suger_D >> E >> F;
  water_A *= 100;
  water_B *= 100;

  ld max_nodo = -1;
  ll max_water = 0;
  ll max_suger = 0;
  rep(a, 31) {
    if (a > F) continue;
    ll A = a * water_A;
    ll b_max = F - A;
    rep(b, b_max + 1) {
      ll B = b * water_B;
      ll c_max = F - (A + B);
      rep(c, c_max + 1) {
        ll C = c * suger_C;
        ll d_max = min(F - (A + B + C), (A + B) / 100 * E - C);
        rep(d, d_max + 1) {
          ll D = d * suger_D;
          if ((A + B + C + D) <= F && (A + B) / 100 * E >= C + D) {
            ld node = (ld)(C + D) / (ld)(A + B);
            if (max_nodo < node) {
              max_nodo = node;
              max_water = A + B;
              max_suger = C + D;
            }
          }
        }
      }
    }
  }

  cout << max_water + max_suger << " " << max_suger << endl;

  return 0;
}

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

int main() {
    int c[3][3] = {0};
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }

    bool flag = true;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            if (c[j][i] - c[j][i + 1] == c[j + 1][i] - c[j + 1][i + 1]) {
                continue;
            }
            else {
                flag = false;
                break;
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	ll h,n;
	cin>>h>>n;
	ll a[n+1];
	ll sum=0;
	rp(i,1,n){
		cin>>a[i];sum+=a[i];
	}
	if(sum>=h)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0; 
}/*『你强归你强，Siyuan比你强』*/





Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define ALL(co) co.begin(), co.end()

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef vector<int> Array;
typedef vector<vector<int> > Array2;
typedef vector<int> LArray;

const int INF = 1 << 29;
const LL LINF = 1LL << 60;

int itiv;
inline int getInt() { return (cin >> itiv, itiv); }
void readAll(Array& vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; }
inline bool between(int first, int last, int n) { return first <= n && n <= last; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }

int m, n;
int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
int dr[] = { 0, -1, 0, 1 }, dc[] = { -1, 0, 1, 0 };


int main(void)
{
	n = 0;
	for (int i = 0; i < 5; i++)
	{
		n += max(getInt(), 40);
	}
	cout << n / 5 << endl;
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
const int MOD = (int)1e9 + 7;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()

int main(int argc, char const *argv[]) {
  int N, K;
  cin >> N >> K;
  vector<ll> x(N);
  REP(i, N) { cin >> x[i]; }
  vector<ll> len;
  REP(i, N - K + 1) {
    len.push_back(abs(x[i] - x[i + K - 1]) + min(abs(x[i]), abs(x[i + K - 1])));
  }
  sort(ALL(len));
  cout << len[0] << endl;

  return 0;
}


Measured memory_bytes: 1660
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
        int size = 0, count = 0, inter_value = 0;
        double x[1000], y[1000], diff[1000];
        double d = 0, max = 0;

        //x, y$NCM$r$=$l$>$l5a$a$k
        scanf("%d", &size);
        while ( count < size )
        {
                scanf("%lf", &x[count]);
                count = count + 1;
        }
        count = 0;
        while ( count < size )
        {
                scanf("%lf", &y[count]);
                count = count + 1;
        }

        //%^%s%O%C%?%s5wN%$r5a$a$k
        count = 0;
        while ( count < size )
        {
                diff[count] = fabs( x[count] - y[count] );
                d = d + diff[count];
                if ( diff[count] > max ) //F1;~$K:GBgCM$b5a$a$k
                {
                        max = diff[count];
                }
                count = count + 1;
        }
        printf("%f\n", d);

        //%f!<%/%j%C%I5wN%$r5a$a$k
        count = 0;
        d = 0;
        while ( count < size )
        {
                d = d + pow( diff[count], 2 );
                count = count + 1;
        }
        printf("%f\n", sqrt( d ));

        count = 0;
        d = 0;
        while ( count < size )
        {
                d = d + pow( diff[count], 3 );
                count = count + 1;
        }
        printf("%f\n", cbrt( d ));

        printf("%f\n", max);

        return 0;
}

Measured memory_bytes: 748
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int sum = 0;
    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        sum += (y-x+1);
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
K = int(input())

def S(N):
    tmp = 0
    while N:
        N, m = divmod(N, 10)
        tmp += m
    return tmp

def com(a, b):
    return a*S(b) <= b*S(a)

tmp = ""
count = 0

i = 1
while count < K:
    if com(int(str(i)+tmp), int(str(i+1)+tmp)):
        print(int(str(i)+tmp))
        count += 1
        i += 1
    else:
        i //= 10
        tmp += "9"

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  cin >> n;

  int a[110][110] = {};
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      a[i][j + 1] += a[i][j];
    }
  }
  for (int j = 0; j <= n; j++) {
    for (int i = 0; i <= n; i++) {
      a[i + 1][j] += a[i][j];
    }
  }
  int ans = INT_MIN;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = i + 1; k <= n; k++) {
        for (int l = j + 1; l <= n; l++) {
          ans = max(ans, a[i][j] + a[k][l] - a[i][l] - a[k][j]);
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3272
r, g, b, N = map(int, input().split())
rr = N//r
ans = 0
for i in range(0,rr+1):
    gg = (N-r*i)//g
    for j in range(0,gg+1):
        if (N-i*r-j*g)%b==0:
            ans += 1
print(ans)

                

Measured memory_bytes: 3060
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define maxn 10004
#define mod 1000000007
#include <bits/stdc++.h>
using namespace std;




int main() {
    int tc = 1;
    while(tc--){
        int a, b, c;
        cin >> a >> b >> c;
        cout << c << " "<< a <<  " "<< b << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Text.Printf
import Test.HUnit

main :: IO ()
-- main = runTestTT (TestList tests) >> return ()
main = do
  n <- getl toInt
  xs <- rgetl n toInt
  mapM_ solve (zip [1..] xs)

solve :: (Int,Int) -> IO ()
solve (i,j) = do
  let xs = take 10 . tail $ iterate msm j
  printf "Case %d:\n" i
  mapM_ print xs

msm :: Int -> Int
msm n = let n2 = n ^ 2 in n2 `div` 100 `mod` 10000

toInt :: String -> Int
toInt s = read s

getl :: (String -> a) -> IO a
getl f = f <$> getLine

rgetl :: Int -> (String -> a) -> IO [a]
rgetl n f = map f <$> replicateM n getLine

tests :: [Test]
tests = [
  "test1" ~: 151 ~=? msm 123,
  "test2" ~: 228 ~=? msm 151,
  "test3" ~: 7725 ~=? msm 9888
  ]

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

int main(){
    int n;
    cin>>n;
    vector<ll>a(n);
    ll m=INF;
    ll sum=0;
    ll c=0;
    bool ch=false;
    rep(i,0,n){
        ll aa;
        cin>>aa;
        if(aa<0)c++;
        if(aa==0)ch=true;
        a.at(i)=abs(aa);
        sum+=a.at(i);
        m=min(m,a.at(i));
    }
    //cout<<ch<<c%2<<endl;
    if(ch or c%2==0)cout<<sum<<endl;
    else{
        cout<<sum-2*m<<endl;
    }
return 0;
}


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

int main(){
    long int a,max,min;
    long int sum=0;
    cin>>a;
    int x[a];
    
    for(int i=0;i<a;i++){
        cin>>x[i];
    }
    max=x[0];
    min=x[0];

    for(int i=0;i<a;i++){
        if(max<x[i]){
            max=x[i];
        }
        
    }
    for(int i=0;i<a;i++){
        if(min>x[i]){
            min=x[i];
        }
    }
    for(int i=0;i<a;i++){
        sum=sum+x[i];
    }
    cout<<min<< " "<<max<<" "<<sum<<endl;

    return 0;
}



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

signed main(){
	lint A, B, C, D;
  cin >> A>> B >> C>> D;
  lint x, y;
  if(C % B == 0) x = C /B;
  else x =C/B + 1;
  if(A % D == 0) y = A/D;
  else y = A/D + 1;
  if(x > y) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void){
	int a;
	int i;
	int min=100000,sum=0;
	for(i=0;i<3;i++){
		scanf("%d",&a);
		if(a<min) min=a;
	}
	sum=min;
	for(i=0;i<2;i++){
		scanf("%d",&a);
		if(a<min) min=a;
	}
	sum+=min-50;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 592
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val a = (1.. 3 * n).map { sc.nextLong() }.toLongArray()

  val aa = a.sorted()
  val ans = mutableListOf<Long>()

  var case1 = 0L
  for (i in 0 until n) {
    case1 += aa[i + n]
  }
  ans.add(case1)

  var case2 = aa[n - 2]
  ans.add(case2)

  var case3 = 0L
  for (i in 0 until n) {
    val index = (3 * n - 1) - (2 * i + 1)
    case3 += aa[index]
  }
  ans.add(case3)

  println(ans.max())
}

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

int n;
int data[8][8];
bool flag;
struct A{
  bool visited[8][8];
};

void rec(A);
void rec2(int, int, int, int, A);

void print(A a) {
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(a.visited[i][j]) cout << '#';
      else cout << ' ';
    }
    cout << endl;
  }
  cout << endl;
}

void rec(A a) {
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(!a.visited[i][j] && data[i][j] < 0) {
	a.visited[i][j] = true;
	rec2(j, i, -data[i][j], 0, a);
	return;
      }
    }
  }
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(!a.visited[i][j]) return;
    }
  }
  flag = true;
}

void rec2(int x, int y, int cost, int sum, A a) {
  static int d[4][2] = {{1,0}, {0,1}, {-1,0}, {0,-1}};
  if(sum == cost) {rec(a);return;}
  if(sum > cost) return;

  for(int i = 0; i < 4; i++) {
    int nx = x + d[i][0];
    int ny = y + d[i][1];
    if(nx < 0 || nx >= n) continue;
    if(ny < 0 || ny >= n) continue;
    if(a.visited[ny][nx]) continue;
    if(data[ny][nx] < 0) continue;

    a.visited[ny][nx] = true;
    rec2(nx, ny, cost, sum+data[ny][nx], a);
    a.visited[ny][nx] = false;
  }
}

int main() {
  while(1) {
    cin >> n;
    if(n == 0) break;
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
	cin >> data[i][j];
      }
    }
    A a;
    for(int i = 0; i < 8; i++) {
      for(int j = 0; j < 8; j++) {
	a.visited[i][j] = false;
      }
    }
    flag = false;
    rec(a);
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 876
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <iterator>

using namespace std;

#if 1
#define PRINT(x) { cout << #x << ": " << (x) << endl; }
#define PRINT_CONTAINER(x)  { cout << #x << ": ";                       \
        for (size_t ix = 0; ix < (x).size(); ++ix) cout << (x)[ix] << ", "; \
        cout << endl; }
#else
#define PRINT(x)
#define PRINT_CONTAINER(x)
#endif

int main(int argc, char *argv[])
{
    int m;
    scanf("%d", &m);
    printf("%d\n", 48 - m);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define FOR(a, b, c) for (int (a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (int (a) = (c) - 1; (a) >= (b); --(a))
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))

int main() {
    int x;
    cin >> x;
    if (x == 1) {
        cout << 0 << endl;
    } else if (x == 0) {
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3588
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()


a, b, c = map(int, input().split())

if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


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

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let m1: usize = iter.next().unwrap().parse().unwrap();
    let d1: usize = iter.next().unwrap().parse().unwrap();
    let m2: usize = iter.next().unwrap().parse().unwrap();
    let d2: usize = iter.next().unwrap().parse().unwrap();

    println!("{}", if d1 >= d2 { "1" } else { "0 "});
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            if(a > b)
            {
                Console.WriteLine(a - 1);
            }
            else
            {
                Console.WriteLine(a);
            }
            
        }

    }
}


Measured memory_bytes: 13140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int k = in.nextInt();
			List<Integer> list = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				list.add(in.nextInt());
			}
			long ans = 0;
			for (int i = 0; i < n - 1;) {
				ans++;
				i += k - 1;
			}
			out.println(ans);
		}
	}

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

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

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

		public char nextChar() {
			return next().charAt(0);
		}

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

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


Measured memory_bytes: 37144
loop do
  price = gets.chomp.to_i
  break if price == 0
  change = 1000 - price
  coins = [500, 100, 50, 10, 5, 1]
  coin_num = 0

  coins.each do |coin|
    coin_num += change / coin
    change = change % coin
  end

  puts coin_num
end

Measured memory_bytes: 6084
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, A[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	sort(A, A + N, greater<int>());

	ll ans = A[0];
	rep(i, 0, N - 2) ans += 1LL * A[i / 2 + 1];
	cout << ans << endl;
}







Measured memory_bytes: 4404
n,k = list(map(int,input().split()))
r,s,p = list(map(int,input().split()))
t = str(input())

t_list = []

for i in range(k):
  t_list.append(t[i])

for i in range(k,n):
  if t[i] != t_list[i-k] or t_list[i-k] == 'all':
    t_list.append(t[i])
  else:
    t_list.append('all')

print(t_list.count('r') * p + t_list.count('s') * r + t_list.count('p') * s)


Measured memory_bytes: 9872
from operator import itemgetter

n, k = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
a.sort(key=itemgetter(0))
m = 0

for i in range(n):
    m += a[i][1]
    if k <= m:
        print(a[i][0])
        break


Measured memory_bytes: 29096
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class BGoldenCoins {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int x = s.nextInt(), f500 = (x / 500);
            x -= f500 * 500;
            int ans = (x / 5) * 5 + f500 * 1000;
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22996
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    a.append(a);
    if(a.find(b)!=string::npos)puts("Yes");
    else puts("No");
    return 0;
}
/*
    ¿ìËÙÅÅÐòÄ£°å
*/


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	char a[5],b[5];
	scanf("%s",a);
	scanf("%s",b);
	if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
N = int(input())
H = list(map(int, input().split()))
ans = 0
a = 0
for i in range(N - 1):
  if H[i] >= H[i+1]:
    a += 1
  else:
    ans = max(ans, a)
    a = 0
else:
  ans = max(ans, a)
print(ans)

Measured memory_bytes: 20592
N, M = gets.split.map(&:to_i)
B = Array.new(N + 1,0)
ans = M.times.find do  
  u, v = gets.split.map(&:to_i)
  B[v] += 1 if u == 1
  B[u] += 1 if v == N
  B[v] == 2 || B[u] == 2
end
puts ans ? "POSSIBLE" :  "IMPOSSIBLE"


Measured memory_bytes: 3324
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderD
{
    static void Main()
    {
        double a;
        double b;
        double x;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            a = double.Parse(words[0]);
            b = double.Parse(words[1]);
            x = double.Parse(words[2]);
        }

        double answer = 0;
        if (2 * x >= a * a * b)
        {
            double c = (a * a * b - x) / (a * a) * 2;
            double tan = c / a;
            answer = Math.Atan(tan);
            answer = answer * (180 / Math.PI);
        }
        else
        {
            double c = x / (a * b) * 2;
            double tan = c / b;
            answer = Math.Atan(tan);
            answer = answer * (180 / Math.PI);
            answer = 90 - answer;
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}

// cf IO: I64d
// atcoder IO: ｌｌｄ
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int Maxn=100005;
int a[Maxn];
int Mx[Maxn];
int main(){
	int n,t;
	scanf("%d %d",&n,&t);
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for (int i=n-1;i>=0;i--){
		Mx[i]=max(Mx[i+1],a[i]);
	}
	int Mxx=0,tot=0;
	for (int i=0;i<n;i++){
		if (Mx[i+1]-a[i]>Mxx){
			Mxx=Mx[i+1]-a[i];
			tot=1;
		}
		else if (Mx[i+1]-a[i]==Mxx){
			tot++;
		}
	}
	printf("%d\n",tot);
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace __gnu_pbds;

#define int long long
#pragma GCC optimize ("O3")
#define ll long long
#define vi vector <int>
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define maa 1000000007
#define Eps 1e-9
#define PI 3.14159265359

typedef tree<int,null_type,less <int>,rb_tree_tag,tree_order_statistics_node_update>ind_set;
///*X.find_by_order("index")
///X.order_of_key("key")

///----------------------------------------------------------------------------------

int n;
string a;
int ct[26];
void solve()
{
    cin>>n>>a;

    memset(ct,0,sizeof ct);
    rep(i,0,n)ct[a[i]-'a']++;
    int ans=1;
    rep(i,0,26)
    {
        ans*=(ct[i]+1);ans%=maa;
    }cout<<ans-1<<"\n";

}
signed main()
{
    //ios_base::sync_with_stdio(false);cin.tie(NULL);

///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);

    int t=1;
///cin>>t;
    rep(a,0,t)
    {
        ///cout<<"Case "<<a+1<<": ";
        solve();
    }
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

struct plot {
    string era;
    int y_era;
    int y_westan;
};

int main(){
    int n, q;
    while (cin >> n >> q && n | q)
    {
        vector<plot> input(n);
        for (int i = 0; i < n; i++)
        {
            string era;
            int y_era, y_west;
            cin >> era >> y_era >> y_west;
            input[i] = { era, y_era, y_west };
        }
        sort(input.begin(), input.end(), [](const plot& a, const plot& b){
            return a.y_westan < b.y_westan;
        });
        for (int i = 0; i < q; i++)
        {
            int y; cin >> y;
            int j = 0;
            while (j < n && y > input[j].y_westan) j++;
            // cout << j << endl;
            if (j < n && y - input[j].y_westan + input[j].y_era > 0){
                cout << input[j].era << " " << y - input[j].y_westan + input[j].y_era << endl;
            }
            else{
                cout << "Unknown" << endl;
            }
        }
    }
}

Measured memory_bytes: 1284
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  string ans;
  if(S[0]==S[S.size()-1]) {
    if(S.size()%2==0) ans = "First";
    else ans = "Second";
  }
  else {
    if(S.size()%2==0) ans = "Second";
    else ans = "First";
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3764
#include <iostream>
#include <math.h>

int tamesi(long long n,long long a,long long b,long long h[],long long ans);

int main(){
  
  long long n,a,b;
 
  scanf("%lld%lld%lld",&n,&a,&b);
  
  long long h[n];
  
  for(int i=0;i<n;i++){
    scanf("%lld",&h[i]);
  }
 
  long long ans=0;

  while(tamesi(n,a,b,h,ans)==0){
    ans+=100000000;
  }
  ans-=100000000;
  while(tamesi(n,a,b,h,ans)==0){
    ans+=10000000;
  }
  ans-=10000000;
  while(tamesi(n,a,b,h,ans)==0){
    ans+=1000000;
  }
  ans-=1000000;
  while(tamesi(n,a,b,h,ans)==0){
    ans+=100000;
  }
  ans-=100000;
  while(tamesi(n,a,b,h,ans)==0){
    ans+=10000;
  }
  ans-=10000;

  while(tamesi(n,a,b,h,ans)==0){
    ans+=1000;
  }
  ans-=1000;
  while(tamesi(n,a,b,h,ans)==0){
    ans+=100;
  }
  ans-=100;

   while(tamesi(n,a,b,h,ans)==0){
    ans+=10;
  }
  ans-=10;

   while(tamesi(n,a,b,h,ans)==0){
    ans+=1;
  }
 

  printf("%lld\n",ans);

  
  
  return 0;
}

int tamesi(long long n,long long a,long long b,long long h[],long long ans){
  long long kari=0;
  long long z[n];
  
  for(long long i=0;i<n;i++){
    z[i]=h[i];
    z[i]=z[i]-ans*b;
    if(z[i]<=0){z[i]=0;}
    kari+=ceil(z[i]*1.0/(a-b)*1.0);
      }
 
  if(kari<=ans){return 1;}
  else{return 0;}
}

  


Measured memory_bytes: 1792
//package atcoder_edu_dp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong()
        {
            return Long.parseLong(next());
        }

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
/*
dp[node] = 1+dp[inc_edgeNode]
 */
    public static void topoSort(int node,LinkedList<Integer>[] adj,boolean[] visited,Stack<Integer> topo){
        visited[node] = true;
        for(int nei : adj[node]){
            if(!visited[nei])
                topoSort(nei,adj,visited,topo);
        }
        topo.push(node);

    }
    public static void main(String[] args)
    {
        FastReader sc=new FastReader();
        int n = sc.nextInt();
        int m = sc.nextInt();
        @SuppressWarnings("unchecked") LinkedList<Integer>[] inc_edgeNodeList = new LinkedList[n+1];
        @SuppressWarnings("unchecked") LinkedList<Integer>[] adj = new LinkedList[n+1];
        for(int i=0;i<=n;i++){
            inc_edgeNodeList[i] = new LinkedList<Integer>();
            adj[i] = new LinkedList<Integer>();
        }
        for(int i=0;i<m;i++){
            int from = sc.nextInt();
            int to = sc.nextInt();
            adj[from].add(to);
            inc_edgeNodeList[to].add(from);
        }
        //topo sort
        Stack<Integer> topo = new Stack<>();
        boolean[] visited = new boolean[n+1];
        for(int i=1;i<=n;i++){
            if(!visited[i]){
                topoSort(i,adj,visited,topo);
            }
        }
        int[] dp = new int[n+1];
        int res = Integer.MIN_VALUE;
        while(!topo.isEmpty()){
            int node = topo.pop();
            for(int inc_edgeNode : inc_edgeNodeList[node]){
                dp[node] = Math.max(1+dp[inc_edgeNode],dp[node]);
            }
            res = Math.max(res,dp[node]);
        }

        System.out.println(res);
    }
}

Measured memory_bytes: 66476