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

namespace Distance_II
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();                   
            var a = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
            var b = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
            var c = new double[a.Length];
            for(int i = 0; i < a.Length; i++)
                c[i] = Math.Abs(a[i] - b[i]);
            for(int j = 1; j < 4; j++)
                Console.WriteLine("{0}", Math.Pow(c.Select(e => Math.Pow(e, j)).Sum(), 1.0 / j));      
            Console.WriteLine("{0}", c.Max());
        }
    }
} 

Measured memory_bytes: 9920
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

fn main() {
    let mut scan = Scan::new();

    let N = scan.word::<usize>();
    let K = scan.word::<usize>();
    let mut A = scan.list::<i64>(N);

    A.push(0);
    let mut next = vec![];

    for _ in 0..K {
        next.clear();
        next.resize(N + 1, 0);

        for i in 0..N {
            let l = ((i as i64) - A[i]).max(0) as usize;
            let r = ((i as i64) + A[i] + 1).min(N as i64) as usize;
            next[l] += 1_i64;
            next[r] -= 1;
        }

        let mut m = next[0];
        for i in 0..N {
            next[i + 1] += next[i];
            m = m.min(next[i]);
        }

        std::mem::swap(&mut A, &mut next);

        if m == N as i64 {
            break;
        }
    }

    println!(
        "{}",
        A[..N]
            .iter()
            .map(|&a| a.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    )
}


Measured memory_bytes: 20056
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define M 1000005
using namespace std;
int nxt[M],head[M],to[M],tot,n;
int read(){
	char c=getchar();int ans=0; 
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') ans=(ans<<1)+(ans<<3)+(c^48),c=getchar();
	return ans; 
}
void add(int u,int v){nxt[++tot]=head[u];head[u]=tot;to[tot]=v;return;}
int DFS(int x,int fa){
	int ans=0;
	for (register int i=head[x];i;i=nxt[i])
		if (to[i]!=fa) ans^=(DFS(to[i],x)+1);
	return ans;
}
int main(){
	n=read();
	for (register int i=1,u,v;i<n;i++) u=read(),v=read(),add(u,v),add(v,u);
	printf("%s",DFS(1,0)?"Alice":"Bob");
	return 0;
}


Measured memory_bytes: 13952
const main = (standardInput) => {
    const List = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
	const K = standardInput;
    console.log(List[K-1]);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

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

using namespace std;
using ll = long long int;

int main() {
	ll n;
	cin>>n;
	map<ll,ll> cnt;
	ll sum = 0;
	for(ll i = 0; i < n; i++) {
		ll x;
		cin>>x;
		sum += x;
		cnt[x]++;
	}
	ll q;
	cin>>q;
	for(ll i = 0; i < q; i++) {
		ll b, c;
		cin>>b>>c;
		ll tsum = sum - b*(cnt[b]) + c*(cnt[b]);
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout<<tsum<<endl;
		sum = tsum;
	}
}
	


Measured memory_bytes: 9548
#include<set>
#include<cstdio> 
#include<cstring> 
#include<cmath> 
#include<algorithm> 
#include<ctime> 
#include<bits/stdc++.h>
using namespace std; 
#define pi  acos(-1)
#define ll int
#define For(i,x,y)  for(ll i=x;i<=y;++i) 
#define FOr(i,x,y)  for(ll i=x;i>=y;--i) 
#define rep(i,x,y)	for(ll i=x;i<y;++i)
ll read(){  ll x=0,f=1; char ch=getchar();  for(;ch<'0'||ch>'9';ch=getchar()) if (ch=='-')    f=-1;   for(;ch>='0'&&ch<='9';ch=getchar())   x=x*10+ch-'0';  return x*f; } 
void write(ll x){   if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  } 
void writeln(ll x){ write(x);   puts("");   }
const ll N=500010;
struct data{	ll x,y;	}p[N];
ll c[N],x1,ya,x2,y2,ans,n,b[N];
void add(ll x,ll v){	for(;x<=n;x+=x&-x)	c[x]=max(c[x],v);	}
ll ask(ll x){	ll ans=-1e9;	for(;x;x-=x&-x)	ans=max(ans,c[x]);	return ans;	}
bool cmp(data a,data b){	return a.x==b.x?a.y<b.y:a.x<b.x;	}
int main(){
	memset(c,-60,sizeof c);
	x1=read();	ya=read();	x2=read();	y2=read();
	n=read();	For(i,1,n)	p[i].x=read(),p[i].y=read();
	if (x1>x2){	x1=-x1;	x2=-x2;	For(i,1,n)	p[i].x=-p[i].x;	}
	if (ya>y2){	ya=-ya;	y2=-y2;	For(i,1,n)	p[i].y=-p[i].y;	}
	p[++n]=(data){x1,ya};	p[++n]=(data){x2,y2};
	For(i,1,n)	b[i]=p[i].y;	sort(b+1,b+n+1);
	ll Y1=lower_bound(b+1,b+n+1,ya)-b,Y2=lower_bound(b+1,b+n+1,y2)-b;
	For(i,1,n)	p[i].y=lower_bound(b+1,b+n+1,p[i].y)-b;
	ll ans=0;
	sort(p+1,p+n+1,cmp);
	For(i,1,n){
		ll lis=ask(p[i].y)+1;
		if (p[i].x==x1&&p[i].y==Y1)	lis=0;
		else if (p[i].x==x2&&p[i].y==Y2)	ans=lis-1;
		add(p[i].y,lis);
	}
	printf("%.20lf",(x2-x1+y2-ya)*100.0+(pi-4)*5*ans+(ans==min(y2-ya+1,x2-x1+1)&&ans)*pi*5);
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)

int main()
{
	ll n,m; cin >> n >> m;
	map<ll,ll> mp;
	REP(i,n)
	{
		ll a; cin>>a;
		mp[a]++;
	}
	REP(i,m)
	{
		ll b,c;cin>>b>>c;
		mp[c]+=b;
	}
	ll sum = 0;
	ll idx = n;
	for( auto it = mp.end(); idx > 0; )
	{
		--it;
		sum += (*it).first * min( idx, (*it).second );
		idx -= (*it).second;
	}
	
	cout << sum;

	return 0;
}

Measured memory_bytes: 12800
let print_array l = Array.fold_left (fun x y -> (if x = "" then "" else x^" ")^(string_of_int y)) "" l
                   |> print_endline;;

let n = read_int ()  and
    a = read_line () |> Str.split (Str.regexp_string " ")
        |> List.map (fun x -> int_of_string x) |> Array.of_list in
    let rec loop l = function
        i when i = n -> print_array l;l
      | i -> print_array l;
             let key = l.(i) in
             let rec loop2 l2 = function
                 j when j < 0 || l2.(j) <= key -> l2.(j+1) <- key;l2
               | j -> l2.(j+1) <- l2.(j);
                      loop2 l2 (j-1)
             in loop (loop2 l (i-1)) (i+1)
    in loop a 1;;

Measured memory_bytes: 4288
import math

n = int(input())
n -= 1
c = [0 for i in range(n)]
s = [0 for i in range(n)]
f = [0 for i in range(n)]
for i in range(n):
    c[i], s[i], f[i] = [int(i) for i in input().split()]


def nextArriveTime(station, start):
    """
    print("start:{} depart:{} arrive:{}"
          .format(start,
                  s[station] + math.ceil((start - s[station]) / f[station]) * f[station],
                  s[station] + math.ceil((start - s[station]) / f[station]) * f[station] + c[i]))
    """
    # print("kf:{}".format(math.ceil((start - s[station]) / f[station]) * f[station]))
    return s[station] \
           + max(0, math.ceil((start - s[station]) / f[station])) * f[station] \
           + c[station]

for i in range(n):
    time = s[i]
    for j in range(i, n):
        time = nextArriveTime(j, time)
        # print("{}->{}:{}".format(j, j+1, nextArriveTime(j, time)))
    print(time)
print(0)


Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n;
  int a[SIZE],b[SIZE];

  scanf("%d",&n);

  for(int i=0;i<n;i++) scanf("%d",a+i);
  for(int i=0;i<n;i++) scanf("%d",b+i);

  int t = 1;
  int ans = 0;
  
  for(int i=0;i<30;i++){
    vector<int> vec[2];
    int counter = 0;

    for(int j=0;j<n;j++){
      bool p = !!(t & a[j]);
      vec[p].push_back(a[j]%t);
    }

    sort(vec[0].begin(),vec[0].end());
    sort(vec[1].begin(),vec[1].end());
    
    for(int j=0;j<n;j++){
      bool p = !!(t & b[j]);

      int q1 = lower_bound(vec[p].begin(),  vec[p].end(),  t - b[j]%t) - vec[p].begin();
      int q2 = lower_bound(vec[!p].begin(), vec[!p].end(), t - b[j]%t) - vec[!p].begin();
      
      counter += (vec[p].size() - q1 + q2)%2;
    }
    
    ans += counter%2 * t;
    t *= 2;
  }


  printf("%d\n",ans);
  
  return 0;
}



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

int main() {
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    h = min(h, 2 * q);
    s = min(s, 2 * h);

    ll ans;
    if (2 * s <= d)
        ans = n * s;
    else
        ans = n / 2 * d + (n % 2) * s;

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


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

int main() {
	ios::sync_with_stdio(false);
	int N;
	while (cin >> N, N) {
		bool na = true;
		int k, res = 1;
		for (int i=0; i<N; ++i) {
			cin >> k;
			if (0 < k) ++ res;
			if (na && 2 <= k) na = false;
		}
		if (na) {
			cout << "NA" << endl;
		} else {
			cout << res << endl;
		}
	}
	return 0;
}

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

int main() {
	long int n;
	cin>>n;
	long long int a[n];
	long long int ans=1LL,ans1=1LL;
	for(long int i=0;i<n;i++)
	{
	    cin>>a[i];
	}
	sort(a,a+n);
	if(a[0]==0)
	cout<<"0"<<endl;
	else
	{
	    long long int ans=1;
	    long long int kk=1e18;
	    bool pp=0;
	    for(long int i=0;i<n;i++)
	    {
	        if(kk/ans>=a[i])
	        {
	            ans=(ans*a[i]);
	        }
	        else
	        pp=1;
	    }
	    if(pp)
	    cout<<"-1"<<endl;
	    else
	    cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 4420
#include<iostream>
using namespace std;
long long t, n, ng,syu,zen;
int i;
int main()
{
	cin >> n >> t >> ng;
	syu = 0;
	zen = 0;
	for (i = 1; i < n; i++)
	{
		cin >> ng;
		if (ng - zen < t)
		{
			syu += ng - zen;
		}
		else
		{
			syu += t;
		}
		zen = ng;
	}
	syu += t;
	cout << syu << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long 

using namespace std;

llint N;
llint A[100005];

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++) cin >> A[i];
	
	llint ans = 0, cnt = 0;
	for(int i = 0; i < N; i++){
		if(A[i] == 0) cnt = 0;
		else{
			cnt += A[i];
			ans += cnt/2;
			cnt %= 2;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N; cin >> N;
    int A[100100]; rep(i, N) cin >> A[i];
    int ans = 1;
    int sig = 0;
    rep1(i, N - 1) {
        if(A[i - 1] < A[i]) {
            if(sig == -1) {
                ans ++;
                sig = 0;
            }
            else sig = 1;
        }
        if(A[i - 1] > A[i]) {
            if(sig == 1) {
                ans ++;
                sig = 0;
            }
            else sig = -1;
        }
    }
    cout << ans << endl;
	return 0;
}

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

typedef long long i64;

const int MAXN = 2000 + 5;
const int MOD = 1e9 + 7;

int N, K;
i64 fact[MAXN * MAXN], inverse[MAXN * MAXN];
i64 DP[MAXN][MAXN];

i64 modularExp(i64 base, i64 exp)
{
	i64 ret = 1;
	while (exp)
	{
		if (exp & 1)
			ret = ret * base % MOD;
		base = base * base % MOD;
		exp = exp >> 1;
	}
	return ret;
}

void prepare()
{
	fact[0] = 1;
	for (int i = 1; i < MAXN * MAXN; i++)
		fact[i] = fact[i - 1] * i % MOD;

	inverse[MAXN * MAXN - 1] = modularExp(fact[MAXN * MAXN - 1], MOD - 2) % MOD;
	for (int i = MAXN * MAXN - 2; i >= 0; i--)
		inverse[i] = inverse[i + 1] * (i + 1) % MOD;

	assert(inverse[1] == 1);
}

i64 getC(int n, int m)
{
	return fact[n] * inverse[m] % MOD * inverse[n - m] % MOD;
}

int main()
{
	prepare();
	cin >> N >> K;

	if(K == 1)
		cout << 1 << endl, exit(0);

	DP[0][0] = 1;
	for (int i = 0; i <= N; i++)
		for (int j = i; j <= N; j++)
		{
			DP[i][j + 1] = (DP[i][j + 1] + DP[i][j]) % MOD;
			DP[i + 1][j] = (DP[i][j] * getC(K * (N - i) - (j - i) - 1, K - 2)
					+ DP[i + 1][j]) % MOD;
		}
	cout << DP[N][N] * fact[N] % MOD << endl ;
	return 0;
}


Measured memory_bytes: 89600
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] a = sc.nextIntArray(n);
        int[] b = a.clone();
        Arrays.sort(b);
        int min = b[n/2-1];
        int max = b[n/2];
        for(int v : a){
            if(v <= min){
                System.out.println(max);
            }else{
                System.out.println(min);
            }
        }
        
    }
}

class Restaurant implements Comparable<Restaurant>{
    int p,i;
    String c;
    public Restaurant(int p,int i,String c){
        this.p = p;
        this.i = i;
        this.c = c;
    }
    
    public int compareTo(Restaurant r){
        if(this.c.compareTo(r.c) <= -1){
            return -1;
        }else if(this.c.compareTo(r.c) >= 1){
            return 1;
        }else{
            if(this.p > r.p){
                return -1;   
            }else if(this.p < r.p){
                return 1;
            }else{
                return 0;
            }
        }
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    } 
}


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

struct Edge {
	int to;
	int64_t dist{1};

	// int64_t cost;
	// int from;
	// int rev_i;
};

std::tuple<int, int, decltype(Edge::dist)> calcTreeDiameter(const std::vector<std::vector<Edge>>& edges)
{
	using Dist = decltype(Edge::dist);
	using pid = std::pair<int, Dist>;

	pid one_side{0, 0};
	std::stack<pid> dfs;
	dfs.push(one_side);
	std::vector<bool> visited(edges.size());

	while (!dfs.empty())
	{
		auto now{dfs.top()};
		dfs.pop();
		visited[now.first] = true;
		if (now.second > one_side.second)
			one_side = now;
		for (auto& e: edges[now.first])
			if (!visited[e.to])
				dfs.push({e.to, now.second + e.dist});
	}
	pid another_side{one_side.first, 0};
	dfs.push(another_side);
	std::fill(visited.begin(), visited.end(), false);
	while (!dfs.empty())
	{
		auto now{dfs.top()};
		dfs.pop();
		visited[now.first] = true;
		if (now.second > another_side.second)
			another_side = now;
		for (auto& e: edges[now.first])
			if (!visited[e.to])
				dfs.push({e.to, now.second + e.dist});
	}
	return std::make_tuple(one_side.first, another_side.first, another_side.second);
}

using ve = std::vector<Edge>;
using vve = std::vector<ve>;

vve graph;
void calcDist(int, std::vector<int64_t>&);

int main()
{
	int n;
	scanf("%d", &n);
	graph.resize(n);
	for (int i{}; i < n - 1; i++)
	{
		int s, t;
		int64_t w;
		scanf("%d%d%lld", &s, &t, &w);
		graph[s].push_back({t, w});
		graph[t].push_back({s, w});
	}
	auto dia{calcTreeDiameter(graph)};
	std::vector<int64_t> dist0(n, LLONG_MIN), dist1(n, LLONG_MIN);
	calcDist(std::get<0>(dia), dist0);
	calcDist(std::get<1>(dia), dist1);

	for (int i{}; i < n; i++)
		printf("%lld\n", std::max(dist0[i], dist1[i]));

	return 0;
}

void calcDist(int source, std::vector<int64_t>& dist)
{
	dist[source] = 0;
	std::stack<int> dfs;
	dfs.push(source);
	std::vector<bool> visited(dist.size());
	while (!dfs.empty())
	{
		auto now{dfs.top()};
		dfs.pop();
		visited[now] = true;
		for (auto& next: graph[now])
			if (!visited[next.to])
			{
				dist[next.to] = dist[now] + next.dist;
				dfs.push(next.to);
			}
	}
}


Measured memory_bytes: 4024
import sys
N = int(sys.stdin.readline())

testimonies = [[-1 for _ in range(N)] for _ in range(N)]
for i in range(N):
    A = int(sys.stdin.readline())
    for _ in range(A):
        x, y = map(int, sys.stdin.readline().rstrip().split())
        testimonies[i][x-1] = y

def check(honest_persons):
    flag = True
    for i in range(N):
        if honest_persons[i]:
            for j in range(N):
                if testimonies[i][j] == -1:
                    continue
                if testimonies[i][j] != honest_persons[j]:
                    flag = False
                    break
            else:
                continue
            break
    return flag

def main():
    ans = 0
    for i in range(1, 2**N):
        honest_persons = bin(i)[2:].zfill(N)
        honest_persons = list(map(int, list(honest_persons)))

        if check(honest_persons):
            ans = max(ans, sum(honest_persons))

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3192
#include <bits/stdc++.h> 
#include <atcoder/all>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
string Yes[2] = {"Yes", "No"};

using Graph = vector<vector<int>>;
Graph G;

/*------------------------------------------------------------------*/


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

    int k; cin >> k;
    string s = "";
    rep(i, k){
        s += "ACL";
    }
    cout << s << endl;

}


Measured memory_bytes: 3672
n,k = map(int,input().split())
lr = []
for _ in range(k):
  lr.append(list(map(int,input().split())))
#print(lr)
imos = [0 for _ in range(n)]
imos[0] = 1
imos[1] = -1
now = 0
mod = 998244353
for i in range(n):
    now += imos[i]
    now %= mod
    #print(now)
    for j in range(k):
        try:
            imos[i+lr[j][0]] += now
            imos[i+lr[j][0]] %= mod
        except:
            pass
        try:
            imos[i+lr[j][1]+1] -= now
            imos[i+lr[j][1]+1] %= mod
        except:
            pass
    #print(imos)
print(now)

Measured memory_bytes: 81132
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> cnt(N, 0);
  for (int i = 0; i < K; i++)
  {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      int a;
      cin >> a;
      a--;
      cnt[a]++;
    }
  }
  int ret = 0;
  for (auto c : cnt)
    if (c == 0)
      ret++;
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

int main() {
	std::vector<int> praize{ 300000, 200000, 100000 };
	int x, y; std::cin >> x >> y;
	if (x == 1 && y == 1) {
		std::cout << 300000 * 2 + 400000 << '\n';
	}
	else {
		auto p = 0;
		if (x <= 3) p += praize[--x];
		if (y <= 3) p += praize[--y];
		std::cout << p << '\n';
	}
}

Measured memory_bytes: 888
x,y,a,b,c=map(int,input().split())
la=input().split()
lb=input().split()
lc=input().split()
A=[]
B=[]
C=[]
for i in range(len(la)):
    A.append(int(la[i]))
for i in range(len(lb)):
    B.append(int(lb[i]))
for i in range(len(lc)):
    C.append(int(lc[i]))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
A=A[:x]
B=B[:y]
C=C[:c]
L=A+B+C
L.sort(reverse=True)
s=0
for i in range(x+y):
    s+=L[i]
print(s)

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    vector<int> cnt(n + 1, 0);
    int now = - 1;
    int tmp = 0;
    for (int i = 0; i < n; i++){
        if (a[i] != now){
            now = a[i];
            tmp = 1;
        }
        else tmp++;
        cnt[tmp]++;
    }
    vector<int> acc(n + 1, 0);
    for (int i = 1; i <= n; i++) acc[i] = acc[i - 1] + cnt[i];
    int ok = n;
    for (int i = 1; i <= n; i++){
        while(acc[ok] < (long long)ok * i) ok--;
        printf("%d\n", ok);
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin>>s;
    if(s=="SUN")
  {
    cout<<"7"<<endl;
  }
  else if(s=="MON")
  {
    cout<<"6"<<endl;
  }
  else if(s=="TUE")
  {
    cout<<"5"<<endl;
  }
  else if(s=="WED")
  {
    cout<<"4"<<endl;
  }
  else if(s=="THU")
  {
    cout<<"3"<<endl;
  }
  else if(s=="FRI")
  {
    cout<<"2"<<endl;
  }
  else if(s=="SAT")
  {
    cout<<"1"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int N = 1000000;
int n, a[200005];
long long res = 0, sum[N + 5];
// long long Count = 0;
vector<int> division_of[N + 5];

void initialize(){
	//for(int i = 1; i <= N; i++) division_of[i].push_back(1);
	for(int i = 1; i <= 1000; i++){
		for(int j = i * i; j <= N; j += i){
			// Count++;
			division_of[j].push_back(i);
			if(j != i * i) division_of[j].push_back(j / i);
		}
	}

}

void update(int cur_val){
	for(int i = 0; i < division_of[cur_val].size(); i++){
		sum[division_of[cur_val][i]] += cur_val;
		sum[division_of[cur_val][i]] %= MOD;
	}
}

long long fix_val(long long x){
	while(x < 0) x += MOD;
	return x;
}

void adding(long long cur_val){
	sort(division_of[cur_val].begin(), division_of[cur_val].end());
	// for(int i = 0; i < division_of[cur_val].size(); i++){
	// 	cout << division_of[cur_val][i] << " ";
	// }
	// cout << endl;
	long long only_div[N + 5];
	// cout << endl << "with the value of " << cur_val << " : " << endl;
	for(int i = division_of[cur_val].size() - 1; i >= 0; i--){
		// cout << "case of div = " << division_of[cur_val][i] << endl;
		only_div[division_of[cur_val][i]] = sum[division_of[cur_val][i]];
		for(int j = i + 1; j <= division_of[cur_val].size() - 1; j++){
			if(division_of[cur_val][j] % division_of[cur_val][i] == 0){
				only_div[division_of[cur_val][i]] -= only_div[division_of[cur_val][j]];
			}
			only_div[division_of[cur_val][i]] = fix_val(only_div[division_of[cur_val][i]]);
		}
		long long x = cur_val / division_of[cur_val][i] * only_div[division_of[cur_val][i]];
		x %= MOD;
		// cout << division_of[cur_val][i] << " -> " << x << endl;
		res = (res + x) % MOD;
	}
}

int main(){
	initialize();
	cin >> n;
	for(long long i = 1; i <= n; i++) cin >> a[i];
	update(a[1]);
	for(long long i = 2; i <= n; i++){
		adding(a[i]);
		update(a[i]);
	}
	cout << res % MOD;
	// cout << Count;
	return 0;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int sum = 0;
    rep(i, 0, n)if(s[i]=='#')sum++;
    vector<int>v(n+1);
    rep(i, 0, n){
        if(s[i] == '#')v[i+1]=v[i]+1;
        else v[i+1] = v[i];
    }
    int ans = 100100100;
    rep(i, 0, n+1){
        chmin(ans, v[i]+((n-i)-(sum-v[i])));
    }
    cout << ans << endl;
}

Measured memory_bytes: 4436
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  vector<vector<int>> a(n,vector<int>(m));
  int ans = 0;
  rep(i,m) cin >> b[i];
  rep(i,n)rep(j,m) cin >> a[i][j];
  rep(i,n) {
    int sum = 0;
    rep(j,m) {
      sum += a[i][j]*b[j];
    }
    if(sum+c > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int D = Integer.parseInt(sc.next());
        int[][] X = new int[N][D];
        double d = 0;
        int count = 0;

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < D; j++) {
                X[i][j] = Integer.parseInt(sc.next());
            }
        }

        for (int i = 0; i < N; i++) {
            for (int j = i; j < N - 1; j++) {
                for (int k = 0; k < D; k++) {
                    d += Math.abs(X[j + 1][k] - X[i][k]) * Math.abs(X[j + 1][k] - X[i][k]);
                }
                d = Math.sqrt(d);
                if (d == (int) d) {
                    count++;
                }
                d = 0;
            }
        }
        PrintWriter out = new PrintWriter(System.out);
        out.println(count);
        sc.close();
        out.flush();
    }
}

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

int main()
{

  int n,m,sum = 0;
  cin >> n >> m;
  int a[n];
  rep(i,n) {
    cin >> a[i];
    sum+=a[i];
  }
  sort(a,a + n);
  reverse(a,a + n);
  cout << ((double)a[m - 1] >= (double)sum / (4*m) ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle{
  int f[N2];
  int space;
  string path;

  bool operator < (const Puzzle &p) const{
    for(int i = 0; i < N2; i++){
      if(f[i] == p.f[i]) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p){
  for(int i = 0; i < N2; i++) if(p.f[i] != (i + 1)) return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while(!Q.empty()){
    u = Q.front();
    Q.pop();
    if(isTarget(u)) return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for(int r = 0; r < 4; r++){
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if(!V[v]){
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }

  return "unsolvable";
}

int main(){
  Puzzle in;

  for(int i = 0; i < N2; i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}

Measured memory_bytes: 30580
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;

int N;
string str;
ll cnte[300001], cntw[300001];

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

	cin >> N;
	cin >> str;

	for (int i = 0; i < str.length(); ++i) {
		if (str[i] == 'W') cntw[i + 1]++;
		else cnte[i + 1]++;
	}

	for (int i = 1; i <= N; ++i) {
		cntw[i] += cntw[i - 1];
		cnte[i] += cnte[i - 1];
	}

	ll res = 1e18;
	for (int i = 1; i <= N; ++i) {
		res = min(res, cntw[i - 1] + cnte[N] - cnte[i]);
	}

	cout << res;
}

Measured memory_bytes: 5396
s = input()
  
if s[0] == s[1]:
    if s[1] == s[2] and s[2] == s[3]:
        print('No')
    elif s[2] == s[3]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[2]:
    if s[1] == s[3]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[3]:
    if s[1] == s[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_S_LEN=1e5,MOD=1e9+7;
string S;
ll dp[MAX_S_LEN+1][13];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>S;
    dp[0][0]=1;
    REP(i,S.size()){
        REP(j,13){
            REP(k,10){
                if(S[i]=='0'+k || S[i]=='?'){
                    ll m=(j*10+k)%13;
                    dp[i+1][m]+=dp[i][j];
                    dp[i+1][m]%=MOD;
                }
            }
        }
    }
    cout<<dp[S.size()][5]<<endl;
}

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

int main() {
	int n;
	cin >> n;
	rep(i, 26) {
		rep(j, 15) {
			if (4 * i + 7 * j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
using namespace std;
#define pb push_back
#define MAX 1000005
int spf[MAX];
void SPF()
{
	int i,j;
	spf[0]=1;
	for(i=1;i<MAX;i++)	spf[i]=i;
	for(i=2;i<MAX;i++){
		if(spf[i]==i){
			for(j=i*i;j<MAX;j+=i){
				spf[j]=min(i,spf[j]);
			}
		}
	}
}
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int n;
	scanf("%lld",&n);
	int a[n];
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	SPF();
	map<int,int>ma;
	for(int i=0;i<n;i++){
		int x=a[i];
		map<int,int>temp;
		while(x!=1){
			temp[spf[x]]++;
			x/=spf[x];
		}
		for(auto it=temp.begin();it!=temp.end();it++){
			ma[it->first]++;
		}
	}
	bool ok=true;
	for(auto it=ma.begin();it!=ma.end();it++){
		if(ma[it->first]>1){
			ok=false;
		}
	}
	if(ok){
		cout << "pairwise coprime";
		return 0;
	}
	int g=0;
	for(int i=0;i<n;i++){
		g=__gcd(g,a[i]);
	}
	if(g==1){
		cout << "setwise coprime";
	}
	else{
		cout << "not coprime";
	}



	return 0;
}


Measured memory_bytes: 24040
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w,ans,x,y;
  ans=0;
  cin>>h>>w;
  vector<vector<char>> vec(h,vector<char>(w));
  vector<vector<int>> kanou(h,vector<int>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin>>vec.at(i).at(j);
      if(vec.at(i).at(j)=='.'){
        ans++;
      }
    }
  }
  kanou.at(0).at(0)=1;
  queue<int> basyo;
  basyo.push(0);
  while(0<basyo.size()){
    y=basyo.front();
    //cout<<y<<endl;
    if(y==h*w-1){
      break;
    }
    x=y%w;
    y=y/w;
    if(x!=0){
      if(vec.at(y).at(x-1)=='.' &&
        kanou.at(y).at(x-1)==0){
        kanou.at(y).at(x-1)=kanou.at(y).at(x)+1;
        basyo.push(y*w+x-1);
      }
    }
    if(y!=0){
      if(vec.at(y-1).at(x)=='.' &&
        kanou.at(y-1).at(x)==0){
        kanou.at(y-1).at(x)=kanou.at(y).at(x)+1;
        basyo.push((y-1)*w+x);
      }
    }
    if(x!=w-1){
      if(vec.at(y).at(x+1)=='.' &&
        kanou.at(y).at(x+1)==0){
        kanou.at(y).at(x+1)=kanou.at(y).at(x)+1;
        basyo.push(y*w+x+1);
      }
    }
    if(y!=h-1){
      if(vec.at(y+1).at(x)=='.' &&
        kanou.at(y+1).at(x)==0){
        kanou.at(y+1).at(x)=kanou.at(y).at(x)+1;
        basyo.push((y+1)*w+x);
        //cout<<(y+1)*w+x<<endl;
      }
    }
    
    basyo.pop();
  }
  if(kanou.at(h-1).at(w-1)!=0){
    cout<<ans-kanou.at(h-1).at(w-1);
  }
  else{
    ans=-1;
    cout<<ans;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define clt(x) 63-__builtin_clzll(x)
#define bct(x) __builtin_popcountll(x)
#define all(v) (v).begin(),(v).end()
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector<pair<ll,ll>>
#define maxq priority_queue<ll>
#define minq priority_queue<ll,vector<ll>, greater<ll>>
#define cont continue;
#define reto return 0;
#define sz size()
#define spmod 1116295198451
#define mod 1000000007
#define md 998244353 
#define N 200009
//typedef tree<int,null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> //pbds;
vi a[N];
bool v[N];
ll dfs(ll n)
{
  if(v[n])
    return 0;
  ll tot=1;
  v[n]=1;
  for(auto x:a[n])
    tot+=dfs(x);
  return tot;
}
vi ans;
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll l,r,n,m;
  cin>>n>>m;
  while(m--)
  {
    cin>>l>>r;
    a[l].pb(r);
    a[r].pb(l);
  }
  ll i=1;
  while(i<=n)
  {
    if(v[i]==0)
    {
      ans.pb(dfs(i));
    }
    i++;
  }
  sort(all(ans));
  ll sum=0,last=0;
  i=0;
  while(i<ans.size())
  {
    sum+=ans[i]-last;
    last=ans[i];
    i++;
  }
  deb(sum)
}

Measured memory_bytes: 21020
N,M=map(int,input().split())
ab=[]
for i in range(N):
    a,b=map(int,input().split())
    ab.append([a,b])
cd=[]
for i in range(M):
    c,d=map(int,input().split())
    cd.append([c,d])
for i in range(N):
    dis=10**30
    a,b=ab[i]
    ans=-1
    for j in range(M):
        c,d=cd[j]
        if abs(a-c)+abs(b-d)<dis:
            dis=abs(a-c)+abs(b-d)
            ans=j+1
    print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		if(s.charAt(s.length()-1)==s.charAt(0) && s.length()%2==0)System.out.println("First");
		else if(s.charAt(s.length()-1)!=s.charAt(0) && s.length()%2!=0)System.out.println("First");
		else System.out.println("Second");
	}
}
	

Measured memory_bytes: 24660
#include <bits/stdc++.h>
#define N 1000099
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define LL long long
using namespace std;
LL n;
int main()
{
    cin >> n;
    LL s = sqrt(n);
    for (int i = s; i >= 1; i--)
        if (n % i == 0)
        {
            cout << i + n / i - 2 << endl;
            break;
        }
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

const int inf = 10000;

int main(){
    int a[3][3];
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    int n;
    cin >> n;
    int b[n];
    rep(i, n) cin >> b[i];

    rep(k, n){
        rep(i, 3) rep(j, 3) if (b[k] == a[i][j]) a[i][j] = inf;
    }

    bool flag = false;

    rep(i, 3){
        if (a[i][0] + a[i][1] + a[i][2] == 3 * inf) flag = true;
    }
    rep(i, 3){
        if (a[0][i] + a[1][i] + a[2][i] == 3 * inf) flag = true;
    }
    if (a[0][0] + a[1][1] + a[2][2] == 3 * inf) flag = true;
    if (a[2][0] + a[1][1] + a[0][2] == 3 * inf) flag = true;


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

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,m,a[100][100],b[100],i,j,c;
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<m;i++){
        scanf("%d",&b[i]);
    }
    
    for(i=0;i<n;i++){
        c=0;
        for(j=0;j<m;j++){
            c=c+a[i][j]*b[j];
        }
        printf("%d\n",c);
    }
    return 0;
}

Measured memory_bytes: 636
#include <stdio.h>
int main(){
  char s[21];
  int i;
  scanf("%s",&s);
  for(i=0;i<20;i++){
    if(s[i]==0) break;
  }
  for(i=i-1;i>=0;i--){
     printf("%c",s[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 0
using System;
class Program
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            string input2 = Console.ReadLine();

            string[] n1 = new string[input1.Length];
            string[] n2 = new string[input2.Length];
            int count = 0;

            for(int i=0;i<input1.Length;i++)
            {
                n1[i] = input1.Substring(i,1);
                n2[i] = input2.Substring(i, 1);

                if(n1[i]==n2[i])
                {
                    count++;
                }
            
            }

            Console.WriteLine(count);
            Console.ReadLine();
           
        }
    }

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#include <iostream>
using namespace std;

int main() {
	ll int n,k;
	cin>>n>>k;
	vector<ll int> a(n);
	for(ll int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	ll int dp[n+1][k+1];
	memset(dp,0,sizeof(dp));
	//dp[0][0]=1;
/*	for(ll int i=0;i<=k;i++){
		dp[1][i]=i>a[0]?0:1;
	}*/
	
	ll int s=0;
	for(ll int i=1;i<=n;i++){
		s+=a[i-1];
		for(ll int j=0;j<=k;j++){
			if(j==0)dp[i][j]=1;
			if(j>s)break;
			else if(j!=0){
				dp[i][j]=((dp[i][j-1]%mod)+(dp[i-1][j]%mod))%mod;
			}
			if(j>a[i-1]){
				ll int t=j-a[i-1];
				dp[i][j]=mod+dp[i][j]%mod-dp[i-1][t-1]%mod;
			}
			dp[i][j]=dp[i][j]%mod;
		}
	}
	cout<<dp[n][k];
	return 0;
}

Measured memory_bytes: 79104
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 100
#define SSIZE 600
int main(){
	double stack[SSIZE];
	char str[SIZE];
	while(gets(str)){	//1行入力
		int i;
		int j;
		for(i=0;i<SSIZE;i++){
			stack[i]=0;
		}
		stack[0]=atof(strtok(str," "));//最初のトークンを取得
		i=1;
		while(1){
			char* buf=strtok(NULL," ");//1トークンずつ取得
			if(buf==NULL){//文が終わったら
				break;
			}
			
			if(!strcmp(buf,"+")){
				stack[i-2]+=stack[i-1];i--;
			}else if(!strcmp(buf,"-")){
				stack[i-2]-=stack[i-1];i--;
			}else if(!strcmp(buf,"*")){
				stack[i-2]*=stack[i-1];i--;
			}else if(!strcmp(buf,"/")){
				stack[i-2]/=stack[i-1];i--;
			}else{
				stack[i]=atof(buf);i++;
			}
		}
		printf("%f\n",stack[0]);
	}
	return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
using namespace std;
typedef tuple<string, int, int> T;

int main() {
  int N; cin >> N;
  vector<T> v;
  for (int i = 0; i < N; i++) {
    string s; int x; cin >> s >> x; x = 100-x;
    v.push_back(T(s,x,i+1));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < N; i++) {
    T t = v[i]; 
    cout << get<2>(t) << endl;
  }
}
  

Measured memory_bytes: 256
def input_one_number():
    return int(input())


D = input_one_number()

def input_multiple_number_as_list():
    return list(map(int, input().split()))

c = input_multiple_number_as_list()

s = [[]*26 for _ in range(D)]

for i in range(D):
	s[i] = input_multiple_number_as_list()

for day in range(D):
	m = max(s[day])
	#print(s[day].index(m))
	print((s[day].index(m)+14)%26+1)

Measured memory_bytes: 9512
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

ll powll ( ll x, ll y ) {
    if ( y == 0 ) return 1;
    return x*powll(x, y-1);
}

int main()
{
    int x;

    cin >> x;

    ll ans = 0;
    rep(i, 100) {
        reep(j, 2, 10) {
            ll y = powll(i, j);

            if ( y <= x ) {
                ans = max(ans, y);
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

ll p(ll a, ll b) {
  ll i;
  for(i = 0; i < b; ++i) a /= 10;
  return a % 10;
}

ll pow(ll a) {
  ll i, ans = 1;
  for(i = 0; i < a; ++i) ans *= 10;
  return ans;
}

ll s(ll a) {
  ll ans = 0;
  while(a) ans += a % 10, a /= 10;
  return ans;
}

ll nex(ll sn, ll min) {
  ll a = s(min), i, b;
  if(a == sn) return min;
  if(a < sn) {
    for(i = 0; a < sn; ++i) {
      b = p(min, i);
      if(a + 9 - b > sn) min += pow(i) * (sn - a), a = sn;
      else a += 9 - b, min += pow(i) * (9 - b);
    }
    return min;
  }
  for(i = 0; s(min) > sn; ++i) if(p(min, i)) min += (10 - p(min, i)) * pow(i);
  min += sn - s(min);
  return min;
}

int main(void) {
  ll i, j, n, k, ans[140], m, now;
  double min;
  scanf("%lld", &k);
  if(k < 10) {
    for(i = 1; i <= k; ++i) printf("%lld\n", i);
    return 0;
  }
  k -= 9;
  for(i = 1; i < 10; ++i) printf("%lld\n", i);
  for(i = 1; i < 140; ++i) ans[i] = nex(i, 10);
  for(i = 0; i < k; ++i) {
    min = 1e15;
    for(j = 1; j < 140; ++j) if(((double)ans[j] / j) < min)
      min = (double)ans[j] / j, m = j;
    now = ans[m];
    printf("%lld\n", now);
    for(j = 1; j < 140; ++j) if(ans[j] <= now) ans[j] = nex(j, now + 1);
  }
  return 0;
}

Measured memory_bytes: 128
import Control.Applicative ((<$>))
import Data.List (unfoldr)

main :: IO ()
main = solve <$> readLn >>= print

solve :: Integer -> Integer
solve = foldr (\a b -> a + 10 * b) 0 . unfoldr f
  where f x | x == 0 = Nothing
            | even x = Just (0, x `div` (-2))
            | otherwise = Just (1, (x-1) `div` (-2))


Measured memory_bytes: 508
import copy

n=int(input())
a=list(map(int,input().split()))
x=abs(a[0])+abs(a[-1])
for i in range(n-1):
  x+=abs(a[i+1]-a[i])
for i in range(n):
  dp=copy.deepcopy(x)
  if i==0:
    dp=dp-abs(a[1]-a[0])-abs(a[0])+abs(a[1])
  if i==n-1:
    dp=dp-abs(a[-1])-abs(a[-1]-a[-2])+abs(a[n-2])
  elif 0<i<n-1:
    dp=dp-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1])
  print(dp)

Measured memory_bytes: 14560
from collections import defaultdict as dd
import sys
sys.setrecursionlimit(6000)
N, M, P = map(int, input().split())
edges = []
revedgedict = dd(dict)
for _ in range(M):
  f, t, c = map(int, input().split())
  edges.append((f-1, t-1, -(c-P)))
  revedgedict[t-1][f-1] = 1

# Nに到達できない頂点を削除
visited = [False] * N
def dfs(f):
  visited[f] = True
  for t in revedgedict[f].keys():
    if not visited[t]:
      dfs(t)
dfs(N-1)

# ベルマンフォード
INF = float('inf')
d = [float('inf')] * N
d[0] = 0
for i in range(N):
  updated = False
  for f, t, c in edges:
    if d[f] != INF and visited[t] and d[t] > d[f] + c:
      d[t] = d[f] + c
      updated = True
  if not updated:
    break
else:
  print(-1)
  exit()
print(max(-d[-1], 0))


Measured memory_bytes: 55640